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.
16 #include "ControlPrefs.h"
19 #include "frontends/LyXView.h"
20 #include "bufferlist.h"
21 #include "helper_funcs.h"
23 #include "support/filetools.h"
24 #include "support/path_defines.h"
25 #include "frontends/Dialogs.h"
26 #include "converter.h"
30 extern BufferList bufferlist;
32 using namespace lyx::support;
37 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
38 : ControlDialogBI(lv, d)
42 void ControlPrefs::setParams()
48 void ControlPrefs::apply()
53 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
55 // The Save button has been pressed
57 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
62 string const ControlPrefs::browsebind(string const & file)
64 string dir = AddName(system_lyxdir(), "bind");
66 string name = _("System Bind|#S#s");
67 pair<string,string> dir1(name, dir);
69 dir = AddName(user_lyxdir(), "bind");
71 name = _("User Bind|#U#u");
72 pair<string,string> dir2(name, dir);
74 return browseFile(file, _("Choose bind file"), "*.bind", false, dir1, dir2);
78 string const ControlPrefs::browseUI(string const & file)
80 string dir = AddName(system_lyxdir(), "ui");
82 string name = _("Sys UI|#S#s");
83 pair<string,string> dir1(name, dir);
85 dir = AddName(user_lyxdir(), "ui");
87 name = _("User UI|#U#u");
88 pair<string,string> dir2(name, dir);
90 return browseFile(file, _("Choose UI file"), "*.ui", false, dir1, dir2);
94 string const ControlPrefs::browsekbmap(string const & file)
96 string const dir = AddName(system_lyxdir(), "kbd");
97 string const name = _("Key maps|#K#k");
98 pair<string, string> dir1(name, dir);
100 return browseFile(file, _("Choose keyboard map"), "*.kmap", false, dir1);
104 string const ControlPrefs::browsedict(string const & file)
106 return browseFile(file, _("Choose personal dictionary"), "*.ispell");
110 string const ControlPrefs::browse(string const & file, string const & title)
112 return browseFile(file, title, "*", true);
116 string const ControlPrefs::browsedir(string const & path, string const & title)
118 return browseDir(path, title);
122 void ControlPrefs::redrawGUI()
124 // we must be sure to get the new values first
127 lv_.getDialogs().redrawGUI();
131 void ControlPrefs::setColor(LColor::color col, string const & hex)
133 string const s = lcolor.getLyXName(col) + ' ' + hex;
134 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
138 void ControlPrefs::updateScreenFonts()
140 // we must be sure to get the new values first
143 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
147 void ControlPrefs::setConverters(Converters const & conv)
150 converters.update(formats);
151 converters.buildGraph();
155 void ControlPrefs::setFormats(Formats const & form)