[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: x_autonumber.c
User: werner
Date: 06/11/24 17:45:10
Modified: . Tag: autonumber x_autonumber.c
Log:
* src/x_autonumber.c: repaired keypress events, added gettext macros
replaced the sortorder ratio buttons with a combo box. That shrinks
the dialog a lot.
* po/POTFILES.in: added x_autonumber.c
* bitmap/gschem-fileorder.png: added an ugly dummy bitmap
Revision Changes Path
No revision
No revision
1.1.2.5 +353 -484 eda/geda/gaf/gschem/src/Attic/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/Attic/x_autonumber.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- x_autonumber.c 11 Nov 2006 18:51:01 -0000 1.1.2.4
+++ x_autonumber.c 24 Nov 2006 22:45:10 -0000 1.1.2.5
@@ -48,12 +48,12 @@
/* autonumber text structs and enums */
enum {
- AUTONUMBER_SORT_FILE,
+ AUTONUMBER_SORT_DIAGONAL,
AUTONUMBER_SORT_YX,
AUTONUMBER_SORT_YX_REV,
AUTONUMBER_SORT_XY,
AUTONUMBER_SORT_XY_REV,
- AUTONUMBER_SORT_DIAGONAL
+ AUTONUMBER_SORT_FILE
};
enum {
@@ -174,9 +174,9 @@
if (aa->text->x > bb->text->x)
return -1;
/* x == x */
- if (aa->text->y > bb->text->y)
- return 1;
if (aa->text->y < bb->text->y)
+ return 1;
+ if (aa->text->y > bb->text->y)
return -1;
return 0;
}
@@ -219,9 +219,9 @@
if (aa->text->y < bb->text->y)
return -1;
/* y == y */
- if (aa->text->x < bb->text->x)
- return 1;
if (aa->text->x > bb->text->x)
+ return 1;
+ if (aa->text->x < bb->text->x)
return -1;
return 0;
}
@@ -435,7 +435,7 @@
if (slot_item == NULL) {
/* insert all slots to the list, except of the current one */
for (i=1; i <= numslots; i++) {
- if (i != slot) {
+ if (i != slotnr) {
slot = g_memdup(slot, sizeof(AUTONUMBER_SLOT));
slot->slotnr = i;
autotext->free_slots = g_list_insert_sorted(autotext->free_slots,
@@ -832,25 +832,53 @@
return found_widget;
}
-/** @brief Creates a new GtkImage displaying from an icon file.
- *
- * @param stock Name of the icon.
- * @return Pointer to the new GtkImage object.
- */
-static GtkWidget *autonumber_create_pixmap(const char *file,
- TOPLEVEL *w_current)
+
+void autonumber_sortorder_create(TOPLEVEL *w_current, GtkWidget *sort_order)
{
- GtkWidget *wpixmap;
+ GtkListStore *store;
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
+ GdkPixbuf *pixbuf;
gchar *path;
+ GError *error=NULL;
- path=g_strconcat(w_current->bitmap_directory,
- G_DIR_SEPARATOR_S, file, NULL);
+ gchar *filenames[] = {"gschem-diagonal.png",
+ "gschem-top2bottom.png", "gschem-bottom2top.png",
+ "gschem-left2right.png", "gschem-right2left.png",
+ "gschem-fileorder.png",
+ NULL};
+ gchar *names[] = {N_("Diagonal"),
+ N_("Top to bottom"), N_("Bottom to top"),
+ N_("Left to right"), N_("Right to left"),
+ N_("File order"),
+ NULL};
+ gint i;
- wpixmap = gtk_image_new_from_file (path);
+ store = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+ for (i=0; filenames[i] != NULL; i++) {
+ path=g_strconcat(w_current->bitmap_directory,
+ G_DIR_SEPARATOR_S, filenames[i], NULL);
+ pixbuf = gdk_pixbuf_new_from_file(path, &error);
g_free(path);
-
- return wpixmap;
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ 0, pixbuf,
+ 1, names[i],
+ -1);
+ }
+
+ gtk_combo_box_set_model(GTK_COMBO_BOX(sort_order), GTK_TREE_MODEL(store));
+ renderer = gtk_cell_renderer_pixbuf_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (sort_order),
+ renderer, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (sort_order),
+ renderer, "pixbuf", 0, NULL);
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (sort_order),
+ renderer, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (sort_order),
+ renderer, "text", 1, NULL);
}
/* ***** STATE STRUCT HANDLING (interface between GUI and backend code) **** */
@@ -939,7 +967,7 @@
autotext->scope_number = SCOPE_SELECTED;
autotext->scope_overwrite = 0;
- autotext->order = AUTONUMBER_SORT_FILE;
+ autotext->order = AUTONUMBER_SORT_DIAGONAL;
autotext->startnum=1;
@@ -958,7 +986,8 @@
void autonumber_set_state(AUTONUMBER_TEXT *autotext)
{
GtkWidget *widget;
-
+ GtkTreeModel *model;
+ GList *el;
/* Scope */
/* Search text history */
@@ -970,14 +999,11 @@
* advertised API, you need to remember how many rows you added and
* use gtk_combo_box_remove_text() */
- GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
gtk_list_store_clear(GTK_LIST_STORE(model));
- GList *el = autotext->scope_text;
-
- while(el!=NULL) {
+ for (el= autotext->scope_text; el != NULL; el=g_list_next(el)) {
gtk_combo_box_append_text(GTK_COMBO_BOX(widget), el->data);
- el=g_list_next(el);
}
widget = lookup_widget(autotext->dialog, "scope_skip");
@@ -992,51 +1018,14 @@
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
autotext->scope_overwrite);
- /* Sort order */
- switch(autotext->order) {
- case AUTONUMBER_SORT_FILE:
-
- widget = lookup_widget(autotext->dialog, "order_file");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), 1);
- break;
-
- case AUTONUMBER_SORT_XY:
-
- widget = lookup_widget(autotext->dialog, "order_left2right");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), 1);
- break;
-
- case AUTONUMBER_SORT_XY_REV:
-
- widget = lookup_widget(autotext->dialog, "order_right2left");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), 1);
- break;
-
- case AUTONUMBER_SORT_YX:
-
- widget = lookup_widget(autotext->dialog, "order_top2bottom");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), 1);
- break;
-
- case AUTONUMBER_SORT_YX_REV:
-
- widget = lookup_widget(autotext->dialog, "order_bottom2top");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), 1);
- break;
-
- case AUTONUMBER_SORT_DIAGONAL:
-
- widget = lookup_widget(autotext->dialog, "order_diagonal");
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), 1);
- break;
- }
-
/* Options */
-
widget = lookup_widget(autotext->dialog, "opt_startnum");
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget),
autotext->startnum);
+ widget = lookup_widget(autotext->dialog, "sort_order");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(widget), autotext->order);
+
widget = lookup_widget(autotext->dialog, "opt_removenum");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
autotext->removenum);
@@ -1067,75 +1056,27 @@
autotext->scope_text=autonumber_history_add(autotext->scope_text, text);
widget = lookup_widget(autotext->dialog, "scope_skip");
- autotext->scope_skip = gtk_combo_box_get_active(
- GTK_COMBO_BOX(widget) );
+ autotext->scope_skip = gtk_combo_box_get_active( GTK_COMBO_BOX(widget) );
widget = lookup_widget(autotext->dialog, "scope_number");
- autotext->scope_number = gtk_combo_box_get_active(
- GTK_COMBO_BOX(widget) );
+ autotext->scope_number = gtk_combo_box_get_active(GTK_COMBO_BOX(widget) );
widget = lookup_widget(autotext->dialog, "scope_overwrite");
- autotext->scope_overwrite = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(widget) );
+ autotext->scope_overwrite = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
/* Sort order */
- autotext->order=-1;
-
- if(autotext->order==-1) {
- widget = lookup_widget(autotext->dialog, "order_file");
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
- autotext->order=AUTONUMBER_SORT_FILE;
- }
- }
-
- if(autotext->order==-1) {
- widget = lookup_widget(autotext->dialog, "order_left2right");
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
- autotext->order=AUTONUMBER_SORT_XY;
- }
- }
-
- if(autotext->order==-1) {
- widget = lookup_widget(autotext->dialog, "order_right2left");
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
- autotext->order=AUTONUMBER_SORT_XY_REV;
- }
- }
-
- if(autotext->order==-1) {
- widget = lookup_widget(autotext->dialog, "order_top2bottom");
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
- autotext->order=AUTONUMBER_SORT_YX;
- }
- }
-
- if(autotext->order==-1) {
- widget = lookup_widget(autotext->dialog, "order_bottom2top");
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
- autotext->order=AUTONUMBER_SORT_YX_REV;
- }
- }
-
- if(autotext->order==-1) {
- widget = lookup_widget(autotext->dialog, "order_diagonal");
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
- autotext->order=AUTONUMBER_SORT_DIAGONAL;
- }
- }
+ widget = lookup_widget(autotext->dialog, "sort_order");
+ autotext->order= gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
/* Options */
-
widget = lookup_widget(autotext->dialog, "opt_startnum");
- autotext->startnum=gtk_spin_button_get_value_as_int(
- GTK_SPIN_BUTTON(widget));
+ autotext->startnum=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
widget = lookup_widget(autotext->dialog, "opt_removenum");
- autotext->removenum = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(widget) );
+ autotext->removenum = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(autotext->dialog, "opt_slotting");
- autotext->slotting = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(widget) );
+ autotext->slotting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
/* ***** CALLBACKS (functions that get called directly from the GTK) ******* */
@@ -1149,8 +1090,6 @@
autonumber_get_state(autotext);
autonumber_text_autonumber(autotext);
-
- autonumber_set_state(autotext);
}
/*! \brief Destroy callback function of the autonumber text dialog
@@ -1165,6 +1104,26 @@
autotext->dialog = NULL;
}
+/*! \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;
+ }
+ return FALSE;
+}
+
/** @brief Callback that activates or deactivates "overwrite existing numbers"
* check box.
*
@@ -1228,47 +1187,32 @@
GtkWidget *vbox3;
GtkWidget *table1;
GtkWidget *label4;
- GtkWidget *label6;
GtkWidget *scope_text;
- GtkWidget *scope_skip;
GtkWidget *label8;
+ GtkWidget *label6;
GtkWidget *scope_number;
+ GtkWidget *scope_skip;
GtkWidget *scope_overwrite;
GtkWidget *label1;
- GtkWidget *frame2;
- GtkWidget *alignment2;
- GtkWidget *table2;
- GtkWidget *order_file;
- GSList *order_file_group = NULL;
- GtkWidget *order_top2bottom;
- GtkWidget *order_left2right;
- GtkWidget *order_diagonal;
- GtkWidget *image2;
- GtkWidget *image3;
- GtkWidget *image1;
- GtkWidget *image4;
- GtkWidget *image5;
- GtkWidget *order_bottom2top;
- GtkWidget *order_right2left;
- GtkWidget *label2;
GtkWidget *frame3;
GtkWidget *alignment3;
GtkWidget *vbox4;
- GtkWidget *hbox1;
+ GtkWidget *table3;
GtkWidget *label12;
+ GtkWidget *label13;
GtkObject *opt_startnum_adj;
GtkWidget *opt_startnum;
+ GtkWidget *sort_order;
GtkWidget *opt_removenum;
GtkWidget *opt_slotting;
GtkWidget *label3;
GtkWidget *hbuttonbox1;
- GtkWidget *button_cancel;
+ 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_title (GTK_WINDOW (autonumber_text), _("Autonumber text"));
gtk_window_set_resizable (GTK_WINDOW (autonumber_text), FALSE);
- // gtk_window_set_type_hint (GTK_WINDOW (autonumber_text), GDK_WINDOW_TYPE_HINT_DIALOG);
vbox1 = gtk_vbox_new (FALSE, 24);
gtk_widget_show (vbox1);
@@ -1295,159 +1239,60 @@
gtk_table_set_row_spacings (GTK_TABLE (table1), 3);
gtk_table_set_col_spacings (GTK_TABLE (table1), 12);
- label4 = gtk_label_new ("Search for:");
+ label4 = gtk_label_new (_("Search for:"));
gtk_widget_show (label4);
gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
- label6 = gtk_label_new ("Skip numbers found in:");
- gtk_widget_show (label6);
- gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
-
scope_text = gtk_combo_box_entry_new_text ();
gtk_widget_show (scope_text);
gtk_table_attach (GTK_TABLE (table1), scope_text, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
- scope_skip = gtk_combo_box_new_text ();
- gtk_widget_show (scope_skip);
- gtk_table_attach (GTK_TABLE (table1), scope_skip, 1, 2, 2, 3,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
- gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), "Selected objects");
- gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), "Current page");
- gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), "Whole hierarchy");
-
- label8 = gtk_label_new ("Autonumber text in:");
+ label8 = gtk_label_new (_("Autonumber text in:"));
gtk_widget_show (label8);
gtk_table_attach (GTK_TABLE (table1), label8, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
+ label6 = gtk_label_new (_("Skip numbers found in:"));
+ gtk_widget_show (label6);
+ gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
+
scope_number = gtk_combo_box_new_text ();
gtk_widget_show (scope_number);
gtk_table_attach (GTK_TABLE (table1), scope_number, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
- gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), "Selected objects");
- gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), "Current page");
- gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), "Whole hierarchy");
+ gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), _("Selected objects"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), _("Current page"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (scope_number), _("Whole hierarchy"));
- scope_overwrite = gtk_check_button_new_with_label ("Overwrite existing numbers");
+ scope_skip = gtk_combo_box_new_text ();
+ gtk_widget_show (scope_skip);
+ gtk_table_attach (GTK_TABLE (table1), scope_skip, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (GTK_FILL), 0, 0);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), _("Selected objects"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), _("Current page"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (scope_skip), _("Whole hierarchy"));
+
+ scope_overwrite = gtk_check_button_new_with_mnemonic (_("Overwrite existing numbers"));
gtk_widget_show (scope_overwrite);
gtk_box_pack_start (GTK_BOX (vbox3), scope_overwrite, FALSE, FALSE, 6);
- label1 = gtk_label_new ("<b>Scope</b>");
+ 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);
- frame2 = gtk_frame_new (NULL);
- gtk_widget_show (frame2);
- gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0);
- gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE);
-
- alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
- gtk_widget_show (alignment2);
- gtk_container_add (GTK_CONTAINER (frame2), alignment2);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 24, 0);
-
- table2 = gtk_table_new (4, 4, FALSE);
- gtk_widget_show (table2);
- gtk_container_add (GTK_CONTAINER (alignment2), table2);
- gtk_table_set_row_spacings (GTK_TABLE (table2), 3);
- gtk_table_set_col_spacings (GTK_TABLE (table2), 12);
-
- order_file = gtk_radio_button_new_with_label (NULL, "File order");
- gtk_widget_show (order_file);
- gtk_table_attach (GTK_TABLE (table2), order_file, 0, 1, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (order_file), order_file_group);
- order_file_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (order_file));
-
- order_top2bottom = gtk_radio_button_new_with_label (NULL, "Top to bottom");
- gtk_widget_show (order_top2bottom);
- gtk_table_attach (GTK_TABLE (table2), order_top2bottom, 1, 2, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (order_top2bottom), order_file_group);
- order_file_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (order_top2bottom));
-
- order_left2right = gtk_radio_button_new_with_label (NULL, "Left to right");
- gtk_widget_show (order_left2right);
- gtk_table_attach (GTK_TABLE (table2), order_left2right, 2, 3, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (order_left2right), order_file_group);
- order_file_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (order_left2right));
-
- order_diagonal = gtk_radio_button_new_with_label (NULL, "Diagonal");
- gtk_widget_show (order_diagonal);
- gtk_table_attach (GTK_TABLE (table2), order_diagonal, 3, 4, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (order_diagonal), order_file_group);
- order_file_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (order_diagonal));
-
- image2 = autonumber_create_pixmap("gschem-left2right.png", w_current);
- gtk_widget_show (image2);
- gtk_table_attach (GTK_TABLE (table2), image2, 2, 3, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
-
- image3 = autonumber_create_pixmap("gschem-diagonal.png", w_current);
- gtk_widget_show (image3);
- gtk_table_attach (GTK_TABLE (table2), image3, 3, 4, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
-
- image1 = autonumber_create_pixmap("gschem-top2bottom.png", w_current);
- gtk_widget_show (image1);
- gtk_table_attach (GTK_TABLE (table2), image1, 1, 2, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
-
- image4 = autonumber_create_pixmap("gschem-bottom2top.png", w_current);
- gtk_widget_show (image4);
- gtk_table_attach (GTK_TABLE (table2), image4, 1, 2, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
-
- image5 = autonumber_create_pixmap("gschem-right2left.png", w_current);
- gtk_widget_show (image5);
- gtk_table_attach (GTK_TABLE (table2), image5, 2, 3, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
-
- order_bottom2top = gtk_radio_button_new_with_label (NULL, "Bottom to top");
- gtk_widget_show (order_bottom2top);
- gtk_table_attach (GTK_TABLE (table2), order_bottom2top, 1, 2, 3, 4,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (order_bottom2top), order_file_group);
- order_file_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (order_bottom2top));
-
- order_right2left = gtk_radio_button_new_with_label (NULL, "Right to left");
- gtk_widget_show (order_right2left);
- gtk_table_attach (GTK_TABLE (table2), order_right2left, 2, 3, 3, 4,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (order_right2left), order_file_group);
- order_file_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (order_right2left));
-
- label2 = gtk_label_new ("<b>Sort order</b>");
- gtk_widget_show (label2);
- gtk_frame_set_label_widget (GTK_FRAME (frame2), label2);
- gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
-
frame3 = gtk_frame_new (NULL);
gtk_widget_show (frame3);
gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0);
@@ -1462,28 +1307,48 @@
gtk_widget_show (vbox4);
gtk_container_add (GTK_CONTAINER (alignment3), vbox4);
- hbox1 = gtk_hbox_new (FALSE, 12);
- gtk_widget_show (hbox1);
- gtk_box_pack_start (GTK_BOX (vbox4), hbox1, TRUE, TRUE, 0);
+ 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);
- label12 = gtk_label_new ("Starting number:");
+ label12 = gtk_label_new (_("Starting number:"));
gtk_widget_show (label12);
- gtk_box_pack_start (GTK_BOX (hbox1), label12, FALSE, FALSE, 0);
+ gtk_table_attach (GTK_TABLE (table3), label12, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
+
+ label13 = gtk_label_new (_("Sort order:"));
+ gtk_widget_show (label13);
+ gtk_table_attach (GTK_TABLE (table3), label13, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);
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_widget_show (opt_startnum);
- gtk_box_pack_start (GTK_BOX (hbox1), opt_startnum, FALSE, FALSE, 0);
+ gtk_table_attach (GTK_TABLE (table3), opt_startnum, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ sort_order = gtk_combo_box_new();
+ gtk_widget_show (sort_order);
+ gtk_table_attach (GTK_TABLE (table3), sort_order, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (GTK_FILL), 0, 0);
- opt_removenum = gtk_check_button_new_with_label ("Remove numbers");
+ opt_removenum = gtk_check_button_new_with_mnemonic (_("Remove numbers"));
gtk_widget_show (opt_removenum);
gtk_box_pack_start (GTK_BOX (vbox4), opt_removenum, FALSE, FALSE, 0);
- opt_slotting = gtk_check_button_new_with_label ("Automatic slotting");
+ opt_slotting = gtk_check_button_new_with_mnemonic (_("Automatic slotting"));
gtk_widget_show (opt_slotting);
gtk_box_pack_start (GTK_BOX (vbox4), opt_slotting, FALSE, FALSE, 0);
- label3 = gtk_label_new ("<b>Options</b>");
+ 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);
@@ -1494,32 +1359,27 @@
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END);
gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 12);
- button_cancel = gtk_button_new_from_stock ("gtk-close");
- gtk_widget_show (button_cancel);
- gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_cancel);
- GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT);
+ 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);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label12), opt_startnum);
-
+ /* 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_skip, "scope_skip");
GLADE_HOOKUP_OBJECT (autonumber_text, scope_number, "scope_number");
+ GLADE_HOOKUP_OBJECT (autonumber_text, scope_skip, "scope_skip");
GLADE_HOOKUP_OBJECT (autonumber_text, scope_overwrite, "scope_overwrite");
- GLADE_HOOKUP_OBJECT (autonumber_text, order_file, "order_file");
- GLADE_HOOKUP_OBJECT (autonumber_text, order_top2bottom, "order_top2bottom");
- GLADE_HOOKUP_OBJECT (autonumber_text, order_left2right, "order_left2right");
- GLADE_HOOKUP_OBJECT (autonumber_text, order_diagonal, "order_diagonal");
- GLADE_HOOKUP_OBJECT (autonumber_text, order_bottom2top, "order_bottom2top");
- GLADE_HOOKUP_OBJECT (autonumber_text, order_right2left, "order_right2left");
GLADE_HOOKUP_OBJECT (autonumber_text, opt_startnum, "opt_startnum");
+ 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_cancel, "button_close");
+ GLADE_HOOKUP_OBJECT (autonumber_text, button_close, "button_close");
GLADE_HOOKUP_OBJECT (autonumber_text, button_ok, "button_ok");
return autonumber_text;
@@ -1539,6 +1399,7 @@
GtkWidget *button_ok = NULL;
GtkWidget *button_close = NULL;
GtkWidget *opt_removenum = NULL;
+ GtkWidget *sort_order = NULL;
if(autotext == NULL) {
/* first call of this function, init dialog structure */
@@ -1556,10 +1417,13 @@
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",
- (GtkSignalFunc) autonumber_text_destroy,
+ GTK_SIGNAL_FUNC(autonumber_text_destroy),
autotext);
gtk_signal_connect(GTK_OBJECT(button_ok),
@@ -1577,6 +1441,11 @@
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);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs