#include <config.h>
#include "FormPreferences.h"
-#include "ControlPrefs.h"
#include "forms/form_preferences.h"
#include "FormColorpicker.h"
#include "forms_gettext.h"
#include "input_validators.h"
#include "xformsBC.h"
+#include "xforms_helpers.h"
+#include "controllers/ControlPrefs.h"
+#include "controllers/frnt_lang.h"
#include "controllers/helper_funcs.h" // getSecond
#include "buffer.h"
#include "converter.h"
#include "format.h"
-#include "frnt_lang.h"
+#include "LColor.h"
#include "lyxfont.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/tostr.h"
#include "support/path_defines.h"
#include <iomanip>
+using lyx::support::AddName;
+using lyx::support::ChangeExtension;
+using lyx::support::rtrim;
+using lyx::support::strToDbl;
+using lyx::support::trim;
+using lyx::support::user_lyxdir;
+
using std::endl;
using std::make_pair;
using std::max;
using std::pair;
using std::vector;
-
-using namespace lyx::support;
+using std::string;
namespace {
string const FormPreferences::getFeedback(FL_OBJECT * ob)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
if (ob->form->fdui == colors_.dialog())
return colors_.feedback(ob);
ButtonPolicy::SMInput FormPreferences::input(FL_OBJECT * ob, long)
{
- Assert(ob);
+ BOOST_ASSERT(ob);
bool valid = true;
// Now do the same for the LyX LColors...
for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
cit != lyxColorDB.end(); ++cit) {
- LColor::color lc = lcolor.getFromGUIName(cit->getname());
+ LColor::color lc = lcolor.getFromLyXName(cit->lyxname);
if (lc == LColor::inherit) continue;
// Create a valid X11 name of the form "#rrggbb"
xformsColorDB.clear();
XformsColor xcol;
- xcol.name = _("GUI background");
+ xcol.lyxname = "GUI background";
+ xcol.guiname = _("GUI background");
xcol.colorID = FL_COL1;
fl_getmcolor(FL_COL1, &xcol.r, &xcol.g, &xcol.b);
xformsColorDB.push_back(xcol);
- xcol.name = _("GUI text");
+ xcol.lyxname = "GUI text";
+ xcol.guiname = _("GUI text");
xcol.colorID = FL_BLACK;
fl_getmcolor(FL_BLACK, &xcol.r, &xcol.g, &xcol.b);
xformsColorDB.push_back(xcol);
- xcol.name = _("GUI selection");
+ xcol.lyxname = "GUI selection";
+ xcol.guiname = _("GUI selection");
xcol.colorID = FL_YELLOW;
fl_getmcolor(FL_YELLOW, &xcol.r, &xcol.g, &xcol.b);
xformsColorDB.push_back(xcol);
- xcol.name = _("GUI pointer");
+ xcol.lyxname = "GUI pointer";
+ xcol.guiname = _("GUI pointer");
xcol.colorID = GUI_COLOR_CURSOR;
fl_getmcolor(GUI_COLOR_CURSOR, &xcol.r, &xcol.g, &xcol.b);
}
// Finally, push the color onto the database
- NamedColor ncol(lcolor.getGUIName(lc), col);
+ NamedColor ncol(lcolor.getLyXName(lc), lcolor.getGUIName(lc), col);
lyxColorDB.push_back(ncol);
}
fl_clear_browser(colbr);
for (vector<XformsColor>::const_iterator cit = xformsColorDB.begin();
cit != xformsColorDB.end(); ++cit) {
- fl_addto_browser(colbr, cit->getname().c_str());
+ fl_addto_browser(colbr, cit->guiname.c_str());
}
for (vector<NamedColor>::const_iterator cit = lyxColorDB.begin();
cit != lyxColorDB.end(); ++cit) {
- fl_addto_browser(colbr, cit->getname().c_str());
+ fl_addto_browser(colbr, cit->guiname.c_str());
}
// just to be safe...
{
rc.document_path = fl_get_input(dialog_->input_default_path);
rc.template_path = fl_get_input(dialog_->input_template_path);
+ rc.tempdir_path = fl_get_input(dialog_->input_temp_dir);
- int button = fl_get_button(dialog_->check_use_temp_dir);
- string str = fl_get_input(dialog_->input_temp_dir);
- if (!button)
- str.erase();
-
- rc.use_tempdir = button;
- rc.tempdir_path = str;
-
- button = fl_get_button(dialog_->check_last_files);
- str = fl_get_input(dialog_->input_lastfiles);
+ int button = fl_get_button(dialog_->check_last_files);
+ string str = fl_get_input(dialog_->input_lastfiles);
if (!button) str.erase();
rc.check_lastfiles = button;
setPrehandler(dialog_->input_backup_path);
setPrehandler(dialog_->input_serverpipe);
setPrehandler(dialog_->input_temp_dir);
- setPrehandler(dialog_->check_use_temp_dir);
}
return LyXRC::getDescription(LyXRC::RC_DOCUMENTPATH);
if (ob == dialog_->input_template_path)
return LyXRC::getDescription(LyXRC::RC_TEMPLATEPATH);
- if (ob == dialog_->check_use_temp_dir)
- return LyXRC::getDescription(LyXRC::RC_USETEMPDIR);
if (ob == dialog_->input_temp_dir)
return LyXRC::getDescription(LyXRC::RC_TEMPDIRPATH);
if (ob == dialog_->check_last_files)
// !ob if function is called from Paths::update() to de/activate
// objects,
// otherwise the function is called by an xforms CB via input().
- if (!ob || ob == dialog_->check_use_temp_dir) {
- bool const enable = fl_get_button(dialog_->check_use_temp_dir);
- setEnabled(dialog_->input_temp_dir, enable);
- }
-
if (!ob || ob == dialog_->check_last_files) {
bool const enable = fl_get_button(dialog_->check_last_files);
setEnabled(dialog_->input_lastfiles, enable);
rc.make_backup);
fl_set_input(dialog_->input_backup_path, str.c_str());
- str.erase();
- if (rc.use_tempdir)
- str = rc.tempdir_path;
-
- fl_set_button(dialog_->check_use_temp_dir,
- rc.use_tempdir);
- fl_set_input(dialog_->input_temp_dir, str.c_str());
+ fl_set_input(dialog_->input_temp_dir, rc.tempdir_path.c_str());
str.erase();
if (rc.check_lastfiles)