b...@lyx.org wrote:
> Author: baum
> Date: Mon Dec 22 19:12:32 2008
> New Revision: 27954
> 
> URL: http://www.lyx.org/trac/changeset/27954
> Log:
> fix bug 2558: hspace support in math
> 
> The basic idea was to reuse the corresponding text space inset in the same
> fashion as is already done for references. The dialog displays a different
> selection for math than for text. If wanted, the additional spaces could
> also be enabled for text, but that would be a file format change.
> Constructs like \hspace{\mylengthvariable} that are not supported are
> treated by the math parser as ERT as before.

...

> +SpaceInfo space_info[] = {
> +     // name           width kind                         negative visible 
> custom
> +     {"!",              6,   InsetSpaceParams::NEGTHIN,   true,    true,   
> false},
> +     {"negthinspace",   6,   InsetSpaceParams::NEGTHIN,   true,    true,   
> false},
> +     {"negmedspace",    8,   InsetSpaceParams::NEGMEDIUM, true,    true,   
> false},
> +     {"negthickspace", 10,   InsetSpaceParams::NEGTHICK,  true,    true,   
> false},
> +     {",",              6,   InsetSpaceParams::THIN,      false,   true,   
> false},
> +     {"thinspace",      6,   InsetSpaceParams::THIN,      false,   true,   
> false},
> +     {":",              8,   InsetSpaceParams::MEDIUM,    false,   true,   
> false},
> +     {"medspace",       8,   InsetSpaceParams::MEDIUM,    false,   true,   
> false},
> +     {";",             10,   InsetSpaceParams::THICK,     false,   true,   
> false},
> +     {"thickspace",    10,   InsetSpaceParams::THICK,     false,   true,   
> false},
> +     {"enskip",        10,   InsetSpaceParams::ENSKIP,    false,   true,   
> false},
> +     {"quad",          20,   InsetSpaceParams::QUAD,      false,   true,   
> false},
> +     {"qquad",         40,   InsetSpaceParams::QQUAD,     false,   true,   
> false},
> +     {"lyxnegspace",   -2,   InsetSpaceParams::NEGTHIN,   true,    false,  
> false},
> +     {"lyxposspace",    2,   InsetSpaceParams::THIN,      false,   false,  
> false},
> +     {"hspace",         0,   InsetSpaceParams::CUSTOM,    false,   true,   
> true},

...

> +void InsetMathSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
> +{
> +     switch (cmd.action) {
> +     case LFUN_INSET_MODIFY:
> +             if (cmd.getArg(0) == "mathspace") {
> +                     MathData ar;
> +                     if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
> +                             *this = *ar[0].nucleus()->asSpaceInset();
> +                             break;
> +                     }
> +             }
> +             cur.undispatched();
> +             break;
> +
> +     case LFUN_INSET_DIALOG_UPDATE:
> +             cur.bv().updateDialog("mathspace", createDialogStr());
> +             break;
> +
> +     case LFUN_MOUSE_RELEASE:
> +             if (cmd.button() == mouse_button::button1) {
> +                     string const data = createDialogStr();
> +                     cur.bv().showDialog("mathspace", data, this);
> +                     break;
> +             }
> +             cur.undispatched();
> +             break;
> +
> +     case LFUN_MOUSE_PRESS:
> +     case LFUN_MOUSE_MOTION:
> +             // eat other mouse commands
> +             break;
> +
> +     default:
> +             InsetMath::doDispatch(cur, cmd);
> +             break;
> +     }


please can you keep LyXAction.cpp up-to-date wrt changes in lfuns?
pavel

Reply via email to