Add button for default layout to the 'extra' toolbar

* src/text3.C
	(LyXText::dispatch): An empty argument of LFUN_LAYOUT is now allowd
	and means the default layout of the text class

	* lib/images/layout.xpm: New image for default layout

	* lib/Makefile.am: Add new file
	* development/scons/scons_manifest.py: ditto

	* lib/ui/stdtoolbars.ui: Add "Deafult" layout button to the extra toolbar


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@15953 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-11-17 09:56:34 +00:00
parent c904b9aa0c
commit c4b59fab79
6 changed files with 37 additions and 13 deletions

View File

@ -1439,6 +1439,7 @@ lib_images_files = Split('''
footnote-insert.xpm
index-insert.xpm
label-insert.xpm
layout.xpm
layout-document.xpm
layout-paragraph.xpm
layout_Description.xpm

View File

@ -196,6 +196,7 @@ dist_images_DATA = \
images/footnote-insert.xpm \
images/index-insert.xpm \
images/label-insert.xpm \
images/layout.xpm \
images/layout-document.xpm \
images/layout-paragraph.xpm \
images/layout_Description.xpm \

25
lib/images/layout.xpm Normal file
View File

@ -0,0 +1,25 @@
/* XPM */
static char * layout_xpm[] = {
"20 20 2 1",
" c None",
". c #000000",
" ",
" ",
" ................. ",
" ",
" ",
" ................. ",
" ",
" ",
" ................. ",
" ",
" ",
" ................. ",
" ",
" ",
" ................. ",
" ",
" ",
" ................. ",
" ",
" "};

View File

@ -63,6 +63,7 @@ Toolbar "standard" "Standard"
End
Toolbar "extra" "Extra"
Item "Default" "layout"
Item "Numbered list" "layout Enumerate"
Item "Itemized list" "layout Itemize"
Item "List" "layout List"

View File

@ -788,21 +788,13 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) "
<< cmd.argument << endl;
// This is not the good solution to the empty argument
// problem, but it will hopefully suffice for 1.2.0.
// The correct solution would be to augument the
// function list/array with information about what
// functions needs arguments and their type.
if (cmd.argument.empty()) {
cur.errorMessage(_("LyX function 'layout' needs an argument."));
break;
}
// Derive layout number from given argument (string)
// and current buffer's textclass (number)
LyXTextClass const & tclass = bv->buffer()->params().getLyXTextClass();
bool hasLayout = tclass.hasLayout(cmd.argument);
string layout = cmd.argument;
string layout = cmd.argument.empty() ?
tclass.defaultLayoutName() :
cmd.argument;
bool hasLayout = tclass.hasLayout(layout);
// If the entry is obsolete, use the new one instead.
if (hasLayout) {
@ -812,7 +804,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
}
if (!hasLayout) {
cur.errorMessage(string(N_("Layout ")) + cmd.argument +
cur.errorMessage(string(N_("Layout ")) + layout +
N_(" not known"));
break;
}

View File

@ -44,6 +44,10 @@ What's new
- New Galician translation of the documentation (splash, Intro);
Update Hebrew (Intro) and Italian (UserGuide) documentation.
- The layout lfun without an argument does now set the layout to the default
layout of the text class. This is used by a new button "Default" in the
extra toolbar.
** Bug fixes:
* Document Input/Output