From 798f00a0a865b9fc9119fd5d88decb4667f1c557 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Wed, 12 Sep 2001 09:35:25 +0000 Subject: [PATCH] Inset dialogs: remain connected to the inset on "Apply" by default, except for the citation dialog which disconnects. Should be much more intuitive behaviour again. Non-inset dialogs (eg preamble): connect() on show, enabling the dialog to act on an updateBufferDependent signal. Change buffer and the preamble will update! (rather embarrassed that this bug crept in!) Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2735 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ChangeLog | 15 +++++++++++++++ src/frontends/controllers/ControlCitation.h | 4 ++++ src/frontends/controllers/ControlConnections.C | 1 - src/frontends/controllers/ControlDialogs.h | 3 +++ src/frontends/controllers/ControlInset.h | 8 ++++++-- src/frontends/controllers/ControlPreamble.C | 2 +- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 23464f2aff..251c3822d1 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,18 @@ +2001-09-12 Angus Leeming + + * ControlInset.h (disconnectOnApply): new method. Defines the behaviour + of the dialog when the Apply button is pressed. Defaults to false, + but can be overridden in the daughter classes. + + * ControlCitation.h (disconnectOnApply): new method. Set to true. + Perhaps make this user-modifiable? + +2001-09-11 Angus Leeming + + * ControlDialogs.h (show): connect() the dialog on show. All of a sudden + we have dialogs that update their contents when the buffer changes. + Rather embarassing, really! + 2001-09-07 Angus Leeming * ControlSearch (replace): change semantics of replace to NOT move on diff --git a/src/frontends/controllers/ControlCitation.h b/src/frontends/controllers/ControlCitation.h index 4bbb8979b8..c0d26e7456 100644 --- a/src/frontends/controllers/ControlCitation.h +++ b/src/frontends/controllers/ControlCitation.h @@ -48,6 +48,10 @@ private: /// virtual void clearDaughterParams(); + /** disconnect from the inset when the Apply button is pressed. + Allows easy insertion of multiple citations. */ + virtual bool disconnectOnApply() { return true; } + /// The info associated with each key biblio::InfoMap bibkeysInfo_; diff --git a/src/frontends/controllers/ControlConnections.C b/src/frontends/controllers/ControlConnections.C index c7de3efd7c..5a207f588e 100644 --- a/src/frontends/controllers/ControlConnections.C +++ b/src/frontends/controllers/ControlConnections.C @@ -105,4 +105,3 @@ void ControlConnectBD::disconnect() u_.disconnect(); ControlConnectBase::disconnect(); } - diff --git a/src/frontends/controllers/ControlDialogs.h b/src/frontends/controllers/ControlDialogs.h index 049c4ef64c..f7dabe9470 100644 --- a/src/frontends/controllers/ControlDialogs.h +++ b/src/frontends/controllers/ControlDialogs.h @@ -47,6 +47,7 @@ protected: /// set the params before show or update virtual void setParams() {} +private: /// is the dialog built ? bool dialog_built_; }; @@ -66,6 +67,8 @@ void ControlDialog::show() if (isBufferDependent() && !lv_.view()->available()) return; + connect(); + setParams(); if (!dialog_built_) { diff --git a/src/frontends/controllers/ControlInset.h b/src/frontends/controllers/ControlInset.h index c1dce1f940..755a4476df 100644 --- a/src/frontends/controllers/ControlInset.h +++ b/src/frontends/controllers/ControlInset.h @@ -46,7 +46,7 @@ protected: Inset * inset() const; private: - /** These 6 methods are all that the individual daughter classes + /** These 7 methods are all that the individual daughter classes should need to instantiate. */ /// if the inset exists then do this... @@ -67,6 +67,10 @@ private: /// clean-up any daughter class-particular data on hide(). virtual void clearDaughterParams() {} + /** Some dialogs may find it beneficial to disconnect from the inset + when the Apply button is pressed. E.g., doing this with the citation + dialog allows multiple citiations to be inserted easily. */ + virtual bool disconnectOnApply() { return false; } @@ -195,7 +199,7 @@ void ControlInset::apply() else applyParamsNoInset(); - if (!isClosing()) { + if (disconnectOnApply() && !isClosing()) { *params_ = getParams(string()); inset_ = 0; ih_.disconnect(); diff --git a/src/frontends/controllers/ControlPreamble.C b/src/frontends/controllers/ControlPreamble.C index 38b808f29e..08eaf67eee 100644 --- a/src/frontends/controllers/ControlPreamble.C +++ b/src/frontends/controllers/ControlPreamble.C @@ -28,7 +28,7 @@ ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d) : ControlDialog(lv, d), params_(0) { - d_.showPreamble.connect(SigC::slot(this, &ControlPreamble::show)); + d_.showPreamble.connect(SigC::slot(this, &ControlPreamble::show)); }