I attach a (partial) diff of my tree against cvs head that contains most of Martin's latest patches namely better super/subscript/^/_ handling in text and math and two new buttons for the math panel.
It seems to work here, but I'd like to hear a 'go' from someone else... Andre' -- André Pönitz .............................................. [EMAIL PROTECTED]
Index: images/sub.xpm =================================================================== RCS file: sub.xpm diff -N sub.xpm --- /dev/null Tue May 5 22:32:27 1998 +++ sub.xpm Thu Jan 3 14:25:18 2002 @@ -0,0 +1,26 @@ +/* XPM */ +static char const * sub_xpm[] = { +"20 20 3 1", +" c #BEFBBEFBBEFB", +". c #000000000000", +"X c #00000000FFFF", +" ", +" ", +" ", +" ", +" ...... ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . ", +" . . XXXXX ", +" . . X X ", +" . . X X ", +" ...... X X ", +" X X ", +" X X ", +" XXXXX ", +" ", +" ", +" "}; Index: images/super.xpm =================================================================== RCS file: super.xpm diff -N super.xpm --- /dev/null Tue May 5 22:32:27 1998 +++ super.xpm Thu Jan 3 14:25:18 2002 @@ -0,0 +1,26 @@ +/* XPM */ +static char const * super_xpm[] = { +"20 20 3 1", +" c #BEFBBEFBBEFB", +". c #00000000FFFF", +"X c #000000000000", +" ", +" ..... ", +" . . ", +" . . ", +" XXXXXX . . ", +" X X . . ", +" X X . . ", +" X X ..... ", +" X X ", +" X X ", +" X X ", +" X X ", +" X X ", +" XXXXXX ", +" ", +" ", +" ", +" ", +" ", +" "}; Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.489 diff -u -p -r1.489 ChangeLog --- src/ChangeLog 2002/01/03 03:14:39 1.489 +++ src/ChangeLog 2002/01/03 13:25:19 @@ -1,3 +1,22 @@ +2002-01-03 Martin Vermeer <[EMAIL PROTECTED]> + + * FormMathsPanel.C: + * FormMathsPanel.h + * MathsSymbols.C: + * form_maths_panel.C: + * form_maths_panel.h: + * form_maths_panel.fd: + implemented sub- and super- 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é). + + * lyxfunc.C: + Allow ^ and _ again to be used both as super/subscript (mathed) + and as themselves (in text). + + 2002-01-03 Allan Rae <[EMAIL PROTECTED]> * LyXView.C (updateWindowTitle): Setup a short icon title of either Index: src/lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.275 diff -u -p -r1.275 lyxfunc.C --- src/lyxfunc.C 2001/12/21 13:55:24 1.275 +++ src/lyxfunc.C 2002/01/03 13:25:19 @@ -559,8 +559,6 @@ func_status::value_type LyXFunc::getStat case LFUN_MATH_LIMITS: case LFUN_MATH_NONUMBER: case LFUN_MATH_NUMBER: - case LFUN_SUBSCRIPT: - case LFUN_SUPERSCRIPT: disable = !mathcursor; break; @@ -1436,12 +1434,18 @@ string const LyXFunc::dispatch(int ac, case LFUN_MATH_NUMBER: case LFUN_MATH_NONUMBER: case LFUN_MATH_LIMITS: - case LFUN_SUBSCRIPT: - case LFUN_SUPERSCRIPT: { setErrorMessage(N_("This is only allowed in math mode!")); } break; + + // passthrough hat and underscore outside mathed: + case LFUN_SUBSCRIPT: + dispatch(LFUN_SELFINSERT, "_"); + break; + case LFUN_SUPERSCRIPT: + dispatch(LFUN_SELFINSERT, "^"); + break; case LFUN_MATH_PANEL: owner->getDialogs()->showMathPanel(); Index: src/frontends/xforms/FormMathsPanel.C =================================================================== RCS file: /usr/local/lyx/cvsroot/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 2002/01/03 13:25:19 @@ -41,6 +41,8 @@ #include "matrix.xpm" #include "space.xpm" #include "sqrt.xpm" +#include "sub.xpm" +#include "super.xpm" #include "arrows.xbm" #include "bop.xbm" @@ -137,6 +139,10 @@ 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_delim, const_cast<char**>(delim)); fl_set_pixmap_data(dialog_->button_deco, @@ -222,6 +228,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: /usr/local/lyx/cvsroot/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 2002/01/03 13:25:19 @@ -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: /usr/local/lyx/cvsroot/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 2002/01/03 13:25:19 @@ -42,6 +42,8 @@ using std::strstr; #include "dots.xbm" #include "mathed/math_parser.h" #include "frac.xpm" +#include "sub.xpm" +#include "super.xpm" #include "sqrt.xpm" #include "delim.xbm" #include "delim.xpm" @@ -146,6 +148,8 @@ 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_DELIM: return delim; case MM_MATRIX: return matrix; case MM_EQU: return equation; Index: src/frontends/xforms/form_maths_panel.C =================================================================== RCS file: /usr/local/lyx/cvsroot/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 2002/01/03 13:25:19 @@ -22,13 +22,13 @@ FD_form_maths_panel * FormMathsPanel::bu FL_OBJECT *obj; FD_form_maths_panel *fdui = new FD_form_maths_panel; - fdui->form = fl_bgn_form(FL_NO_BOX, 274, 226); + fdui->form = fl_bgn_form(FL_NO_BOX, 260, 180); 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 ")); + obj = fl_add_box(FL_UP_BOX, 0, 0, 260, 180, ""); + fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 170, 140, 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")); + fdui->browser_funcs = obj = fl_add_browser(FL_SELECT_BROWSER, 170, 30, 80, 100, +_("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); @@ -52,26 +52,26 @@ FD_form_maths_panel * FormMathsPanel::bu 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); - fdui->button_equation = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 50, 30, 30, ""); + fdui->button_equation = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 40, 30, +30, ""); fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_EQU); - fdui->button_sqrt = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 20, 30, 30, ""); + fdui->button_sqrt = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 10, 10, 30, 30, ""); fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SQRT); - fdui->button_frac = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 20, 30, 30, ""); + fdui->button_frac = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 40, 10, 30, 30, ""); fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_lcolor(obj, FL_COL1); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_FRAC); - fdui->button_delim = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 20, 30, 30, ""); + fdui->button_delim = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 70, 10, 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, 40, 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, ""); + fdui->button_deco = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 100, 10, 30, 30, +""); fl_set_object_color(obj, FL_MCOL, FL_BLUE); fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_DECO); - fdui->button_space = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 20, 30, 30, ""); + fdui->button_space = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 130, 10, 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")); @@ -82,6 +82,12 @@ FD_form_maths_panel * FormMathsPanel::bu 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, 40, 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, 40, 30, 30, +""); + fl_set_object_color(obj, FL_MCOL, FL_BLUE); + fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, MM_SUPER); fl_end_form(); fdui->form->fdui = fdui; Index: src/frontends/xforms/form_maths_panel.h =================================================================== RCS file: /usr/local/lyx/cvsroot/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 2002/01/03 13:25:19 @@ -30,6 +30,8 @@ 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; }; #endif /* FD_form_maths_panel_h_ */ Index: src/frontends/xforms/forms/form_maths_panel.fd =================================================================== RCS file: /usr/local/lyx/cvsroot/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 2002/01/03 13:25:19 @@ -8,14 +8,14 @@ Unit of measure: FL_COORD_PIXEL =============== FORM =============== Name: form_maths_panel -Width: 274 -Height: 226 -Number of Objects: 17 +Width: 260 +Height: 180 +Number of Objects: 19 -------------------- class: FL_BOX type: UP_BOX -box: 0 0 274 226 +box: 0 0 260 180 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -33,7 +33,7 @@ argument: -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 100 180 80 30 +box: 170 140 80 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -51,7 +51,7 @@ argument: 0 -------------------- class: FL_BROWSER type: SELECT_BROWSER -box: 170 30 90 140 +box: 170 30 80 100 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_TOP @@ -160,7 +160,7 @@ argument: MM_MISC -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 130 50 30 30 +box: 130 40 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -178,7 +178,7 @@ argument: MM_EQU -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 10 20 30 30 +box: 10 10 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -196,7 +196,7 @@ argument: MM_SQRT -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 40 20 30 30 +box: 40 10 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -214,7 +214,7 @@ argument: MM_FRAC -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 70 20 30 30 +box: 70 10 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -232,7 +232,7 @@ argument: MM_DELIM -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 10 50 30 30 +box: 100 40 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -250,7 +250,7 @@ argument: MM_MATRIX -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 100 20 30 30 +box: 100 10 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -268,7 +268,7 @@ argument: MM_DECO -------------------- class: FL_PIXMAPBUTTON type: NORMAL_BUTTON -box: 130 20 30 30 +box: 130 10 30 30 boxtype: FL_UP_BOX colors: FL_MCOL FL_BLUE alignment: FL_ALIGN_BOTTOM @@ -318,6 +318,42 @@ gravity: FL_NoGravity FL_NoGravity name: button_varsize callback: C_FormBaseDeprecatedInputCB argument: MM_VARSIZE + +-------------------- +class: FL_PIXMAPBUTTON +type: NORMAL_BUTTON +box: 40 40 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 40 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 ============================== create_the_forms