/**
* \file FormPreferences.C
- * Copyright 2000-2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "FormPreferences.h"
#include "forms/form_preferences.h"
-#include "Dialogs.h"
+
+#include "combox.h"
+#include "Color.h"
+#include "input_validators.h"
+#include "forms_gettext.h"
+#include "xforms_helpers.h"
+#include "helper_funcs.h"
#include "buffer.h"
#include "converter.h"
#include "debug.h"
-#include "frontends/LyXView.h"
#include "language.h"
#include "frnt_lang.h"
-#include "lyxfunc.h"
#include "lyxlex.h"
#include "lyxrc.h"
#include "LColor.h"
#include "Lsstream.h"
#include "funcrequest.h"
-#include "combox.h"
-#include "Color.h"
-#include "input_validators.h"
-#include "forms_gettext.h"
-#include "xforms_helpers.h"
-#include "helper_funcs.h"
+#include "frontends/LyXView.h"
+#include "frontends/Dialogs.h"
#include "support/lyxfunctional.h"
#include "support/lyxmanip.h"
#include "support/LAssert.h"
#include "graphics/GraphicsCache.h"
+#include "graphics/GraphicsTypes.h"
#include <boost/bind.hpp>
FormPreferences::FormPreferences(LyXView & lv, Dialogs & d)
- : FormBaseBI(&lv, &d, _("Preferences"), false),
+ : FormBaseBI(lv, d, _("Preferences"), false),
colors_(*this), converters_(*this), inputs_misc_(*this),
formats_(*this), interface_(*this), language_(*this),
lnf_misc_(*this), outputs_misc_(*this), paths_(*this),
colors_.modifiedXformsPrefs = !XformsColor::write(filename);
}
- lv_->getLyXFunc().dispatch(LFUN_SAVEPREFERENCES);
+ lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
}
setCursorColor(GUI_COLOR_CURSOR);
}
}
- parent_.lv_->getDialogs().redrawGUI();
+ parent_.lv_.getDialogs().redrawGUI();
}
// Now do the same for the LyX LColors...
string const s = lcolor.getLyXName(lc) + string(" ") +
hexname;
- parent_.lv_->getLyXFunc().dispatch(FuncRequest(LFUN_SET_COLOR, s));
+ parent_.lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
}
}
}
<< "\". Set to \"black\"!" << endl;
string const arg = lcolor.getLyXName(lc) + " black";
- parent_.lv_->getLyXFunc().
- dispatch(FuncRequest(LFUN_SET_COLOR, arg));
+ parent_.lv_.dispatch(FuncRequest(LFUN_SET_COLOR, arg));
continue;
}
lyxrc.wheel_jump = static_cast<unsigned int>
(fl_get_counter_value(dialog_->counter_wm_jump));
- string const old_value = lyxrc.display_graphics;
- if (fl_get_button(dialog_->radio_display_monochrome)) {
- lyxrc.display_graphics = "mono";
- } else if (fl_get_button(dialog_->radio_display_grayscale)) {
- lyxrc.display_graphics = "gray";
- } else if (fl_get_button(dialog_->radio_display_color)) {
- lyxrc.display_graphics = "color";
- } else {
- lyxrc.display_graphics = "no";
+ // See FIXME below
+ // grfx::DisplayType old_value = lyxrc.display_graphics;
+ switch (fl_get_choice(dialog_->choice_display)) {
+ case 4: lyxrc.display_graphics = grfx::NoDisplay; break;
+ case 3: lyxrc.display_graphics = grfx::ColorDisplay; break;
+ case 2: lyxrc.display_graphics = grfx::GrayscaleDisplay; break;
+ case 1: lyxrc.display_graphics = grfx::MonochromeDisplay; break;
+ default: lyxrc.display_graphics = grfx::ColorDisplay; break;
}
#ifdef WITH_WARNINGS
setPrehandler(dialog_->check_dialogs_iconify_with_main);
setPrehandler(dialog_->check_preview_latex);
setPrehandler(dialog_->counter_wm_jump);
- setPrehandler(dialog_->radio_display_monochrome);
- setPrehandler(dialog_->radio_display_grayscale);
- setPrehandler(dialog_->radio_display_color);
- setPrehandler(dialog_->radio_no_display);
+
+ fl_addto_choice(dialog_->choice_display, _("Monochrome|Grayscale|Color|Do not display"));
}
return lyxrc.getDescription(LyXRC::RC_AUTOSAVE);
if (ob == dialog_->counter_wm_jump)
return lyxrc.getDescription(LyXRC::RC_WHEEL_JUMP);
- if (ob == dialog_->radio_display_monochrome ||
- ob == dialog_->radio_display_grayscale ||
- ob == dialog_->radio_display_color ||
- ob == dialog_->radio_no_display)
+ if (ob == dialog_->choice_display)
return lyxrc.getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
return string();
}
fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
- if (lyxrc.display_graphics == "mono") {
- fl_set_button(dialog_->radio_display_monochrome, 1);
- } else if (lyxrc.display_graphics == "gray") {
- fl_set_button(dialog_->radio_display_grayscale, 1);
- } else if (lyxrc.display_graphics == "color") {
- fl_set_button(dialog_->radio_display_color, 1);
- } else {
- fl_set_button(dialog_->radio_no_display, 1);
+ switch (lyxrc.display_graphics) {
+ case grfx::NoDisplay: fl_set_choice(dialog_->choice_display, 4); break;
+ case grfx::ColorDisplay: fl_set_choice(dialog_->choice_display, 3); break;
+ case grfx::GrayscaleDisplay: fl_set_choice(dialog_->choice_display, 2); break;
+ case grfx::MonochromeDisplay: fl_set_choice(dialog_->choice_display, 1); break;
+ default: fl_set_choice(dialog_->choice_display, 3); break;
}
}
if (changed) {
// Now update the buffers
// Can anything below here affect the redraw process?
- parent_.lv_->getLyXFunc().dispatch(LFUN_SCREEN_FONT_UPDATE);
+ parent_.lv_.dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
}
}
// Show the file browser dialog
string const new_filename =
- browseFile(lv_, filename, title, pattern, dir1, dir2);
+ browseFile(&lv_, filename, title, pattern, dir1, dir2);
// Save the filename to the dialog
if (new_filename != filename && !new_filename.empty()) {