Date:2012-07-19 00:52:19 (7 years 4 months ago)
Author:Werner Almesberger
Commit:57dbeb1aadf3d3fad2e5bebcc9a1d147b9f22019
Message:gui_status.c (show_pad_type): share pad type to name translation

... and move to new function pad_type_name in layer.c
Files: gui_status.c (2 diffs)
layer.c (2 diffs)
layer.h (2 diffs)

Change Details

gui_status.c
2424#include "error.h"
2525#include "unparse.h"
2626#include "obj.h"
27#include "layer.h"
2728#include "gui_util.h"
2829#include "gui_style.h"
2930#include "gui_canvas.h"
...... 
195196
196197static void show_pad_type(void)
197198{
198    const char *s;
199
200    switch (*curr_pad_type) {
201    case pt_normal:
202        s = "normal";
203        break;
204    case pt_bare:
205        s = "bare";
206        break;
207    case pt_trace:
208        s = "trace";
209        break;
210    case pt_paste:
211        s = "paste";
212        break;
213    case pt_mask:
214        s = "mask";
215        break;
216    default:
217        abort();
218    }
219    gtk_label_set_text(GTK_LABEL(pad_type), s);
199    gtk_label_set_text(GTK_LABEL(pad_type), pad_type_name(*curr_pad_type));
220200}
221201
222202
layer.c
11/*
22 * layer.c - PCB layers on a pad
33 *
4 * Written 2009-2011 by Werner Almesberger
5 * Copyright 2009-2011 by Werner Almesberger
4 * Written 2009-2012 by Werner Almesberger
5 * Copyright 2009-2012 by Werner Almesberger
66 *
77 * This program is free software; you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
...... 
8686}
8787
8888
89const char *pad_type_name(enum pad_type type)
90{
91    switch (type) {
92    case pt_normal:
93        return "normal";
94    case pt_bare:
95        return "bare";
96    case pt_trace:
97        return "trace";
98    case pt_paste:
99        return "paste";
100    case pt_mask:
101        return "mask";
102    default:
103        abort();
104    }
105}
106
107
89108/* ----- layers in mechanical holes ---------------------------------------- */
90109
91110
layer.h
11/*
22 * layer.h - PCB layers on a pad
33 *
4 * Written 2009-2011 by Werner Almesberger
5 * Copyright 2009-2011 by Werner Almesberger
4 * Written 2009-2012 by Werner Almesberger
5 * Copyright 2009-2012 by Werner Almesberger
66 *
77 * This program is free software; you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
...... 
7575
7676layer_type pad_type_to_layers(enum pad_type type);
7777enum pad_type layers_to_pad_type(layer_type layers);
78const char *pad_type_name(enum pad_type type);
7879
7980layer_type mech_hole_layers(void);
8081

Archive Download the corresponding diff file

Branches:
master



interactive