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

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



The branch, master has been updated
       via  b0ecb342f6602c037072b99a11250ccc162bf781 (commit)
      from  2c683cfb8bdc22ca9e16de39917a4f4dfc39b298 (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/action.c  |    1 -
 src/create.c  |    8 +++++---
 src/create.h  |    2 +-
 src/file.c    |    7 +++++--
 src/main.c    |    1 -
 src/parse_y.y |    3 ++-
 6 files changed, 13 insertions(+), 9 deletions(-)


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

commit b0ecb342f6602c037072b99a11250ccc162bf781
Author: Jared Casper <jaredcasper@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    refdes labels in new layout can't be moved.
    
    The .pcb file that gsch2pcb creates does not have a font in it.  When
    loading files, the bounding box for all the text is calculated as the
    file is read.  In the case that there is no font, this is before the
    default font is installed, so the bounding box is way too small.
    
    This patch remedies this by making all new PCB structures contain the
    default font by calling CreateDefaultFont in CreateNewPCB
    (CreateDefaultFont now takes in a PCBTypePtr instead of using the
    global PCB).  Previously, each time CreateNewPCB was called,
    CreateDefaultFont was called soon thereafter.
    
    In the case of loading a PCB from a file.  The default font in the
    newly created struct PCB is marked invalid but not removed.  If the
    .pcb file contains a font, the default font will be overwritten by the
    file's font.  If it does not, PCB->Font will still be invalid after
    LoadPCB, a message is displayed that the default font is being used,
    and PCB->Font.Valid is set to true.
    
    Also fixes a related bug where the memory for a symbols lines wasn't
    being cleared when a new file was brought into place.  Previously,
    this only happened if a new Font was loaded into an existing PCB.  Now
    the font will be replaced every time a file with symbol information is
    loaded.
    
    Rebased to actual git-head by Felix Ruoff
    
    Closes-bug: lp-699478

:100644 100644 52157a0... 30d9745... M	src/action.c
:100644 100644 e4eeb0b... cd31935... M	src/create.c
:100644 100644 754a450... ec964fa... M	src/create.h
:100644 100644 fef1046... abdb444... M	src/file.c
:100644 100644 0e6852f... 04b7c2f... M	src/main.c
:100644 100644 f35d9d0... 9c1bb6a... M	src/parse_y.y

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

commit b0ecb342f6602c037072b99a11250ccc162bf781
Author: Jared Casper <jaredcasper@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    refdes labels in new layout can't be moved.
    
    The .pcb file that gsch2pcb creates does not have a font in it.  When
    loading files, the bounding box for all the text is calculated as the
    file is read.  In the case that there is no font, this is before the
    default font is installed, so the bounding box is way too small.
    
    This patch remedies this by making all new PCB structures contain the
    default font by calling CreateDefaultFont in CreateNewPCB
    (CreateDefaultFont now takes in a PCBTypePtr instead of using the
    global PCB).  Previously, each time CreateNewPCB was called,
    CreateDefaultFont was called soon thereafter.
    
    In the case of loading a PCB from a file.  The default font in the
    newly created struct PCB is marked invalid but not removed.  If the
    .pcb file contains a font, the default font will be overwritten by the
    file's font.  If it does not, PCB->Font will still be invalid after
    LoadPCB, a message is displayed that the default font is being used,
    and PCB->Font.Valid is set to true.
    
    Also fixes a related bug where the memory for a symbols lines wasn't
    being cleared when a new file was brought into place.  Previously,
    this only happened if a new Font was loaded into an existing PCB.  Now
    the font will be replaced every time a file with symbol information is
    loaded.
    
    Rebased to actual git-head by Felix Ruoff
    
    Closes-bug: lp-699478

diff --git a/src/action.c b/src/action.c
index 52157a0..30d9745 100644
--- a/src/action.c
+++ b/src/action.c
@@ -5924,7 +5924,6 @@ ActionNew (int argc, char **argv, int x, int y)
       PCB->Name = name;
 
       ResetStackAndVisibility ();
-      CreateDefaultFont ();
       SetCrosshairRange (0, 0, PCB->MaxWidth, PCB->MaxHeight);
       CenterDisplay (PCB->MaxWidth / 2, PCB->MaxHeight / 2);
       Redraw ();
diff --git a/src/create.c b/src/create.c
index e4eeb0b..cd31935 100644
--- a/src/create.c
+++ b/src/create.c
@@ -207,6 +207,8 @@ CreateNewPCB (bool SetDefaultNames)
   for (i = 0; i < MAX_LAYER; i++)
     ptr->Data->Layer[i].Name = strdup (Settings.DefaultLayerName[i]);
 
+	CreateDefaultFont (ptr);
+
   return (ptr);
 }
 
