From bdd235120be55eb0372dfe3a52045b32942406fe Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 20 Aug 2001 15:44:24 +0000 Subject: [PATCH] Get the browse buttons working... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2560 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/xforms/ChangeLog | 5 ++++ src/frontends/xforms/FormBibtex.C | 36 +++++++++++++---------- src/frontends/xforms/form_bibtex.C | 16 +++++++--- src/frontends/xforms/forms/form_bibtex.fd | 21 ++++++------- 4 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 7fee6fb4f3..9e37df1c58 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2001-08-20 Angus Leeming + + * FormBibtex.C: + * forms/form_bibtex.fd: get the browse buttons working as they should. + 2001-08-20 Herbert Voss * FormBibtex.C: diff --git a/src/frontends/xforms/FormBibtex.C b/src/frontends/xforms/FormBibtex.C index 99b8640363..95806be52b 100644 --- a/src/frontends/xforms/FormBibtex.C +++ b/src/frontends/xforms/FormBibtex.C @@ -53,36 +53,40 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long) { if (ob == dialog_->database_browse) { string const in_name = fl_get_input(dialog_->database); - fl_freeze_form(form()); string out_name = controller().Browse(in_name, "Select Database", "*.bib| BibTeX Databases (*.bib)"); - if (suffixIs(out_name,".bib")) { - // to prevent names like xxxbib.bib - // latex needs it without suffix - out_name = ChangeExtension(out_name,""); - } + if (!out_name.empty()) { + if (suffixIs(out_name,".bib")) { + // to prevent names like xxxbib.bib + // latex needs it without suffix + out_name = ChangeExtension(out_name,""); + } - fl_set_input(dialog_->database, out_name.c_str()); - fl_unfreeze_form(form()); + fl_freeze_form(form()); + fl_set_input(dialog_->database, out_name.c_str()); + fl_unfreeze_form(form()); + } } if (ob == dialog_->style_browse) { string const in_name = fl_get_input(dialog_->style); - fl_freeze_form(form()); string out_name = controller().Browse(in_name, "Select BibTeX-Style", "*.bst| BibTeX Styles (*.bst)"); - if (suffixIs(out_name,".bst")) { - // to prevent names like xxxbib.bib - // name for display only - out_name = OnlyFilename(ChangeExtension(out_name,"")); - } + if (!out_name.empty()) { + if (suffixIs(out_name,".bst")) { + // to prevent names like xxxbib.bib + // name for display only + out_name = OnlyFilename(ChangeExtension(out_name,"")); + } - fl_set_input(dialog_->style, out_name.c_str()); - fl_unfreeze_form(form()); + fl_freeze_form(form()); + fl_set_input(dialog_->style, out_name.c_str()); + fl_unfreeze_form(form()); + } } if (!compare(fl_get_input(dialog_->database),"")) { diff --git a/src/frontends/xforms/form_bibtex.C b/src/frontends/xforms/form_bibtex.C index 0406be916c..33e207e234 100644 --- a/src/frontends/xforms/form_bibtex.C +++ b/src/frontends/xforms/form_bibtex.C @@ -49,10 +49,18 @@ FD_form_bibtex * FormBibtex::build_bibtex() } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->database_browse = obj = fl_add_button(FL_PUSH_BUTTON, 360, 10, 80, 30, _("Browse")); - fl_set_button_shortcut(obj, _("B"), 1); - fdui->style_browse = obj = fl_add_button(FL_PUSH_BUTTON, 360, 50, 80, 30, _("Browse")); - fl_set_button_shortcut(obj, _("l"), 1); + { + char const * const dummy = N_("Browse...|#B"); + fdui->database_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 360, 10, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); + { + char const * const dummy = N_("Browse...|#r"); + fdui->style_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 360, 50, 80, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fdui->radio_bibtotoc = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 90, 90, 30, 30, _("Add bibliography to TOC")); fl_set_button_shortcut(obj, _("T"), 1); fl_end_form(); diff --git a/src/frontends/xforms/forms/form_bibtex.fd b/src/frontends/xforms/forms/form_bibtex.fd index 9ac6123248..f04b2d7496 100644 --- a/src/frontends/xforms/forms/form_bibtex.fd +++ b/src/frontends/xforms/forms/form_bibtex.fd @@ -5,6 +5,7 @@ Internal Form Definition File Number of forms: 1 Unit of measure: FL_COORD_PIXEL +SnapGrid: 1 =============== FORM =============== Name: form_bibtex @@ -104,7 +105,7 @@ argument: 0 -------------------- class: FL_BUTTON -type: PUSH_BUTTON +type: NORMAL_BUTTON box: 360 10 80 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 @@ -112,17 +113,17 @@ alignment: FL_ALIGN_CENTER style: FL_NORMAL_STYLE size: FL_DEFAULT_SIZE lcol: FL_BLACK -label: Browse -shortcut: B +label: Browse...|#B +shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: database_browse -callback: -argument: database +callback: C_FormBaseInputCB +argument: 0 -------------------- class: FL_BUTTON -type: PUSH_BUTTON +type: NORMAL_BUTTON box: 360 50 80 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 @@ -130,13 +131,13 @@ alignment: FL_ALIGN_CENTER style: FL_NORMAL_STYLE size: FL_DEFAULT_SIZE lcol: FL_BLACK -label: Browse -shortcut: l +label: Browse...|#r +shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: style_browse -callback: -argument: +callback: C_FormBaseInputCB +argument: 0 -------------------- class: FL_CHECKBUTTON