From 57dbeb1aadf3d3fad2e5bebcc9a1d147b9f22019 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 18 Jul 2012 19:52:19 -0300 Subject: [PATCH] gui_status.c (show_pad_type): share pad type to name translation ... and move to new function pad_type_name in layer.c --- gui_status.c | 24 ++---------------------- layer.c | 23 +++++++++++++++++++++-- layer.h | 5 +++-- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/gui_status.c b/gui_status.c index 05d92e0..222a144 100644 --- a/gui_status.c +++ b/gui_status.c @@ -24,6 +24,7 @@ #include "error.h" #include "unparse.h" #include "obj.h" +#include "layer.h" #include "gui_util.h" #include "gui_style.h" #include "gui_canvas.h" @@ -195,28 +196,7 @@ static GtkWidget *pad_type; static void show_pad_type(void) { - const char *s; - - switch (*curr_pad_type) { - case pt_normal: - s = "normal"; - break; - case pt_bare: - s = "bare"; - break; - case pt_trace: - s = "trace"; - break; - case pt_paste: - s = "paste"; - break; - case pt_mask: - s = "mask"; - break; - default: - abort(); - } - gtk_label_set_text(GTK_LABEL(pad_type), s); + gtk_label_set_text(GTK_LABEL(pad_type), pad_type_name(*curr_pad_type)); } diff --git a/layer.c b/layer.c index b6a533c..b62533c 100644 --- a/layer.c +++ b/layer.c @@ -1,8 +1,8 @@ /* * layer.c - PCB layers on a pad * - * Written 2009-2011 by Werner Almesberger - * Copyright 2009-2011 by Werner Almesberger + * Written 2009-2012 by Werner Almesberger + * Copyright 2009-2012 by Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,6 +86,25 @@ enum pad_type layers_to_pad_type(layer_type layers) } +const char *pad_type_name(enum pad_type type) +{ + switch (type) { + case pt_normal: + return "normal"; + case pt_bare: + return "bare"; + case pt_trace: + return "trace"; + case pt_paste: + return "paste"; + case pt_mask: + return "mask"; + default: + abort(); + } +} + + /* ----- layers in mechanical holes ---------------------------------------- */ diff --git a/layer.h b/layer.h index 873e99c..b52a362 100644 --- a/layer.h +++ b/layer.h @@ -1,8 +1,8 @@ /* * layer.h - PCB layers on a pad * - * Written 2009-2011 by Werner Almesberger - * Copyright 2009-2011 by Werner Almesberger + * Written 2009-2012 by Werner Almesberger + * Copyright 2009-2012 by Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,6 +75,7 @@ enum pad_type { layer_type pad_type_to_layers(enum pad_type type); enum pad_type layers_to_pad_type(layer_type layers); +const char *pad_type_name(enum pad_type type); layer_type mech_hole_layers(void);