d'oh !

john

-- 
"Take the ideas you find useful. Try not to get hung up on the labels."
        - Jonathan S. Shapiro

Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.170
diff -u -r1.170 ChangeLog
--- ChangeLog   2001/05/23 16:15:14     1.170
+++ ChangeLog   2001/05/24 23:25:54
@@ -1,3 +1,13 @@
+2001-05-25  John Levon  <[EMAIL PROTECTED]>
+
+       * CutAndPaste.C: fix indentation
+
+       * lyxparagraph.h:
+       * lyxtext.h:
+       * paragraph.C:
+       * text2.C: add "clipboard" parameter to prevent
+         label strings from appearing in external pastes
+
 2001-05-23  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
        * lyx_main.C (defaultKeyBindings): set KP_enter to point at
Index: CutAndPaste.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/CutAndPaste.C,v
retrieving revision 1.30
diff -u -r1.30 CutAndPaste.C
--- CutAndPaste.C       2001/05/08 13:28:42     1.30
+++ CutAndPaste.C       2001/05/24 23:25:56
@@ -56,17 +56,17 @@
 // Perhaps it even should take a parameter? (Lgb)
 void DeleteBuffer()
 {
-    if (!buf)
+       if (!buf)
                return;
        
-    LyXParagraph * tmppar;
+       LyXParagraph * tmppar;
        
-    while (buf) {
+       while (buf) {
                tmppar =  buf;
                buf = buf->next();
                delete tmppar;
-    }
-    buf = 0;
+       }
+       buf = 0;
 }
 
 } // namespace anon
@@ -320,11 +320,11 @@
                                             LyXTextClassList::size_type c2,
                                             LyXParagraph * par)
 {
-    int ret = 0;
-    if (!par || c1 == c2)
+       int ret = 0;
+       if (!par || c1 == c2)
                return ret;
 
-    while (par) {
+       while (par) {
                string const name = textclasslist.NameOfLayout(c1,
                                                               par->layout);
                int lay = 0;
@@ -350,14 +350,12 @@
                        par->InsertInset(0, new_inset);
                }
                par = par->next();
-    }
-    return ret;
+       }
+       return ret;
 }
 
 
 bool CutAndPaste::checkPastePossible(LyXParagraph *)
 {
-    if (!buf) return false;
-
-    return true;
+       return buf;
 }
diff -u -r1.77 lyxparagraph.h
--- lyxparagraph.h      2001/05/10 15:53:09     1.77
+++ lyxparagraph.h      2001/05/24 23:26:08
@@ -111,8 +111,9 @@
        ///
 
        string const String(Buffer const *, bool label);
-       ///
-       string const String(Buffer const *, size_type beg, size_type end);
+       /// if clipboard is true, don't include label strings
+       string const String(Buffer const *, size_type beg, size_type end,
+               bool clipboard = false);
        
        ///
        void writeFile(Buffer const *, std::ostream &, BufferParams const &,
Index: lyxtext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
retrieving revision 1.64
diff -u -r1.64 lyxtext.h
--- lyxtext.h   2001/05/03 14:31:31     1.64
+++ lyxtext.h   2001/05/24 23:26:11
@@ -232,8 +232,8 @@
        void SetSelection(BufferView *);
        ///
        void ClearSelection(BufferView *) const;
-       ///
-       string const selectionAsString(Buffer const *) const;
+       /// if clipboard is true, don't add labels
+       string const selectionAsString(Buffer const *, bool clipboard = false) const;
        
        /// just selects the word the cursor is in
        void SelectWord(BufferView *);
Index: paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.138
diff -u -r1.138 paragraph.C
--- paragraph.C 2001/05/09 09:14:48     1.138
+++ paragraph.C 2001/05/24 23:26:15
@@ -2320,11 +2323,12 @@
 
 string const LyXParagraph::String(Buffer const * buffer, 
                            LyXParagraph::size_type beg,
-                           LyXParagraph::size_type end)
+                           LyXParagraph::size_type end,
+                           bool clipboard)
 {
        std::ostringstream ost;
 
-       if (beg == 0 && !params.labelString().empty())
+       if (beg == 0 && !clipboard && !params.labelString().empty())
                ost << params.labelString() << ' ';
 
        for (LyXParagraph::size_type i = beg; i < end; ++i) {
diff -u -r1.125 text2.C
--- text2.C     2001/05/09 09:14:48     1.125
+++ text2.C     2001/05/24 23:26:36
@@ -931,7 +931,7 @@
 }
 
 
-string const LyXText::selectionAsString(Buffer const * buffer) const
+string const LyXText::selectionAsString(Buffer const * buffer, bool clipboard) const
 {
        if (!selection) return string();
        string result;
@@ -940,7 +940,8 @@
        if (sel_start_cursor.par() == sel_end_cursor.par()) {
                result += sel_start_cursor.par()->String(buffer,
                                                         sel_start_cursor.pos(),
-                                                        sel_end_cursor.pos());
+                                                        sel_end_cursor.pos(), 
+                                                        clipboard);
                return result;
        }
        
@@ -949,19 +950,22 @@
        // First paragraph in selection
        result += sel_start_cursor.par()->String(buffer,
                                                 sel_start_cursor.pos(),
-                                                sel_start_cursor.par()->size())
+                                                sel_start_cursor.par()->size(),
+                                                clipboard)
                + "\n\n";
        
        // The paragraphs in between (if any)
        LyXCursor tmpcur(sel_start_cursor);
        tmpcur.par(tmpcur.par()->next());
        while (tmpcur.par() != sel_end_cursor.par()) {
-               result += tmpcur.par()->String(buffer, 0, tmpcur.par()->size()) + 
"\n\n";
+               result += tmpcur.par()->String(buffer, 0, tmpcur.par()->size(),
+                       clipboard) + "\n\n";
                tmpcur.par(tmpcur.par()->next()); // Or NextAfterFootnote??
        }
 
        // Last paragraph in selection
-       result += sel_end_cursor.par()->String(buffer, 0, sel_end_cursor.pos());
+       result += sel_end_cursor.par()->String(buffer, 0, 
+               sel_end_cursor.pos(), clipboard);
        
        return result;
 }
@@ -1605,7 +1609,7 @@
        // finished. The solution used currently just works, to make it
        // faster we need to be more clever and probably also have more
        // calls to stuffClipboard. (Lgb)
-       bview->stuffClipboard(selectionAsString(bview->buffer()));
+       bview->stuffClipboard(selectionAsString(bview->buffer(), true));
 
        // This doesn't make sense, if there is no selection
        if (!selection)
@@ -1681,7 +1685,7 @@
        // finished. The solution used currently just works, to make it
        // faster we need to be more clever and probably also have more
        // calls to stuffClipboard. (Lgb)
-       bview->stuffClipboard(selectionAsString(bview->buffer()));
+       bview->stuffClipboard(selectionAsString(bview->buffer(), true));
 
        // this doesnt make sense, if there is no selection
        if (!selection)

Reply via email to