[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-user: [PATCH 1/4][PCB] Remove color fields from PCBType data strucutre
Currently color preferences are loaded/saved globally thus they don't need
to be stored in the PCBType struct. All references to colors previously
stored in the PCBType struct have been updated with the cooresponding
color stored in the global SettingType structure.
Signed-off-by: Peter Tyser <ptyser@xxxxxxxxx>
---
src/autoroute.c | 2 +-
src/create.c | 18 +-------
src/draw.c | 96 +++++++++++++++++++++---------------------
src/global.h | 11 -----
src/hid/gtk/gui-top-window.c | 12 +++---
src/hid/lesstif/menu.c | 12 +++---
src/print.c | 6 +-
src/rtree.c | 6 +-
8 files changed, 68 insertions(+), 95 deletions(-)
diff --git a/src/autoroute.c b/src/autoroute.c
index 5c689e4..bf67e48 100644
--- a/src/autoroute.c
+++ b/src/autoroute.c
@@ -2525,7 +2525,7 @@ RD_DrawVia (routedata_t * rd, LocationType X, LocationType Y,
if (TEST_FLAG (LIVEROUTEFLAG, PCB))
{
- gui->set_color (ar_gc, PCB->ViaColor);
+ gui->set_color (ar_gc, Settings.ViaColor);
gui->fill_circle (ar_gc, X, Y, radius);
}
}
diff --git a/src/create.c b/src/create.c
index fa0a394..37cd839 100644
--- a/src/create.c
+++ b/src/create.c
@@ -86,29 +86,13 @@ CreateNewBuffer (void)
}
/* ---------------------------------------------------------------------------
- * Perhaps PCB should internally just use the Settings colors? For now,
- * use this to set PCB colors so the config can reassign PCB colors.
+ * Update layer colors from Settings structure
*/
void
pcb_colors_from_settings (PCBTypePtr ptr)
{
int i;
- /* copy default settings */
- ptr->ConnectedColor = Settings.ConnectedColor;
- ptr->ElementColor = Settings.ElementColor;
- ptr->RatColor = Settings.RatColor;
- ptr->InvisibleObjectsColor = Settings.InvisibleObjectsColor;
- ptr->InvisibleMarkColor = Settings.InvisibleMarkColor;
- ptr->ElementSelectedColor = Settings.ElementSelectedColor;
- ptr->RatSelectedColor = Settings.RatSelectedColor;
- ptr->PinColor = Settings.PinColor;
- ptr->PinSelectedColor = Settings.PinSelectedColor;
- ptr->PinNameColor = Settings.PinNameColor;
- ptr->ViaColor = Settings.ViaColor;
- ptr->ViaSelectedColor = Settings.ViaSelectedColor;
- ptr->WarnColor = Settings.WarnColor;
- ptr->MaskColor = Settings.MaskColor;
for (i = 0; i < MAX_LAYER; i++)
{
ptr->Data->Layer[i].Color = Settings.LayerColor[i];
diff --git a/src/draw.c b/src/draw.c
index 6d03be8..b8519d8 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -129,14 +129,14 @@ SetPVColor (PinTypePtr Pin, int Type)
&& TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin))
{
if (TEST_FLAG (WARNFLAG, Pin))
- color = PCB->WarnColor;
+ color = Settings.WarnColor;
else if (TEST_FLAG (SELECTEDFLAG, Pin))
- color = PCB->ViaSelectedColor;
+ color = Settings.ViaSelectedColor;
else
- color = PCB->ConnectedColor;
+ color = Settings.ConnectedColor;
}
else
- color = PCB->ViaColor;
+ color = Settings.ViaColor;
}
else
{
@@ -144,14 +144,14 @@ SetPVColor (PinTypePtr Pin, int Type)
&& TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pin))
{
if (TEST_FLAG (WARNFLAG, Pin))
- color = PCB->WarnColor;
+ color = Settings.WarnColor;
else if (TEST_FLAG (SELECTEDFLAG, Pin))
- color = PCB->PinSelectedColor;
+ color = Settings.PinSelectedColor;
else
- color = PCB->ConnectedColor;
+ color = Settings.ConnectedColor;
}
else
- color = PCB->PinColor;
+ color = Settings.PinColor;
}
gui->set_color (Output.fgGC, color);
@@ -397,8 +397,8 @@ DrawEverything (BoxTypePtr drawn_area)
/* This is the reverse of the order in which we draw them. */
int drawn_groups[MAX_LAYER];
- PCB->Data->SILKLAYER.Color = PCB->ElementColor;
- PCB->Data->BACKSILKLAYER.Color = PCB->InvisibleObjectsColor;
+ PCB->Data->SILKLAYER.Color = Settings.ElementColor;
+ PCB->Data->BACKSILKLAYER.Color = Settings.InvisibleObjectsColor;
memset (do_group, 0, sizeof (do_group));
for (ngroups = 0, i = 0; i < max_layer; i++)
@@ -557,7 +557,7 @@ DrawEverything (BoxTypePtr drawn_area)
doit = gui->set_layer ("toppaste", SL (PASTE, TOP), NoData);
if (doit)
{
- gui->set_color (Output.fgGC, PCB->ElementColor);
+ gui->set_color (Output.fgGC, Settings.ElementColor);
ALLPAD_LOOP (PCB->Data);
{
if ((TEST_FLAG (ONSOLDERFLAG, pad) && side == SOLDER_LAYER)
@@ -595,8 +595,8 @@ DrawEMark (ElementTypePtr e, LocationType X, LocationType Y,
if (e->PadN && mark_size > e->Pad[0].Thickness / 2)
mark_size = e->Pad[0].Thickness / 2;
- gui->set_color (Output.fgGC,
- invisible ? PCB->InvisibleMarkColor : PCB->ElementColor);
+ gui->set_color (Output.fgGC, invisible ?
+ Settings.InvisibleMarkColor : Settings.ElementColor);
gui->set_line_cap (Output.fgGC, Trace_Cap);
gui->set_line_width (Output.fgGC, 1);
gui->draw_line (Output.fgGC, X - mark_size, Y, X, Y - mark_size);
@@ -763,13 +763,13 @@ DrawMask (BoxType * screen)
info.arg = True;
if (thin)
- gui->set_color (Output.pmGC, PCB->MaskColor);
+ gui->set_color (Output.pmGC, Settings.MaskColor);
else
{
if (gui->poly_before)
{
gui->use_mask (HID_MASK_BEFORE);
- gui->set_color (out->fgGC, PCB->MaskColor);
+ gui->set_color (out->fgGC, Settings.MaskColor);
gui->fill_rect (out->fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
}
gui->use_mask (HID_MASK_CLEAR);
@@ -786,7 +786,7 @@ DrawMask (BoxType * screen)
if (gui->poly_after)
{
gui->use_mask (HID_MASK_AFTER);
- gui->set_color (out->fgGC, PCB->MaskColor);
+ gui->set_color (out->fgGC, Settings.MaskColor);
gui->fill_rect (out->fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
}
gui->use_mask (HID_MASK_OFF);
@@ -1111,9 +1111,9 @@ DrawHole (PinTypePtr Ptr)
if (TEST_FLAG (HOLEFLAG, Ptr))
{
if (TEST_FLAG (WARNFLAG, Ptr))
- gui->set_color (Output.fgGC, PCB->WarnColor);
+ gui->set_color (Output.fgGC, Settings.WarnColor);
else if (TEST_FLAG (SELECTEDFLAG, Ptr))
- gui->set_color (Output.fgGC, PCB->ViaSelectedColor);
+ gui->set_color (Output.fgGC, Settings.ViaSelectedColor);
else
gui->set_color (Output.fgGC, Settings.BlackColor);
@@ -1318,7 +1318,7 @@ DrawPinOrViaNameLowLevel (PinTypePtr Ptr)
/*printf("DrawPin(%d,%d): x=%d y=%d w=%d h=%d\n",
TO_DRAW_X(Ptr->X), TO_DRAW_Y(Ptr->Y), box.X1, box.Y1, width, height);*/
- gui->set_color (Output.fgGC, PCB->PinNameColor);
+ gui->set_color (Output.fgGC, Settings.PinNameColor);
text.Flags = NoFlags ();
text.Scale = Ptr->Thickness / 80;
@@ -1541,7 +1541,7 @@ DrawPadNameLowLevel (PadTypePtr Pad)
return;
}
- gui->set_color (Output.fgGC, PCB->PinNameColor);
+ gui->set_color (Output.fgGC, Settings.PinNameColor);
text.Flags = NoFlags ();
text.Scale = Pad->Thickness / 50;
@@ -1798,9 +1798,9 @@ DrawViaName (PinTypePtr Via, int unused)
if (!Gathering)
{
if (TEST_FLAG (SELECTEDFLAG, Via))
- gui->set_color (Output.fgGC, PCB->ViaSelectedColor);
+ gui->set_color (Output.fgGC, Settings.ViaSelectedColor);
else
- gui->set_color (Output.fgGC, PCB->ViaColor);
+ gui->set_color (Output.fgGC, Settings.ViaColor);
}
DrawPinOrViaNameLowLevel (Via);
}
@@ -1846,9 +1846,9 @@ DrawPinName (PinTypePtr Pin, int unused)
if (!Gathering)
{
if (TEST_FLAG (SELECTEDFLAG, Pin))
- gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ gui->set_color (Output.fgGC, Settings.PinSelectedColor);
else
- gui->set_color (Output.fgGC, PCB->PinColor);
+ gui->set_color (Output.fgGC, Settings.PinColor);
}
DrawPinOrViaNameLowLevel (Pin);
}
@@ -1862,20 +1862,20 @@ DrawPad (PadTypePtr Pad, int unused)
if (!Gathering)
{
if (doing_pinout)
- gui->set_color (Output.fgGC, PCB->PinColor);
+ gui->set_color (Output.fgGC, Settings.PinColor);
else if (TEST_FLAG (WARNFLAG | SELECTEDFLAG | FOUNDFLAG, Pad))
{
if (TEST_FLAG (WARNFLAG, Pad))
- gui->set_color (Output.fgGC, PCB->WarnColor);
+ gui->set_color (Output.fgGC, Settings.WarnColor);
else if (TEST_FLAG (SELECTEDFLAG, Pad))
- gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ gui->set_color (Output.fgGC, Settings.PinSelectedColor);
else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ gui->set_color (Output.fgGC, Settings.ConnectedColor);
}
else if (FRONT (Pad))
- gui->set_color (Output.fgGC, PCB->PinColor);
+ gui->set_color (Output.fgGC, Settings.PinColor);
else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
+ gui->set_color (Output.fgGC, Settings.InvisibleObjectsColor);
}
DrawPadLowLevel (Output.fgGC, Pad, False, False);
if (doing_pinout || TEST_FLAG (DISPLAYNAMEFLAG, Pad))
@@ -1891,11 +1891,11 @@ DrawPadName (PadTypePtr Pad, int unused)
if (!Gathering)
{
if (TEST_FLAG (SELECTEDFLAG, Pad))
- gui->set_color (Output.fgGC, PCB->PinSelectedColor);
+ gui->set_color (Output.fgGC, Settings.PinSelectedColor);
else if (FRONT (Pad))
- gui->set_color (Output.fgGC, PCB->PinColor);
+ gui->set_color (Output.fgGC, Settings.PinColor);
else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
+ gui->set_color (Output.fgGC, Settings.InvisibleObjectsColor);
}
DrawPadNameLowLevel (Pad);
}
@@ -1913,7 +1913,7 @@ DrawLine (LayerTypePtr Layer, LineTypePtr Line, int unused)
if (TEST_FLAG (SELECTEDFLAG, Line))
gui->set_color (Output.fgGC, Layer->SelectedColor);
else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ gui->set_color (Output.fgGC, Settings.ConnectedColor);
}
else
gui->set_color (Output.fgGC, Layer->Color);
@@ -1932,12 +1932,12 @@ DrawRat (RatTypePtr Line, int unused)
if (TEST_FLAG (SELECTEDFLAG | FOUNDFLAG, Line))
{
if (TEST_FLAG (SELECTEDFLAG, Line))
- gui->set_color (Output.fgGC, PCB->RatSelectedColor);
+ gui->set_color (Output.fgGC, Settings.RatSelectedColor);
else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ gui->set_color (Output.fgGC, Settings.ConnectedColor);
}
else
- gui->set_color (Output.fgGC, PCB->RatColor);
+ gui->set_color (Output.fgGC, Settings.RatColor);
}
if (Settings.RatThickness < 20)
Line->Thickness = pixel_slop * Settings.RatThickness;
@@ -1985,7 +1985,7 @@ DrawArc (LayerTypePtr Layer, ArcTypePtr Arc, int unused)
if (TEST_FLAG (SELECTEDFLAG, Arc))
gui->set_color (Output.fgGC, Layer->SelectedColor);
else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ gui->set_color (Output.fgGC, Settings.ConnectedColor);
}
else
gui->set_color (Output.fgGC, Layer->Color);
@@ -2053,7 +2053,7 @@ DrawPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon, int unused)
if (TEST_FLAG (SELECTEDFLAG, Polygon))
gui->set_color (Output.fgGC, Layer->SelectedColor);
else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ gui->set_color (Output.fgGC, Settings.ConnectedColor);
}
else
gui->set_color (Output.fgGC, Layer->Color);
@@ -2107,7 +2107,7 @@ DrawPlainPolygon (LayerTypePtr Layer, PolygonTypePtr Polygon)
if (TEST_FLAG (SELECTEDFLAG, Polygon))
gui->set_color (Output.fgGC, Layer->SelectedColor);
else
- gui->set_color (Output.fgGC, PCB->ConnectedColor);
+ gui->set_color (Output.fgGC, Settings.ConnectedColor);
}
else
gui->set_color (Output.fgGC, Layer->Color);
@@ -2188,13 +2188,13 @@ DrawElementName (ElementTypePtr Element, int unused)
if (TEST_FLAG (HIDENAMEFLAG, Element))
return;
if (doing_pinout || doing_assy)
- gui->set_color (Output.fgGC, PCB->ElementColor);
+ gui->set_color (Output.fgGC, Settings.ElementColor);
else if (TEST_FLAG (SELECTEDFLAG, &ELEMENT_TEXT (PCB, Element)))
- gui->set_color (Output.fgGC, PCB->ElementSelectedColor);
+ gui->set_color (Output.fgGC, Settings.ElementSelectedColor);
else if (FRONT (Element))
- gui->set_color (Output.fgGC, PCB->ElementColor);
+ gui->set_color (Output.fgGC, Settings.ElementColor);
else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
+ gui->set_color (Output.fgGC, Settings.InvisibleObjectsColor);
DrawTextLowLevel (&ELEMENT_TEXT (PCB, Element), PCB->minSlk);
}
@@ -2206,13 +2206,13 @@ DrawElementPackage (ElementTypePtr Element, int unused)
{
/* set color and draw lines, arcs, text and pins */
if (doing_pinout || doing_assy)
- gui->set_color (Output.fgGC, PCB->ElementColor);
+ gui->set_color (Output.fgGC, Settings.ElementColor);
else if (TEST_FLAG (SELECTEDFLAG, Element))
- gui->set_color (Output.fgGC, PCB->ElementSelectedColor);
+ gui->set_color (Output.fgGC, Settings.ElementSelectedColor);
else if (FRONT (Element))
- gui->set_color (Output.fgGC, PCB->ElementColor);
+ gui->set_color (Output.fgGC, Settings.ElementColor);
else
- gui->set_color (Output.fgGC, PCB->InvisibleObjectsColor);
+ gui->set_color (Output.fgGC, Settings.InvisibleObjectsColor);
DrawElementPackageLowLevel (Element, unused);
}
diff --git a/src/global.h b/src/global.h
index 767808f..53668ce 100644
--- a/src/global.h
+++ b/src/global.h
@@ -421,17 +421,6 @@ typedef struct PCBType
ViaOn, /* visibility flags */
ElementOn, RatOn, InvisibleObjectsOn, PinOn, SilkActive, /* active layer is actually silk */
RatDraw; /* we're drawing rats */
- char *ViaColor, /* some colors */
- *ViaSelectedColor,
- *PinColor,
- *PinSelectedColor,
- *PinNameColor,
- *ElementColor,
- *RatColor,
- *InvisibleObjectsColor,
- *InvisibleMarkColor,
- *ElementSelectedColor,
- *RatSelectedColor, *ConnectedColor, *WarnColor, *MaskColor;
long CursorX, /* cursor position as saved with layout */
CursorY, Clipping;
int Bloat, /* drc sizes saved with layout */
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 3812e68..6fbc9fb 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -996,32 +996,32 @@ layer_process (gchar **color_string, char **text, int *set, int i)
switch (i)
{
case LAYER_BUTTON_SILK:
- *color_string = PCB->ElementColor;
+ *color_string = Settings.ElementColor;
*text = _( "silk");
*set = PCB->ElementOn;
break;
case LAYER_BUTTON_RATS:
- *color_string = PCB->RatColor;
+ *color_string = Settings.RatColor;
*text = _( "rat lines");
*set = PCB->RatOn;
break;
case LAYER_BUTTON_PINS:
- *color_string = PCB->PinColor;
+ *color_string = Settings.PinColor;
*text = _( "pins/pads");
*set = PCB->PinOn;
break;
case LAYER_BUTTON_VIAS:
- *color_string = PCB->ViaColor;
+ *color_string = Settings.ViaColor;
*text = _( "vias");
*set = PCB->ViaOn;
break;
case LAYER_BUTTON_FARSIDE:
- *color_string = PCB->InvisibleObjectsColor;
+ *color_string = Settings.InvisibleObjectsColor;
*text = _( "far side");
*set = PCB->InvisibleObjectsOn;
break;
case LAYER_BUTTON_MASK:
- *color_string = PCB->MaskColor;
+ *color_string = Settings.MaskColor;
*text = _( "solder mask");
*set = TEST_FLAG (SHOWMASKFLAG, PCB);
break;
diff --git a/src/hid/lesstif/menu.c b/src/hid/lesstif/menu.c
index 266b5de..8e883f7 100644
--- a/src/hid/lesstif/menu.c
+++ b/src/hid/lesstif/menu.c
@@ -186,13 +186,13 @@ LayersChanged (int argc, char **argv, int x, int y)
DataType *d = PCB->Data;
for (i = 0; i < MAX_LAYER; i++)
fg_colors[i] = lesstif_parse_color (d->Layer[i].Color);
- fg_colors[LB_SILK] = lesstif_parse_color (PCB->ElementColor);
- fg_colors[LB_RATS] = lesstif_parse_color (PCB->RatColor);
- fg_colors[LB_PINS] = lesstif_parse_color (PCB->PinColor);
- fg_colors[LB_VIAS] = lesstif_parse_color (PCB->ViaColor);
+ fg_colors[LB_SILK] = lesstif_parse_color (Settings.ElementColor);
+ fg_colors[LB_RATS] = lesstif_parse_color (Settings.RatColor);
+ fg_colors[LB_PINS] = lesstif_parse_color (Settings.PinColor);
+ fg_colors[LB_VIAS] = lesstif_parse_color (Settings.ViaColor);
fg_colors[LB_BACK] =
- lesstif_parse_color (PCB->InvisibleObjectsColor);
- fg_colors[LB_MASK] = lesstif_parse_color (PCB->MaskColor);
+ lesstif_parse_color (Settings.InvisibleObjectsColor);
+ fg_colors[LB_MASK] = lesstif_parse_color (Settings.MaskColor);
bg_color = lesstif_parse_color (Settings.BackgroundColor);
}
else
diff --git a/src/print.c b/src/print.c
index 1f7bc53..a5346b1 100644
--- a/src/print.c
+++ b/src/print.c
@@ -243,7 +243,7 @@ PrintFab (void)
plated_sym = --ds;
if (drill->UnplatedCount)
unplated_sym = --ds;
- gui->set_color (Output.fgGC, PCB->PinColor);
+ gui->set_color (Output.fgGC, Settings.PinColor);
for (i = 0; i < drill->PinN; i++)
drill_sym (TEST_FLAG (HOLEFLAG, drill->Pin[i]) ?
unplated_sym : plated_sym, drill->Pin[i]->X,
@@ -265,7 +265,7 @@ PrintFab (void)
text_at (140000, yoff, 200, "NO");
text_at (98000, yoff, 200, "%d", drill->UnplatedCount);
}
- gui->set_color (Output.fgGC, PCB->ElementColor);
+ gui->set_color (Output.fgGC, Settings.ElementColor);
text_at (45000, yoff, 200, "%0.3f",
drill->DrillSize / 100000. + 0.0004);
if (plated_sym != -1 && unplated_sym != -1)
@@ -276,7 +276,7 @@ PrintFab (void)
total_drills += drill->ViaCount;
}
- gui->set_color (Output.fgGC, PCB->ElementColor);
+ gui->set_color (Output.fgGC, Settings.ElementColor);
text_at (0, yoff, 900, "Symbol");
text_at (41000, yoff, 900, "Diam. (Inch)");
text_at (95000, yoff, 900, "Count");
diff --git a/src/rtree.c b/src/rtree.c
index 19741e4..2a97991 100644
--- a/src/rtree.c
+++ b/src/rtree.c
@@ -248,7 +248,7 @@ __r_dump_tree (struct rtree_node *node, int depth)
if (depth < max_layer + 1)
gdk_gc_set_foreground (Output.fgGC, (LAYER_PTR (depth)->Color));
else
- gdk_gc_set_foreground (Output.fgGC, PCB->WarnColor);
+ gdk_gc_set_foreground (Output.fgGC, Settings.WarnColor);
XDrawCLine (Output.top_window->window, Output.fgGC,
node->box.X1, node->box.Y1, node->box.X2, node->box.Y1);
XDrawCLine (Output.top_window->window, Output.fgGC,
@@ -265,7 +265,7 @@ __r_dump_tree (struct rtree_node *node, int depth)
gdk_gc_set_line_attributes (Output.fgGC, 2,
GDK_LINE_SOLID, GDK_CAP_ROUND,
GDK_JOIN_ROUND);
- gdk_gc_set_foreground (Output.fgGC, PCB->MaskColor);
+ gdk_gc_set_foreground (Output.fgGC, Settings.MaskColor);
XDrawCLine (Output.top_window->window, Output.fgGC,
node->box.X1, node->box.Y1, node->box.X2, node->box.Y1);
XDrawCLine (Output.top_window->window, Output.fgGC,
@@ -292,7 +292,7 @@ __r_dump_tree (struct rtree_node *node, int depth)
gdk_gc_set_line_attributes (Output.fgGC, 1,
GDK_LINE_SOLID, GDK_CAP_ROUND,
GDK_JOIN_ROUND);
- gdk_gc_set_foreground (Output.fgGC, PCB->ViaSelectedColor);
+ gdk_gc_set_foreground (Output.fgGC, Settings.ViaSelectedColor);
XDrawCLine (Output.top_window->window, Output.fgGC,
node->u.rects[j].bounds.X1, node->u.rects[j].bounds.Y1,
node->u.rects[j].bounds.X2, node->u.rects[j].bounds.Y1);
--
1.6.2-rc2.GIT
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user