A first try at colors and format preferences (Angus)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1187 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-11-03 09:47:02 +00:00
parent 916c6bf9d8
commit f2eaff9f30
12 changed files with 846 additions and 44 deletions

View File

@ -1,3 +1,14 @@
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

View File

@ -33,7 +33,8 @@ using std::find;
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
@ -80,6 +81,13 @@ void FormCitation::build()
// 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();
}
@ -281,11 +289,15 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const
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 );
}
@ -294,6 +306,7 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const
#endif
bool FormCitation::input( FL_OBJECT *, long data )
{
bool activate = false;
State cb = static_cast<State>( data );
switch( cb ) {
@ -375,6 +388,7 @@ bool FormCitation::input( FL_OBJECT *, long data )
setBibButtons( OFF );
setCiteButtons( ON );
activate = true;
}
break;
case DELETE:
@ -390,6 +404,7 @@ bool FormCitation::input( FL_OBJECT *, long data )
setBibButtons( ON );
setCiteButtons( OFF );
activate = true;
}
break;
case UP:
@ -410,6 +425,7 @@ bool FormCitation::input( FL_OBJECT *, long data )
fl_select_browser_line( dialog_->citeBrsr, sel-1 );
citekeys.insert( it-1, tmp );
setCiteButtons( ON );
activate = true;
}
break;
case DOWN:
@ -430,12 +446,13 @@ bool FormCitation::input( FL_OBJECT *, long data )
fl_select_browser_line( dialog_->citeBrsr, sel+1 );
citekeys.insert( it+1, tmp );
setCiteButtons( ON );
activate = true;
}
break;
default:
break;
}
return true;
return activate;
}

View File

@ -2,6 +2,7 @@
* FormPreferences Interface Class Implementation
*/
#include <utility>
#include <config.h>
#include FORMS_H_LOCATION
@ -10,6 +11,7 @@
#pragma implementation
#endif
#include "Lsstream.h"
#include "FormPreferences.h"
#include "form_preferences.h"
#include "input_validators.h"
@ -23,6 +25,8 @@
#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"
@ -31,16 +35,26 @@ using SigC::slot;
#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)
{
@ -62,6 +76,7 @@ FormPreferences::~FormPreferences()
delete outputs_tab_;
delete usage_tab_;
delete colours_;
delete formats_;
delete inputs_misc_;
delete interface_;
delete language_;
@ -72,8 +87,8 @@ FormPreferences::~FormPreferences()
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_;
}
@ -92,15 +107,6 @@ void FormPreferences::ok()
}
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
@ -138,6 +144,7 @@ void FormPreferences::build()
// build actual tabfolder contents
// these will become nested tabfolders
buildColours();
buildFormats();
buildInputsMisc();
buildInterface();
buildLanguage();
@ -190,6 +197,9 @@ void FormPreferences::build()
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);
@ -217,6 +227,7 @@ void FormPreferences::apply()
// and other stuff which may cost us a lot on slower/high-load machines.
applyColours();
applyFormats();
applyInputsMisc();
applyInterface();
applyLanguage();
@ -235,6 +246,8 @@ void FormPreferences::feedback( FL_OBJECT * ob )
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_ ) {
@ -271,7 +284,10 @@ bool FormPreferences::input(FL_OBJECT * ob, long)
// 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_ ) {
@ -295,6 +311,7 @@ void FormPreferences::update()
// read lyxrc entries
updateColours();
updateFormats();
updateInputsMisc();
updateInterface();
updateLanguage();
@ -315,6 +332,100 @@ void FormPreferences::applyColours() const
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;
}
@ -324,11 +435,144 @@ string FormPreferences::feedbackColours( FL_OBJECT const * const ) const
}
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);
@ -494,9 +738,11 @@ void FormPreferences::buildLanguage()
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);
@ -505,6 +751,7 @@ void FormPreferences::buildLanguage()
// 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);
@ -513,6 +760,7 @@ void FormPreferences::buildLanguage()
// 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);
@ -520,6 +768,7 @@ void FormPreferences::buildLanguage()
addLanguages( *combo_kbmap_2 );
fl_end_form();
fl_unfreeze_form(language_->form);
// set up the feedback mechanism
fl_addto_form(language_->form);
@ -1344,6 +1593,27 @@ void FormPreferences::buildScreenFonts()
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);
@ -1687,7 +1957,7 @@ bool FormPreferences::inputSpellChecker( FL_OBJECT const * const ob )
}
}
return true; // all input is valid!
return true; // All input is valid!
}
@ -1877,6 +2147,11 @@ void FormPreferences::FeedbackCB(FL_OBJECT * ob, long)
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);

