From: John Spray Date: Sun, 12 Feb 2006 15:03:50 +0000 (+0000) Subject: More work on GPreferences X-Git-Tag: 1.6.10~13616 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=134abbe788ce2ad7500717babfef2954369db057;p=features.git More work on GPreferences git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13211 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index b5f9fde753..2495446405 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,6 @@ +2006-02-09 John Spray + * GPreferences.[Ch], glade/preferences.glade: Add language tab + 2006-02-07 John Spray * GCitation.[Ch]: Allow adding items by double clicking diff --git a/src/frontends/gtk/GPreferences.C b/src/frontends/gtk/GPreferences.C index 2264935533..58e4788c30 100644 --- a/src/frontends/gtk/GPreferences.C +++ b/src/frontends/gtk/GPreferences.C @@ -22,13 +22,14 @@ #include "ControlPrefs.h" #include "ghelpers.h" -//#include "support/lstrings.h" - -//#include +#include "controllers/frnt_lang.h" +#include "controllers/helper_funcs.h" +#include "support/lstrings.h" #include using std::string; +using std::vector; namespace lyx { namespace frontend { @@ -53,6 +54,7 @@ void GPreferences::doBuild() xml_->get_widget("Revert", button); setRestore(button); + Gtk::HBox *box = NULL; // *** Screen fonts *** // FIXME: these font buttons display a dialog @@ -79,15 +81,17 @@ void GPreferences::doBuild() // *** 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(); + keyboardmap1fcbutton_ = Gtk::manage(new Gtk::FileChooserButton); + 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(); + keyboardmap2fcbutton_ = Gtk::manage(new Gtk::FileChooserButton); + box->pack_start(*keyboardmap2fcbutton_); + keyboardmap2fcbutton_->set_action(Gtk::FILE_CHOOSER_ACTION_OPEN); + keyboardmap2fcbutton_->show(); Gtk::FileFilter kmapfilter; kmapfilter.set_name ("LyX keyboard maps"); @@ -96,15 +100,40 @@ void GPreferences::doBuild() 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); + 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)); + + // *** Language *** + + xml_->get_widget("DefaultLanguage", box); + box->pack_start (defaultlanguagecombo_); + defaultlanguagecombo_.show(); + xml_->get_widget("LanguagePackage", languagepackageentry_); + xml_->get_widget("CommandStart", commandstartentry_); + xml_->get_widget("CommandEnd", commandendentry_); + xml_->get_widget("UseBabel", usebabelcheck_); + xml_->get_widget("MarkForeignLanguages", markforeigncheck_); + xml_->get_widget("Global", globalcheck_); + xml_->get_widget("RTLSupport", RTLsupportcheck_); + xml_->get_widget("AutoBegin", autobegincheck_); + xml_->get_widget("AutoEnd", autoendcheck_); + + // Store the lang identifiers for later + vector const langs = getLanguageData(false); + lang_ = getSecond(langs); + + vector::const_iterator lit = langs.begin(); + vector::const_iterator const lend = langs.end(); + for (; lit != lend; ++lit) { + defaultlanguagecombo_.append_text(lit->first); + } } @@ -157,10 +186,25 @@ void GPreferences::update() // *** 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); + keyboardmap1fcbutton_->set_filename (rc.primary_kbmap); + keyboardmap2fcbutton_->set_filename (rc.secondary_kbmap); + keyboardmap1fcbutton_->set_sensitive (rc.use_kbmap); + keyboardmap2fcbutton_->set_sensitive (rc.use_kbmap); + + // *** Language *** + int const pos = int(findPos(lang_, rc.default_language)); + defaultlanguagecombo_.set_active(pos); + + languagepackageentry_->set_text(rc.language_package); + commandstartentry_->set_text(rc.language_command_begin); + commandendentry_->set_text(rc.language_command_end); + + usebabelcheck_->set_active(rc.language_use_babel); + markforeigncheck_->set_active(rc.mark_foreign_language); + globalcheck_->set_active(rc.language_global_options); + RTLsupportcheck_->set_active(rc.rtl_support); + autobegincheck_->set_active(rc.language_auto_begin); + autoendcheck_->set_active(rc.language_auto_end); bc().valid(); } @@ -214,9 +258,24 @@ void GPreferences::apply() // *** Keyboard *** rc.use_kbmap = keyboardmapcheck_->get_active(); if (rc.use_kbmap) { - rc.primary_kbmap = keyboardmap1fcbutton_.get_filename(); - rc.secondary_kbmap = keyboardmap2fcbutton_.get_filename(); + rc.primary_kbmap = keyboardmap1fcbutton_->get_filename(); + rc.secondary_kbmap = keyboardmap2fcbutton_->get_filename(); } + + // *** Language *** + rc.default_language = lang_[ + defaultlanguagecombo_.get_active_row_number()]; + + rc.language_package = languagepackageentry_->get_text(); + rc.language_command_begin = commandstartentry_->get_text(); + rc.language_command_end = commandendentry_->get_text(); + + rc.language_use_babel = usebabelcheck_->get_active(); + rc.mark_foreign_language = markforeigncheck_->get_active(); + rc.language_global_options = globalcheck_->get_active(); + rc.rtl_support = RTLsupportcheck_->get_active(); + rc.language_auto_begin = autobegincheck_->get_active(); + rc.language_auto_end = autoendcheck_->get_active(); // Prevent Apply button ever getting disabled bc().valid(); @@ -226,8 +285,8 @@ void GPreferences::apply() void GPreferences::keyboard_sensitivity () { bool const kbmap = keyboardmapcheck_->get_active(); - keyboardmap1fcbutton_.set_sensitive(kbmap); - keyboardmap2fcbutton_.set_sensitive(kbmap); + keyboardmap1fcbutton_->set_sensitive(kbmap); + keyboardmap2fcbutton_->set_sensitive(kbmap); } } // namespace frontend diff --git a/src/frontends/gtk/GPreferences.h b/src/frontends/gtk/GPreferences.h index 06b247545a..23bc721a64 100644 --- a/src/frontends/gtk/GPreferences.h +++ b/src/frontends/gtk/GPreferences.h @@ -14,6 +14,8 @@ #include "GViewBase.h" +#include + namespace lyx { namespace frontend { @@ -51,9 +53,23 @@ private: // >>> Keyboard tab void keyboard_sensitivity (); Gtk::CheckButton *keyboardmapcheck_; - Gtk::FileChooserButton keyboardmap1fcbutton_; - Gtk::FileChooserButton keyboardmap2fcbutton_; + Gtk::FileChooserButton *keyboardmap1fcbutton_; + Gtk::FileChooserButton *keyboardmap2fcbutton_; // <<< Keyboard tab + + // >>> Language tab + std::vector lang_; + Gtk::ComboBoxText defaultlanguagecombo_; + Gtk::Entry *languagepackageentry_; + Gtk::Entry *commandstartentry_; + Gtk::Entry *commandendentry_; + Gtk::CheckButton *usebabelcheck_; + Gtk::CheckButton *markforeigncheck_; + Gtk::CheckButton *globalcheck_; + Gtk::CheckButton *RTLsupportcheck_; + Gtk::CheckButton *autobegincheck_; + Gtk::CheckButton *autoendcheck_; + // <<< Language tab }; } // namespace frontend diff --git a/src/frontends/gtk/glade/preferences.glade b/src/frontends/gtk/glade/preferences.glade index 2af2c8bd3d..82d6fdeb7c 100644 --- a/src/frontends/gtk/glade/preferences.glade +++ b/src/frontends/gtk/glade/preferences.glade @@ -368,7 +368,7 @@ True - _Fonts + Fonts True False GTK_JUSTIFY_LEFT @@ -388,6 +388,374 @@ + + + 6 + True + 10 + 2 + False + 6 + 12 + + + + True + _Default language: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + False + 0 + + + + + + + 1 + 2 + 0 + 1 + fill + + + + + + True + Language pac_kage: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + LanguagePackage + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Command s_tart: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + CommandStart + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + Command e_nd: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + CommandEnd + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 3 + 4 + + + + + + + True + True + Mark _foreign languages + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 5 + 6 + fill + + + + + + + True + True + Use bab_el + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 4 + 5 + fill + + + + + + + True + True + _Global + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 6 + 7 + fill + + + + + + + True + True + _Right-to-left language support + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 7 + 8 + fill + + + + + + + True + True + Auto _begin + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 8 + 9 + fill + + + + + + + True + True + Auto _end + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 9 + 10 + fill + + + + + + False + True + + + + + + True + Language + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + 6 @@ -632,7 +1000,7 @@ True - _Graphics + Graphics True False GTK_JUSTIFY_LEFT @@ -666,7 +1034,7 @@ True True - Use k_eyboard map + Use _keyboard map True GTK_RELIEF_NORMAL True @@ -788,7 +1156,7 @@ True - _Keyboard + Keyboard True False GTK_JUSTIFY_LEFT