create and use a little setEnabled() xforms wrapper function.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1676 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-03-05 19:02:40 +00:00
parent 9a355872f6
commit 4505b2f7b3
38 changed files with 369 additions and 643 deletions

View File

@ -1,3 +1,27 @@
2001-03-05 Angus Leeming <a.leeming@ic.ac.uk>
* xform_helpers.[Ch]: renamed as xforms_helpers.[Ch].
* various: in a rush of delayed guilt, I've renamed all instances of
xform as xforms. Jean-Marc sowed this seed a long, long time ago and it
finally sprouted.
* xforms_helpers.[Ch] (setEnabled): a little wrapper function to
activate/deactivate an FL_OBJECT.
* FormCitation.C:
* FormDocument.C:
* FormInclude.C:
* FormParagraph.C:
* FormPreamble.C:
* FormPreferences.C:
* FormRef.C:
* FormTabular.C: used it.
2001-03-05 Angus Leeming <a.leeming@ic.ac.uk>
* FormPreferences.C: removed three unused using directives.
2001-02-27 Dekel Tsur <dekelts@tau.ac.il> 2001-02-27 Dekel Tsur <dekelts@tau.ac.il>
* FormRef.C: Fixed the behaviour of Goto-Ref. * FormRef.C: Fixed the behaviour of Goto-Ref.

View File

@ -56,7 +56,7 @@ protected: // methods
virtual ~FormBase(); virtual ~FormBase();
/** Redraw the form (on receipt of a Signal indicating, for example, /** Redraw the form (on receipt of a Signal indicating, for example,
that the xform colors have been re-mapped). that the xforms colors have been re-mapped).
Must be virtual because dialogs with tabbed folders will need to Must be virtual because dialogs with tabbed folders will need to
redraw the form for each tab. redraw the form for each tab.
*/ */
@ -95,7 +95,7 @@ protected: // methods
virtual void restore() { virtual void restore() {
update(); update();
} }
/// Pointer to the actual instantiation of xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const = 0; virtual FL_FORM * form() const = 0;
/** Which LyXFunc do we use? /** Which LyXFunc do we use?

View File

@ -37,7 +37,7 @@ private:
virtual bool input(FL_OBJECT *,long); virtual bool input(FL_OBJECT *,long);
/// Apply from dialog (modify or create inset) /// Apply from dialog (modify or create inset)
virtual void apply(); virtual void apply();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// ///
FD_form_bibitem * build_bibitem(); FD_form_bibitem * build_bibitem();

View File

@ -37,7 +37,7 @@ private:
virtual bool input(FL_OBJECT *, long); virtual bool input(FL_OBJECT *, long);
/// Apply from dialog (modify or create inset) /// Apply from dialog (modify or create inset)
virtual void apply(); virtual void apply();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// ///
FD_form_bibtex * build_bibtex(); FD_form_bibtex * build_bibtex();

View File

@ -36,7 +36,7 @@ protected:
FD_form_browser * dialog_; FD_form_browser * dialog_;
private: private:
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Filter the inputs on callback from xforms /// Filter the inputs on callback from xforms
virtual bool input(FL_OBJECT *, long); virtual bool input(FL_OBJECT *, long);

View File

@ -45,7 +45,7 @@ private:
/// Update the popup. /// Update the popup.
virtual void update(); virtual void update();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
FD_form_character * build_character(); FD_form_character * build_character();

View File

@ -24,6 +24,7 @@
#include "form_citation.h" #include "form_citation.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "xforms_helpers.h"
using std::find; using std::find;
using std::max; using std::max;
@ -164,65 +165,22 @@ void FormCitation::updateBrowser(FL_OBJECT * browser,
void FormCitation::setBibButtons(State status) const void FormCitation::setBibButtons(State status) const
{ {
switch (status) { setEnabled(dialog_->button_add, (status == ON));
case ON:
fl_activate_object(dialog_->button_add);
fl_set_object_lcol(dialog_->button_add, FL_BLACK);
break;
case OFF:
fl_deactivate_object(dialog_->button_add);
fl_set_object_lcol(dialog_->button_add, FL_INACTIVE);
break;
default:
break;
}
} }
void FormCitation::setCiteButtons(State status) const void FormCitation::setCiteButtons(State status) const
{ {
switch (status) { int const sel = fl_get_browser(dialog_->browser_cite);
case ON: int const maxline = fl_get_browser_maxline(dialog_->browser_cite);
{
fl_activate_object(dialog_->button_del);
fl_set_object_lcol(dialog_->button_del, FL_BLACK);
int sel = fl_get_browser(dialog_->browser_cite); bool const activate = (status == ON);
bool const activate_up = (activate && sel != 1);
bool const activate_down = (activate && sel != maxline);
if (sel != 1) { setEnabled(dialog_->button_del, activate);
fl_activate_object(dialog_->button_up); setEnabled(dialog_->button_up, activate_up);
fl_set_object_lcol(dialog_->button_up, FL_BLACK); setEnabled(dialog_->button_down, activate_down);
} else {
fl_deactivate_object(dialog_->button_up);
fl_set_object_lcol(dialog_->button_up, FL_INACTIVE);
}
if (sel != fl_get_browser_maxline(dialog_->browser_cite)) {
fl_activate_object(dialog_->button_down);
fl_set_object_lcol(dialog_->button_down, FL_BLACK);
} else {
fl_deactivate_object(dialog_->button_down);
fl_set_object_lcol(dialog_->button_down, FL_INACTIVE);
}
break;
}
case OFF:
{
fl_deactivate_object(dialog_->button_del);
fl_set_object_lcol(dialog_->button_del, FL_INACTIVE);
fl_deactivate_object(dialog_->button_up);
fl_set_object_lcol(dialog_->button_up, FL_INACTIVE);
fl_deactivate_object(dialog_->button_down);
fl_set_object_lcol(dialog_->button_down, FL_INACTIVE);
}
default:
break;
}
} }

View File

@ -47,7 +47,7 @@ private:
virtual void update(); virtual void update();
/// Apply from dialog (modify or create inset) /// Apply from dialog (modify or create inset)
virtual void apply(); virtual void apply();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// ///

View File

@ -14,7 +14,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "form_copyright.h" #include "form_copyright.h"
#include "FormCopyright.h" #include "FormCopyright.h"
#include "xform_helpers.h" #include "xforms_helpers.h"
FormCopyright::FormCopyright( LyXView * lv, Dialogs * d ) FormCopyright::FormCopyright( LyXView * lv, Dialogs * d )
: FormBaseBI(lv, d, _("Copyright and Warranty"), new OkCancelPolicy), : FormBaseBI(lv, d, _("Copyright and Warranty"), new OkCancelPolicy),

View File

@ -37,7 +37,7 @@ public:
private: private:
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Fdesign generated method /// Fdesign generated method
FD_form_copyright * build_copyright(); FD_form_copyright * build_copyright();

View File

@ -37,6 +37,7 @@
#include "Liason.h" #include "Liason.h"
#include "CutAndPaste.h" #include "CutAndPaste.h"
#include "bufferview_funcs.h" #include "bufferview_funcs.h"
#include "xforms_helpers.h"
#ifdef CXX_WORKING_NAMESPACES #ifdef CXX_WORKING_NAMESPACES
using Liason::setMinibuffer; using Liason::setMinibuffer;
@ -796,14 +797,10 @@ void FormDocument::bullets_update(BufferParams const & params)
if (!bullets_ || ((XpmVersion<4) || (XpmVersion==4 && XpmRevision<7))) if (!bullets_ || ((XpmVersion<4) || (XpmVersion==4 && XpmRevision<7)))
return; return;
if (lv_->buffer()->isLinuxDoc()) { bool const isLinuxDoc = lv_->buffer()->isLinuxDoc();
fl_deactivate_object(fbullet); setEnabled(fbullet, !isLinuxDoc);
fl_set_object_lcol(fbullet, FL_INACTIVE);
return; if (isLinuxDoc) return;
} else {
fl_activate_object(fbullet);
fl_set_object_lcol(fbullet, FL_BLACK);
}
fl_set_button(bullets_->radio_bullet_depth_1, 1); fl_set_button(bullets_->radio_bullet_depth_1, 1);
fl_set_input(bullets_->input_bullet_latex, fl_set_input(bullets_->input_bullet_latex,

View File

@ -80,7 +80,7 @@ private:
BULLETBMTABLE BULLETBMTABLE
}; };
/** Redraw the form (on receipt of a Signal indicating, for example, /** Redraw the form (on receipt of a Signal indicating, for example,
that the xform colours have been re-mapped). */ that the xforms colours have been re-mapped). */
virtual void redraw(); virtual void redraw();
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();

View File

@ -39,7 +39,7 @@ private:
virtual void update(); virtual void update();
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Fdesign generated method /// Fdesign generated method
FD_form_error * build_error(); FD_form_error * build_error();

View File

@ -20,7 +20,7 @@
#include "support/lstrings.h" // for strToDbl & tostr #include "support/lstrings.h" // for strToDbl & tostr
#include "support/FileInfo.h" // for FileInfo #include "support/FileInfo.h" // for FileInfo
#include "xform_helpers.h" // for browseFile #include "xforms_helpers.h" // for browseFile
#include "support/filetools.h" // for AddName #include "support/filetools.h" // for AddName
#include "insets/insetgraphics.h" #include "insets/insetgraphics.h"
#include "insets/insetgraphicsParams.h" #include "insets/insetgraphicsParams.h"

View File

@ -91,7 +91,7 @@ private:
/// Open the file browse dialog to select an image file. /// Open the file browse dialog to select an image file.
void browse(); void browse();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Fdesign generated method /// Fdesign generated method
FD_form_graphics * build_graphics(); FD_form_graphics * build_graphics();

View File

@ -24,6 +24,7 @@
#include "buffer.h" #include "buffer.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "xforms_helpers.h"
#include "form_include.h" #include "form_include.h"
@ -198,15 +199,13 @@ bool FormInclude::input(FL_OBJECT *, long data)
break; break;
case VERBATIM: case VERBATIM:
fl_activate_object(dialog_->flag41); setEnabled(dialog_->flag41, true);
fl_set_object_lcol(dialog_->flag41, FL_BLACK);
break; break;
case INPUTINCLUDE: case INPUTINCLUDE:
cout << "inputinclude" << endl; cout << "inputinclude" << endl;
/* huh ? why doesn't this work ? */ /* huh ? why doesn't this work ? */
fl_deactivate_object(dialog_->flag41); setEnabled(dialog_->flag41, false);
fl_set_object_lcol(dialog_->flag41, FL_INACTIVE);
fl_set_button(dialog_->flag41, 0); fl_set_button(dialog_->flag41, 0);
break; break;
} }

View File

@ -48,7 +48,7 @@ private:
virtual void update(); virtual void update();
/// Apply from dialog (modify or create inset) /// Apply from dialog (modify or create inset)
virtual void apply(); virtual void apply();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Type definition from the fdesign produced header file. /// Type definition from the fdesign produced header file.

View File

