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/globbing.h"
31 #include "support/path_defines.h"
35 using lyx::support::AddName;
36 using lyx::support::FileFilterList;
37 using lyx::support::system_lyxdir;
38 using lyx::support::user_lyxdir;
44 extern BufferList bufferlist;
46 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
47 : ControlDialogBI(lv, d)
51 void ControlPrefs::setParams()
57 void ControlPrefs::apply()
62 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
64 // The Save button has been pressed
66 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
71 string const ControlPrefs::browsebind(string const & file) const
73 string dir = AddName(system_lyxdir(), "bind");
75 string name = _("System Bind|#S#s");
76 pair<string,string> dir1(name, dir);
78 dir = AddName(user_lyxdir(), "bind");
80 name = _("User Bind|#U#u");
81 pair<string,string> dir2(name, dir);
83 return browseFile(file, _("Choose bind file"),
84 FileFilterList("*.bind"), false, dir1, dir2);
88 string const ControlPrefs::browseUI(string const & file) const
90 string dir = AddName(system_lyxdir(), "ui");
92 string name = _("Sys UI|#S#s");
93 pair<string,string> dir1(name, dir);
95 dir = AddName(user_lyxdir(), "ui");
97 name = _("User UI|#U#u");
98 pair<string,string> dir2(name, dir);
100 return browseFile(file, _("Choose UI file"),
101 FileFilterList("*.ui"), false, dir1, dir2);
105 string const ControlPrefs::browsekbmap(string const & file) const
107 string const dir = AddName(system_lyxdir(), "kbd");
108 string const name = _("Key maps|#K#k");
109 pair<string, string> dir1(name, dir);
111 return browseFile(file, _("Choose keyboard map"),
112 FileFilterList("*.kmap"), false, dir1);
116 string const ControlPrefs::browsedict(string const & file) const
118 return browseFile(file, _("Choose personal dictionary"),
119 FileFilterList("*.ispell"));
123 string const ControlPrefs::browse(string const & file,
124 string const & title) const
126 return browseFile(file, title, FileFilterList(), true);
130 string const ControlPrefs::browsedir(string const & path,
131 string const & title) const
133 return browseDir(path, title);
137 void ControlPrefs::redrawGUI()
139 // we must be sure to get the new values first
142 lv_.getDialogs().redrawGUI();
146 void ControlPrefs::setColor(LColor_color col, string const & hex)
148 string const s = lcolor.getLyXName(col) + ' ' + hex;
149 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
153 void ControlPrefs::updateScreenFonts()
155 // we must be sure to get the new values first
158 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
162 void ControlPrefs::setConverters(Converters const & conv)
165 converters.update(formats);
166 converters.buildGraph();
170 void ControlPrefs::setFormats(Formats const & form)