#include "ControlPrefs.h"
#include "ghelpers.h"
-//#include "support/lstrings.h"
-
-//#include <boost/tuple/tuple.hpp>
+#include "controllers/frnt_lang.h"
+#include "controllers/helper_funcs.h"
+#include "support/lstrings.h"
#include <libglademm.h>
using std::string;
+using std::vector;
namespace lyx {
namespace frontend {
xml_->get_widget("Revert", button);
setRestore(button);
+ Gtk::HBox *box = NULL;
// *** Screen fonts ***
// FIXME: these font buttons display a dialog
// *** 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");
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<LanguagePair> const langs = getLanguageData(false);
+ lang_ = getSecond(langs);
+
+ vector<LanguagePair>::const_iterator lit = langs.begin();
+ vector<LanguagePair>::const_iterator const lend = langs.end();
+ for (; lit != lend; ++lit) {
+ defaultlanguagecombo_.append_text(lit->first);
+ }
}
// *** 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();
}
// *** 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();
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
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Fonts</property>
+ <property name="label" translatable="yes">Fonts</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
</packing>
</child>
+ <child>
+ <widget class="GtkTable" id="table4">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="n_rows">10</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Default language:</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">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="DefaultLanguage">
+ <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">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Language pac_kage:</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="mnemonic_widget">LanguagePackage</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="label16">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Command s_tart:</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="mnemonic_widget">CommandStart</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="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Command e_nd:</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="mnemonic_widget">CommandEnd</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">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="LanguagePackage">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ </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"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="CommandStart">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ </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="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="CommandEnd">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="MarkForeignLanguages">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Mark _foreign languages</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">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="UseBabel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use bab_el</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">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="Global">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Global</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">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="RTLSupport">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Right-to-left language support</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">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="AutoBegin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Auto _begin</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">8</property>
+ <property name="bottom_attach">9</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="AutoEnd">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Auto _end</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">9</property>
+ <property name="bottom_attach">10</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label13">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Language</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="table2">
<property name="border_width">6</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Graphics</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>
<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="label" translatable="yes">Use _keyboard map</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Keyboard</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>