mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Do not reset custom space values if accessed via context menu (#8847)
This commit is contained in:
parent
c89ae3b517
commit
7e259c8d76
@ -231,7 +231,7 @@ Menuset
|
||||
Item "Horizontal Fill (Right Arrow)|g" "inset-modify space \rightarrowfill{}"
|
||||
Item "Horizontal Fill (Up Brace)|p" "inset-modify space \upbracefill{}"
|
||||
Item "Horizontal Fill (Down Brace)|B" "inset-modify space \downbracefill{}"
|
||||
Item "Custom Length|C" "command-sequence inset-modify space \hspace{} \length 1in; inset-settings"
|
||||
Item "Custom Length|C" "command-sequence inset-modify space \hspace{}; inset-settings"
|
||||
Separator
|
||||
Item "Settings...|S" "inset-settings"
|
||||
End
|
||||
@ -263,7 +263,7 @@ Menuset
|
||||
Item "MedSkip|M" "inset-modify vspace medskip"
|
||||
Item "BigSkip|B" "inset-modify vspace bigskip"
|
||||
Item "VFill|F" "inset-modify vspace vfill"
|
||||
Item "Custom|C" "command-sequence inset-modify vspace 1in; inset-settings"
|
||||
Item "Custom|C" "command-sequence inset-modify vspace custom; inset-settings"
|
||||
Separator
|
||||
Item "Settings...|e" "inset-settings"
|
||||
End
|
||||
|
@ -146,10 +146,16 @@ void InsetSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
{
|
||||
switch (cmd.action()) {
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
case LFUN_INSET_MODIFY: {
|
||||
cur.recordUndo();
|
||||
string2params(to_utf8(cmd.argument()), params_);
|
||||
string arg = to_utf8(cmd.argument());
|
||||
if (arg == "space \\hspace{}")
|
||||
arg += params_.length.len().empty()
|
||||
? " \\length 1" + string(stringFromUnit(Length::defaultUnit()))
|
||||
: " \\length " + params_.length.asString();
|
||||
string2params(arg, params_);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
cur.bv().updateDialog("space", params2string(params()));
|
||||
|
@ -59,7 +59,12 @@ void InsetVSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
cur.recordUndo();
|
||||
InsetVSpace::string2params(to_utf8(cmd.argument()), space_);
|
||||
string arg = to_utf8(cmd.argument());
|
||||
if (arg == "vspace custom")
|
||||
arg = (space_.kind() == VSpace::LENGTH)
|
||||
? "vspace " + space_.length().asString()
|
||||
: "vspace 1" + string(stringFromUnit(Length::defaultUnit()));
|
||||
InsetVSpace::string2params(arg, space_);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -78,7 +83,12 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (cmd.getArg(0) == "vspace") {
|
||||
VSpace vspace;
|
||||
InsetVSpace::string2params(to_utf8(cmd.argument()), vspace);
|
||||
string arg = to_utf8(cmd.argument());
|
||||
if (arg == "vspace custom")
|
||||
arg = (space_.kind() == VSpace::LENGTH)
|
||||
? "vspace " + space_.length().asString()
|
||||
: "vspace 1" + string(stringFromUnit(Length::defaultUnit()));
|
||||
InsetVSpace::string2params(arg, vspace);
|
||||
status.setOnOff(vspace == space_);
|
||||
}
|
||||
status.setEnabled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user