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 lyx::support::AddName;
34 using lyx::support::system_lyxdir;
35 using lyx::support::user_lyxdir;
40 extern BufferList bufferlist;
42 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
43 : ControlDialogBI(lv, d)
47 void ControlPrefs::setParams()
53 void ControlPrefs::apply()
58 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
60 // The Save button has been pressed
62 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
67 string const ControlPrefs::browsebind(string const & file)
69 string dir = AddName(system_lyxdir(), "bind");
71 string name = _("System Bind|#S#s");
72 pair<string,string> dir1(name, dir);
74 dir = AddName(user_lyxdir(), "bind");
76 name = _("User Bind|#U#u");
77 pair<string,string> dir2(name, dir);
79 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
83 string const ControlPrefs::browseUI(string const & file)
85 string dir = AddName(system_lyxdir(), "ui");
87 string name = _("Sys UI|#S#s");
88 pair<string,string> dir1(name, dir);
90 dir = AddName(user_lyxdir(), "ui");
92 name = _("User UI|#U#u");
93 pair<string,string> dir2(name, dir);
95 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
99 string const ControlPrefs::browsekbmap(string const & file)
101 string const dir = AddName(system_lyxdir(), "kbd");
102 string const name = _("Key maps|#K#k");
103 pair<string, string> dir1(name, dir);
105 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
109 string const ControlPrefs::browsedict(string const & file)
111 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
115 string const ControlPrefs::browse(string const & file, string const & title)
117 return browseFile(file, title, "*", true);
121 string const ControlPrefs::browsedir(string const & path, string const & title)
123 return browseDir(path, title);
127 void ControlPrefs::redrawGUI()
129 // we must be sure to get the new values first
132 lv_.getDialogs().redrawGUI();
136 void ControlPrefs::setColor(LColor::color col, string const & hex)
138 string const s = lcolor.getLyXName(col) + ' ' + hex;
139 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
143 void ControlPrefs::updateScreenFonts()
145 // we must be sure to get the new values first
148 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
152 void ControlPrefs::setConverters(Converters const & conv)
155 converters.update(formats);
156 converters.buildGraph();
160 void ControlPrefs::setFormats(Formats const & form)