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.
13 #include "ControlPrefs.h"
15 #include "helper_funcs.h"
18 #include "bufferlist.h"
19 #include "converter.h"
22 #include "funcrequest.h"
25 #include "frontends/Dialogs.h"
26 #include "frontends/LyXView.h"
28 #include "support/filetools.h"
29 #include "support/path_defines.h"
33 using namespace lyx::support;
39 extern BufferList bufferlist;
41 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
42 : ControlDialogBI(lv, d)
46 void ControlPrefs::setParams()
52 void ControlPrefs::apply()
57 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
59 // The Save button has been pressed
61 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
66 string const ControlPrefs::browsebind(string const & file)
68 string dir = AddName(system_lyxdir(), "bind");
70 string name = _("System Bind|#S#s");
71 pair<string,string> dir1(name, dir);
73 dir = AddName(user_lyxdir(), "bind");
75 name = _("User Bind|#U#u");
76 pair<string,string> dir2(name, dir);
78 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
82 string const ControlPrefs::browseUI(string const & file)
84 string dir = AddName(system_lyxdir(), "ui");
86 string name = _("Sys UI|#S#s");
87 pair<string,string> dir1(name, dir);
89 dir = AddName(user_lyxdir(), "ui");
91 name = _("User UI|#U#u");
92 pair<string,string> dir2(name, dir);
94 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
98 string const ControlPrefs::browsekbmap(string const & file)
100 string const dir = AddName(system_lyxdir(), "kbd");
101 string const name = _("Key maps|#K#k");
102 pair<string, string> dir1(name, dir);
104 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
108 string const ControlPrefs::browsedict(string const & file)
110 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
114 string const ControlPrefs::browse(string const & file, string const & title)
116 return browseFile(file, title, "*", true);
120 string const ControlPrefs::browsedir(string const & path, string const & title)
122 return browseDir(path, title);
126 void ControlPrefs::redrawGUI()
128 // we must be sure to get the new values first
131 lv_.getDialogs().redrawGUI();
135 void ControlPrefs::setColor(LColor::color col, string const & hex)
137 string const s = lcolor.getLyXName(col) + ' ' + hex;
138 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
142 void ControlPrefs::updateScreenFonts()
144 // we must be sure to get the new values first
147 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
151 void ControlPrefs::setConverters(Converters const & conv)
154 converters.update(formats);
155 converters.buildGraph();
159 void ControlPrefs::setFormats(Formats const & form)