+2000-11-02 Angus Leeming <a.leeming@ic.ac.uk>
+
+ * src/frontends/xforms/FormCitation.C: made use of ButtonController.
+ Can now Apply to different insets without closing the dialog.
+
+ * src/frontends/xforms/FormPreferences.C: new Colour and Format tabs.
+ Can't actually DO anything with them yet, but I'd like a little
+ feedback.
+
+ * src/frontends/xforms/input_validators.[ch] (fl_lowercase_filter): new.
+
2000-10-27 Dekel Tsur <dekelts@tau.ac.il>
* src/mathed/formulamacro.h (LyxCode) Return MATHMACRO_CODE instead
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
- : FormCommand(lv, d, _("Citation")), dialog_(0)
+ : FormCommand(lv, d, _("Citation"), new OkApplyCancelReadOnlyPolicy),
+ dialog_(0)
{
// let the dialog be shown
// These are permanent connections so we won't bother
// Workaround dumb xforms sizing bug
minw_ = form()->w;
minh_ = form()->h;
+
+ // manage the ok, apply and cancel/close buttons
+ bc_.setOK(dialog_->button_ok);
+ bc_.setApply(dialog_->button_apply);
+ bc_.setCancel(dialog_->button_cancel);
+ bc_.setUndoAll(dialog_->button_restore);
+ bc_.refresh();
}
x = dialog_->textAftr->x;
fl_set_object_position( dialog_->textAftr, x, y );
- x = dialog_->button_ok->x;
y += htext + dh1;
- fl_set_object_position( dialog_->button_ok, x, y );
+ x = dialog_->button_restore->x;
+ fl_set_object_position( dialog_->button_restore, x, y );
+ x = dialog_->button_ok->x;
+ fl_set_object_position( dialog_->button_ok, x, y );
+ x = dialog_->button_apply->x;
+ fl_set_object_position( dialog_->button_apply, x, y );
x = dialog_->button_cancel->x;
- fl_set_object_position( dialog_->button_cancel, x, y );
+ fl_set_object_position( dialog_->button_cancel, x, y );
}
#endif
bool FormCitation::input( FL_OBJECT *, long data )
{
+ bool activate = false;
State cb = static_cast<State>( data );
switch( cb ) {
setBibButtons( OFF );
setCiteButtons( ON );
+ activate = true;
}
break;
case DELETE:
setBibButtons( ON );
setCiteButtons( OFF );
+ activate = true;
}
break;
case UP:
fl_select_browser_line( dialog_->citeBrsr, sel-1 );
citekeys.insert( it-1, tmp );
setCiteButtons( ON );
+ activate = true;
}
break;
case DOWN:
fl_select_browser_line( dialog_->citeBrsr, sel+1 );
citekeys.insert( it+1, tmp );
setCiteButtons( ON );
+ activate = true;
}
break;
default:
break;
}
- return true;
+ return activate;
}
* FormPreferences Interface Class Implementation
*/
+#include <utility>
#include <config.h>
#include FORMS_H_LOCATION
#pragma implementation
#endif
+#include "Lsstream.h"
#include "FormPreferences.h"
#include "form_preferences.h"
#include "input_validators.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "lyx_gui_misc.h"
+#include "lyxlex.h"
+#include "input_validators.h"
#include "xform_helpers.h" // formatted()
#include "xform_macros.h"
#endif
using std::find;
+using std::getline;
+using std::istream;
+using std::pair;
using std::vector;
+extern string fmt(char const * fmtstr ...);
extern Languages languages;
+typedef pair<string, vector<int> > X11Colour;
+
+static vector<X11Colour> colourDB;
+static string const colourFile = "/usr/lib/X11/rgb.txt";
+
+
FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
: FormBaseBI(lv, d, _("Preferences"), new PreferencesPolicy),
dialog_(0), outputs_tab_(0), look_n_feel_tab_(0), inputs_tab_(0),
- usage_tab_(0), colours_(0), inputs_misc_(0), interface_(0),
- language_(0), lnf_misc_(0), outputs_misc_(0), paths_(0), printer_(0),
- screen_fonts_(0), spellchecker_(0),
+ usage_tab_(0), colours_(0), formats_(0), inputs_misc_(0),
+ interface_(0), language_(0), lnf_misc_(0), outputs_misc_(0),
+ paths_(0), printer_(0), screen_fonts_(0), spellchecker_(0),
combo_default_lang(0), combo_kbmap_1(0), combo_kbmap_2(0),
feedbackObj(0)
{
delete outputs_tab_;
delete usage_tab_;
delete colours_;
+ delete formats_;
delete inputs_misc_;
delete interface_;
delete language_;
delete screen_fonts_;
delete spellchecker_;
- // Must be last to be deleted, or we'll get a SIGSEGV.
- // Something to do with the Timer mechanism.
+ // Must delete dialog last or we'll end up with a SIGSEGV trying to
+ // access dialog_->timer_feedback in feedbackPost().
delete dialog_;
}
}
-void FormPreferences::restore()
-{
- update();
-// if I add an error message line to the dialog it'll have to be controlled
-// within input(). I don't need it yet so I'll leave it commented out.
-// bc_.valid(input(0));
-}
-
-
void FormPreferences::hide()
{
// We need to hide the active tabfolder otherwise we get a
// build actual tabfolder contents
// these will become nested tabfolders
buildColours();
+ buildFormats();
buildInputsMisc();
buildInterface();
buildLanguage();
fl_addto_tabfolder(outputs_tab_->tabfolder_outer,
_("Printer"),
printer_->form);
+ fl_addto_tabfolder(outputs_tab_->tabfolder_outer,
+ _("Formats"),
+ formats_->form);
fl_addto_tabfolder(outputs_tab_->tabfolder_outer,
_("Misc"),
outputs_misc_->form);
// and other stuff which may cost us a lot on slower/high-load machines.
applyColours();
+ applyFormats();
applyInputsMisc();
applyInterface();
applyLanguage();
if( ob->form->fdui == colours_ ) {
str = feedbackColours( ob );
+ } else if( ob->form->fdui == formats_ ) {
+ str = feedbackFormats( ob );
} else if( ob->form->fdui == inputs_misc_ ) {
str = feedbackInputsMisc( ob );
} else if( ob->form->fdui == interface_ ) {
// some totally ridiculous value somewhere. Change activate to suit.
// comments before each test describe what is _valid_
- if( ob->form->fdui == language_ ) {
+ if( ob->form->fdui == colours_ ) {
+ if( ! inputColours( ob ) )
+ activate = false;
+ } else if( ob->form->fdui == language_ ) {
if( ! inputLanguage( ob ) )
activate = false;
} else if( ob->form->fdui == paths_ ) {
// read lyxrc entries
updateColours();
+ updateFormats();
updateInputsMisc();
updateInterface();
updateLanguage();
void FormPreferences::buildColours()
{
colours_ = build_colours();
+
+ FL_OBJECT *obj;
+ obj = colours_->valslider_red;
+ fl_set_slider_bounds(obj, 0, 255);
+ fl_set_slider_precision(obj, 0);
+ fl_set_slider_return(obj, FL_RETURN_END_CHANGED);
+
+ obj = colours_->valslider_green;
+ fl_set_slider_bounds(obj, 0, 255);
+ fl_set_slider_precision(obj, 0);
+ fl_set_slider_return(obj, FL_RETURN_END_CHANGED);
+
+ obj = colours_->valslider_blue;
+ fl_set_slider_bounds(obj, 0, 255);
+ fl_set_slider_precision(obj, 0);
+ fl_set_slider_return(obj, FL_RETURN_END_CHANGED);
+
+ fl_set_object_color(colours_->button_colour,
+ FL_FREE_COL4, FL_FREE_COL4);
+
+ fl_set_input_return(colours_->input_name, FL_RETURN_END_CHANGED);
+
+ if( loadColourBrowser(colourFile) )
+ fl_set_input(colours_->input_name, colourFile.c_str());
+ else
+ fl_set_input(colours_->input_name, N_("No file found"));
+
+ // deactivate the browse button because it isn't implemented
+ fl_deactivate_object(colours_->button_browse);
+ fl_set_object_lcol(colours_->button_browse, FL_INACTIVE);
+}
+
+
+bool FormPreferences::loadColourBrowser( string const & filename )
+{
+ LyXLex lex(0, 0);
+
+ if (!lex.setFile(filename))
+ return false;
+
+ vector<int> oldrgb(3);
+ oldrgb[0] = -1; oldrgb[1] = -1; oldrgb[2] = -1;
+
+ istream & is = lex.getStream();
+ string line;
+
+ while( 1 ) {
+ getline( is, line );
+ if( line.empty() )
+ break;
+
+ if( line[0] != '!' ) {
+ vector<int> rgb(3);
+ string name;
+
+ istringstream iss(line);
+ iss >> rgb[0] >> rgb[1] >> rgb[2];
+ while( iss.good() ) {
+ string next;
+ iss >> next;
+ name += next;
+ }
+
+ // remove redundant entries on the fly
+ if( oldrgb != rgb ) {
+ string tmp;
+ name = lowercase( name );
+ if( name == "gray0" ) name = "black";
+ if( name == "gray100" ) name = "white";
+ X11Colour pa( name, rgb );
+ colourDB.push_back(pa);
+ }
+ oldrgb = rgb;
+ }
+ }
+
+ FL_OBJECT * colbr = colours_->browser_x11;
+ fl_freeze_form(colours_->form);
+ fl_clear_browser( colbr );
+
+ for( vector<X11Colour>::const_iterator cit = colourDB.begin();
+ cit != colourDB.end(); ++cit ) {
+ vector<int> rgb = (*cit).second;
+ string name = fmt("%3d %3d %3d ", rgb[0], rgb[1], rgb[2]) +
+ (*cit).first;
+ fl_addto_browser(colbr, name.c_str());
+ }
+
+ fl_set_browser_topline(colbr, 1);
+ fl_select_browser_line(colbr, 1);
+ updateColoursBrowser(0);
+ fl_unfreeze_form(colours_->form);
+
+ return true;
}
}
+bool FormPreferences::inputColours( FL_OBJECT const * const ob )
+{
+ bool activate = true;
+
+ if( ob == colours_->browser_x11 ) {
+ int i = fl_get_browser(colours_->browser_x11);
+ if( i > 0) {
+ updateColoursBrowser(i-1);
+ }
+
+ } else if( ob == colours_->valslider_red
+ || ob == colours_->valslider_green
+ || ob == colours_->valslider_blue ) {
+ updateColoursRGB();
+
+ } else if( ob == colours_->input_name) {
+ string file = fl_get_input(colours_->input_name);
+ if( loadColourBrowser(file) )
+ fl_set_input(colours_->input_name, file.c_str());
+ else if( loadColourBrowser(colourFile) )
+ fl_set_input(colours_->input_name, colourFile.c_str());
+ else
+ fl_set_input(colours_->input_name, N_("No file found"));
+ }
+
+ return activate;
+}
+
+
+void FormPreferences::updateColoursBrowser( int i )
+{
+ fl_freeze_form(colours_->form);
+
+ vector<int> rgb = colourDB[i].second;
+
+ fl_mapcolor(FL_FREE_COL4+i, rgb[0], rgb[1], rgb[2]);
+ fl_mapcolor(FL_FREE_COL4, rgb[0], rgb[1], rgb[2]);
+ fl_set_slider_value(colours_->valslider_red, rgb[0]);
+ fl_set_slider_value(colours_->valslider_green, rgb[1]);
+ fl_set_slider_value(colours_->valslider_blue, rgb[2]);
+ fl_redraw_object(colours_->button_colour);
+
+ fl_unfreeze_form(colours_->form);
+}
+
+
+void FormPreferences::updateColoursRGB()
+{
+ fl_freeze_form(colours_->form);
+
+ vector<int> rgb(3);
+ rgb[0] = fl_get_slider_value(colours_->valslider_red);
+ rgb[1] = fl_get_slider_value(colours_->valslider_green);
+ rgb[2] = fl_get_slider_value(colours_->valslider_blue);
+
+ fl_mapcolor(FL_FREE_COL4, rgb[0], rgb[1], rgb[2]);
+ fl_redraw_object(colours_->button_colour);
+
+ int top = fl_get_browser_topline(colours_->browser_x11);
+ int i = searchColourEntry( rgb );
+ // change topline only if necessary
+ if(i < top || i > (top+15))
+ fl_set_browser_topline(colours_->browser_x11,
+ i-8);
+ fl_select_browser_line(colours_->browser_x11, i + 1);
+
+ fl_unfreeze_form(colours_->form);
+}
+
+
+int FormPreferences::searchColourEntry(vector<int> const & rgb ) const
+{
+ int mindiff = 0x7fffffff;
+ vector<X11Colour>::const_iterator mincit = colourDB.begin();
+
+ for( vector<X11Colour>::const_iterator cit = colourDB.begin();
+ cit != colourDB.end(); ++cit ) {
+ vector<int> rgbDB = (*cit).second;
+ vector<int> diff(3);
+ diff[0] = rgb[0] - rgbDB[0];
+ diff[1] = rgb[1] - rgbDB[1];
+ diff[2] = rgb[2] - rgbDB[2];
+
+ int d = (2 * (diff[0] * diff[0]) +
+ 3 * (diff[1] * diff[1]) +
+ (diff[2] * diff[2]));
+
+ if( mindiff > d ) {
+ mindiff = d;
+ mincit = cit;
+ }
+ }
+ return static_cast<int>(mincit - colourDB.begin());
+}
+
+
void FormPreferences::updateColours()
{
}
+void FormPreferences::applyFormats() const
+{
+}
+
+
+void FormPreferences::buildFormats()
+{
+ formats_ = build_formats();
+
+ fl_set_input_return(formats_->input_format, FL_RETURN_CHANGED);
+ fl_set_input_return(formats_->input_viewer, FL_RETURN_CHANGED);
+ fl_set_input_return(formats_->input_gui_name, FL_RETURN_CHANGED);
+ fl_set_input_return(formats_->input_extension, FL_RETURN_CHANGED);
+
+ fl_set_input_filter(formats_->input_format, fl_lowercase_filter);
+}
+
+
+string FormPreferences::feedbackFormats( FL_OBJECT const * const ) const
+{
+ string str;
+
+ return str;
+}
+
+
+bool FormPreferences::inputFormats( FL_OBJECT const * const )
+{
+ return true;
+}
+
+
+void FormPreferences::updateFormats()
+{
+}
+
+
void FormPreferences::applyInputsMisc() const
{
lyxrc.date_insert_format = fl_get_input(inputs_misc_->input_date_format);
fl_set_input_return(language_->input_command_end, FL_RETURN_CHANGED);
// The default_language is a combo-box and has to be inserted manually
+ fl_freeze_form(language_->form);
fl_addto_form(language_->form);
FL_OBJECT * obj = language_->choice_default_lang;
+ fl_deactivate_object(language_->choice_default_lang);
combo_default_lang = new Combox(FL_COMBOX_DROPLIST);
combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400);
combo_default_lang->shortcut("#L",1);
// ditto kbmap_1
obj = language_->choice_kbmap_1;
+ fl_deactivate_object(language_->choice_kbmap_1);
combo_kbmap_1 = new Combox(FL_COMBOX_DROPLIST);
combo_kbmap_1->add(obj->x, obj->y, obj->w, obj->h, 400);
combo_kbmap_1->shortcut("#1",1);
// ditto kbmap_2
obj = language_->choice_kbmap_2;
+ fl_deactivate_object(language_->choice_kbmap_2);
combo_kbmap_2 = new Combox(FL_COMBOX_DROPLIST);
combo_kbmap_2->add(obj->x, obj->y, obj->w, obj->h, 400);
combo_kbmap_2->shortcut("#2",1);
addLanguages( *combo_kbmap_2 );
fl_end_form();
+ fl_unfreeze_form(language_->form);
// set up the feedback mechanism
fl_addto_form(language_->form);
fl_set_input_return(screen_fonts_->input_huge, FL_RETURN_CHANGED);
fl_set_input_return(screen_fonts_->input_huger, FL_RETURN_CHANGED);
+ fl_set_input_filter(screen_fonts_->input_tiny,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_script,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_footnote,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_small,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_normal,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_large,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_larger,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_largest,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_huge,
+ fl_unsigned_int_filter);
+ fl_set_input_filter(screen_fonts_->input_huger,
+ fl_unsigned_int_filter);
+
// set up the feedback mechanism
fl_addto_form(screen_fonts_->form);
}
}
- return true; // all input is valid!
+ return true; // All input is valid!
}
extern "C" int C_FormPreferencesFeedbackPost(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord, int, void *)
{
+ // can occur when form is being deleted. This seems an easier fix than
+ // a call "fl_set_object_posthandler(ob, 0)" for each and every object
+ // in the destructor.
+ if( !ob->form ) return 0;
+
FormPreferences * pre =
static_cast<FormPreferences*>(ob->form->u_vdata);
pre->feedbackPost(ob, event);
class LyXView;
class Dialogs;
-
-struct FD_form_preferences;
-struct FD_form_lnf_misc;
-struct FD_form_screen_fonts;
+struct FD_form_colours;
+struct FD_form_formats;
+struct FD_form_inputs_misc;
struct FD_form_interface;
-struct FD_form_printer;
-struct FD_form_paths;
+struct FD_form_language;
+struct FD_form_lnf_misc;
struct FD_form_outer_tab;
-struct FD_form_inputs_misc;
struct FD_form_outputs_misc;
+struct FD_form_paths;
+struct FD_form_preferences;
+struct FD_form_printer;
+struct FD_form_screen_fonts;
struct FD_form_spellchecker;
-struct FD_form_language;
-struct FD_form_colours;
class Combox;
/** This class provides an XForms implementation of the FormPreferences Dialog.
virtual void ok();
/// Apply from dialog
virtual void apply();
- /// Restore from dialog
- virtual void restore();
/// Filter the inputs -- return true if entries are valid
virtual bool input(FL_OBJECT *, long);
/// Build the dialog
///
void applyColours() const;
///
+ void applyFormats() const;
+ ///
void applyInputsMisc() const;
///
void applyInterface() const;
///
void buildColours();
///
+ bool loadColourBrowser( string const & );
+ ///
+ int searchColourEntry(std::vector<int> const & ) const;
+ ///
+ void buildFormats();
+ ///
void buildInputsMisc();
///
void buildInterface();
///
string feedbackColours(FL_OBJECT const * const) const;
///
+ string feedbackFormats( FL_OBJECT const * const ) const;
+ ///
string feedbackInputsMisc(FL_OBJECT const * const) const;
///
string feedbackInterface(FL_OBJECT const * const) const;
///
string feedbackSpellChecker(FL_OBJECT const * const) const;
///
+ bool inputColours(FL_OBJECT const * const);
+ ///
+ bool inputFormats( FL_OBJECT const * const );
+ ///
bool inputLanguage(FL_OBJECT const * const);
///
bool inputPaths(FL_OBJECT const * const);
///
void updateColours();
///
+ void updateColoursBrowser( int );
+ ///
+ void updateColoursRGB();
+ ///
+ void updateFormats();
+ ///
void updateInputsMisc();
///
void updateInterface();
///
FD_form_colours * build_colours();
///
+ FD_form_formats * build_formats();
+ ///
FD_form_inputs_misc * build_inputs_misc();
///
FD_form_interface * build_interface();
///
FD_form_colours * colours_;
///
+ FD_form_formats * formats_;
+ ///
FD_form_inputs_misc * inputs_misc_;
///
FD_form_interface * interface_;
fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 570, 250, 30, idex(_("Text after|#a")));
fl_set_button_shortcut(obj, scex(_("Text after|#a")), 1);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 230, 630, 90, 30, _("OK"));
+ fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 130, 630, 90, 30, _("OK"));
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseOKCB, 0);
+ fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 630, 90, 30, idex(_("Apply|#A")));
+ fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
+ fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+ fl_set_object_callback(obj, C_FormBaseApplyCB, 0);
fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 630, 90, 30, idex(_("Cancel|#C^[")));
fl_set_button_shortcut(obj, scex(_("Cancel|#C^[")), 1);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, C_FormBaseCancelCB, 0);
+ fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 630, 90, 30, idex(_("Restore|#R")));
+ fl_set_button_shortcut(obj, scex(_("Restore|#R")), 1);
+ fl_set_object_gravity(obj, FL_SouthWest, FL_SouthWest);
+ fl_set_object_callback(obj, C_FormBaseRestoreCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
/** Callbacks, globals and object handlers **/
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseOKCB(FL_OBJECT *, long);
+extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long);
extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
+extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
FL_OBJECT *textBefore;
FL_OBJECT *textAftr;
FL_OBJECT *button_ok;
+ FL_OBJECT *button_apply;
FL_OBJECT *button_cancel;
+ FL_OBJECT *button_restore;
};
#endif /* FD_form_citation_h_ */
fl_set_button_shortcut(obj, scex(_("Package|#P")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
- fdui->choice_default_lang = obj = fl_add_choice(FL_NORMAL_CHOICE, 231, 56, 200, 30, idex(_("Default language|#D")));
- fl_set_button_shortcut(obj, scex(_("Default language|#D")), 1);
+ fdui->choice_default_lang = obj = fl_add_choice(FL_NORMAL_CHOICE, 231, 56, 200, 30, idex(_("Default language|#l")));
+ fl_set_button_shortcut(obj, scex(_("Default language|#l")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->check_use_kbmap = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 158, 113, 30, 30, idex(_("Keyboard map|#K")));
fdui->form = fl_bgn_form(FL_NO_BOX, 450, 360);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 360, "");
+ fdui->browser_x11 = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 25, 175, 235, idex(_("X11 colour names|#X")));
+ fl_set_button_shortcut(obj, scex(_("X11 colour names|#X")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 10, 285, 175, 30, idex(_("Name database|#N")));
+ fl_set_button_shortcut(obj, scex(_("Name database|#N")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 190, 285, 90, 30, idex(_("Browse|#B")));
+ fl_set_button_shortcut(obj, scex(_("Browse|#B")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->button_colour = obj = fl_add_button(FL_NORMAL_BUTTON, 300, 230, 140, 30, "");
+ fl_set_object_boxtype(obj, FL_BORDER_BOX);
+ fl_set_object_color(obj, FL_WHITE, FL_COL1);
+ fdui->valslider_red = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 190, 25, 30, 235, idex(_("R|#R")));
+ fl_set_button_shortcut(obj, scex(_("R|#R")), 1);
+ fl_set_object_color(obj, FL_COL1, FL_RED);
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fl_set_slider_size(obj, 0.15);
+ fdui->valslider_green = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 220, 25, 30, 235, idex(_("G|#G")));
+ fl_set_button_shortcut(obj, scex(_("G|#G")), 1);
+ fl_set_object_color(obj, FL_COL1, FL_GREEN);
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fl_set_slider_size(obj, 0.15);
+ fdui->valslider_blue = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 250, 25, 30, 235, idex(_("B|#B")));
+ fl_set_button_shortcut(obj, scex(_("B|#B")), 1);
+ fl_set_object_color(obj, FL_COL1, FL_BLUE);
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fl_set_slider_size(obj, 0.15);
+ fdui->browser_lyx_objs = obj = fl_add_browser(FL_HOLD_BROWSER, 300, 25, 140, 200, idex(_("LyX objects|#L")));
+ fl_set_button_shortcut(obj, scex(_("LyX objects|#L")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fl_end_form();
+
+ fdui->form->fdui = fdui;
+
+ return fdui;
+}
+/*---------------------------------------*/
+
+FD_form_formats::~FD_form_formats()
+{
+ if( form->visible ) fl_hide_form( form );
+ fl_free_form( form );
+}
+
+
+FD_form_formats * FormPreferences::build_formats()
+{
+ FL_OBJECT *obj;
+ FD_form_formats *fdui = new FD_form_formats;
+
+ fdui->form = fl_bgn_form(FL_NO_BOX, 450, 360);
+ fdui->form->u_vdata = this;
+ obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 360, "");
+ fdui->browser_formats = obj = fl_add_browser(FL_NORMAL_BROWSER, 30, 30, 160, 270, idex(_("All formats|#A")));
+ fl_set_button_shortcut(obj, scex(_("All formats|#A")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->input_format = obj = fl_add_input(FL_NORMAL_INPUT, 280, 30, 150, 30, idex(_("Format|#F")));
+ fl_set_button_shortcut(obj, scex(_("Format|#F")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->input_gui_name = obj = fl_add_input(FL_NORMAL_INPUT, 280, 70, 150, 30, idex(_("GUI name|#G")));
+ fl_set_button_shortcut(obj, scex(_("GUI name|#G")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->button_delete = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 270, 90, 30, idex(_("Delete|#D")));
+ fl_set_button_shortcut(obj, scex(_("Delete|#D")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->button_add = obj = fl_add_button(FL_NORMAL_BUTTON, 240, 270, 90, 30, idex(_("Add|#A")));
+ fl_set_button_shortcut(obj, scex(_("Add|#A")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->input_extension = obj = fl_add_input(FL_NORMAL_INPUT, 280, 110, 150, 30, idex(_("Extension|#E")));
+ fl_set_button_shortcut(obj, scex(_("Extension|#E")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fdui->input_viewer = obj = fl_add_input(FL_NORMAL_INPUT, 280, 150, 150, 30, idex(_("Viewer|#V")));
+ fl_set_button_shortcut(obj, scex(_("Viewer|#V")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
+
+extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
~FD_form_colours();
FL_FORM *form;
+ FL_OBJECT *browser_x11;
+ FL_OBJECT *input_name;
+ FL_OBJECT *button_browse;
+ FL_OBJECT *button_colour;
+ FL_OBJECT *valslider_red;
+ FL_OBJECT *valslider_green;
+ FL_OBJECT *valslider_blue;
+ FL_OBJECT *browser_lyx_objs;
+};
+struct FD_form_formats {
+ ~FD_form_formats();
+
+ FL_FORM *form;
+ FL_OBJECT *browser_formats;
+ FL_OBJECT *input_format;
+ FL_OBJECT *input_gui_name;
+ FL_OBJECT *button_delete;
+ FL_OBJECT *button_add;
+ FL_OBJECT *input_extension;
+ FL_OBJECT *input_viewer;
};
struct FD_form_lnf_misc {
~FD_form_lnf_misc();
Name: form_citation
Width: 435
Height: 665
-Number of Objects: 13
+Number of Objects: 15
--------------------
class: FL_BOX
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
-box: 230 630 90 30
+box: 130 630 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
callback: C_FormBaseOKCB
argument: 0
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 230 630 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Apply|#A
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_SouthEast FL_SouthEast
+name: button_apply
+callback: C_FormBaseApplyCB
+argument: 0
+
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
callback: C_FormBaseCancelCB
argument: 0
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 10 630 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: Restore|#R
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_SouthWest FL_SouthWest
+name: button_restore
+callback: C_FormBaseRestoreCB
+argument: 0
+
==============================
create_the_forms
Internal Form Definition File
(do not change)
-Number of forms: 12
+Number of forms: 13
Unit of measure: FL_COORD_PIXEL
SnapGrid: 1
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
-label: Default language|#D
+label: Default language|#l
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
Name: form_colours
Width: 450
Height: 360
-Number of Objects: 1
+Number of Objects: 9
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 450 360
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name:
+callback:
+argument:
+
+--------------------
+class: FL_BROWSER
+type: HOLD_BROWSER
+box: 10 25 175 235
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: X11 colour names|#X
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: browser_x11
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 10 285 175 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Name database|#N
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_name
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 190 285 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Browse|#B
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_browse
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 300 230 140 30
+boxtype: FL_BORDER_BOX
+colors: FL_WHITE FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_colour
+callback:
+argument:
+
+--------------------
+class: FL_VALSLIDER
+type: VERT_FILL_SLIDER
+box: 190 25 30 235
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_RED
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_TINY_SIZE
+lcol: FL_BLACK
+label: R|#R
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: valslider_red
+callback: C_FormBaseInputCB
+argument: 0
+ slsize: 0.15
+
+--------------------
+class: FL_VALSLIDER
+type: VERT_FILL_SLIDER
+box: 220 25 30 235
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_GREEN
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_TINY_SIZE
+lcol: FL_BLACK
+label: G|#G
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: valslider_green
+callback: C_FormBaseInputCB
+argument: 0
+ slsize: 0.15
+
+--------------------
+class: FL_VALSLIDER
+type: VERT_FILL_SLIDER
+box: 250 25 30 235
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_BLUE
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_TINY_SIZE
+lcol: FL_BLACK
+label: B|#B
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: valslider_blue
+callback: C_FormBaseInputCB
+argument: 0
+ slsize: 0.15
+
+--------------------
+class: FL_BROWSER
+type: HOLD_BROWSER
+box: 300 25 140 200
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: LyX objects|#L
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: browser_lyx_objs
+callback: C_FormBaseInputCB
+argument: 0
+
+=============== FORM ===============
+Name: form_formats
+Width: 450
+Height: 360
+Number of Objects: 8
--------------------
class: FL_BOX
callback:
argument:
+--------------------
+class: FL_BROWSER
+type: NORMAL_BROWSER
+box: 30 30 160 270
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: All formats|#A
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: browser_formats
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 280 30 150 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Format|#F
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_format
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 280 70 150 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: GUI name|#G
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_gui_name
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 340 270 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Delete|#D
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_delete
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 240 270 90 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Add|#A
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: button_add
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 280 110 150 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Extension|#E
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_extension
+callback: C_FormBaseInputCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 280 150 150 30
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Viewer|#V
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: input_viewer
+callback: C_FormBaseInputCB
+argument: 0
+
=============== FORM ===============
Name: form_lnf_misc
Width: 450
}
+int fl_lowercase_filter(FL_OBJECT * ob,
+ char const * not_used,
+ char const * unused,
+ int c)
+{
+ if (c == 0 /* final test before handing contents to app */
+ || strchr("abcdefghijklmnopqrstuvwxyz", c)) {
+ /* since we only accept numerals then it must be valid */
+ return FL_VALID;
+ }
+ return FL_INVALID|FL_RINGBELL;
+}
+
+
#if 0
/* I've just moved this code here and written a few comments.
still to complete it. ARRae 20000518 */
{
#endif
- /** Only allow whole numbers no '+' or '-' signs or exponents. */
+ /** Only allow whole numbers no '+' or '-' signs or exponents. */
int fl_unsigned_int_filter(FL_OBJECT *, char const *, char const *, int);
+ /** Only allow lowercase letters. */
+int fl_lowercase_filter(FL_OBJECT *, char const *, char const *, int);
+
#if defined(__cplusplus)
}
#endif