More pref work from Angus

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1197 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-11-03 17:05:42 +00:00
parent 74eb28ed74
commit 8c84c220e5
6 changed files with 476 additions and 168 deletions

View File

@ -71,7 +71,7 @@ private:
void setCiteButtons( State ) const;
///
void setSize( int, bool ) const;
///
/// Type definition from the fdesign produced header file.
FD_form_citation * build_citation();
/// Real GUI implementation.

View File

@ -43,7 +43,7 @@ using std::vector;
extern string fmt(char const * fmtstr ...);
extern Languages languages;
typedef pair<string, vector<int> > X11Colour;
typedef pair<string, FormPreferences::RGB> X11Colour;
static vector<X11Colour> colourDB;
static string const colourFile = "/usr/lib/X11/rgb.txt";
@ -51,8 +51,10 @@ 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), formats_(0), inputs_misc_(0),
dialog_(0),
converters_tab_(0), inputs_tab_(0), look_n_feel_tab_(0),
outputs_tab_(0), usage_tab_(0),
colours_(0), converters_(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),
@ -71,11 +73,14 @@ FormPreferences::~FormPreferences()
delete combo_kbmap_1;
delete combo_kbmap_2;
delete look_n_feel_tab_;
delete converters_tab_;
delete inputs_tab_;
delete look_n_feel_tab_;
delete outputs_tab_;
delete usage_tab_;
delete colours_;
delete converters_;
delete formats_;
delete inputs_misc_;
delete interface_;
@ -136,14 +141,16 @@ void FormPreferences::build()
minh_ = form()->h;
// build the tab folders
outputs_tab_ = build_outer_tab();
converters_tab_ = build_outer_tab();
look_n_feel_tab_ = build_outer_tab();
inputs_tab_ = build_outer_tab();
outputs_tab_ = build_outer_tab();
usage_tab_ = build_outer_tab();
// build actual tabfolder contents
// these will become nested tabfolders
buildColours();
buildConverters();
buildFormats();
buildInputsMisc();
buildInterface();
@ -159,15 +166,18 @@ void FormPreferences::build()
fl_addto_tabfolder(dialog_->tabfolder_prefs,
_("Look and Feel"),
look_n_feel_tab_->form);
fl_addto_tabfolder(dialog_->tabfolder_prefs,
_("Usage"),
usage_tab_->form);
fl_addto_tabfolder(dialog_->tabfolder_prefs,
_("Converters"),
converters_tab_->form);
fl_addto_tabfolder(dialog_->tabfolder_prefs,
_("Inputs"),
inputs_tab_->form);
fl_addto_tabfolder(dialog_->tabfolder_prefs,
_("Outputs"),
outputs_tab_->form);
fl_addto_tabfolder(dialog_->tabfolder_prefs,
_("Usage"),
usage_tab_->form);
// now build the nested tabfolders
// Starting with look and feel
@ -184,6 +194,14 @@ void FormPreferences::build()
_("Misc"),
lnf_misc_->form);
// then build converters
fl_addto_tabfolder(converters_tab_->tabfolder_outer,
_("Formats"),
formats_->form);
fl_addto_tabfolder(converters_tab_->tabfolder_outer,
_("Converters"),
converters_->form);
// then build inputs
// Paths should probably go in a few outer_tab called Files
fl_addto_tabfolder(inputs_tab_->tabfolder_outer,
@ -197,9 +215,6 @@ 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);
@ -227,6 +242,7 @@ void FormPreferences::apply()
// and other stuff which may cost us a lot on slower/high-load machines.
applyColours();
applyConverters();
applyFormats();
applyInputsMisc();
applyInterface();
@ -246,6 +262,8 @@ void FormPreferences::feedback( FL_OBJECT * ob )
if( ob->form->fdui == colours_ ) {
str = feedbackColours( ob );
} else if( ob->form->fdui == converters_ ) {
str = feedbackConverters( ob );
} else if( ob->form->fdui == formats_ ) {
str = feedbackFormats( ob );
} else if( ob->form->fdui == inputs_misc_ ) {
@ -311,6 +329,7 @@ void FormPreferences::update()
// read lyxrc entries
updateColours();
updateConverters();
updateFormats();
updateInputsMisc();
updateInterface();
@ -354,7 +373,7 @@ void FormPreferences::buildColours()
fl_set_input_return(colours_->input_name, FL_RETURN_END_CHANGED);
if( loadColourBrowser(colourFile) )
if( ColoursLoadBrowser(colourFile) )
fl_set_input(colours_->input_name, colourFile.c_str());
else
fl_set_input(colours_->input_name, N_("No file found"));
@ -365,70 +384,6 @@ void FormPreferences::buildColours()
}
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;
}
string FormPreferences::feedbackColours( FL_OBJECT const * const ) const
{
return string();
@ -442,19 +397,19 @@ bool FormPreferences::inputColours( FL_OBJECT const * const ob )
if( ob == colours_->browser_x11 ) {
int i = fl_get_browser(colours_->browser_x11);
if( i > 0) {
updateColoursBrowser(i-1);
ColoursUpdateBrowser(i-1);
}
} else if( ob == colours_->valslider_red
|| ob == colours_->valslider_green
|| ob == colours_->valslider_blue ) {
updateColoursRGB();
ColoursUpdateRGB();
} else if( ob == colours_->input_name) {
string file = fl_get_input(colours_->input_name);
if( loadColourBrowser(file) )
if( ColoursLoadBrowser(file) )
fl_set_input(colours_->input_name, file.c_str());
else if( loadColourBrowser(colourFile) )
else if( ColoursLoadBrowser(colourFile) )
fl_set_input(colours_->input_name, colourFile.c_str());
else
fl_set_input(colours_->input_name, N_("No file found"));
@ -464,63 +419,105 @@ bool FormPreferences::inputColours( FL_OBJECT const * const ob )
}
void FormPreferences::updateColoursBrowser( int i )
bool FormPreferences::ColoursLoadBrowser( string const & filename )
{
LyXLex lex(0, 0);
if (!lex.setFile(filename))
return false;
istream & is = lex.getStream();
string line;
vector<RGB> cols;
vector<string> names;
while( 1 ) {
getline( is, line );
if( line.empty() )
break;
if( line[0] != '!' ) {
RGB col;
string name;
istringstream iss(line);
iss >> col.r >> col.g >> col.b;
while( iss.good() ) {
string next;
iss >> next;
if( !name.empty() ) name += " ";
name += next;
}
// remove redundant entries on the fly
bool add = cols.empty();
if( !add ) {
vector<RGB>::const_iterator it =
find( cols.begin(), cols.end(), col );
add = (it == cols.end());
}
if ( add ) {
name = lowercase( name );
if( name == "gray0" ) name = "black";
if( name == "gray100" ) name = "white";
if( name == "black" || name == "white" ) {
cols.insert(cols.begin(), col);
names.insert(names.begin(), name);
} else {
cols.push_back(col);
names.push_back(name);
}
}
}
}
vector<string>::iterator sit = names.begin();
for( vector<RGB>::const_iterator iit = cols.begin();
iit != cols.end(); ++iit, ++sit ) {
colourDB.push_back( X11Colour(*sit, *iit) );
}
FL_OBJECT * colbr = colours_->browser_x11;
fl_freeze_form(colours_->form);
fl_clear_browser( colbr );
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);
for( vector<X11Colour>::const_iterator cit = colourDB.begin();
cit != colourDB.end(); ++cit ) {
string name = (*cit).first;
//RGB col = (*cit).second;
//name += " (" + tostr(col.r) + ", " + tostr(col.g) +
// ", " + tostr(col.b) + ")";
fl_addto_browser(colbr, name.c_str());
}
fl_set_browser_topline(colbr, 1);
fl_select_browser_line(colbr, 1);
ColoursUpdateBrowser(0);
fl_unfreeze_form(colours_->form);
return true;
}
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 FormPreferences::ColoursSearchEntry(RGB const & col ) 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];
RGB colDB = (*cit).second;
RGB diff;
diff.r = col.r - colDB.r;
diff.g = col.g - colDB.g;
diff.b = col.b - colDB.b;
int d = (2 * (diff[0] * diff[0]) +
3 * (diff[1] * diff[1]) +
(diff[2] * diff[2]));
int d = (2 * (diff.r * diff.r) +
3 * (diff.g * diff.g) +
(diff.b * diff.b));
if( mindiff > d ) {
mindiff = d;
@ -531,11 +528,74 @@ int FormPreferences::searchColourEntry(vector<int> const & rgb ) const
}
void FormPreferences::ColoursUpdateBrowser( int i )
{
fl_freeze_form(colours_->form);
RGB col = colourDB[i].second;
fl_mapcolor(FL_FREE_COL4+i, col.r, col.g, col.b);
fl_mapcolor(FL_FREE_COL4, col.r, col.g, col.b);
fl_set_slider_value(colours_->valslider_red, col.r);
fl_set_slider_value(colours_->valslider_green, col.g);
fl_set_slider_value(colours_->valslider_blue, col.b);
fl_redraw_object(colours_->button_colour);
fl_unfreeze_form(colours_->form);
}
void FormPreferences::ColoursUpdateRGB()
{
fl_freeze_form(colours_->form);
RGB col;
col.r = int(fl_get_slider_value(colours_->valslider_red));
col.g = int(fl_get_slider_value(colours_->valslider_green));
col.b = int(fl_get_slider_value(colours_->valslider_blue));
fl_mapcolor(FL_FREE_COL4, col.r, col.g, col.b);
fl_redraw_object(colours_->button_colour);
int i = ColoursSearchEntry( col );
// change topline only if necessary
// int top = fl_get_browser_topline(colours_->browser_x11);
// if(i < top || i > (top+15))
fl_set_browser_topline(colours_->browser_x11, i-5);
fl_select_browser_line(colours_->browser_x11, i + 1);
fl_unfreeze_form(colours_->form);
}
void FormPreferences::updateColours()
{
}
void FormPreferences::applyConverters() const
{
}
void FormPreferences::buildConverters()
{
converters_ = build_converters();
}
string FormPreferences::feedbackConverters( FL_OBJECT const * const ) const
{
return string();
}
void FormPreferences::updateConverters()
{
}
void FormPreferences::applyFormats() const
{
}
@ -747,7 +807,7 @@ void FormPreferences::buildLanguage()
combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400);
combo_default_lang->shortcut("#L",1);
combo_default_lang->setcallback(ComboLanguageCB, this);
addLanguages( *combo_default_lang );
LanguagesAdd( *combo_default_lang );
// ditto kbmap_1
obj = language_->choice_kbmap_1;
@ -756,7 +816,7 @@ void FormPreferences::buildLanguage()
combo_kbmap_1->add(obj->x, obj->y, obj->w, obj->h, 400);
combo_kbmap_1->shortcut("#1",1);
combo_kbmap_1->setcallback(ComboLanguageCB, this);
addLanguages( *combo_kbmap_1 );
LanguagesAdd( *combo_kbmap_1 );
// ditto kbmap_2
obj = language_->choice_kbmap_2;
@ -765,7 +825,7 @@ void FormPreferences::buildLanguage()
combo_kbmap_2->add(obj->x, obj->y, obj->w, obj->h, 400);
combo_kbmap_2->shortcut("#2",1);
combo_kbmap_2->setcallback(ComboLanguageCB, this);
addLanguages( *combo_kbmap_2 );
LanguagesAdd( *combo_kbmap_2 );
fl_end_form();
fl_unfreeze_form(language_->form);
@ -793,15 +853,6 @@ void FormPreferences::buildLanguage()
}
void FormPreferences::addLanguages( Combox & combo ) const
{
for(Languages::const_iterator cit = languages.begin();
cit != languages.end(); cit++) {
combo.addto((*cit).second.lang());
}
}
string FormPreferences::feedbackLanguage( FL_OBJECT const * const ob ) const
{
string str;
@ -885,6 +936,15 @@ void FormPreferences::updateLanguage()
}
void FormPreferences::LanguagesAdd( Combox & combo ) const
{
for(Languages::const_iterator cit = languages.begin();
cit != languages.end(); cit++) {
combo.addto((*cit).second.lang());
}
}
void FormPreferences::applyLnFmisc() const
{
lyxrc.show_banner = fl_get_button(lnf_misc_->check_banner);

View File

@ -26,6 +26,7 @@
class LyXView;
class Dialogs;
struct FD_form_colours;
struct FD_form_converters;
struct FD_form_formats;
struct FD_form_inputs_misc;
struct FD_form_interface;
@ -56,6 +57,19 @@ public:
///
void feedbackPost(FL_OBJECT *, int);
/// helper struct for Colours
struct RGB {
int r;
int g;
int b;
RGB() : r(0), g(0), b(0) {}
RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
bool operator==(RGB const & o) const
{ return( r == o.r && g == o.g && b == o.b ); }
bool operator!=(RGB const & o) const
{ return( r != o.r || g != o.g || b != o.b ); }
};
private:
/// Update the dialog.
virtual void update();
@ -73,9 +87,15 @@ private:
void feedback( FL_OBJECT * );
///
virtual FL_FORM * form() const;
/** Folder specific apply functions.
*/
///
void applyColours() const;
///
void applyConverters() const;
///
void applyFormats() const;
///
void applyInputsMisc() const;
@ -95,12 +115,14 @@ private:
void applyScreenFonts() const;
///
void applySpellChecker(); // not const because calls updateSpellChecker!
/** Folder specific build functions.
*/
///
void buildColours();
///
bool loadColourBrowser( string const & );
///
int searchColourEntry(std::vector<int> const & ) const;
void buildConverters();
///
void buildFormats();
///
@ -110,8 +132,6 @@ private:
///
void buildLanguage();
///
void addLanguages( Combox & ) const;
///
void buildLnFmisc();
///
void buildOutputsMisc();
@ -123,9 +143,15 @@ private:
void buildScreenFonts();
///
void buildSpellchecker();
/** Folder specific feedback functions.
*/
///
string feedbackColours(FL_OBJECT const * const) const;
///
string feedbackConverters(FL_OBJECT const * const) const;
///
string feedbackFormats( FL_OBJECT const * const ) const;
///
string feedbackInputsMisc(FL_OBJECT const * const) const;
@ -145,6 +171,10 @@ private:
string feedbackScreenFonts(FL_OBJECT const * const) const;
///
string feedbackSpellChecker(FL_OBJECT const * const) const;
/** Folder specific input functions. Not all folders require one.
*/
///
bool inputColours(FL_OBJECT const * const);
///
@ -157,12 +187,14 @@ private:
bool inputScreenFonts();
///
bool inputSpellChecker(FL_OBJECT const * const);
/** Folder specific update functions.
*/
///
void updateColours();
///
void updateColoursBrowser( int );
///
void updateColoursRGB();
void updateConverters();
///
void updateFormats();
///
@ -184,22 +216,39 @@ private:
///
void updateSpellChecker();
/** Some helper functions for specific folders.
*/
///
void LanguagesAdd( Combox & ) const;
///
bool ColoursLoadBrowser( string const & );
///
int ColoursSearchEntry(RGB const & ) const;
///
void ColoursUpdateBrowser( int );
///
void ColoursUpdateRGB();
///
bool WriteableDir( string const & ) const;
///
bool ReadableDir( string const & ) const;
///
bool WriteableFile( string const &, string const & = string() ) const;
///
/// The timer post handler.
void setPostHandler( FL_OBJECT * ) const;
///
/// Type definitions from the fdesign produced header file.
FD_form_preferences * build_preferences();
///
FD_form_outer_tab * build_outer_tab();
///
FD_form_colours * build_colours();
///
FD_form_converters * build_converters();
///
FD_form_formats * build_formats();
///
FD_form_inputs_misc * build_inputs_misc();
@ -222,15 +271,19 @@ private:
/// Real GUI implementation.
FD_form_preferences * dialog_;
/// Outputs tabfolder
FD_form_outer_tab * outputs_tab_;
/// HCI configuration
FD_form_outer_tab * look_n_feel_tab_;
/// Converters tabfolder
FD_form_outer_tab * converters_tab_;
/// reLyX and other import/input stuff
FD_form_outer_tab * inputs_tab_;
/// HCI configuration
FD_form_outer_tab * look_n_feel_tab_;
/// Outputs tabfolder
FD_form_outer_tab * outputs_tab_;
/// Spellchecker, language stuff, etc
FD_form_outer_tab * usage_tab_;
///
FD_form_converters * converters_;
///
FD_form_colours * colours_;
///
FD_form_formats * formats_;

View File

@ -27,6 +27,7 @@ FD_form_preferences * FormPreferences::build_preferences()
obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 500, "");
fdui->tabfolder_prefs = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 5, 10, 455, 375, "");
fl_set_object_boxtype(obj, FL_FLAT_BOX);
fl_set_object_color(obj, FL_BOTTOM_BCOL, FL_COL1);
fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 390, 90, 30, idex(_("Apply|#A")));
fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
@ -71,6 +72,7 @@ FD_form_outer_tab * FormPreferences::build_outer_tab()
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 455, 375, "");
fdui->tabfolder_outer = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 455, 375, "");
fl_set_object_boxtype(obj, FL_FLAT_BOX);
fl_set_object_color(obj, FL_BOTTOM_BCOL, FL_COL1);
fl_end_form();
fdui->form->fdui = fdui;
@ -397,42 +399,42 @@ 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")));
fdui->browser_x11 = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 25, 150, 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")));
fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 10, 285, 185, 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")));
fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 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, "");
fdui->button_colour = obj = fl_add_button(FL_NORMAL_BUTTON, 290, 230, 150, 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")));
fdui->valslider_red = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 180, 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")));
fdui->valslider_green = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 210, 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")));
fdui->valslider_blue = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 240, 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")));
fdui->browser_lyx_objs = obj = fl_add_browser(FL_HOLD_BROWSER, 290, 25, 150, 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);
@ -445,6 +447,54 @@ FD_form_colours * FormPreferences::build_colours()
}
/*---------------------------------------*/
FD_form_converters::~FD_form_converters()
{
if( form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_converters * FormPreferences::build_converters()
{
FL_OBJECT *obj;
FD_form_converters *fdui = new FD_form_converters;
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_converters = obj = fl_add_browser(FL_NORMAL_BROWSER, 30, 30, 160, 270, idex(_("All converters|#A")));
fl_set_button_shortcut(obj, scex(_("All converters|#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->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_converter = obj = fl_add_input(FL_NORMAL_INPUT, 280, 110, 150, 30, idex(_("Converter|#C")));
fl_set_button_shortcut(obj, scex(_("Converter|#C")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_from = obj = fl_add_choice(FL_NORMAL_CHOICE, 280, 30, 150, 30, idex(_("From|#F")));
fl_set_button_shortcut(obj, scex(_("From|#F")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->choice_to = obj = fl_add_choice(FL_NORMAL_CHOICE, 280, 70, 150, 30, idex(_("To|#T")));
fl_set_button_shortcut(obj, scex(_("To|#T")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
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 );

View File

@ -33,6 +33,8 @@ extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
struct FD_form_preferences {
@ -135,6 +137,17 @@ struct FD_form_colours {
FL_OBJECT *valslider_blue;
FL_OBJECT *browser_lyx_objs;
};
struct FD_form_converters {
~FD_form_converters();
FL_FORM *form;
FL_OBJECT *browser_converters;
FL_OBJECT *button_delete;
FL_OBJECT *button_add;
FL_OBJECT *input_converter;
FL_OBJECT *choice_from;
FL_OBJECT *choice_to;
};
struct FD_form_formats {
~FD_form_formats();

View File

@ -3,7 +3,7 @@ Magic: 13000
Internal Form Definition File
(do not change)
Number of forms: 13
Number of forms: 14
Unit of measure: FL_COORD_PIXEL
SnapGrid: 1
@ -36,7 +36,7 @@ class: FL_TABFOLDER
type: TOP_TABFOLDER
box: 5 10 455 375
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
colors: FL_BOTTOM_BCOL FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
@ -204,7 +204,7 @@ class: FL_TABFOLDER
type: TOP_TABFOLDER
box: 0 0 455 375
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_COL1
colors: FL_BOTTOM_BCOL FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
@ -1187,7 +1187,7 @@ argument:
--------------------
class: FL_BROWSER
type: HOLD_BROWSER
box: 10 25 175 235
box: 10 25 150 235
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP
@ -1205,7 +1205,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 10 285 175 30
box: 10 285 185 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_TOP
@ -1223,7 +1223,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 190 285 90 30
box: 200 285 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
@ -1241,7 +1241,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 300 230 140 30
box: 290 230 150 30
boxtype: FL_BORDER_BOX
colors: FL_WHITE FL_COL1
alignment: FL_ALIGN_CENTER
@ -1259,7 +1259,7 @@ argument:
--------------------
class: FL_VALSLIDER
type: VERT_FILL_SLIDER
box: 190 25 30 235
box: 180 25 30 235
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_RED
alignment: FL_ALIGN_TOP
@ -1278,7 +1278,7 @@ argument: 0
--------------------
class: FL_VALSLIDER
type: VERT_FILL_SLIDER
box: 220 25 30 235
box: 210 25 30 235
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_GREEN
alignment: FL_ALIGN_TOP
@ -1297,7 +1297,7 @@ argument: 0
--------------------
class: FL_VALSLIDER
type: VERT_FILL_SLIDER
box: 250 25 30 235
box: 240 25 30 235
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_TOP
@ -1316,7 +1316,7 @@ argument: 0
--------------------
class: FL_BROWSER
type: HOLD_BROWSER
box: 300 25 140 200
box: 290 25 150 200
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_TOP
@ -1331,6 +1331,138 @@ name: browser_lyx_objs
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
Name: form_converters
Width: 450
Height: 360
Number of Objects: 7
--------------------
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 converters|#A
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: browser_converters
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: Converter|#C
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_converter
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 280 30 150 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: From|#F
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_from
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
box: 280 70 150 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
lcol: FL_BLACK
label: To|#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: choice_to
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
Name: form_formats
Width: 450