On Fri, Dec 14, 2001 at 08:17:21AM +0100, Andre Poenitz wrote: ... > rote: > > Item 1. does make the key sequences a little longer, but so what? > > People won't like it. I think there are still more mathematicians or > physisists who use LyX than people from the poetry fraction... > > > There are many others already of the same length, and we all type > > happily M-m g D to get a \Delta etc. etc. > > No, I type \Delta. Actually, I type most math exactly the way I would do > when writing LaTeX in vi, so every additional difference annoys me...
OK André, as you want it! With this patch (on top of the earlier patch, applied as I saw), you will 1. be able to use _ and ^ (or ^ space) to get sub- and superscripts 2. be able to insert _ and ^ into text or math by typing @ _ or @ ^ (or @ ^ space) 3. put hat accents over letters by prefixing them by @ ^ (other accents unchanged) 4. inside mathed, use \ as prefix like before: \Delta. [I tried to make the \ the escape character for _ and ^, but that would have resulted in having to type \\Delta. Not good.] 5. Added subscript, superscript, and both-of-them buttons to the math panel. [Here I didn't get it working so that clicking on any of these throws you into math mode, like \frac and \sqrt do; not very serious but if you know how to fix it... ] There is also still some unpleasantness in LyX-handles-deadkeys mode when trying to insert a ^. Beyond me. I attach the patch and the new .xpm's to be placed in the images directory and *added* to CVS. Cheers Martin PS fdesign is pretty cool! -- Martin Vermeer [EMAIL PROTECTED] Helsinki University of Technology Department of Surveying P.O. Box 1200, FIN-02015 HUT, Finland :wq
Index: src/ChangeLog =================================================================== RCS file: /cvs/lyx/lyx-devel/src/ChangeLog,v retrieving revision 1.462 diff -u -p -r1.462 ChangeLog --- src/ChangeLog 2001/12/14 11:55:56 1.462 +++ src/ChangeLog 2001/12/14 13:27:32 @@ -1,3 +1,18 @@ +2001-12-14 Martin Vermeer <[EMAIL PROTECTED]> + + * FormMathsPanel.C: + * FormMathsPanel.h + * MathsSymbols.C: + * form_maths_panel.C: + * form_maths_panel.h: + * form_maths_panel.fd: + implemented sub- super- and both buttons in math panel. + + * lyx_main.C: + Revised hardwired bindings to allow original _ and ^ (or ^ space) + to be used as in TeX (req'd byAndré). @ serves as escape for _ + and ^ in both text and math. + 2001-12-13 Juergen Vigna <[EMAIL PROTECTED]> * undo_funcs.C (textRedo/Undo): fixed as the first paragraph was Index: src/lyx_main.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/lyx_main.C,v retrieving revision 1.98 diff -u -p -r1.98 lyx_main.C --- src/lyx_main.C 2001/12/12 14:37:57 1.98 +++ src/lyx_main.C 2001/12/14 13:27:33 @@ -526,8 +526,13 @@ void LyX::defaultKeyBindings(kb_keymap // sub- and superscript -MV kbmap->bind("~S-underscore", LFUN_SUBSCRIPT); + kbmap->bind("~S-dead_circumflex", LFUN_SUPERSCRIPT); kbmap->bind("~S-asciicircum", LFUN_SUPERSCRIPT); - + // define chars to be escaped + kbmap->bind("~S-at ~S-at", LFUN_SELFINSERT); + kbmap->bind("~S-at ~S-underscore", LFUN_SELFINSERT); + kbmap->bind("~S-at ~S-asciicircum", LFUN_SELFINSERT); + // kbmap->bindings to enable the use of the numeric keypad // e.g. Num Lock set //kbmap->bind("KP_0", LFUN_SELFINSERT); @@ -584,7 +589,7 @@ void LyX::deadKeyBindings(kb_keymap * kb kbmap->bind("~C-~S-~M-dead_caron", LFUN_CARON); kbmap->bind("~C-~S-~M-dead_cedilla", LFUN_CEDILLA); kbmap->bind("~C-~S-~M-dead_abovering", LFUN_CIRCLE); - kbmap->bind("~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX); + kbmap->bind("~S-at ~C-~S-~M-dead_circumflex", LFUN_CIRCUMFLEX); kbmap->bind("~C-~S-~M-dead_abovedot", LFUN_DOT); kbmap->bind("~C-~S-~M-dead_grave", LFUN_GRAVE); kbmap->bind("~C-~S-~M-dead_doubleacute", LFUN_HUNG_UMLAUT); Index: src/frontends/xforms/FormMathsPanel.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/FormMathsPanel.C,v retrieving revision 1.12 diff -u -p -r1.12 FormMathsPanel.C --- src/frontends/xforms/FormMathsPanel.C 2001/09/07 17:55:37 1.12 +++ src/frontends/xforms/FormMathsPanel.C 2001/12/14 13:27:35 @@ -41,6 +41,9 @@ #include "matrix.xpm" #include "space.xpm" #include "sqrt.xpm" +#include "sub.xpm" +#include "super.xpm" +#include "subsuper.xpm" #include "arrows.xbm" #include "bop.xbm" @@ -137,6 +140,12 @@ void FormMathsPanel::build() const_cast<char**>(sqrt_xpm)); fl_set_pixmap_data(dialog_->button_frac, const_cast<char**>(frac)); + fl_set_pixmap_data(dialog_->button_super, + const_cast<char**>(super_xpm)); + fl_set_pixmap_data(dialog_->button_sub, + const_cast<char**>(sub_xpm)); + fl_set_pixmap_data(dialog_->button_subsuper, + const_cast<char**>(subsuper_xpm)); fl_set_pixmap_data(dialog_->button_delim, const_cast<char**>(delim)); fl_set_pixmap_data(dialog_->button_deco, @@ -222,6 +231,20 @@ bool FormMathsPanel::input(FL_OBJECT *, case MM_SQRT: insertSymbol("sqrt"); + break; + + case MM_SUPER: + lv_->getLyXFunc()->dispatch(LFUN_SUPERSCRIPT); + break; + + case MM_SUB: + lv_->getLyXFunc()->dispatch(LFUN_SUBSCRIPT); + break; + + case MM_SUBSUPER: + lv_->getLyXFunc()->dispatch(LFUN_SUBSCRIPT); + lv_->getLyXFunc()->dispatch(LFUN_LEFT); + lv_->getLyXFunc()->dispatch(LFUN_SUPERSCRIPT); break; case MM_DELIM: Index: src/frontends/xforms/FormMathsPanel.h =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/FormMathsPanel.h,v retrieving revision 1.6 diff -u -p -r1.6 FormMathsPanel.h --- src/frontends/xforms/FormMathsPanel.h 2001/09/07 17:55:37 1.6 +++ src/frontends/xforms/FormMathsPanel.h 2001/12/14 13:27:35 @@ -39,6 +39,9 @@ enum MathsCallbackValues { MM_FRAC, MM_SQRT, MM_DELIM, + MM_SUPER, + MM_SUB, + MM_SUBSUPER, MM_MATRIX, MM_EQU, MM_DECO, Index: src/frontends/xforms/MathsSymbols.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/MathsSymbols.C,v retrieving revision 1.9 diff -u -p -r1.9 MathsSymbols.C --- src/frontends/xforms/MathsSymbols.C 2001/08/31 21:15:57 1.9 +++ src/frontends/xforms/MathsSymbols.C 2001/12/14 13:27:36 @@ -42,6 +42,9 @@ using std::strstr; #include "dots.xbm" #include "mathed/math_parser.h" #include "frac.xpm" +#include "sub.xpm" +#include "super.xpm" +#include "subsuper.xpm" #include "sqrt.xpm" #include "delim.xbm" #include "delim.xpm" @@ -146,6 +149,9 @@ static char const ** mathed_get_pixmap_f switch (d) { case MM_FRAC: return frac; case MM_SQRT: return sqrt_xpm; + case MM_SUPER: return super_xpm; + case MM_SUB: return sub_xpm; + case MM_SUBSUPER: return subsuper_xpm; case MM_DELIM: return delim; case MM_MATRIX: return matrix; case MM_EQU: return equation; Index: src/frontends/xforms/form_maths_panel.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/form_maths_panel.C,v retrieving revision 1.3 diff -u -p -r1.3 form_maths_panel.C --- src/frontends/xforms/form_maths_panel.C 2001/11/26 10:19:54 1.3 +++ src/frontends/xforms/form_maths_panel.C 2001/12/14 13:27:36 @@ -25,30 +25,30 @@ FD_form_maths_panel * FormMathsPanel::bu fdui->form = fl_bgn_form(FL_NO_BOX, 274, 226); fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 274, 226, ""); - fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 100, 180, 80, 30, _("Close ")); + fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 180, 180, 80, 30, +_("Close ")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0); fdui->browser_funcs = obj = fl_add_browser(FL_SELECT_BROWSER, 170, 30, 90, 140, _("Functions")); fl_set_object_lalign(obj, FL_ALIGN_TOP); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_FUNC); fl_set_browser_hscrollbar(obj, FL_OFF); - fdui->button_greek = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 80, 50, 30, _("Greek")); + fdui->button_greek = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 120, 50, 30, +_("Greek")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lstyle(obj, 15); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_GREEK); - fdui->button_arrow = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 110, 50, 30, _(" Û")); + fdui->button_arrow = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 150, 50, 30, _(" +Û")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lstyle(obj, 15); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_ARROW); - fdui->button_boperator = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 110, 50, 30, _("± ´")); + fdui->button_boperator = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 150, 50, 30, +_("± ´")); fl_set_object_lsize(obj, 0); fl_set_object_lstyle(obj, 15); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_BOP); - fdui->button_brelats = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 110, 50, 30, _("£ @")); + fdui->button_brelats = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 150, 50, 30, _("£ +@")); fl_set_object_lsize(obj, 0); fl_set_object_lstyle(obj, 15); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_BRELATS); - fdui->button_misc = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 140, 50, 30, _("Misc")); + fdui->button_misc = obj = fl_add_button(FL_NORMAL_BUTTON, 110, 180, 50, 30, +_("Misc")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lstyle(obj, FL_TIMESITALIC_STYLE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_MISC); @@ -65,7 +65,7 @@ FD_form_maths_panel * FormMathsPanel::bu fdui->button_delim = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 20, 30, 30, ""); fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_DELIM); - fdui->button_matrix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 50, 30, 30, ""); + fdui->button_matrix = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 100, 50, 30, 30, +""); fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_MATRIX); fdui->button_deco = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 100, 20, 30, 30, ""); @@ -74,14 +74,23 @@ FD_form_maths_panel * FormMathsPanel::bu fdui->button_space = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 20, 30, 30, ""); fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SPACE); - fdui->button_dots = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 140, 50, 30, _("Dots")); + fdui->button_dots = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 180, 50, 30, +_("Dots")); fl_set_object_lsize(obj, 0); fl_set_object_lstyle(obj, FL_TIMESITALIC_STYLE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_DOTS); - fdui->button_varsize = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 140, 50, 30, _("S ò")); + fdui->button_varsize = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 180, 50, 30, _("S +ò")); fl_set_object_lsize(obj, 0); fl_set_object_lstyle(obj, 15); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_VARSIZE); + fdui->button_sub = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 50, 30, 30, ""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SUB); + fdui->button_super = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 50, 30, 30, +""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SUPER); + fdui->button_subsuper = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 50, 30, 30, +""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SUBSUPER); fl_end_form(); fdui->form->fdui = fdui; Index: src/frontends/xforms/form_maths_panel.h =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/form_maths_panel.h,v retrieving revision 1.2 diff -u -p -r1.2 form_maths_panel.h --- src/frontends/xforms/form_maths_panel.h 2001/08/01 10:08:52 1.2 +++ src/frontends/xforms/form_maths_panel.h 2001/12/14 13:27:36 @@ -30,6 +30,9 @@ struct FD_form_maths_panel { FL_OBJECT *button_space; FL_OBJECT *button_dots; FL_OBJECT *button_varsize; + FL_OBJECT *button_sub; + FL_OBJECT *button_super; + FL_OBJECT *button_subsuper; }; #endif /* FD_form_maths_panel_h_ */ Index: src/frontends/xforms/forms/form_maths_panel.fd =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/forms/form_maths_panel.fd,v retrieving revision 1.2 diff -u -p -r1.2 form_maths_panel.fd --- src/frontends/xforms/forms/form_maths_panel.fd 2001/08/01 10:08:52 1.2 +++ src/frontends/xforms/forms/form_maths_panel.fd 2001/12/14 13:27:36 @@ -10,7 +10,7 @@ Unit of measure: FL_COORD_PIXEL Name: form_maths_panel Width: 274 Height: 226 -Number of Objects: 17 +Number of Objects: 20 -------------------- class: FL_BOX @@ -33,7 +33,7 @@ argument: -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 100 180 80 30 +box: 180 180 80 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -70,7 +70,7 @@ argument: MM_FUNC -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 60 80 50 30 +box: 60 120 50 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -88,7 +88,7 @@ argument: MM_GREEK -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 110 110 50 30 +box: 110 150 50 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -106,7 +106,7 @@ argument: MM_ARROW -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 10 110 50 30 +box: 10 150 50 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -124,7 +124,7 @@ argument: MM_BOP -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 60 110 50 30 +box: 60 150 50 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -142,7 +142,7 @@ argument: MM_BRELATS -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 110 140 50 30 +box: 110 180 50 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -232,7 +232,7 @@ argument: MM_DELIM -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 10 50 30 30 +box: 100 50 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -286,7 +286,7 @@ argument: MM_SPACE -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 60 140 50 30 +box: 60 180 50 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -304,7 +304,7 @@ argument: MM_DOTS -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 10 140 50 30 +box: 10 180 50 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -318,6 +318,60 @@ gravity: FL_NoGravity FL_NoGravity name: button_varsize callback: C_FormBaseDeprecatedInputCB argument: MM_VARSIZE + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 40 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_sub +callback: C_FormBaseDeprecatedInputCB +argument: MM_SUB + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 10 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_super +callback: C_FormBaseDeprecatedInputCB +argument: MM_SUPER + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 70 50 30 30 +boxtype: FL_UP_BOX +colors: FL_MCOL FL_BLUE +alignment: FL_ALIGN_BOTTOM +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_subsuper +callback: C_FormBaseDeprecatedInputCB +argument: MM_SUBSUPER ============================== create_the_forms
sub.xpm
Description: X pixmap
super.xpm
Description: X pixmap
subsuper.xpm
Description: X pixmap
msg30608/pgp00000.pgp
Description: PGP signature