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 "frontends/Dialogs.h"
25 #include "converter.h"
28 extern string system_lyxdir;
29 extern string user_lyxdir;
30 extern BufferList bufferlist;
35 ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
36 : ControlDialogBI(lv, d)
40 void ControlPrefs::setParams()
46 void ControlPrefs::apply()
51 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
53 // The Save button has been pressed
55 lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
60 string const ControlPrefs::browsebind(string const & file)
62 string dir = AddName(system_lyxdir, "bind");
64 string name = _("System Bind|#S#s");
65 pair<string,string> dir1(name, dir);
67 dir = AddName(user_lyxdir, "bind");
69 name = _("User Bind|#U#u");
70 pair<string,string> dir2(name, dir);
72 return browseFile(&lv_, file, _("Choose bind file"), "*.bind", false, dir1, dir2);
76 string const ControlPrefs::browseUI(string const & file)
78 string dir = AddName(system_lyxdir, "ui");
80 string name = _("Sys UI|#S#s");
81 pair<string,string> dir1(name, dir);
83 dir = AddName(user_lyxdir, "ui");
85 name = _("User UI|#U#u");
86 pair<string,string> dir2(name, dir);
88 return browseFile(&lv_, file, _("Choose UI file"), "*.ui", false, dir1, dir2);
92 string const ControlPrefs::browsekbmap(string const & file)
94 string const dir = AddName(system_lyxdir, "kbd");
95 string const name = _("Key maps|#K#k");
96 pair<string, string> dir1(name, dir);
98 return browseFile(&lv_, file, _("Choose keyboard map"), "*.kmap", false, dir1);
102 string const ControlPrefs::browsedict(string const & file)
104 return browseFile(&lv_, file, _("Choose personal dictionary"), "*.ispell");
108 string const ControlPrefs::browse(string const & file, string const & title)
110 return browseFile(&lv_, file, title, "*", true);
114 string const ControlPrefs::browsedir(string const & path, string const & title)
116 return browseDir(&lv_, path, title);
120 void ControlPrefs::redrawGUI()
122 // we must be sure to get the new values first
125 lv_.getDialogs().redrawGUI();
129 void ControlPrefs::setColor(LColor::color col, string const & hex)
131 string const s = lcolor.getLyXName(col) + ' ' + hex;
132 lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
136 void ControlPrefs::updateScreenFonts()
138 // we must be sure to get the new values first
141 lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
145 void ControlPrefs::setConverters(Converters const & conv)
148 converters.update(formats);
149 converters.buildGraph();
153 void ControlPrefs::setFormats(Formats const & form)