1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-22 08:38:26 +02:00

gui_status.c (show_pad_type): share pad type to name translation

... and move to new function pad_type_name in layer.c
This commit is contained in:
Werner Almesberger 2012-07-18 19:52:19 -03:00
parent 54434e9ab3
commit 57dbeb1aad
3 changed files with 26 additions and 26 deletions

View File

@ -24,6 +24,7 @@
#include "error.h" #include "error.h"
#include "unparse.h" #include "unparse.h"
#include "obj.h" #include "obj.h"
#include "layer.h"
#include "gui_util.h" #include "gui_util.h"
#include "gui_style.h" #include "gui_style.h"
#include "gui_canvas.h" #include "gui_canvas.h"
@ -195,28 +196,7 @@ static GtkWidget *pad_type;
static void show_pad_type(void) static void show_pad_type(void)
{ {
const char *s; gtk_label_set_text(GTK_LABEL(pad_type), pad_type_name(*curr_pad_type));
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);
} }

23
layer.c
View File

@ -1,8 +1,8 @@
/* /*
* layer.c - PCB layers on a pad * layer.c - PCB layers on a pad
* *
* Written 2009-2011 by Werner Almesberger * Written 2009-2012 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger * Copyright 2009-2012 by Werner Almesberger
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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 ---------------------------------------- */ /* ----- layers in mechanical holes ---------------------------------------- */

View File

@ -1,8 +1,8 @@
/* /*
* layer.h - PCB layers on a pad * layer.h - PCB layers on a pad
* *
* Written 2009-2011 by Werner Almesberger * Written 2009-2012 by Werner Almesberger
* Copyright 2009-2011 by Werner Almesberger * Copyright 2009-2012 by Werner Almesberger
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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); layer_type pad_type_to_layers(enum pad_type type);
enum pad_type layers_to_pad_type(layer_type layers); 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); layer_type mech_hole_layers(void);