mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Modification to ButtonController, so that read-only list of widgets is
not refreshed every time Restore,Apply,Ok,Cancel are pressed. Has the real advantage that the GUI's can control the widgets more accurately, since the ButtonController cannot. Demonstrated with some small change to the Paragraph dialog: enabling the align buttons is now dependent on the AlignPossible entry in the Layout. Also apply a small bug fix to getVectorFromString in helper_funcs.C git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2087 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ac114c3d50
commit
9b7b1a17fc
@ -39,8 +39,10 @@ public:
|
||||
///
|
||||
void eraseReadOnly() { read_only_.clear(); }
|
||||
|
||||
/// Refresh the widgets status.
|
||||
/// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
|
||||
void refresh();
|
||||
/// Refresh the status of any widgets in the read_only list
|
||||
void refreshReadOnly();
|
||||
|
||||
private:
|
||||
/// Enable/Disable a widget
|
||||
@ -89,9 +91,14 @@ void GuiBC<Button, Widget>::refresh()
|
||||
else
|
||||
setButtonLabel(cancel_, close_label_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class Button, class Widget>
|
||||
void GuiBC<Button, Widget>::refreshReadOnly()
|
||||
{
|
||||
if (read_only_.empty()) return;
|
||||
|
||||
// Enable/Disable read-only handled widgets.
|
||||
if (!read_only_.empty()) {
|
||||
bool const enable = !bp().isReadOnly();
|
||||
|
||||
Widgets::const_iterator end = read_only_.end();
|
||||
@ -101,8 +108,6 @@ void GuiBC<Button, Widget>::refresh()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template <class BP, class GUIBC>
|
||||
class ButtonController: public GUIBC
|
||||
|
@ -84,10 +84,11 @@ void ButtonControllerBase::invalid()
|
||||
bool ButtonControllerBase::readOnly(bool ro)
|
||||
{
|
||||
if (ro) {
|
||||
input(ButtonPolicy::SMI_READ_ONLY);
|
||||
bp().input(ButtonPolicy::SMI_READ_ONLY);
|
||||
} else {
|
||||
input(ButtonPolicy::SMI_READ_WRITE);
|
||||
bp().input(ButtonPolicy::SMI_READ_WRITE);
|
||||
}
|
||||
refreshReadOnly();
|
||||
return ro;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
void hide();
|
||||
///
|
||||
virtual void refresh() = 0;
|
||||
///
|
||||
virtual void refreshReadOnly() = 0;
|
||||
|
||||
/// Passthrough function -- returns its input value
|
||||
bool readOnly(bool = true);
|
||||
|
@ -1,3 +1,16 @@
|
||||
2001-06-01 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* helper_funcs.C (getVectorFromString): bug fix.
|
||||
|
||||
2001-05-30 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* ButtonController.h
|
||||
* ButtonControllerBase.[Ch] (refreshReadOnly): new method, called direct
|
||||
from ButtonControllerBase::readOnly. Updates the state of the widgets
|
||||
in the read-only list only when the read-only status of the document
|
||||
changes.
|
||||
(refresh): moved this stuff into refreshReadOnly.
|
||||
|
||||
2001-05-18 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* ControlPrint.C (c-tor):
|
||||
|
@ -11,6 +11,8 @@
|
||||
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
@ -18,13 +20,6 @@
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/*
|
||||
#include "buffer.h"
|
||||
#include "Dialogs.h"
|
||||
#include "LyXView.h"
|
||||
*/
|
||||
#include "LString.h"
|
||||
#include "biblio.h"
|
||||
#include "helper_funcs.h"
|
||||
@ -34,7 +29,6 @@
|
||||
|
||||
using std::find;
|
||||
using std::min;
|
||||
using std::pair;
|
||||
using std::vector;
|
||||
using std::sort;
|
||||
|
||||
|
@ -54,7 +54,10 @@ vector<string> const getVectorFromString(string const & str,
|
||||
|
||||
for(;;) {
|
||||
string::size_type const idx = keys.find(delim);
|
||||
if (idx == string::npos) break;
|
||||
if (idx == string::npos) {
|
||||
vec.push_back(keys);
|
||||
break;
|
||||
}
|
||||
|
||||
string const key = keys.substr(0, idx);
|
||||
if (!key.empty())
|
||||
@ -64,9 +67,6 @@ vector<string> const getVectorFromString(string const & str,
|
||||
keys = keys.substr(start);
|
||||
}
|
||||
|
||||
if (vec.empty()) // unable to separate
|
||||
vec.push_back(str);
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2001-05-30 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* FormParagraph.C (update, general_update): enabling the align buttons
|
||||
is now dependent on the AlignPossible entry in the Layout.
|
||||
|
||||
2001-06-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* MathsSymbols.C:
|
||||
|
@ -126,9 +126,10 @@ void FormParagraph::update()
|
||||
if (!dialog_.get())
|
||||
return;
|
||||
|
||||
general_update();
|
||||
|
||||
// Do this first; some objects may be de/activated subsequently.
|
||||
bc_.readOnly(lv_->buffer()->isReadonly());
|
||||
|
||||
general_update();
|
||||
}
|
||||
|
||||
|
||||
@ -273,6 +274,15 @@ void FormParagraph::general_update()
|
||||
break;
|
||||
}
|
||||
|
||||
LyXAlignment alignpos =
|
||||
textclasslist.Style(buf->params.textclass,
|
||||
text->cursor.par()->GetLayout()).alignpossible;
|
||||
|
||||
setEnabled(general_->radio_align_block, bool(alignpos & LYX_ALIGN_BLOCK));
|
||||
setEnabled(general_->radio_align_center, bool(alignpos & LYX_ALIGN_CENTER));
|
||||
setEnabled(general_->radio_align_left, bool(alignpos & LYX_ALIGN_LEFT));
|
||||
setEnabled(general_->radio_align_right, bool(alignpos & LYX_ALIGN_RIGHT));
|
||||
|
||||
fl_set_button(general_->check_lines_top,
|
||||
text->cursor.par()->params.lineTop());
|
||||
fl_set_button(general_->check_lines_bottom,
|
||||
|
Loading…
Reference in New Issue
Block a user