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
///
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
else
setButtonLabel(cancel_, close_label_);
}
+}
- // Enable/Disable read-only handled widgets.
- if (!read_only_.empty()) {
- bool const enable = !bp().isReadOnly();
- Widgets::const_iterator end = read_only_.end();
- Widgets::const_iterator iter = read_only_.begin();
- for (; iter != end; ++iter) {
- setWidgetEnabled(*iter, enable);
- }
- }
+template <class Button, class Widget>
+void GuiBC<Button, Widget>::refreshReadOnly()
+{
+ if (read_only_.empty()) return;
+
+ bool const enable = !bp().isReadOnly();
+ Widgets::const_iterator end = read_only_.end();
+ Widgets::const_iterator iter = read_only_.begin();
+ for (; iter != end; ++iter) {
+ setWidgetEnabled(*iter, enable);
+ }
}
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;
}
void hide();
///
virtual void refresh() = 0;
+ ///
+ virtual void refreshReadOnly() = 0;
/// Passthrough function -- returns its input value
bool readOnly(bool = true);
+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):
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
+#include <config.h>
+
#include <vector>
#include <algorithm>
#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"
using std::find;
using std::min;
-using std::pair;
using std::vector;
using std::sort;
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())
keys = keys.substr(start);
}
- if (vec.empty()) // unable to separate
- vec.push_back(str);
-
return vec;
}
+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:
if (!dialog_.get())
return;
- general_update();
-
+ // Do this first; some objects may be de/activated subsequently.
bc_.readOnly(lv_->buffer()->isReadonly());
+
+ general_update();
}
if (align == LYX_ALIGN_LAYOUT)
align = textclasslist.Style(buf->params.textclass,
text->cursor.par()->GetLayout()).align;
-
+
switch (align) {
case LYX_ALIGN_RIGHT:
fl_set_button(general_->radio_align_right, 1);
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,