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

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



The branch, master has been updated
       via  84ae26807325c8d2d95cd3ec3c2a6e61c217626e (commit)
       via  60e84badc0b51f9f00840b66feee759951ce89c1 (commit)
       via  c95bd50c671fd43127aa8e5fa8cb3b92dc2c1f11 (commit)
      from  596fa244e208faf3e0e81a7309e73d300c34a6d1 (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  |   14 ++++++++++----
 src/command.c |   14 ++++++++++++--
 src/file.c    |   23 +++++++++--------------
 src/hid.h     |   13 +++++++++++++
 4 files changed, 44 insertions(+), 20 deletions(-)


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

commit 84ae26807325c8d2d95cd3ec3c2a6e61c217626e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Add a HID API call, notify_pcb_filename_change()
    
    This is so the core can tell the GUI when the PCB being edited is saved
    into a different file.

:100644 100644 9e47690... 55825a9... M	src/action.c
:100644 100644 009d373... 963ed85... M	src/command.c
:100644 100644 d1c7c8e... 2266b6c... M	src/hid.h

commit 60e84badc0b51f9f00840b66feee759951ce89c1
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Add a HID API call, notify_save_pcb() called around saving the PCB
    
    The intention of this API is so that GUIs monitoring the active PCB
    file on disk for changes, can filter out changes which occur as we
    save the file ourselves.

:100644 100644 edd1f26... 7769057... M	src/file.c
:100644 100644 b1f532f... d1c7c8e... M	src/hid.h

commit c95bd50c671fd43127aa8e5fa8cb3b92dc2c1f11
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    file.c: Don't set the PCB filename or changed flags inside SavePCB (Filename)
    
    Save this for the caller to do. (action.c already set the filename for the
    SaveAs case anyway).

:100644 100644 faa1f21... 9e47690... M	src/action.c
:100644 100644 4c3a419... 009d373... M	src/command.c
:100644 100644 1c68abc... edd1f26... M	src/file.c

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

commit 84ae26807325c8d2d95cd3ec3c2a6e61c217626e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Add a HID API call, notify_pcb_filename_change()
    
    This is so the core can tell the GUI when the PCB being edited is saved
    into a different file.

diff --git a/src/action.c b/src/action.c
index 9e47690..55825a9 100644
--- a/src/action.c
+++ b/src/action.c
@@ -5687,6 +5687,8 @@ ActionSaveTo (int argc, char **argv, Coord x, Coord y)
           SetChangedFlag (false);
           free (PCB->Filename);
           PCB->Filename = strdup (name);
+          if (gui->notify_filename_changed != NULL)
+            gui->notify_filename_changed ();
         }
       return 0;
     }
diff --git a/src/command.c b/src/command.c
index 009d373..963ed85 100644
--- a/src/command.c
+++ b/src/command.c
@@ -354,6 +354,8 @@ CommandSaveLayout (int argc, char **argv, Coord x, Coord y)
           SetChangedFlag (false);
           free (PCB->Filename);
           PCB->Filename = strdup (argv[0]);
+           if (gui->notify_filename_changed != NULL)
+            gui->notify_filename_changed ();
         }
       break;
 
diff --git a/src/hid.h b/src/hid.h
index d1c7c8e..2266b6c 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -577,6 +577,9 @@ typedef enum
      * our deliberate changes.
      */
     void (*notify_save_pcb) (const char *filename, bool done);
+
+    /* Notification to the GUI that the PCB file has been renamed. */
+    void (*notify_filename_changed) (void);
   };
 
 /* Call this as soon as possible from main().  No other HID calls are

commit 60e84badc0b51f9f00840b66feee759951ce89c1
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Add a HID API call, notify_save_pcb() called around saving the PCB
    
    The intention of this API is so that GUIs monitoring the active PCB
    file on disk for changes, can filter out changes which occur as we
    save the file ourselves.

diff --git a/src/file.c b/src/file.c
index edd1f26..7769057 100644
--- a/src/file.c
+++ b/src/file.c
@@ -349,9 +349,18 @@ SaveBufferElements (char *Filename)
  * save PCB
  */
 int
