Hi, Attached patch continues work on GTK preferences dialog.
It uses Gtk::FileChooserButton, which means that gtkmm-2.4 version >= 2.6.0 is now a non-negotiable dependency. John
? newfile1.pdf ? newfile1.ps ? out ? frontends/gnome/.deps ? frontends/gnome/Makefile ? frontends/gnome/Makefile.in ? frontends/xforms/forms/extern.5208 ? frontends/xforms/forms/fdfixh.5208 Index: frontends/gtk/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/ChangeLog,v retrieving revision 1.159 diff -u -p -r1.159 ChangeLog --- frontends/gtk/ChangeLog 7 Feb 2006 10:42:10 -0000 1.159 +++ frontends/gtk/ChangeLog 7 Feb 2006 22:25:01 -0000 @@ -1,6 +1,8 @@ 2006-02-07 John Spray <[EMAIL PROTECTED]> * 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 <[EMAIL PROTECTED]> Index: frontends/gtk/GPreferences.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/GPreferences.C,v retrieving revision 1.3 diff -u -p -r1.3 GPreferences.C --- frontends/gtk/GPreferences.C 6 Feb 2006 22:52:53 -0000 1.3 +++ frontends/gtk/GPreferences.C 7 Feb 2006 22:25:01 -0000 @@ -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,11 +183,51 @@ 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<int>(zoomadj_->get_value()); + rc.dpi = static_cast<int>(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 Index: frontends/gtk/GPreferences.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/GPreferences.h,v retrieving revision 1.1 diff -u -p -r1.1 GPreferences.h --- frontends/gtk/GPreferences.h 5 Feb 2006 21:57:17 -0000 1.1 +++ frontends/gtk/GPreferences.h 7 Feb 2006 22:25:01 -0000 @@ -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 Index: frontends/gtk/glade/preferences.glade =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/glade/preferences.glade,v retrieving revision 1.1 diff -u -p -r1.1 preferences.glade --- frontends/gtk/glade/preferences.glade 5 Feb 2006 21:57:17 -0000 1.1 +++ frontends/gtk/glade/preferences.glade 7 Feb 2006 22:25:01 -0000 @@ -103,33 +103,6 @@ <property name="enable_popup">False</property> <child> - <placeholder/> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">label1</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> <widget class="GtkTable" id="table1"> <property name="border_width">6</property> <property name="visible">True</property> @@ -416,14 +389,407 @@ </child> <child> - <placeholder/> + <widget class="GtkTable" id="table2"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">12</property> + <property name="column_spacing">6</property> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkRadioButton" id="GraphicsColor"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Co_lor</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="GraphicsGrayscale"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Grayscale</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">GraphicsColor</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="GraphicsMonochrome"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Monochrome</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">GraphicsColor</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="GraphicsDoNotDisplay"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Do not display</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">GraphicsColor</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="label" translatable="yes">Display g_raphics:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="label" translatable="yes">Instant _preview:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkRadioButton" id="InstantPreviewOn"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">O_n</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="InstantPreviewOff"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">O_ff</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">InstantPreviewOn</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="InstantPreviewNoMath"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_No math</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">InstantPreviewOn</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Graphics</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + + <child> + <widget class="GtkTable" id="table3"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="n_rows">3</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + + <child> + <widget class="GtkCheckButton" id="UseKeyboardMap"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Use k_eyboard map</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="label" translatable="yes">_First:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Second:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="FirstKeyboardMap"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="SecondKeyboardMap"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> </child> <child> <widget class="GtkLabel" id="label3"> <property name="visible">True</property> - <property name="label" translatable="yes">label3</property> - <property name="use_underline">False</property> + <property name="label" translatable="yes">_Keyboard</property> + <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> Index: frontends/qt2/qfont_metrics.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/qfont_metrics.C,v retrieving revision 1.33 diff -u -p -r1.33 qfont_metrics.C --- frontends/qt2/qfont_metrics.C 17 Jul 2005 23:03:01 -0000 1.33 +++ frontends/qt2/qfont_metrics.C 7 Feb 2006 22:25:02 -0000 @@ -18,6 +18,7 @@ #include "language.h" +#include <iostream> using std::string;