]> git.lyx.org Git - lyx.git/blobdiff - src/bufferlist.C
Fix deleting of paragraphs after undo (fix #236).
[lyx.git] / src / bufferlist.C
index 8fd835dd35188f38cca2bfec5afbed46d74e27b3..f0b289eb92f8ac88aaefa1c427beddcec8c75f33 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "bufferlist.h"
 #include "lyx_main.h"
-#include "lyx_gui_misc.h"
 #include "lastfiles.h"
 #include "debug.h"
 #include "lyxrc.h"
@@ -32,6 +31,7 @@
 #include "LyXView.h"
 #include "vc-backend.h"
 #include "TextCache.h"
+#include "lyxtextclasslist.h"
 
 #include "frontends/Alert.h"
 
@@ -198,7 +198,7 @@ bool BufferList::close(Buffer * buf)
                while (reask) {
                        switch (Alert::askConfirmation(_("Changes in document:"),
                                               fname,
-                                              _("Save document?"))){
+                                              _("Save document?"))) {
                        case 1: // Yes
                                if (buf->isUnnamed())
                                        reask = !WriteAs(current_view, buf);
@@ -243,14 +243,16 @@ vector<string> const BufferList::getFileNames() const
 
 Buffer * BufferList::first()
 {
-       if (bstore.empty()) return 0;
+       if (bstore.empty())
+               return 0;
        return bstore.front();
 }
 
 
 Buffer * BufferList::getBuffer(unsigned int choice)
 {
-       if (choice >= bstore.size()) return 0;
+       if (choice >= bstore.size())
+               return 0;
        return bstore[choice];
 }
 
@@ -476,13 +478,15 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
                        }
                }
                if (!templateok) {
-                       Alert::alert(_("Error!"), _("Unable to open template"), 
+                       Alert::alert(_("Error!"), _("Unable to open template"),
                                   MakeDisplayPath(tname));
                        // no template, start with empty buffer
                        b->paragraph = new Paragraph;
+                       b->paragraph->layout(textclasslist[b->params.textclass].defaultLayoutName());
                }
        } else {  // start with empty buffer
                b->paragraph = new Paragraph;
+                       b->paragraph->layout(textclasslist[b->params.textclass].defaultLayoutName());
        }
 
        if (!lyxrc.new_ask_filename && !isNamed) {
@@ -542,7 +546,7 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
                                // How can we know _how_ to do the checkout?
                                // With the current VC support it has to be,
                                // a RCS file since CVS do not have special ,v files.
-                               RCS::retrive(s);
+                               RCS::retrieve(s);
                                return loadLyXFile(filename, tolastfiles);
                        }
                }