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"
23 #include "frontends/Dialogs.h"
24 #include "frontends/LyXView.h"
26 #include "support/filetools.h"
27 #include "support/path_defines.h"
31 using namespace lyx::support;
37 extern BufferList bufferlist;
39 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
40 : ControlDialogBI(lv, d)
44 void ControlPrefs::setParams()
50 void ControlPrefs::apply()
55 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
57 // The Save button has been pressed
59 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
64 string const ControlPrefs::browsebind(string const & file)
66 string dir = AddName(system_lyxdir(), "bind");
68 string name = _("System Bind|#S#s");
69 pair<string,string> dir1(name, dir);
71 dir = AddName(user_lyxdir(), "bind");
73 name = _("User Bind|#U#u");
74 pair<string,string> dir2(name, dir);
76 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
80 string const ControlPrefs::browseUI(string const & file)
82 string dir = AddName(system_lyxdir(), "ui");
84 string name = _("Sys UI|#S#s");
85 pair<string,string> dir1(name, dir);
87 dir = AddName(user_lyxdir(), "ui");
89 name = _("User UI|#U#u");
90 pair<string,string> dir2(name, dir);
92 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
96 string const ControlPrefs::browsekbmap(string const & file)
98 string const dir = AddName(system_lyxdir(), "kbd");
99 string const name = _("Key maps|#K#k");
100 pair<string, string> dir1(name, dir);
102 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
106 string const ControlPrefs::browsedict(string const & file)
108 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
112 string const ControlPrefs::browse(string const & file, string const & title)
114 return browseFile(file, title, "*", true);
118 string const ControlPrefs::browsedir(string const & path, string const & title)
120 return browseDir(path, title);
124 void ControlPrefs::redrawGUI()
126 // we must be sure to get the new values first
129 lv_.getDialogs().redrawGUI();
133 void ControlPrefs::setColor(LColor::color col, string const & hex)
135 string const s = lcolor.getLyXName(col) + ' ' + hex;
136 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
140 void ControlPrefs::updateScreenFonts()
142 // we must be sure to get the new values first
145 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
149 void ControlPrefs::setConverters(Converters const & conv)
152 converters.update(formats);
153 converters.buildGraph();
157 void ControlPrefs::setFormats(Formats const & form)