Martin Vermeer <[EMAIL PROTECTED]> writes:

| Ehh,
>
| text.C:
>
|    // well this is the caption hack since one caption is really enough
|    if (layout.labeltype == LABEL_SENSITIVE) {
|      if (!cursor.pos())
|          // set to standard-layout
|          cursor.par()->applyLayout(0);
|      else
|          // set to standard-layout
|          cursor.par()->next()->applyLayout(0);
|    }
>
| ...when the only definition of applyLayout I can find expects a string
| argument?
>
| Where is strong typing when you need it?

The problem is '0' it can be converted to any type.

| Fix attached.
>
| Martin
>
>
| Index: text.C
| ===================================================================
| RCS file: /cvs/lyx/lyx-devel/src/text.C,v
| retrieving revision 1.234
| diff -u -p -r1.234 text.C
| --- text.C    2002/03/04 01:06:37     1.234
| +++ text.C    2002/03/05 15:12:39
| @@ -1709,10 +1709,10 @@ void LyXText::breakParagraph(BufferView 
|     if (layout.labeltype == LABEL_SENSITIVE) {
|       if (!cursor.pos())
|            // set to standard-layout
| -          cursor.par()->applyLayout(0);
| +          cursor.par()->applyLayout("Standard");
|       else
|            // set to standard-layout
| -          cursor.par()->next()->applyLayout(0);
| +          cursor.par()->next()->applyLayout("Standard");
|     }
|     
|     /* if the cursor is at the beginning of a row without prior newline, 

Wrong fix.... what if there are no layout named "Standard"?

This is the correct patch:

Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.235
diff -u -p -r1.235 text.C
--- text.C	2002/03/05 14:55:19	1.235
+++ text.C	2002/03/05 16:10:35
@@ -1679,8 +1679,9 @@ void LyXText::breakAgainOneRow(BufferVie
 
 void LyXText::breakParagraph(BufferView * bview, char keep_layout)
 {
-   LyXLayout const & layout =
-	   textclasslist[bview->buffer()->params.textclass][cursor.par()->layout()];
+	LyXTextClass const & tclass =
+		textclasslist[bview->buffer()->params.textclass];
+   LyXLayout const & layout = tclass[cursor.par()->layout()];
 
    // this is only allowed, if the current paragraph is not empty or caption
    if ((cursor.par()->size() <= 0)
@@ -1709,10 +1710,10 @@ void LyXText::breakParagraph(BufferView 
    if (layout.labeltype == LABEL_SENSITIVE) {
      if (!cursor.pos())
 	     // set to standard-layout
-	     cursor.par()->applyLayout(0);
+	     cursor.par()->applyLayout(tclass.defaultLayoutName());
      else
 	     // set to standard-layout
-	     cursor.par()->next()->applyLayout(0);
+	     cursor.par()->next()->applyLayout(tclass.defaultLayoutName());
    }
    
    /* if the cursor is at the beginning of a row without prior newline, 

-- 
        Lgb

Reply via email to