]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
formatting
[lyx.git] / src / lyxfunc.C
index f8fe702f076bdc9281e0902e06f0808f2ed4c64f..f18fe3ada4f723374d6ed2f29f257906f7ed53e9 100644 (file)
@@ -27,6 +27,7 @@
 #include "bufferlist.h"
 #include "bufferparams.h"
 #include "BufferView.h"
+#include "bufferview_funcs.h"
 #include "cursor.h"
 #include "CutAndPaste.h"
 #include "debug.h"
@@ -1017,7 +1018,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                // case 1: print to a file
                                command += lyxrc.print_to_file
                                        + quoteName(makeAbsPath(target_name,
-                                                               path))
+                                                               path).toFilesystemEncoding())
                                        + ' '
                                        + quoteName(dviname);
                                res = one.startscript(Systemcall::DontWait,
@@ -1342,17 +1343,17 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                case LFUN_BUFFER_CHILD_OPEN: {
                        BOOST_ASSERT(lyx_view_);
-                       string const filename =
+                       FileName const filename =
                                makeAbsPath(argument, lyx_view_->buffer()->filePath());
                        // FIXME Should use bformat
                        setMessage(_("Opening child document ") +
-                                        makeDisplayPath(filename) + "...");
+                                        makeDisplayPath(filename.absFilename()) + "...");
                        view()->saveBookmark(false);
                        string const parentfilename = lyx_view_->buffer()->fileName();
-                       if (theBufferList().exists(filename))
-                               lyx_view_->setBuffer(theBufferList().getBuffer(filename));
+                       if (theBufferList().exists(filename.absFilename()))
+                               lyx_view_->setBuffer(theBufferList().getBuffer(filename.absFilename()));
                        else
-                               lyx_view_->loadLyXFile(FileName(filename));
+                               lyx_view_->loadLyXFile(filename);
                        // Set the parent name of the child document.
                        // This makes insertion of citations and references in the child work,
                        // when the target is in the parent or another child document.
@@ -1412,8 +1413,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                }
 
                case LFUN_PREFERENCES_SAVE: {
-                       lyxrc.write(FileName(makeAbsPath("preferences",
-                                                        package().user_support())),
+                       lyxrc.write(makeAbsPath("preferences",
+                                               package().user_support()),
                                    false);
                        break;
                }
@@ -1757,27 +1758,27 @@ void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd
        if (!dispatch_msg.empty())
                dispatch_msg += ' ';
 
-       string comname = lyxaction.getActionName(cmd.action);
+       docstring comname = from_utf8(lyxaction.getActionName(cmd.action));
 
        bool argsadded = false;
 
        if (!cmd.argument().empty()) {
                if (cmd.action != LFUN_UNKNOWN_ACTION) {
-                       comname += ' ' + to_utf8(cmd.argument());
+                       comname += ' ' + cmd.argument();
                        argsadded = true;
                }
        }
 
-       string const shortcuts = to_utf8(theTopLevelKeymap().printbindings(cmd));
+       docstring const shortcuts = theTopLevelKeymap().printbindings(cmd);
 
        if (!shortcuts.empty())
                comname += ": " + shortcuts;
        else if (!argsadded && !cmd.argument().empty())
-               comname += ' ' + to_utf8(cmd.argument());
+               comname += ' ' + cmd.argument();
 
        if (!comname.empty()) {
                comname = rtrim(comname);
-               dispatch_msg += from_utf8('(' + rtrim(comname) + ')');
+               dispatch_msg += '(' + rtrim(comname) + ')';
        }
 
        lyxerr[Debug::ACTION] << "verbose dispatch msg "
@@ -1796,7 +1797,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
        if (view()->buffer()) {
                string const trypath = lyx_view_->buffer()->filePath();
                // If directory is writeable, use this as default.
-               if (isDirWriteable(trypath))
+               if (isDirWriteable(FileName(trypath)))
                        initpath = trypath;
        }
 
@@ -1847,7 +1848,7 @@ void LyXFunc::open(string const & fname)
        if (view()->buffer()) {
                string const trypath = lyx_view_->buffer()->filePath();
                // If directory is writeable, use this as default.
-               if (isDirWriteable(trypath))
+               if (isDirWriteable(FileName(trypath)))
                        initpath = trypath;
        }
 
@@ -1920,7 +1921,7 @@ void LyXFunc::doImport(string const & argument)
                if (view()->buffer()) {
                        string const trypath = lyx_view_->buffer()->filePath();
                        // If directory is writeable, use this as default.
-                       if (isDirWriteable(trypath))
+                       if (isDirWriteable(FileName(trypath)))
                                initpath = trypath;
                }