]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlPrefs.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlPrefs.C
index b36d2ee2fc84187d5463c4b924be21d0bd7aecf1..ed442139e54797d1eafd3fdc55005f1a5b4ab7c5 100644 (file)
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include <utility>
+
 #include "ControlPrefs.h"
 #include "ViewBase.h"
 
 #include "frontends/LyXView.h"
+#include "bufferlist.h"
 #include "helper_funcs.h"
 #include "gettext.h"
 #include "support/filetools.h"
 #include "frontends/Dialogs.h"
 #include "converter.h"
+#include "format.h"
 #include "debug.h"
 
 extern string system_lyxdir;
 extern string user_lyxdir;
+extern BufferList bufferlist;
+
+using namespace lyx::support;
+
 using std::endl;
 using std::pair;
+
 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
        : ControlDialogBI(lv, d)
 {}
@@ -47,30 +49,30 @@ void ControlPrefs::setParams()
 void ControlPrefs::apply()
 {
        view().apply();
-       lyxrc = rc_; 
-}
+       lyxrc = rc_;
 
+       bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
 
-void ControlPrefs::OKButton()
-{
-       ControlDialogBI::OKButton();
-       lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
+       // The Save button has been pressed
+       if (isClosing()) {
+               lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
+       }
 }
 
+
 string const ControlPrefs::browsebind(string const & file)
 {
        string dir  = AddName(system_lyxdir, "bind");
        // FIXME: stupid name
        string name = _("System Bind|#S#s");
        pair<string,string> dir1(name, dir);
+
        dir = AddName(user_lyxdir, "bind");
        // FIXME: stupid name
        name = _("User Bind|#U#u");
        pair<string,string> dir2(name, dir);
-       return browseFile(&lv_, file, _("Choose bind file"), "*.bind", dir1, dir2);
+
+       return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
 }
 
 
@@ -80,35 +82,41 @@ string const ControlPrefs::browseUI(string const & file)
        // FIXME: stupid name
        string name = _("Sys UI|#S#s");
        pair<string,string> dir1(name, dir);
+
        dir = AddName(user_lyxdir, "ui");
        // FIXME: stupid name
        name = _("User UI|#U#u");
        pair<string,string> dir2(name, dir);
-       return browseFile(&lv_, file, _("Choose UI file"), "*.ui", dir1, dir2);
+
+       return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
 }
 
+
 string const ControlPrefs::browsekbmap(string const & file)
 {
        string const dir = AddName(system_lyxdir, "kbd");
        string const name = _("Key maps|#K#k");
        pair<string, string> dir1(name, dir);
-       return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", dir1);
+
+       return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
 }
 
+
 string const ControlPrefs::browsedict(string const & file)
 {
-       return browseFile(&lv_, file, _("Choose personal dictionary"), "*.ispell");
+       return browseFile(file, _("Choose personal dictionary"), "*.ispell");
 }
+
+
 string const ControlPrefs::browse(string const & file, string const & title)
 {
-       return browseFile(&lv_, file, title, "*");
+       return browseFile(file, title, "*", true);
+}
+
+
+string const ControlPrefs::browsedir(string const & path, string const & title)
+{
+       return browseDir(path, title);
 }
 
 
@@ -116,14 +124,14 @@ void ControlPrefs::redrawGUI()
 {
        // we must be sure to get the new values first
        lyxrc = rc_;
+
        lv_.getDialogs().redrawGUI();
 }
 
+
 void ControlPrefs::setColor(LColor::color col, string const & hex)
 {
-       string const s = lcolor.getLyXName(col) + string(" ") + hex;
+       string const s = lcolor.getLyXName(col) + ' ' + hex;
        lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
 }
 
@@ -132,13 +140,13 @@ void ControlPrefs::updateScreenFonts()
 {
        // we must be sure to get the new values first
        lyxrc = rc_;
+
        lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
 }
+
+
 void ControlPrefs::setConverters(Converters const & conv)
-{ 
+{
        converters = conv;
        converters.update(formats);
        converters.buildGraph();