]> git.lyx.org Git - features.git/commitdiff
Rob Lahaye's "iconify dialogs with main window if so desired" patch.
authorAngus Leeming <leeming@lyx.org>
Fri, 7 Sep 2001 10:11:02 +0000 (10:11 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 7 Sep 2001 10:11:02 +0000 (10:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2703 a592a061-630c-0410-9148-cb99ea01b6c8

14 files changed:
src/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlButtons.C
src/frontends/controllers/ControlButtons.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormBase.C
src/frontends/xforms/FormBase.h
src/frontends/xforms/FormBaseDeprecated.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/form_preferences.h
src/frontends/xforms/forms/form_preferences.fd
src/lyxrc.C
src/lyxrc.h

index 4b74e9f08152619ec3f15787aca6c0187b96233b..0764dcce31e58c97d0e4af28aff04efaa6f41bc7 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-07  Rob Lahaye  <lahaye@users.sourceforge.net>
+
+       * lyxrc.[Ch]: added dialogs_iconify_with_main variable and associated
+       code.
+
 2001-09-04  José Matos  <jamatos@fep.up.pt>
        * buffer.C
        * buffer.h
index b9ca141ad06805fbc78d9e1673e88786f7e3d54f..edfd3d11efd9d84530fc8b7c9e74fd408fd3ce85 100644 (file)
@@ -1,3 +1,7 @@
+2001-09-07  Rob Lahaye  <lahaye@users.sourceforge.net>
+
+       * ControlButtons.[Ch]: added publicly accessible IconifyWithMain method.
+
 2001-09-04  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * ControlCharacter.C: fix Michael's bug: In the "Character layout"
index 0e381f8247301f6293a81ed34ca7838d685adfd2..06f31205eb93c8cfcaa5e665c3039c5e3966bbd9 100644 (file)
@@ -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;
+}
index 25547338eb3e0728b44c8ae96d258cee9a731457..98ee9fc092269ac05d6605fe1497fca8c0b5ad77 100644 (file)
@@ -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
index d9ad8b43a2df0e3b6944b788c09c025c573c006c..02fd5fac61d209d6c65c13e5db4c870c701b6201 100644 (file)
@@ -1,3 +1,19 @@
+2001-09-07  Rob Lahaye  <lahaye@users.sourceforge.net>
+
+       * 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  <a.leeming@ic.ac.uk>
+
+       * FormBase.h: clean-up comments. Remove mutable status of minw_, minh_.
+
 2001-09-06  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * Toolbar_pimpl.C (updateLayoutList): do not display obsolete
index 5b5b73764367e15a8396fff0e0ecce40a55ab719..cd97c3ef83743cc2aa37601258ecd30a68b76986 100644 (file)
@@ -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());
        }
 }
 
index 4bc4d06e38f27c65ddb570effef2ad113829daad..3774f2bbf24c8725e510859d4f7713a22cd504e4 100644 (file)
@@ -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_;
 };
index 43dddbdfc3cd86d05f34a314365c7466ac807f6d..847844c7cca692266e6104f079d1f10998d7ab6f 100644 (file)
@@ -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());
        }
 }
 
index 0d113c607297b628ea03e3547421180df79488e5..4272c2f82b9c1b916d3338af430a2acc3fdb40d3 100644 (file)
@@ -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<unsigned int>
                (fl_get_counter_value(dialog_->counter_autosave));
        lyxrc.wheel_jump = static_cast<unsigned int>
@@ -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);
 }
index 7b46f55d916ce633769069137f9e42684b3333ce..a6c243c0f7db9aa7445d51e62a666892c4a147de 100644 (file)
@@ -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);
index f7d482a950103ae9207540fbc4307e99efa4ffd7..0eecd1c07cf1890d7a6ad7b82b602e4aefb2fcd4 100644 (file)
@@ -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;
 };
index 38311f31a03e1cb4c7deeb5ec2d60a49650a47a6..a5563bb7c584ae53fe29cd662632e86b978ac898 100644 (file)
@@ -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
index 1a4aa619dd73f3a052d1d17ec8e0f151ae3e3049..3051e62531cd1688abc1ced382ab92e7827441b4 100644 (file)
@@ -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;
index d477b2a33f9c4ab44f0280e948fc278f31c6acd8..edbe7e8adbaa14a81057ebf6e52ecb358e2dca33 100644 (file)
@@ -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?