@@ -937,14 +939,14 @@ CreateNewLineInSymbol (SymbolTypePtr Symbol,
 }
 
 /* ---------------------------------------------------------------------------
- * parses a file with font information and installs it
+ * parses a file with font information and installs it into the provided PCB
  * checks directories given as colon separated list by resource fontPath
  * if the fonts filename doesn't contain a directory component
  */
 void
-CreateDefaultFont (void)
+CreateDefaultFont (PCBTypePtr pcb)
 {
-  if (ParseFont (&PCB->Font, Settings.FontFile))
+  if (ParseFont (&pcb->Font, Settings.FontFile))
     Message (_("Can't find font-symbol-file '%s'\n"), Settings.FontFile);
 }
 
diff --git a/src/create.h b/src/create.h
index 754a450..ec964fa 100644
--- a/src/create.h
+++ b/src/create.h
@@ -86,7 +86,7 @@ PadTypePtr CreateNewPad (ElementTypePtr, LocationType, LocationType,
 			 BDimension, char *, char *, FlagType);
 LineTypePtr CreateNewLineInSymbol (SymbolTypePtr, LocationType, LocationType,
 				   LocationType, LocationType, BDimension);
-void CreateDefaultFont (void);
+void CreateDefaultFont (PCBTypePtr);
 RubberbandTypePtr CreateNewRubberbandEntry (LayerTypePtr,
 					    LineTypePtr, PointTypePtr);
 LibraryMenuTypePtr CreateNewNet (LibraryTypePtr, char *, char *);
diff --git a/src/file.c b/src/file.c
index fef1046..abdb444 100644
--- a/src/file.c
+++ b/src/file.c
@@ -405,6 +405,9 @@ LoadPCB (char *Filename)
   oldPCB = PCB;
   PCB = newPCB;
 
+  /* mark the default font invalid to know if the file has one */
+  newPCB->Font.Valid = false;
+
   /* new data isn't added to the undo list */
   if (!ParsePCB (PCB, Filename))
     {
@@ -421,13 +424,13 @@ LoadPCB (char *Filename)
       /* update cursor confinement and output area (scrollbars) */
       ChangePCBSize (PCB->MaxWidth, PCB->MaxHeight);
 
-      /* create default font if necessary */
+      /* enable default font if necessary */
       if (!PCB->Font.Valid)
 	{
 	  Message (_
 		   ("File '%s' has no font information, using default font\n"),
 		   Filename);
-	  CreateDefaultFont ();
+	  PCB->Font.Valid = true;
 	}
 
       /* clear 'changed flag' */
diff --git a/src/main.c b/src/main.c
index 0e6852f..04b7c2f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1004,7 +1004,6 @@ main (int argc, char *argv[])
 
   ResetStackAndVisibility ();
 
-  CreateDefaultFont ();
   if (gui->gui)
     InitCrosshair ();
   InitHandler ();
diff --git a/src/parse_y.y b/src/parse_y.y
index f35d9d0..9c1bb6a 100644
--- a/src/parse_y.y
+++ b/src/parse_y.y
@@ -263,7 +263,8 @@ parsefont
 				}
 				yyFont->Valid = false;
 				for (i = 0; i <= MAX_FONTPOSITION; i++)
-					yyFont->Symbol[i].Valid = false;
+					free (yyFont->Symbol[i].Line);
+				bzero(yyFont->Symbol, sizeof(yyFont->Symbol));
 			}
 		  symbols
 			{




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