mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* math macro toolbar can be made automatic
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22265 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2d2a9924e2
commit
4267ad00cd
@ -25,6 +25,7 @@ Include "stdtoolbars.inc"
|
||||
# on: the toolbar is visible
|
||||
# off: the toolbar is not visible
|
||||
# math: the toolbar is visible only when in math
|
||||
# mathmacrotemplate: the toolbar is visible only when in a macro definition
|
||||
# table: the toolbar is visible only when in a table
|
||||
# top: the toolbar should be at the top of the window
|
||||
# bottom: the toolbar should be at the bottom of the window
|
||||
@ -39,6 +40,6 @@ Toolbars
|
||||
"table" "table,bottom"
|
||||
"math_panels" "math,bottom"
|
||||
"math" "math,bottom"
|
||||
"math_macros" "off,bottom"
|
||||
"mathmacrotemplate" "auto,mathmacrotemplate,bottom"
|
||||
"minibuffer" "off,bottom"
|
||||
End
|
||||
|
@ -164,7 +164,7 @@ ToolbarSet
|
||||
Item "Toggle Math Panels" "toolbar-toggle math_panels"
|
||||
End
|
||||
|
||||
Toolbar "math_macros" "Math Macros"
|
||||
Toolbar "mathmacrotemplate" "Math Macros"
|
||||
Item "Remove Last Parameter" "math-macro-remove-param"
|
||||
Item "Append Parameter" "math-macro-add-param"
|
||||
Separator
|
||||
|
@ -243,6 +243,7 @@ void LyXAction::init()
|
||||
{ LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM, "math-macro-add-optional-param", Noop, Math },
|
||||
{ LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM, "math-macro-remove-optional-param", Noop, Math },
|
||||
{ LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM, "math-macro-add-greedy-optional-param", Noop, Math },
|
||||
{ LFUN_IN_MATHMACROTEMPLATE, "in-mathmacrotemplate", Noop, Math },
|
||||
{ LFUN_MENU_OPEN, "menu-open", NoBuffer, Buffer },
|
||||
{ LFUN_META_PREFIX, "meta-prefix", NoBuffer, System },
|
||||
{ LFUN_NEW_LINE, "new-line", Noop, Edit },
|
||||
|
@ -295,6 +295,8 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
|
||||
flag = ToolbarInfo::MATH;
|
||||
else if (!compare_ascii_no_case(*cit, "table"))
|
||||
flag = ToolbarInfo::TABLE;
|
||||
else if (!compare_ascii_no_case(*cit, "mathmacrotemplate"))
|
||||
flag = ToolbarInfo::MATHMACROTEMPLATE;
|
||||
else if (!compare_ascii_no_case(*cit, "review"))
|
||||
flag = ToolbarInfo::REVIEW;
|
||||
else if (!compare_ascii_no_case(*cit, "top"))
|
||||
@ -305,6 +307,8 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
|
||||
flag = ToolbarInfo::LEFT;
|
||||
else if (!compare_ascii_no_case(*cit, "right"))
|
||||
flag = ToolbarInfo::RIGHT;
|
||||
else if (!compare_ascii_no_case(*cit, "auto"))
|
||||
flag = ToolbarInfo::AUTO;
|
||||
else {
|
||||
LYXERR(Debug::ANY,
|
||||
"ToolbarBackend::readToolbarSettings: unrecognised token:`"
|
||||
|
@ -77,7 +77,8 @@ public:
|
||||
LEFT = 64, //< show at left
|
||||
RIGHT = 128, //< show at right
|
||||
REVIEW = 256, //< show when change tracking is enabled
|
||||
AUTO = 512 //< only if AUTO is set, when MATH, TABLE and REVIEW is used
|
||||
AUTO = 512, //< only if AUTO is set, when MATH, TABLE and REVIEW is used
|
||||
MATHMACROTEMPLATE = 1024 //< show in math macro
|
||||
};
|
||||
/// the toolbar items
|
||||
typedef std::vector<ToolbarItem> Items;
|
||||
|
@ -208,7 +208,8 @@ void GuiToolbars::toggleToolbarState(string const & name, bool allowauto)
|
||||
} else if (allowauto
|
||||
&& ((flags & ToolbarInfo::MATH)
|
||||
|| (flags & ToolbarInfo::TABLE)
|
||||
|| (flags & ToolbarInfo::REVIEW))) {
|
||||
|| (flags & ToolbarInfo::REVIEW)
|
||||
|| (flags & ToolbarInfo::MATHMACROTEMPLATE))) {
|
||||
// for math etc, toggle from on -> auto
|
||||
TurnOffFlag(ON);
|
||||
TurnOnFlag(AUTO);
|
||||
@ -223,7 +224,8 @@ void GuiToolbars::toggleToolbarState(string const & name, bool allowauto)
|
||||
#undef TurnOffFlag
|
||||
|
||||
|
||||
void GuiToolbars::update(bool in_math, bool in_table, bool review)
|
||||
void GuiToolbars::update(bool in_math, bool in_table, bool review,
|
||||
bool in_mathmacrotemplate)
|
||||
{
|
||||
updateIcons();
|
||||
|
||||
@ -242,6 +244,8 @@ void GuiToolbars::update(bool in_math, bool in_table, bool review)
|
||||
displayToolbar(*cit, in_table);
|
||||
else if ((cit->flags & ToolbarInfo::AUTO) && (cit->flags & ToolbarInfo::REVIEW))
|
||||
displayToolbar(*cit, review);
|
||||
else if ((cit->flags & ToolbarInfo::AUTO) && (cit->flags & ToolbarInfo::MATHMACROTEMPLATE))
|
||||
displayToolbar(*cit, in_mathmacrotemplate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,8 @@ public:
|
||||
void toggleToolbarState(std::string const & name, bool allowauto);
|
||||
|
||||
/// Update the state of the toolbars.
|
||||
void update(bool in_math, bool in_table, bool review);
|
||||
void update(bool in_math, bool in_table, bool review,
|
||||
bool in_mathmacrotemplate);
|
||||
|
||||
/// Is the Toolbar currently visible?
|
||||
bool visible(std::string const & name) const;
|
||||
|
@ -787,10 +787,12 @@ void GuiView::updateToolbars()
|
||||
bool const review =
|
||||
lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).enabled() &&
|
||||
lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).onoff(true);
|
||||
bool const mathmacrotemplate =
|
||||
lyx::getStatus(FuncRequest(LFUN_IN_MATHMACROTEMPLATE)).enabled();
|
||||
|
||||
d.toolbars_->update(math, table, review);
|
||||
d.toolbars_->update(math, table, review, mathmacrotemplate);
|
||||
} else
|
||||
d.toolbars_->update(false, false, false);
|
||||
d.toolbars_->update(false, false, false, false);
|
||||
|
||||
// update read-only status of open dialogs.
|
||||
checkStatus();
|
||||
|
@ -475,6 +475,7 @@ enum kb_action {
|
||||
|
||||
// 315
|
||||
LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM,
|
||||
LFUN_IN_MATHMACROTEMPLATE,
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
||||
|
@ -646,6 +646,10 @@ bool MathMacroTemplate::getStatus(Cursor & /*cur*/, FuncRequest const & cmd,
|
||||
&& type_ != MacroTypeDef);
|
||||
break;
|
||||
|
||||
case LFUN_IN_MATHMACROTEMPLATE:
|
||||
flag.enabled();
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = false;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user