[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (48b13a7ef095b479235c69b08c57bac74e81b3b6)



The branch, master has been updated
       via  48b13a7ef095b479235c69b08c57bac74e81b3b6 (commit)
      from  658e2517d906c0d925a643b91bde006fce81c57b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/file.c |   10 ++++++++--
 src/set.c  |    5 +++++
 2 files changed, 13 insertions(+), 2 deletions(-)


=================
 Commit Messages
=================

commit 48b13a7ef095b479235c69b08c57bac74e81b3b6
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add attribute PCB::grid::size for user's grid setting
    
    This stores the grid size using pcb-printf for full precision;
    the ordinary value in Grid[] needs to be in cmils for backward
    compatibility, so it cannot store metric settings correctly.

:100644 100644 99ba274... 501b735... M	src/file.c
:100644 100644 1f86adb... 5712bca... M	src/set.c

=========
 Changes
=========

commit 48b13a7ef095b479235c69b08c57bac74e81b3b6
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add attribute PCB::grid::size for user's grid setting
    
    This stores the grid size using pcb-printf for full precision;
    the ordinary value in Grid[] needs to be in cmils for backward
    compatibility, so it cannot store metric settings correctly.

diff --git a/src/file.c b/src/file.c
index 99ba274..501b735 100644
--- a/src/file.c
+++ b/src/file.c
@@ -390,7 +390,7 @@ set_some_route_style ()
 static int
 real_load_pcb (char *Filename, bool revert)
 {
-  const char *unit_suffix;
+  const char *unit_suffix, *grid_size;
   char *new_filename;
   PCBTypePtr newPCB = CreateNewPCB (false);
   PCBTypePtr oldPCB;
@@ -447,6 +447,12 @@ real_load_pcb (char *Filename, bool revert)
             Settings.grid_unit = new_unit;
         }
       AttributePut (PCB, "PCB::grid::unit", Settings.grid_unit->suffix);
+      /* Use attribute PCB::grid::size as size, if we can */
+      grid_size = AttributeGet (PCB, "PCB::grid::size");
+      if (grid_size)
+        {
+          PCB->Grid = GetValue (grid_size, NULL, NULL);
+        }
  
       sort_netlist ();
 
@@ -601,7 +607,7 @@ WritePCBDataHeader (FILE * FP)
   fputs ("\nPCB[", FP);
   PrintQuotedString (FP, (char *)EMPTY (PCB->Name));
   pcb_fprintf (FP, " %mr %mr]\n\n", PCB->MaxWidth, PCB->MaxHeight);
-  pcb_fprintf (FP, "Grid[%.1mr %mr %mr %d]\n", PCB->Grid, PCB->GridOffsetX, PCB->GridOffsetY, Settings.DrawGrid);
+  pcb_fprintf (FP, "Grid[%s %mr %mr %d]\n", c_dtostr (COORD_TO_MIL (PCB->Grid) * 100), PCB->GridOffsetX, PCB->GridOffsetY, Settings.DrawGrid);
   pcb_fprintf (FP, "Cursor[%mr %mr %s]\n",
                Crosshair.X, Crosshair.Y, c_dtostr (PCB->Zoom));
   /* PolyArea should be output in square cmils, no suffix */
diff --git a/src/set.c b/src/set.c
index 1f86adb..5712bca 100644
--- a/src/set.c
+++ b/src/set.c
@@ -71,6 +71,7 @@ static int mode_stack[MAX_MODESTACK_DEPTH];
 void
 SetGrid (Coord Grid, bool align)
 {
+  char *grid_string;
   if (Grid >= 1 && Grid <= MAX_GRID)
     {
       if (align)
@@ -79,6 +80,10 @@ SetGrid (Coord Grid, bool align)
 	  PCB->GridOffsetY = Crosshair.Y % Grid;
 	}
       PCB->Grid = Grid;
+      grid_string = pcb_g_strdup_printf ("%mr", Grid);
+      if (grid_string)
+        AttributePut (PCB, "PCB::grid::size", grid_string);
+      g_free (grid_string);
       if (Settings.DrawGrid)
 	Redraw ();
     }




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs