[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_funcs.c
User: pcjc2
Date: 07/02/11 18:58:59
Modified: . Tag: noscreen g_funcs.c g_rc.c g_register.c
globals.c i_vars.c o_bus.c o_grips.c o_misc.c
o_net.c o_picture.c x_attribedit.c x_autonumber.c
x_compselect.c x_dialog.c x_image.c x_log.c
x_menus.c x_multiattrib.c x_preview.c x_print.c
x_script.c
Log:
Sync with trunc
Revision Changes Path
No revision
No revision
1.19.6.1 +8 -4 eda/geda/gaf/gschem/src/g_funcs.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_funcs.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_funcs.c,v
retrieving revision 1.19
retrieving revision 1.19.6.1
diff -u -b -r1.19 -r1.19.6.1
--- g_funcs.c 30 Aug 2006 11:06:16 -0000 1.19
+++ g_funcs.c 11 Feb 2007 23:58:55 -0000 1.19.6.1
@@ -52,9 +52,11 @@
SCM_ARG1, "gschem-print");
if (output_filename) {
- f_print_file (global_window_current, output_filename);
+ if (f_print_file (global_window_current, output_filename))
+ return SCM_BOOL_F;
} else {
- f_print_file (global_window_current, SCM_STRING_CHARS (filename));
+ if (f_print_file (global_window_current, SCM_STRING_CHARS (filename)))
+ return SCM_BOOL_F;
}
return SCM_BOOL_T;
@@ -71,9 +73,11 @@
SCM_ARG1, "gschem-postscript");
if (output_filename) {
- f_print_file (global_window_current, output_filename);
+ if (f_print_file (global_window_current, output_filename))
+ return SCM_BOOL_F;
} else {
- f_print_file (global_window_current, SCM_STRING_CHARS (filename));
+ if (f_print_file (global_window_current, SCM_STRING_CHARS (filename)))
+ return SCM_BOOL_F;
}
return SCM_BOOL_T;
1.42.2.1 +27 -0 eda/geda/gaf/gschem/src/g_rc.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_rc.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_rc.c,v
retrieving revision 1.42
retrieving revision 1.42.2.1
diff -u -b -r1.42 -r1.42.2.1
--- g_rc.c 3 Dec 2006 02:27:13 -0000 1.42
+++ g_rc.c 11 Feb 2007 23:58:56 -0000 1.42.2.1
@@ -662,6 +662,33 @@
return SCM_BOOL_T;
}
+/*! \brief Sets the output font scaling factor
+ *
+ * \par Use this setting to change the scale of the output PS font
+ * characters. This allows to fine tune the font size so that it
+ * matches more closely with the screen.
+ *
+ * \return SCM_BOOL_T always.
+ */
+
+SCM g_rc_postscript_font_scale(SCM scale)
+{
+ float val;
+
+ SCM_ASSERT (SCM_REALP (scale), scale, SCM_ARG1, "postscript-font-scale");
+
+ val =(float)(SCM_REAL_VALUE (scale));
+ if (val == 0) {
+ fprintf(stderr, _("Invalid size [%f] passed to postscript-font-scale\n"),
+ val);
+ val = 1.0; /* absolute default */
+ }
+
+ default_postscript_font_scale = val;
+
+ return SCM_BOOL_T;
+}
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
1.49.2.1 +2 -0 eda/geda/gaf/gschem/src/g_register.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_register.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/g_register.c,v
retrieving revision 1.49
retrieving revision 1.49.2.1
diff -u -b -r1.49 -r1.49.2.1
--- g_register.c 5 Dec 2006 22:52:07 -0000 1.49
+++ g_register.c 11 Feb 2007 23:58:56 -0000 1.49.2.1
@@ -99,6 +99,8 @@
{ "attribute-name", 1, 0, 0, g_rc_attribute_name },
{ "paper-size", 2, 0, 0, g_rc_paper_size },
{ "paper-sizes", 3, 0, 0, g_rc_paper_sizes },
+ { "postscript-font-scale", 1, 0, 0, g_rc_postscript_font_scale },
+
/* text-output is old... will eventually be removed! */
{ "text-output", 1, 0, 0, g_rc_output_text },
{ "output-text", 1, 0, 0, g_rc_output_text },
1.18.6.1 +0 -1 eda/geda/gaf/gschem/src/globals.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globals.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/globals.c,v
retrieving revision 1.18
retrieving revision 1.18.6.1
diff -u -b -r1.18 -r1.18.6.1
--- globals.c 28 Sep 2006 18:00:32 -0000 1.18
+++ globals.c 11 Feb 2007 23:58:56 -0000 1.18.6.1
@@ -63,7 +63,6 @@
void (*pin_draw_func)() = o_pin_draw;
void (*select_func)() = o_select_object; /* NEW SELECTION code */
void (*x_log_update_func)() = NULL;
-void (*quit_func)() = NULL; /* not used by gschem */
void (*variable_set_func)() = NULL; /* not used by gschem */
int (*load_newer_backup_func)() = x_fileselect_load_backup;
1.35.2.1 +2 -0 eda/geda/gaf/gschem/src/i_vars.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_vars.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_vars.c,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -u -b -r1.35 -r1.35.2.1
--- i_vars.c 3 Dec 2006 02:27:13 -0000 1.35
+++ i_vars.c 11 Feb 2007 23:58:56 -0000 1.35.2.1
@@ -32,6 +32,7 @@
int default_text_color = TEXT_COLOR;
int default_text_size = 10;
int default_text_caps = LOWER;
+float default_postscript_font_scale = 1.0;
int default_attribute_color = ATTRIBUTE_COLOR;
int default_detachattr_color = DETACHED_ATTRIBUTE_COLOR;
int default_net_color = NET_COLOR;
@@ -149,6 +150,7 @@
w_current->text_color = default_text_color;
w_current->text_size = default_text_size;
w_current->text_caps = default_text_caps;
+ w_current->postscript_font_scale = default_postscript_font_scale;
w_current->attribute_color = default_attribute_color;
w_current->detachedattr_color = default_detachattr_color;
1.21.6.2 +1 -1 eda/geda/gaf/gschem/src/o_bus.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_bus.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_bus.c,v
retrieving revision 1.21.6.1
retrieving revision 1.21.6.2
diff -u -b -r1.21.6.1 -r1.21.6.2
--- o_bus.c 27 Dec 2006 17:37:56 -0000 1.21.6.1
+++ o_bus.c 11 Feb 2007 23:58:56 -0000 1.21.6.2
@@ -67,7 +67,7 @@
gdk_gc_set_line_attributes(w_current->gc, size, GDK_LINE_SOLID,
GDK_CAP_BUTT,
- GDK_CAP_NOT_LAST);
+ GDK_JOIN_MITER);
}
if (w_current->override_color != -1 ) {
1.12.6.2 +1 -1 eda/geda/gaf/gschem/src/o_grips.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_grips.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_grips.c,v
retrieving revision 1.12.6.1
retrieving revision 1.12.6.2
diff -u -b -r1.12.6.1 -r1.12.6.2
--- o_grips.c 27 Dec 2006 17:37:56 -0000 1.12.6.1
+++ o_grips.c 11 Feb 2007 23:58:56 -0000 1.12.6.2
@@ -1243,7 +1243,7 @@
gdk_gc_set_line_attributes(w_current->gc, size,
GDK_LINE_SOLID,
GDK_CAP_BUTT,
- GDK_CAP_NOT_LAST);
+ GDK_JOIN_MITER);
}
gdk_gc_set_foreground(w_current->gc,
1.36.2.4 +2 -116 eda/geda/gaf/gschem/src/o_misc.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_misc.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_misc.c,v
retrieving revision 1.36.2.3
retrieving revision 1.36.2.4
diff -u -b -r1.36.2.3 -r1.36.2.4
--- o_misc.c 27 Dec 2006 19:56:42 -0000 1.36.2.3
+++ o_misc.c 11 Feb 2007 23:58:56 -0000 1.36.2.4
@@ -507,120 +507,6 @@
}
}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void o_embed(TOPLEVEL *w_current, OBJECT *o_current)
-{
- gchar *new_basename;
-
- /* check o_current is a complex and is not already embedded */
- if (o_current->type == OBJ_COMPLEX &&
- !o_complex_is_embedded (o_current))
- {
- /* change the clib of complex to "EMBEDDED" */
- if (o_current->complex_clib) {
- g_free (o_current->complex_clib);
- }
- o_current->complex_clib = g_strdup ("EMBEDDED");
-
- /* change the basename to "EMBEDDED"+basename */
- new_basename = g_strconcat ("EMBEDDED",
- o_current->complex_basename,
- NULL);
- g_free (o_current->complex_basename);
- o_current->complex_basename = new_basename;
-
- s_log_message (_("Component [%s] has been embedded\n"),
- o_current->complex_basename + 8);
-
- /* page content has been modified */
- w_current->page_current->CHANGED = 1;
- }
-
- /* If it's a picture and it's not embedded */
- if ( (o_current->type == OBJ_PICTURE) &&
- (o_current->picture->embedded == 0) ) {
-
- o_current->picture->embedded = 1;
-
- s_log_message (_("Picture [%s] has been embedded\n"),
- basename(o_current->picture->filename));
-
-
- /* page content has been modified */
- w_current->page_current->CHANGED = 1;
- }
-
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void o_unembed(TOPLEVEL *w_current, OBJECT *o_current)
-{
- gchar *new_basename, *new_clib;
- const GSList *clibs;
-
- /* check o_current is an embedded complex */
- if (o_current->type == OBJ_COMPLEX &&
- o_complex_is_embedded (o_current))
- {
- /* get ride of the EMBEDDED word in basename */
- new_basename = g_strdup (o_current->complex_basename + 8);
-
- /* search for the symbol in the library */
- clibs = s_clib_search_basename (new_basename);
-
- if (!clibs) {
- /* symbol not found in the symbol library: signal an error */
- s_log_message (_("Could not find component [%s], while trying to unembed. Component is still embedded\n"),
- o_current->complex_basename + 8);
-
- } else {
- /* set the object new basename */
- g_free (o_current->complex_basename);
- o_current->complex_basename = new_basename;
-
- /* set the object new clib */
- g_free (o_current->complex_clib);
- if (g_slist_next (clibs)) {
- s_log_message (_("More than one component found with name [%s]\n"),
- new_basename);
- /* PB: for now, use the first directory in clibs */
- /* PB: maybe open a dialog to select the right one? */
- }
- new_clib = g_strdup ((gchar*)clibs->data);
- o_current->complex_clib = new_clib;
-
- s_log_message (_("Component [%s] has been successfully unembedded\n"),
- o_current->complex_basename);
-
- /* page content has been modified */
- w_current->page_current->CHANGED = 1;
-
- }
- }
-
- /* If it's a picture and it's embedded */
- if ( (o_current->type == OBJ_PICTURE) &&
- (o_current->picture->embedded == 1) ) {
-
- o_current->picture->embedded = 0;
-
- s_log_message (_("Picture [%s] has been unembedded\n"),
- basename(o_current->picture->filename));
-
-
- /* page content has been modified */
- w_current->page_current->CHANGED = 1;
- }
-
-}
/*! \todo Finish function documentation!!!
* \brief
@@ -1281,9 +1167,9 @@
o_redraw_single (w_current, o_current);
if (is_embedded) {
- /* we previously allocated memory for basename and clib */
+ /* we previously allocated memory for basename */
g_free (basename);
- g_free (clib);
+ /* clib should not be freed here since it is owned by libgeda */
}
/* mark the page as modified */
1.29.6.2 +2 -2 eda/geda/gaf/gschem/src/o_net.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_net.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_net.c,v
retrieving revision 1.29.6.1
retrieving revision 1.29.6.2
diff -u -b -r1.29.6.1 -r1.29.6.2
--- o_net.c 27 Dec 2006 17:37:56 -0000 1.29.6.1
+++ o_net.c 11 Feb 2007 23:58:57 -0000 1.29.6.2
@@ -74,12 +74,12 @@
gdk_gc_set_line_attributes(w_current->gc, size,
GDK_LINE_SOLID,
GDK_CAP_BUTT,
- GDK_CAP_NOT_LAST);
+ GDK_JOIN_MITER);
gdk_gc_set_line_attributes(w_current->bus_gc, size,
GDK_LINE_SOLID,
GDK_CAP_BUTT,
- GDK_CAP_NOT_LAST);
+ GDK_JOIN_MITER);
}
if (w_current->override_color != -1 ) {
1.6.6.2 +132 -228 eda/geda/gaf/gschem/src/o_picture.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_picture.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/o_picture.c,v
retrieving revision 1.6.6.1
retrieving revision 1.6.6.2
diff -u -b -r1.6.6.1 -r1.6.6.2
--- o_picture.c 27 Dec 2006 17:37:56 -0000 1.6.6.1
+++ o_picture.c 11 Feb 2007 23:58:57 -0000 1.6.6.2
@@ -157,82 +157,35 @@
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Creates the add image dialog
* \par Function Description
- *
+ * This function creates the add image dialog and loads the selected picture.
*/
void picture_selection_dialog (TOPLEVEL *w_current)
{
- GtkWidget *file_selector;
+ gchar *filename;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
- /* Create the selector */
- if (!w_current->pfswindow) {
-#if DEBUG
- printf("Creating new picture file selection dialog\n");
-#endif
- w_current->pfswindow = gtk_file_selection_new (_("Please select a picture file."));
- file_selector = w_current->pfswindow;
+ w_current->pfswindow = gtk_file_chooser_dialog_new ("Select a picture file...",
+ GTK_WINDOW(w_current->main_window),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
if (w_current->pixbuf_filename)
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_selector), w_current->pixbuf_filename);
- gtk_window_position(GTK_WINDOW (w_current->pfswindow),
- GTK_WIN_POS_NONE);
-
- gtk_window_set_transient_for(GTK_WINDOW(file_selector),
- GTK_WINDOW(w_current->main_window));
-
- g_signal_connect (G_OBJECT (file_selector), "destroy",
- G_CALLBACK (picture_selection_cancel), w_current);
-
-
- g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
- "clicked",
- G_CALLBACK (picture_selection_ok),
- w_current);
-
- /*
- * Ensure that the dialog box is destroyed when the user clicks the
- * cancel button.
- */
- g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->cancel_button),
- "clicked",
- G_CALLBACK (picture_selection_cancel),
- w_current);
-
- }
-
- /* Display that dialog */
- if (!GTK_WIDGET_VISIBLE (w_current->pfswindow)) {
- gtk_widget_show (w_current->pfswindow);
-#if 0
- gtk_grab_add (w_current->pfswindow);
-#endif
- } else {
- gdk_window_raise(w_current->pfswindow->window);
- }
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void picture_selection_ok (GtkWidget *widget, TOPLEVEL *w_current)
-{
- GtkWidget *file_selector = (GtkWidget *)w_current->pfswindow;
- const gchar *selected_filename;
- GdkPixbuf *pixbuf;
- GError *error;
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(w_current->pfswindow),
+ w_current->pixbuf_filename);
+ if (gtk_dialog_run (GTK_DIALOG (w_current->pfswindow)) == GTK_RESPONSE_ACCEPT) {
- selected_filename = (char *) g_strdup(gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selector)));
-#if DEBUG
- g_print ("Selected picture: %s\n", selected_filename);
-#endif
- picture_selection_cancel(widget, w_current);
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w_current->pfswindow));
+ gtk_widget_destroy(w_current->pfswindow);
+ w_current->pfswindow=NULL;
- error = NULL;
- pixbuf = gdk_pixbuf_new_from_file (selected_filename, &error);
+ pixbuf = gdk_pixbuf_new_from_file (filename, &error);
if (!pixbuf) {
GtkWidget *dialog;
@@ -243,48 +196,35 @@
GTK_BUTTONS_CLOSE,
_("Failed to load picture: %s"),
error->message);
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
+ /* Wait for any user response */
+ gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_show (dialog);
- return;
+ g_error_free (error);
+ gtk_widget_destroy(dialog);
}
-
+ else {
#if DEBUG
printf("Picture loaded succesfully.\n");
#endif
- exit_if_null(w_current);
-
o_erase_rubber(w_current);
-
i_update_middle_button(w_current, i_callback_add_picture, _("Picture"));
w_current->inside_action = 0;
- o_picture_set_pixbuf(w_current, pixbuf, (char *) selected_filename);
- /* o_picture_set_pixbuf allocates memory for filename, so free the pointer */
- g_free((char *)selected_filename);
+ o_picture_set_pixbuf(w_current, pixbuf, filename);
w_current->page_current->CHANGED=1;
-
i_allow_expose();
i_set_state(w_current, DRAWPICTURE);
+ }
+ g_free (filename);
+ }
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void picture_selection_cancel (GtkWidget *widget, TOPLEVEL *w_current)
-{
- i_set_state(w_current, SELECT);
i_update_toolbar(w_current);
+ if (w_current->pfswindow) {
gtk_widget_destroy(w_current->pfswindow);
w_current->pfswindow=NULL;
+ }
}
/*! \todo Finish function documentation!!!
@@ -716,68 +656,21 @@
abs(screen_y2 - screen_y1));
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Replace all selected pictures with a new picture
* \par Function Description
+ * This function replaces all pictures in the current selection with a
+ * new image.
*
- */
-void picture_change_selection_cancel (GtkWidget *widget, TOPLEVEL *w_current)
-{
- i_set_state(w_current, SELECT);
- i_update_toolbar(w_current);
- gtk_widget_destroy(w_current->pcfswindow);
- w_current->pcfswindow=NULL;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
+ * \param [in] w_current The TOPLEVEL object
+ * \param [in] pixbuf New GdkPixbuf object
+ * \param [in] filename The filename of the new picture
*
*/
-void picture_change_selection_ok (GtkWidget *widget, TOPLEVEL *w_current)
+void o_picture_exchange (TOPLEVEL *w_current, GdkPixbuf *pixbuf,
+ const gchar *filename)
{
- GtkWidget *file_selector = (GtkWidget *)w_current->pcfswindow;
- const gchar *selected_filename;
- GdkPixbuf *pixbuf;
- GError *error;
GList *list;
- selected_filename = (char *) g_strdup(gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selector)));
-#if DEBUG
- g_print ("Selected picture: %s\n", selected_filename);
-#endif
- picture_change_selection_cancel(widget, w_current);
-
- error = NULL;
- pixbuf = gdk_pixbuf_new_from_file (selected_filename, &error);
-
- if (!pixbuf) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (w_current->main_window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Failed to load picture: %s"),
- error->message);
- g_error_free (error);
-
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
- return;
- }
-#if DEBUG
- printf("Picture loaded succesfully.\n");
-#endif
-
- exit_if_null(w_current);
-
- o_erase_rubber(w_current);
-
- w_current->inside_action = 0;
-
list = w_current->page_current->selection_list;
while (list != NULL) {
OBJECT *object;
@@ -811,80 +704,91 @@
return;
}
- object->picture->filename = (char *) g_strdup(selected_filename);
+ object->picture->filename = (char *) g_strdup(filename);
object->picture->ratio = gdk_pixbuf_get_width(pixbuf) /
gdk_pixbuf_get_height(pixbuf);
/* Draw new picture */
o_picture_draw(w_current, object);
-
}
}
list = list->next;
}
-
- g_free ((char *) selected_filename);
- g_object_unref(pixbuf);
- w_current->page_current->CHANGED=1;
-
- i_allow_expose();
-
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create dialog to exchange picture objects
* \par Function Description
+ * This function opens a file chooser and replaces all pictures of the selections
+ * with the new picture.
*
+ * \todo Maybe merge this dialog function with picture_selection_dialog()
*/
void picture_change_filename_dialog (TOPLEVEL *w_current)
{
+ gchar *filename;
+ GdkPixbuf *pixbuf;
+ GError *error = NULL;
- GtkWidget *file_selector;
-
- /* Create the selector */
- if (!w_current->pcfswindow) {
-#if DEBUG
- printf("Creating change picture file selection dialog\n");
-#endif
- w_current->pcfswindow = gtk_file_selection_new (_("Please select a picture file."));
- file_selector = w_current->pcfswindow;
+ w_current->pfswindow = gtk_file_chooser_dialog_new ("Select a picture file...",
+ GTK_WINDOW(w_current->main_window),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
if (w_current->pixbuf_filename)
- gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_selector),
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(w_current->pfswindow),
w_current->pixbuf_filename);
- gtk_window_position(GTK_WINDOW(w_current->pcfswindow),
- GTK_WIN_POS_NONE);
- gtk_window_set_transient_for(GTK_WINDOW(file_selector),
- GTK_WINDOW(w_current->main_window));
+ if (gtk_dialog_run (GTK_DIALOG (w_current->pfswindow)) == GTK_RESPONSE_ACCEPT) {
- g_signal_connect (G_OBJECT(file_selector), "destroy",
- G_CALLBACK(picture_change_selection_cancel),
- w_current);
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w_current->pfswindow));
+ gtk_widget_destroy(w_current->pfswindow);
+ w_current->pfswindow=NULL;
+ pixbuf = gdk_pixbuf_new_from_file (filename, &error);
- g_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(file_selector)->ok_button),
- "clicked",
- G_CALLBACK(picture_change_selection_ok),
- w_current);
+ if (!pixbuf) {
+ GtkWidget *dialog;
- /*
- * Ensure that the dialog box is destroyed when the user clicks the
- * cancel button.
- */
- g_signal_connect (GTK_OBJECT(GTK_FILE_SELECTION(file_selector)->cancel_button),
- "clicked",
- G_CALLBACK (picture_change_selection_cancel),
- w_current);
+ dialog = gtk_message_dialog_new (GTK_WINDOW (w_current->main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Failed to load picture: %s"),
+ error->message);
+ /* Wait for any user response */
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ g_error_free (error);
+ gtk_widget_destroy(dialog);
+ }
+ else {
+#if DEBUG
+ printf("Picture loaded succesfully.\n");
+#endif
+ o_erase_rubber(w_current);
+ w_current->inside_action = 0;
+
+ /* \FIXME Should we set the pixbuf buffer in TOPLEVEL to store
+ the current pixbuf? (Werner)
+ o_picture_set_pixbuf(w_current, pixbuf, filename); */
+
+ o_picture_exchange(w_current, pixbuf, filename);
+
+ g_object_unref(pixbuf);
+ w_current->page_current->CHANGED=1;
+
+ i_allow_expose();
+ }
+ g_free (filename);
}
- /* Display that dialog */
- if (!GTK_WIDGET_VISIBLE (w_current->pcfswindow)) {
- gtk_widget_show (w_current->pcfswindow);
- #if 0
- gtk_grab_add (w_current->pcfswindow);
- #endif
- } else {
- gdk_window_raise(w_current->pcfswindow->window);
+ i_update_toolbar(w_current);
+ if (w_current->pfswindow) {
+ gtk_widget_destroy(w_current->pfswindow);
+ w_current->pfswindow=NULL;
}
}
1.5.6.2 +120 -240 eda/geda/gaf/gschem/src/x_attribedit.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_attribedit.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_attribedit.c,v
retrieving revision 1.5.6.1
retrieving revision 1.5.6.2
diff -u -b -r1.5.6.1 -r1.5.6.2
--- x_attribedit.c 27 Dec 2006 17:37:56 -0000 1.5.6.1
+++ x_attribedit.c 11 Feb 2007 23:58:57 -0000 1.5.6.2
@@ -33,12 +33,12 @@
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
+#include "../include/x_dialog.h"
#ifdef HAVE_LIBDMALLOC
#include <dmalloc.h>
#endif
-
/***************** Start of Attrib Edit dialog box ********************/
/*! \section attrib-edit-dialog-box Atrib Edit Dialog Box */
@@ -67,22 +67,6 @@
* \par Function Documentation
*
*/
-int attrib_edit_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- attrib_edit_dialog_cancel(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Documentation
- *
- */
void attrib_edit_dialog_ok(GtkWidget * w, TOPLEVEL * w_current)
{
const char *value, *label;
@@ -266,60 +250,41 @@
g_free(newtext);
}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Documentation
- *
+/*! \brief Response function for the attribute add/edit dialog
+ * \par Function Description
+ * This function catches the user response for the add and edit
+ * attribute dialog.
*/
-void attrib_edit_dialog_cancel(GtkWidget *w, TOPLEVEL *w_current)
+void attribute_edit_dialog_response(GtkWidget *w, gint response,
+ TOPLEVEL *w_current)
{
+ switch(response) {
+ case GTK_RESPONSE_APPLY:
+ attrib_edit_dialog_ok(NULL, w_current);
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
i_set_state(w_current, SELECT);
gtk_grab_remove(w_current->aewindow);
gtk_widget_destroy(w_current->aewindow);
w_current->aewindow = NULL;
+ break;
+ default:
+ printf("attrib_edit_dialog_response(): strange signal %d\n", response);
+ }
+ /* clean up */
}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Documentation
- *
- */
-void attrib_edit_dialog_delete(GtkWidget *w, TOPLEVEL *w_current)
-{
- OBJECT *object;
-
- /* for now unselect everything, but in the future you really ought
- * to just unselect a single object */
- o_unselect_all(w_current);
-
- object = gtk_object_get_data(GTK_OBJECT(w_current->aewindow),"attrib");
- o_delete_text(w_current, object);
- w_current->page_current->CHANGED=1;
- o_undo_savestate(w_current, UNDO_ALL);
- i_set_state(w_current, SELECT);
- i_update_menus(w_current);
- gtk_grab_remove(w_current->aewindow);
- gtk_widget_destroy(w_current->aewindow);
- w_current->aewindow = NULL;
-}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Documentation
- *
+/*! \brief Create the attribute add/edit dialog
+ * \par Function Description
+ * This function creates the single attribute edit dialog.
*/
void attrib_edit_dialog(TOPLEVEL * w_current, OBJECT * list, int flag)
{
GtkWidget *aewindow;
- GtkWidget *table1;
- GtkWidget *hbox1;
- GtkWidget *hbuttonbox1;
- GtkWidget *okbutton;
- GtkWidget *deletebutton=NULL;
- GtkWidget *cancelbutton;
- GtkWidget *frame1;
- GtkWidget *table3;
+ GtkWidget *vbox, *label, *table, *alignment;
GtkWidget *show_options;
GtkWidget *show_options_menu;
GtkWidget *glade_menuitem;
@@ -327,10 +292,6 @@
GtkWidget *attrib_combo_entry;
GtkWidget *value_entry;
GtkWidget *visbutton;
- GtkWidget *label2;
- GtkWidget *label1;
- GtkWidget *frame2;
- GtkWidget *hbox2;
GSList *hbox2_group = NULL;
GtkWidget *addtoallbutton;
GtkWidget *addtocompsbutton;
@@ -350,151 +311,96 @@
if (w_current->aewindow)
return;
- /* gschem specific */
- s_current = w_current->page_current->selection_list;
- while (s_current != NULL) {
+ /* gschem specific: What do we count here? (Werner) */
+ for (s_current = w_current->page_current->selection_list;
+ s_current != NULL;
+ s_current = s_current->next) {
if (!((OBJECT *) s_current->data)->attached_to) {
nsel++;
}
- s_current = s_current->next;
}
- aewindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_object_set_data (GTK_OBJECT (aewindow), "aewindow", aewindow);
- gtk_window_set_title (GTK_WINDOW (aewindow), _("Single Attribute Editor"));
+
+ aewindow = gtk_dialog_new_with_buttons(_("Single Attribute Editor"),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_APPLY,
+ NULL);
+
+ gtk_signal_connect(GTK_OBJECT(aewindow), "response",
+ GTK_SIGNAL_FUNC(attribute_edit_dialog_response), w_current);
+
gtk_window_set_position (GTK_WINDOW (aewindow), GTK_WIN_POS_MOUSE);
- gtk_window_set_modal (GTK_WINDOW (aewindow), TRUE);
- gtk_window_set_transient_for(GTK_WINDOW(aewindow),
- GTK_WINDOW(w_current->main_window));
-
- table1 = gtk_table_new (3, 1, FALSE);
- gtk_widget_ref (table1);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "table1", table1,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (table1);
- gtk_container_add (GTK_CONTAINER (aewindow), table1);
- gtk_container_set_border_width (GTK_CONTAINER (aewindow), 5);
-
- hbox1 = gtk_hbox_new (FALSE, 0);
- gtk_widget_ref (hbox1);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "hbox1", hbox1,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (hbox1);
- gtk_table_attach (GTK_TABLE (table1), hbox1, 0, 1, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
- hbuttonbox1 = gtk_hbutton_box_new ();
- gtk_widget_ref (hbuttonbox1);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "hbuttonbox1", hbuttonbox1,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (hbuttonbox1);
- gtk_box_pack_start (GTK_BOX (hbox1), hbuttonbox1, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox1), 1);
-
- if (list) { /* gschem specific */
- deletebutton = gtk_button_new_from_stock (GTK_STOCK_DELETE);
- gtk_widget_ref (deletebutton);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "deletebutton", deletebutton,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (deletebutton);
- gtk_container_add (GTK_CONTAINER (hbuttonbox1), deletebutton);
- gtk_container_set_border_width (GTK_CONTAINER (deletebutton), 3);
- GTK_WIDGET_SET_FLAGS (deletebutton, GTK_CAN_DEFAULT);
- }
+ gtk_dialog_set_default_response(GTK_DIALOG(aewindow),
+ GTK_RESPONSE_ACCEPT);
- cancelbutton = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_widget_ref (cancelbutton);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "cancelbutton", cancelbutton,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (cancelbutton);
- gtk_container_add (GTK_CONTAINER (hbuttonbox1), cancelbutton);
- gtk_container_set_border_width (GTK_CONTAINER (cancelbutton), 3);
- GTK_WIDGET_SET_FLAGS (cancelbutton, GTK_CAN_DEFAULT);
-
- okbutton = gtk_button_new_from_stock (GTK_STOCK_OK);
- gtk_widget_ref (okbutton);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "okbutton", okbutton,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (okbutton);
- gtk_container_add (GTK_CONTAINER (hbuttonbox1), okbutton);
- gtk_container_set_border_width (GTK_CONTAINER (okbutton), 3);
- GTK_WIDGET_SET_FLAGS (okbutton, GTK_CAN_DEFAULT);
- gtk_button_set_relief (GTK_BUTTON (okbutton), GTK_RELIEF_HALF);
-
- frame1 = gtk_frame_new (_("Add/Edit Attribute"));
- gtk_widget_ref (frame1);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "frame1", frame1,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (frame1);
- gtk_table_attach (GTK_TABLE (table1), frame1, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
- gtk_container_set_border_width (GTK_CONTAINER (frame1), 6);
+ vbox = GTK_DIALOG(aewindow)->vbox;
+ gtk_container_set_border_width(GTK_CONTAINER(aewindow),
+ DIALOG_BORDER_SPACING);
+ gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- table3 = gtk_table_new (3, 2, FALSE);
- gtk_widget_ref (table3);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "table3", table3,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (table3);
- gtk_container_add (GTK_CONTAINER (frame1), table3);
- gtk_container_set_border_width (GTK_CONTAINER (table3), 6);
+ if (list)
+ label = gtk_label_new(_("<b>Edit Attribute</b>"));
+ else
+ label = gtk_label_new(_("<b>Add Attribute</b>"));
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+
+ alignment = gtk_alignment_new(0,0,1,1);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0,
+ DIALOG_INDENTATION, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), alignment, TRUE, TRUE, 0);
+
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
+ gtk_container_add (GTK_CONTAINER (alignment), table);
+
+ /* Name selection */
+ label = gtk_label_new (_("Name:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (GTK_FILL), 0, 0);
attrib_combo = gtk_combo_new ();
- gtk_widget_ref (attrib_combo);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "attrib_combo", attrib_combo,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (attrib_combo);
- gtk_table_attach (GTK_TABLE (table3), attrib_combo, 1, 2, 0, 1,
+ gtk_table_attach (GTK_TABLE (table), attrib_combo, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
-
attrib_combo_entry = GTK_COMBO (attrib_combo)->entry;
gtk_widget_ref (attrib_combo_entry);
gtk_object_set_data_full (GTK_OBJECT (aewindow), "attrib_combo_entry", attrib_combo_entry,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (attrib_combo_entry);
+
+ /* Value entry */
+ label = gtk_label_new (_("Value:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
value_entry = gtk_entry_new ();
gtk_widget_ref (value_entry);
gtk_object_set_data_full (GTK_OBJECT (aewindow), "value_entry", value_entry,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (value_entry);
- gtk_table_attach (GTK_TABLE (table3), value_entry, 1, 2, 1, 2,
+ gtk_table_attach (GTK_TABLE (table), value_entry, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 8);
+ (GtkAttachOptions) (0), 0, 0);
+ /* Visibility */
visbutton = gtk_check_button_new_with_label (_("Visible"));
gtk_widget_ref (visbutton);
gtk_object_set_data_full (GTK_OBJECT (aewindow), "visbutton", visbutton,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (visbutton);
- gtk_table_attach (GTK_TABLE (table3), visbutton, 0, 1, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 3, 0);
- gtk_container_set_border_width (GTK_CONTAINER (visbutton), 3);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (visbutton), TRUE);
- label2 = gtk_label_new (_("Value:"));
- gtk_widget_ref (label2);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "label2", label2,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (label2);
- gtk_table_attach (GTK_TABLE (table3), label2, 0, 1, 1, 2,
- (GtkAttachOptions) (0),
- (GtkAttachOptions) (0), 0, 3);
- gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
-
- label1 = gtk_label_new (_("Name:"));
- gtk_widget_ref (label1);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "label1", label1,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (label1);
- gtk_table_attach (GTK_TABLE (table3), label1, 0, 1, 0, 1,
- (GtkAttachOptions) (0),
- (GtkAttachOptions) (0), 0, 3);
- gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_RIGHT);
- gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
- gtk_misc_set_padding (GTK_MISC (label1), 4, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (visbutton), TRUE);
+ gtk_table_attach (GTK_TABLE (table), visbutton, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
show_options = gtk_option_menu_new ();
gtk_widget_ref (show_options);
@@ -502,72 +408,67 @@
show_options,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (show_options);
- gtk_table_attach (GTK_TABLE (table3), show_options, 1, 2, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
+ gtk_table_attach (GTK_TABLE (table), show_options, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
(GtkAttachOptions) (0), 0, 0);
show_options_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("Show Value Only"));
- gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (show_options_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Show Name Only"));
- gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (show_options_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Show Name & Value"));
- gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (show_options_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (show_options), show_options_menu);
gtk_option_menu_set_history (GTK_OPTION_MENU (show_options), 0);
if (nsel > 1) { /* gschem specific */
- frame2 = gtk_frame_new (_("Multiple Attach"));
- gtk_widget_ref (frame2);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "frame2", frame2,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (frame2);
- gtk_table_attach (GTK_TABLE (table1), frame2, 0, 1, 1, 2,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
- gtk_container_set_border_width (GTK_CONTAINER (frame2), 6);
- hbox2 = gtk_hbox_new (FALSE, 0);
- gtk_widget_ref (hbox2);
- gtk_object_set_data_full (GTK_OBJECT (aewindow), "hbox2", hbox2,
- (GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (hbox2);
- gtk_container_add (GTK_CONTAINER (frame2), hbox2);
+ label = gtk_label_new(_("<b>Attach Options</b>"));
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+
+ alignment = gtk_alignment_new(0,0,1,1);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0,
+ DIALOG_INDENTATION, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), alignment, TRUE, TRUE, 0);
+
+ table = gtk_table_new (2, 3, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
+ gtk_container_add (GTK_CONTAINER (alignment), table);
addtoallbutton = gtk_radio_button_new_with_label (hbox2_group, _("All"));
hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (addtoallbutton));
gtk_widget_ref (addtoallbutton);
gtk_object_set_data_full (GTK_OBJECT (aewindow), "addtoallbutton", addtoallbutton,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (addtoallbutton);
- gtk_box_pack_start (GTK_BOX (hbox2), addtoallbutton, FALSE, FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (addtoallbutton), 3);
+ gtk_table_attach(GTK_TABLE(table), addtoallbutton, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
addtocompsbutton = gtk_radio_button_new_with_label (hbox2_group, _("Components"));
hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (addtocompsbutton));
gtk_widget_ref (addtocompsbutton);
gtk_object_set_data_full (GTK_OBJECT (aewindow), "addtocompsbutton", addtocompsbutton,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (addtocompsbutton);
- gtk_box_pack_start (GTK_BOX (hbox2), addtocompsbutton, FALSE, FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (addtocompsbutton), 3);
+ gtk_table_attach(GTK_TABLE(table), addtocompsbutton, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
addtonetsbutton = gtk_radio_button_new_with_label (hbox2_group, _("Nets"));
hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (addtonetsbutton));
gtk_widget_ref (addtonetsbutton);
gtk_object_set_data_full (GTK_OBJECT (aewindow), "addtonetsbutton", addtonetsbutton,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (addtonetsbutton);
- gtk_box_pack_start (GTK_BOX (hbox2), addtonetsbutton, FALSE, FALSE, 0);
+ gtk_table_attach(GTK_TABLE(table), addtonetsbutton, 2, 3, 0, 1,
+ (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
- overwritebutton = gtk_check_button_new_with_label (_("Replace"));
+ overwritebutton = gtk_check_button_new_with_label (_("Replace existing attributes"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(overwritebutton), TRUE);
gtk_widget_ref (overwritebutton);
gtk_object_set_data_full (GTK_OBJECT (aewindow), "overwritebutton", overwritebutton,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (overwritebutton);
- gtk_box_pack_start (GTK_BOX (hbox2), overwritebutton, FALSE, FALSE, 0);
+ gtk_table_attach(GTK_TABLE(table), overwritebutton, 0, 3, 1, 2,
+ (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
}
/* gschem specific */
@@ -626,30 +527,9 @@
g_list_free(combo_items);
/* gschem specific */
- gtk_widget_show(aewindow);
+ gtk_widget_show_all(aewindow);
w_current->aewindow = aewindow;
- /* gschem specific */
- gtk_signal_connect(GTK_OBJECT(aewindow), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->aewindow);
- gtk_signal_connect(GTK_OBJECT(okbutton), "clicked",
- GTK_SIGNAL_FUNC(attrib_edit_dialog_ok), w_current);
- gtk_signal_connect(GTK_OBJECT(cancelbutton), "clicked",
- GTK_SIGNAL_FUNC(attrib_edit_dialog_cancel),
- w_current);
- gtk_signal_connect(GTK_OBJECT(value_entry), "activate",
- GTK_SIGNAL_FUNC(attrib_edit_dialog_ok), w_current);
-
- gtk_signal_connect(GTK_OBJECT(aewindow), "key_press_event",
- (GtkSignalFunc) attrib_edit_dialog_keypress, w_current);
-
- if (list) {
- gtk_signal_connect(GTK_OBJECT(deletebutton), "clicked",
- GTK_SIGNAL_FUNC(attrib_edit_dialog_delete),
- w_current);
- }
-
gtk_grab_add(w_current->aewindow);
if (attrib || (name && strcmp(name, "netname") == 0)) {
1.2.2.2 +94 -149 eda/geda/gaf/gschem/src/x_autonumber.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_autonumber.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_autonumber.c,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -b -r1.2.2.1 -r1.2.2.2
--- x_autonumber.c 27 Dec 2006 17:37:56 -0000 1.2.2.1
+++ x_autonumber.c 11 Feb 2007 23:58:57 -0000 1.2.2.2
@@ -34,6 +34,7 @@
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
+#include "../include/x_dialog.h"
#ifdef HAVE_LIBDMALLOC
#include <dmalloc.h>
@@ -343,6 +344,9 @@
/* now look for the extension, either a number or the "?" */
if (g_str_has_suffix (o_current->text->string,"?")) {
isnumbered = 0;
+ /* There must not be any character between the "?" and the searchtext */
+ if (strlen(o_current->text->string) != len+1)
+ return AUTONUMBER_IGNORE;
}
else {
if (!isdigit( (int) (o_current->text->string[len]) )) /* has at least one digit */
@@ -676,7 +680,7 @@
/* Step1: get all pages of the hierarchy */
pages = s_hierarchy_traversepages(w_current, HIERARCHY_NODUPS);
- // g_list_foreach(pages, (GFunc) s_hierarchy_print_page, NULL);
+ /* g_list_foreach(pages, (GFunc) s_hierarchy_print_page, NULL); */
/* Step2: if searchtext has an asterisk at the end we have to find
all matching searchtextes.
@@ -724,8 +728,8 @@
if (g_list_find_custom(searchtext_list, new_searchtext,
(GCompareFunc) strcmp) == NULL ) {
searchtext_list = g_list_append(searchtext_list, new_searchtext);
- //printf("autonumber_text: text \"%s\", \"%s\"\n",
- // o_current->text->string, new_searchtext);
+ /*printf("autonumber_text: text \"%s\", \"%s\"\n", */
+ /* o_current->text->string, new_searchtext); */
}
else {
g_free(new_searchtext);
@@ -747,7 +751,7 @@
/* Step3: iterate over the search items in the list */
for (text_item=searchtext_list; text_item !=NULL; text_item=g_list_next(text_item)) {
autotext->current_searchtext = text_item->data;
- // printf("autonumber_text2: searchtext %s\n", autotext->current_searchtext);
+ /* printf("autonumber_text_autonumber: searchtext %s\n", autotext->current_searchtext); */
/* decide whether to renumber page by page or get a global used-list */
if (autotext->scope_skip == SCOPE_HIERARCHY) { /* whole hierarchy database */
/* renumbering all means that no db is required */
@@ -902,7 +906,7 @@
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (sort_order),
renderer, "text", 0, NULL);
renderer = gtk_cell_renderer_pixbuf_new();
- g_object_set(G_OBJECT(renderer), "xpad", 10, "ypad", 10, NULL);
+ g_object_set(G_OBJECT(renderer), "xpad", 5, "ypad", 5, NULL);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (sort_order),
renderer, FALSE);
@@ -992,7 +996,7 @@
t++;
}
- autotext->scope_skip = SCOPE_SELECTED;
+ autotext->scope_skip = SCOPE_PAGE;
autotext->scope_number = SCOPE_SELECTED;
autotext->scope_overwrite = 0;
@@ -1035,6 +1039,9 @@
gtk_combo_box_append_text(GTK_COMBO_BOX(widget), el->data);
}
+ widget = gtk_bin_get_child(GTK_BIN(widget));
+ gtk_entry_set_text(GTK_ENTRY(widget), g_list_first(autotext->scope_text)->data);
+
widget = lookup_widget(autotext->dialog, "scope_skip");
gtk_combo_box_set_active(GTK_COMBO_BOX(widget),
autotext->scope_skip);
@@ -1111,81 +1118,53 @@
/* ***** CALLBACKS (functions that get called directly from the GTK) ******* */
-/*! \brief OK Button callback of the autonumber text dialog
+/*! \brief response callback for the autonumber text dialog
* \par Function Description
- * This function applies the dialog settings to the schematics.
+ * The function just closes the dialog if the close button is pressed or the
+ * user closes the dialog window.
+ * Triggering the apply button will call the autonumber action functions.
*/
-void autonumber_text_ok(GtkWidget * w, AUTONUMBER_TEXT *autotext)
+void autonumber_text_response(GtkWidget * widget, gint response,
+ AUTONUMBER_TEXT *autotext)
{
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
autonumber_get_state(autotext);
-
+ if (autotext->removenum == TRUE && autotext->scope_overwrite == FALSE) {
+ /* temporarly set the overwrite flag */
+ autotext->scope_overwrite = TRUE;
autonumber_text_autonumber(autotext);
-}
-
-/*! \brief Destroy callback function of the autonumber text dialog
- */
-void autonumber_text_destroy(GtkWidget * w, AUTONUMBER_TEXT *autotext)
-{
- /* The usual behaviour is that dialog contents are not stored if
- * the user pressed "cancel" */
-
- /* autonumber_text_getdata(autotext); */
-
- autotext->dialog = NULL;
-}
-
-/** @brief Close button callback function of the autonumber text dialog
- *
- * Just destroys the dialog. The triggered destroy event will save the
- * dialog contents.
- */
-void autonumber_text_close(GtkWidget * w, AUTONUMBER_TEXT *autotext)
-{
+ autotext->scope_overwrite = FALSE;
+ }
+ else {
+ autonumber_text_autonumber(autotext);
+ }
+ break;
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
gtk_widget_destroy(autotext->dialog);
-
- /* the settings are stored by autonumber_text_destroy,
- called by the destroy event */
-}
-
-/*! \brief Keypress callback for the autonumber text dialog
- * \par Function Description
- * The function just closes the dialog if one presses the Escape key.
- * The Return key applies the dialogs ok button function.
- */
-int autonumber_text_keypress(GtkWidget * widget, GdkEventKey * event,
- AUTONUMBER_TEXT *autotext)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- autonumber_text_close(NULL, autotext);
- autonumber_text_destroy(NULL, autotext);
- return TRUE;
- }
- if (strcmp(gdk_keyval_name(event->keyval), "Return") == 0) {
- autonumber_text_ok(NULL, autotext);
- return TRUE;
+ autotext->dialog = NULL;
+ break;
+ default:
+ printf("ERROR: autonumber_text_response(): strange signal %d\n",response);
}
- return FALSE;
}
+
/** @brief Callback that activates or deactivates "overwrite existing numbers"
* check box.
*
* This gets called each time "remove numbers" check box gets clicked.
*/
-void autonumber_removenum_toggled(GtkWidget * w, AUTONUMBER_TEXT *autotext)
+void autonumber_removenum_toggled(GtkWidget * opt_removenum,
+ AUTONUMBER_TEXT *autotext)
{
GtkWidget *scope_overwrite;
- GtkWidget *opt_removenum;
scope_overwrite=lookup_widget(autotext->dialog, "scope_overwrite");
- opt_removenum=w;
+ /* toggle activity of scope overwrite with respect to removenum */
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_removenum))) {
- /* it does not make sense to have "remove numbers" enabled and
- * "overwrite numbers" disabled */
- gtk_toggle_button_set_active(
- GTK_TOGGLE_BUTTON(scope_overwrite),
- 1);
gtk_widget_set_sensitive(scope_overwrite, 0);
} else {
gtk_widget_set_sensitive(scope_overwrite, 1);
@@ -1213,7 +1192,6 @@
{
GtkWidget *autonumber_text;
GtkWidget *vbox1;
- GtkWidget *frame1;
GtkWidget *alignment1;
GtkWidget *vbox3;
GtkWidget *table1;
@@ -1225,7 +1203,6 @@
GtkWidget *scope_skip;
GtkWidget *scope_overwrite;
GtkWidget *label1;
- GtkWidget *frame3;
GtkWidget *alignment3;
GtkWidget *vbox4;
GtkWidget *table3;
@@ -1237,28 +1214,37 @@
GtkWidget *opt_removenum;
GtkWidget *opt_slotting;
GtkWidget *label3;
- GtkWidget *hbuttonbox1;
- GtkWidget *button_close;
- GtkWidget *button_ok;
-
- autonumber_text = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (autonumber_text), _("Autonumber text"));
- gtk_window_set_resizable (GTK_WINDOW (autonumber_text), FALSE);
-
- vbox1 = gtk_vbox_new (FALSE, 24);
- gtk_widget_show (vbox1);
- gtk_container_add (GTK_CONTAINER (autonumber_text), vbox1);
- gtk_container_set_border_width (GTK_CONTAINER (vbox1), 12);
-
- frame1 = gtk_frame_new (NULL);
- gtk_widget_show (frame1);
- gtk_box_pack_start (GTK_BOX (vbox1), frame1, TRUE, TRUE, 0);
- gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE);
- alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
+
+ autonumber_text = gtk_dialog_new_with_buttons(_("Autonumber text"),
+ GTK_WINDOW(w_current->main_window),
+ 0, /* not modal */
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_APPLY,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ gtk_window_position (GTK_WINDOW (autonumber_text),
+ GTK_WIN_POS_MOUSE);
+
+ gtk_container_border_width(GTK_CONTAINER(autonumber_text),
+ DIALOG_BORDER_SPACING);
+ vbox1 = GTK_DIALOG(autonumber_text)->vbox;
+ gtk_box_set_spacing(GTK_BOX(vbox1), DIALOG_V_SPACING);
+
+ /* scope section */
+ label1 = gtk_label_new (_("<b>Scope</b>"));
+ gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
+ gtk_misc_set_alignment (GTK_MISC(label1), 0, 0);
+ gtk_box_pack_start (GTK_BOX(vbox1), label1, TRUE, TRUE, 0);
+ gtk_widget_show (label1);
+
+ alignment1 = gtk_alignment_new (0, 0, 1, 1);
gtk_widget_show (alignment1);
- gtk_container_add (GTK_CONTAINER (frame1), alignment1);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 24, 0);
+ gtk_box_pack_start (GTK_BOX (vbox1), alignment1, TRUE, TRUE, 0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1),
+ 0, 0, DIALOG_INDENTATION, 0);
vbox3 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox3);
@@ -1267,8 +1253,8 @@
table1 = gtk_table_new (3, 2, FALSE);
gtk_widget_show (table1);
gtk_box_pack_start (GTK_BOX (vbox3), table1, TRUE, TRUE, 0);
- gtk_table_set_row_spacings (GTK_TABLE (table1), 3);
- gtk_table_set_col_spacings (GTK_TABLE (table1), 12);
+ gtk_table_set_row_spacings (GTK_TABLE (table1), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings (GTK_TABLE (table1), DIALOG_H_SPACING);
label4 = gtk_label_new (_("Search for:"));
gtk_widget_show (label4);
@@ -1278,6 +1264,7 @@
gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
scope_text = gtk_combo_box_entry_new_text ();
+ gtk_entry_set_activates_default(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(scope_text))), TRUE);
gtk_widget_show (scope_text);
gtk_table_attach (GTK_TABLE (table1), scope_text, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
@@ -1319,20 +1306,18 @@
gtk_widget_show (scope_overwrite);
gtk_box_pack_start (GTK_BOX (vbox3), scope_overwrite, FALSE, FALSE, 6);
- label1 = gtk_label_new (_("<b>Scope</b>"));
- gtk_widget_show (label1);
- gtk_frame_set_label_widget (GTK_FRAME (frame1), label1);
- gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
-
- frame3 = gtk_frame_new (NULL);
- gtk_widget_show (frame3);
- gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0);
- gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_NONE);
+ /* Options section */
+ label3 = gtk_label_new (_("<b>Options</b>"));
+ gtk_label_set_use_markup (GTK_LABEL (label3), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(label3), 0, 0);
+ gtk_widget_show (label3);
+ gtk_box_pack_start(GTK_BOX(vbox1), label3, TRUE, TRUE, 0);
- alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1);
+ alignment3 = gtk_alignment_new (0, 0, 1, 1);
gtk_widget_show (alignment3);
- gtk_container_add (GTK_CONTAINER (frame3), alignment3);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 24, 0);
+ gtk_box_pack_start(GTK_BOX(vbox1), alignment3, TRUE, TRUE, 0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3),
+ 0, 0, DIALOG_INDENTATION, 0);
vbox4 = gtk_vbox_new (FALSE, 3);
gtk_widget_show (vbox4);
@@ -1341,8 +1326,8 @@
table3 = gtk_table_new (2, 2, FALSE);
gtk_widget_show (table3);
gtk_box_pack_start (GTK_BOX (vbox4), table3, TRUE, TRUE, 0);
- gtk_table_set_row_spacings (GTK_TABLE (table3), 3);
- gtk_table_set_col_spacings (GTK_TABLE (table3), 12);
+ gtk_table_set_row_spacings (GTK_TABLE (table3), DIALOG_V_SPACING);
+ gtk_table_set_col_spacings (GTK_TABLE (table3), DIALOG_H_SPACING);
label12 = gtk_label_new (_("Starting number:"));
gtk_widget_show (label12);
@@ -1360,6 +1345,7 @@
opt_startnum_adj = gtk_adjustment_new (1, 0, 10000, 1, 10, 10);
opt_startnum = gtk_spin_button_new (GTK_ADJUSTMENT (opt_startnum_adj), 1, 0);
+ gtk_entry_set_activates_default(GTK_ENTRY(opt_startnum), TRUE);
gtk_widget_show (opt_startnum);
gtk_table_attach (GTK_TABLE (table3), opt_startnum, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
@@ -1379,29 +1365,7 @@
gtk_widget_show (opt_slotting);
gtk_box_pack_start (GTK_BOX (vbox4), opt_slotting, FALSE, FALSE, 0);
- label3 = gtk_label_new (_("<b>Options</b>"));
- gtk_widget_show (label3);
- gtk_frame_set_label_widget (GTK_FRAME (frame3), label3);
- gtk_label_set_use_markup (GTK_LABEL (label3), TRUE);
-
- hbuttonbox1 = gtk_hbutton_box_new ();
- gtk_widget_show (hbuttonbox1);
- gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0);
- gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END);
- gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 12);
-
- button_close = gtk_button_new_from_stock ("gtk-close");
- gtk_widget_show (button_close);
- gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_close);
- GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT);
-
- button_ok = gtk_button_new_from_stock ("gtk-apply");
- gtk_widget_show (button_ok);
- gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_ok);
- GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);
-
/* Store pointers to all widgets, for use by lookup_widget(). */
- GLADE_HOOKUP_OBJECT (autonumber_text, alignment1, "alignment1");
GLADE_HOOKUP_OBJECT (autonumber_text, scope_text, "scope_text");
GLADE_HOOKUP_OBJECT (autonumber_text, scope_number, "scope_number");
GLADE_HOOKUP_OBJECT (autonumber_text, scope_skip, "scope_skip");
@@ -1410,8 +1374,6 @@
GLADE_HOOKUP_OBJECT (autonumber_text, sort_order, "sort_order");
GLADE_HOOKUP_OBJECT (autonumber_text, opt_removenum, "opt_removenum");
GLADE_HOOKUP_OBJECT (autonumber_text, opt_slotting, "opt_slotting");
- GLADE_HOOKUP_OBJECT (autonumber_text, button_close, "button_close");
- GLADE_HOOKUP_OBJECT (autonumber_text, button_ok, "button_ok");
return autonumber_text;
}
@@ -1427,8 +1389,6 @@
{
static AUTONUMBER_TEXT *autotext = NULL;
- GtkWidget *button_ok = NULL;
- GtkWidget *button_close = NULL;
GtkWidget *opt_removenum = NULL;
GtkWidget *sort_order = NULL;
@@ -1445,26 +1405,16 @@
autotext->dialog = autonumber_create_dialog(w_current);
- button_ok = lookup_widget(autotext->dialog, "button_ok");
- button_close = lookup_widget(autotext->dialog, "button_close");
opt_removenum = lookup_widget(autotext->dialog, "opt_removenum");
sort_order = lookup_widget(autotext->dialog, "sort_order");
autonumber_sortorder_create(w_current, sort_order);
- gtk_signal_connect(GTK_OBJECT(autotext->dialog),
- "destroy",
- GTK_SIGNAL_FUNC(autonumber_text_destroy),
- autotext);
+ gtk_dialog_set_default_response (GTK_DIALOG (autotext->dialog),
+ GTK_RESPONSE_ACCEPT);
- gtk_signal_connect(GTK_OBJECT(button_ok),
- "clicked",
- GTK_SIGNAL_FUNC(autonumber_text_ok),
- autotext);
-
- gtk_signal_connect(GTK_OBJECT(button_close),
- "clicked",
- GTK_SIGNAL_FUNC(autonumber_text_close),
+ gtk_signal_connect(GTK_OBJECT(autotext->dialog), "response",
+ GTK_SIGNAL_FUNC(autonumber_text_response),
autotext);
gtk_signal_connect(GTK_OBJECT(opt_removenum),
@@ -1472,11 +1422,6 @@
GTK_SIGNAL_FUNC(autonumber_removenum_toggled),
autotext);
- gtk_signal_connect(GTK_OBJECT(autotext->dialog),
- "key_press_event",
- GTK_SIGNAL_FUNC(autonumber_text_keypress),
- autotext);
-
autonumber_set_state(autotext);
gtk_widget_show_all(autotext->dialog);
1.11.2.2 +2 -2 eda/geda/gaf/gschem/src/x_compselect.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_compselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_compselect.c,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -b -r1.11.2.1 -r1.11.2.2
--- x_compselect.c 27 Dec 2006 17:37:56 -0000 1.11.2.1
+++ x_compselect.c 11 Feb 2007 23:58:57 -0000 1.11.2.2
@@ -215,7 +215,7 @@
enum {
PROP_FILENAME=1,
- PROP_BEHAVIOR,
+ PROP_BEHAVIOR
};
static GObjectClass *compselect_parent_class = NULL;
@@ -789,7 +789,7 @@
compselect);
/* add the filter entry to the filter area */
gtk_box_pack_start (GTK_BOX (filter_hbox), entry,
- FALSE, FALSE, 0);
+ TRUE, TRUE, 0);
/* set filter entry of compselect */
compselect->entry_filter = GTK_ENTRY (entry);
/* and init the event source for component filter */
1.68.2.2 +3 -3 eda/geda/gaf/gschem/src/x_dialog.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_dialog.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_dialog.c,v
retrieving revision 1.68.2.1
retrieving revision 1.68.2.2
diff -u -b -r1.68.2.1 -r1.68.2.2
--- x_dialog.c 27 Dec 2006 17:37:56 -0000 1.68.2.1
+++ x_dialog.c 11 Feb 2007 23:58:57 -0000 1.68.2.2
@@ -2514,14 +2514,14 @@
/* the columns */
renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("Function",
+ column = gtk_tree_view_column_new_with_attributes (_("Function"),
renderer,
"text",
0,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("Keystroke(s)",
+ column = gtk_tree_view_column_new_with_attributes (_("Keystroke(s)"),
renderer,
"text",
1,
@@ -3339,7 +3339,7 @@
enum {
PROP_UNSAVED_PAGE=1,
PROP_UNSAVED_PAGES,
- PROP_SELECTED_PAGES,
+ PROP_SELECTED_PAGES
};
enum {
1.27.2.2 +22 -22 eda/geda/gaf/gschem/src/x_image.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_image.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_image.c,v
retrieving revision 1.27.2.1
retrieving revision 1.27.2.2
diff -u -b -r1.27.2.1 -r1.27.2.2
--- x_image.c 27 Dec 2006 17:37:56 -0000 1.27.2.1
+++ x_image.c 11 Feb 2007 23:58:58 -0000 1.27.2.2
@@ -30,6 +30,7 @@
#include "../include/globals.h"
#include "../include/prototype.h"
+#include "../include/x_dialog.h"
#ifdef HAVE_LIBDMALLOC
#include <dmalloc.h>
@@ -282,7 +283,6 @@
/* try to use recalc here */
o_redraw_all(w_current);
- printf("Calling f_image_write.\n");
f_image_write(w_current, filename, width, height,
w_current->image_color);
#else
@@ -388,7 +388,6 @@
}
}
-
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
@@ -462,8 +461,9 @@
GTK_SIGNAL_FUNC(x_image_response), w_current);
box = GTK_DIALOG(w_current->iwindow)->vbox;
- gtk_container_set_border_width(GTK_CONTAINER(w_current->iwindow),5);
- gtk_box_set_spacing(GTK_BOX(box),5);
+ gtk_container_set_border_width(GTK_CONTAINER(w_current->iwindow),
+ DIALOG_BORDER_SPACING);
+ gtk_box_set_spacing(GTK_BOX(box), DIALOG_V_SPACING);
label = gtk_label_new (_("Width x Height:"));
gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
@@ -474,7 +474,7 @@
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu),
create_menu_size (w_current));
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 2);
- gtk_box_pack_start (GTK_BOX (box), optionmenu, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), optionmenu, FALSE, FALSE, 0);
label = gtk_label_new (_("Filename:"));
gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
@@ -482,14 +482,19 @@
gtk_box_pack_start (GTK_BOX (box),
label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new(FALSE,10);
+ hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
filename_entry = gtk_entry_new_with_max_length (200);
gtk_editable_select_region (GTK_EDITABLE (filename_entry), 0, -1);
gtk_box_pack_start (GTK_BOX (hbox),
filename_entry, TRUE, TRUE, 0);
- button = gtk_button_new_with_mnemonic(_("_Browse"));
+ button = gtk_button_new();
+ gtk_container_add(GTK_CONTAINER(button),
+ gtk_image_new_from_stock(GTK_STOCK_OPEN,
+ GTK_ICON_SIZE_SMALL_TOOLBAR));
+ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
g_signal_connect(button, "clicked",
GTK_SIGNAL_FUNC (x_image_select_filename),
@@ -497,22 +502,19 @@
GLADE_HOOKUP_OBJECT(w_current->iwindow,filename_entry,"filename_entry");
- gtk_widget_show_all (box);
+ gtk_widget_show_all (w_current->iwindow);
+ }
+
+ else { /* dialog already created */
+ gtk_window_present(GTK_WINDOW(w_current->iwindow));
}
- if (!GTK_WIDGET_VISIBLE (w_current->iwindow)) {
- filename_entry = g_object_get_data (G_OBJECT (w_current->iwindow), "filename_entry");
+ /* always set the data entries in the dialog */
+ filename_entry = g_object_get_data (G_OBJECT (w_current->iwindow),
+ "filename_entry");
gtk_entry_set_text(GTK_ENTRY(filename_entry), filename);
w_current->image_width = 800;
w_current->image_height = 600;
- gtk_widget_show (w_current->iwindow);
- gdk_window_raise(w_current->iwindow->window);
- /* gtk_grab_add (w_current->iwindow);*/
- } else {
- /* window should already be mapped */
- /* otherwise this will core */
- gdk_window_raise(w_current->iwindow->window);
- }
}
/*! \todo Finish function documentation!!!
@@ -574,8 +576,6 @@
int origin_x, origin_y, bottom, right;
int size_x, size_y, s_right, s_left, s_top,s_bottom;
TOPLEVEL toplevel;
- OBJECT *aux;
- char object_found = 0;
/* Do a copy of the toplevel struct and work with it */
memcpy(&toplevel, w_current, sizeof(TOPLEVEL));
1.18.2.1 +6 -4 eda/geda/gaf/gschem/src/x_log.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_log.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_log.c,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -b -r1.18 -r1.18.2.1
--- x_log.c 7 Dec 2006 04:24:17 -0000 1.18
+++ x_log.c 11 Feb 2007 23:58:58 -0000 1.18.2.1
@@ -157,15 +157,17 @@
{
GtkTextBuffer *buffer;
GtkTextIter iter;
+ GtkTextMark *mark;
g_return_if_fail (IS_LOG (log));
buffer = gtk_text_view_get_buffer (log->textview);
- gtk_text_buffer_insert_at_cursor (buffer, message, strlen (message));
-
gtk_text_buffer_get_end_iter (buffer, &iter);
- gtk_text_view_scroll_to_iter (log->textview, &iter, 0, TRUE, 0, 1);
+ gtk_text_buffer_insert(buffer, &iter, message, -1);
+ mark = gtk_text_buffer_create_mark(buffer, NULL, &iter, FALSE);
+ gtk_text_view_scroll_to_mark (log->textview, mark, 0, TRUE, 0, 1);
+ gtk_text_buffer_delete_mark (buffer, mark);
}
/*! \todo Finish function documentation!!!
1.40.2.1 +0 -1 eda/geda/gaf/gschem/src/x_menus.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_menus.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_menus.c,v
retrieving revision 1.40
retrieving revision 1.40.2.1
diff -u -b -r1.40 -r1.40.2.1
--- x_menus.c 5 Dec 2006 03:04:31 -0000 1.40
+++ x_menus.c 11 Feb 2007 23:58:58 -0000 1.40.2.1
@@ -102,7 +102,6 @@
char *menu_item_hotkey_func;
char *menu_item_keys;
char *spaces;
- const char *help_string;
int i, j;
int name_len, key_len, pad;
int sum, diff, max_size, space_size;
1.3.6.2 +4 -0 eda/geda/gaf/gschem/src/x_multiattrib.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_multiattrib.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_multiattrib.c,v
retrieving revision 1.3.6.1
retrieving revision 1.3.6.2
diff -u -b -r1.3.6.1 -r1.3.6.2
--- x_multiattrib.c 27 Dec 2006 17:37:56 -0000 1.3.6.1
+++ x_multiattrib.c 11 Feb 2007 23:58:58 -0000 1.3.6.2
@@ -58,6 +58,10 @@
"toplevel", toplevel,
"object", object,
NULL));
+
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),
+ GTK_WINDOW(toplevel->main_window));
+
gtk_widget_show (dialog);
switch (gtk_dialog_run ((GtkDialog*)dialog)) {
case MULTIATTRIB_RESPONSE_CLOSE:
1.13.6.1 +1 -1 eda/geda/gaf/gschem/src/x_preview.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_preview.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_preview.c,v
retrieving revision 1.13
retrieving revision 1.13.6.1
diff -u -b -r1.13 -r1.13.6.1
--- x_preview.c 23 Sep 2006 08:41:39 -0000 1.13
+++ x_preview.c 11 Feb 2007 23:58:58 -0000 1.13.6.1
@@ -46,7 +46,7 @@
enum {
PROP_FILENAME=1,
- PROP_ACTIVE,
+ PROP_ACTIVE
};
static GObjectClass *preview_parent_class = NULL;
1.26.2.2 +31 -14 eda/geda/gaf/gschem/src/x_print.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_print.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_print.c,v
retrieving revision 1.26.2.1
retrieving revision 1.26.2.2
diff -u -b -r1.26.2.1 -r1.26.2.2
--- x_print.c 27 Dec 2006 17:37:56 -0000 1.26.2.1
+++ x_print.c 11 Feb 2007 23:58:58 -0000 1.26.2.2
@@ -87,12 +87,12 @@
GtkWidget *filechooser;
const gchar *filename;
const gchar *newfilename;
- filechooser = gtk_file_chooser_dialog_new (_("Save PostScript As..."),
+ filechooser = gtk_file_chooser_dialog_new (_("Select PostScript Filename..."),
GTK_WINDOW (dialog),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE_AS,
+ GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT, NULL);
filename = gtk_entry_get_text (GTK_ENTRY (dialog->fnfield));
@@ -327,7 +327,7 @@
gtk_container_set_border_width (GTK_CONTAINER (settingstable), 5);
gtk_container_add (GTK_CONTAINER (frame), settingstable);
- label = gtk_label_new (_("Output paper size"));
+ label = gtk_label_new (_("Output paper size:"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_table_attach (GTK_TABLE (settingstable),
label,
@@ -338,7 +338,7 @@
GTK_WIDGET (dialog->papercbox),
1, 2, 0, 1, GTK_FILL, 0, 0, 0);
- label = gtk_label_new (_("Type"));
+ label = gtk_label_new (_("Type:"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_table_attach (GTK_TABLE (settingstable),
label,
@@ -349,7 +349,7 @@
GTK_WIDGET (dialog->typecbox),
1, 2, 1, 2, GTK_FILL, 0, 0, 0);
- label = gtk_label_new (_("Orientation"));
+ label = gtk_label_new (_("Orientation:"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
gtk_table_attach (GTK_TABLE (settingstable),
label,
@@ -374,10 +374,10 @@
/* Widgets for printing to file */
dialog->fileradio =
- GTK_RADIO_BUTTON (gtk_radio_button_new_with_label (NULL, _("File")));
+ GTK_RADIO_BUTTON (gtk_radio_button_new_with_label (NULL, _("File:")));
gtk_table_attach (GTK_TABLE (desttable),
GTK_WIDGET (dialog->fileradio),
- 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
+ 0, 1, 0, 1, GTK_FILL, GTK_EXPAND, 0, 0);
g_signal_connect (dialog->fileradio,
"toggled",
GTK_SIGNAL_FUNC (print_dialog_action_radio_toggled),
@@ -388,11 +388,15 @@
GTK_WIDGET (dialog->fnfield),
1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- dialog->saveasbutton =
- GTK_BUTTON (gtk_button_new_from_stock (GTK_STOCK_SAVE_AS));
+ dialog->saveasbutton = GTK_BUTTON(gtk_button_new());
+ gtk_container_add(GTK_CONTAINER(dialog->saveasbutton),
+ gtk_image_new_from_stock(GTK_STOCK_OPEN,
+ GTK_ICON_SIZE_SMALL_TOOLBAR));
+ gtk_button_set_relief(GTK_BUTTON(dialog->saveasbutton), GTK_RELIEF_NONE);
+
gtk_table_attach (GTK_TABLE (desttable),
GTK_WIDGET (dialog->saveasbutton), 2, 3, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ GTK_FILL, 0, 0, 0);
g_signal_connect (dialog->saveasbutton,
"clicked",
GTK_SIGNAL_FUNC (print_dialog_action_choosefile), dialog);
@@ -400,10 +404,10 @@
/* Widgets for printing to command */
dialog->cmdradio =
GTK_RADIO_BUTTON (gtk_radio_button_new_with_label_from_widget
- (dialog->fileradio, _("Command")));
+ (dialog->fileradio, _("Command:")));
gtk_table_attach (GTK_TABLE (desttable),
GTK_WIDGET (dialog->cmdradio),
- 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
+ 0, 1, 1, 2, GTK_FILL, GTK_EXPAND, 0, 0);
g_signal_connect (dialog->cmdradio,
"toggled",
GTK_SIGNAL_FUNC (print_dialog_action_radio_toggled),
@@ -673,6 +677,8 @@
gint paperidx, x, y, result;
gchar *string, *destination;
gboolean usefile = FALSE;
+ GtkDialog *dialog;
+ GtkWidget *popup_message;
/* Work out current paper size by iterating through available paper
* sizes. Set the default paper size as the active selection */
@@ -702,7 +708,7 @@
/* Create a print dialog, find out whether the user clicks Print or
Cancel, and then print or return accordingly */
- GtkDialog *dialog = GTK_DIALOG (g_object_new (TYPE_PRINT_DIALOG,
+ dialog = GTK_DIALOG (g_object_new (TYPE_PRINT_DIALOG,
"command", command,
"filename", filename,
"papersize", paperidx,
@@ -766,6 +772,17 @@
{
s_log_message (_("Cannot print current schematic to [%s]\n"),
destination);
+
+ /* Pop up a message warning the user */
+ popup_message =
+ gtk_message_dialog_new (GTK_WINDOW(dialog),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Error printing to file '%s'\n"
+ "Check the log window for more information"),
+ destination);
+ gtk_dialog_run (GTK_DIALOG (popup_message));
}
else
{
1.11.6.1 +23 -80 eda/geda/gaf/gschem/src/x_script.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_script.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_script.c,v
retrieving revision 1.11
retrieving revision 1.11.6.1
diff -u -b -r1.11 -r1.11.6.1
--- x_script.c 14 Jul 2006 02:23:55 -0000 1.11
+++ x_script.c 11 Feb 2007 23:58:58 -0000 1.11.6.1
@@ -36,92 +36,35 @@
#include <dmalloc.h>
#endif
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Select a script and execute it
* \par Function Description
- *
+ * This function opens a file selection dialog. The selected script
+ * is executed.
*/
-void script_selection_ok(GtkWidget *w, TOPLEVEL *w_current)
+void setup_script_selector (TOPLEVEL *w_current)
{
- int len;
- const char *string;
-
- /* who frees this? */
- string = gtk_file_selection_get_filename(
- GTK_FILE_SELECTION(w_current->sowindow));
-
- if(string != NULL) {
- len = strlen(string);
+ char *filename;
- if (string[len - 1] != G_DIR_SEPARATOR) {
- s_log_message(_("Executing guile script [%s]\n"), string);
- g_read_file(string);
+ w_current->sowindow =
+ gtk_file_chooser_dialog_new (_("Execute Script..."),
+ GTK_WINDOW(w_current->main_window),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_EXECUTE,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ if (gtk_dialog_run (GTK_DIALOG (w_current->sowindow)) == GTK_RESPONSE_ACCEPT) {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (w_current->sowindow));
+
+ if (!(g_file_test(filename, G_FILE_TEST_IS_DIR))) {
+ s_log_message(_("Executing guile script [%s]\n"), filename);
+ g_read_file(filename);
}
+ g_free (filename);
}
- /* would like to move this earlier! */
- gtk_grab_remove(w_current->sowindow);
- gtk_widget_destroy(GTK_WIDGET (w_current->sowindow));
- w_current->sowindow = NULL;
-}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void script_selection_cancel (GtkWidget *w, TOPLEVEL *w_current)
-{
- gtk_grab_remove(w_current->sowindow);
- gtk_widget_destroy (GTK_WIDGET (w_current->sowindow));
+ gtk_widget_destroy (GTK_WIDGET(w_current->sowindow));
w_current->sowindow = NULL;
}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void setup_script_selector (TOPLEVEL *w_current)
-{
- if (!w_current->sowindow) {
- w_current->sowindow =
- gtk_file_selection_new(_("Script Execute..."));
- gtk_window_position(GTK_WINDOW(w_current->sowindow),
- GTK_WIN_POS_MOUSE);
- /* added 4/6/98 */
- gtk_file_selection_hide_fileop_buttons(
- GTK_FILE_SELECTION(w_current->sowindow));
- gtk_signal_connect(GTK_OBJECT (w_current->sowindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->sowindow);
-
-#if 0 /* this was causing the dialog box to not die */
- gtk_signal_connect(GTK_OBJECT(w_current->sowindow),
- "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->sowindow);
-#endif
-
- /*! \todo consistant function names for connect
- * connect_object */
- gtk_signal_connect (GTK_OBJECT (
- GTK_FILE_SELECTION (w_current->sowindow)->ok_button),
- "clicked",
- GTK_SIGNAL_FUNC(script_selection_ok),
- w_current);
-
- gtk_signal_connect(GTK_OBJECT(
- GTK_FILE_SELECTION(w_current->sowindow)->
- cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC(script_selection_cancel),
- w_current);
-
- }
-
- if (!GTK_WIDGET_VISIBLE (w_current->sowindow)) {
- gtk_widget_show (w_current->sowindow);
- gtk_grab_add (w_current->sowindow);
- }
-}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs