[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: x_compselect.c
User: werner
Date: 06/12/09 14:03:12
Modified: . x_compselect.c x_dialog.c x_fileselect.c x_image.c
x_print.c
Log:
* src/x_compselect.c: added transient_for flag to the dialog
* src/x_fileselect.c: set default response to OK
* src/x_print.c: set default response to print, added transient_for
flag, fixed a keyval "Return" instead of "linefeed"
* src/x_image.c: use GtkDialog for the PNG export dialog.
added a filechooser dialog, misc cosmetics.
* src/x_dialog.c: use GtkDialog for text property dialog.
code cleanup and cosmetics
Revision Changes Path
1.11 +4 -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.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- x_compselect.c 5 Dec 2006 19:39:12 -0000 1.10
+++ x_compselect.c 9 Dec 2006 19:03:12 -0000 1.11
@@ -180,12 +180,14 @@
G_CALLBACK (x_compselect_callback_response),
toplevel);
+ gtk_window_set_transient_for(GTK_WINDOW(toplevel->cswindow),
+ GTK_WINDOW(toplevel->main_window));
+
gtk_widget_show (toplevel->cswindow);
} else {
gdk_window_raise (toplevel->cswindow->window);
}
-
}
/*! \brief Closes the component selection dialog.
1.65 +107 -128 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.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- x_dialog.c 7 Dec 2006 04:24:17 -0000 1.64
+++ x_dialog.c 9 Dec 2006 19:03:12 -0000 1.65
@@ -304,10 +304,12 @@
/***************** End of Text Input dialog box ***********************/
/***************** Start of Text Edit dialog box **********************/
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief CAllback for a text aligment change
* \par Function Description
- *
+ * This function stores a change of the text alignment in the
+ * <b>TOPLEVEL</b> struct.
+ * \todo Remove that function. Only the OK-Button should set any
+ * properties in the TOPLEVEL struct.
*/
gint change_alignment(GtkWidget *w, TOPLEVEL *w_current)
{
@@ -318,13 +320,13 @@
/*w_current->page_current->CHANGED=1; I don't think this belongs */
/* o_undo_savestate(w_current, UNDO_ALL); I don't think this belongs */
- return(0);
+ return 0;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Create the alignment menu for the text property dialog
* \par Function Description
- *
+ * This function creates a GtkMenu with nine different alignment
+ * entries.
*/
static GtkWidget *create_menu_alignment (TOPLEVEL *w_current)
{
@@ -435,32 +437,17 @@
w_current);
gtk_widget_show (menuitem);
- return(menu);
+ return menu;
}
/* we reuse the color menu so we need to declare it */
static GtkWidget *create_color_menu(TOPLEVEL * w_current, int * select_index);
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Apply the settings from the text property dialog
* \par Function Description
- *
- */
-int text_edit_dialog_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
-{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- text_edit_dialog_cancel(NULL, w_current);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
+ * This function applies the user settings to the selected text objects
+ * and closes the dialog
+ * \todo Check why we have no color attribute in that dialog
*/
void text_edit_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
{
@@ -472,17 +459,20 @@
int num_selected;
GtkTextBuffer *textbuffer;
GtkTextIter start, end;
+ GtkWidget *widget;
num_selected = o_selection_return_num(w_current->page_current->selection2_head);
/* text string entry will only show up if one object is selected */
if (num_selected == 1) {
- textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(w_current->teentry));
+ widget = g_object_get_data (G_OBJECT (w_current->tewindow), "textentry");
+ textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
gtk_text_buffer_get_bounds (textbuffer, &start, &end);
text_string = gtk_text_iter_get_text (&start, &end);
} /* else the string will be null which is okay */
- text_size_string = (char *) gtk_entry_get_text(GTK_ENTRY(w_current->tsentry));
+ widget = g_object_get_data (G_OBJECT (w_current->tewindow), "sizeentry");
+ text_size_string = (char *) gtk_entry_get_text(GTK_ENTRY(widget));
if (text_string) {
len = strlen(text_string);
@@ -502,139 +492,150 @@
i_set_state(w_current, SELECT);
i_update_toolbar(w_current);
-
- gtk_grab_remove(w_current->tewindow);
gtk_widget_destroy(w_current->tewindow);
w_current->tewindow = NULL;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*!
+ * \brief Cancel function for the text property dialog
* \par Function Description
- *
+ * Just close the dialog and clean up.
+ * \todo join the function into text_edit_dialog_response()
*/
void text_edit_dialog_cancel(GtkWidget *w, TOPLEVEL *w_current)
{
i_set_state(w_current, SELECT);
i_update_toolbar(w_current);
- gtk_grab_remove(w_current->tewindow);
gtk_widget_destroy(w_current->tewindow);
w_current->tewindow = NULL;
}
-/*! \todo Finish function documentation!!!
- * \brief
+/*! \brief Response function for the text property dialog
* \par Function Description
+ * This function receives the user response of the text property dialog.
+ * The response is either <b>OK</b> or <b>Cancel</b>
*
*/
+void text_edit_dialog_response(GtkWidget * widget, gint response, TOPLEVEL *w_current)
+{
+ switch(response) {
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ text_edit_dialog_cancel(widget, w_current);
+ break;
+ case GTK_RESPONSE_ACCEPT:
+ text_edit_dialog_ok(widget, w_current);
+ break;
+ default:
+ printf("text_edit_dialog_response(): strange signal %d\n", response);
+ }
+}
+
+/*! \brief Create the edit text properties dialog
+ * \par Function Description
+ * This Function creates the dialog to edit text properties.
+ * \todo Check why there's no color in the calling parameters
+ */
void text_edit_dialog (TOPLEVEL *w_current, char *string, int text_size,
int text_alignment)
{
GtkWidget *label = NULL;
- GtkWidget *buttonok = NULL;
- GtkWidget *buttoncancel = NULL;
- GtkWidget *vbox, *action_area;
+ GtkWidget *vbox;
GtkWidget *optionmenu = NULL;
GtkWidget *align_menu = NULL;
GtkWidget *viewport1 = NULL;
+ GtkWidget *textentry = NULL;
+ GtkWidget *sizeentry = NULL;
GtkWidget *scrolled_window = NULL;
GtkTextBuffer *textbuffer;
char *text_size_string;
- int len;
- int num_selected;
+ int num_selected=0;
int select_index=0;
- num_selected = o_selection_return_num(w_current->page_current->selection2_head);
-
if (!w_current->tewindow) {
- w_current->tewindow = x_create_dialog_box(&vbox, &action_area);
+ w_current->tewindow = gtk_dialog_new_with_buttons(_("Edit Text Properties"),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->tewindow),
+ GTK_RESPONSE_ACCEPT);
- gtk_window_set_default_size (GTK_WINDOW (w_current->tewindow), 250, 300);
+ gtk_signal_connect(GTK_OBJECT(w_current->tewindow), "response",
+ GTK_SIGNAL_FUNC(text_edit_dialog_response), w_current);
gtk_window_position(GTK_WINDOW (w_current->tewindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect(GTK_OBJECT (w_current->tewindow),
- "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->tewindow);
-
- gtk_signal_connect(GTK_OBJECT(w_current->tewindow),
- "key_press_event",
- (GtkSignalFunc) text_edit_dialog_keypress, w_current);
+ vbox = GTK_DIALOG(w_current->tewindow)->vbox;
+ gtk_container_set_border_width(GTK_CONTAINER(w_current->tewindow),5);
+ gtk_box_set_spacing(GTK_BOX(vbox),5);
-#if 0 /* removed because it was causing the dialog box to not close */
- gtk_signal_connect(GTK_OBJECT (w_current->tewindow),
- "delete_event",
- GTK_SIGNAL_FUNC(gtk_widget_destroyed),
- &w_current->tewindow);
-#endif
-
- gtk_window_set_title(GTK_WINDOW (w_current->tewindow),
- _("Edit Text"));
- gtk_container_border_width(
- GTK_CONTAINER(w_current->tewindow), 10);
-
+ /* add a text box if only one object is selected */
+ num_selected = o_selection_return_num(w_current->page_current->selection2_head);
if (num_selected == 1) {
- label = gtk_label_new (_("Edit Text"));
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 3);
+ label = gtk_label_new (_("Text Content:"));
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
viewport1 = gtk_viewport_new (NULL, NULL);
gtk_widget_show (viewport1);
+ gtk_widget_set_size_request(GTK_WIDGET(viewport1),-1,75);
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (viewport1), scrolled_window);
- gtk_box_pack_start( GTK_BOX(vbox), viewport1, TRUE, TRUE, 10);
+ gtk_box_pack_start( GTK_BOX(vbox), viewport1, TRUE, TRUE, 0);
gtk_widget_show(scrolled_window);
- w_current->teentry = gtk_text_view_new();
- gtk_text_view_set_editable(GTK_TEXT_VIEW(w_current->teentry), TRUE);
- select_all_text_in_textview(GTK_TEXT_VIEW(w_current->teentry));
+ textentry = gtk_text_view_new();
+ gtk_text_view_set_editable(GTK_TEXT_VIEW(textentry), TRUE);
+ select_all_text_in_textview(GTK_TEXT_VIEW(textentry));
/*! \bug FIXME: Set tab's width in the textview widget. */
/* See first the code in text_input_dialog and get it working before adding it here. */
- gtk_container_add(GTK_CONTAINER(scrolled_window), w_current->teentry);
-
- gtk_widget_show (w_current->teentry);
- gtk_widget_grab_focus(w_current->teentry);
+ gtk_container_add(GTK_CONTAINER(scrolled_window), textentry);
+ gtk_widget_show (textentry);
+ gtk_widget_grab_focus(textentry);
+ GLADE_HOOKUP_OBJECT(w_current->tewindow, textentry,"textentry");
}
- label = gtk_label_new(_("Edit Text Color"));
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
+ label = gtk_label_new(_("Text Color:"));
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
optionmenu = gtk_option_menu_new();
-
- gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), create_color_menu(w_current, &select_index));
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu),
+ create_color_menu(w_current, &select_index));
gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), select_index);
- gtk_box_pack_start(GTK_BOX(vbox), optionmenu, FALSE, TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox), optionmenu, FALSE, TRUE, 0);
gtk_widget_show(optionmenu);
- label = gtk_label_new (_("Edit Text Size"));
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
+ label = gtk_label_new (_("Text Size:"));
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
- w_current->tsentry = gtk_entry_new_with_max_length (10);
- gtk_editable_select_region(
- GTK_EDITABLE (w_current->tsentry), 0, -1);
- gtk_box_pack_start(
- GTK_BOX(vbox),
- w_current->tsentry, FALSE, FALSE, 5);
- gtk_signal_connect(GTK_OBJECT(w_current->tsentry), "activate",
- GTK_SIGNAL_FUNC(text_edit_dialog_ok),
- w_current);
- gtk_widget_show (w_current->tsentry);
-
+ sizeentry = gtk_entry_new_with_max_length (10);
+ gtk_editable_select_region(GTK_EDITABLE (sizeentry), 0, -1);
+ gtk_box_pack_start(GTK_BOX(vbox),
+ sizeentry, FALSE, FALSE, 5);
+ gtk_widget_show (sizeentry);
- label = gtk_label_new (_("Edit Text Alignment"));
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 5);
+ label = gtk_label_new (_("Text Alignment:"));
+ gtk_misc_set_alignment(GTK_MISC(label),0,0);
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
optionmenu = gtk_option_menu_new ();
@@ -647,50 +648,28 @@
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_menu_get_active(GTK_MENU(align_menu))),
TRUE);
+ GLADE_HOOKUP_OBJECT(w_current->tewindow, sizeentry,"sizeentry");
+
gtk_box_pack_start(GTK_BOX(vbox), optionmenu, FALSE, TRUE, 0);
gtk_widget_show(optionmenu);
-
-
- buttoncancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- GTK_WIDGET_SET_FLAGS(buttoncancel, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttoncancel, TRUE, TRUE, 5);
- gtk_signal_connect(GTK_OBJECT (buttoncancel), "clicked",
- GTK_SIGNAL_FUNC(text_edit_dialog_cancel),
- w_current);
- gtk_widget_show(buttoncancel);
-
- buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS (buttonok, GTK_CAN_DEFAULT);
- gtk_box_pack_start(
- GTK_BOX(action_area),
- buttonok, TRUE, TRUE, 5);
- gtk_signal_connect(GTK_OBJECT (buttonok), "clicked",
- GTK_SIGNAL_FUNC(text_edit_dialog_ok),
- w_current);
- gtk_widget_show(buttonok);
- gtk_widget_grab_default(buttonok);
-
}
if (!GTK_WIDGET_VISIBLE (w_current->tewindow)) {
gtk_widget_show (w_current->tewindow);
if (string != NULL) {
- len = strlen(string);
if (num_selected == 1) { /* only if one thing is selected */
- textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(w_current->teentry));
+ textentry = g_object_get_data (G_OBJECT (w_current->tewindow), "textentry");
+ textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textentry));
gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textbuffer), string, -1);
- select_all_text_in_textview(GTK_TEXT_VIEW(w_current->teentry));
+ select_all_text_in_textview(GTK_TEXT_VIEW(textentry));
}
}
text_size_string = g_strdup_printf("%d", text_size);
- gtk_entry_set_text(GTK_ENTRY(w_current->tsentry),
+ sizeentry = g_object_get_data (G_OBJECT (w_current->tewindow), "sizeentry");
+ gtk_entry_set_text(GTK_ENTRY(sizeentry),
text_size_string);
g_free(text_size_string);
-
- gtk_grab_add (w_current->tewindow);
}
}
1.31 +3 -0 eda/geda/gaf/gschem/src/x_fileselect.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_fileselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_fileselect.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- x_fileselect.c 4 Oct 2006 20:11:40 -0000 1.30
+++ x_fileselect.c 9 Dec 2006 19:03:12 -0000 1.31
@@ -234,6 +234,9 @@
/* set the current filename or directory name if new document */
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
toplevel->page_current->page_filename);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog),
+ GTK_RESPONSE_ACCEPT);
gtk_widget_show (dialog);
if (gtk_dialog_run ((GtkDialog*)dialog) == GTK_RESPONSE_ACCEPT) {
gchar *filename =
1.27 +98 -121 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.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- x_image.c 30 Sep 2006 20:03:32 -0000 1.26
+++ x_image.c 9 Dec 2006 19:03:12 -0000 1.27
@@ -35,6 +35,9 @@
#include <dmalloc.h>
#endif
+#define GLADE_HOOKUP_OBJECT(component,widget,name) \
+ g_object_set_data_full (G_OBJECT (component), name, \
+ gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
/* static const gchar *list_item_data_key="list_item_data"; */
@@ -339,15 +342,18 @@
gint x_image_write(GtkWidget *w, TOPLEVEL *w_current)
{
const char *filename=NULL;
+ GtkWidget *widget;
- filename = gtk_entry_get_text(GTK_ENTRY(w_current->ifilename_entry));
+ widget = g_object_get_data (G_OBJECT (w_current->iwindow), "filename_entry");
+
+ filename = gtk_entry_get_text(GTK_ENTRY(widget));
if (filename[0] != '\0') {
x_image_lowlevel(w_current, filename);
}
gtk_widget_destroy(w_current->iwindow);
w_current->iwindow=NULL;
- return(0);
+ return 0;
}
/*! \todo Finish function documentation!!!
@@ -368,17 +374,59 @@
* \par Function Description
*
*/
-int x_image_keypress(GtkWidget * widget, GdkEventKey * event,
- TOPLEVEL * w_current)
+void x_image_response(GtkWidget * widget, gint response, TOPLEVEL *w_current)
{
- if (strcmp(gdk_keyval_name(event->keyval), "Escape") == 0) {
- x_image_cancel(NULL, w_current);
- return TRUE;
+ switch(response) {
+ case GTK_RESPONSE_REJECT:
+ case GTK_RESPONSE_DELETE_EVENT:
+ x_image_cancel(widget, w_current);
+ break;
+ case GTK_RESPONSE_ACCEPT:
+ x_image_write(widget, w_current);
+ break;
+ default:
+ printf("x_image_response(): strange signal %d\n", response);
}
+}
+
+
+/*! \todo Finish function documentation!!!
+ * \brief
+ * \par Function Description
+ *
+ */
+void x_image_select_filename(GtkWidget *w, GtkWidget *image_dialog)
+{
+ GtkWidget *widget;
+ GtkWidget *filechooser;
+ const gchar *filename;
+
+ filechooser = gtk_file_chooser_dialog_new (_("Select Image Filename..."),
+ GTK_WINDOW (image_dialog),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT, NULL);
- return FALSE;
+ widget = g_object_get_data (G_OBJECT (image_dialog), "filename_entry");
+ filename = gtk_entry_get_text (GTK_ENTRY (widget));
+
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooser), filename);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(filechooser),
+ GTK_RESPONSE_ACCEPT);
+
+ if (gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT) {
+ filename =
+ gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser));
+ gtk_entry_set_text (GTK_ENTRY (widget), filename);
+ }
+
+ gtk_widget_destroy (filechooser);
}
+
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
@@ -387,146 +435,75 @@
void x_image_setup (TOPLEVEL *w_current, char *filename)
{
GtkWidget *label;
- GtkWidget *separator;
GtkWidget *box;
- GtkWidget *buttonwrite;
- GtkWidget *buttoncancel;
+ GtkWidget *hbox;
GtkWidget *optionmenu;
- GtkWidget *vbox, *action_area;
-
- /* freeze the window_current pointer so that it doesn't change */
+ GtkWidget *filename_entry;
+ GtkWidget *button;
+ /* only create the dialog if it's not there yet */
if (!w_current->iwindow) {
- w_current->iwindow = x_create_dialog_box(&vbox, &action_area);
+ w_current->iwindow = gtk_dialog_new_with_buttons(_("Write Image..."),
+ GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(w_current->iwindow),
+ GTK_RESPONSE_ACCEPT);
gtk_window_position (GTK_WINDOW (w_current->iwindow),
GTK_WIN_POS_MOUSE);
- gtk_signal_connect (GTK_OBJECT (w_current->iwindow), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->iwindow);
-
-#if 0 /* this was causing the dialog box to not die */
- gtk_signal_connect (GTK_OBJECT (w_current->iwindow), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &w_current->iwindow);
-#endif
-
- gtk_window_set_title (GTK_WINDOW (w_current->iwindow), _("Write Image..."));
+ gtk_signal_connect(GTK_OBJECT(w_current->iwindow), "response",
+ GTK_SIGNAL_FUNC(x_image_response), w_current);
- buttonwrite = gtk_button_new_from_stock (GTK_STOCK_OK);
- GTK_WIDGET_SET_FLAGS (buttonwrite, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area),
- buttonwrite, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (buttonwrite), "clicked",
- GTK_SIGNAL_FUNC(x_image_write), w_current);
- gtk_widget_show (buttonwrite);
- gtk_widget_grab_default (buttonwrite);
-
- buttoncancel = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
- GTK_WIDGET_SET_FLAGS (buttoncancel, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area),
- buttoncancel, TRUE, TRUE, 0);
- gtk_signal_connect ( GTK_OBJECT(buttoncancel),
- "clicked", GTK_SIGNAL_FUNC(x_image_cancel),
- w_current);
- gtk_widget_show (buttoncancel);
+ 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);
-#if 0
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-#endif
-
- box = gtk_vbox_new(FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box), 5);
- gtk_container_add(GTK_CONTAINER(vbox), box);
- gtk_widget_show(box);
-
-#if 0
- label = gtk_label_new (_("Width"));
- gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (box),
- label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- w_current->iwidth_entry = gtk_entry_new_with_max_length (5);
- gtk_editable_select_region (GTK_EDITABLE (w_current->iwidth_entry), 0, -1);
- gtk_box_pack_start (GTK_BOX (box),
- w_current->iwidth_entry, TRUE, TRUE, 10);
- /*
- gtk_signal_connect(GTK_OBJECT(w_current->width_entry),
- "activate",
- GTK_SIGNAL_FUNC(x_image_write),
- w_current);
- */
- gtk_widget_show (w_current->iwidth_entry);
-
- label = gtk_label_new (_("Height"));
- gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (box),
- label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- w_current->iheight_entry = gtk_entry_new_with_max_length (5);
- gtk_editable_select_region (GTK_EDITABLE (w_current->iheight_entry), 0, -1);
- gtk_box_pack_start (GTK_BOX (box),
- w_current->iheight_entry, TRUE, TRUE, 10);
- /*
- gtk_signal_connect(GTK_OBJECT(w_current->height_entry),
- "activate",
- GTK_SIGNAL_FUNC(x_image_write),
- w_current);
- */
- gtk_widget_show (w_current->iheight_entry);
-#endif
- label = gtk_label_new (_("Width x Height"));
+ label = gtk_label_new (_("Width x Height:"));
gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (box),
- label, FALSE, FALSE, 0);
- gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
optionmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), create_menu_size (w_current));
+ 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_widget_show (optionmenu);
- label = gtk_label_new (_("Filename"));
+ label = gtk_label_new (_("Filename:"));
gtk_misc_set_alignment( GTK_MISC (label), 0, 0);
gtk_misc_set_padding (GTK_MISC (label), 0, 0);
gtk_box_pack_start (GTK_BOX (box),
label, FALSE, FALSE, 0);
- gtk_widget_show (label);
- w_current->ifilename_entry = gtk_entry_new_with_max_length (200);
- gtk_editable_select_region (GTK_EDITABLE (w_current->ifilename_entry), 0, -1);
- gtk_box_pack_start (GTK_BOX (box),
- w_current->ifilename_entry, TRUE, TRUE, 10);
- gtk_signal_connect(GTK_OBJECT(w_current->ifilename_entry),
- "activate",
- GTK_SIGNAL_FUNC(x_image_write),
- w_current);
- gtk_widget_show (w_current->ifilename_entry);
+ hbox = gtk_hbox_new(FALSE,10);
+ 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"));
+ gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
+ g_signal_connect(button, "clicked",
+ GTK_SIGNAL_FUNC (x_image_select_filename),
+ w_current->iwindow);
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
+ GLADE_HOOKUP_OBJECT(w_current->iwindow,filename_entry,"filename_entry");
- gtk_signal_connect(GTK_OBJECT(w_current->iwindow), "key_press_event",
- (GtkSignalFunc) x_image_keypress, w_current);
+ gtk_widget_show_all (box);
}
if (!GTK_WIDGET_VISIBLE (w_current->iwindow)) {
- gtk_entry_set_text(GTK_ENTRY(w_current->ifilename_entry), filename);
- /* gtk_entry_set_text(GTK_ENTRY(w_current->iwidth_entry), "800");
- gtk_entry_set_text(GTK_ENTRY(w_current->iheight_entry), "600");*/
-
- /*gtk_entry_select_region(GTK_ENTRY(w_current->ifilename_entry), 0, strlen(filename)); */
+ 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);
1.26 +10 -3 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.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- x_print.c 21 Oct 2006 01:46:29 -0000 1.25
+++ x_print.c 9 Dec 2006 19:03:12 -0000 1.26
@@ -98,6 +98,8 @@
filename = gtk_entry_get_text (GTK_ENTRY (dialog->fnfield));
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooser), filename);
+ gtk_dialog_set_default_response(GTK_DIALOG(filechooser),
+ GTK_RESPONSE_ACCEPT);
if (gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT)
{
@@ -129,7 +131,7 @@
GTK_RESPONSE_REJECT);
return TRUE;
}
- if (strcmp (gdk_keyval_name (event->keyval), "Linefeed") == 0)
+ if (strcmp (gdk_keyval_name (event->keyval), "Return") == 0)
{
gtk_dialog_response (GTK_DIALOG (dialog),
GTK_RESPONSE_ACCEPT);
@@ -214,7 +216,6 @@
renderer, "text", 0);
d->typecbox = GTK_COMBO_BOX (combobox);
-
}
/*!
@@ -710,6 +711,12 @@
"usefile", usefile,
NULL));
gtk_widget_show_all (GTK_WIDGET (dialog));
+
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog),
+ GTK_RESPONSE_ACCEPT);
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),
+ GTK_WINDOW(w_current->main_window));
+
result = gtk_dialog_run (dialog);
if (result == GTK_RESPONSE_ACCEPT)
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs