Prepare the way for resizable tabfolders if the xforms version is

up to the task.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6749 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-04-09 21:34:50 +00:00
parent 46d403a3c8
commit e93988314d
8 changed files with 106 additions and 28 deletions

View File

@ -1,3 +1,13 @@
2003-04-09 Angus Leeming <leeming@lyx.org>
* FormAboutlyx.C:
* FormDocument.C:
* FormGraphics.C:
* FormPreferences.C:
* FormTabular.C:
* forms/form_preferences.fd: prepare the way for resizable
tabfolders if the xforms version is up to the task.
2003-04-09 John Levon <levon@movementarian.org> 2003-04-09 John Levon <levon@movementarian.org>
* Toolbar_pimpl.C: * Toolbar_pimpl.C:

View File

@ -23,11 +23,21 @@
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
namespace {
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
bool const scalableTabfolders = false;
#else
bool const scalableTabfolders = true;
#endif
} // namespace anon
typedef FormController<ControlAboutlyx, FormView<FD_aboutlyx> > base_class; typedef FormController<ControlAboutlyx, FormView<FD_aboutlyx> > base_class;
FormAboutlyx::FormAboutlyx(Dialog & parent) FormAboutlyx::FormAboutlyx(Dialog & parent)
: base_class(parent, _("About LyX"), false) : base_class(parent, _("About LyX"), scalableTabfolders)
{} {}
@ -63,7 +73,11 @@ void FormAboutlyx::build()
fl_add_browser_line(license_->browser_license, cs.str().c_str()); fl_add_browser_line(license_->browser_license, cs.str().c_str());
// stack tabs // Enable the tabfolder to be rescaled correctly.
if (scalableTabfolders)
fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
// Stack tabs
fl_addto_tabfolder(dialog_->tabfolder, _("Version"), fl_addto_tabfolder(dialog_->tabfolder, _("Version"),
version_->form); version_->form);
fl_addto_tabfolder(dialog_->tabfolder, _("Credits"), fl_addto_tabfolder(dialog_->tabfolder, _("Credits"),
@ -71,9 +85,6 @@ void FormAboutlyx::build()
fl_addto_tabfolder(dialog_->tabfolder, _("License"), fl_addto_tabfolder(dialog_->tabfolder, _("License"),
license_->form); license_->form);
// work-around xforms bug re update of folder->x, folder->y coords.
setPrehandler(dialog_->tabfolder);
// Manage the cancel/close button // Manage the cancel/close button
bcview().setCancel(dialog_->button_close); bcview().setCancel(dialog_->button_close);
} }

View File

