3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
16 #include "ControlPrefs.h"
19 #include "frontends/LyXView.h"
20 #include "bufferlist.h"
21 #include "helper_funcs.h"
23 #include "support/filetools.h"
24 #include "frontends/Dialogs.h"
25 #include "converter.h"
29 extern string system_lyxdir;
30 extern string user_lyxdir;
31 extern BufferList bufferlist;
33 using namespace lyx::support;
38 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
39 : ControlDialogBI(lv, d)
43 void ControlPrefs::setParams()
49 void ControlPrefs::apply()
54 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
56 // The Save button has been pressed
58 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
63 string const ControlPrefs::browsebind(string const & file)
65 string dir = AddName(system_lyxdir, "bind");
67 string name = _("System Bind|#S#s");
68 pair<string,string> dir1(name, dir);
70 dir = AddName(user_lyxdir, "bind");
72 name = _("User Bind|#U#u");
73 pair<string,string> dir2(name, dir);
75 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
79 string const ControlPrefs::browseUI(string const & file)
81 string dir = AddName(system_lyxdir, "ui");
83 string name = _("Sys UI|#S#s");
84 pair<string,string> dir1(name, dir);
86 dir = AddName(user_lyxdir, "ui");
88 name = _("User UI|#U#u");
89 pair<string,string> dir2(name, dir);
91 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
95 string const ControlPrefs::browsekbmap(string const & file)
97 string const dir = AddName(system_lyxdir, "kbd");
98 string const name = _("Key maps|#K#k");
99 pair<string, string> dir1(name, dir);
101 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
105 string const ControlPrefs::browsedict(string const & file)
107 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
111 string const ControlPrefs::browse(string const & file, string const & title)
113 return browseFile(file, title, "*", true);
117 string const ControlPrefs::browsedir(string const & path, string const & title)
119 return browseDir(path, title);
123 void ControlPrefs::redrawGUI()
125 // we must be sure to get the new values first
128 lv_.getDialogs().redrawGUI();
132 void ControlPrefs::setColor(LColor::color col, string const & hex)
134 string const s = lcolor.getLyXName(col) + ' ' + hex;
135 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
139 void ControlPrefs::updateScreenFonts()
141 // we must be sure to get the new values first
144 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
148 void ControlPrefs::setConverters(Converters const & conv)
151 converters.update(formats);
152 converters.buildGraph();
156 void ControlPrefs::setFormats(Formats const & form)