mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Inset configurability: separate charstyle and custom insets
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19769 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2cf5e9b563
commit
540f3564f0
19
lib/layouts/stdcustom.inc
Normal file
19
lib/layouts/stdcustom.inc
Normal file
@ -0,0 +1,19 @@
|
||||
# Textclass definition file for LaTeX.
|
||||
# Author : Martin vermeer <amrtin.vermeer@tkk.fi>
|
||||
# Custom Inset layouts definition
|
||||
|
||||
Format 5
|
||||
|
||||
InsetLayout Custom:Endnote
|
||||
LyXType custom
|
||||
LatexName endnote
|
||||
LatexType command
|
||||
Font
|
||||
Size Small
|
||||
EndFont
|
||||
LabelString foot
|
||||
Preamble
|
||||
\usepackage{endnote}
|
||||
EndPreamble
|
||||
End
|
||||
|
@ -295,6 +295,7 @@ Menuset
|
||||
Submenu "Float|a" "insert_float"
|
||||
Submenu "Note|N" "insert_note"
|
||||
Submenu "Branch|B" "insert_branches"
|
||||
Submenu "Custom insets" "insert_custom"
|
||||
Submenu "File|e" "insert_file"
|
||||
Item "Box" "box-insert Frameless"
|
||||
Separator
|
||||
@ -404,6 +405,10 @@ Menuset
|
||||
Branches
|
||||
End
|
||||
|
||||
Menu "insert_custom"
|
||||
Custom
|
||||
End
|
||||
|
||||
#
|
||||
# DOCUMENT MENU
|
||||
#
|
||||
|
@ -218,6 +218,7 @@ Menu & Menu::read(Lexer & lex)
|
||||
md_documents,
|
||||
md_bookmarks,
|
||||
md_charstyles,
|
||||
md_custom,
|
||||
md_endmenu,
|
||||
md_exportformats,
|
||||
md_importformats,
|
||||
@ -240,6 +241,7 @@ Menu & Menu::read(Lexer & lex)
|
||||
{ "bookmarks", md_bookmarks },
|
||||
{ "branches", md_branches },
|
||||
{ "charstyles", md_charstyles },
|
||||
{ "custom", md_custom },
|
||||
{ "documents", md_documents },
|
||||
{ "end", md_endmenu },
|
||||
{ "exportformats", md_exportformats },
|
||||
@ -294,6 +296,10 @@ Menu & Menu::read(Lexer & lex)
|
||||
add(MenuItem(MenuItem::CharStyles));
|
||||
break;
|
||||
|
||||
case md_custom:
|
||||
add(MenuItem(MenuItem::Custom));
|
||||
break;
|
||||
|
||||
case md_documents:
|
||||
add(MenuItem(MenuItem::Documents));
|
||||
break;
|
||||
@ -613,7 +619,7 @@ void expandFloatInsert(Menu & tomenu, Buffer const * buf)
|
||||
}
|
||||
|
||||
|
||||
void expandCharStyleInsert(Menu & tomenu, Buffer const * buf)
|
||||
void expandCharStyleInsert(Menu & tomenu, Buffer const * buf, std::string s)
|
||||
{
|
||||
if (!buf) {
|
||||
tomenu.add(MenuItem(MenuItem::Command,
|
||||
@ -627,8 +633,9 @@ void expandCharStyleInsert(Menu & tomenu, Buffer const * buf)
|
||||
CharStyles::iterator end = charstyles.end();
|
||||
for (; cit != end; ++cit) {
|
||||
docstring const label = from_utf8(cit->name);
|
||||
tomenu.addWithStatusCheck(MenuItem(MenuItem::Command, label,
|
||||
FuncRequest(LFUN_CHARSTYLE_INSERT,
|
||||
if (cit->lyxtype == s)
|
||||
tomenu.addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||
label, FuncRequest(LFUN_CHARSTYLE_INSERT,
|
||||
label)));
|
||||
}
|
||||
}
|
||||
@ -877,7 +884,11 @@ void MenuBackend::expand(Menu const & frommenu, Menu & tomenu,
|
||||
break;
|
||||
|
||||
case MenuItem::CharStyles:
|
||||
expandCharStyleInsert(tomenu, buf);
|
||||
expandCharStyleInsert(tomenu, buf, "charstyle");
|
||||
break;
|
||||
|
||||
case MenuItem::Custom:
|
||||
expandCharStyleInsert(tomenu, buf, "custom");
|
||||
break;
|
||||
|
||||
case MenuItem::FloatListInsert:
|
||||
|
@ -63,6 +63,9 @@ public:
|
||||
/** This is the list of elements available
|
||||
* for insertion into document. */
|
||||
CharStyles,
|
||||
/** This is the list of user-configurable
|
||||
insets to insert into document */
|
||||
Custom,
|
||||
/** This is the list of floats that we can
|
||||
insert a list for. */
|
||||
FloatListInsert,
|
||||
|
@ -698,7 +698,7 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
|
||||
insetlayoutlist_[name] = il;
|
||||
|
||||
// test name for CS:
|
||||
if (il.lyxtype == "charstyle") {
|
||||
if (il.lyxtype == "charstyle" || il.lyxtype == "custom") {
|
||||
charstyles().push_back(il);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user