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"
26 #include "frontends/Dialogs.h"
27 #include "frontends/LyXView.h"
29 #include "support/filetools.h"
30 #include "support/path_defines.h"
34 using lyx::support::AddName;
35 using lyx::support::system_lyxdir;
36 using lyx::support::user_lyxdir;
41 extern BufferList bufferlist;
43 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
44 : ControlDialogBI(lv, d)
48 void ControlPrefs::setParams()
54 void ControlPrefs::apply()
59 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
61 // The Save button has been pressed
63 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
68 string const ControlPrefs::browsebind(string const & file)
70 string dir = AddName(system_lyxdir(), "bind");
72 string name = _("System Bind|#S#s");
73 pair<string,string> dir1(name, dir);
75 dir = AddName(user_lyxdir(), "bind");
77 name = _("User Bind|#U#u");
78 pair<string,string> dir2(name, dir);
80 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
84 string const ControlPrefs::browseUI(string const & file)
86 string dir = AddName(system_lyxdir(), "ui");
88 string name = _("Sys UI|#S#s");
89 pair<string,string> dir1(name, dir);
91 dir = AddName(user_lyxdir(), "ui");
93 name = _("User UI|#U#u");
94 pair<string,string> dir2(name, dir);
96 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
100 string const ControlPrefs::browsekbmap(string const & file)
102 string const dir = AddName(system_lyxdir(), "kbd");
103 string const name = _("Key maps|#K#k");
104 pair<string, string> dir1(name, dir);
106 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
110 string const ControlPrefs::browsedict(string const & file)
112 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
116 string const ControlPrefs::browse(string const & file, string const & title)
118 return browseFile(file, title, "*", true);
122 string const ControlPrefs::browsedir(string const & path, string const & title)
124 return browseDir(path, title);
128 void ControlPrefs::redrawGUI()
130 // we must be sure to get the new values first
133 lv_.getDialogs().redrawGUI();
137 void ControlPrefs::setColor(EnumLColor col, string const & hex)
139 string const s = lcolor.getLyXName(col) + ' ' + hex;
140 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
144 void ControlPrefs::updateScreenFonts()
146 // we must be sure to get the new values first
149 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
153 void ControlPrefs::setConverters(Converters const & conv)
156 converters.update(formats);
157 converters.buildGraph();
161 void ControlPrefs::setFormats(Formats const & form)