Back to index

tetex-bin  3.0
xm_prefs_appearance.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 Stefan Ulrich
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to
00006  * deal in the Software without restriction, including without limitation the
00007  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00008  * sell copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00017  * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
00018  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020  * OTHER DEALINGS IN THE SOFTWARE.
00021  *
00022  */
00023 
00024 /*
00025  * Panel 1 (Apperance) for xdvik preferences dialog.
00026  */
00027 
00028 #include "xdvi-config.h"
00029 #include "xdvi.h"
00030 
00031 #include "x_util.h"
00032 #include "my-snprintf.h"
00033 #include "xm_colorsel.h"
00034 #include "topic-window.h"
00035 #include "message-window.h"
00036 #include "util.h"
00037 #include "events.h"
00038 
00039 #include "xm_toolbar.h"
00040 #include "xm_menu.h"
00041 #include "statusline.h"
00042 #include "pagesel.h"
00043 
00044 #include "xm_prefsP.h"
00045 #include "xm_prefs_appearance.h"
00046 
00047 #ifdef MOTIF /* entire file */
00048 
00049 #include <X11/Xatom.h>
00050 
00051 #include <Xm/Xm.h>
00052 #include <Xm/Protocols.h>
00053 #include <Xm/DialogS.h>
00054 #include <Xm/LabelG.h>
00055 #include <Xm/PushB.h>
00056 #include <Xm/Form.h>
00057 #include <Xm/Frame.h>
00058 #include <Xm/PanedW.h>
00059 #include <Xm/DrawnB.h>
00060 #include <Xm/RowColumn.h>
00061 #include <Xm/Scale.h>
00062 #include <Xm/ToggleBG.h>
00063 #include <Xm/Text.h>
00064 #include <Xm/TextF.h>
00065 
00066 /*
00067  * Handy defaults
00068  */
00069 static Arg one_of_many = { XmNindicatorType, XmONE_OF_MANY };
00070 static Arg n_of_many = { XmNindicatorType, XmN_OF_MANY };
00071 static Arg frame_title = { XmNchildType, XmFRAME_TITLE_CHILD };
00072 static Arg two_cols[] = {
00073     { XmNpacking, XmPACK_TIGHT },
00074     { XmNnumColumns, 2 },
00075     { XmNorientation, XmHORIZONTAL }
00076 };
00077 static Arg two_cols_fixed[] = {
00078     { XmNpacking, XmPACK_COLUMN },
00079     { XmNnumColumns, 2 }
00080 };
00081 
00082 static void
00083 match_cb(Widget w, XtPointer client_data, XtPointer call_data)
00084 {
00085     struct topic_info *info = (struct topic_info *)client_data;
00086     struct prefs_choice *prefs = (struct prefs_choice *)(info->data);
00087     Widget inverted, boxed;
00088     
00089     UNUSED(w);
00090     UNUSED(call_data);
00091 
00092     resource.match_highlight_inverted = !resource.match_highlight_inverted;
00093 
00094     /* force a redraw so that a current match is updated if there was one */
00095     globals.ev.flags |= EV_NEWPAGE;
00096     
00097     store_preference(&(prefs->db), "matchInverted", "%s",
00098                    resource.match_highlight_inverted ? "True" : "False");
00099     
00100     if (get_widget_by_name(&inverted, info->shell, Xdvi_MATCH_INVERTED_STR, True)
00101        && get_widget_by_name(&boxed, info->shell, Xdvi_MATCH_BOXED_STR, True)) {
00102 
00103        XmToggleButtonGadgetSetState(inverted, resource.match_highlight_inverted, False);
00104        XmToggleButtonGadgetSetState(boxed, !resource.match_highlight_inverted, False);
00105     }
00106 }
00107 
00108 static void
00109 tooltips_cb(Widget w, XtPointer client_data, XtPointer call_data)
00110 {
00111     struct topic_info *info = (struct topic_info *)client_data;
00112     struct prefs_choice *prefs = (struct prefs_choice *)(info->data);
00113     const char *w_name = XtName(w);
00114 
00115     UNUSED(call_data);
00116 
00117     if (strcmp(w_name, Xdvi_TIPS_STATUSLINE) == 0) {
00118        resource.tooltips_in_statusline = !resource.tooltips_in_statusline;
00119        store_preference(&(prefs->db), "tooltipsInStatusline", "%s",
00120                       resource.tooltips_in_statusline ? "True" : "False");
00121     }
00122     else if (strcmp(w_name, Xdvi_TIPS_POPUPS) == 0) {
00123        Widget label1, text, label2;
00124 
00125        resource.show_tooltips = !resource.show_tooltips;
00126 
00127        if (!resource.show_tooltips && resource.tooltips_wait_period >= 0) {
00128            if (resource.tooltips_wait_period == 0)
00129               resource.tooltips_wait_period = -1;
00130            else
00131               resource.tooltips_wait_period = -resource.tooltips_wait_period;
00132        }
00133        else if (resource.show_tooltips && resource.tooltips_wait_period < 0) {
00134            resource.tooltips_wait_period = -resource.tooltips_wait_period;
00135        }
00136        store_preference(&(prefs->db), "showTooltips", "%s", resource.show_tooltips ? "True" : "False");
00137        
00138        if (get_widget_by_name(&label1, info->shell, Xdvi_TIPS_DELAY_LABEL1, True)
00139            && get_widget_by_name(&text, info->shell, Xdvi_TIPS_DELAY_TEXT, True)
00140            && get_widget_by_name(&label2, info->shell, Xdvi_TIPS_DELAY_LABEL2, True)) {
00141 
00142            XtSetSensitive(label1, resource.show_tooltips);
00143            XtSetSensitive(text, resource.show_tooltips);
00144            XtSetSensitive(label2, resource.show_tooltips);
00145        }
00146     }
00147     else if (strcmp(w_name, Xdvi_TIPS_DELAY_TEXT) == 0) {
00148        char *buf = XmTextFieldGetString(w);
00149        int val = strtol(buf, (char **)NULL, 10);
00150        XtFree((char *)buf);
00151        TRACE_GUI((stderr, "tooltips_cb wait period2: %d\n", val));
00152 
00153        resource.tooltips_wait_period = val;
00154        store_preference(&(prefs->db), "tipShell.waitPeriod", "%d", val);
00155        
00156     }
00157     else {
00158        XDVI_WARNING((stderr, "unexpected widget name `%s' in tooltips_cb", XtName(w)));
00159     }
00160     
00161 }
00162 
00163 #if 0
00164 static void
00165 toolbar_buttons_cb(Widget w, XtPointer client_data, XtPointer call_data)
00166 {
00167     struct topic_info *info = (struct topic_info *)client_data;
00168     struct x_resources *res = (struct x_resources *)(info->data);
00169     Boolean is_flat = False, is_raised = False;
00170 
00171     Widget flat_b, raised_b;
00172 
00173     UNUSED(call_data);
00174     
00175     if (!get_widget_by_name(&flat_b, XtParent(w), TB_BUTTONS_FLAT_STR, True) ||
00176        !get_widget_by_name(&raised_b, XtParent(w), TB_BUTTONS_RAISED_STR, True))
00177        return;
00178     
00179     if (w == flat_b) {
00180        is_flat = True;
00181     }
00182     else if (w == raised_b) {
00183        is_raised = True;
00184     }
00185     else {
00186        unexpected_widget_in_callback(w, "toolbar_buttons_cb()");
00187        return;
00188     }
00189 
00190     res->toolbar_buttons_raised = is_raised ? True : False;
00191     
00192     XmToggleButtonGadgetSetState(raised_b, is_raised, False);
00193     XmToggleButtonGadgetSetState(flat_b, is_flat, False);
00194 }
00195 #endif /* 0 */
00196 
00197 void update_preferences_expert(void)
00198 {
00199     Widget shell;
00200     Widget statusline_b, toolbar_b, pagelist_b, scrollbars_b;
00201 
00202     /* it's not an error if the prefs dialog doesn't exist yet */
00203     if (get_widget_by_name(&shell, globals.widgets.top_level, Xdvi_PREFS_DIALOG_NAME, False)
00204        && get_widget_by_name(&statusline_b, shell, Xdvi_GUI_STATUSLINE_STR, True)
00205        && get_widget_by_name(&toolbar_b, shell, Xdvi_GUI_TOOLBAR_STR, True)
00206        && get_widget_by_name(&pagelist_b, shell, Xdvi_GUI_PAGELIST_STR, True)
00207        && get_widget_by_name(&scrollbars_b, shell, Xdvi_GUI_SCROLLBARS_STR, True)) {
00208 
00209        XmToggleButtonGadgetSetState(statusline_b, resource.expert_mode & XPRT_SHOW_STATUSLINE ? True : False, False);
00210        XmToggleButtonGadgetSetState(toolbar_b, resource.expert_mode & XPRT_SHOW_TOOLBAR ? True : False, False);
00211        XmToggleButtonGadgetSetState(pagelist_b, resource.expert_mode & XPRT_SHOW_PAGELIST ? True : False, False);
00212        XmToggleButtonGadgetSetState(scrollbars_b, resource.expert_mode & XPRT_SHOW_SCROLLBARS ? True : False, False);
00213     }
00214 }
00215 
00216 void update_preferences_tooltips(void)
00217 {
00218      Widget shell;
00219      Widget statusline_b, popup_b, label1, text, label2;
00220 
00221      if (resource.toolbar_unusable)
00222         return;
00223      
00224      if (get_widget_by_name(&shell, globals.widgets.top_level, Xdvi_PREFS_DIALOG_NAME, True)
00225         && get_widget_by_name(&statusline_b, shell, Xdvi_TIPS_STATUSLINE, True)
00226         && get_widget_by_name(&popup_b, shell, Xdvi_TIPS_POPUPS, True)
00227         && get_widget_by_name(&label1, shell, Xdvi_TIPS_DELAY_LABEL1, True)
00228         && get_widget_by_name(&text, shell, Xdvi_TIPS_DELAY_TEXT, True)
00229         && get_widget_by_name(&label2, shell, Xdvi_TIPS_DELAY_LABEL2, True)) {
00230 
00231         char buf[LENGTH_OF_INT];
00232 
00233         SNPRINTF(buf, LENGTH_OF_INT, "%d", ABS(resource.tooltips_wait_period));
00234         XtVaSetValues(text, XmNvalue, buf, NULL);
00235         
00236         XmToggleButtonGadgetSetState(statusline_b, resource.tooltips_in_statusline, False);
00237         XmToggleButtonGadgetSetState(popup_b, resource.show_tooltips, False);
00238 
00239         XtSetSensitive(label1, resource.show_tooltips);
00240         XtSetSensitive(text, resource.show_tooltips);
00241         XtSetSensitive(label2, resource.show_tooltips);
00242      }
00243 }
00244 
00245 void update_preferences_search(void)
00246 {
00247     Widget shell;
00248     Widget inverted, boxed;
00249 
00250     if (get_widget_by_name(&shell, globals.widgets.top_level, Xdvi_PREFS_DIALOG_NAME, True)
00251        && get_widget_by_name(&inverted, shell, Xdvi_MATCH_INVERTED_STR, True)
00252        && get_widget_by_name(&boxed, shell, Xdvi_MATCH_BOXED_STR, True)) {
00253 
00254        XmToggleButtonGadgetSetState(inverted, resource.match_highlight_inverted, False);
00255        XmToggleButtonGadgetSetState(boxed, !resource.match_highlight_inverted, False);
00256     }
00257 }
00258 
00259 static void
00260 gui_buttons_cb(Widget w, XtPointer client_data, XtPointer call_data)
00261 {
00262     struct topic_info *info = (struct topic_info *)client_data;
00263     struct prefs_choice *prefs = (struct prefs_choice *)(info->data);
00264     char *name = XtName(w);
00265     
00266     UNUSED(call_data);
00267 
00268     if (strcmp(name, Xdvi_GUI_STATUSLINE_STR) == 0) {
00269        resource.expert_mode ^= XPRT_SHOW_STATUSLINE;
00270        toggle_statusline();
00271        update_expert_mode();
00272     }
00273     else if (strcmp(name, Xdvi_GUI_TOOLBAR_STR) == 0) {
00274        resource.expert_mode ^= XPRT_SHOW_TOOLBAR;
00275        toggle_toolbar();
00276        update_expert_mode();
00277     }
00278     else if (strcmp(name, Xdvi_GUI_PAGELIST_STR) == 0) {
00279        resource.expert_mode ^= XPRT_SHOW_PAGELIST;
00280        toggle_pagelist();
00281        update_expert_mode();
00282     }
00283     else if (strcmp(name, Xdvi_GUI_SCROLLBARS_STR) == 0) {
00284 #if defined(LESSTIF_VERSION)
00285        static Boolean warned_about_lesstif = False;
00286 #endif
00287        resource.expert_mode ^= XPRT_SHOW_SCROLLBARS;
00288        toggle_scrollbars();
00289        update_expert_mode();
00290 #if defined(LESSTIF_VERSION)
00291        if (!warned_about_lesstif) {
00292            warned_about_lesstif = True;
00293            popup_message(globals.widgets.top_level,
00294                        MSG_INFO,
00295                        NULL,
00296                        "This version has been compiled with LessTif; "
00297                        "toggling the scrollbars won't work with LessTif.");
00298        }
00299 #endif
00300     }
00301     else {
00302        popup_message(globals.widgets.top_level,
00303                     MSG_ERR,
00304                     REPORT_XDVI_BUG_TEMPLATE,
00305                     "Unexpected label in gui buttons: |%s|!\n", name);
00306     }
00307     store_preference(&(prefs->db), "expertMode", "%d", resource.expert_mode);
00308 }
00309 
00310 
00311 #if 0
00312 static void
00313 toolbar_buttons_init(struct topic_info *info, Widget raised, Widget flat)
00314 {
00315     Boolean is_flat = False, is_raised = False;
00316     struct x_resources *res = (struct x_resources *)(info->data);
00317 
00318     if (res->toolbar_buttons_raised)
00319        is_raised = True;
00320 
00321     XmToggleButtonGadgetSetState(raised, is_raised, False);
00322     XmToggleButtonGadgetSetState(flat, is_flat, False);
00323     
00324     XtAddCallback(flat, XmNvalueChangedCallback, toolbar_buttons_cb, (XtPointer)info);
00325     XtAddCallback(raised, XmNvalueChangedCallback, toolbar_buttons_cb, (XtPointer)info);
00326 }
00327 #endif /* 0 */
00328 
00329 
00330 Widget
00331 prefs_appearance(struct topic_info *info)
00332 {
00333     Widget form;
00334     Widget gui_frame, gui_label, gui_rowcol,
00335        gui_statusline, gui_toolbar, gui_pagelist, gui_scrollbars;
00336     Widget tips_frame, tips_label, tips_form, tips_statusline;
00337     Widget tips_popups, tips_delay_text, tips_delay_label1, tips_delay_label2;
00338     Widget match_frame, match_label, match_rowcol, match_inverted, match_boxed;
00339 #if 0
00340     Widget tb_buttons_frame, tb_buttons_label, tb_buttons_rowcol,
00341        tb_buttons_flat, tb_buttons_raised;
00342 #endif
00343     XmString str;
00344     char buf[LENGTH_OF_INT];
00345     Arg args[10];
00346     int n;
00347     
00348     form = XmCreateForm(info->right_form, "appearance_form", NULL, 0);
00349     h_attach_below(form, NULL);
00350 
00351     n = 0;
00352     XtSetArg(args[n], XmNmarginWidth, 8); n++;
00353     XtSetArg(args[n], XmNmarginHeight, 4); n++;
00354     gui_frame = XmCreateFrame(form, "gui_frame", args, n);
00355     h_attach_below(gui_frame, NULL);
00356     
00357     gui_label = XmCreateLabelGadget(gui_frame, "Window Configuration", &frame_title, 1);
00358     XtManageChild(gui_label);
00359 
00360     gui_rowcol = XmCreateRowColumn(gui_frame, "gui_rowcol", two_cols_fixed, XtNumber(two_cols_fixed));
00361     XtManageChild(gui_rowcol);
00362 
00363     gui_statusline = XmCreateToggleButtonGadget(gui_rowcol, Xdvi_GUI_STATUSLINE_STR, &n_of_many, 1);
00364     XmToggleButtonGadgetSetState(gui_statusline, resource.expert_mode & XPRT_SHOW_STATUSLINE ? True : False, False);
00365     XtManageChild(gui_statusline);
00366 
00367     gui_toolbar = XmCreateToggleButtonGadget(gui_rowcol, Xdvi_GUI_TOOLBAR_STR, &n_of_many, 1);
00368     XmToggleButtonGadgetSetState(gui_toolbar, resource.expert_mode & XPRT_SHOW_TOOLBAR ? True : False, False);
00369     XtManageChild(gui_toolbar);
00370     
00371     gui_pagelist = XmCreateToggleButtonGadget(gui_rowcol, Xdvi_GUI_PAGELIST_STR, &n_of_many, 1);
00372     XmToggleButtonGadgetSetState(gui_pagelist, resource.expert_mode & XPRT_SHOW_PAGELIST ? True : False, False);
00373     XtManageChild(gui_pagelist);
00374     
00375     gui_scrollbars = XmCreateToggleButtonGadget(gui_rowcol, Xdvi_GUI_SCROLLBARS_STR, &n_of_many, 1);
00376     XmToggleButtonGadgetSetState(gui_scrollbars, resource.expert_mode & XPRT_SHOW_SCROLLBARS ? True : False, False);
00377     XtManageChild(gui_scrollbars);
00378 
00379     XtAddCallback(gui_statusline, XmNvalueChangedCallback, gui_buttons_cb, (XtPointer)info);
00380     XtAddCallback(gui_toolbar, XmNvalueChangedCallback, gui_buttons_cb, (XtPointer)info);
00381     XtAddCallback(gui_pagelist, XmNvalueChangedCallback, gui_buttons_cb, (XtPointer)info);
00382     XtAddCallback(gui_scrollbars, XmNvalueChangedCallback, gui_buttons_cb, (XtPointer)info);
00383 
00384     n = 0;
00385     XtSetArg(args[n], XmNmarginWidth, 8); n++;
00386     XtSetArg(args[n], XmNmarginHeight, 4); n++;
00387     XtSetArg(args[n], XmNtopOffset, 10); n++;
00388     tips_frame = XmCreateFrame(form, "tips_frame", args, n);
00389     h_attach_below(tips_frame, gui_frame);
00390     
00391     tips_label = XmCreateLabelGadget(tips_frame, "Show Tooltips", &frame_title, 1);
00392     XtManageChild(tips_label);
00393     
00394     tips_form = XmCreateForm(tips_frame, "tips_form", NULL, 0);
00395     
00396     str = XmStringCreateLocalized("As Text in Statusline");
00397     tips_statusline = XtVaCreateManagedWidget(Xdvi_TIPS_STATUSLINE,
00398                                          xmToggleButtonGadgetClass, tips_form,
00399                                          XmNlabelString, str,
00400                                          XmNindicatorType, XmN_OF_MANY,
00401                                          XmNset, True,
00402                                          XmNtopAttachment, XmATTACH_FORM,
00403                                          XmNleftAttachment, XmATTACH_FORM,
00404                                          NULL);
00405     XmStringFree(str);
00406 
00407     str = XmStringCreateLocalized("As Popups");
00408     tips_popups = XtVaCreateManagedWidget(Xdvi_TIPS_POPUPS,
00409                                      xmToggleButtonGadgetClass, tips_form,
00410                                      XmNlabelString, str,
00411                                      XmNindicatorType, XmN_OF_MANY,
00412                                      XmNtopAttachment, XmATTACH_WIDGET,
00413                                      XmNtopWidget, tips_statusline,
00414                                      XmNleftAttachment, XmATTACH_FORM,
00415                                      NULL);
00416     XmStringFree(str);
00417 
00418     str = XmStringCreateLocalized("with");
00419     tips_delay_label1 = XtVaCreateManagedWidget(Xdvi_TIPS_DELAY_LABEL1,
00420                                           xmLabelGadgetClass, tips_form,
00421                                           XmNlabelString, tips_form,
00422                                           XmNlabelString, str,
00423                                           XmNtopAttachment, XmATTACH_WIDGET,
00424                                           XmNtopWidget, tips_statusline,
00425                                           XmNleftAttachment, XmATTACH_WIDGET,
00426                                           XmNleftWidget, tips_popups,
00427                                           XmNleftOffset, 0, /* no spacing to prev text */
00428                                           NULL);
00429     XmStringFree(str);
00430 
00431     SNPRINTF(buf, LENGTH_OF_INT, "%d", ABS(resource.tooltips_wait_period));
00432     
00433     tips_delay_text = XtVaCreateManagedWidget(Xdvi_TIPS_DELAY_TEXT,
00434                                          xmTextFieldWidgetClass, tips_form,
00435                                          XmNcolumns, 4,
00436                                          XmNtopAttachment, XmATTACH_WIDGET,
00437                                          XmNtopWidget, tips_statusline,
00438                                          XmNleftAttachment, XmATTACH_WIDGET,
00439                                          XmNleftWidget, tips_delay_label1,
00440                                          XmNvalue, buf,
00441                                          NULL);
00442 
00443     str = XmStringCreateLocalized("milliseconds delay");
00444     tips_delay_label2 = XtVaCreateManagedWidget(Xdvi_TIPS_DELAY_LABEL2,
00445                                           xmLabelGadgetClass, tips_form,
00446                                           XmNlabelString, str,
00447                                           XmNtopAttachment, XmATTACH_WIDGET,
00448                                           XmNtopWidget, tips_statusline,
00449                                           XmNleftAttachment, XmATTACH_WIDGET,
00450                                           XmNleftWidget, tips_delay_text,
00451                                           NULL);
00452 
00453     adjust_heights(tips_popups, tips_delay_label1, tips_delay_text, tips_delay_label2, NULL);
00454 
00455     XmToggleButtonGadgetSetState(tips_statusline, resource.tooltips_in_statusline, False);
00456     XmToggleButtonGadgetSetState(tips_popups, resource.show_tooltips, False);
00457 
00458     if (resource.toolbar_unusable) {
00459        XtSetSensitive(tips_frame, False);
00460     }
00461     else {
00462        XtSetSensitive(tips_delay_label1, resource.show_tooltips);
00463        XtSetSensitive(tips_delay_text, resource.show_tooltips);
00464        XtSetSensitive(tips_delay_label2, resource.show_tooltips);
00465     
00466        XtAddCallback(tips_statusline,  XmNvalueChangedCallback, tooltips_cb, (XtPointer)info);
00467        XtAddCallback(tips_popups,  XmNvalueChangedCallback, tooltips_cb, (XtPointer)info);
00468        XtAddCallback(tips_delay_text, XmNvalueChangedCallback, tooltips_cb, (XtPointer)info);
00469     }
00470 
00471 #if 0
00472     tb_buttons_frame = XmCreateFrame(form, "tb_buttons_frame", &v_off, 1);
00473     h_attach_below(tb_buttons_frame, tips_frame);
00474     
00475     tb_buttons_label = XmCreateLabelGadget(tb_buttons_frame, "Toolbar Buttons:", &frame_title, 1);
00476     XtManageChild(tb_buttons_label);
00477 
00478     tb_buttons_rowcol = XmCreateRowColumn(tb_buttons_frame, "tb_buttons_rowcol", two_cols, XtNumber(two_cols));
00479     XtManageChild(tb_buttons_rowcol);
00480     
00481     tb_buttons_raised = XmCreateToggleButtonGadget(tb_buttons_rowcol, "Raised", &one_of_many, 1);
00482     XtManageChild(tb_buttons_raised);
00483 
00484     tb_buttons_flat = XmCreateToggleButtonGadget(tb_buttons_rowcol, "Flat", &one_of_many, 1);
00485     XtManageChild(tb_buttons_flat);
00486     toolbar_buttons_init((XtPointer)info, tb_buttons_raised, tb_buttons_flat);
00487 #endif /* 0 */
00488 
00489     n = 0;
00490     XtSetArg(args[n], XmNmarginWidth, 8); n++;
00491     XtSetArg(args[n], XmNmarginHeight, 4); n++;
00492     XtSetArg(args[n], XmNtopOffset, 10); n++;
00493     match_frame = XmCreateFrame(form, "match_frame", args, n);
00494     XtVaSetValues(match_frame,
00495                 XmNtopAttachment, XmATTACH_WIDGET,
00496                 XmNtopWidget, tips_frame,
00497                 XmNleftAttachment, XmATTACH_FORM,
00498                 XmNrightAttachment, XmATTACH_FORM,
00499                 XmNbottomAttachment, XmATTACH_FORM,
00500                 NULL);
00501 
00502     match_label = XmCreateLabelGadget(match_frame, "String Matches are shown:", &frame_title, 1);
00503     XtManageChild(match_label);
00504 
00505     match_rowcol = XmCreateRowColumn(match_frame, "tb_buttons_rowcol", two_cols, XtNumber(two_cols));
00506     XtManageChild(match_rowcol);
00507     
00508     match_inverted = XmCreateToggleButtonGadget(match_rowcol, Xdvi_MATCH_INVERTED_STR, &one_of_many, 1);
00509     XtManageChild(match_inverted);
00510 
00511     match_boxed = XmCreateToggleButtonGadget(match_rowcol, Xdvi_MATCH_BOXED_STR, &one_of_many, 1);
00512     XtManageChild(match_boxed);
00513 
00514     XmToggleButtonGadgetSetState(match_inverted, resource.match_highlight_inverted, False);
00515     XmToggleButtonGadgetSetState(match_boxed, !resource.match_highlight_inverted, False);
00516 
00517     XtAddCallback(match_inverted, XmNvalueChangedCallback, match_cb, (XtPointer)info);
00518     XtAddCallback(match_boxed, XmNvalueChangedCallback, match_cb, (XtPointer)info);
00519 
00520     /* manage children (order shouldn't matter, since children are already managed, but ...) */
00521     XtManageChild(gui_frame);
00522     
00523     XtManageChild(tips_form);
00524     XtManageChild(tips_frame);
00525 
00526 #if 0
00527     XtManageChild(tb_buttons_frame);
00528 #endif
00529     
00530     XtManageChild(match_frame);
00531 
00532     XtManageChild(form);
00533     
00534     return form;
00535 }
00536 
00537 #else
00538 /* silence `empty compilation unit' warnings */
00539 static void bar(void); static void foo() { bar(); } static void bar(void) { foo(); }
00540 #endif /* MOTIF */