Initial import of gattrib 20040806
[geda-gaf/whiteaudio.git] / gattrib / include / struct.h
blob019413694b1fd374feb2e02f8184c7bab9615d97
1 /* gEDA - GPL Electronic Design Automation
2 * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
3 * Copyright (C) 2003 Stuart D. Brorson.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
20 /* ----------------------------------------------------------------- *
21 * This file holds definitions of the structures used in gattrib.
22 * ----------------------------------------------------------------- */
25 #ifndef SHEET_DATA_STRUCT
26 #define SHEET_DATA_STRUCT
28 #include <gtk/gtk.h>
29 #include <gdk/gdk.h>
30 #include <gdk/gdkkeysyms.h>
32 #include <glib.h>
33 #ifdef HAS_GTK22
34 #include <glib-object.h>
35 #endif
37 /* ------- Includes needed to make the GTK stuff work ------ */
39 #ifdef HAS_GTK22
40 #include "gtksheet_2_2.h"
41 #include "gtkitementry_2_2.h"
42 #else
43 #include "gtksheet_1_2.h"
44 #include "gtkitementry_1_2.h"
45 #endif
47 #include "pixmaps.h"
49 /* ======== Data structures used in processing below here ========== */
52 /* ----------------------------------------------------------------- *
53 * This struct used in dealing with guile's read-in of the rc files.
54 * ----------------------------------------------------------------- */
55 typedef struct {
56 int m_val;
57 char *m_str;
58 } vstbl_entry;
61 /* ----------------------------------------------------------------- *
62 * The sheet data hierarchy built by the prog should look like this:
63 * SHEET_DATA->(STRING_LIST *master_XXX_list) // list of comps/nets/pins (row labels)
64 * ->(STRING_LIST *master_XXX_attrib_list) // list of attached names (column labels)
65 * ->(TABLE *XXX_table) // table of attrib values (table entries)
66 * ----------------------------------------------------------------- */
67 typedef struct st_sheet_data SHEET_DATA;
68 typedef struct st_table TABLE;
69 typedef struct st_string_list STRING_LIST;
70 typedef struct st_pin_list PIN_LIST;
71 typedef struct st_main_window MAIN_WINDOW;
74 /* -------------------------------------------------------------------- *
75 * st_sheet_data defines SHEET_DATA, and holds master lists holding
76 * sorted lists of comp/netlist names. Also holds pointers to the heads
77 * of the attribute-holding component and net structures.
78 * -------------------------------------------------------------------- */
79 struct st_sheet_data {
80 STRING_LIST *master_comp_list_head; /* Sorted list of all component refdeses used in design */
81 STRING_LIST *master_comp_attrib_list_head; /* Sorted list of all component attribs used in design */
82 int comp_count; /* This cannnot change -- user must edit design using gschem */
83 int comp_attrib_count; /* This can change in this prog if the user adds attribs */
85 STRING_LIST *master_net_list_head; /* Sorted list of all net names used in design */
86 STRING_LIST *master_net_attrib_list_head; /* Sorted list of all net attribs used in design */
87 int net_count; /* This cannnot change -- user must edit design using gschem */
88 int net_attrib_count; /* This can change in this prog if the user adds attribs */
90 STRING_LIST *master_pin_list_head; /* Sorted list of all refdes:pin items used in design. */
91 STRING_LIST *master_pin_attrib_list_head; /* Sorted list of all pin attribs used in design */
92 int pin_count; /* This cannnot change -- user must edit design using gschem */
93 int pin_attrib_count; /* This can change in this prog if the user adds attribs */
95 TABLE **component_table; /* points to 2d array of component attribs */
96 TABLE **net_table; /* points to 2d array of net attribs */
97 TABLE **pin_table; /* points to 2d array of pin attribs */
102 /* -------------------------------------------------------------------- *
103 * st_table defined what is held in a spreadsheet cell for both
104 * comp and net spreadsheets. Holds pointer to individual comp/net name, and
105 * pointer to attrib list. Ideally, the name pointer points to the
106 * refdes/netname string held in the TOPLEVEL data structure, so that
107 * when SHEET_DATA is manipulated, so is TOPLEVEL.
108 * -------------------------------------------------------------------- */
109 #define ATTRIB_VIS_INVISIBLE 0
110 #define ATTRIB_VIS_VALUE_ONLY 1
111 #define ATTRIB_VIS_NAME_ONLY 2
112 #define ATTRIB_VIS_BOTH 3
113 struct st_table {
114 int row; /* location on spreadsheet */
115 int col; /* location on spreadsheet */
116 gchar *row_name; /* comp, net, or refdes:pin name */
117 gchar *col_name; /* attrib name */
118 gchar *attrib_value; /* attrib value */
119 int visibility; /* 0 = invisible, 1 = value only, 2 = name only,
120 * 3 = both name & value visible */
125 /* -------------------------------------------------------------------- *
126 * STRING_LIST is a list of strings. This struct is used for several
127 * different jobs, including serving as base class for master lists.
128 * -------------------------------------------------------------------- */
129 struct st_string_list {
130 gchar *data; /* holds string */
131 int pos; /* pos on spreadsheet */
132 int length; /* number of items in list */
133 STRING_LIST *prev;
134 STRING_LIST *next;
137 /* -------------------------------------------------------------------- *
138 * PIN_LIST is a special struct used for keeping track of pins. Since
139 * the master_pin_list must keep track of both refdes and pin, we need a
140 * special struct for pins. Later processing will for a STRING_LIST
141 * of refdes:pinnumber pairs for insertion in the spreadsheet.
142 * -------------------------------------------------------------------- */
143 struct st_pin_list {
144 gchar *refdes; /* holds refdes string */
145 gint pinnumber;
146 gchar *pinlabel; /* holds pin label string */
147 int pos; /* pos on spreadsheet */
148 int length; /* number of items in list */
149 PIN_LIST *prev;
150 PIN_LIST *next;
153 #endif