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>
* FormRef.C: Fixed the behaviour of Goto-Ref.

View File

@ -56,7 +56,7 @@ protected: // methods
virtual ~FormBase();
/** 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
redraw the form for each tab.
*/
@ -95,7 +95,7 @@ protected: // methods
virtual void restore() {
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;
/** Which LyXFunc do we use?

View File

@ -37,7 +37,7 @@ private:
virtual bool input(FL_OBJECT *,long);
/// Apply from dialog (modify or create inset)
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;
///
FD_form_bibitem * build_bibitem();

View File

@ -37,7 +37,7 @@ private:
virtual bool input(FL_OBJECT *, long);
/// Apply from dialog (modify or create inset)
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;
///
FD_form_bibtex * build_bibtex();

View File

@ -36,7 +36,7 @@ protected:
FD_form_browser * dialog_;
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;
/// Filter the inputs on callback from xforms
virtual bool input(FL_OBJECT *, long);

View File

@ -45,7 +45,7 @@ private:
/// Update the popup.
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;
FD_form_character * build_character();

View File

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

View File

@ -47,7 +47,7 @@ private:
virtual void update();
/// Apply from dialog (modify or create inset)
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;
///

View File

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

View File

@ -37,7 +37,7 @@ public:
private:
/// Build the dialog
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;
/// Fdesign generated method
FD_form_copyright * build_copyright();

View File

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

View File

@ -80,7 +80,7 @@ private:
BULLETBMTABLE
};
/** 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();
/// Build the dialog
virtual void build();

View File

@ -39,7 +39,7 @@ private:
virtual void update();
/// Build the dialog
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;
/// Fdesign generated method
FD_form_error * build_error();

View File

@ -20,7 +20,7 @@
#include "support/lstrings.h" // for strToDbl & tostr
#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 "insets/insetgraphics.h"
#include "insets/insetgraphicsParams.h"

View File

@ -91,7 +91,7 @@ private:
/// Open the file browse dialog to select an image file.
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;
/// Fdesign generated method
FD_form_graphics * build_graphics();

View File

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

View File

@ -48,7 +48,7 @@ private:
virtual void update();
/// Apply from dialog (modify or create inset)
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;
/// Type definition from the fdesign produced header file.

View File

@ -36,7 +36,7 @@ private:
virtual void update();
/// Apply from dialog (modify or create inset)
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;
///
FD_form_index * build_index();

View File

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

View File

@ -36,7 +36,7 @@ public:
private:
/** 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();
/// Build the popup
virtual void build();

View File

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

View File

@ -24,7 +24,7 @@ public:
private:
/** 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

View File

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

View File

@ -24,7 +24,7 @@
#include <utility> // pair
#include "FormBase.h"
#include "Color.h" // NamedColor
#include "xform_helpers.h" // XformColor
#include "xforms_helpers.h" // XformsColor
class Combox;
class Dialogs;
@ -65,7 +65,7 @@ private:
/// Disconnect signals. Also perform any necessary housekeeping.
virtual void disconnect();
/** 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();
/// Update the dialog.
virtual void update();
@ -79,7 +79,7 @@ private:
virtual bool input(FL_OBJECT *, long);
/// Build the dialog
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;
/// control which feedback message is output
void feedback(FL_OBJECT *);
@ -91,7 +91,7 @@ private:
/// Print a warning message and set warning flag.
void printWarning( string const & );
/** 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,
string const & title, string const & pattern,
@ -162,7 +162,7 @@ private:
///
FD_form_colors const * dialog() { return dialog_; }
///
void apply(); // not const as modifies modifiedXformPrefs.
void apply(); // not const as modifies modifiedXformsPrefs.
///
void build();
///
@ -173,7 +173,7 @@ private:
void update() { LoadBrowserLyX(); }
/// Flag whether Xforms colors have changed since last file save
bool modifiedXformPrefs;
bool modifiedXformsPrefs;
private:
///
@ -200,8 +200,8 @@ private:
/// A vector of LyX LColor GUI name and associated RGB color.
std::vector<NamedColor> lyxColorDB;
/// A vector of xform color ID, RGB colors and associated name.
std::vector<XformColor> xformColorDB;
/// A vector of xforms color ID, RGB colors and associated name.
std::vector<XformsColor> xformsColorDB;
};
///
friend class Colors;

View File

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

View File

@ -45,7 +45,7 @@ private:
virtual void apply();
/// Filter the inputs
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;
/// Build the dialog
virtual void build();

View File

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

View File

@ -40,7 +40,7 @@ private:
virtual void update();
/// Not used but must be instantiated
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;
///

View File

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

View File

@ -34,7 +34,7 @@ private:
virtual void show();
/// Build the dialog
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;
/// Fdesign generated method
FD_form_splash * build_splash();

View File

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

View File

@ -36,7 +36,7 @@ public:
private:
/** 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();
/// Disconnect signals. Also perform any necessary housekeeping.
virtual void disconnect();
@ -51,7 +51,7 @@ private:
virtual void build();
/// Filter the inputs
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;
/// Fdesign generated methods

View File

@ -43,7 +43,7 @@ private:
virtual void apply();
/// Update dialog before showing it
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;
/// Build the dialog
virtual void build();

View File

@ -40,7 +40,7 @@ private:
virtual void update();
/// Filter the inputs on callback from xforms
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;
///
void updateToc();

View File

@ -36,7 +36,7 @@ private:
virtual void update();
/// Apply from dialog (modify or create inset)
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;
///
FD_form_url * build_url();

View File

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

View File

@ -12,7 +12,7 @@
#pragma implementation
#endif
#include "xform_helpers.h"
#include "xforms_helpers.h"
#include "lyxlex.h"
#include "filedlg.h" // LyXFileDlg
#include "support/FileInfo.h"
@ -24,6 +24,19 @@ using std::ofstream;
using std::pair;
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
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);
bool XformColor::read(string const & filename)
bool XformsColor::read(string const & filename)
{
LyXLex lexrc(xformTags, xformCount);
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());
if (!os)

View File

@ -1,5 +1,5 @@
#ifndef XFORMHELPERS_H
#define XFORMHELPERS_H
#ifndef XFORMSHELPERS_H
#define XFORMSHELPERS_H
#ifdef __GNUG_
#pragma interface
@ -10,6 +10,9 @@
#include "LString.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
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);
/// struct holding xform-specific colors
struct XformColor : public NamedColor {
struct XformsColor : public NamedColor {
int colorID;
XformColor() : NamedColor(), colorID(0) {}
XformsColor() : NamedColor(), colorID(0) {}
static bool read(string const &);
static bool write(string const &);
};
@ -53,4 +56,4 @@ private:
///
static string error_message;
};
#endif
#endif // XFORMSHELPERS_H