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;
38 extern BufferList bufferlist;
40 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
41 : ControlDialogBI(lv, d)
45 void ControlPrefs::setParams()
51 void ControlPrefs::apply()
56 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
58 // The Save button has been pressed
60 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
65 string const ControlPrefs::browsebind(string const & file)
67 string dir = AddName(system_lyxdir(), "bind");
69 string name = _("System Bind|#S#s");
70 pair<string,string> dir1(name, dir);
72 dir = AddName(user_lyxdir(), "bind");
74 name = _("User Bind|#U#u");
75 pair<string,string> dir2(name, dir);
77 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
81 string const ControlPrefs::browseUI(string const & file)
83 string dir = AddName(system_lyxdir(), "ui");
85 string name = _("Sys UI|#S#s");
86 pair<string,string> dir1(name, dir);
88 dir = AddName(user_lyxdir(), "ui");
90 name = _("User UI|#U#u");
91 pair<string,string> dir2(name, dir);
93 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
97 string const ControlPrefs::browsekbmap(string const & file)
99 string const dir = AddName(system_lyxdir(), "kbd");
100 string const name = _("Key maps|#K#k");
101 pair<string, string> dir1(name, dir);
103 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
107 string const ControlPrefs::browsedict(string const & file)
109 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
113 string const ControlPrefs::browse(string const & file, string const & title)
115 return browseFile(file, title, "*", true);
119 string const ControlPrefs::browsedir(string const & path, string const & title)
121 return browseDir(path, title);
125 void ControlPrefs::redrawGUI()
127 // we must be sure to get the new values first
130 lv_.getDialogs().redrawGUI();
134 void ControlPrefs::setColor(LColor::color col, string const & hex)
136 string const s = lcolor.getLyXName(col) + ' ' + hex;
137 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
141 void ControlPrefs::updateScreenFonts()
143 // we must be sure to get the new values first
146 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
150 void ControlPrefs::setConverters(Converters const & conv)
153 converters.update(formats);
154 converters.buildGraph();
158 void ControlPrefs::setFormats(Formats const & form)