From 5bc3841d4170e068a561c265af9bf0bce65128d0 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 7 Sep 2001 10:11:02 +0000 Subject: [PATCH] Rob Lahaye's "iconify dialogs with main window if so desired" patch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2703 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/frontends/controllers/ChangeLog | 4 ++++ src/frontends/controllers/ControlButtons.C | 7 +++++++ src/frontends/controllers/ControlButtons.h | 2 ++ src/frontends/xforms/ChangeLog | 16 ++++++++++++++ src/frontends/xforms/FormBase.C | 5 +++-- src/frontends/xforms/FormBase.h | 10 ++++----- src/frontends/xforms/FormBaseDeprecated.C | 7 +++++-- src/frontends/xforms/FormPreferences.C | 7 +++++++ src/frontends/xforms/form_preferences.C | 8 +++++++ src/frontends/xforms/form_preferences.h | 1 + .../xforms/forms/form_preferences.fd | 21 ++++++++++++++++++- src/lyxrc.C | 17 +++++++++++++++ src/lyxrc.h | 3 +++ 14 files changed, 102 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4b74e9f081..0764dcce31 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-09-07 Rob Lahaye + + * lyxrc.[Ch]: added dialogs_iconify_with_main variable and associated + code. + 2001-09-04 José Matos * buffer.C * buffer.h diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index b9ca141ad0..edfd3d11ef 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2001-09-07 Rob Lahaye + + * ControlButtons.[Ch]: added publicly accessible IconifyWithMain method. + 2001-09-04 Angus Leeming * ControlCharacter.C: fix Michael's bug: In the "Character layout" diff --git a/src/frontends/controllers/ControlButtons.C b/src/frontends/controllers/ControlButtons.C index 0e381f8247..06f31205eb 100644 --- a/src/frontends/controllers/ControlButtons.C +++ b/src/frontends/controllers/ControlButtons.C @@ -20,6 +20,7 @@ #include "ControlButtons.h" #include "ButtonControllerBase.h" #include "ViewBase.h" +#include "lyxrc.h" ControlButtons::ControlButtons() : is_closing_(false) @@ -55,3 +56,9 @@ void ControlButtons::RestoreButton() update(); bc().restore(); } + + +bool ControlButtons::IconifyWithMain() const +{ + return lyxrc.dialogs_iconify_with_main; +} diff --git a/src/frontends/controllers/ControlButtons.h b/src/frontends/controllers/ControlButtons.h index 25547338eb..98ee9fc092 100644 --- a/src/frontends/controllers/ControlButtons.h +++ b/src/frontends/controllers/ControlButtons.h @@ -57,6 +57,8 @@ public: void CancelButton(); /// void RestoreButton(); + /// + bool IconifyWithMain() const; /** Allow the view to access the ButtonController. This method must be instantiated in a daughter class that creates the actual instance diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index d9ad8b43a2..02fd5fac61 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,19 @@ +2001-09-07 Rob Lahaye + + * FormBase.C (show): use controller_.IconifyWithMain() to control + the dialog's show policy + + * FormBaseDeprecated.C (show): ditto, but use lyxrc variable directly. + + * FormPreferences.C: + * forms/form_preferences.fd: add a check_dialogs_iconify_with_main + check button to the Look & Feel->Misc tab and code to modify the lyxrc + variable dialogs_iconify_with_main appropriately. + +2001-09-07 Angus Leeming + + * FormBase.h: clean-up comments. Remove mutable status of minw_, minh_. + 2001-09-06 Jean-Marc Lasgouttes * Toolbar_pimpl.C (updateLayoutList): do not display obsolete diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index 5b5b737643..cd97c3ef83 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -85,8 +85,9 @@ void FormBase::show() fl_set_form_maxsize(form(), minw_, minh_); fl_show_form(form(), - FL_PLACE_MOUSE | FL_FREE_SIZE, 0, - title_.c_str()); + FL_PLACE_MOUSE | FL_FREE_SIZE, + (controller_.IconifyWithMain() ? FL_TRANSIENT : 0), + title_.c_str()); } } diff --git a/src/frontends/xforms/FormBase.h b/src/frontends/xforms/FormBase.h index 4bc4d06e38..3774f2bbf2 100644 --- a/src/frontends/xforms/FormBase.h +++ b/src/frontends/xforms/FormBase.h @@ -51,21 +51,19 @@ protected: private: /// Pointer to the actual instantiation of xform's form virtual FL_FORM * form() const = 0; - /** Filter the inputs on callback from xforms - Return true if inputs are valid. */ + /// Filter the inputs on callback from xforms virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); /** Redraw the form (on receipt of a Signal indicating, for example, that the xform colors have been re-mapped). */ virtual void redraw(); - /// Overcome a dumb xforms sizing bug - mutable int minw_; + /// The dialog's minimum allowable dimensions. + int minw_; /// - mutable int minh_; + int minh_; /// Can the dialog be resized after it has been created? bool allow_resize_; - /// dialog title, displayed by WM. string title_; }; diff --git a/src/frontends/xforms/FormBaseDeprecated.C b/src/frontends/xforms/FormBaseDeprecated.C index 43dddbdfc3..847844c7cc 100644 --- a/src/frontends/xforms/FormBaseDeprecated.C +++ b/src/frontends/xforms/FormBaseDeprecated.C @@ -21,6 +21,7 @@ #include "LyXView.h" #include "support/LAssert.h" #include "xformsBC.h" +#include "lyxrc.h" //#include "debug.h" using SigC::slot; @@ -112,9 +113,11 @@ void FormBaseDeprecated::show() // 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, 0, - title_.c_str()); + FL_PLACE_MOUSE | FL_FREE_SIZE, + (lyxrc.dialogs_iconify_with_main ? FL_TRANSIENT : 0), + title_.c_str()); } } diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 0d113c6072..4272c2f82b 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -1846,6 +1846,8 @@ void FormPreferences::LnFmisc::apply() const lyxrc.new_ask_filename = fl_get_button(dialog_->check_ask_new_file); lyxrc.cursor_follows_scrollbar = fl_get_button(dialog_->check_cursor_follows_scrollbar); + lyxrc.dialogs_iconify_with_main = + fl_get_button(dialog_->check_dialogs_iconify_with_main); lyxrc.autosave = static_cast (fl_get_counter_value(dialog_->counter_autosave)); lyxrc.wheel_jump = static_cast @@ -1871,6 +1873,7 @@ void FormPreferences::LnFmisc::build() setPreHandler(dialog_->counter_autosave); setPreHandler(dialog_->check_ask_new_file); setPreHandler(dialog_->check_cursor_follows_scrollbar); + setPreHandler(dialog_->check_dialogs_iconify_with_main); setPreHandler(dialog_->counter_wm_jump); } @@ -1892,6 +1895,8 @@ FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const str = lyxrc.getDescription(LyXRC::RC_NEW_ASK_FILENAME); else if (ob == dialog_->check_cursor_follows_scrollbar) str = lyxrc.getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR); + else if (ob == dialog_->check_dialogs_iconify_with_main) + str = lyxrc.getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN); else if (ob == dialog_->counter_autosave) str = lyxrc.getDescription(LyXRC::RC_AUTOSAVE); else if (ob == dialog_->counter_wm_jump) @@ -1911,6 +1916,8 @@ void FormPreferences::LnFmisc::update() fl_set_button(dialog_->check_ask_new_file, lyxrc.new_ask_filename); fl_set_button(dialog_->check_cursor_follows_scrollbar, lyxrc.cursor_follows_scrollbar); + fl_set_button(dialog_->check_dialogs_iconify_with_main, + lyxrc.dialogs_iconify_with_main); fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave); fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump); } diff --git a/src/frontends/xforms/form_preferences.C b/src/frontends/xforms/form_preferences.C index 7b46f55d91..a6c243c0f7 100644 --- a/src/frontends/xforms/form_preferences.C +++ b/src/frontends/xforms/form_preferences.C @@ -402,6 +402,14 @@ FD_form_lnf_misc * FormPreferences::build_lnf_misc() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); fl_set_button(obj, 1); + { + char const * const dummy = N_("Dialogs iconify with main window|#D"); + fdui->check_dialogs_iconify_with_main = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 195, 30, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); + fl_set_button(obj, 1); fdui->counter_wm_jump = obj = fl_add_counter(FL_NORMAL_COUNTER, 320, 225, 115, 30, _("Wheel mouse jump")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); diff --git a/src/frontends/xforms/form_preferences.h b/src/frontends/xforms/form_preferences.h index f7d482a950..0eecd1c07c 100644 --- a/src/frontends/xforms/form_preferences.h +++ b/src/frontends/xforms/form_preferences.h @@ -115,6 +115,7 @@ struct FD_form_lnf_misc { FL_OBJECT *check_display_shrtcuts; FL_OBJECT *check_ask_new_file; FL_OBJECT *check_cursor_follows_scrollbar; + FL_OBJECT *check_dialogs_iconify_with_main; FL_OBJECT *counter_wm_jump; FL_OBJECT *counter_autosave; }; diff --git a/src/frontends/xforms/forms/form_preferences.fd b/src/frontends/xforms/forms/form_preferences.fd index 38311f31a0..a5563bb7c5 100644 --- a/src/frontends/xforms/forms/form_preferences.fd +++ b/src/frontends/xforms/forms/form_preferences.fd @@ -938,7 +938,7 @@ argument: 0 Name: form_lnf_misc Width: 450 Height: 350 -Number of Objects: 9 +Number of Objects: 10 -------------------- class: FL_BOX @@ -1072,6 +1072,25 @@ callback: C_FormBaseDeprecatedInputCB argument: 0 value: 1 +-------------------- +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 15 195 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Dialogs iconify with main window|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: check_dialogs_iconify_with_main +callback: C_FormBaseDeprecatedInputCB +argument: 0 + value: 1 + -------------------- class: FL_COUNTER type: NORMAL_COUNTER diff --git a/src/lyxrc.C b/src/lyxrc.C index 1a4aa619dd..3051e62531 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -65,6 +65,7 @@ keyword_item lyxrcTags[] = { { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT }, { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE }, { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE }, + { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN }, { "\\display_shortcuts", LyXRC::RC_DISPLAY_SHORTCUTS }, { "\\document_path", LyXRC::RC_DOCUMENTPATH }, { "\\escape_chars", LyXRC::RC_ESC_CHARS }, @@ -248,6 +249,7 @@ void LyXRC::setDefaults() { date_insert_format = "%A, %e %B %Y"; show_banner = true; cursor_follows_scrollbar = false; + dialogs_iconify_with_main = false; label_init_length = 3; /// These variables are not stored on disk (perhaps they @@ -751,6 +753,11 @@ int LyXRC::read(string const & filename) cursor_follows_scrollbar = lexrc.getBool(); break; + case RC_DIALOGS_ICONIFY_WITH_MAIN: + if (lexrc.next()) + dialogs_iconify_with_main = lexrc.getBool(); + break; + case RC_ASCIIROFF_COMMAND: if (lexrc.next()) ascii_roff_command = lexrc.getString(); @@ -1117,6 +1124,12 @@ void LyXRC::output(ostream & os) const os << "\\cursor_follows_scrollbar " << tostr(cursor_follows_scrollbar) << "\n"; } + case RC_DIALOGS_ICONIFY_WITH_MAIN: + if (dialogs_iconify_with_main + != system_lyxrc.dialogs_iconify_with_main) { + os << "\\dialogs_iconify_with_main " + << tostr(dialogs_iconify_with_main) << "\n"; + } case RC_SCREEN_FONT_ROMAN: if (roman_font_name != system_lyxrc.roman_font_name) { os << "\\screen_font_roman \"" << roman_font_name @@ -1854,6 +1867,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = N_("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen."); break; + case RC_DIALOGS_ICONIFY_WITH_MAIN: + str = N_("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)"); + break; + case RC_EXIT_CONFIRMATION: str = N_("Sets whether LyX asks for a second confirmation to exit when you have changed documents. (LyX will still ask to save changed documents.)"); break; diff --git a/src/lyxrc.h b/src/lyxrc.h index d477b2a33f..edbe7e8adb 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -94,6 +94,7 @@ enum LyXRCTags { RC_ESC_CHARS, RC_CHKTEX_COMMAND, RC_CURSOR_FOLLOWS_SCROLLBAR, + RC_DIALOGS_ICONIFY_WITH_MAIN, RC_EXIT_CONFIRMATION, RC_DISPLAY_SHORTCUTS, RC_MAKE_BACKUP, @@ -336,6 +337,8 @@ enum LyXRCTags { /// bool cursor_follows_scrollbar; /// + bool dialogs_iconify_with_main; + /// int label_init_length; private: /// Is a bind file already (or currently) read? -- 2.39.2