From 8effd3eec4f9f143572875416ed8815e2a26cd12 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 20 Oct 2000 09:50:09 +0000 Subject: [PATCH] The forms resize patch, and small updates git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1142 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 19 +++++++++++++- NEWS | 16 ++++++------ lib/CREDITS | 7 ++++++ lib/ui/default.ui | 2 +- src/frontends/xforms/FormBase.C | 15 +++++++++-- src/frontends/xforms/FormBase.h | 29 ++++++++++----------- src/frontends/xforms/FormCitation.C | 30 ++++++++++++---------- src/frontends/xforms/FormCitation.h | 2 ++ src/frontends/xforms/FormCopyright.C | 4 +++ src/frontends/xforms/FormDocument.C | 4 +++ src/frontends/xforms/FormError.C | 9 +++---- src/frontends/xforms/FormIndex.C | 18 +++++++------ src/frontends/xforms/FormIndex.h | 6 ++--- src/frontends/xforms/FormInset.C | 1 + src/frontends/xforms/FormInset.h | 7 ++---- src/frontends/xforms/FormParagraph.C | 4 +++ src/frontends/xforms/FormPreferences.C | 15 +++-------- src/frontends/xforms/FormPreferences.h | 6 ----- src/frontends/xforms/FormPrint.C | 13 +++------- src/frontends/xforms/FormPrint.h | 2 -- src/frontends/xforms/FormRef.C | 35 ++++++++++++++------------ src/frontends/xforms/FormRef.h | 2 ++ src/frontends/xforms/FormToc.C | 5 ++++ src/frontends/xforms/FormUrl.C | 19 ++++++++------ src/frontends/xforms/FormUrl.h | 6 ++--- 25 files changed, 158 insertions(+), 118 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2593aa0ef..f0a9b7e52b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ +2000-10-19 Angus Leeming + + * src/frontends/xforms/FormBase.[Ch]: + * src/frontends/xforms/FormXXX.[Ch] where XXX is a FormBase daughter: + read the xforms manual to discover that fl_set_form_minsize()/maxsize() + work only for the next call to fl_show_form(). The correct place to set + them, therefore is in connect() immediately BEFORE fl_show_form(). Now + done. FormBase also stores minw_, minh_ itself. All dialogs derived + from FormBase have the minimum size set; no more stupid crashes with + tabbed folders etc. + +2000-10-20 Jean-Marc Lasgouttes + + * lib/ui/default.ui: fix shortcut for Insert->Include File. + 2000-10-19 Jean-Marc Lasgouttes + * lib/CREDITS: add Andre' Poenitz and Kornelia Pietsch + * src/support/lyxlib.h: changed second argument of mkdir to unsigned long int (unsigned int would probably have been enough, but...). Removed header. @@ -1469,7 +1486,7 @@ 2000-09-27 Lars Gullik Bjønnes * src/insets/insettext.C (Ascii): return numer of '\n' in the text - outputed to the ostream. + output to the ostream. * several files: fixed types based on warnings from cxx diff --git a/NEWS b/NEWS index 496f01181a..8d64d63a06 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ What's new in LyX version 1.1.6? -------------------------------- -As for all of the 1.1.x versions of LyX, this release contains a lot +As with all of the 1.1.x versions of LyX, this release contains a lot of new code: in particular, half of the changes described in the ChangeLog (which dates back to the 1.1.0 release) describe changes in LyX 1.1.6! @@ -12,7 +12,7 @@ GUI-independent branch of development has been merged, as well as code from the older development version: - many popups have been rewritten to use the new GUI-I scheme. In the - process they have gotten a nice cleanup: the Document and Paragraph + process they have received a nice cleanup: the Document and Paragraph popups now contain in one single place what was previously scattered in many places. Similarly, the citation and cross reference popups have been overhauled. @@ -20,26 +20,26 @@ from the older development version: - LyX now has a Preference popup where you can change most of your lyxrc settings [Allan, details?] -- The menus can now be defined in a text file, and they automatically +- the menus can now be defined in a text file, and they automatically display the keyboard bindings associated with commands. - it is now possible to provide your own icons for the toolbar. - last but not least, work has begun on a KDE and a Gnome frontend for LyX. They are not officially supported for this version, but this - can give you an idea of what is happening. + will give you an idea of what is happening. Other major changes in 1.1.6 include: - the table support has been completely rewritten. It is now a modular - object (inset) which owns for each cell a (also) newly written text + object (inset), each cell of which owns a (also) newly written text inset. This now permits automatic text-wrap inside a tabular cell (if you define a width), multiparagraph mode AND setting of layouts for the paragraphs (lists inside a tabular cell!). Last but - not least, a wide tabular now scroll automatically so that all of it + not least, a wide tabular now scrolls automatically so that all of it is visible without the need to enlarge the window! - While there are yet no other new features, they will be now MUCH + While there are as yet no other new features, they will be now MUCH easier to add. It may be that because of being "young" code some features may not work right now, but at least it is much better than before. @@ -60,7 +60,7 @@ Other major changes in 1.1.6 include: - LyX can do command line exports without opening any GUI components. -- The multilingual support was improved. It is now possible to use in a +- The multilingual support has been improved. It is now possible to use in a document languages with different encodings, e.g. German (iso8859-1) and Czech (iso8859-2). Such a document can be viewed on screen using an iso10646-1 (Unicode) font. However, it is (currently) not possible to diff --git a/lib/CREDITS b/lib/CREDITS index 45196a7247..12061c5078 100644 --- a/lib/CREDITS +++ b/lib/CREDITS @@ -136,6 +136,13 @@ @iE-mail: sp2joap1@ida.his.se po-file for Swedish, a tool for picking shortcuts, bug reports and hacking at random +@bKornelia Pietsch +@iE-mail: pietsch@mathematik.tu-chemnitz.de + provided siamltex document class +@bAndré Poenitz +@iE-mail: poenitz@HTWM.De + --export and --import command line options + file io with streams @bAlkis Polyzotis Keymap work. @bBernhard Psaier diff --git a/lib/ui/default.ui b/lib/ui/default.ui index 74ae9a6796..1da80926aa 100644 --- a/lib/ui/default.ui +++ b/lib/ui/default.ui @@ -178,7 +178,7 @@ Menuset Item "Figure...|g" "figure-insert" Item "Tabular...|T" "dialog-tabular-insert" Separator - Item "Include File...|I" "buffer-child-insert" + Item "Include File...|c" "buffer-child-insert" Submenu "Import ascii file|a" "insert_ascii" Item "Insert LyX file...|X" "file-insert" Item "Insert external material...|e" "external-insert" diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index b0ebbc3f18..deb7168a0d 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -32,7 +32,8 @@ C_GENERICCB(FormBase, RestoreCB) FormBase::FormBase(LyXView * lv, Dialogs * d, string const & t, ButtonPolicy * bp, char const * close, char const * cancel) - : lv_(lv), bc_(bp, cancel, close), d_(d), h_(0), title(t), bp_(bp) + : lv_(lv), bc_(bp, cancel, close), d_(d), h_(0), title(t), bp_(bp), + minw_(0), minh_(0) {} @@ -42,6 +43,12 @@ FormBase::~FormBase() } +void FormBase::connect() +{ + fl_set_form_minsize( form(), minw_, minh_ ); +} + + void FormBase::show() { if (!form()) { @@ -57,11 +64,13 @@ void FormBase::show() if (form()->visible) { fl_raise_form(form()); } else { + // calls to fl_set_form_minsize/maxsize apply only to the next + // fl_show_form(), so connect() comes first. + connect(); fl_show_form(form(), FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, title.c_str()); - connect(); } } @@ -137,6 +146,7 @@ FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t, void FormBaseBI::connect() { h_ = d_->hideAll.connect(slot(this, &FormBaseBI::hide)); + FormBase::connect(); } @@ -160,6 +170,7 @@ void FormBaseBD::connect() connect(slot(this, &FormBaseBD::update)); h_ = d_->hideBufferDependent. connect(slot(this, &FormBaseBD::hide)); + FormBase::connect(); } diff --git a/src/frontends/xforms/FormBase.h b/src/frontends/xforms/FormBase.h index 87f37fd1e5..26febe08f2 100644 --- a/src/frontends/xforms/FormBase.h +++ b/src/frontends/xforms/FormBase.h @@ -33,14 +33,6 @@ class LyXView; */ class FormBase : public DialogBase, public noncopyable { public: - /** Constructor. - #FormBase(lv, d, _("DialogName"), BUFFER_DEPENDENT, new ButtonPolicy)# - */ - FormBase(LyXView *, Dialogs *, string const &, - ButtonPolicy *, char const *, char const *); - /// - virtual ~FormBase(); - /// Callback functions static int WMHideCB(FL_FORM *, void *); /// @@ -55,6 +47,14 @@ public: static void RestoreCB(FL_OBJECT *, long); protected: // methods + /** Constructor. + #FormBase(lv, d, _("DialogName"), BUFFER_DEPENDENT, new ButtonPolicy)# + */ + FormBase(LyXView *, Dialogs *, string const &, + ButtonPolicy *, char const *, char const *); + /// + virtual ~FormBase(); + /// Create the dialog if necessary, update it and display it. void show(); /// Hide the dialog. @@ -62,7 +62,7 @@ protected: // methods /// bool indicates if a buffer switch took place virtual void update(bool = false) {} /// Connect signals. Also perform any necessary initialisation. - virtual void connect() = 0; + virtual void connect(); /// Disconnect signals. Also perform any necessary housekeeping. virtual void disconnect() = 0; /// Build the dialog @@ -91,7 +91,6 @@ protected: // methods /// Pointer to the actual instantiation of xform's form virtual FL_FORM * form() const = 0; -protected: // data /** Which LyXFunc do we use? We could modify Dialogs to have a visible LyXFunc* instead and save a couple of bytes per dialog. @@ -107,6 +106,10 @@ protected: // data string title; /// ButtonPolicy * bp_; + /// Overcome a dumb xforms sizing bug + mutable int minw_; + /// + mutable int minh_; }; @@ -115,14 +118,13 @@ protected: // data an update() function which is also supported by restore(). */ class FormBaseBI : public FormBase { -public: +protected: /// Constructor FormBaseBI(LyXView *, Dialogs *, string const &, ButtonPolicy * bp = new OkApplyCancelPolicy, char const * close = N_("Close"), char const * cancel = N_("Cancel")); -protected: /// Connect signals virtual void connect(); /// Disconnect signals @@ -133,14 +135,13 @@ protected: /** This class is an XForms GUI base class for Buffer Dependent dialogs */ class FormBaseBD : public FormBase { -public: +protected: /// Constructor FormBaseBD(LyXView *, Dialogs *, string const &, ButtonPolicy * bp = new OkApplyCancelReadOnlyPolicy, char const * close = N_("Close"), char const * cancel = N_("Cancel")); -protected: /// Connect signals virtual void connect(); /// Disconnect signals diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index a79c6772b5..d304045288 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -34,7 +34,6 @@ using std::max; using std::min; using std::find; -static int min_wform; FormCitation::FormCitation(LyXView * lv, Dialogs * d) : FormCommand(lv, d, _("Citation")), dialog_(0) @@ -60,6 +59,13 @@ FL_FORM * FormCitation::form() const } +void FormCitation::connect() +{ + fl_set_form_maxsize( dialog_->form, 3*minw_, minh_ ); + FormCommand::connect(); +} + + void FormCitation::disconnect() { citekeys.clear(); @@ -73,7 +79,10 @@ void FormCitation::disconnect() void FormCitation::build() { dialog_ = build_citation(); - min_wform = dialog_->form->w; + + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; } @@ -223,25 +232,20 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const static int const htext = dialog_->textAftr->h; static int const hok = dialog_->button_ok->h; - int const wform = dialog_->form->w; int hform = dh1 + hbrsr + dh1; if ( bibPresent ) hform += hinfo + dh1; if ( natbib ) hform += hstyle + dh1 + htext + dh2; hform += htext + dh1 + hok + dh2; - bool const sizeSet = ( hform != dialog_->form->h ); - if ( sizeSet ) fl_set_form_size( dialog_->form, wform, hform ); - - // No vertical resizing is allowed - // min_wform set in build() - fl_set_form_minsize( dialog_->form, min_wform, hform ); - fl_set_form_maxsize( dialog_->form, 3*min_wform, hform ); - - if ( !sizeSet ) return; + if ( hform != minh_ ) { + minh_ = hform; + fl_set_form_size( dialog_->form, minw_, minh_ ); + } else + return; int x = 0; int y = 0; - fl_set_object_geometry( dialog_->box, x, y, wform, hform ); + fl_set_object_geometry( dialog_->box, x, y, minw_, minh_ ); x = dialog_->citeBrsr->x; y += dh1; diff --git a/src/frontends/xforms/FormCitation.h b/src/frontends/xforms/FormCitation.h index ca49a7973a..a8ac4cfb33 100644 --- a/src/frontends/xforms/FormCitation.h +++ b/src/frontends/xforms/FormCitation.h @@ -47,6 +47,8 @@ private: /// OFF }; + /// Connect signals etc. Set form's max size. + virtual void connect(); /// Disconnect signals. Also perform any necessary housekeeping. virtual void disconnect(); diff --git a/src/frontends/xforms/FormCopyright.C b/src/frontends/xforms/FormCopyright.C index 3453352522..0cef3ce770 100644 --- a/src/frontends/xforms/FormCopyright.C +++ b/src/frontends/xforms/FormCopyright.C @@ -42,4 +42,8 @@ FL_FORM * FormCopyright::form() const void FormCopyright::build() { dialog_ = build_copyright(); + + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; } diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 27511bf231..e3051215e9 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -94,6 +94,10 @@ void FormDocument::build() bc_.setUndoAll(dialog_->button_restore); bc_.refresh(); + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + // the document paper form paper_ = build_doc_paper(); fl_addto_choice(paper_->choice_papersize2, diff --git a/src/frontends/xforms/FormError.C b/src/frontends/xforms/FormError.C index 9033ff4873..9bdf9dfb69 100644 --- a/src/frontends/xforms/FormError.C +++ b/src/frontends/xforms/FormError.C @@ -20,8 +20,6 @@ #include "form_error.h" #include "insets/inseterror.h" -static int minh, minw; - FormError::FormError( LyXView * lv, Dialogs * d ) : FormInset( lv, d, _("LaTeX Error") ), dialog_(0), inset_(0), message_("") @@ -75,7 +73,6 @@ void FormError::update(bool switched) return; } - fl_set_form_minsize(form(), minw, minh); fl_set_object_label(dialog_->message, message_.c_str()); } @@ -84,7 +81,7 @@ void FormError::build() { dialog_ = build_error(); - // XFORMS bug workaround - // Define the min/max dimensions. Actually applied in update() - minw = form()->w; minh = form()->h; + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; } diff --git a/src/frontends/xforms/FormIndex.C b/src/frontends/xforms/FormIndex.C index 8e718e46d1..cefacea8db 100644 --- a/src/frontends/xforms/FormIndex.C +++ b/src/frontends/xforms/FormIndex.C @@ -26,7 +26,7 @@ #include "lyxfunc.h" FormIndex::FormIndex(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Index")), minh(0), minw(0), dialog_(0) + : FormCommand(lv, d, _("Index")), dialog_(0) { // let the dialog be shown // These are permanent connections so we won't bother @@ -49,6 +49,13 @@ FL_FORM * FormIndex::form() const } +void FormIndex::connect() +{ + fl_set_form_maxsize( form(), 2*minw_, minh_ ); + FormCommand::connect(); +} + + void FormIndex::build() { dialog_ = build_index(); @@ -56,9 +63,9 @@ void FormIndex::build() #ifdef WITH_WARNINGS #warning use the buttoncontroller #endif - // XFORMS bug workaround - // Define the min/max dimensions. Actually applied in update() - minw = form()->w; minh = form()->h; + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; } @@ -69,9 +76,6 @@ void FormIndex::update(bool switched) return; } - fl_set_form_minsize(form(), minw, minh); - fl_set_form_maxsize(form(), 2*minw, minh); - fl_set_input(dialog_->key, params.getContents().c_str()); if ( lv_->buffer()->isReadonly() ) { diff --git a/src/frontends/xforms/FormIndex.h b/src/frontends/xforms/FormIndex.h index 7c3207391f..19f93e2391 100644 --- a/src/frontends/xforms/FormIndex.h +++ b/src/frontends/xforms/FormIndex.h @@ -28,6 +28,8 @@ public: /// ~FormIndex(); private: + /// Connect signals etc. Set form's max size. + virtual void connect(); /// Build the dialog virtual void build(); /// Update dialog before showing it @@ -38,10 +40,6 @@ private: virtual FL_FORM * form() const; /// FD_form_index * build_index(); - /// - int minh; - /// - int minw; /// Real GUI implementation. FD_form_index * dialog_; }; diff --git a/src/frontends/xforms/FormInset.C b/src/frontends/xforms/FormInset.C index 57362adac6..743293f864 100644 --- a/src/frontends/xforms/FormInset.C +++ b/src/frontends/xforms/FormInset.C @@ -35,6 +35,7 @@ void FormInset::connect() connect(slot(this, &FormInset::update)); h_ = d_->hideBufferDependent. connect(slot(this, &FormInset::hide)); + FormBase::connect(); } diff --git a/src/frontends/xforms/FormInset.h b/src/frontends/xforms/FormInset.h index 865cb4516e..1ffd4d2359 100644 --- a/src/frontends/xforms/FormInset.h +++ b/src/frontends/xforms/FormInset.h @@ -23,20 +23,18 @@ /** This class is an XForms GUI base class to insets */ class FormInset : public FormBaseBD { -public: +protected: /// Constructor FormInset( LyXView *, Dialogs *, string const &, ButtonPolicy * bp = new OkCancelReadOnlyPolicy, char const * close = N_("Close"), char const * cancel = N_("Cancel")); -protected: // methods /// Connect signals. Also perform any necessary initialisation. virtual void connect(); /// Disconnect signals. Also perform any necessary housekeeping. virtual void disconnect(); -protected: // data /// inset::hide connection. Connection ih_; }; @@ -46,14 +44,13 @@ protected: // data InsetCommand */ class FormCommand : public FormInset { -public: +protected: /// Constructor FormCommand( LyXView *, Dialogs *, string const &, ButtonPolicy * = new OkCancelReadOnlyPolicy, char const * close = N_("Close"), char const * cancel = N_("Cancel")); -protected: /// Disconnect signals. Also perform any necessary housekeeping. virtual void disconnect(); diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 43ab071378..0e2f85a95f 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -61,6 +61,10 @@ void FormParagraph::build() // the tabbed folder dialog_ = build_tabbed_paragraph(); + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + // manage the restore, ok, apply and cancel/close buttons bc_.setOK(dialog_->button_ok); bc_.setApply(dialog_->button_apply); diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 9bf62d3a0e..5815dd11ad 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -31,7 +31,7 @@ FormPreferences::FormPreferences(LyXView * lv, Dialogs * d) : FormBaseBI(lv, d, _("Preferences"), new PreferencesPolicy), dialog_(0), outputs_tab_(0), look_n_feel_tab_(0), inputs_tab_(0), lnf_general_(0), screen_fonts_(0), interface_(0), - printer_(0), paths_(0), outputs_general_(0), minw_(0), minh_(0) + printer_(0), paths_(0), outputs_general_(0) { // let the dialog be shown // This is a permanent connection so we won't bother @@ -80,8 +80,8 @@ void FormPreferences::build() bc_.refresh(); // Workaround dumb xforms sizing bug - minw_ = dialog_->form->w; - minh_ = dialog_->form->h; + minw_ = form()->w; + minh_ = form()->h; // build the tab folders outputs_tab_ = build_outer_tab(); @@ -225,15 +225,6 @@ FL_FORM * FormPreferences::form() const } -void FormPreferences::connect() -{ - FormBaseBI::connect(); - fl_set_form_minsize(dialog_->form, - minw_, - minh_); -} - - void FormPreferences::apply() { // set the new lyxrc entries diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index 5015240119..5657707cb9 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -45,8 +45,6 @@ public: /// ~FormPreferences(); private: - /// - virtual void connect(); /// Update the dialog. virtual void update(bool = false); /// @@ -100,10 +98,6 @@ private: FD_form_paths * paths_; /// FD_form_outputs_general * outputs_general_; - /// Overcome a dumb xforms sizing bug - int minw_; - /// - int minh_; }; #endif diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 12147c2e79..4c9dff6571 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -54,6 +54,10 @@ void FormPrint::build() { dialog_ = build_print(); + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + // manage the ok, apply and cancel/close buttons bc_.setOK(dialog_->button_ok); bc_.setApply(dialog_->button_apply); @@ -107,15 +111,6 @@ void FormPrint::build() } -void FormPrint::connect() -{ - FormBaseBD::connect(); - fl_set_form_minsize(dialog_->form, - dialog_->form->w, - dialog_->form->h); -} - - FL_FORM * FormPrint::form() const { if (dialog_) return dialog_->form; diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index e18837efc9..28acdcc4ca 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -45,8 +45,6 @@ private: virtual void apply(); /// Filter the inputs virtual bool input(FL_OBJECT *, long); - /// - virtual void connect(); /// Pointer to the actual instantiation of the xform's form virtual FL_FORM * form() const; /// Build the dialog diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 23070c3661..ecbd5db944 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -30,9 +30,6 @@ using std::sort; using std::vector; -static int formw; -static int formh; - FormRef::FormRef(LyXView * lv, Dialogs * d) : FormCommand(lv, d, _("Reference")), toggle(GOBACK), dialog_(0) { @@ -57,6 +54,13 @@ FL_FORM * FormRef::form() const } +void FormRef::connect() +{ + fl_set_form_maxsize( form(), 2*minw_, minh_ ); + FormCommand::connect(); +} + + void FormRef::disconnect() { refs.clear(); @@ -71,9 +75,9 @@ void FormRef::build() fl_addto_choice(dialog_->type, _(" Ref | Page | TextRef | TextPage | PrettyRef ")); - // XFORMS bug workaround - // Define the min/max dimensions. Actually applied in update() - formw = form()->w, formh = form()->h; + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; // Name is irrelevant to LaTeX documents if ( lv_->buffer()->isLatex() ) { @@ -157,7 +161,7 @@ void FormRef::showBrowser() const fl_show_object( dialog_->button_update ); fl_show_object( dialog_->sort ); - setSize( formw, formh, 0 ); + setSize( minw_, minh_, 0 ); fl_deactivate_object( dialog_->type ); fl_set_object_lcol( dialog_->type, FL_INACTIVE ); @@ -174,7 +178,7 @@ void FormRef::hideBrowser() const fl_hide_object( dialog_->button_update ); fl_hide_object( dialog_->sort ); - setSize( 250, formh, 280 ); + setSize( 250, minh_, 280 ); fl_activate_object( dialog_->type ); fl_set_object_lcol( dialog_->type, FL_BLACK ); @@ -200,14 +204,13 @@ void FormRef::setSize( int w, int h, int dx ) const static int x6 = dialog_->button_cancel->x; static int y6 = dialog_->button_cancel->y; - if ( form()->w != w ) - fl_set_form_size( form(), w, h ); - - fl_set_form_minsize( form(), w, h ); - fl_set_form_maxsize( form(), 2*w, h ); - - if ( form()->w == w ) return; - + if ( form()->w != w ) { + minw_ = w; + minh_ = h; + fl_set_form_size( form(), minw_, minh_ ); + } else + return; + fl_set_object_position( dialog_->name, x1-dx, y1 ); fl_set_object_position( dialog_->ref, x2-dx, y2 ); fl_set_object_position( dialog_->type, x3-dx, y3 ); diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index 65861a14ee..e7ad15d418 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -51,6 +51,8 @@ private: GOFIRST }; + /// Connect signals etc. Set form's max size. + virtual void connect(); /// Disconnect signals. Also perform any necessary housekeeping. virtual void disconnect(); diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 2e5111cde5..2191473c4f 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -66,10 +66,15 @@ void FormToc::disconnect() void FormToc::build() { dialog_ = build_toc(); + fl_addto_choice(dialog_->type, _(" TOC | LOF | LOT | LOA ")); // Don't need to limit size of this dialog + // (but fixing min size is a GOOD thing). + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; } diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index 8d61d8ea02..b32450b5c1 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -26,7 +26,7 @@ #include "lyxfunc.h" FormUrl::FormUrl(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Url")), minh(0), minw(0), dialog_(0) + : FormCommand(lv, d, _("Url")), dialog_(0) { // let the dialog be shown // These are permanent connections so we won't bother @@ -49,6 +49,13 @@ FL_FORM * FormUrl::form() const } +void FormUrl::connect() +{ + fl_set_form_maxsize( form(), 2*minw_, minh_ ); + FormCommand::connect(); +} + + void FormUrl::build() { dialog_ = build_url(); @@ -56,10 +63,9 @@ void FormUrl::build() #ifdef WITH_WARNINGS #warning use the buttoncontroller #endif - // XFORMS bug workaround - // Define the min/max dimensions. Actually applied in update() - minw = form()->w; - minh = form()->h; + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; } @@ -70,9 +76,6 @@ void FormUrl::update(bool switched) return; } - fl_set_form_minsize(form(), minw, minh); - fl_set_form_maxsize(form(), 2*minw, minh); - fl_set_input(dialog_->url, params.getContents().c_str()); fl_set_input(dialog_->name, params.getOptions().c_str()); diff --git a/src/frontends/xforms/FormUrl.h b/src/frontends/xforms/FormUrl.h index add9278ce7..e6f718ab0a 100644 --- a/src/frontends/xforms/FormUrl.h +++ b/src/frontends/xforms/FormUrl.h @@ -28,6 +28,8 @@ public: /// ~FormUrl(); private: + /// Connect signals etc. Set form's max size. + virtual void connect(); /// Build the dialog virtual void build(); /// Update dialog before showing it @@ -38,10 +40,6 @@ private: virtual FL_FORM * form() const; /// FD_form_url * build_url(); - /// - int minh; - /// - int minw; /// Real GUI implementation. FD_form_url * dialog_; };