@ -48,10 +48,21 @@ using std::bind2nd;
using std::vector; using std::vector;
namespace {
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
bool const scalableTabfolders = false;
#else
bool const scalableTabfolders = true;
#endif
} // namespace anon
typedef FormCB<ControlDocument, FormDB<FD_document> > base_class; typedef FormCB<ControlDocument, FormDB<FD_document> > base_class;
FormDocument::FormDocument() FormDocument::FormDocument()
: base_class(_("Document Layout"), false), : base_class(_("Document Layout"), scalableTabfolders),
ActCell(0), Confirmed(0), ActCell(0), Confirmed(0),
current_bullet_panel(0), current_bullet_depth(0), fbullet(0) current_bullet_panel(0), current_bullet_depth(0), fbullet(0)
{} {}
@ -322,6 +333,11 @@ void FormDocument::build()
fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6, fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6,
bmtablefile.c_str()); bmtablefile.c_str());
// Enable the tabfolder to be rescaled correctly.
if (scalableTabfolders)
fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
// Stack tabs
fl_addto_tabfolder(dialog_->tabfolder,_("Document"), fl_addto_tabfolder(dialog_->tabfolder,_("Document"),
class_->form); class_->form);
fl_addto_tabfolder(dialog_->tabfolder,_("Paper"), fl_addto_tabfolder(dialog_->tabfolder,_("Paper"),
@ -333,9 +349,6 @@ void FormDocument::build()
fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets"), fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets"),
bullets_->form); bullets_->form);
// work-around xforms bug re update of folder->x, folder->y coords.
setPrehandler(dialog_->tabfolder);
if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) { if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) {
lyxerr << _("Your version of libXpm is older than 4.7.\n" lyxerr << _("Your version of libXpm is older than 4.7.\n"
"The `bullet' tab of the document dialog " "The `bullet' tab of the document dialog "

View File

@ -52,13 +52,19 @@ int const FILENAME_MAXCHARS = 1024;
string defaultUnit("cm"); string defaultUnit("cm");
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
bool const scalableTabfolders = false;
#else
bool const scalableTabfolders = true;
#endif
} // namespace anon } // namespace anon
typedef FormController<ControlGraphics, FormView<FD_graphics> > base_class; typedef FormController<ControlGraphics, FormView<FD_graphics> > base_class;
FormGraphics::FormGraphics(Dialog & parent) FormGraphics::FormGraphics(Dialog & parent)
: base_class(parent, _("Graphics"), false) : base_class(parent, _("Graphics"), scalableTabfolders)
{} {}
@ -257,14 +263,15 @@ void FormGraphics::build()
"graphicx-package and not mentioned in the gui's tabfolders."); "graphicx-package and not mentioned in the gui's tabfolders.");
tooltips().init(extra_->input_special, str); tooltips().init(extra_->input_special, str);
// add the different tabfolders // Enable the tabfolder to be rescaled correctly.
if (scalableTabfolders)
fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
// Stack tabs
fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form); fl_addto_tabfolder(dialog_->tabfolder, _("File"), file_->form);
fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form); fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
fl_addto_tabfolder(dialog_->tabfolder, _("Extra"), extra_->form); fl_addto_tabfolder(dialog_->tabfolder, _("Extra"), extra_->form);
// work-around xforms bug re update of folder->x, folder->y coords.
setPrehandler(dialog_->tabfolder);
// set the right default unit // set the right default unit
switch (lyxrc.default_papersize) { switch (lyxrc.default_papersize) {
case BufferParams::PAPER_DEFAULT: break; case BufferParams::PAPER_DEFAULT: break;

View File

@ -101,13 +101,20 @@ string const X11hexname(RGBColor const & col)
return STRCONV(ostr.str()); return STRCONV(ostr.str());
} }
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
bool const scalableTabfolders = false;
#else
bool const scalableTabfolders = true;
#endif
} // namespace anon } // namespace anon
typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class; typedef FormCB<ControlPrefs, FormDB<FD_preferences> > base_class;
FormPreferences::FormPreferences() FormPreferences::FormPreferences()
: base_class(_("Preferences"), false), : base_class(_("Preferences"), scalableTabfolders),
colors_(*this), converters_(*this), inputs_misc_(*this), colors_(*this), converters_(*this), inputs_misc_(*this),
formats_(*this), interface_(*this), language_(*this), formats_(*this), interface_(*this), language_(*this),
lnf_misc_(*this), identity_(*this), outputs_misc_(*this), lnf_misc_(*this), identity_(*this), outputs_misc_(*this),
@ -196,6 +203,28 @@ void FormPreferences::build()
screen_fonts_.build(); screen_fonts_.build();
spelloptions_.build(); spelloptions_.build();
// Enable the tabfolders to be rescaled correctly.
if (scalableTabfolders) {
FL_OBJECT * folder = dialog_->tabfolder_prefs;
fl_set_tabfolder_autofit(folder, FL_FIT);
folder = look_n_feel_tab_->tabfolder_inner;
fl_set_tabfolder_autofit(folder, FL_FIT);
folder = converters_tab_->tabfolder_inner;
fl_set_tabfolder_autofit(folder, FL_FIT);
folder = inputs_tab_->tabfolder_inner;
fl_set_tabfolder_autofit(folder, FL_FIT);
folder = outputs_tab_->tabfolder_inner;
fl_set_tabfolder_autofit(folder, FL_FIT);
folder = lang_opts_tab_->tabfolder_inner;
fl_set_tabfolder_autofit(folder, FL_FIT);
}
// Stack tabs
// Now add them to the tabfolder // Now add them to the tabfolder
fl_addto_tabfolder(dialog_->tabfolder_prefs, fl_addto_tabfolder(dialog_->tabfolder_prefs,
_("Look & Feel"), _("Look & Feel"),
@ -263,13 +292,6 @@ void FormPreferences::build()
fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner, fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
_("Language"), _("Language"),
language_.dialog()->form); language_.dialog()->form);
// work-around xforms bug re update of folder->x, folder->y coords.
setPrehandler(look_n_feel_tab_->tabfolder_inner);
setPrehandler(converters_tab_->tabfolder_inner);
setPrehandler(inputs_tab_->tabfolder_inner);
setPrehandler(outputs_tab_->tabfolder_inner);
setPrehandler(lang_opts_tab_->tabfolder_inner);
} }

