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;
42 extern BufferList bufferlist;
44 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
45 : ControlDialogBI(lv, d)
49 void ControlPrefs::setParams()
55 void ControlPrefs::apply()
60 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
62 // The Save button has been pressed
64 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
69 string const ControlPrefs::browsebind(string const & file)
71 string dir = AddName(system_lyxdir(), "bind");
73 string name = _("System Bind|#S#s");
74 pair<string,string> dir1(name, dir);
76 dir = AddName(user_lyxdir(), "bind");
78 name = _("User Bind|#U#u");
79 pair<string,string> dir2(name, dir);
81 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
85 string const ControlPrefs::browseUI(string const & file)
87 string dir = AddName(system_lyxdir(), "ui");
89 string name = _("Sys UI|#S#s");
90 pair<string,string> dir1(name, dir);
92 dir = AddName(user_lyxdir(), "ui");
94 name = _("User UI|#U#u");
95 pair<string,string> dir2(name, dir);
97 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
101 string const ControlPrefs::browsekbmap(string const & file)
103 string const dir = AddName(system_lyxdir(), "kbd");
104 string const name = _("Key maps|#K#k");
105 pair<string, string> dir1(name, dir);
107 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
111 string const ControlPrefs::browsedict(string const & file)
113 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
117 string const ControlPrefs::browse(string const & file, string const & title)
119 return browseFile(file, title, "*", true);
123 string const ControlPrefs::browsedir(string const & path, string const & title)
125 return browseDir(path, title);
129 void ControlPrefs::redrawGUI()
131 // we must be sure to get the new values first
134 lv_.getDialogs().redrawGUI();
138 void ControlPrefs::setColor(LColor_color col, string const & hex)
140 string const s = lcolor.getLyXName(col) + ' ' + hex;
141 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
145 void ControlPrefs::updateScreenFonts()
147 // we must be sure to get the new values first
150 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
154 void ControlPrefs::setConverters(Converters const & conv)
157 converters.update(formats);
158 converters.buildGraph();
162 void ControlPrefs::setFormats(Formats const & form)