From: John Spray Date: Tue, 7 Feb 2006 22:29:13 +0000 (+0000) Subject: Keyboard and graphics options in GTK preferences X-Git-Tag: 1.6.10~13622 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b3f859406a2433c99bfd27aca3678a7051a2431d;p=features.git Keyboard and graphics options in GTK preferences git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10825 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 69094f8e60..b5f9fde753 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,6 +1,8 @@ 2006-02-07 John Spray * GCitation.[Ch]: Allow adding items by double clicking + * GPreferences.[Ch], glade/preferences.glade: Make font options + apply properly, add graphics and keyboard options. 2006-02-06 John Spray diff --git a/src/frontends/gtk/GPreferences.C b/src/frontends/gtk/GPreferences.C index a9386ec7eb..2264935533 100644 --- a/src/frontends/gtk/GPreferences.C +++ b/src/frontends/gtk/GPreferences.C @@ -66,19 +66,50 @@ void GPreferences::doBuild() dpiadj_ = spin->get_adjustment(); xml_->get_widget("Zoom", spin); zoomadj_ = spin->get_adjustment(); - -/* - inlineradio_->signal_toggled().connect( - sigc::mem_fun(*this, &GPreferences::apply)); - bcview().addReadOnly(inlineradio_);*/ - + + // *** Graphics *** + xml_->get_widget("GraphicsColor", graphicscolorradio_); + xml_->get_widget("GraphicsGrayscale", graphicsgrayscaleradio_); + xml_->get_widget("GraphicsMonochrome", graphicsmonoradio_); + xml_->get_widget("GraphicsDoNotDisplay", graphicsnoneradio_); + + xml_->get_widget("InstantPreviewOn", instprevonradio_); + xml_->get_widget("InstantPreviewOff", instprevoffradio_); + xml_->get_widget("InstantPreviewNoMath", instprevnomathradio_); + + // *** Keyboard *** + xml_->get_widget("UseKeyboardMap", keyboardmapcheck_); + Gtk::HBox *box; + xml_->get_widget("FirstKeyboardMap", box); + box->pack_start(keyboardmap1fcbutton_); + keyboardmap1fcbutton_.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN); + keyboardmap1fcbutton_.show(); + xml_->get_widget("SecondKeyboardMap", box); + box->pack_start(keyboardmap2fcbutton_); + keyboardmap2fcbutton_.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN); + keyboardmap2fcbutton_.show(); + + Gtk::FileFilter kmapfilter; + kmapfilter.set_name ("LyX keyboard maps"); + kmapfilter.add_pattern ("*.kmap"); + Gtk::FileFilter allfilter; + allfilter.set_name ("All files"); + allfilter.add_pattern ("*"); + + keyboardmap1fcbutton_.add_filter (kmapfilter); + keyboardmap1fcbutton_.add_filter (allfilter); + keyboardmap1fcbutton_.set_filter (kmapfilter); + keyboardmap2fcbutton_.add_filter (kmapfilter); + keyboardmap2fcbutton_.add_filter (allfilter); + keyboardmap2fcbutton_.set_filter (kmapfilter); + + keyboardmapcheck_->signal_toggled().connect( + sigc::mem_fun(*this, &GPreferences::keyboard_sensitivity)); } void GPreferences::update() { - applylock_ = true; - LyXRC const & rc(controller().rc()); // *** Screen fonts *** @@ -94,19 +125,54 @@ void GPreferences::update() zoomadj_->set_value (rc.zoom); dpiadj_->set_value (rc.dpi); + // *** Graphics *** + switch (rc.display_graphics) { + case graphics::NoDisplay: + graphicsnoneradio_->set_active(); + break; + case graphics::MonochromeDisplay: + graphicsmonoradio_->set_active(); + break; + case graphics::GrayscaleDisplay: + graphicsgrayscaleradio_->set_active(); + break; + default: + case graphics::ColorDisplay: + graphicscolorradio_->set_active(); + break; + } + + switch (rc.preview) { + case LyXRC::PREVIEW_ON: + instprevonradio_->set_active(); + break; + case LyXRC::PREVIEW_NO_MATH: + instprevnomathradio_->set_active(); + break; + default: + case LyXRC::PREVIEW_OFF: + instprevoffradio_->set_active(); + break; + } + + // *** Keyboard *** + keyboardmapcheck_->set_active (rc.use_kbmap); + keyboardmap1fcbutton_.set_filename (rc.primary_kbmap); + keyboardmap2fcbutton_.set_filename (rc.secondary_kbmap); + keyboardmap1fcbutton_.set_sensitive (rc.use_kbmap); + keyboardmap2fcbutton_.set_sensitive (rc.use_kbmap); + bc().valid(); - applylock_ = false; } void GPreferences::apply() { - if (applylock_) - return; - LyXRC & rc(controller().rc()); // *** Screen fonts *** + LyXRC const oldrc(rc); + rc.roman_font_name = Pango::FontDescription( romanfontbutton_->get_font_name()).get_family (); rc.roman_font_foundry = ""; @@ -117,12 +183,52 @@ void GPreferences::apply() typewriterfontbutton_->get_font_name()).get_family (); rc.typewriter_font_foundry = ""; - rc.zoom = zoomadj_->get_value(); - rc.dpi = dpiadj_->get_value(); + rc.zoom = static_cast(zoomadj_->get_value()); + rc.dpi = static_cast(dpiadj_->get_value()); + + 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.zoom != oldrc.zoom || rc.dpi != oldrc.dpi) { + controller().updateScreenFonts(); + } + + // *** Graphics *** + if (graphicsnoneradio_->get_active()) + rc.display_graphics = graphics::NoDisplay; + else if (graphicsgrayscaleradio_->get_active()) + rc.display_graphics = graphics::GrayscaleDisplay; + else if (graphicsmonoradio_->get_active()) + rc.display_graphics = graphics::MonochromeDisplay; + else + rc.display_graphics = graphics::ColorDisplay; + + if (instprevonradio_->get_active()) + rc.preview = LyXRC::PREVIEW_ON; + else if (instprevnomathradio_->get_active()) + rc.preview = LyXRC::PREVIEW_NO_MATH; + else + rc.preview = LyXRC::PREVIEW_OFF; + + // *** Keyboard *** + rc.use_kbmap = keyboardmapcheck_->get_active(); + if (rc.use_kbmap) { + rc.primary_kbmap = keyboardmap1fcbutton_.get_filename(); + rc.secondary_kbmap = keyboardmap2fcbutton_.get_filename(); + } // Prevent Apply button ever getting disabled bc().valid(); } + +void GPreferences::keyboard_sensitivity () +{ + bool const kbmap = keyboardmapcheck_->get_active(); + keyboardmap1fcbutton_.set_sensitive(kbmap); + keyboardmap2fcbutton_.set_sensitive(kbmap); +} + } // namespace frontend } // namespace lyx diff --git a/src/frontends/gtk/GPreferences.h b/src/frontends/gtk/GPreferences.h index 665c5f0121..06b247545a 100644 --- a/src/frontends/gtk/GPreferences.h +++ b/src/frontends/gtk/GPreferences.h @@ -29,9 +29,6 @@ private: virtual void doBuild(); virtual void update(); - // apply() won't act when this is true - bool applylock_; - // >>> Font tab Gtk::FontButton *romanfontbutton_; Gtk::FontButton *sansseriffontbutton_; @@ -39,6 +36,24 @@ private: Gtk::Adjustment *dpiadj_; Gtk::Adjustment *zoomadj_; // <<< Font tab + + // >>> Graphics tab + Gtk::RadioButton *graphicscolorradio_; + Gtk::RadioButton *graphicsgrayscaleradio_; + Gtk::RadioButton *graphicsmonoradio_; + Gtk::RadioButton *graphicsnoneradio_; + + Gtk::RadioButton *instprevonradio_; + Gtk::RadioButton *instprevoffradio_; + Gtk::RadioButton *instprevnomathradio_; + // <<< Graphics tab + + // >>> Keyboard tab + void keyboard_sensitivity (); + Gtk::CheckButton *keyboardmapcheck_; + Gtk::FileChooserButton keyboardmap1fcbutton_; + Gtk::FileChooserButton keyboardmap2fcbutton_; + // <<< Keyboard tab }; } // namespace frontend diff --git a/src/frontends/gtk/glade/preferences.glade b/src/frontends/gtk/glade/preferences.glade index 34db614ad1..2af2c8bd3d 100644 --- a/src/frontends/gtk/glade/preferences.glade +++ b/src/frontends/gtk/glade/preferences.glade @@ -102,33 +102,6 @@ False False - - - - - - - True - label1 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - 6 @@ -416,14 +389,407 @@ - + + 6 + True + 2 + 2 + False + 12 + 6 + + + + True + False + 0 + + + + True + True + Co_lor + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + _Grayscale + True + GTK_RELIEF_NORMAL + True + False + False + True + GraphicsColor + + + 0 + False + False + + + + + + True + True + _Monochrome + True + GTK_RELIEF_NORMAL + True + False + False + True + GraphicsColor + + + 0 + False + False + + + + + + True + True + _Do not display + True + GTK_RELIEF_NORMAL + True + False + False + True + GraphicsColor + + + 0 + False + False + + + + + 1 + 2 + 0 + 1 + fill + + + + + + True + Display g_raphics: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + fill + + + + + + True + Instant _preview: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + fill + + + + + + True + False + 0 + + + + True + True + O_n + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + O_ff + True + GTK_RELIEF_NORMAL + True + False + False + True + InstantPreviewOn + + + 0 + False + False + + + + + + True + True + _No math + True + GTK_RELIEF_NORMAL + True + False + False + True + InstantPreviewOn + + + 0 + False + False + + + + + 1 + 2 + 1 + 2 + fill + fill + + + + + False + True + + + + + + True + _Graphics + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + 6 + True + 3 + 2 + False + 6 + 6 + + + + True + True + Use k_eyboard map + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 0 + 1 + fill + + + + + + + True + _First: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + _Second: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + False + 0 + + + + + + + 1 + 2 + 1 + 2 + fill + + + + + + True + False + 0 + + + + + + + 1 + 2 + 2 + 3 + fill + fill + + + + + False + True + True - label3 - False + _Keyboard + True False GTK_JUSTIFY_LEFT False