Patches to FormPreference from Angus and Dekel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1208 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-11-09 15:28:42 +00:00
parent db2fe3221a
commit f542eaaa6e
9 changed files with 990 additions and 590 deletions

View File

@ -1,3 +1,25 @@
2000-11-08 Dekel Tsur <dekelts@tau.ac.il>
* src/frontends/xforms/FormParagraph.C (updateLanguage): Check
iterators to prevent crash.
2000-11-08 Angus Leeming <a.leeming@ic.ac.uk>
* src/converter.h (getprettyname, getFromToPrettyname): new methods.
* src/frontends/xforms/xform_macros.h (C_PREPOSTHANDLER): new macro
shortcut for xforms CB to the preemptive or post-handler function.
* src/frontends/xforms/forms/form_preferences.fd (form_preferences):
removed the HIDDEN_TIMER as it's no longer used.
Various other small changes.
* src/frontends/xforms/FormPreferences.[Ch]: removed timer. Use a
preemptive handler to obtain feedback, rather than the post-handler.
(ColoursLoadBrowser): find "black" and "white" based on RGB values
rather than name.
Formats tab is now complete. Converters tab is nearly so.
2000-11-09 Juergen Vigna <jug@sad.it>
* src/insets/insettext.C (~InsetText):

View File

@ -48,6 +48,10 @@ public:
string const getname() const {
return name;
}
///
string const getprettyname() const {
return prettyname;
}
};
///
@ -85,6 +89,11 @@ struct Command {
bool visited;
/// Used by the BFS algorithm
std::vector<Command>::iterator previous;
///
std::pair<string, string> const getFromToPrettyname() const {
return std::pair<string, string>(from->prettyname,
to->prettyname);
}
};
class FormatPair {

File diff suppressed because it is too large Load Diff

View File

@ -23,8 +23,11 @@
#pragma interface
#endif
class LyXView;
class Combox;
class Command;
class Dialogs;
class Format;
class LyXView;
struct FD_form_colours;
struct FD_form_converters;
struct FD_form_formats;
@ -39,8 +42,6 @@ struct FD_form_preferences;
struct FD_form_printer;
struct FD_form_screen_fonts;
struct FD_form_spellchecker;
class Combox;
class Format;
/** This class provides an XForms implementation of the FormPreferences Dialog.
The preferences dialog allows users to set/save their preferences.
@ -54,9 +55,8 @@ public:
///
static void ComboLanguageCB(int, void *, Combox *);
///
static void FeedbackCB(FL_OBJECT *, long);
///
void feedbackPost(FL_OBJECT *, int);
static int FeedbackCB(FL_OBJECT *, int,
FL_Coord, FL_Coord, int, void *);
private:
/// helper struct for Colours
@ -88,6 +88,8 @@ private:
virtual void build();
/// control which feedback message is output
void feedback( FL_OBJECT * );
/// The handler for the preemptive feedback
void Feedback(FL_OBJECT *, int);
///
virtual FL_FORM * form() const;
@ -181,6 +183,8 @@ private:
///
bool inputColours(FL_OBJECT const * const);
///
bool inputConverters( FL_OBJECT const * const );
///
bool inputFormats( FL_OBJECT const * const );
///
bool inputLanguage(FL_OBJECT const * const);
@ -230,24 +234,45 @@ private:
void ColoursUpdateBrowser( int );
///
void ColoursUpdateRGB();
///
bool FormatsInputAdd();
///
bool FormatsInputBrowser();
///
bool FormatsInputDelete();
///
bool FormatsInputInput();
///
bool WriteableDir( string const & ) const;
bool ConvertersAdd();
///
bool ReadableDir( string const & ) const;
bool ConvertersBrowser();
///
bool WriteableFile( string const &, string const & = string() ) const;
void ConvertersClear() const;
///
bool ConvertersContainFormat( Format const &) const;
///
bool ConvertersDelete();
///
bool ConvertersInput();
///
bool ConvertersSetCommand( Command & ) const;
///
void ConvertersUpdateChoices();
/// The timer post handler.
void setPostHandler( FL_OBJECT * ) const;
bool FormatsAdd();
///
bool FormatsBrowser();
///
void FormatsClear() const;
///
bool FormatsDelete();
///
bool FormatsInput();
///
bool WriteableDir( string const & );
///
bool ReadableDir( string const & );
///
bool WriteableFile( string const &, string const & = string() );
///
void setPreHandler( FL_OBJECT * ) const;
///
void printWarning( string const & );
/// Type definitions from the fdesign produced header file.
FD_form_preferences * build_preferences();
@ -320,11 +345,11 @@ private:
Combox * combo_kbmap_1;
///
Combox * combo_kbmap_2;
///
FL_OBJECT * feedbackObj;
/// A vector of Formats, to be manipulated in the Format browser.
std::vector<Format> formats_vec;
/// A vector of Commands, to be manipulated in the Converter browser.
std::vector<Command> commands_vec;
/// A vector of RGB colours and associated name.
static std::vector<X11Colour> colourDB;
/** A collection of kmap files.
@ -333,6 +358,8 @@ private:
Eg, system_lyxdir/kbd/american2.kmap, american2
*/
static std::pair<std::vector<string>, std::vector<string> > dirlist;
///
bool warningPosted;
};
inline