View File

@ -35,10 +35,21 @@ using std::vector;
using std::bind2nd; using std::bind2nd;
namespace {
#if FL_VERSION == 0 || (FL_REVISION == 0 && FL_FIXLEVEL < 2)
bool const scalableTabfolders = false;
#else
bool const scalableTabfolders = true;
#endif
} // namespace anon
typedef FormController<ControlTabular, FormView<FD_tabular> > base_class; typedef FormController<ControlTabular, FormView<FD_tabular> > base_class;
FormTabular::FormTabular(Dialog & parent) FormTabular::FormTabular(Dialog & parent)
: base_class(parent, _("Edit table settings")), : base_class(parent, _("Edit table settings"), scalableTabfolders),
closing_(false), actCell_(-1) closing_(false), actCell_(-1)
{ {
} }
@ -111,6 +122,11 @@ void FormTabular::build()
longtable_options_.reset(build_tabular_longtable(this)); longtable_options_.reset(build_tabular_longtable(this));
// Enable the tabfolder to be rescaled correctly.
if (scalableTabfolders)
fl_set_tabfolder_autofit(dialog_->tabfolder, FL_FIT);
// Stack tabs
fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"), fl_addto_tabfolder(dialog_->tabfolder, _("Tabular"),
tabular_options_->form); tabular_options_->form);
fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"), fl_addto_tabfolder(dialog_->tabfolder, _("Column/Row"),
@ -120,9 +136,6 @@ void FormTabular::build()
fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"), fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
longtable_options_->form); longtable_options_->form);
// work-around xforms bug re update of folder->x, folder->y coords.
setPrehandler(dialog_->tabfolder);
// FIXME: addReadOnly everything // FIXME: addReadOnly everything
} }

View File

@ -43,7 +43,7 @@ size: FL_NORMAL_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: label:
shortcut: shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: tabfolder_prefs name: tabfolder_prefs
callback: callback:
@ -193,7 +193,7 @@ size: FL_DEFAULT_SIZE
lcol: FL_BLACK lcol: FL_BLACK
label: label:
shortcut: shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity gravity: FL_NoGravity FL_NoGravity
name: tabfolder_inner name: tabfolder_inner
callback: callback:

View File

@ -33,11 +33,13 @@ using std::pair;
using std::vector; using std::vector;
using std::make_pair; using std::make_pair;
bool isActive(FL_OBJECT * ob) bool isActive(FL_OBJECT * ob)
{ {
return ob && ob->active > 0; return ob && ob->active > 0;
} }
std::pair<string, string> parse_shortcut(string const & str) std::pair<string, string> parse_shortcut(string const & str)
{ {
string::size_type i = str.find_first_of("&"); string::size_type i = str.find_first_of("&");