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
14 #pragma implementation
19 #include "ControlPrefs.h"
22 #include "frontends/LyXView.h"
23 #include "helper_funcs.h"
25 #include "support/filetools.h"
26 #include "frontends/Dialogs.h"
27 #include "converter.h"
30 extern string system_lyxdir;
31 extern string user_lyxdir;
36 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
37 : ControlDialogBI(lv, d)
41 void ControlPrefs::setParams()
47 void ControlPrefs::apply()
52 // The Save button has been pressed
54 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
59 string const ControlPrefs::browsebind(string const & file)
61 string dir = AddName(system_lyxdir, "bind");
63 string name = _("System Bind|#S#s");
64 pair<string,string> dir1(name, dir);
66 dir = AddName(user_lyxdir, "bind");
68 name = _("User Bind|#U#u");
69 pair<string,string> dir2(name, dir);
71 return browseFile(&lv_, file, _("Choose bind file"), "*.bind", false, dir1, dir2);
75 string const ControlPrefs::browseUI(string const & file)
77 string dir = AddName(system_lyxdir, "ui");
79 string name = _("Sys UI|#S#s");
80 pair<string,string> dir1(name, dir);
82 dir = AddName(user_lyxdir, "ui");
84 name = _("User UI|#U#u");
85 pair<string,string> dir2(name, dir);
87 return browseFile(&lv_, file, _("Choose UI file"), "*.ui", false, dir1, dir2);
91 string const ControlPrefs::browsekbmap(string const & file)
93 string const dir = AddName(system_lyxdir, "kbd");
94 string const name = _("Key maps|#K#k");
95 pair<string, string> dir1(name, dir);
97 return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", false, dir1);
101 string const ControlPrefs::browsedict(string const & file)
103 return browseFile(&lv_, file, _("Choose personal dictionary"), "*.ispell");
107 string const ControlPrefs::browse(string const & file, string const & title)
109 return browseFile(&lv_, file, title, "*", true);
113 void ControlPrefs::redrawGUI()
115 // we must be sure to get the new values first
118 lv_.getDialogs().redrawGUI();
122 void ControlPrefs::setColor(LColor::color col, string const & hex)
124 string const s = lcolor.getLyXName(col) + ' ' + hex;
125 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
129 void ControlPrefs::updateScreenFonts()
131 // we must be sure to get the new values first
134 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
138 void ControlPrefs::setConverters(Converters const & conv)
141 converters.update(formats);
142 converters.buildGraph();
146 void ControlPrefs::setFormats(Formats const & form)