View File

@ -25,19 +25,19 @@
class LyXView;
class Dialogs;
struct FD_form_preferences;
struct FD_form_lnf_misc;
struct FD_form_screen_fonts;
struct FD_form_interface;
struct FD_form_printer;
struct FD_form_paths;
struct FD_form_outer_tab;
struct FD_form_inputs_misc;
struct FD_form_outputs_misc;
struct FD_form_spellchecker;
struct FD_form_language;
struct FD_form_colours;
struct FD_form_formats;
struct FD_form_inputs_misc;
struct FD_form_interface;
struct FD_form_language;
struct FD_form_lnf_misc;
struct FD_form_outer_tab;
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;
class Combox;
/** This class provides an XForms implementation of the FormPreferences Dialog.
@ -65,8 +65,6 @@ private:
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
@ -78,6 +76,8 @@ private:
///
void applyColours() const;
///
void applyFormats() const;
///
void applyInputsMisc() const;
///
void applyInterface() const;
@ -98,6 +98,12 @@ private:
///
void buildColours();
///
bool loadColourBrowser( string const & );
///
int searchColourEntry(std::vector<int> const & ) const;
///
void buildFormats();
///
void buildInputsMisc();
///
void buildInterface();
@ -120,6 +126,8 @@ private:
///
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;
@ -138,6 +146,10 @@ private:
///
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);
@ -148,6 +160,12 @@ private:
///
void updateColours();
///
void updateColoursBrowser( int );
///
void updateColoursRGB();
///
void updateFormats();
///
void updateInputsMisc();
///
void updateInterface();
@ -182,6 +200,8 @@ private:
///
FD_form_colours * build_colours();
///
FD_form_formats * build_formats();
///
FD_form_inputs_misc * build_inputs_misc();
///
FD_form_interface * build_interface();
@ -213,6 +233,8 @@ private:
///
FD_form_colours * colours_;
///
FD_form_formats * formats_;
///
FD_form_inputs_misc * inputs_misc_;
///
FD_form_interface * interface_;

View File

@ -59,13 +59,21 @@ FD_form_citation * FormCitation::build_citation()
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;

View File

@ -7,7 +7,9 @@
/** 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 ****/
@ -27,7 +29,9 @@ struct FD_form_citation {
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_ */

View File

@ -329,8 +329,8 @@ FD_form_language * FormPreferences::build_language()
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")));
@ -397,6 +397,98 @@ FD_form_colours * FormPreferences::build_colours()
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;

View File

@ -21,6 +21,9 @@ 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);
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
@ -123,6 +126,26 @@ struct FD_form_colours {
~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();

View File

@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL
Name: form_citation
Width: 435
Height: 665
Number of Objects: 13
Number of Objects: 15
--------------------
class: FL_BOX
@ -213,7 +213,7 @@ argument:
--------------------
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
@ -228,6 +228,24 @@ name: button_ok
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
@ -246,5 +264,23 @@ name: button_cancel
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

View File

@ -3,7 +3,7 @@ Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 12
Number of forms: 13
Unit of measure: FL_COORD_PIXEL
SnapGrid: 1
@ -990,7 +990,7 @@ alignment: FL_ALIGN_LEFT
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
@ -1164,7 +1164,7 @@ argument: 0
Name: form_colours
Width: 450
Height: 360
Number of Objects: 1
Number of Objects: 9
--------------------
class: FL_BOX
@ -1184,6 +1184,303 @@ 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
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: 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

View File

@ -27,6 +27,20 @@ int fl_unsigned_int_filter(FL_OBJECT * ob,
}
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 */

View File

@ -24,9 +24,12 @@ extern "C"
{
#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