]> git.lyx.org Git - features.git/commitdiff
* src/frontends/controllers/Dialog.{cpp,h}:
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 2 Jul 2007 13:54:30 +0000 (13:54 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 2 Jul 2007 13:54:30 +0000 (13:54 +0000)
- new boolean canApplyToReadonly that allows to apply params/update view
  even if the buffer is readOnly for specific dialogs.

* src/frontends/controllers/ControlPrint.h:
- use that (fix bug 3909)
* src/frontends/controllers/ControlViewSource:
- dto. (fix bug 3943)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18959 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ControlPrint.h
src/frontends/controllers/ControlViewSource.h
src/frontends/controllers/Dialog.cpp
src/frontends/controllers/Dialog.h

index f1d0b3c825b4427aa68b8a5ae7a4df8040df24de..f6023ae0df40c11c73ce16ae234a531a2c6965b9 100644 (file)
@@ -40,6 +40,8 @@ public:
        ///
        virtual bool isBufferDependent() const { return true; }
        ///
+       virtual bool canApplyToReadOnly() const { return true; }
+       ///
        virtual kb_action getLfun() const { return LFUN_BUFFER_PRINT; }
 
        /// Browse for a file
index 43081f565822143ffaa218b96a54afeab6de1b29..0c2218e5d430a948c15a0b68b3d3ac52e96ccefb 100644 (file)
@@ -37,6 +37,8 @@ public:
        virtual bool isBufferDependent() const { return true; }
        ///
        bool canApply() const { return true; }
+       ///
+       virtual bool canApplyToReadOnly() const { return true; }
 
        /// The title displayed by the dialog reflects source type.
        docstring const title() const;
index d8591586ee5c6444ddd319f17fb4879e54616511..a46f1b84a3269789cee4707b790194fe858508c0 100644 (file)
@@ -121,7 +121,8 @@ void Dialog::apply()
 {
        if (controller().isBufferDependent()) {
                if (!kernel().isBufferAvailable() ||
-                   kernel().isBufferReadonly())
+                   (kernel().isBufferReadonly() &&
+                    !controller().canApplyToReadOnly()))
                        return;
        }
 
@@ -188,7 +189,7 @@ void Dialog::checkStatus()
                bc().readOnly(readonly);
                // refreshReadOnly() is too generous in _enabling_ widgets
                // update dialog to disable disabled widgets again
-               if (!readonly)
+               if (!readonly || controller().canApplyToReadOnly())
                        view().update();
        } else
                bc().readOnly(true);
index 0caa30381674b2bf64aeec46d43db38e1c529a7c..892f69cc883f0368a954dbcf81c986173cc0e9b9 100644 (file)
@@ -161,6 +161,12 @@ public:
         */
        virtual bool isBufferDependent() const = 0;
 
+       /** \return true if the dialog can apply data also
+        *  for ReadOnly buffers.
+        *  This has to be distinguished from isBufferDependent()
+        */
+       virtual bool canApplyToReadOnly() const { return false; }
+
        /** The lfun that is sent for applying the data.
         *
         * This method is used by the default implementation of canApply()