change ButtonController's trigger_change_ vector to dont_trigger_change.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1518 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-02-15 11:15:31 +00:00
parent 6512edb15a
commit 50be761b25
4 changed files with 23 additions and 17 deletions

View File

@ -19,7 +19,7 @@ using std::vector;
ButtonController::ButtonController(ButtonPolicy * bp, ButtonController::ButtonController(ButtonPolicy * bp,
char const * cancel, char const * close) char const * cancel, char const * close)
: bp_(bp), okay_(0), apply_(0), cancel_(0), undo_all_(0), : bp_(bp), okay_(0), apply_(0), cancel_(0), undo_all_(0),
read_only_(), trigger_change_(), read_only_(), dont_trigger_change_(),
cancel_label(cancel), close_label(close) cancel_label(cancel), close_label(close)
{ {
Assert(bp); Assert(bp);
@ -150,13 +150,14 @@ void ButtonController::readWrite()
bool ButtonController::valid(bool v, FL_OBJECT * obj) bool ButtonController::valid(bool v, FL_OBJECT * obj)
{ {
if (obj && !trigger_change_.empty()) { if (obj && !dont_trigger_change_.empty()) {
vector<FL_OBJECT *>::const_iterator cit = vector<FL_OBJECT *>::const_iterator cit =
find(trigger_change_.begin(), trigger_change_.end(), find(dont_trigger_change_.begin(),
dont_trigger_change_.end(),
obj); obj);
// Only trigger a change if the obj is in the list // Only trigger a change if the obj is not in the list
if (cit != trigger_change_.end()) { if (cit == dont_trigger_change_.end()) {
if (v) { if (v) {
input(ButtonPolicy::SMI_VALID); input(ButtonPolicy::SMI_VALID);
} else { } else {

View File

@ -90,12 +90,12 @@ public:
} }
/// ///
void addTriggerChange(FL_OBJECT * obj) { void addDontTriggerChange(FL_OBJECT * obj) {
trigger_change_.push_back(obj); dont_trigger_change_.push_back(obj);
} }
/// ///
void eraseTriggerChange() { void eraseDontTriggerChange() {
trigger_change_.clear(); dont_trigger_change_.clear();
} }
/* Action Functions */ /* Action Functions */
@ -135,8 +135,8 @@ private:
FL_OBJECT * undo_all_; FL_OBJECT * undo_all_;
/// List of items to be deactivated when in one of the read-only states /// List of items to be deactivated when in one of the read-only states
std::list<FL_OBJECT *> read_only_; std::list<FL_OBJECT *> read_only_;
/// List of items that will trigger a change in activation status. /// container of items that do not trigger a change in activation status
std::vector<FL_OBJECT *> trigger_change_; std::vector<FL_OBJECT *> dont_trigger_change_;
/// ///
char const * cancel_label; char const * cancel_label;
/// ///

View File

@ -1,3 +1,12 @@
2001-02-15 Angus Leeming <a.leeming@ic.ac.uk>
* ButtonController.[Ch]: changed trigger_change_ vector and associated
methods to dont_trigger_change_ because FL_OBJECTs that trigger a
callback to InputCB() but don't trigger a change in the state of the
Ok, Apply buttons are much rarer than those that do.
* FormCitation.C (build): associated change.
2001-02-14 Lars Gullik Bjønnes <larsbj@lyx.org> 2001-02-14 Lars Gullik Bjønnes <larsbj@lyx.org>
* ButtonController.C: include algorithm * ButtonController.C: include algorithm

View File

@ -97,12 +97,8 @@ void FormCitation::build()
bc_.addReadOnly(dialog_->textBefore); bc_.addReadOnly(dialog_->textBefore);
bc_.addReadOnly(dialog_->textAftr); bc_.addReadOnly(dialog_->textAftr);
bc_.addTriggerChange(dialog_->addBtn); bc_.addDontTriggerChange(dialog_->citeBrsr);
bc_.addTriggerChange(dialog_->delBtn); bc_.addDontTriggerChange(dialog_->bibBrsr);
bc_.addTriggerChange(dialog_->upBtn);
bc_.addTriggerChange(dialog_->downBtn);
bc_.addTriggerChange(dialog_->textBefore);
bc_.addTriggerChange(dialog_->textAftr);
} }