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

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-203-g6a07d73)



The branch, master has been updated
       via  6a07d737a32a816f43e1f061409a10e616d7aa2a (commit)
       via  246acd46e591e542ac3f00f9064905ae0311b0ec (commit)
      from  17077786f635102715f3d6c225d6f16396e531f6 (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
=========

 gschem/include/gschem_struct.h      |    1 +
 gschem/include/prototype.h          |   11 +++
 gschem/lib/system-gschemrc.in       |    6 +-
 gschem/src/Makefile.am              |    1 +
 gschem/src/g_keys.c                 |    5 ++
 gschem/src/g_register.c             |    5 ++
 gschem/src/gschem_toplevel.c        |    1 +
 gschem/src/i_callbacks.c            |   91 ++++++++++++++++++++++++
 gschem/src/o_misc.c                 |    2 +-
 gschem/src/o_undo.c                 |    2 +-
 gschem/src/x_clipboard.c            |  133 +++++++++++++++++++++++++++++++++++
 libgeda/include/libgeda/prototype.h |    5 +-
 libgeda/src/a_basic.c               |   32 ++++++--
 libgeda/src/f_basic.c               |    4 +-
 14 files changed, 282 insertions(+), 17 deletions(-)
 create mode 100644 gschem/src/x_clipboard.c


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

commit 6a07d737a32a816f43e1f061409a10e616d7aa2a
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Jan 24 16:11:39 2009 +0000

    Enable basic clipboard support.
    
    Enable clipboard support using the GTK Clipboard API.  gschem
    advertises 'application/x-geda-schematic' data, and transfers it in
    the gEDA on-disc file format.
    
    This works between gschem instances, but data does not remain in the
    clipboard after the advertising instance of gschem exits.

:100644 100644 ebe58b8... 4ae55b7... M	gschem/include/gschem_struct.h
:100644 100644 4bd7594... ce0c0c0... M	gschem/include/prototype.h
:100644 100644 357bafb... 09fd26a... M	gschem/lib/system-gschemrc.in
:100644 100644 0403cd7... 6374bba... M	gschem/src/Makefile.am
:100644 100644 0a9d1fe... 665e7ef... M	gschem/src/g_keys.c
:100644 100644 fb710ed... 5173d30... M	gschem/src/g_register.c
:100644 100644 caafcd1... c2dd999... M	gschem/src/gschem_toplevel.c
:100644 100644 b50f6fd... 20a7da1... M	gschem/src/i_callbacks.c
:000000 100644 0000000... 27fd436... A	gschem/src/x_clipboard.c

commit 246acd46e591e542ac3f00f9064905ae0311b0ec
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Jan 24 16:08:43 2009 +0000

    Make o_save(), o_read() and friends take an object list argument.
    
    Sometimes we may want to save or read in a list of objects which isn't
    the current page. This adds a new function o_save_curr_page() which
    behaves the same as o_save() previously did.

:100644 100644 ea82dc6... a650623... M	gschem/src/o_misc.c
:100644 100644 b59fc3b... 83aa17b... M	gschem/src/o_undo.c
:100644 100644 7ed1b34... ab6711a... M	libgeda/include/libgeda/prototype.h
:100644 100644 0e3a41e... 6038eef... M	libgeda/src/a_basic.c
:100644 100644 44ec096... 0cf7640... M	libgeda/src/f_basic.c

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

commit 6a07d737a32a816f43e1f061409a10e616d7aa2a
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Jan 24 16:11:39 2009 +0000

    Enable basic clipboard support.
    
    Enable clipboard support using the GTK Clipboard API.  gschem
    advertises 'application/x-geda-schematic' data, and transfers it in
    the gEDA on-disc file format.
    
    This works between gschem instances, but data does not remain in the
    clipboard after the advertising instance of gschem exits.

diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index ebe58b8..4ae55b7 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -120,6 +120,7 @@ struct st_gschem_toplevel {
   int doing_pan;                        /* mouse pan status flag */
   int buffer_number;                    /* current paste buffer in use */
   void (*last_callback)();              /* Last i_call* cmd executed */
+  GList *clipboard_buffer;              /* buffer for system clipboard integration */
 
   /* ------------------ */
   /* rc/user parameters */
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 4bd7594..ce0c0c0 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -94,6 +94,10 @@ SCM g_keys_edit_find(SCM rest);
 SCM g_keys_edit_show_text(SCM rest);
 SCM g_keys_edit_hide_text(SCM rest);
 SCM g_keys_edit_autonumber_text(SCM rest);
+SCM g_keys_clipboard_copy(SCM rest);
+SCM g_keys_clipboard_cut(SCM rest);
+SCM g_keys_clipboard_paste(SCM rest);
+SCM g_keys_clipboard_paste_hotkey(SCM rest);
 SCM g_keys_buffer_copy1(SCM rest);
 SCM g_keys_buffer_copy2(SCM rest);
 SCM g_keys_buffer_copy3(SCM rest);
@@ -378,6 +382,10 @@ void i_callback_page_close(gpointer data, guint callback_action, GtkWidget *widg
 void i_callback_page_revert(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_page_discard(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_page_print(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_clipboard_copy(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_clipboard_cut(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_clipboard_paste(gpointer data, guint callback_action, GtkWidget *widget);
+void i_callback_clipboard_paste_hotkey(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_buffer_copy1(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_buffer_copy2(gpointer data, guint callback_action, GtkWidget *widget);
 void i_callback_buffer_copy3(gpointer data, guint callback_action, GtkWidget *widget);
@@ -733,6 +741,9 @@ void x_vscrollbar_set_ranges(GSCHEM_TOPLEVEL *w_current);
 void x_vscrollbar_update(GSCHEM_TOPLEVEL *w_current);
 void x_scrollbars_update(GSCHEM_TOPLEVEL *w_current);
 void x_basic_warp_cursor(GtkWidget *widget, gint x, gint y);
+/* x_clipboard.c */
+gboolean x_clipboard_set (GSCHEM_TOPLEVEL *w_current, const GList *object_list);
+GList *x_clipboard_get (GSCHEM_TOPLEVEL *w_current);
 /* x_color.c */
 void x_color_init (void);
 void x_color_free (void);
diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index 357bafb..09fd26a 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -1368,9 +1368,9 @@
     ("Shift U" . edit-undo)
     ("Shift R" . edit-redo)
     ("Shift Z" . view-zoom-out-hotkey)
-    ("Control x" . buffer-cut1)
-    ("Control c" . buffer-copy1)
-    ("Control v" . buffer-paste1-hotkey)
+    ("Control x" . clipboard-cut)
+    ("Control c" . clipboard-copy)
+    ("Control v" . clipboard-paste-hotkey)
     ("Control z" . edit-undo)
     ("Control y" . edit-redo)))
 
diff --git a/gschem/src/Makefile.am b/gschem/src/Makefile.am
index 0403cd7..6374bba 100644
--- a/gschem/src/Makefile.am
+++ b/gschem/src/Makefile.am
@@ -52,6 +52,7 @@ gschem_SOURCES = \
 	x_attribedit.c \
 	x_autonumber.c \
 	x_basic.c \
+	x_clipboard.c \
 	x_color.c \
 	x_compselect.c \
 	x_dialog.c \
diff --git a/gschem/src/g_keys.c b/gschem/src/g_keys.c
index 0a9d1fe..665e7ef 100644
--- a/gschem/src/g_keys.c
+++ b/gschem/src/g_keys.c
@@ -255,6 +255,11 @@ DEFINE_G_KEYS(edit_show_text)
 DEFINE_G_KEYS(edit_hide_text)
 DEFINE_G_KEYS(edit_autonumber_text)
 
+DEFINE_G_KEYS(clipboard_copy)
+DEFINE_G_KEYS(clipboard_cut)
+DEFINE_G_KEYS(clipboard_paste)
+DEFINE_G_KEYS(clipboard_paste_hotkey)
+
 DEFINE_G_KEYS(buffer_copy1)
 DEFINE_G_KEYS(buffer_copy2)
 DEFINE_G_KEYS(buffer_copy3)
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index fb710ed..5173d30 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -200,6 +200,11 @@ static struct gsubr_t gschem_funcs[] = {
   { "edit-hide-text",            0, 0, 0, g_keys_edit_hide_text },
   { "edit-autonumber",           0, 0, 0, g_keys_edit_autonumber_text },
 
+  { "clipboard-copy",            0, 0, 0, g_keys_clipboard_copy },
+  { "clipboard-cut",             0, 0, 0, g_keys_clipboard_cut },
+  { "clipboard-paste",           0, 0, 0, g_keys_clipboard_paste },
+  { "clipboard-paste-hotkey",    0, 0, 0, g_keys_clipboard_paste_hotkey },
+
   { "buffer-copy1",              0, 0, 0, g_keys_buffer_copy1 },
   { "buffer-copy2",              0, 0, 0, g_keys_buffer_copy2 },
   { "buffer-copy3",              0, 0, 0, g_keys_buffer_copy3 },
diff --git a/gschem/src/gschem_toplevel.c b/gschem/src/gschem_toplevel.c
index caafcd1..c2dd999 100644
--- a/gschem/src/gschem_toplevel.c
+++ b/gschem/src/gschem_toplevel.c
@@ -137,6 +137,7 @@ GSCHEM_TOPLEVEL *gschem_toplevel_new ()
   w_current->doing_pan = 0;
   w_current->buffer_number = 0;
   w_current->last_callback = NULL;
+  w_current->clipboard_buffer = NULL;
 
   /* ------------------ */
   /* rc/user parameters */
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index b50f6fd..20a7da1 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -1800,6 +1800,97 @@ DEFINE_I_CALLBACK(page_print)
   s_page_print_all(w_current->toplevel);
 }
 
+/*! \section clipboard-menu Clipboard Menu Callback Functions */
+/*! \brief Copy selection to clipboard.
+ *  \par Function Description
+ * Copies the current selection to the clipboard, via buffer 0.
+ */
+DEFINE_I_CALLBACK(clipboard_copy)
+{
+  GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
+
+  exit_if_null (w_current);
+  if (!o_select_selected (w_current)) return;
+
+  i_update_middle_button (w_current, i_callback_clipboard_copy,
+                          _("Copy to clipboard"));
+
+  o_buffer_copy (w_current, 0);
+  x_clipboard_set (w_current, object_buffer[0]);
+}
+
+/*! \brief Cut selection to clipboard.
+ *  \par Function Description
+ * Cut the current selection to the clipboard, via buffer 0.
+ */
+DEFINE_I_CALLBACK(clipboard_cut)
+{
+  GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
+
+  exit_if_null (w_current);
+  if (!o_select_selected (w_current)) return;
+
+  i_update_middle_button (w_current, i_callback_clipboard_cut,
+                          _("Cut to clipboard"));
+
+  o_buffer_cut (w_current, 0);
+  x_clipboard_set (w_current, object_buffer[0]);
+}
+
+/*! \brief Start pasting clipboard contents.
+ *  \par Function Description
+ * Cut the current selection to the clipboard, via buffer 0.
+ */
+DEFINE_I_CALLBACK(clipboard_paste)
+{
+  GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL *) data;
+  TOPLEVEL *toplevel = w_current->toplevel;
+  GList *object_list = NULL;
+
+  exit_if_null(w_current);
+
+  i_update_middle_button (w_current, i_callback_buffer_paste1, _("Paste from clipboard"));
+
+  object_list = x_clipboard_get (w_current);
+
+  if (object_list != NULL) {
+    s_delete_object_glist (toplevel, object_buffer[0]);
+    object_buffer[0] = object_list;
+    o_redraw_cleanstates (w_current);
+    w_current->buffer_number = 0;
+    w_current->inside_action = 1;
+    i_set_state (w_current, STARTPASTE);
+  } else {
+    i_set_state_msg (w_current, SELECT, _("Empty buffer"));
+  }
+}
+
+/*! \brief Start pasting clipboard contents (hotkey version)
+ *  \par Function Description
+ *  It's not entirely clear what the difference is between this and
+ *  i_callback_clipboard_paste()...
+ */
+DEFINE_I_CALLBACK(clipboard_paste_hotkey)
+{
+  GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL *) data;
+  TOPLEVEL *toplevel = w_current->toplevel;
+  GList *object_list = NULL;
+  gint wx, wy;
+
+  exit_if_null (w_current);
+
+  if (!x_event_get_pointer_position (w_current, TRUE, &wx, &wy))
+    return;
+
+  object_list = x_clipboard_get (w_current);
+
+  if (object_list == NULL) return;
+  s_delete_object_glist (toplevel, object_buffer[0]);
+  object_buffer[0] = object_list;
+
+  o_buffer_paste_start (w_current, wx, wy, 0);
+}
+
 /*! \section buffer-menu Buffer Menu Callback Functions */
 /*! \todo Finish function documentation!!!
  *  \brief
diff --git a/gschem/src/x_clipboard.c b/gschem/src/x_clipboard.c
new file mode 100644
index 0000000..27fd436
--- /dev/null
+++ b/gschem/src/x_clipboard.c
@@ -0,0 +1,133 @@
+/* gEDA - GPL Electronic Design Automation
+ * gschem - gEDA Schematic Capture
+ * Copyright (C) 1998-2009 gEDA Contributors (see ChangeLog for details)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ */
+#include <config.h>
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "gschem.h"
+
+#ifdef HAVE_LIBDMALLOC
+#include <dmalloc.h>
+#endif
+
+#define MIME_TYPE_SCHEMATIC "application/x-geda-schematic"
+#define CLIP_TYPE_SCHEMATIC 1
+
+static void
+clip_get (GtkClipboard *cb, GtkSelectionData *selection_data,
+          guint info, gpointer user_data_or_owner)
+{
+  GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL *) user_data_or_owner;
+  TOPLEVEL *toplevel = w_current->toplevel;
+  GdkAtom type = gdk_atom_intern (MIME_TYPE_SCHEMATIC, FALSE);
+  gchar *buf;
+  if (info != CLIP_TYPE_SCHEMATIC) return;
+  /* Convert the objects in the clipboard buffer to gEDA schematic
+   * format */
+  buf = o_save_buffer (toplevel, w_current->clipboard_buffer);
+  /* Set the selection appropriately */
+  gtk_selection_data_set (selection_data, type,
+                          8, /* 8-bit data (UTF-8) */
+                          (guchar *) buf,
+                          (gint) strlen(buf));
+  g_free (buf);
+}
+
+static void
+clip_clear (GtkClipboard *cb, gpointer user_data_or_owner)
+{
+  /* Do nothing for now */
+}
+
+/* \brief Set the contents of the system clipboard.
+ * \par Function Description
+ * Set the system clipboard to contain the gschem objects listed in \a
+ * object_list.
+ *
+ * \param [in,out] w_current   The current GSCHEM_TOPLEVEL.
+ * \param [in]     object_list The objects to put in the clipboard.
+ *
+ * \return TRUE if the clipboard is successfully set.
+ */
+gboolean
+x_clipboard_set (GSCHEM_TOPLEVEL *w_current, const GList *object_list)
+{
+  GtkClipboard *cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  GtkTargetEntry target = { MIME_TYPE_SCHEMATIC, 0,
+                            CLIP_TYPE_SCHEMATIC };
+  TOPLEVEL *toplevel = w_current->toplevel;
+  gboolean result;
+
+  /* Clear the clipboard buffer */
+  s_delete_object_glist(toplevel, w_current->clipboard_buffer);
+  w_current->clipboard_buffer = NULL;
+
+  /* Copy the objects to the clipboard buffer */
+  w_current->clipboard_buffer =
+    o_glist_copy_all (toplevel, object_list, w_current->clipboard_buffer,
+                      SELECTION_FLAG);
+
+  /* Advertise that the data is available */
+  result = gtk_clipboard_set_with_data (cb, &target, 1,
+                                        clip_get, clip_clear, w_current);
+
+  /* Hint that the data can be stored to be accessed after the program
+   * has quit. */
+  gtk_clipboard_set_can_store (cb, NULL, 0);
+
+  return result;
+}
+
+/* \brief Get the contents of the system clipboard.
+ * \par Function Description
+ * If the system clipboard contains schematic data, retrieve it.
+ *
+ * \param [in,out] w_current   The current GSCHEM_TOPLEVEL.
+ *
+ * \returns Any OBJECTs retrieved from the system clipboard, or NULL
+ *          if none were available.
+ */
+GList *
+x_clipboard_get (GSCHEM_TOPLEVEL *w_current)
+{
+  GtkClipboard *cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  TOPLEVEL *toplevel = w_current->toplevel;
+  GdkAtom type = gdk_atom_intern (MIME_TYPE_SCHEMATIC, FALSE);
+  GtkSelectionData *selection_data;
+  GList *object_list = NULL;
+  const guchar *buf;
+
+  /* Try to get the contents of the clipboard */
+  selection_data = gtk_clipboard_wait_for_contents (cb, type);
+  if (selection_data == NULL) return FALSE;
+
+  /* Convert the data buffer to OBJECTs */
+  buf = gtk_selection_data_get_data (selection_data);
+  object_list = o_read_buffer (toplevel, object_list,
+                               (gchar *) buf, -1, "Clipboard");
+
+  gtk_selection_data_free (selection_data);
+  return object_list;
+}

commit 246acd46e591e542ac3f00f9064905ae0311b0ec
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Jan 24 16:08:43 2009 +0000

    Make o_save(), o_read() and friends take an object list argument.
    
    Sometimes we may want to save or read in a list of objects which isn't
    the current page. This adds a new function o_save_curr_page() which
    behaves the same as o_save() previously did.

diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index ea82dc6..a650623 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -887,7 +887,7 @@ void o_autosave_backups(GSCHEM_TOPLEVEL *w_current)
           umask(saved_umask);
         }
 
-        if (o_save (toplevel, backup_filename)) {
+        if (o_save_curr_page (toplevel, backup_filename)) {
 
           p_current->ops_since_last_backup = 0;
                 p_current->do_autosave_backup = 0;
diff --git a/gschem/src/o_undo.c b/gschem/src/o_undo.c
index b59fc3b..83aa17b 100644
--- a/gschem/src/o_undo.c
+++ b/gschem/src/o_undo.c
@@ -105,7 +105,7 @@ void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
     /* f_save manages the creaton of backup copies. 
        This way, f_save is called only when saving a file, and not when
        saving an undo backup copy */
-    o_save(toplevel, filename);
+    o_save_curr_page (toplevel, filename);
 
 
   } else if (w_current->undo_type == UNDO_MEMORY && flag == UNDO_ALL) {
diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index 7ed1b34..ab6711a 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -1,8 +1,9 @@
 
 /* a_basic.c */
 const gchar *o_file_format_header();
-gchar *o_save_buffer(TOPLEVEL *toplevel);
-int o_save(TOPLEVEL *toplevel, const char *filename);
+gchar *o_save_buffer (TOPLEVEL *toplevel, const GList *object_list);
+int o_save (TOPLEVEL *toplevel, const GList *object_list, const char *filename);
+int o_save_curr_page (TOPLEVEL *toplevel, const char *filename);
 GList *o_read_buffer(TOPLEVEL *toplevel, GList *object_list, char *buffer, const int size, const char *name);
 GList *o_read(TOPLEVEL *toplevel, GList *object_list, char *filename, GError **err);
 void o_scale(TOPLEVEL *toplevel, GList *list, int x_scale, int y_scale);
diff --git a/libgeda/src/a_basic.c b/libgeda/src/a_basic.c
index 0e3a41e..6038eef 100644
--- a/libgeda/src/a_basic.c
+++ b/libgeda/src/a_basic.c
@@ -56,10 +56,11 @@ const gchar *o_file_format_header()
  *  This function saves a whole schematic into a buffer in libgeda
  *  format. The buffer should be freed when no longer needed.
  *
- *  \param [in] toplevel  The data to save.
+ *  \param [in] toplevel    The current TOPLEVEL.
+ *  \param [in] object_list The head of a GList of OBJECTs to save.
  *  \returns a buffer containing schematic data or NULL on failure.
  */
-gchar *o_save_buffer (TOPLEVEL *toplevel)
+gchar *o_save_buffer (TOPLEVEL *toplevel, const GList *object_list)
 {
   GString *acc;
   gchar *buffer;
@@ -74,7 +75,7 @@ gchar *o_save_buffer (TOPLEVEL *toplevel)
 
   acc = g_string_new (o_file_format_header());
 
-  buffer = o_save_objects (s_page_objects (toplevel->page_current), FALSE);
+  buffer = o_save_objects (object_list, FALSE);
   g_string_append (acc, buffer);
   g_free (buffer);
 
@@ -92,7 +93,7 @@ gchar *o_save_buffer (TOPLEVEL *toplevel)
  *  we recurse for saving out those attributes, the function must be called
  *  with save_attribs passed as TRUE.
  *
- *  \param [in] object_list   Head of list of objects to save.
+ *  \param [in] object_list   The head of a GList of objects to save.
  *  \param [in] save_attribs  Should attribute objects encounterd be saved?
  *  \returns a buffer containing schematic data or NULL on failure.
  */
@@ -217,11 +218,13 @@ gchar *o_save_objects (const GList *object_list, gboolean save_attribs)
 /*! \brief Save a file
  *  \par Function Description
  *  This function saves the data in a libgeda format to a file
- *  \param [in] toplevel  The data to save to file.
- *  \param [in] filename   The filename to save the data to.
+ *  \param [in] toplevel    The current TOPLEVEL.
+ *  \param [in] object_list The head of a GList of OBJECTs to save.
+ *  \param [in] filename    The filename to save the data to.
  *  \return 1 on success, 0 on failure.
  */
-int o_save(TOPLEVEL *toplevel, const char *filename)
+int o_save (TOPLEVEL *toplevel, const GList *object_list,
+            const char *filename)
 {
   FILE *fp;
   char *buffer;
@@ -233,7 +236,7 @@ int o_save(TOPLEVEL *toplevel, const char *filename)
     return 0;
   }
 
-  buffer = o_save_buffer (toplevel);
+  buffer = o_save_buffer (toplevel, object_list);
   if (fwrite (buffer, strlen(buffer), 1, fp) != 1) {
     /* An error occurred with fwrite */
 #warning FIXME: What do we do?
@@ -244,6 +247,19 @@ int o_save(TOPLEVEL *toplevel, const char *filename)
   return 1;
 }
 
+/*! \brief Save a file
+ *  \par Function Description
+ *  This function saves the current page in a libgeda format to a file
+ *  \param [in] toplevel    The current TOPLEVEL.
+ *  \param [in] filename    The filename to save the data to.
+ *  \return 1 on success, 0 on failure.
+ */
+int o_save_curr_page (TOPLEVEL *toplevel, const char *filename)
+{
+  return o_save (toplevel, s_page_objects (toplevel->page_current),
+                 filename);
+}
+
 /*! \brief Read a memory buffer
  *  \par Function Description
  *  This function reads data in libgeda format from a memory buffer.
diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index 44ec096..0cf7640 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -347,7 +347,7 @@ void f_close(TOPLEVEL *toplevel)
  */
 void f_save_close(TOPLEVEL *toplevel, char *filename)
 {
-  o_save(toplevel, filename);
+  o_save_curr_page (toplevel, filename);
   s_page_delete (toplevel, toplevel->page_current);
 }
 
@@ -444,7 +444,7 @@ int f_save(TOPLEVEL *toplevel, const char *filename)
   g_free (dirname);
   g_free (only_filename);
   
-  if (o_save(toplevel, real_filename)) {
+  if (o_save_curr_page (toplevel, real_filename)) {
 
     toplevel->page_current->saved_since_first_loaded = 1;
 




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