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"
20 #include "funcrequest.h"
23 #include "support/filefilterlist.h"
27 using std::ostringstream;
33 extern BufferList bufferlist;
37 using support::FileFilterList;
42 ControlPrefs::ControlPrefs(Dialog & parent)
43 : Dialog::Controller(parent),
45 update_screen_font_(false)
49 bool ControlPrefs::initialiseParams(std::string const &)
53 converters_ = ::converters;
54 converters_.update(formats_);
58 update_screen_font_ = false;
64 void ControlPrefs::dispatchParams()
68 kernel().dispatch(FuncRequest(LFUN_LYXRC_APPLY, ss.str()));
70 // FIXME: these need lfuns
71 bufferlist.setCurrentAuthor(rc_.user_name, rc_.user_email);
75 ::converters = converters_;
76 ::converters.update(::formats);
77 ::converters.buildGraph();
81 vector<string>::const_iterator it = colors_.begin();
82 vector<string>::const_iterator const end = colors_.end();
83 for (; it != end; ++it)
84 kernel().dispatch(FuncRequest(LFUN_SET_COLOR, *it));
92 if (update_screen_font_) {
93 kernel().dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
94 update_screen_font_ = false;
97 // The Save button has been pressed
98 if (dialog().isClosing()) {
99 kernel().dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
104 void ControlPrefs::redrawGUI()
110 void ControlPrefs::setColor(LColor_color col, string const & hex)
112 colors_.push_back(lcolor.getLyXName(col) + ' ' + hex);
116 void ControlPrefs::updateScreenFonts()
118 update_screen_font_ = true;
122 string const ControlPrefs::browsebind(string const & file) const
124 return browseLibFile("bind", file, "bind", _("Choose bind file"),
125 FileFilterList("LyX bind files (*.bind)"));
129 string const ControlPrefs::browseUI(string const & file) const
131 return browseLibFile("ui", file, "ui", _("Choose UI file"),
132 FileFilterList("LyX UI files (*.ui)"));
136 string const ControlPrefs::browsekbmap(string const & file) const
138 return browseLibFile("kbd", file, "kmap", _("Choose keyboard map"),
139 FileFilterList("LyX keyboard maps (*.kmap)"));
143 string const ControlPrefs::browsedict(string const & file) const
145 return browseFile(file, _("Choose personal dictionary"),
146 FileFilterList("*.ispell"));
150 string const ControlPrefs::browse(string const & file,
151 string const & title) const
153 return browseFile(file, title, FileFilterList(), true);
157 string const ControlPrefs::browsedir(string const & path,
158 string const & title) const
160 return browseDir(path, title);
163 } // namespace frontend