#include "Converter.h"
#include "FontEnums.h"
#include "Format.h"
+#include "FuncCode.h"
+#include "FuncRequest.h"
#include "Lexer.h"
#include "LyX.h"
#include "Mover.h"
}
// fall through
case LyXRC::RC_PREVIEW:
+ if (lyxrc_orig.preview != lyxrc_new.preview) {
+ // Update all previews of all documents.
+ /* FIXME: this can be very expensive. It would be cheaper
+ * to kill all existing previews and update visible
+ * previews.*/
+ theBufferList().updatePreviews();
+ }
+ // fall through
case LyXRC::RC_PREVIEW_HASHED_LABELS:
case LyXRC::RC_PREVIEW_SCALE_FACTOR:
case LyXRC::RC_PRINTLANDSCAPEFLAG:
case LyXRC::RC_SAVE_COMPRESSED:
case LyXRC::RC_SAVE_ORIGIN:
case LyXRC::RC_SCREEN_DPI:
+
case LyXRC::RC_SCREEN_FONT_ROMAN:
case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
case LyXRC::RC_SCREEN_FONT_SANS:
case LyXRC::RC_SCREEN_FONT_SIZES:
case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
- case LyXRC::RC_GEOMETRY_SESSION:
case LyXRC::RC_SCREEN_ZOOM:
+ if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
+ || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
+ || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
+ || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
+ || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
+ || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
+ || lyxrc_orig.font_sizes != lyxrc_new.font_sizes
+ || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
+ || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
+ dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
+ }
+
+ case LyXRC::RC_GEOMETRY_SESSION:
case LyXRC::RC_SERVERPIPE:
case LyXRC::RC_SET_COLOR:
case LyXRC::RC_SHOW_BANNER:
rc.font_sizes[FONT_SIZE_LARGEST] = widgetToDoubleStr(screenLargestED);
rc.font_sizes[FONT_SIZE_HUGE] = widgetToDoubleStr(screenHugeED);
rc.font_sizes[FONT_SIZE_HUGER] = widgetToDoubleStr(screenHugerED);
-
- if (rc.font_sizes != oldrc.font_sizes
- || rc.roman_font_name != oldrc.roman_font_name
- || rc.sans_font_name != oldrc.sans_font_name
- || rc.typewriter_font_name != oldrc.typewriter_font_name
- || rc.defaultZoom != oldrc.defaultZoom) {
- guiApp->fontLoader().update();
- form_->updateScreenFonts();
- }
}
rc.preview = LyXRC::PREVIEW_OFF;
break;
case 1:
- if (rc.preview != LyXRC::PREVIEW_NO_MATH) {
- rc.preview = LyXRC::PREVIEW_NO_MATH;
- form_->updatePreviews();
- }
+ rc.preview = LyXRC::PREVIEW_NO_MATH;
break;
case 2:
- if (rc.preview != LyXRC::PREVIEW_ON) {
- rc.preview = LyXRC::PREVIEW_ON;
- form_->updatePreviews();
- }
+ rc.preview = LyXRC::PREVIEW_ON;
break;
}
/////////////////////////////////////////////////////////////////////
GuiPreferences::GuiPreferences(GuiView & lv)
- : GuiDialog(lv, "prefs", qt_("Preferences")), update_screen_font_(false),
- update_previews_(false)
+ : GuiDialog(lv, "prefs", qt_("Preferences"))
{
setupUi(this);
converters_.update(formats_);
movers_ = theMovers();
colors_.clear();
- update_screen_font_ = false;
- update_previews_ = false;
updateRC(rc_);
// Make sure that the bc is in the INITIAL state
theMovers() = movers_;
- vector<string>::const_iterator it = colors_.begin();
- vector<string>::const_iterator const end = colors_.end();
- for (; it != end; ++it)
- dispatch(FuncRequest(LFUN_SET_COLOR, *it));
+ for (string const & color : colors_)
+ dispatch(FuncRequest(LFUN_SET_COLOR, color));
colors_.clear();
- if (update_screen_font_) {
- dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
- // resets flag in case second apply in same dialog
- update_screen_font_ = false;
- }
-
- if (update_previews_) {
- // resets flag in case second apply in same dialog
- theBufferList().updatePreviews();
- update_previews_ = false;
- }
-
// Save permanently
if (!tempSaveCB->isChecked())
dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
}
-void GuiPreferences::updateScreenFonts()
-{
- update_screen_font_ = true;
-}
-
-
-void GuiPreferences::updatePreviews()
-{
- update_previews_ = true;
-}
-
-
QString GuiPreferences::browsebind(QString const & file) const
{
return browseLibFile("bind", file, "bind", qt_("Choose bind file"),