]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_cb.C
ws changes only
[lyx.git] / src / lyx_cb.C
index cc248424d9057155e14a5d073957e8e0ce4c678b..e9dbaccf92657c23fd00e66f46378a697148dbc9 100644 (file)
@@ -1,59 +1,82 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file lyx_cb.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Lars Gullik Bjønnes
+ * \author Angus Leeming
+ * \author John Levon
+ * \author André Pönitz
+ * \author Jürgen Vigna
  *
- *         Copyright 1995 Matthias Ettrich,
- *          Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
 #include "lyx_cb.h"
-#include "lyx_main.h"
+
 #include "buffer.h"
-#include "buffer_funcs.h"
 #include "bufferlist.h"
-#include "bufferview_funcs.h"
+#include "BufferView.h"
 #include "debug.h"
+#include "gettext.h"
 #include "lastfiles.h"
+#include "lyx_main.h"
+#include "lyxlayout.h"
 #include "lyxrc.h"
 #include "lyxtext.h"
-#include "gettext.h"
-#include "BufferView.h"
-#include "Lsstream.h"
-
-#include "insets/insetlabel.h"
+#include "paragraph.h"
 
-#include "frontends/lyx_gui.h"
-#include "frontends/LyXView.h"
 #include "frontends/Alert.h"
 #include "frontends/FileDialog.h"
+#include "frontends/lyx_gui.h"
+#include "frontends/LyXView.h"
 
 #include "support/FileInfo.h"
 #include "support/filetools.h"
 #include "support/forkedcall.h"
+#include "support/lyxlib.h"
+#include "support/os.h"
 #include "support/path.h"
+#include "support/path_defines.h"
 #include "support/systemcall.h"
-#include "support/lstrings.h"
 
-#include <fstream>
-#include <algorithm>
-#include <utility>
 #include <cerrno>
+#include <fstream>
 
-using namespace lyx::support;
+using lyx::support::AddName;
+using lyx::support::bformat;
+using lyx::support::destroyDir;
+using lyx::support::FileInfo;
+using lyx::support::ForkedProcess;
+using lyx::support::IsLyXFilename;
+using lyx::support::LibFileSearch;
+using lyx::support::MakeAbsPath;
+using lyx::support::MakeDisplayPath;
+using lyx::support::OnlyFilename;
+using lyx::support::OnlyPath;
+using lyx::support::Path;
+using lyx::support::removeAutosaveFile;
+using lyx::support::rename;
+using lyx::support::split;
+using lyx::support::system_lyxdir;
+using lyx::support::Systemcall;
+using lyx::support::tempName;
+using lyx::support::unlink;
+using lyx::support::user_lyxdir;
+
+namespace os = lyx::support::os;
 
-using std::vector;
-using std::ifstream;
+using std::back_inserter;
 using std::copy;
 using std::endl;
+using std::make_pair;
+using std::string;
+using std::ifstream;
 using std::ios;
-using std::back_inserter;
 using std::istream_iterator;
-using std::pair;
-using std::make_pair;
+
 
 extern BufferList bufferlist;
 // this should be static, but I need it in buffer.C
@@ -172,11 +195,11 @@ void QuitLyX()
        bufferlist.closeAll();
 
        // do any other cleanup procedures now
-       lyxerr[Debug::INFO] << "Deleting tmp dir " << system_tempdir << endl;
+       lyxerr[Debug::INFO] << "Deleting tmp dir " << os::getTmpDir() << endl;
 
-       if (destroyDir(system_tempdir) != 0) {
+       if (destroyDir(os::getTmpDir()) != 0) {
                string msg = bformat(_("Could not remove the temporary directory %1$s"),
-                       system_tempdir);
+                       os::getTmpDir());
                Alert::warning(_("Could not remove temporary directory"), msg);
        }
 
@@ -336,8 +359,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
                bv->getLyXText()->insertStringAsLines(tmpstr);
        else
                bv->getLyXText()->insertStringAsParagraphs(tmpstr);
-       if (flag)
-               bv->update(BufferView::SELECT);
+       bv->update();
 }
 
 
@@ -387,7 +409,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
        istream_iterator<char> end;
 #if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
        // We use this until the compilers get better...
-       vector<char> tmp;
+       std::vector<char> tmp;
        copy(ii, end, back_inserter(tmp));
        string const tmpstr(tmp.begin(), tmp.end());
 #else
@@ -405,7 +427,7 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
 
 string const getPossibleLabel(BufferView const & bv)
 {
-       ParagraphList::iterator pit = bv.getLyXText()->cursor.par();
+       ParagraphList::iterator pit = bv.getLyXText()->cursorPar();
        ParagraphList & plist = bv.getLyXText()->ownerParagraphs();
 
        LyXLayout_ptr layout = pit->layout();
@@ -430,7 +452,7 @@ string const getPossibleLabel(BufferView const & bv)
            lyxrc.label_init_length < 0)
                text.erase();
 
-       string par_text = pit->asString(bv.buffer(), false);
+       string par_text = pit->asString(*bv.buffer(), false);
        for (int i = 0; i < lyxrc.label_init_length; ++i) {
                if (par_text.empty())
                        break;
@@ -453,10 +475,10 @@ void Reconfigure(BufferView * bv)
        bv->owner()->message(_("Running configure..."));
 
        // Run configure in user lyx directory
-       Path p(user_lyxdir);
+       Path p(user_lyxdir());
        Systemcall one;
        one.startscript(Systemcall::Wait,
-                       AddName(system_lyxdir, "configure"));
+                       AddName(system_lyxdir(), "configure"));
        p.pop();
        bv->owner()->message(_("Reloading configuration..."));
        lyxrc.read(LibFileSearch(string(), "lyxrc.defaults"));