[EMAIL PROTECTED] wrote:
> * Create a toolbar button for this purpose by creating and icon with
> the name (?)
It would need to be called layout_Standard.xpm.
> "command-sequence layout Standard;"
> and place it in the directory ??. LyX will then execute the
> command when the user clicks on the icon.
> (Is this how you do it, I don't remember!)
No, only "layout Standard".
> * Do 'new-3', i.e. let 'layout' without argument set the paragraph layout
> to "Standard"
>
> * Create an (optional?) toolbar button for changing to "Standard"
Wrong!!!
Not "Standard", but the default layout of the text class. Not all classes
have a "Standard" layout, but all have a default layout.
The attached patch implements this. OK to go in? Before or after alpha? BTW
there was a "layout.xpm" icon in 1.3. What was its purpose? Should we use
it instead of my new one?
> PS. I discovered that the argument of the LFUN layout is case sensitive.
> In other words, 'layout Standard' works but 'layout standard' doesn't.
> Maybe it should be case insensitive?
Why? Are layout names case insensitive elsewhere?
Georg
Index: src/text3.C
===================================================================
--- src/text3.C (Revision 15932)
+++ src/text3.C (Arbeitskopie)
@@ -809,24 +809,15 @@ void LyXText::dispatch(LCursor & cur, Fu
break;
case LFUN_LAYOUT: {
- lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) "
- << to_utf8(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;
- }
+ string layout = to_ascii(cmd.argument());
+ lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) " << layout << endl;
// Derive layout number from given argument (string)
// and current buffer's textclass (number)
LyXTextClass const & tclass = bv->buffer()->params().getLyXTextClass();
- bool hasLayout = tclass.hasLayout(to_utf8(cmd.argument()));
- string layout = to_utf8(cmd.argument());
+ if (layout.empty())
+ layout = tclass.defaultLayoutName();
+ bool hasLayout = tclass.hasLayout(layout);
// If the entry is obsolete, use the new one instead.
if (hasLayout) {
Index: lib/images/layout.xpm
===================================================================
--- lib/images/layout.xpm (Revision 0)
+++ lib/images/layout.xpm (Revision 0)
@@ -0,0 +1,25 @@
+/* XPM */
+static char * layout_xpm[] = {
+"20 20 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" ................. ",
+" ",
+" ",
+" ................. ",
+" ",
+" ",
+" ................. ",
+" ",
+" ",
+" ................. ",
+" ",
+" ",
+" ................. ",
+" ",
+" ",
+" ................. ",
+" ",
+" "};
Index: lib/ui/stdtoolbars.ui
===================================================================
--- lib/ui/stdtoolbars.ui (Revision 15932)
+++ lib/ui/stdtoolbars.ui (Arbeitskopie)
@@ -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"