X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xoptions.c;h=e081bd7a1122a84ab6e5991a0c0a45cbaee971b0;hb=868622bc4b4ac3f5179909e9776ebcb309dd01c9;hp=fb203c6de9cfe73a3f3a8d57c86b0ec144143ce7;hpb=6bb0e96d7ace34f8aab7ba3b99c9f9a077ac266a;p=xboard.git diff --git a/xoptions.c b/xoptions.c index fb203c6..e081bd7 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1067,14 +1067,15 @@ static int TableWidth (Option *opt) { // Hideous work-around! If the table is 3 columns, but 2 & 3 are always occupied together, the fixing of the width of column 1 does not work while(opt->type != EndMark && opt->type != Break) - if(opt->type == FileName || opt++->type == PathName) return 3; // This table needs browse button + if(opt->type == FileName || opt->type == PathName || opt++->type == BarBegin) return 3; // This table needs browse button return 2; // no browse button; } static int SameRow (Option *opt) { - return (opt->min & SAME_ROW && (opt->type == Button || opt->type == SaveButton || opt->type == Label || opt->type == ListBox)); + return (opt->min & SAME_ROW && (opt->type == Button || opt->type == SaveButton || opt->type == Label + || opt->type == ListBox || opt->type == BoxBegin || opt->type == Icon)); } static void @@ -1094,7 +1095,7 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent GtkWidget *box; GtkWidget *checkbutton; GtkWidget *entry; - GtkWidget *hbox = NULL; + GtkWidget *oldHbox, *hbox = NULL; GtkWidget *pane = NULL; GtkWidget *button; GtkWidget *table; @@ -1298,6 +1299,11 @@ printf("n=%d, h=%d, w=%d\n",n,height,width); gtk_table_attach(GTK_TABLE(table), checkbutton, left, left+r, top, top+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 2, 0); option[i].handle = (void *)checkbutton; break; + case Icon: + option[i].handle = (void *) (label = gtk_image_new_from_pixbuf(NULL)); + gtk_widget_set_size_request(label, option[i].max ? option[i].max : -1, -1); + Pack(hbox, table, label, left, left+2, top, 0); + break; case Label: option[i].handle = (void *) (label = gtk_label_new(option[i].name)); /* Left Justify */ @@ -1308,7 +1314,7 @@ printf("n=%d, h=%d, w=%d\n",n,height,width); label = frame; } gtk_widget_set_size_request(label, option[i].max ? option[i].max : -1, -1); - Pack(hbox, table, label, left, left+r, top, 0); + Pack(hbox, table, label, left, left+2, top, 0); if(option[i].target) { // allow user to specify event handler for button presses gtk_widget_add_events(GTK_WIDGET(label), GDK_BUTTON_PRESS_MASK); g_signal_connect(label, "button-press-event", G_CALLBACK(MemoEvent), (gpointer) &option[i]); @@ -1460,14 +1466,25 @@ printf("n=%d, h=%d, w=%d\n",n,height,width); case BarBegin: menuBar = gtk_menu_bar_new (); gtk_widget_show (menuBar); + boxStart = i; + break; case BoxBegin: + option[i+1].min |= SAME_ROW; // kludge to suppress allocation of new hbox + oldHbox = hbox; + option[i].handle = (void*) (hbox = gtk_hbox_new(FALSE, 0)); // hbox to collect buttons + gtk_box_pack_start(GTK_BOX (oldHbox), hbox, FALSE, TRUE, 0); // *** Beware! Assumes button bar always on same row with other! *** +// gtk_table_attach(GTK_TABLE(table), hbox, left+2, left+3, top, top+1, GTK_FILL | GTK_SHRINK, GTK_FILL, 2, 1); boxStart = i; break; case BarEnd: - gtk_table_attach_defaults(GTK_TABLE(table), menuBar, left, left+r, top, top+1); + gtk_table_attach(GTK_TABLE(table), menuBar, left, left+r, top, top+1, GTK_FILL | GTK_EXPAND, GTK_FILL, 2, 1); + + if(option[i].target) ((ButtonCallback*)option[i].target)(boxStart); // callback that can make sizing decisions + break; case BoxEnd: // XtManageChildren(&form, 1); // SqueezeIntoBox(&option[boxStart], i-boxStart, option[boxStart].max); + hbox = oldHbox; if(option[i].target) ((ButtonCallback*)option[i].target)(boxStart); // callback that can make sizing decisions break; case Break: