]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
more cursor dispatch
[lyx.git] / src / lyx_cb.C
index 875281607d292001eb2198df2d63a67b844359f6..48ac377406df0ff2497807cf0c895cde8df6fd44 100644 (file)
@@ -19,6 +19,7 @@
 #include "buffer.h"
 #include "bufferlist.h"
 #include "BufferView.h"
+#include "cursor.h"
 #include "debug.h"
 #include "gettext.h"
 #include "lastfiles.h"
@@ -36,6 +37,7 @@
 #include "support/FileInfo.h"
 #include "support/filetools.h"
 #include "support/forkedcall.h"
+#include "support/globbing.h"
 #include "support/lyxlib.h"
 #include "support/os.h"
 #include "support/path.h"
@@ -48,6 +50,7 @@
 using lyx::support::AddName;
 using lyx::support::bformat;
 using lyx::support::destroyDir;
+using lyx::support::FileFilterList;
 using lyx::support::FileInfo;
 using lyx::support::ForkedProcess;
 using lyx::support::IsLyXFilename;
@@ -128,10 +131,12 @@ bool WriteAs(Buffer * buffer, string const & filename)
                if (!IsLyXFilename(fname))
                        fname += ".lyx";
 
+               FileFilterList const filter (_("LyX Documents (*.lyx)"));
+
                FileDialog::Result result =
                        fileDlg.save(OnlyPath(fname),
-                                      _("*.lyx| LyX Documents (*.lyx)"),
-                                      OnlyFilename(fname));
+                                    filter,
+                                    OnlyFilename(fname));
 
                if (result.first == FileDialog::Later)
                        return false;
@@ -354,7 +359,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
 
        // clear the selection
        if (bv->text() == bv->getLyXText())
-               bv->text()->clearSelection();
+               bv->cursor().clearSelection();
        if (asParagraph)
                bv->getLyXText()->insertStringAsParagraphs(tmpstr);
        else
@@ -372,7 +377,9 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
                FileDialog fileDlg(_("Select file to insert"),
                        (asParagraph) ? LFUN_FILE_INSERT_ASCII_PARA : LFUN_FILE_INSERT_ASCII);
 
-               FileDialog::Result result = fileDlg.open(bv->owner()->buffer()->filePath());
+               FileDialog::Result result =
+                       fileDlg.open(bv->owner()->buffer()->filePath(),
+                                    FileFilterList(), string());
 
                if (result.first == FileDialog::Later)
                        return string();
@@ -428,7 +435,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
 string const getPossibleLabel(BufferView const & bv)
 {
        ParagraphList::iterator pit = bv.getLyXText()->cursorPar();
-       ParagraphList & plist = bv.getLyXText()->ownerParagraphs();
+       ParagraphList & plist = bv.getLyXText()->paragraphs();
 
        LyXLayout_ptr layout = pit->layout();