]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
minimal effort implementation of:
[lyx.git] / src / lyxfunc.C
index 59f6c47fe963228c89fedfe0e629638f1933910c..2d1f1b65eba6fd7f58f4d55a84d040a3e31c9746 100644 (file)
@@ -92,6 +92,7 @@
 #include "support/systemcall.h"
 #include "support/convert.h"
 #include "support/os.h"
+#include "support/unicode.h"
 
 #include <boost/current_function.hpp>
 #include <boost/filesystem/operations.hpp>
@@ -248,7 +249,8 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
 
        Encoding const * encoding = view()->cursor().getEncoding();
 
-       encoded_last_key = keysym->getISOEncoded(encoding ? encoding->name() : "");
+       //encoded_last_key = keysym->getISOEncoded(encoding ? encoding->name() : "");
+       size_t encoded_last_key = keysym->getUCSEncoded();
 
        // Do a one-deep top-level lookup for
        // cancel and meta-fake keys. RVDK_PATCH_5
@@ -321,7 +323,8 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
 
        if (func.action == LFUN_SELF_INSERT) {
                if (encoded_last_key != 0) {
-                       string const arg(1, encoded_last_key);
+                       std::vector<char> tmp = ucs4_to_utf8(encoded_last_key);
+                       string const arg(tmp.begin(), tmp.end());
                        dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
                                             FuncRequest::KEYBOARD));
                        lyxerr[Debug::KEY]
@@ -837,22 +840,18 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                case LFUN_BUFFER_UPDATE:
                        Exporter::Export(owner->buffer(), argument, true);
-                       view()->showErrorList(bufferFormat(*owner->buffer()));
                        break;
 
                case LFUN_BUFFER_VIEW:
                        Exporter::preview(owner->buffer(), argument);
-                       view()->showErrorList(bufferFormat(*owner->buffer()));
                        break;
 
                case LFUN_BUILD_PROGRAM:
                        Exporter::Export(owner->buffer(), "program", true);
-                       view()->showErrorList(_("Build"));
                        break;
 
                case LFUN_BUFFER_CHKTEX:
                        owner->buffer()->runChktex();
-                       view()->showErrorList(_("ChkTeX"));
                        break;
 
                case LFUN_BUFFER_EXPORT:
@@ -860,7 +859,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                owner->getDialogs().show("sendto");
                        else {
                                Exporter::Export(owner->buffer(), argument, false);
-                               view()->showErrorList(bufferFormat(*owner->buffer()));
                        }
                        break;
 
@@ -892,8 +890,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                        break;
 
                        } else {
-                               Exporter::Export(buffer, format_name, true,
-                                                filename);
+                               Exporter::Export(buffer, format_name, true, filename);
                        }
 
                        // Substitute $$FName for filename
@@ -1175,11 +1172,11 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                        data = "literate ";
                                        break;
                                }
-                               data += logfile.second;
+                               data += LyXLex::quoteString(logfile.second);
                                owner->getDialogs().show("log", data);
                        } else if (name == "vclog") {
                                string const data = "vc " +
-                                       owner->buffer()->lyxvc().getLogFile();
+                                       LyXLex::quoteString(owner->buffer()->lyxvc().getLogFile());
                                owner->getDialogs().show("log", data);
                        } else
                                owner->getDialogs().show(name, data);
@@ -1555,14 +1552,14 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        recordUndoFullDocument(view());
                        buffer->params().textclass = new_class;
                        StableDocIterator backcur(view()->cursor());
-                       ErrorList el;
+                       ErrorList & el = buffer->errorList("Class Switch");
                        lyx::cap::switchBetweenClasses(
                                old_class, new_class,
                                static_cast<InsetText &>(buffer->inset()), el);
 
                        view()->setCursor(backcur.asDocIterator(&(buffer->inset())));
-                       bufferErrors(*buffer, el);
-                       view()->showErrorList(_("Class switch"));
+
+                       buffer->errors("Class Switch");
                        updateLabels(*buffer);
                        updateforce = true;
                        break;
@@ -1614,13 +1611,14 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                            && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)
                            && !lyxaction.funcHasFlag(cmd.action, LyXAction::ReadOnly))
                                view()->buffer()->markDirty();
-               }
 
-               if (view()->cursor().inTexted()) {
-                       view()->owner()->updateLayoutChoice();
+                       if (view()->cursor().inTexted()) {
+                               view()->owner()->updateLayoutChoice();
+                       }
                }
        }
-       sendDispatchMessage(_(getMessage()), cmd);
+       if (!quitting)
+               sendDispatchMessage(_(getMessage()), cmd);
 }
 
 
@@ -1735,7 +1733,9 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
                templname = result.second;
        }
 
-       owner->setBuffer(newFile(filename, templname, !name.empty()));
+       Buffer * const b = newFile(filename, templname, !name.empty());
+       if (b)
+               owner->setBuffer(b);
 }
 
 
@@ -1790,7 +1790,9 @@ void LyXFunc::open(string const & fname)
        // if the file doesn't exist, let the user create one
        if (!fs::exists(filename)) {
                // the user specifically chose this name. Believe him.
-               owner->setBuffer(newFile(filename, "", true));
+               Buffer * const b = newFile(filename, string(), true);
+               if (b)
+                       owner->setBuffer(b);
                return;
        }
 
@@ -1885,7 +1887,9 @@ void LyXFunc::doImport(string const & argument)
                }
        }
 
-       Importer::Import(owner, filename, format);
+       ErrorList errorList;
+       Importer::Import(owner, filename, format, errorList);
+       // FIXME (Abdel 12/08/06): Is there a need to display the error list here?
 }