mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Distinguish between "Apply" when the dialog should be refreshed afterwards
and "Ok" when it shouldn't. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2679 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
81d7acebb2
commit
f3562a2398
@ -21,6 +21,11 @@
|
||||
#include "ButtonControllerBase.h"
|
||||
#include "ViewBase.h"
|
||||
|
||||
ControlButtons::ControlButtons()
|
||||
: is_closing_(false)
|
||||
{}
|
||||
|
||||
|
||||
void ControlButtons::ApplyButton()
|
||||
{
|
||||
apply();
|
||||
@ -30,7 +35,9 @@ void ControlButtons::ApplyButton()
|
||||
|
||||
void ControlButtons::OKButton()
|
||||
{
|
||||
is_closing_ = true;
|
||||
apply();
|
||||
is_closing_ = false;
|
||||
hide();
|
||||
bc().ok();
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ class ButtonControllerBase;
|
||||
*/
|
||||
class ControlButtons : public DialogBase
|
||||
{
|
||||
public: // methods
|
||||
public:
|
||||
///
|
||||
ControlButtons() {}
|
||||
ControlButtons();
|
||||
///
|
||||
virtual ~ControlButtons() {}
|
||||
|
||||
@ -64,6 +64,10 @@ public: // methods
|
||||
virtual ButtonControllerBase & bc() = 0;
|
||||
|
||||
protected:
|
||||
/** When Applying it's useful to know whether the dialog is about
|
||||
to close or not (no point refreshing the display for example). */
|
||||
bool isClosing() const { return is_closing_; }
|
||||
|
||||
/// Get changed parameters and Dispatch them to the kernel.
|
||||
virtual void apply() = 0;
|
||||
/// Disconnect signals and hide View.
|
||||
@ -75,6 +79,11 @@ protected:
|
||||
instantiated in a daughter class that creates the actual instance
|
||||
of the View. */
|
||||
virtual ViewBase & view() = 0;
|
||||
|
||||
private:
|
||||
///
|
||||
bool is_closing_;
|
||||
|
||||
};
|
||||
|
||||
#endif // CONTROLBUTTONS_H
|
||||
|
@ -195,11 +195,13 @@ void ControlInset<Inset, Params>::apply()
|
||||
else
|
||||
applyParamsNoInset();
|
||||
|
||||
*params_ = getParams(string());
|
||||
inset_ = 0;
|
||||
ih_.disconnect();
|
||||
if (!isClosing()) {
|
||||
*params_ = getParams(string());
|
||||
inset_ = 0;
|
||||
ih_.disconnect();
|
||||
|
||||
view().update();
|
||||
view().update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user