-SavePCB (char *Filename)
+SavePCB (char *file)
 {
-  return WritePipe (Filename, true);
+  int retcode;
+
+  if (gui->notify_save_pcb == NULL)
+    return WritePipe (file, true);
+
+  gui->notify_save_pcb (file, false);
+  retcode = WritePipe (file, true);
+  gui->notify_save_pcb (file, true);
+
+  return retcode;
 }
 
 /* ---------------------------------------------------------------------------
diff --git a/src/hid.h b/src/hid.h
index b1f532f..d1c7c8e 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -567,6 +567,16 @@ typedef enum
      * Any remaining rendering will be flushed to the screen.
      */
     void (*finish_debug_draw)  (void);
+
+    /* Notification to the GUI around saving the PCB file.
+     *
+     * Called with a false parameter before the save, called again
+     * with true after the save.
+     *
+     * Allows GUIs which watch for file-changes on disk to ignore
+     * our deliberate changes.
+     */
+    void (*notify_save_pcb) (const char *filename, bool done);
   };
 
 /* Call this as soon as possible from main().  No other HID calls are

commit c95bd50c671fd43127aa8e5fa8cb3b92dc2c1f11
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    file.c: Don't set the PCB filename or changed flags inside SavePCB (Filename)
    
    Save this for the caller to do. (action.c already set the filename for the
    SaveAs case anyway).

diff --git a/src/action.c b/src/action.c
index faa1f21..9e47690 100644
--- a/src/action.c
+++ b/src/action.c
@@ -5672,7 +5672,8 @@ ActionSaveTo (int argc, char **argv, Coord x, Coord y)
 
   if (strcasecmp (function, "Layout") == 0)
     {
-      SavePCB (PCB->Filename);
+      if (SavePCB (PCB->Filename) == 0)
+        SetChangedFlag (false);
       return 0;
     }
 
@@ -5681,9 +5682,12 @@ ActionSaveTo (int argc, char **argv, Coord x, Coord y)
 
   if (strcasecmp (function, "LayoutAs") == 0)
     {
-      free (PCB->Filename);
-      PCB->Filename = strdup (name);
-      SavePCB (PCB->Filename);
+      if (SavePCB (name) == 0)
+        {
+          SetChangedFlag (false);
+          free (PCB->Filename);
+          PCB->Filename = strdup (name);
+        }
       return 0;
     }
 
diff --git a/src/command.c b/src/command.c
index 4c3a419..009d373 100644
--- a/src/command.c
+++ b/src/command.c
@@ -340,13 +340,21 @@ CommandSaveLayout (int argc, char **argv, Coord x, Coord y)
     {
     case 0:
       if (PCB->Filename)
-	SavePCB (PCB->Filename);
+        {
+          if (SavePCB (PCB->Filename) == 0)
+            SetChangedFlag (false);
+        }
       else
 	Message ("No filename to save to yet\n");
       break;
 
     case 1:
-      SavePCB (argv[0]);
+      if (SavePCB (argv[0]) == 0)
+        {
+          SetChangedFlag (false);
+          free (PCB->Filename);
+          PCB->Filename = strdup (argv[0]);
+        }
       break;
 
     default:
diff --git a/src/file.c b/src/file.c
index 1c68abc..edd1f26 100644
--- a/src/file.c
+++ b/src/file.c
@@ -351,21 +351,7 @@ SaveBufferElements (char *Filename)
 int
 SavePCB (char *Filename)
 {
-  int retcode;
-  char *copy;
-
-  if (!(retcode = WritePipe (Filename, true)))
-    {
-      /* thanks to Nick Bailey for the bug-fix;
-       * first of all make a copy of the passed filename because
-       * it might be identical to 'PCB->Filename'
-       */
-      copy = strdup (Filename);
-      free (PCB->Filename);
-      PCB->Filename = copy;
-      SetChangedFlag (false);
-    }
-  return (retcode);
+  return WritePipe (Filename, true);
 }
 
 /* ---------------------------------------------------------------------------




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