Changes needed to activate Character dialog buttons when any field is not

IGNORE.
Also fix crash when Font button on toolbar is pressed and the Character dialog
has not yet been shown for the first time.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2106 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-06-12 13:54:04 +00:00
parent 79327ea1ad
commit e8779e6014
8 changed files with 69 additions and 5 deletions

View File

@ -3,6 +3,9 @@
* converter.h (Get): changed argument type from int to
FormatList::size_type to avoid unnecessary conversion.
* bufferview_funcs.C (ToggleAndShow): check state of LyXText pointer
before using it.
2001-06-07 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* gettext.h: include LString.h even when --disable-nls is on.

View File

@ -250,6 +250,8 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
return;
}
LyXText * text = bv->getLyXText();
if (!text)
return;
bv->hideCursor();
bv->update(text, BufferView::SELECT|BufferView::FITCUR);

View File

@ -1,3 +1,11 @@
2001-06-12 Angus Leeming <a.leeming@ic.ac.uk>
* ControlCharacter.C (apply): test that font_ exists, thereby preventing
crash when the Font button on the Toolbar is pressed.
* GUI.h: change policy of Character button controller to
OkApplyCancelReadOnlyPolicy.
2001-06-11 Lars Gullik Bjønnes <larsbj@birdstep.com>
* ControlToc.C (getContents): don't add anything to the list if it

View File

@ -56,7 +56,7 @@ void ControlCharacter::clearParams()
void ControlCharacter::apply()
{
if (!lv_.view()->available())
if (!(font_ && lv_.view()->available()))
return;
view().apply();

View File

@ -86,13 +86,13 @@ class ControlCharacter;
template <class GUIview, class GUIbc>
class GUICharacter : public GUI<ControlCharacter, GUIview,
NoRepeatedApplyReadOnlyPolicy, GUIbc>
OkApplyCancelReadOnlyPolicy, GUIbc>
{
public:
///
GUICharacter(LyXView & lv, Dialogs & d)
: GUI<ControlCharacter, GUIview,
NoRepeatedApplyReadOnlyPolicy, GUIbc>(lv, d) {}
OkApplyCancelReadOnlyPolicy, GUIbc>(lv, d) {}
};

View File

@ -8,6 +8,9 @@
(Converters::GetTo): get the contents of "to" not "from"! Thus fix bug
that disabled addition of new converters.
* FormCharacter.C (input, update): new methods. Activate the Apply
button when any of the input fileds are not IGNORE.
2001-06-11 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormToc.C (input): change test slightly.

View File

@ -111,6 +111,8 @@ void FormCharacter::build()
void FormCharacter::apply()
{
if (!form()) return;
int pos = fl_get_choice(dialog_->choice_family);
controller().setFamily(family_[pos-1]);
@ -134,3 +136,46 @@ void FormCharacter::apply()
bool const toggleall = fl_get_button(dialog_->check_toggle_all);
controller().setToggleAll(toggleall);
}
void FormCharacter::update()
{
if (input(0,0) == ButtonPolicy::SMI_VALID)
bc().valid(); // so that the user can press Ok
}
ButtonPolicy::SMInput FormCharacter::input(FL_OBJECT *, long)
{
ButtonPolicy::SMInput activate = ButtonPolicy::SMI_NOOP;
int pos = fl_get_choice(dialog_->choice_family);
if (family_[pos-1] != LyXFont::IGNORE_FAMILY)
activate = ButtonPolicy::SMI_VALID;
pos = fl_get_choice(dialog_->choice_series);
if (series_[pos-1] != LyXFont::IGNORE_SERIES)
activate = ButtonPolicy::SMI_VALID;
pos = fl_get_choice(dialog_->choice_shape);
if (shape_[pos-1] != LyXFont::IGNORE_SHAPE)
activate = ButtonPolicy::SMI_VALID;
pos = fl_get_choice(dialog_->choice_size);
if (size_[pos-1] != LyXFont::IGNORE_SIZE)
activate = ButtonPolicy::SMI_VALID;
pos = fl_get_choice(dialog_->choice_bar);
if (bar_[pos-1] != character::IGNORE)
activate = ButtonPolicy::SMI_VALID;
pos = fl_get_choice(dialog_->choice_color);
if (color_[pos-1] != LColor::ignore)
activate = ButtonPolicy::SMI_VALID;
string const language = combo_language2_->getline();
if (language != _("No change"))
activate = ButtonPolicy::SMI_VALID;
return activate;
}

View File

@ -43,8 +43,11 @@ private:
/// Build the dialog
virtual void build();
/// Nothing to update...
virtual void update() {}
/// Update the dialog.
virtual void update();
/// Filter the inputs on callback from xforms
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
/** Callback method (used only to activate Apply button when
combox is changed */