View File

@ -45,7 +45,6 @@ FD_form_preferences * FormPreferences::build_preferences()
obj = fl_add_frame(FL_ENGRAVED_FRAME, 0, 425, 470, 1, "");
fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 5, 430, 460, 70, "");
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fdui->timer_feedback = obj = fl_add_timer(FL_HIDDEN_TIMER, 107, 390, 50, 30, "");
fl_end_form();
fdui->form->fdui = fdui;
@ -464,7 +463,7 @@ FD_form_converters * FormPreferences::build_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_HOLD_BROWSER, 30, 30, 160, 270, idex(_("All converters|#A")));
fdui->browser_all = obj = fl_add_browser(FL_HOLD_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);
@ -516,7 +515,7 @@ FD_form_formats * FormPreferences::build_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_HOLD_BROWSER, 30, 30, 160, 270, idex(_("All formats|#A")));
fdui->browser_all = obj = fl_add_browser(FL_HOLD_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);
@ -572,22 +571,22 @@ FD_form_lnf_misc * FormPreferences::build_lnf_misc()
fdui->form = fl_bgn_form(FL_NO_BOX, 450, 350);
fdui->form->u_vdata = this;
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 350, "");
fdui->check_banner = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 15, 310, 30, idex(_("Show banner|#S")));
fdui->check_banner = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 15, 30, 30, idex(_("Show banner|#S")));
fl_set_button_shortcut(obj, scex(_("Show banner|#S")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_set_button(obj, 1);
fdui->check_auto_region_delete = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 45, 310, 30, idex(_("Auto region delete|#A")));
fdui->check_auto_region_delete = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 45, 30, 30, idex(_("Auto region delete|#A")));
fl_set_button_shortcut(obj, scex(_("Auto region delete|#A")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_set_button(obj, 1);
fdui->check_exit_confirm = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 75, 310, 30, idex(_("Exit confirmation|#E")));
fdui->check_exit_confirm = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 75, 30, 30, idex(_("Exit confirmation|#E")));
fl_set_button_shortcut(obj, scex(_("Exit confirmation|#E")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_set_button(obj, 1);
fdui->check_display_shrtcuts = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 105, 310, 30, _("Display keyboard shortcuts"));
fdui->check_display_shrtcuts = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 105, 30, 30, _("Display keyboard shortcuts"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_set_button(obj, 1);
@ -599,12 +598,12 @@ FD_form_lnf_misc * FormPreferences::build_lnf_misc()
fl_set_counter_bounds(obj, 0, 1200);
fl_set_counter_value(obj, 300);
fl_set_counter_step(obj, 1, 1);
fdui->check_ask_new_file = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 135, 310, 30, idex(_("File->New asks for name|#N")));
fdui->check_ask_new_file = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 135, 30, 30, idex(_("File->New asks for name|#N")));
fl_set_button_shortcut(obj, scex(_("File->New asks for name|#N")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fl_set_button(obj, 1);
fdui->check_cursor_follows_scrollbar = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 165, 310, 30, idex(_("Cursor follows scrollbar|#C")));
fdui->check_cursor_follows_scrollbar = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 165, 30, 30, idex(_("Cursor follows scrollbar|#C")));
fl_set_button_shortcut(obj, scex(_("Cursor follows scrollbar|#C")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -661,7 +660,7 @@ FD_form_interface * FormPreferences::build_interface()
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->button_ui_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 148, 80, 30, _("Browse..."));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->check_override_x_dead_keys = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 24, 230, 310, 30, idex(_("Override X-Windows dead-keys|#O")));
fdui->check_override_x_dead_keys = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 24, 230, 30, 30, idex(_("Override X-Windows dead-keys|#O")));
fl_set_button_shortcut(obj, scex(_("Override X-Windows dead-keys|#O")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
@ -740,7 +739,7 @@ FD_form_printer * FormPreferences::build_printer()
fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 130, 10, 80, 30, _("name"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
fdui->check_adapt_output = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 240, 10, 120, 30, _("adapt output"));
fdui->check_adapt_output = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 240, 10, 30, 30, _("adapt output"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 0, 60, 452, 260, _("Printer Command and Flags"));

View File

@ -47,7 +47,6 @@ struct FD_form_preferences {
FL_OBJECT *button_ok;
FL_OBJECT *button_restore;
FL_OBJECT *text_warning;
FL_OBJECT *timer_feedback;
};
struct FD_form_outer_tab {
~FD_form_outer_tab();
@ -142,7 +141,7 @@ struct FD_form_converters {
~FD_form_converters();
FL_FORM *form;
FL_OBJECT *browser_converters;
FL_OBJECT *browser_all;
FL_OBJECT *button_delete;
FL_OBJECT *button_add;
FL_OBJECT *input_converter;
@ -154,7 +153,7 @@ struct FD_form_formats {
~FD_form_formats();
FL_FORM *form;
FL_OBJECT *browser_formats;
FL_OBJECT *browser_all;
FL_OBJECT *input_format;
FL_OBJECT *input_gui_name;
FL_OBJECT *button_delete;

View File

@ -11,7 +11,7 @@ SnapGrid: 1
Name: form_preferences
Width: 470
Height: 500
Number of Objects: 9
Number of Objects: 8
--------------------
class: FL_BOX
@ -36,7 +36,7 @@ class: FL_TABFOLDER
type: TOP_TABFOLDER
box: 5 10 455 375
boxtype: FL_FLAT_BOX
colors: FL_BOTTOM_BCOL FL_COL1
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
@ -157,24 +157,6 @@ name: text_warning
callback:
argument:
--------------------
class: FL_TIMER
type: HIDDEN_TIMER
box: 107 390 50 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_RED
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: timer_feedback
callback:
argument:
=============== FORM ===============
Name: form_outer_tab
Width: 455
@ -204,7 +186,7 @@ class: FL_TABFOLDER
type: TOP_TABFOLDER
box: 0 0 455 375
boxtype: FL_FLAT_BOX
colors: FL_BOTTOM_BCOL FL_COL1
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_TOP_LEFT
style: FL_NORMAL_STYLE
size: FL_DEFAULT_SIZE
@ -1164,7 +1146,7 @@ argument: 0
Name: form_colours
Width: 450
Height: 360
Number of Objects: 9
Number of Objects: 10
--------------------
class: FL_BOX
@ -1241,7 +1223,7 @@ argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 290 230 150 30
box: 180 230 90 30
boxtype: FL_BORDER_BOX
colors: FL_WHITE FL_COL1
alignment: FL_ALIGN_CENTER
@ -1259,7 +1241,7 @@ argument:
--------------------
class: FL_VALSLIDER
type: VERT_FILL_SLIDER
box: 180 25 30 235
box: 180 25 30 200
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_RED
alignment: FL_ALIGN_TOP
@ -1278,7 +1260,7 @@ argument: 0
--------------------
class: FL_VALSLIDER
type: VERT_FILL_SLIDER
box: 210 25 30 235
box: 210 25 30 200
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_GREEN
alignment: FL_ALIGN_TOP
@ -1297,7 +1279,7 @@ argument: 0
--------------------
class: FL_VALSLIDER
type: VERT_FILL_SLIDER
box: 240 25 30 235
box: 240 25 30 200
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_BLUE
alignment: FL_ALIGN_TOP
@ -1331,11 +1313,29 @@ name: browser_lyx_objs
callback: C_FormBaseInputCB
argument: 0
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
box: 350 230 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: Modify|#M
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_modify
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
Name: form_converters
Width: 450
Height: 360
Number of Objects: 7
Number of Objects: 8
--------------------
class: FL_BOX
@ -1369,7 +1369,7 @@ label: All converters|#A
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: browser_converters
name: browser_all
callback: C_FormBaseInputCB
argument: 0
@ -1463,11 +1463,29 @@ name: choice_to
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: Flags|#F
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_flags
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
Name: form_formats
Width: 450
Height: 360
Number of Objects: 8
Number of Objects: 9
--------------------
class: FL_BOX
@ -1501,7 +1519,7 @@ label: All formats|#A
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: browser_formats
name: browser_all
callback: C_FormBaseInputCB
argument: 0
@ -1580,7 +1598,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 280 110 150 30
box: 280 150 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -1598,7 +1616,7 @@ argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 280 150 150 30
box: 280 190 150 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
@ -1613,6 +1631,24 @@ name: input_viewer
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: Shortcut|#S
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_shrtcut
callback: C_FormBaseInputCB
argument: 0
=============== FORM ===============
Name: form_lnf_misc
Width: 450
@ -1640,7 +1676,7 @@ argument:
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 15 15 310 30
box: 15 15 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1659,7 +1695,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 15 45 310 30
box: 15 45 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1678,7 +1714,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 15 75 310 30
box: 15 75 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1697,7 +1733,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 15 105 310 30
box: 15 105 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1708,7 +1744,7 @@ label: Display keyboard shortcuts
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: check_display_shortcuts
name: check_display_shrtcuts
callback: C_FormBaseInputCB
argument: 0
value: 1
@ -1738,7 +1774,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 15 135 310 30
box: 15 135 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1757,7 +1793,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 15 165 310 30
box: 15 165 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -1948,7 +1984,7 @@ argument:
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 24 230 310 30
box: 24 230 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
@ -2297,7 +2333,7 @@ argument: 0
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
box: 240 10 120 30
box: 240 10 30 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER

View File

@ -18,4 +18,13 @@ extern "C" int C_##FN##METHOD(FL_FORM * ob, void * d) \
return FN::METHOD(ob, d); \
}
// The CB used by the preempive and post-object handlers.
#define C_PREPOSTHANDLER(FN, METHOD) \
extern "C" int C_##FN##METHOD(FL_OBJECT * ob, int event, \
FL_Coord mx, FL_Coord my, \
int key, void * xev) \
{ \
return FN::METHOD(ob, event, mx, my, key, xev); \
}
#endif

View File

@ -1610,11 +1610,11 @@ string LyXRC::getDescription(LyXRCTags tag)
break;
case RC_SCREEN_FONT_ENCODING:
str = N_("The norm for the screen fonts.");
str = N_("The encoding for the screen fonts.");
break;
case RC_SCREEN_FONT_ENCODING_MENU:
str = N_("The norm for the menu/popups fonts.");
str = N_("The encoding for the menu/popups fonts.");
break;
case RC_SET_COLOR: