[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gEDA-dev: PCB patch for "SetChangedFlag" action,work on project manager
Hi,
Attached is a patch for PCB to add an action "SetChangedFlag" which sets
the changed flag on a layout.
We are intending to script PCB from our project manager application over
a pipe, and need a way to remotely save an open layout to a temporary
file, make a few edits, and get PCB to reload it for the user. The
project manager then needs to get PCB to mark the layout as changed, so
they are prompted to save it to keep the changes.
I'm investigating whether we need to backup, replace and then restore
the user's layout file to make PCB use the right filename when they then
use "File -> Save", or if futher scripting can be used to open a file
from a temporary file, but instruct that PCB saves it as a different
file name when using File -> Save.
We intend to have a project manager update the layout using gschem2pcb,
but update a currently loaded layout updated on the fly with stdin
scripting to the PCB session.
My feeling is that if done cleverly, the user may revert this with a
simple "Edit -> Undo" if they don't like the changes made. I'd intended
deletions to "just happen", and new components to be loaded, eg. from
"foo.new.pcb", to be placed into the user's paste buffer and paste mode
be selected.
I appreciate that this will over-write what the user has in their paste
buffer, but perhaps I can prompt to ask if this is ok first. Perhaps I
could add an action to prompt the user with a dialog, questioning if it
ok to make changes to bring the layout up to date.
Regards
Peter Clifton
--- pcb.clean/src/action.c 2006-08-18 04:30:57.000000000 +0100
+++ pcb/src/action.c 2006-08-22 17:53:53.000000000 +0100
@@ -6442,6 +6442,29 @@ ActionExecuteFile (int argc, char **argv
/* --------------------------------------------------------------------------- */
+static const char setchangedflag_syntax[] =
+"SetChangedFlag()";
+
+static const char setchangedflag_help[] =
+"Sets the dirty flag on the layout.";
+
+/* %start-doc actions SetChangedFlag
+
+When invoked, sets the changed flag on a layout
+
+%end-doc */
+
+static int
+ActionSetChangedFlag (int argc, char **argv, int x, int y)
+{
+ SetChangedFlag( True );
+
+ return 0;
+}
+
+
+/* --------------------------------------------------------------------------- */
+
HID_Action action_action_list[] = {
{"AddRats", 0, ActionAddRats,
addrats_help, addrats_syntax},
@@ -6549,6 +6572,8 @@ HID_Action action_action_list[] = {
movetocurrentlayer_help, movetocurrentlayer_syntax},
{"New", 0, ActionNew,
new_help, new_syntax},
+ {"SetChangedFlag", 0, ActionSetChangedFlag,
+ setchangedflag_help, setchangedflag_syntax }
};
REGISTER_ACTIONS (action_action_list)
_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev