Get the browse buttons working...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2560 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-08-20 15:44:24 +00:00
parent aea21e8cac
commit bdd235120b
4 changed files with 48 additions and 30 deletions

View File

@ -1,3 +1,8 @@
2001-08-20 Angus Leeming <a.leeming@ic.ac.uk>
* FormBibtex.C:
* forms/form_bibtex.fd: get the browse buttons working as they should.
2001-08-20 Herbert Voss <voss@perce.de> 2001-08-20 Herbert Voss <voss@perce.de>
* FormBibtex.C: * FormBibtex.C:

View File

@ -53,36 +53,40 @@ ButtonPolicy::SMInput FormBibtex::input(FL_OBJECT * ob, long)
{ {
if (ob == dialog_->database_browse) { if (ob == dialog_->database_browse) {
string const in_name = fl_get_input(dialog_->database); string const in_name = fl_get_input(dialog_->database);
fl_freeze_form(form());
string out_name = string out_name =
controller().Browse(in_name, controller().Browse(in_name,
"Select Database", "Select Database",
"*.bib| BibTeX Databases (*.bib)"); "*.bib| BibTeX Databases (*.bib)");
if (suffixIs(out_name,".bib")) { if (!out_name.empty()) {
// to prevent names like xxxbib.bib if (suffixIs(out_name,".bib")) {
// latex needs it without suffix // to prevent names like xxxbib.bib
out_name = ChangeExtension(out_name,""); // latex needs it without suffix
} out_name = ChangeExtension(out_name,"");
}
fl_set_input(dialog_->database, out_name.c_str()); fl_freeze_form(form());
fl_unfreeze_form(form()); fl_set_input(dialog_->database, out_name.c_str());
fl_unfreeze_form(form());
}
} }
if (ob == dialog_->style_browse) { if (ob == dialog_->style_browse) {
string const in_name = fl_get_input(dialog_->style); string const in_name = fl_get_input(dialog_->style);
fl_freeze_form(form());
string out_name = string out_name =
controller().Browse(in_name, controller().Browse(in_name,
"Select BibTeX-Style", "Select BibTeX-Style",
"*.bst| BibTeX Styles (*.bst)"); "*.bst| BibTeX Styles (*.bst)");
if (suffixIs(out_name,".bst")) { if (!out_name.empty()) {
// to prevent names like xxxbib.bib if (suffixIs(out_name,".bst")) {
// name for display only // to prevent names like xxxbib.bib
out_name = OnlyFilename(ChangeExtension(out_name,"")); // name for display only
} out_name = OnlyFilename(ChangeExtension(out_name,""));
}
fl_set_input(dialog_->style, out_name.c_str()); fl_freeze_form(form());
fl_unfreeze_form(form()); fl_set_input(dialog_->style, out_name.c_str());
fl_unfreeze_form(form());
}
} }
if (!compare(fl_get_input(dialog_->database),"")) { if (!compare(fl_get_input(dialog_->database),"")) {

View File

@ -49,10 +49,18 @@ FD_form_bibtex * FormBibtex::build_bibtex()
} }
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0); 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); char const * const dummy = N_("Browse...|#B");
fdui->style_browse = obj = fl_add_button(FL_PUSH_BUTTON, 360, 50, 80, 30, _("Browse")); fdui->database_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 360, 10, 80, 30, idex(_(dummy)));
fl_set_button_shortcut(obj, _("l"), 1); 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")); 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_set_button_shortcut(obj, _("T"), 1);
fl_end_form(); fl_end_form();

View File

@ -5,6 +5,7 @@ Internal Form Definition File
Number of forms: 1 Number of forms: 1
Unit of measure: FL_COORD_PIXEL Unit of measure: FL_COORD_PIXEL
SnapGrid: 1
=============== FORM =============== =============== FORM ===============
Name: form_bibtex Name: form_bibtex
@ -104,7 +105,7 @@ argument: 0
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
type: PUSH_BUTTON type: NORMAL_BUTTON
box: 360 10 80 30 box: 360 10 80 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1 colors: FL_COL1 FL_COL1
@ -112,17 +113,17 @@ alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE size: FL_DEFAULT_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Browse label: Browse...|#B
shortcut: B shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: database_browse name: database_browse
callback: callback: C_FormBaseInputCB
argument: database argument: 0
-------------------- --------------------
class: FL_BUTTON class: FL_BUTTON
type: PUSH_BUTTON type: NORMAL_BUTTON
box: 360 50 80 30 box: 360 50 80 30
boxtype: FL_UP_BOX boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1 colors: FL_COL1 FL_COL1
@ -130,13 +131,13 @@ alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE size: FL_DEFAULT_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: Browse label: Browse...|#r
shortcut: l shortcut:
resize: FL_RESIZE_ALL resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: style_browse name: style_browse
callback: callback: C_FormBaseInputCB
argument: argument: 0
-------------------- --------------------
class: FL_CHECKBUTTON class: FL_CHECKBUTTON