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>
* FormBibtex.C:

View File

@ -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),"")) {

View File

@ -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();

View File

@ -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