@ -36,7 +36,7 @@ private:
virtual void update(); virtual void update();
/// Apply from dialog (modify or create inset) /// Apply from dialog (modify or create inset)
virtual void apply(); virtual void apply();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// ///
FD_form_index * build_index(); FD_form_index * build_index();

View File

@ -24,6 +24,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "buffer.h" #include "buffer.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "xforms_helpers.h"
#ifdef CXX_WORKING_NAMESPACES #ifdef CXX_WORKING_NAMESPACES
using Liason::setMinibuffer; using Liason::setMinibuffer;
@ -441,19 +442,17 @@ void FormParagraph::general_update()
added_space_bottom.keep()); added_space_bottom.keep());
fl_set_button(general_->check_noindent, fl_set_button(general_->check_noindent,
text->cursor.par()->FirstPhysicalPar()->noindent); text->cursor.par()->FirstPhysicalPar()->noindent);
if (text->cursor.par()->FirstPhysicalPar()->InInset()) {
fl_set_button(general_->check_pagebreaks_top, 0); bool const enable = (!text->cursor.par()->FirstPhysicalPar()->InInset());
fl_deactivate_object(general_->check_pagebreaks_top);
fl_set_object_lcol(general_->check_pagebreaks_top, FL_INACTIVE); setEnabled(general_->check_pagebreaks_top, enable);
fl_set_button(general_->check_pagebreaks_bottom, 0); setEnabled(general_->check_pagebreaks_bottom, enable);
fl_deactivate_object(general_->check_pagebreaks_bottom);
fl_set_object_lcol(general_->check_pagebreaks_bottom, FL_INACTIVE); if (!enable) {
} else { fl_set_button(general_->check_pagebreaks_top, 0);
fl_activate_object(general_->check_pagebreaks_top); fl_set_button(general_->check_pagebreaks_bottom, 0);
fl_set_object_lcol(general_->check_pagebreaks_top, FL_BLACK);
fl_activate_object(general_->check_pagebreaks_bottom);
fl_set_object_lcol(general_->check_pagebreaks_bottom, FL_BLACK);
} }
#else #else
fl_set_input(general_->input_space_below, text->cursor.par()-> fl_set_input(general_->input_space_below, text->cursor.par()->
added_space_bottom.length().asString().c_str()); added_space_bottom.length().asString().c_str());
@ -474,10 +473,9 @@ void FormParagraph::extra_update()
LyXParagraph * par = lv_->view()->text->cursor.par(); LyXParagraph * par = lv_->view()->text->cursor.par();
fl_activate_object(extra_->input_pextra_width); setEnabled(extra_->input_pextra_width, true);
fl_set_object_lcol(extra_->input_pextra_width, FL_BLACK); setEnabled(extra_->input_pextra_widthp, true);
fl_activate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_BLACK);
fl_set_input(extra_->input_pextra_width, fl_set_input(extra_->input_pextra_width,
par->pextra_width.c_str()); par->pextra_width.c_str());
fl_set_input(extra_->input_pextra_widthp, fl_set_input(extra_->input_pextra_widthp,
@ -501,49 +499,35 @@ void FormParagraph::extra_update()
fl_set_button(extra_->radio_pextra_indent, 1); fl_set_button(extra_->radio_pextra_indent, 1);
fl_set_button(extra_->radio_pextra_minipage, 0); fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0); fl_set_button(extra_->radio_pextra_floatflt, 0);
fl_deactivate_object(extra_->radio_pextra_top); setEnabled(extra_->radio_pextra_top, false);
fl_set_object_lcol(extra_->radio_pextra_top, FL_INACTIVE); setEnabled(extra_->radio_pextra_middle, false);
fl_deactivate_object(extra_->radio_pextra_middle); setEnabled(extra_->radio_pextra_bottom, false);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_bottom);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE);
input(extra_->radio_pextra_indent, 0); input(extra_->radio_pextra_indent, 0);
} else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) { } else if (par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) {
fl_set_button(extra_->radio_pextra_indent, 0); fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 1); fl_set_button(extra_->radio_pextra_minipage, 1);
fl_set_button(extra_->radio_pextra_floatflt, 0); fl_set_button(extra_->radio_pextra_floatflt, 0);
fl_activate_object(extra_->radio_pextra_top); setEnabled(extra_->radio_pextra_top, true);
fl_set_object_lcol(extra_->radio_pextra_top, FL_BLACK); setEnabled(extra_->radio_pextra_middle, true);
fl_activate_object(extra_->radio_pextra_middle); setEnabled(extra_->radio_pextra_bottom, true);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_BLACK);
fl_activate_object(extra_->radio_pextra_bottom);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_BLACK);
input(extra_->radio_pextra_minipage, 0); input(extra_->radio_pextra_minipage, 0);
} else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) { } else if (par->pextra_type == LyXParagraph::PEXTRA_FLOATFLT) {
fl_set_button(extra_->radio_pextra_indent, 0); fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0); fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 1); fl_set_button(extra_->radio_pextra_floatflt, 1);
fl_deactivate_object(extra_->radio_pextra_top); setEnabled(extra_->radio_pextra_top, false);
fl_set_object_lcol(extra_->radio_pextra_top, FL_INACTIVE); setEnabled(extra_->radio_pextra_middle, false);
fl_deactivate_object(extra_->radio_pextra_middle); setEnabled(extra_->radio_pextra_bottom, false);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_bottom);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE);
input(extra_->radio_pextra_floatflt, 0); input(extra_->radio_pextra_floatflt, 0);
} else { } else {
fl_set_button(extra_->radio_pextra_indent, 0); fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0); fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0); fl_set_button(extra_->radio_pextra_floatflt, 0);
fl_deactivate_object(extra_->input_pextra_width); setEnabled(extra_->input_pextra_width, false);
fl_set_object_lcol(extra_->input_pextra_width, FL_INACTIVE); setEnabled(extra_->input_pextra_widthp, false);
fl_deactivate_object(extra_->input_pextra_widthp); setEnabled(extra_->radio_pextra_top, false);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_INACTIVE); setEnabled(extra_->radio_pextra_middle, false);
fl_deactivate_object(extra_->radio_pextra_top); setEnabled(extra_->radio_pextra_bottom, false);
fl_set_object_lcol(extra_->radio_pextra_top, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_middle);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_bottom);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE);
input(0, 0); input(0, 0);
} }
fl_hide_object(dialog_->text_warning); fl_hide_object(dialog_->text_warning);
@ -574,90 +558,53 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
// then the extra form // then the extra form
// //
if (ob == extra_->radio_pextra_indent) { if (ob == extra_->radio_pextra_indent) {
int n = fl_get_button(extra_->radio_pextra_indent); bool const enable = (fl_get_button(extra_->radio_pextra_indent) != 0);
if (n) {
if (enable) {
fl_set_button(extra_->radio_pextra_minipage, 0); fl_set_button(extra_->radio_pextra_minipage, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0); fl_set_button(extra_->radio_pextra_floatflt, 0);
fl_activate_object(extra_->input_pextra_width);
fl_set_object_lcol(extra_->input_pextra_width, FL_BLACK);
fl_activate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_BLACK);
} else {
fl_deactivate_object(extra_->input_pextra_width);
fl_set_object_lcol(extra_->input_pextra_width, FL_INACTIVE);
fl_deactivate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_INACTIVE);
} }
fl_deactivate_object(extra_->radio_pextra_top);
fl_set_object_lcol(extra_->radio_pextra_top, FL_INACTIVE); setEnabled(extra_->input_pextra_width, enable);
fl_deactivate_object(extra_->radio_pextra_middle); setEnabled(extra_->input_pextra_widthp, enable);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_bottom); setEnabled(extra_->radio_pextra_top, false);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE); setEnabled(extra_->radio_pextra_middle, false);
fl_activate_object(extra_->radio_pextra_hfill); setEnabled(extra_->radio_pextra_bottom, false);
fl_set_object_lcol(extra_->radio_pextra_hfill, FL_INACTIVE); setEnabled(extra_->radio_pextra_hfill, false);
fl_activate_object(extra_->radio_pextra_startmp); setEnabled(extra_->radio_pextra_startmp, false);
fl_set_object_lcol(extra_->radio_pextra_startmp, FL_INACTIVE);
} else if (ob == extra_->radio_pextra_minipage) { } else if (ob == extra_->radio_pextra_minipage) {
int n = fl_get_button(extra_->radio_pextra_minipage); bool const enable = (fl_get_button(extra_->radio_pextra_minipage) != 0);
if (n) {
if (enable) {
fl_set_button(extra_->radio_pextra_indent, 0); fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_floatflt, 0); fl_set_button(extra_->radio_pextra_floatflt, 0);
fl_activate_object(extra_->input_pextra_width);
fl_set_object_lcol(extra_->input_pextra_width, FL_BLACK);
fl_activate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_BLACK);
fl_activate_object(extra_->radio_pextra_top);
fl_set_object_lcol(extra_->radio_pextra_top, FL_BLACK);
fl_activate_object(extra_->radio_pextra_middle);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_BLACK);
fl_activate_object(extra_->radio_pextra_bottom);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_BLACK);
fl_activate_object(extra_->radio_pextra_hfill);
fl_set_object_lcol(extra_->radio_pextra_hfill, FL_BLACK);
fl_activate_object(extra_->radio_pextra_startmp);
fl_set_object_lcol(extra_->radio_pextra_startmp, FL_BLACK);
} else {
fl_deactivate_object(extra_->input_pextra_width);
fl_set_object_lcol(extra_->input_pextra_width, FL_INACTIVE);
fl_deactivate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_top);
fl_set_object_lcol(extra_->radio_pextra_top, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_middle);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_bottom);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE);
fl_activate_object(extra_->radio_pextra_hfill);
fl_set_object_lcol(extra_->radio_pextra_hfill, FL_INACTIVE);
fl_activate_object(extra_->radio_pextra_startmp);
fl_set_object_lcol(extra_->radio_pextra_startmp, FL_INACTIVE);
} }
setEnabled(extra_->input_pextra_width, enable);
setEnabled(extra_->input_pextra_widthp, enable);
setEnabled(extra_->radio_pextra_top, enable);
setEnabled(extra_->radio_pextra_middle, enable);
setEnabled(extra_->radio_pextra_bottom, enable);
setEnabled(extra_->radio_pextra_hfill, enable);
setEnabled(extra_->radio_pextra_startmp, enable);
} else if (ob == extra_->radio_pextra_floatflt) { } else if (ob == extra_->radio_pextra_floatflt) {
int n = fl_get_button(extra_->radio_pextra_floatflt); bool const enable = (fl_get_button(extra_->radio_pextra_floatflt) != 0);
if (n) {
if (enable) {
fl_set_button(extra_->radio_pextra_indent, 0); fl_set_button(extra_->radio_pextra_indent, 0);
fl_set_button(extra_->radio_pextra_minipage, 0); fl_set_button(extra_->radio_pextra_minipage, 0);
fl_activate_object(extra_->input_pextra_width);
fl_set_object_lcol(extra_->input_pextra_width, FL_BLACK);
fl_activate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_BLACK);
} else {
fl_deactivate_object(extra_->input_pextra_width);
fl_set_object_lcol(extra_->input_pextra_width, FL_INACTIVE);
fl_deactivate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_INACTIVE);
} }
fl_deactivate_object(extra_->radio_pextra_top);
fl_set_object_lcol(extra_->radio_pextra_top, FL_INACTIVE); setEnabled(extra_->input_pextra_width, enable);
fl_deactivate_object(extra_->radio_pextra_middle); setEnabled(extra_->input_pextra_widthp, enable);
fl_set_object_lcol(extra_->radio_pextra_middle, FL_INACTIVE);
fl_deactivate_object(extra_->radio_pextra_bottom); setEnabled(extra_->radio_pextra_top, false);
fl_set_object_lcol(extra_->radio_pextra_bottom, FL_INACTIVE); setEnabled(extra_->radio_pextra_middle, false);
fl_activate_object(extra_->radio_pextra_hfill); setEnabled(extra_->radio_pextra_bottom, false);
fl_set_object_lcol(extra_->radio_pextra_hfill, FL_INACTIVE); setEnabled(extra_->radio_pextra_hfill, false);
fl_activate_object(extra_->radio_pextra_startmp); setEnabled(extra_->radio_pextra_startmp, false);
fl_set_object_lcol(extra_->radio_pextra_startmp, FL_INACTIVE);
} }
// //
@ -695,23 +642,17 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
string s1 = fl_get_input(extra_->input_pextra_width); string s1 = fl_get_input(extra_->input_pextra_width);
string s2 = fl_get_input(extra_->input_pextra_widthp); string s2 = fl_get_input(extra_->input_pextra_widthp);
if (!n) { // no button pressed both should be deactivated now if (!n) { // no button pressed both should be deactivated now
fl_deactivate_object(extra_->input_pextra_width); setEnabled(extra_->input_pextra_width, false);
fl_set_object_lcol(extra_->input_pextra_width, FL_INACTIVE); setEnabled(extra_->input_pextra_widthp, false);
fl_deactivate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_INACTIVE);
fl_hide_object(dialog_->text_warning); fl_hide_object(dialog_->text_warning);
} else if (s1.empty() && s2.empty()) { } else if (s1.empty() && s2.empty()) {
fl_activate_object(extra_->input_pextra_width); setEnabled(extra_->input_pextra_width, true);
fl_set_object_lcol(extra_->input_pextra_width, FL_BLACK); setEnabled(extra_->input_pextra_widthp, true);
fl_activate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_BLACK);
fl_hide_object(dialog_->text_warning); fl_hide_object(dialog_->text_warning);
ret = false; ret = false;
} else if (!s1.empty()) { // LyXLength parameter } else if (!s1.empty()) { // LyXLength parameter
fl_activate_object(extra_->input_pextra_width); setEnabled(extra_->input_pextra_width, true);
fl_set_object_lcol(extra_->input_pextra_width, FL_BLACK); setEnabled(extra_->input_pextra_widthp, false);
fl_deactivate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_INACTIVE);
if (!isValidLength(s1)) { if (!isValidLength(s1)) {
fl_set_object_label(dialog_->text_warning, fl_set_object_label(dialog_->text_warning,
_("Warning: Invalid Length (valid example: 10mm)")); _("Warning: Invalid Length (valid example: 10mm)"));
@ -719,10 +660,8 @@ bool FormParagraph::input(FL_OBJECT * ob, long)
ret = false; ret = false;
} }
} else { // !s2.empty() % parameter } else { // !s2.empty() % parameter
fl_deactivate_object(extra_->input_pextra_width); setEnabled(extra_->input_pextra_width, false);
fl_set_object_lcol(extra_->input_pextra_width, FL_INACTIVE); setEnabled(extra_->input_pextra_widthp, true);
fl_activate_object(extra_->input_pextra_widthp);
fl_set_object_lcol(extra_->input_pextra_widthp, FL_BLACK);
if ((lyx::atoi(s2) < 0 ) || (lyx::atoi(s2) > 100)) { if ((lyx::atoi(s2) < 0 ) || (lyx::atoi(s2) > 100)) {
ret = false; ret = false;
fl_set_object_label(dialog_->text_warning, fl_set_object_label(dialog_->text_warning,

View File

@ -36,7 +36,7 @@ public:
private: private:
/** Redraw the form (on receipt of a Signal indicating, for example, /** Redraw the form (on receipt of a Signal indicating, for example,
that the xform colours have been re-mapped). */ that the xforms colours have been re-mapped). */
virtual void redraw(); virtual void redraw();
/// Build the popup /// Build the popup
virtual void build(); virtual void build();

View File

@ -17,6 +17,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "buffer.h" #include "buffer.h"
#include "gettext.h" #include "gettext.h"
#include "xforms_helpers.h"
#ifdef CXX_WORKING_NAMESPACES #ifdef CXX_WORKING_NAMESPACES
using Liason::setMinibuffer; using Liason::setMinibuffer;
@ -81,19 +82,11 @@ void FormPreamble::update()
return; return;
fl_set_input(dialog_->input_preamble,lv_->buffer()->params.preamble.c_str()); fl_set_input(dialog_->input_preamble,lv_->buffer()->params.preamble.c_str());
if (lv_->buffer()->isReadonly()) {
fl_deactivate_object(dialog_->input_preamble); bool const enable = (! lv_->buffer()->isReadonly());
fl_deactivate_object(dialog_->button_ok); setEnabled(dialog_->input_preamble, enable);
fl_deactivate_object(dialog_->button_apply); setEnabled(dialog_->button_ok, enable);
fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE); setEnabled(dialog_->button_apply, enable);
fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE);
} else {
fl_activate_object(dialog_->input_preamble);
fl_activate_object(dialog_->button_ok);
fl_activate_object(dialog_->button_apply);
fl_set_object_lcol(dialog_->button_ok, FL_BLACK);
fl_set_object_lcol(dialog_->button_apply, FL_BLACK);
}
// need this? // need this?
// bc_.readOnly(lv_->buffer()->isReadonly()); // bc_.readOnly(lv_->buffer()->isReadonly());

View File

@ -24,7 +24,7 @@ public:
private: private:
/** Redraw the form (on receipt of a Signal indicating, for example, /** Redraw the form (on receipt of a Signal indicating, for example,
* that the xform colours have been re-mapped). * that the xforms colours have been re-mapped).
*/ */
/// Filter the inputs /// Filter the inputs

View File

@ -41,19 +41,16 @@
#include "lyx_gui_misc.h" // idex, scex #include "lyx_gui_misc.h" // idex, scex
#include "lyxlex.h" #include "lyxlex.h"
#include "input_validators.h" #include "input_validators.h"
#include "xform_helpers.h" #include "xforms_helpers.h"
#include "converter.h" #include "converter.h"
#include "support/lyxfunctional.h" #include "support/lyxfunctional.h"
#include "support/lyxmanip.h" #include "support/lyxmanip.h"
using std::endl; using std::endl;
using std::find;
using std::find_if;
using std::pair; using std::pair;
using std::make_pair; using std::make_pair;
using std::max; using std::max;
using std::min; using std::min;
using std::sort;
using std::vector; using std::vector;
extern string system_lyxdir; extern string system_lyxdir;
@ -155,10 +152,10 @@ void FormPreferences::ok()
{ {
FormBase::ok(); FormBase::ok();
if (colors_.modifiedXformPrefs) { if (colors_.modifiedXformsPrefs) {
string const filename = string const filename =
AddName(user_lyxdir, "preferences.xform"); AddName(user_lyxdir, "preferences.xform");
colors_.modifiedXformPrefs = !XformColor::write(filename); colors_.modifiedXformsPrefs = !XformsColor::write(filename);
} }
lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES); lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES);
@ -411,12 +408,12 @@ void FormPreferences::Colors::apply()
bool modifiedText = false; bool modifiedText = false;
bool modifiedBackground = false; bool modifiedBackground = false;
for (vector<XformColor>::const_iterator cit = xformColorDB.begin(); for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
cit != xformColorDB.end(); ++cit) { cit != xformsColorDB.end(); ++cit) {
RGBColor col; RGBColor col;
fl_getmcolor((*cit).colorID, &col.r, &col.g, &col.b); fl_getmcolor((*cit).colorID, &col.r, &col.g, &col.b);
if (col != (*cit).color()) { if (col != (*cit).color()) {
modifiedXformPrefs = true; modifiedXformsPrefs = true;
if ((*cit).colorID == FL_BLACK) if ((*cit).colorID == FL_BLACK)
modifiedText = true; modifiedText = true;
if ((*cit).colorID == FL_COL1) if ((*cit).colorID == FL_COL1)
@ -424,10 +421,10 @@ void FormPreferences::Colors::apply()
} }
} }
if (modifiedXformPrefs) { if (modifiedXformsPrefs) {
for (vector<XformColor>::const_iterator cit = for (vector<XformsColor>::const_iterator cit =
xformColorDB.begin(); xformsColorDB.begin();
cit != xformColorDB.end(); ++cit) { cit != xformsColorDB.end(); ++cit) {
fl_mapcolor((*cit).colorID, fl_mapcolor((*cit).colorID,
(*cit).r, (*cit).g, (*cit).b); (*cit).r, (*cit).g, (*cit).b);
@ -599,14 +596,14 @@ void FormPreferences::Colors::InputBrowserLyX() const
// Is the choice an Xforms color... // Is the choice an Xforms color...
RGBColor col; RGBColor col;
if( selLyX-1 < xformColorDB.size() ) { if( selLyX-1 < xformsColorDB.size() ) {
vector<XformColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
col = xformColorDB[i].color(); col = xformsColorDB[i].color();
} }
// or a LyX Logical color? // or a LyX Logical color?
else { else {
vector<NamedColor>::size_type const i = selLyX - 1 - vector<NamedColor>::size_type const i = selLyX - 1 -
xformColorDB.size(); xformsColorDB.size();
col = lyxColorDB[i].color(); col = lyxColorDB[i].color();
} }
@ -619,8 +616,7 @@ void FormPreferences::Colors::InputBrowserLyX() const
SwitchColorSpace(); SwitchColorSpace();
// Deactivate the modify button to begin with... // Deactivate the modify button to begin with...
fl_deactivate_object(dialog_->button_modify); setEnabled(dialog_->button_modify, false);
fl_set_object_lcol(dialog_->button_modify, FL_INACTIVE);
fl_unfreeze_form(dialog_->form); fl_unfreeze_form(dialog_->form);
} }
@ -663,24 +659,18 @@ void FormPreferences::Colors::InputHSV()
bool modify = false; bool modify = false;
// Is the choice an Xforms color... // Is the choice an Xforms color...
if( selLyX-1 < xformColorDB.size() ) { if( selLyX-1 < xformsColorDB.size() ) {
vector<XformColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
modify = (xformColorDB[i].color() != col); modify = (xformsColorDB[i].color() != col);
} }
// or a LyX Logical color? // or a LyX Logical color?
else { else {
vector<NamedColor>::size_type const i = selLyX - 1 - vector<NamedColor>::size_type const i = selLyX - 1 -
xformColorDB.size(); xformsColorDB.size();
modify = (lyxColorDB[i].color() != col); modify = (lyxColorDB[i].color() != col);
} }
if (modify) { setEnabled(dialog_->button_modify, modify);
fl_activate_object(dialog_->button_modify);
fl_set_object_lcol(dialog_->button_modify, FL_BLACK);
} else {
fl_deactivate_object(dialog_->button_modify);
fl_set_object_lcol(dialog_->button_modify, FL_INACTIVE);
}
} }
@ -710,24 +700,18 @@ void FormPreferences::Colors::InputRGB()
bool modify = false; bool modify = false;
// Is the choice an Xforms color... // Is the choice an Xforms color...
if( selLyX-1 < xformColorDB.size() ) { if( selLyX-1 < xformsColorDB.size() ) {
vector<XformColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
modify = (xformColorDB[i].color() != col); modify = (xformsColorDB[i].color() != col);
} }
// or a LyX Logical color? // or a LyX Logical color?
else { else {
vector<NamedColor>::size_type const i = selLyX - 1 - vector<NamedColor>::size_type const i = selLyX - 1 -
xformColorDB.size(); xformsColorDB.size();
modify = (lyxColorDB[i].color() != col); modify = (lyxColorDB[i].color() != col);
} }
if (modify) { setEnabled(dialog_->button_modify, modify);
fl_activate_object(dialog_->button_modify);
fl_set_object_lcol(dialog_->button_modify, FL_BLACK);
} else {
fl_deactivate_object(dialog_->button_modify);
fl_set_object_lcol(dialog_->button_modify, FL_INACTIVE);
}
} }
@ -735,15 +719,15 @@ void FormPreferences::Colors::LoadBrowserLyX()
{ {
if (!dialog_->browser_lyx_objs->visible) return; if (!dialog_->browser_lyx_objs->visible) return;
// First, define the modifiable xform colors // First, define the modifiable xforms colors
xformColorDB.clear(); xformsColorDB.clear();
XformColor xcol; XformsColor xcol;
xcol.name = _("GUI background"); xcol.name = _("GUI background");
xcol.colorID = FL_COL1; xcol.colorID = FL_COL1;
fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b); fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
xformColorDB.push_back(xcol); xformsColorDB.push_back(xcol);
xcol.name = _("GUI text"); xcol.name = _("GUI text");
xcol.colorID = FL_BLACK; xcol.colorID = FL_BLACK;
@ -752,19 +736,19 @@ void FormPreferences::Colors::LoadBrowserLyX()
fl_mapcolor(GUI_COLOR_CURSOR, xcol.r, xcol.g, xcol.b); fl_mapcolor(GUI_COLOR_CURSOR, xcol.r, xcol.g, xcol.b);
fl_set_cursor_color(FL_DEFAULT_CURSOR, GUI_COLOR_CURSOR, FL_WHITE); fl_set_cursor_color(FL_DEFAULT_CURSOR, GUI_COLOR_CURSOR, FL_WHITE);
xformColorDB.push_back(xcol); xformsColorDB.push_back(xcol);
xcol.name = _("GUI selection"); xcol.name = _("GUI selection");
xcol.colorID = FL_YELLOW; xcol.colorID = FL_YELLOW;
fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b); fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
xformColorDB.push_back(xcol); xformsColorDB.push_back(xcol);
xcol.name = _("GUI pointer"); xcol.name = _("GUI pointer");
xcol.colorID = GUI_COLOR_CURSOR; xcol.colorID = GUI_COLOR_CURSOR;
fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b); fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
xformColorDB.push_back(xcol); xformsColorDB.push_back(xcol);
// Now create the the LyX LColors database // Now create the the LyX LColors database
lyxColorDB.clear(); lyxColorDB.clear();
@ -831,8 +815,8 @@ void FormPreferences::Colors::LoadBrowserLyX()
FL_OBJECT * colbr = dialog_->browser_lyx_objs; FL_OBJECT * colbr = dialog_->browser_lyx_objs;
fl_freeze_form(dialog_->form); fl_freeze_form(dialog_->form);
fl_clear_browser(colbr); fl_clear_browser(colbr);
for (vector<XformColor>::const_iterator cit = xformColorDB.begin(); for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
cit != xformColorDB.end(); ++cit) { cit != xformsColorDB.end(); ++cit) {
fl_addto_browser(colbr, (*cit).getname().c_str()); fl_addto_browser(colbr, (*cit).getname().c_str());
} }
for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin(); for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
@ -859,26 +843,23 @@ void FormPreferences::Colors::Modify()
fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b); fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
// Is the choice an Xforms color... // Is the choice an Xforms color...
if( selLyX-1 < xformColorDB.size() ) { if( selLyX-1 < xformsColorDB.size() ) {
vector<XformColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
xformColorDB[i].r = col.r; xformsColorDB[i].r = col.r;
xformColorDB[i].g = col.g; xformsColorDB[i].g = col.g;
xformColorDB[i].b = col.b; xformsColorDB[i].b = col.b;
} }
// or a LyX Logical color? // or a LyX Logical color?
else { else {
vector<NamedColor>::size_type const i = selLyX - 1 - vector<NamedColor>::size_type const i = selLyX - 1 -
xformColorDB.size(); xformsColorDB.size();
lyxColorDB[i].r = col.r; lyxColorDB[i].r = col.r;
lyxColorDB[i].g = col.g; lyxColorDB[i].g = col.g;
lyxColorDB[i].b = col.b; lyxColorDB[i].b = col.b;
} }
fl_freeze_form(dialog_->form); fl_freeze_form(dialog_->form);
setEnabled(dialog_->button_modify, false);
fl_deactivate_object(dialog_->button_modify);
fl_set_object_lcol(dialog_->button_modify, FL_INACTIVE);
fl_unfreeze_form(dialog_->form); fl_unfreeze_form(dialog_->form);
} }
@ -1083,8 +1064,7 @@ bool FormPreferences::Converters::Add()
local_converters.UpdateLast(local_formats); local_converters.UpdateLast(local_formats);
UpdateBrowser(); UpdateBrowser();
} }
fl_deactivate_object(dialog_->button_add); setEnabled(dialog_->button_add, false);
fl_set_object_lcol(dialog_->button_add, FL_INACTIVE);
return true; return true;
} }
@ -1113,11 +1093,8 @@ bool FormPreferences::Converters::Browser()
fl_set_button_shortcut(dialog_->button_add, fl_set_button_shortcut(dialog_->button_add,
scex(_("Modify|#M")), 1); scex(_("Modify|#M")), 1);
fl_deactivate_object(dialog_->button_add); setEnabled(dialog_->button_add, false);
fl_set_object_lcol(dialog_->button_add, FL_INACTIVE); setEnabled(dialog_->button_delete, true);
fl_activate_object(dialog_->button_delete);
fl_set_object_lcol(dialog_->button_delete, FL_BLACK);
fl_unfreeze_form(dialog_->form); fl_unfreeze_form(dialog_->form);
return false; return false;
@ -1150,9 +1127,7 @@ bool FormPreferences::Converters::Input()
scex(_("Add|#A")), 1); scex(_("Add|#A")), 1);
fl_deselect_browser(dialog_->browser_all); fl_deselect_browser(dialog_->browser_all);
setEnabled(dialog_->button_delete, false);
fl_deactivate_object(dialog_->button_delete);
fl_set_object_lcol(dialog_->button_delete, FL_INACTIVE);
} else { } else {
fl_set_object_label(dialog_->button_add, fl_set_object_label(dialog_->button_add,
@ -1163,19 +1138,12 @@ bool FormPreferences::Converters::Input()
int top = max(sel-5, 0); int top = max(sel-5, 0);
fl_set_browser_topline(dialog_->browser_all, top); fl_set_browser_topline(dialog_->browser_all, top);
fl_select_browser_line(dialog_->browser_all, sel+1); fl_select_browser_line(dialog_->browser_all, sel+1);
setEnabled(dialog_->button_delete, true);
fl_activate_object(dialog_->button_delete);
fl_set_object_lcol(dialog_->button_delete, FL_BLACK);
} }
string const command = fl_get_input(dialog_->input_converter); string const command = fl_get_input(dialog_->input_converter);
if (command.empty() || from == to) { bool const enable = !(command.empty() || from == to);
fl_deactivate_object(dialog_->button_add); setEnabled(dialog_->button_add, enable);
fl_set_object_lcol(dialog_->button_add, FL_INACTIVE);
} else {
fl_activate_object(dialog_->button_add);
fl_set_object_lcol(dialog_->button_add, FL_BLACK);
}
fl_unfreeze_form(dialog_->form); fl_unfreeze_form(dialog_->form);
return false; return false;
@ -1367,8 +1335,7 @@ bool FormPreferences::Formats::Add()
if (old) if (old)
parent_.converters_.UpdateBrowser(); parent_.converters_.UpdateBrowser();
} }
fl_deactivate_object(dialog_->button_add); setEnabled(dialog_->button_add, false);
fl_set_object_lcol(dialog_->button_add, FL_INACTIVE);
return true; return true;
} }
@ -1392,11 +1359,8 @@ bool FormPreferences::Formats::Browser()
fl_set_object_label(dialog_->button_add, idex(_("Modify|#M"))); fl_set_object_label(dialog_->button_add, idex(_("Modify|#M")));
fl_set_button_shortcut(dialog_->button_add, scex(_("Modify|#M")), 1); fl_set_button_shortcut(dialog_->button_add, scex(_("Modify|#M")), 1);
fl_deactivate_object(dialog_->button_add); setEnabled(dialog_->button_add, false);
fl_set_object_lcol(dialog_->button_add, FL_INACTIVE); setEnabled(dialog_->button_delete, true);
fl_activate_object(dialog_->button_delete);
fl_set_object_lcol(dialog_->button_delete, FL_BLACK);
fl_unfreeze_form(dialog_->form); fl_unfreeze_form(dialog_->form);
return false; return false;
@ -1409,8 +1373,7 @@ bool FormPreferences::Formats::Delete()
if (local_converters.FormatIsUsed(name)) { if (local_converters.FormatIsUsed(name)) {
parent_.printWarning(_("Cannot remove a Format used by a Converter. Remove the converter first.")); parent_.printWarning(_("Cannot remove a Format used by a Converter. Remove the converter first."));
fl_deactivate_object(dialog_->button_delete); setEnabled(dialog_->button_delete, false);
fl_set_object_lcol(dialog_->button_delete, FL_INACTIVE);
return false; return false;
} }
@ -1433,9 +1396,7 @@ bool FormPreferences::Formats::Input()
scex(_("Add|#A")), 1); scex(_("Add|#A")), 1);
fl_deselect_browser(dialog_->browser_all); fl_deselect_browser(dialog_->browser_all);
setEnabled(dialog_->button_delete, false);
fl_deactivate_object(dialog_->button_delete);
fl_set_object_lcol(dialog_->button_delete, FL_INACTIVE);
} else { } else {
fl_set_object_label(dialog_->button_add, fl_set_object_label(dialog_->button_add,
@ -1447,21 +1408,13 @@ bool FormPreferences::Formats::Input()
fl_set_browser_topline(dialog_->browser_all, top); fl_set_browser_topline(dialog_->browser_all, top);
fl_select_browser_line(dialog_->browser_all, sel+1); fl_select_browser_line(dialog_->browser_all, sel+1);
fl_activate_object(dialog_->button_add); setEnabled(dialog_->button_add, true);
fl_set_object_lcol(dialog_->button_add, FL_BLACK); setEnabled(dialog_->button_delete, true);
fl_activate_object(dialog_->button_delete);
fl_set_object_lcol(dialog_->button_delete, FL_BLACK);
} }
string const prettyname = fl_get_input(dialog_->input_gui_name); string const prettyname = fl_get_input(dialog_->input_gui_name);
if (name.empty() || prettyname.empty()) { bool const enable = !(name.empty() || prettyname.empty());
fl_deactivate_object(dialog_->button_add); setEnabled(dialog_->button_add, enable);
fl_set_object_lcol(dialog_->button_add, FL_INACTIVE);
} else {
fl_activate_object(dialog_->button_add);
fl_set_object_lcol(dialog_->button_add, FL_BLACK);
}
fl_unfreeze_form(dialog_->form); fl_unfreeze_form(dialog_->form);
return false; return false;
@ -1774,35 +1727,11 @@ bool FormPreferences::Language::input(FL_OBJECT const * const ob)
// objects, // objects,
// otherwise the function is called by an xforms CB via input(). // otherwise the function is called by an xforms CB via input().
if (!ob || ob == dialog_->check_use_kbmap) { if (!ob || ob == dialog_->check_use_kbmap) {
if (fl_get_button(dialog_->check_use_kbmap)) { bool const enable = fl_get_button(dialog_->check_use_kbmap);
fl_activate_object(dialog_->button_kbmap1_browse); setEnabled(dialog_->button_kbmap1_browse, enable);
fl_set_object_lcol(dialog_->button_kbmap1_browse, setEnabled(dialog_->button_kbmap2_browse, enable);
FL_BLACK); setEnabled(dialog_->input_kbmap1, enable);
setEnabled(dialog_->input_kbmap2, enable);
fl_activate_object(dialog_->button_kbmap2_browse);
fl_set_object_lcol(dialog_->button_kbmap2_browse,
FL_BLACK);
fl_activate_object(dialog_->input_kbmap1);
fl_set_object_lcol(dialog_->input_kbmap1, FL_BLACK);
fl_activate_object(dialog_->input_kbmap2);
fl_set_object_lcol(dialog_->input_kbmap2, FL_BLACK);
} else {
fl_deactivate_object(dialog_->button_kbmap1_browse);
fl_set_object_lcol(dialog_->button_kbmap1_browse,
FL_INACTIVE);
fl_deactivate_object(dialog_->button_kbmap2_browse);
fl_set_object_lcol(dialog_->button_kbmap2_browse,
FL_INACTIVE);
fl_deactivate_object(dialog_->input_kbmap1);
fl_set_object_lcol(dialog_->input_kbmap1,
FL_INACTIVE);
fl_deactivate_object(dialog_->input_kbmap2);
fl_set_object_lcol(dialog_->input_kbmap2,
FL_INACTIVE);
}
} }
if (ob == dialog_->button_kbmap1_browse) { if (ob == dialog_->button_kbmap1_browse) {
@ -2148,39 +2077,18 @@ bool FormPreferences::Paths::input(FL_OBJECT const * const ob)
// objects, // objects,
// otherwise the function is called by an xforms CB via input(). // otherwise the function is called by an xforms CB via input().
if (!ob || ob == dialog_->check_use_temp_dir) { if (!ob || ob == dialog_->check_use_temp_dir) {
if (fl_get_button(dialog_->check_use_temp_dir)) { bool const enable = fl_get_button(dialog_->check_use_temp_dir);
fl_activate_object(dialog_->input_temp_dir); setEnabled(dialog_->input_temp_dir, enable);
fl_set_object_lcol(dialog_->input_temp_dir,
FL_BLACK);
} else {
fl_deactivate_object(dialog_->input_temp_dir);
fl_set_object_lcol(dialog_->input_temp_dir,
FL_INACTIVE);
}
} }
if (!ob || ob == dialog_->check_last_files) { if (!ob || ob == dialog_->check_last_files) {
if (fl_get_button(dialog_->check_last_files)) { bool const enable = fl_get_button(dialog_->check_last_files);
fl_activate_object(dialog_->input_lastfiles); setEnabled(dialog_->input_lastfiles, enable);
fl_set_object_lcol(dialog_->input_lastfiles,
FL_BLACK);
} else {
fl_deactivate_object(dialog_->input_lastfiles);
fl_set_object_lcol(dialog_->input_lastfiles,
FL_INACTIVE);
}
} }
if (!ob || ob == dialog_->check_make_backups) { if (!ob || ob == dialog_->check_make_backups) {
if (fl_get_button(dialog_->check_make_backups)) { bool const enable = fl_get_button(dialog_->check_make_backups);
fl_activate_object(dialog_->input_backup_path); setEnabled(dialog_->input_backup_path, enable);
fl_set_object_lcol(dialog_->input_backup_path,
FL_BLACK);
} else {
fl_deactivate_object(dialog_->input_backup_path);
fl_set_object_lcol(dialog_->input_backup_path,
FL_INACTIVE);
}
} }
if (!ob || ob == dialog_->input_default_path) { if (!ob || ob == dialog_->input_default_path) {
@ -2931,39 +2839,18 @@ bool FormPreferences::SpellChecker::input(FL_OBJECT const * const ob)
} }
if (!ob || ob == dialog_->check_alt_lang) { if (!ob || ob == dialog_->check_alt_lang) {
if (fl_get_button(dialog_->check_alt_lang)) { bool const enable = fl_get_button(dialog_->check_alt_lang);
fl_activate_object(dialog_->input_alt_lang); setEnabled(dialog_->input_alt_lang, enable);
fl_set_object_lcol(dialog_->input_alt_lang,
FL_BLACK);
} else {
fl_deactivate_object(dialog_->input_alt_lang);
fl_set_object_lcol(dialog_->input_alt_lang,
FL_INACTIVE);
}
} }
if (!ob || ob == dialog_->check_escape_chars) { if (!ob || ob == dialog_->check_escape_chars) {
if (fl_get_button(dialog_->check_escape_chars)) { bool const enable = fl_get_button(dialog_->check_escape_chars);
fl_activate_object(dialog_->input_escape_chars); setEnabled(dialog_->input_escape_chars, enable);
fl_set_object_lcol(dialog_->input_escape_chars,
FL_BLACK);
} else {
fl_deactivate_object(dialog_->input_escape_chars);
fl_set_object_lcol(dialog_->input_escape_chars,
FL_INACTIVE);
}
} }
if (!ob || ob == dialog_->check_personal_dict) { if (!ob || ob == dialog_->check_personal_dict) {
if (fl_get_button(dialog_->check_personal_dict)) { bool const enable = fl_get_button(dialog_->check_personal_dict);
fl_activate_object(dialog_->input_personal_dict); setEnabled(dialog_->input_personal_dict, enable);
fl_set_object_lcol(dialog_->input_personal_dict,
FL_BLACK);
} else {
fl_deactivate_object(dialog_->input_personal_dict);
fl_set_object_lcol(dialog_->input_personal_dict,
FL_INACTIVE);
}
} }
if (ob == dialog_->button_personal_dict) { if (ob == dialog_->button_personal_dict) {

View File

@ -24,7 +24,7 @@
#include <utility> // pair #include <utility> // pair
#include "FormBase.h" #include "FormBase.h"
#include "Color.h" // NamedColor #include "Color.h" // NamedColor
#include "xform_helpers.h" // XformColor #include "xforms_helpers.h" // XformsColor
class Combox; class Combox;
class Dialogs; class Dialogs;
@ -65,7 +65,7 @@ private:
/// Disconnect signals. Also perform any necessary housekeeping. /// Disconnect signals. Also perform any necessary housekeeping.
virtual void disconnect(); virtual void disconnect();
/** Redraw the form (on receipt of a Signal indicating, for example, /** Redraw the form (on receipt of a Signal indicating, for example,
that the xform colours have been re-mapped). */ that the xforms colours have been re-mapped). */
virtual void redraw(); virtual void redraw();
/// Update the dialog. /// Update the dialog.
virtual void update(); virtual void update();
@ -79,7 +79,7 @@ private:
virtual bool input(FL_OBJECT *, long); virtual bool input(FL_OBJECT *, long);
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
/// Pointer to the actual instantiation of xform's form. /// Pointer to the actual instantiation of the xforms form.
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// control which feedback message is output /// control which feedback message is output
void feedback(FL_OBJECT *); void feedback(FL_OBJECT *);
@ -91,7 +91,7 @@ private:
/// Print a warning message and set warning flag. /// Print a warning message and set warning flag.
void printWarning( string const & ); void printWarning( string const & );
/** Launch a file dialog and modify input if it returns a new file. /** Launch a file dialog and modify input if it returns a new file.
For an explanation of the various parameters, see xform_helpers.h. For an explanation of the various parameters, see xforms_helpers.h.
*/ */
void browse( FL_OBJECT * input, void browse( FL_OBJECT * input,
string const & title, string const & pattern, string const & title, string const & pattern,
@ -162,7 +162,7 @@ private:
/// ///
FD_form_colors const * dialog() { return dialog_; } FD_form_colors const * dialog() { return dialog_; }
/// ///
void apply(); // not const as modifies modifiedXformPrefs. void apply(); // not const as modifies modifiedXformsPrefs.
/// ///
void build(); void build();
/// ///
@ -173,7 +173,7 @@ private:
void update() { LoadBrowserLyX(); } void update() { LoadBrowserLyX(); }
/// Flag whether Xforms colors have changed since last file save /// Flag whether Xforms colors have changed since last file save
bool modifiedXformPrefs; bool modifiedXformsPrefs;
private: private:
/// ///
@ -200,8 +200,8 @@ private:
/// A vector of LyX LColor GUI name and associated RGB color. /// A vector of LyX LColor GUI name and associated RGB color.
std::vector<NamedColor> lyxColorDB; std::vector<NamedColor> lyxColorDB;
/// A vector of xform color ID, RGB colors and associated name. /// A vector of xforms color ID, RGB colors and associated name.
std::vector<XformColor> xformColorDB; std::vector<XformsColor> xformsColorDB;
}; };
/// ///
friend class Colors; friend class Colors;

View File

@ -22,7 +22,7 @@
#include "debug.h" #include "debug.h"
#include "BufferView.h" #include "BufferView.h"
#include "lyx_gui_misc.h" // WriteAlert #include "lyx_gui_misc.h" // WriteAlert
#include "xform_helpers.h" // for browseFile #include "xforms_helpers.h" // for browseFile
#ifdef SIGC_CXX_NAMESPACES #ifdef SIGC_CXX_NAMESPACES
using SigC::slot; using SigC::slot;

View File

@ -45,7 +45,7 @@ private:
virtual void apply(); virtual void apply();
/// Filter the inputs /// Filter the inputs
virtual bool input(FL_OBJECT *, long); virtual bool input(FL_OBJECT *, long);
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();

View File

@ -11,13 +11,13 @@
#include <config.h> #include <config.h>
#include <algorithm>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include "Dialogs.h" #include "Dialogs.h"
#include "FormRef.h" #include "FormRef.h"
#include "LyXView.h" #include "LyXView.h"
@ -25,8 +25,7 @@
#include "form_ref.h" #include "form_ref.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "insets/insetref.h" #include "insets/insetref.h"
#include "xforms_helpers.h"
#include <algorithm>
using std::find; using std::find;
using std::max; using std::max;
@ -110,17 +109,13 @@ void FormRef::update()
// Name is irrelevant to LaTeX/Literate documents, while // Name is irrelevant to LaTeX/Literate documents, while
// type is irrelevant to LinuxDoc/DocBook. // type is irrelevant to LinuxDoc/DocBook.
if (lv_->buffer()->isLatex() || lv_->buffer()->isLatex()) { if (lv_->buffer()->isLatex() || lv_->buffer()->isLatex()) {
fl_deactivate_object(dialog_->name); setEnabled(dialog_->name, false);
fl_set_object_lcol(dialog_->name, FL_INACTIVE); setEnabled(dialog_->type, true);
fl_activate_object(dialog_->type);
fl_set_object_lcol(dialog_->type, FL_BLACK);
} else { } else {
fl_set_choice(dialog_->type, 1); fl_set_choice(dialog_->type, 1);
fl_activate_object(dialog_->name); setEnabled(dialog_->name, true);
fl_set_object_lcol(dialog_->name, FL_BLACK); setEnabled(dialog_->type, false);
fl_deactivate_object(dialog_->type);
fl_set_object_lcol(dialog_->type, FL_INACTIVE);
} }
refs = lv_->buffer()->getLabelList(); refs = lv_->buffer()->getLabelList();
@ -145,16 +140,13 @@ void FormRef::updateBrowser(vector<string> const & akeys) const
fl_add_browser_line(dialog_->browser, fl_add_browser_line(dialog_->browser,
_("*** No labels found in document ***")); _("*** No labels found in document ***"));
fl_deactivate_object(dialog_->browser); setEnabled(dialog_->browser, false);
fl_deactivate_object(dialog_->sort); setEnabled(dialog_->sort, false);
fl_set_object_lcol(dialog_->browser, FL_INACTIVE);
fl_set_object_lcol(dialog_->sort, FL_INACTIVE);
fl_set_input(dialog_->ref, ""); fl_set_input(dialog_->ref, "");
} else { } else {
fl_activate_object(dialog_->browser); setEnabled(dialog_->browser, true);
fl_set_object_lcol(dialog_->browser, FL_BLACK); setEnabled(dialog_->sort, true);
fl_activate_object(dialog_->sort);
fl_set_object_lcol(dialog_->sort, FL_BLACK);
string ref = fl_get_input(dialog_->ref); string ref = fl_get_input(dialog_->ref);
vector<string>::const_iterator cit = vector<string>::const_iterator cit =
@ -237,10 +229,8 @@ bool FormRef::input(FL_OBJECT *, long data)
at_ref = false; at_ref = false;
fl_set_object_label(dialog_->button_go, _("Goto reference")); fl_set_object_label(dialog_->button_go, _("Goto reference"));
fl_activate_object(dialog_->type); setEnabled(dialog_->type, true);
fl_set_object_lcol(dialog_->type, FL_BLACK); setEnabled(dialog_->button_go, true);
fl_activate_object(dialog_->button_go);
fl_set_object_lcol(dialog_->button_go, FL_BLACK);
fl_set_object_lcol(dialog_->ref, FL_BLACK); fl_set_object_lcol(dialog_->ref, FL_BLACK);
} }
break; break;

View File

@ -40,7 +40,7 @@ private:
virtual void update(); virtual void update();
/// Not used but must be instantiated /// Not used but must be instantiated
virtual void apply(); virtual void apply();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// ///

View File

@ -19,7 +19,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "form_splash.h" #include "form_splash.h"
#include "FormSplash.h" #include "FormSplash.h"
#include "xform_helpers.h" #include "xforms_helpers.h"
#include "version.h" #include "version.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "lyxrc.h" #include "lyxrc.h"

View File

@ -34,7 +34,7 @@ private:
virtual void show(); virtual void show();
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Fdesign generated method /// Fdesign generated method
FD_form_splash * build_splash(); FD_form_splash * build_splash();

View File

@ -20,6 +20,7 @@
#include "Dialogs.h" #include "Dialogs.h"
#include "insets/insettabular.h" #include "insets/insettabular.h"
#include "buffer.h" #include "buffer.h"
#include "xforms_helpers.h"
FormTabular::FormTabular(LyXView * lv, Dialogs * d) FormTabular::FormTabular(LyXView * lv, Dialogs * d)
@ -166,20 +167,16 @@ void FormTabular::update()
fl_set_button(cell_options_->radio_multicolumn, 1); fl_set_button(cell_options_->radio_multicolumn, 1);
fl_set_button(cell_options_->radio_border_top, fl_set_button(cell_options_->radio_border_top,
tabular->TopLine(cell)?1:0); tabular->TopLine(cell)?1:0);
fl_activate_object(cell_options_->radio_border_top); setEnabled(cell_options_->radio_border_top, true);
fl_set_object_lcol(cell_options_->radio_border_top, FL_BLACK);
fl_set_button(cell_options_->radio_border_bottom, fl_set_button(cell_options_->radio_border_bottom,
tabular->BottomLine(cell)?1:0); tabular->BottomLine(cell)?1:0);
fl_activate_object(cell_options_->radio_border_bottom); setEnabled(cell_options_->radio_border_bottom, true);
fl_set_object_lcol(cell_options_->radio_border_bottom, FL_BLACK);
fl_set_button(cell_options_->radio_border_left, fl_set_button(cell_options_->radio_border_left,
tabular->LeftLine(cell)?1:0); tabular->LeftLine(cell)?1:0);
fl_activate_object(cell_options_->radio_border_left); setEnabled(cell_options_->radio_border_left, true);
fl_set_object_lcol(cell_options_->radio_border_left, FL_BLACK);
fl_set_button(cell_options_->radio_border_right, fl_set_button(cell_options_->radio_border_right,
tabular->RightLine(cell)?1:0); tabular->RightLine(cell)?1:0);
fl_activate_object(cell_options_->radio_border_right); setEnabled(cell_options_->radio_border_right, true);
fl_set_object_lcol(cell_options_->radio_border_right, FL_BLACK);
pwidth = tabular->GetMColumnPWidth(cell); pwidth = tabular->GetMColumnPWidth(cell);
align = tabular->GetAlignment(cell); align = tabular->GetAlignment(cell);
if (!pwidth.empty() || (align == LYX_ALIGN_LEFT)) if (!pwidth.empty() || (align == LYX_ALIGN_LEFT))
@ -188,12 +185,9 @@ void FormTabular::update()
fl_set_button(cell_options_->radio_align_right, 1); fl_set_button(cell_options_->radio_align_right, 1);
else else
fl_set_button(cell_options_->radio_align_center, 1); fl_set_button(cell_options_->radio_align_center, 1);
fl_activate_object(cell_options_->radio_align_left); setEnabled(cell_options_->radio_align_left, true);
fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK); setEnabled(cell_options_->radio_align_right, true);
fl_activate_object(cell_options_->radio_align_right); setEnabled(cell_options_->radio_align_center, true);
fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK);
fl_activate_object(cell_options_->radio_align_center);
fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK);
align = tabular->GetVAlignment(cell); align = tabular->GetVAlignment(cell);
fl_set_button(cell_options_->radio_valign_top, 0); fl_set_button(cell_options_->radio_valign_top, 0);
fl_set_button(cell_options_->radio_valign_bottom, 0); fl_set_button(cell_options_->radio_valign_bottom, 0);
@ -204,87 +198,62 @@ void FormTabular::update()
fl_set_button(cell_options_->radio_valign_bottom, 1); fl_set_button(cell_options_->radio_valign_bottom, 1);
else else
fl_set_button(cell_options_->radio_valign_top, 1); fl_set_button(cell_options_->radio_valign_top, 1);
fl_activate_object(cell_options_->radio_valign_top); setEnabled(cell_options_->radio_valign_top, true);
fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK); setEnabled(cell_options_->radio_valign_bottom, true);
fl_activate_object(cell_options_->radio_valign_bottom); setEnabled(cell_options_->radio_valign_center, true);
fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK);
fl_activate_object(cell_options_->radio_valign_center);
fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK);
special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_MULTI); special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_MULTI);
fl_set_input(cell_options_->input_special_multialign, special.c_str()); fl_set_input(cell_options_->input_special_multialign, special.c_str());
fl_set_input(cell_options_->input_mcolumn_width,pwidth.c_str()); fl_set_input(cell_options_->input_mcolumn_width,pwidth.c_str());
if (!lv_->buffer()->isReadonly()) { if (!lv_->buffer()->isReadonly()) {
fl_activate_object(cell_options_->input_special_multialign); setEnabled(cell_options_->input_special_multialign, true);
fl_set_object_lcol(cell_options_->input_special_multialign, setEnabled(cell_options_->input_mcolumn_width, true);
FL_BLACK);
fl_activate_object(cell_options_->input_mcolumn_width);
fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_BLACK);
}
if (!pwidth.empty()) {
fl_deactivate_object(cell_options_->radio_align_left);
fl_deactivate_object(cell_options_->radio_align_right);
fl_deactivate_object(cell_options_->radio_align_center);
fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE);
fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE);
fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE);
fl_activate_object(cell_options_->radio_valign_top);
fl_activate_object(cell_options_->radio_valign_bottom);
fl_activate_object(cell_options_->radio_valign_center);
fl_set_object_lcol(cell_options_->radio_valign_top, FL_BLACK);
fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_BLACK);
fl_set_object_lcol(cell_options_->radio_valign_center, FL_BLACK);
} else {
fl_activate_object(cell_options_->radio_align_left);
fl_activate_object(cell_options_->radio_align_right);
fl_activate_object(cell_options_->radio_align_center);
fl_set_object_lcol(cell_options_->radio_align_left, FL_BLACK);
fl_set_object_lcol(cell_options_->radio_align_right, FL_BLACK);
fl_set_object_lcol(cell_options_->radio_align_center, FL_BLACK);
fl_deactivate_object(cell_options_->radio_valign_top);
fl_deactivate_object(cell_options_->radio_valign_bottom);
fl_deactivate_object(cell_options_->radio_valign_center);
fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE);
fl_set_object_lcol(cell_options_->radio_valign_bottom,FL_INACTIVE);
fl_set_object_lcol(cell_options_->radio_valign_center,FL_INACTIVE);
} }
setEnabled(cell_options_->radio_valign_top, !pwidth.empty());
setEnabled(cell_options_->radio_valign_bottom, !pwidth.empty());
setEnabled(cell_options_->radio_valign_center, !pwidth.empty());
setEnabled(cell_options_->radio_align_left, pwidth.empty());
setEnabled(cell_options_->radio_align_right, pwidth.empty());
setEnabled(cell_options_->radio_align_center, pwidth.empty());
} else { } else {
fl_set_button(cell_options_->radio_multicolumn, 0); fl_set_button(cell_options_->radio_multicolumn, 0);
fl_set_button(cell_options_->radio_border_top, 0); fl_set_button(cell_options_->radio_border_top, 0);
fl_deactivate_object(cell_options_->radio_border_top); setEnabled(cell_options_->radio_border_top, false);
fl_set_object_lcol(cell_options_->radio_border_top, FL_INACTIVE);
fl_set_button(cell_options_->radio_border_bottom, 0); fl_set_button(cell_options_->radio_border_bottom, 0);
fl_deactivate_object(cell_options_->radio_border_bottom); setEnabled(cell_options_->radio_border_bottom, false);
fl_set_object_lcol(cell_options_->radio_border_bottom, FL_INACTIVE);
fl_set_button(cell_options_->radio_border_left, 0); fl_set_button(cell_options_->radio_border_left, 0);
fl_deactivate_object(cell_options_->radio_border_left); setEnabled(cell_options_->radio_border_left, false);
fl_set_object_lcol(cell_options_->radio_border_left, FL_INACTIVE);
fl_set_button(cell_options_->radio_border_right, 0); fl_set_button(cell_options_->radio_border_right, 0);
fl_deactivate_object(cell_options_->radio_border_right); setEnabled(cell_options_->radio_border_right, false);
fl_set_object_lcol(cell_options_->radio_border_right, FL_INACTIVE);
fl_set_button(cell_options_->radio_align_left, 0); fl_set_button(cell_options_->radio_align_left, 0);
fl_deactivate_object(cell_options_->radio_align_left); setEnabled(cell_options_->radio_align_left, false);
fl_set_object_lcol(cell_options_->radio_align_left, FL_INACTIVE);
fl_set_button(cell_options_->radio_align_right, 0); fl_set_button(cell_options_->radio_align_right, 0);
fl_deactivate_object(cell_options_->radio_align_right); setEnabled(cell_options_->radio_align_right, false);
fl_set_object_lcol(cell_options_->radio_align_right, FL_INACTIVE);
fl_set_button(cell_options_->radio_align_center, 0); fl_set_button(cell_options_->radio_align_center, 0);
fl_deactivate_object(cell_options_->radio_align_center); setEnabled(cell_options_->radio_align_center, false);
fl_set_object_lcol(cell_options_->radio_align_center, FL_INACTIVE);
fl_set_button(cell_options_->radio_valign_top, 0); fl_set_button(cell_options_->radio_valign_top, 0);
fl_deactivate_object(cell_options_->radio_valign_top); setEnabled(cell_options_->radio_valign_top, false);
fl_set_object_lcol(cell_options_->radio_valign_top, FL_INACTIVE);
fl_set_button(cell_options_->radio_valign_bottom, 0); fl_set_button(cell_options_->radio_valign_bottom, 0);
fl_deactivate_object(cell_options_->radio_valign_bottom); setEnabled(cell_options_->radio_valign_bottom, false);
fl_set_object_lcol(cell_options_->radio_valign_bottom, FL_INACTIVE);
fl_set_button(cell_options_->radio_valign_center, 0); fl_set_button(cell_options_->radio_valign_center, 0);
fl_deactivate_object(cell_options_->radio_valign_center); setEnabled(cell_options_->radio_valign_center, false);
fl_set_object_lcol(cell_options_->radio_valign_center, FL_INACTIVE);
fl_set_input(cell_options_->input_special_multialign, ""); fl_set_input(cell_options_->input_special_multialign, "");
fl_deactivate_object(cell_options_->input_special_multialign); setEnabled(cell_options_->input_special_multialign, false);
fl_set_object_lcol(cell_options_->input_special_multialign, FL_INACTIVE);
fl_set_input(cell_options_->input_mcolumn_width,""); fl_set_input(cell_options_->input_mcolumn_width, "");
fl_deactivate_object(cell_options_->input_mcolumn_width); setEnabled(cell_options_->input_mcolumn_width, false);
fl_set_object_lcol(cell_options_->input_mcolumn_width, FL_INACTIVE);
} }
if (tabular->GetRotateCell(cell)) if (tabular->GetRotateCell(cell))
fl_set_button(cell_options_->radio_rotate_cell, 1); fl_set_button(cell_options_->radio_rotate_cell, 1);
@ -308,27 +277,21 @@ void FormTabular::update()
fl_set_button(column_options_->radio_border_right, 0); fl_set_button(column_options_->radio_border_right, 0);
special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_COLUMN); special = tabular->GetAlignSpecial(cell,LyXTabular::SET_SPECIAL_COLUMN);
fl_set_input(column_options_->input_special_alignment, special.c_str()); fl_set_input(column_options_->input_special_alignment, special.c_str());
if (lv_->buffer()->isReadonly())
fl_deactivate_object(column_options_->input_special_alignment); bool const isReadonly = lv_->buffer()->isReadonly();
else setEnabled(column_options_->input_special_alignment, !isReadonly);
fl_activate_object(column_options_->input_special_alignment);
pwidth = tabular->GetColumnPWidth(cell); pwidth = tabular->GetColumnPWidth(cell);
fl_set_input(column_options_->input_column_width,pwidth.c_str()); fl_set_input(column_options_->input_column_width,pwidth.c_str());
if (lv_->buffer()->isReadonly()) { setEnabled(column_options_->input_column_width, !isReadonly);
fl_deactivate_object(column_options_->input_column_width);
} else { setEnabled(cell_options_->radio_useminipage, !pwidth.empty());
fl_activate_object(column_options_->input_column_width);
}
if (!pwidth.empty()) { if (!pwidth.empty()) {
fl_activate_object(cell_options_->radio_useminipage);
fl_set_object_lcol(cell_options_->radio_useminipage, FL_BLACK);
if (tabular->GetUsebox(cell) == 2) if (tabular->GetUsebox(cell) == 2)
fl_set_button(cell_options_->radio_useminipage, 1); fl_set_button(cell_options_->radio_useminipage, 1);
else else
fl_set_button(cell_options_->radio_useminipage, 0); fl_set_button(cell_options_->radio_useminipage, 0);
} else { } else {
fl_deactivate_object(cell_options_->radio_useminipage);
fl_set_object_lcol(cell_options_->radio_useminipage, FL_INACTIVE);
fl_set_button(cell_options_->radio_useminipage,0); fl_set_button(cell_options_->radio_useminipage,0);
} }
align = tabular->GetAlignment(cell, true); align = tabular->GetAlignment(cell, true);
@ -351,46 +314,26 @@ void FormTabular::update()
fl_set_button(column_options_->radio_valign_bottom, 1); fl_set_button(column_options_->radio_valign_bottom, 1);
else else
fl_set_button(column_options_->radio_valign_top, 1); fl_set_button(column_options_->radio_valign_top, 1);
if (!pwidth.empty()) {
fl_deactivate_object(column_options_->radio_align_left); setEnabled(column_options_->radio_align_left, pwidth.empty());
fl_deactivate_object(column_options_->radio_align_right); setEnabled(column_options_->radio_align_right, pwidth.empty());
fl_deactivate_object(column_options_->radio_align_center); setEnabled(column_options_->radio_align_center, pwidth.empty());
fl_set_object_lcol(column_options_->radio_align_left, FL_INACTIVE);
fl_set_object_lcol(column_options_->radio_align_right, FL_INACTIVE); setEnabled(column_options_->radio_valign_top, !pwidth.empty());
fl_set_object_lcol(column_options_->radio_align_center, FL_INACTIVE); setEnabled(column_options_->radio_valign_bottom, !pwidth.empty());
fl_activate_object(column_options_->radio_valign_top); setEnabled(column_options_->radio_valign_center, !pwidth.empty());
fl_activate_object(column_options_->radio_valign_bottom);
fl_activate_object(column_options_->radio_valign_center);
fl_set_object_lcol(column_options_->radio_valign_top, FL_BLACK);
fl_set_object_lcol(column_options_->radio_valign_bottom, FL_BLACK);
fl_set_object_lcol(column_options_->radio_valign_center, FL_BLACK);
} else {
fl_activate_object(column_options_->radio_align_left);
fl_activate_object(column_options_->radio_align_right);
fl_activate_object(column_options_->radio_align_center);
fl_set_object_lcol(column_options_->radio_align_left, FL_BLACK);
fl_set_object_lcol(column_options_->radio_align_right, FL_BLACK);
fl_set_object_lcol(column_options_->radio_align_center, FL_BLACK);
fl_deactivate_object(column_options_->radio_valign_top);
fl_deactivate_object(column_options_->radio_valign_bottom);
fl_deactivate_object(column_options_->radio_valign_center);
fl_set_object_lcol(column_options_->radio_valign_top, FL_INACTIVE);
fl_set_object_lcol(column_options_->radio_valign_bottom, FL_INACTIVE);
fl_set_object_lcol(column_options_->radio_valign_center, FL_INACTIVE);
}
fl_set_button(tabular_options_->radio_longtable, fl_set_button(tabular_options_->radio_longtable,
tabular->IsLongTabular()); tabular->IsLongTabular());
if (tabular->IsLongTabular()) {
fl_activate_object(longtable_options_->radio_lt_firsthead); bool const enable = tabular->IsLongTabular();
fl_activate_object(longtable_options_->radio_lt_head); setEnabled(longtable_options_->radio_lt_firsthead, enable);
fl_activate_object(longtable_options_->radio_lt_foot); setEnabled(longtable_options_->radio_lt_head, enable);
fl_activate_object(longtable_options_->radio_lt_lastfoot); setEnabled(longtable_options_->radio_lt_foot, enable);
fl_activate_object(longtable_options_->radio_lt_newpage); setEnabled(longtable_options_->radio_lt_lastfoot, enable);
fl_set_object_lcol(longtable_options_->radio_lt_firsthead, FL_BLACK); setEnabled(longtable_options_->radio_lt_newpage, enable);
fl_set_object_lcol(longtable_options_->radio_lt_head, FL_BLACK);
fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_BLACK); if (enable) {
fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_BLACK);
fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_BLACK);
int dummy; int dummy;
fl_set_button(longtable_options_->radio_lt_firsthead, fl_set_button(longtable_options_->radio_lt_firsthead,
tabular->GetRowOfLTFirstHead(cell, dummy)); tabular->GetRowOfLTFirstHead(cell, dummy));
@ -403,21 +346,11 @@ void FormTabular::update()
fl_set_button(longtable_options_->radio_lt_newpage, fl_set_button(longtable_options_->radio_lt_newpage,
tabular->GetLTNewPage(cell)); tabular->GetLTNewPage(cell));
} else { } else {
fl_deactivate_object(longtable_options_->radio_lt_firsthead);
fl_deactivate_object(longtable_options_->radio_lt_head);
fl_deactivate_object(longtable_options_->radio_lt_foot);
fl_deactivate_object(longtable_options_->radio_lt_lastfoot);
fl_deactivate_object(longtable_options_->radio_lt_newpage);
fl_set_button(longtable_options_->radio_lt_firsthead,0); fl_set_button(longtable_options_->radio_lt_firsthead,0);
fl_set_button(longtable_options_->radio_lt_head,0); fl_set_button(longtable_options_->radio_lt_head,0);
fl_set_button(longtable_options_->radio_lt_foot,0); fl_set_button(longtable_options_->radio_lt_foot,0);
fl_set_button(longtable_options_->radio_lt_lastfoot,0); fl_set_button(longtable_options_->radio_lt_lastfoot,0);
fl_set_button(longtable_options_->radio_lt_newpage,0); fl_set_button(longtable_options_->radio_lt_newpage,0);
fl_set_object_lcol(longtable_options_->radio_lt_firsthead,FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_head, FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_lastfoot, FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_newpage, FL_INACTIVE);
} }
fl_set_button(tabular_options_->radio_rotate_tabular, fl_set_button(tabular_options_->radio_rotate_tabular,
tabular->GetRotateTabular()); tabular->GetRotateTabular());
@ -514,46 +447,36 @@ bool FormTabular::input(FL_OBJECT * ob, long)
else if (ob == cell_options_->radio_multicolumn) else if (ob == cell_options_->radio_multicolumn)
num = LyXTabular::MULTICOLUMN; num = LyXTabular::MULTICOLUMN;
else if (ob == tabular_options_->radio_longtable) { else if (ob == tabular_options_->radio_longtable) {
s = fl_get_button(tabular_options_->radio_longtable); bool const enable =
if (s) { fl_get_button(tabular_options_->radio_longtable);
num = LyXTabular::SET_LONGTABULAR;
fl_activate_object(longtable_options_->radio_lt_firsthead); setEnabled(longtable_options_->radio_lt_firsthead, enable);
fl_activate_object(longtable_options_->radio_lt_head); setEnabled(longtable_options_->radio_lt_head, enable);
fl_activate_object(longtable_options_->radio_lt_foot); setEnabled(longtable_options_->radio_lt_foot, enable);
fl_activate_object(longtable_options_->radio_lt_lastfoot); setEnabled(longtable_options_->radio_lt_lastfoot, enable);
fl_activate_object(longtable_options_->radio_lt_newpage); setEnabled(longtable_options_->radio_lt_newpage, enable);
int dummy;
fl_set_button(longtable_options_->radio_lt_firsthead, if (enable) {
tabular->GetRowOfLTFirstHead(cell, dummy)); num = LyXTabular::SET_LONGTABULAR;
fl_set_button(longtable_options_->radio_lt_head, int dummy;
tabular->GetRowOfLTHead(cell, dummy)); fl_set_button(longtable_options_->radio_lt_firsthead,
fl_set_button(longtable_options_->radio_lt_foot, tabular->GetRowOfLTFirstHead(cell, dummy));
tabular->GetRowOfLTFoot(cell, dummy)); fl_set_button(longtable_options_->radio_lt_head,
fl_set_button(longtable_options_->radio_lt_lastfoot, tabular->GetRowOfLTHead(cell, dummy));
tabular->GetRowOfLTLastFoot(cell, dummy)); fl_set_button(longtable_options_->radio_lt_foot,
fl_set_button(longtable_options_->radio_lt_firsthead, tabular->GetRowOfLTFoot(cell, dummy));
tabular->GetLTNewPage(cell)); fl_set_button(longtable_options_->radio_lt_lastfoot,
} else { tabular->GetRowOfLTLastFoot(cell, dummy));
num = LyXTabular::UNSET_LONGTABULAR; fl_set_button(longtable_options_->radio_lt_firsthead,
fl_deactivate_object(longtable_options_->radio_lt_firsthead); tabular->GetLTNewPage(cell));
fl_deactivate_object(longtable_options_->radio_lt_head); } else {
fl_deactivate_object(longtable_options_->radio_lt_foot); num = LyXTabular::UNSET_LONGTABULAR;
fl_deactivate_object(longtable_options_->radio_lt_lastfoot); fl_set_button(longtable_options_->radio_lt_firsthead,0);
fl_deactivate_object(longtable_options_->radio_lt_newpage); fl_set_button(longtable_options_->radio_lt_head,0);
fl_set_button(longtable_options_->radio_lt_firsthead,0); fl_set_button(longtable_options_->radio_lt_foot,0);
fl_set_button(longtable_options_->radio_lt_head,0); fl_set_button(longtable_options_->radio_lt_lastfoot,0);
fl_set_button(longtable_options_->radio_lt_foot,0); fl_set_button(longtable_options_->radio_lt_newpage,0);
fl_set_button(longtable_options_->radio_lt_lastfoot,0); }
fl_set_button(longtable_options_->radio_lt_newpage,0);
fl_set_object_lcol(longtable_options_->radio_lt_firsthead,
FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_head, FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_foot, FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_lastfoot,
FL_INACTIVE);
fl_set_object_lcol(longtable_options_->radio_lt_newpage,
FL_INACTIVE);
}
} else if (ob == tabular_options_->radio_rotate_tabular) { } else if (ob == tabular_options_->radio_rotate_tabular) {
s = fl_get_button(tabular_options_->radio_rotate_tabular); s = fl_get_button(tabular_options_->radio_rotate_tabular);
if (s) if (s)

View File

@ -36,7 +36,7 @@ public:
private: private:
/** Redraw the form (on receipt of a Signal indicating, for example, /** Redraw the form (on receipt of a Signal indicating, for example,
that the xform colours have been re-mapped). */ that the xforms colours have been re-mapped). */
virtual void redraw(); virtual void redraw();
/// Disconnect signals. Also perform any necessary housekeeping. /// Disconnect signals. Also perform any necessary housekeeping.
virtual void disconnect(); virtual void disconnect();
@ -51,7 +51,7 @@ private:
virtual void build(); virtual void build();
/// Filter the inputs /// Filter the inputs
virtual bool input(FL_OBJECT *, long); virtual bool input(FL_OBJECT *, long);
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Fdesign generated methods /// Fdesign generated methods

View File

@ -43,7 +43,7 @@ private:
virtual void apply(); virtual void apply();
/// Update dialog before showing it /// Update dialog before showing it
virtual void update(); virtual void update();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();

View File

@ -40,7 +40,7 @@ private:
virtual void update(); virtual void update();
/// Filter the inputs on callback from xforms /// Filter the inputs on callback from xforms
virtual bool input( FL_OBJECT *, long); virtual bool input( FL_OBJECT *, long);
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// ///
void updateToc(); void updateToc();

View File

@ -36,7 +36,7 @@ private:
virtual void update(); virtual void update();
/// Apply from dialog (modify or create inset) /// Apply from dialog (modify or create inset)
virtual void apply(); virtual void apply();
/// Pointer to the actual instantiation of the xform's form /// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const; virtual FL_FORM * form() const;
/// ///
FD_form_url * build_url(); FD_form_url * build_url();

View File

@ -120,8 +120,8 @@ libxforms_la_SOURCES = \
Timeout_pimpl.h \ Timeout_pimpl.h \
Toolbar_pimpl.C \ Toolbar_pimpl.C \
Toolbar_pimpl.h \ Toolbar_pimpl.h \
xform_helpers.C \ xforms_helpers.C \
xform_helpers.h xforms_helpers.h
# These still have to be added. Sooner or later. ARRae-20000411 # These still have to be added. Sooner or later. ARRae-20000411
# GUI_defaults.C \ # GUI_defaults.C \

View File

@ -12,7 +12,7 @@
#pragma implementation #pragma implementation
#endif #endif
#include "xform_helpers.h" #include "xforms_helpers.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "filedlg.h" // LyXFileDlg #include "filedlg.h" // LyXFileDlg
#include "support/FileInfo.h" #include "support/FileInfo.h"
@ -24,6 +24,19 @@ using std::ofstream;
using std::pair; using std::pair;
using std::vector; using std::vector;
// Set an FL_OBJECT to activated or deactivated
void setEnabled(FL_OBJECT * ob, bool enable)
{
if (enable) {
fl_activate_object(ob);
fl_set_object_lcol(ob, FL_BLACK);
} else {
fl_deactivate_object(ob);
fl_set_object_lcol(ob, FL_INACTIVE);
}
}
// Take a string and add breaks so that it fits into a desired label width, w // Take a string and add breaks so that it fits into a desired label width, w
string formatted(string const & sin, int w, int size, int style) string formatted(string const & sin, int w, int size, int style)
{ {
@ -137,7 +150,7 @@ keyword_item xformTags[] = {
static const int xformCount = sizeof(xformTags) / sizeof(keyword_item); static const int xformCount = sizeof(xformTags) / sizeof(keyword_item);
bool XformColor::read(string const & filename) bool XformsColor::read(string const & filename)
{ {
LyXLex lexrc(xformTags, xformCount); LyXLex lexrc(xformTags, xformCount);
if (!lexrc.setFile(filename)) if (!lexrc.setFile(filename))
@ -173,7 +186,7 @@ bool XformColor::read(string const & filename)
} }
bool XformColor::write(string const & filename) bool XformsColor::write(string const & filename)
{ {
ofstream os(filename.c_str()); ofstream os(filename.c_str());
if (!os) if (!os)

View File

@ -1,5 +1,5 @@
#ifndef XFORMHELPERS_H #ifndef XFORMSHELPERS_H
#define XFORMHELPERS_H #define XFORMSHELPERS_H
#ifdef __GNUG_ #ifdef __GNUG_
#pragma interface #pragma interface
@ -10,6 +10,9 @@
#include "LString.h" #include "LString.h"
#include "Color.h" #include "Color.h"
// Set an FL_OBJECT to activated or deactivated
void setEnabled(FL_OBJECT *, bool enable);
// Take a string and add breaks so that it fits into a desired label width, w // Take a string and add breaks so that it fits into a desired label width, w
string formatted(string const &label, int w, int size, int style); string formatted(string const &label, int w, int size, int style);
@ -26,9 +29,9 @@ string const browseFile(string const & filename,
std::pair<string,string> const & dir2); std::pair<string,string> const & dir2);
/// struct holding xform-specific colors /// struct holding xform-specific colors
struct XformColor : public NamedColor { struct XformsColor : public NamedColor {
int colorID; int colorID;
XformColor() : NamedColor(), colorID(0) {} XformsColor() : NamedColor(), colorID(0) {}
static bool read(string const &); static bool read(string const &);
static bool write(string const &); static bool write(string const &);
}; };
@ -53,4 +56,4 @@ private:
/// ///
static string error_message; static string error_message;
}; };
#endif #endif // XFORMSHELPERS_H