]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormPreferences.C
change X-windows to X window
[lyx.git] / src / frontends / xforms / FormPreferences.C
index 88e54ec6b5f878404de294708f8918ef81f89af8..084db72967ed0e9eeb1b7d5546acaa69641ab480 100644 (file)
@@ -69,7 +69,7 @@ Converters local_converters;
 
 
 FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
-       : FormBaseBI(lv, d, _("Preferences")),
+       : FormBaseBI(lv, d, _("Preferences"), false),
          warningPosted(false),
          colors_(*this), converters_(*this), inputs_misc_(*this),
          formats_(*this), interface_(*this), language_(*this), 
@@ -84,24 +84,6 @@ FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
 }
 
 
-void FormPreferences::connect()
-{
-       fl_set_form_maxsize( dialog_->form, minw_, minh_ );
-
-       FormBaseBI::connect();
-}
-
-
-void FormPreferences::disconnect()
-{
-       // colors_->disconnect();
-       // converters_->disconnect(); //local_converters.Clear();
-       // formats_->disconnect();    //local_formats.Clear();
-
-       FormBaseBI::disconnect();
-}
-
-
 void FormPreferences::redraw()
 {
        if (!(form() && form()->visible))
@@ -166,7 +148,7 @@ void FormPreferences::ok()
 void FormPreferences::hide()
 {
        // We need to hide the active tabfolder otherwise we get a
-       // BadDrawable error from X windows and LyX crashes without saving.
+       // BadDrawable error from X window and LyX crashes without saving.
        FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder_prefs);
        if (outer_form
            && outer_form->visible) {
@@ -393,7 +375,7 @@ void FormPreferences::update()
 
 
 FormPreferences::Colors::Colors(FormPreferences & p)
-       : parent_(p)
+       : modifiedXformsPrefs(false), parent_(p)
 {}
 
 
@@ -1781,7 +1763,7 @@ void FormPreferences::Language::update()
        fl_set_button(dialog_->check_use_kbmap,
                      lyxrc.use_kbmap);
 
-       combo_default_lang->select_text(lyxrc.default_language);
+       combo_default_lang->select(lyxrc.default_language);
 
        if (lyxrc.use_kbmap) {
                fl_set_input(dialog_->input_kbmap1,
@@ -1846,10 +1828,22 @@ void FormPreferences::LnFmisc::apply() const
        lyxrc.new_ask_filename = fl_get_button(dialog_->check_ask_new_file);
        lyxrc.cursor_follows_scrollbar =
                fl_get_button(dialog_->check_cursor_follows_scrollbar);
+       lyxrc.dialogs_iconify_with_main =
+               fl_get_button(dialog_->check_dialogs_iconify_with_main);
        lyxrc.autosave = static_cast<unsigned int>
                (fl_get_counter_value(dialog_->counter_autosave));
        lyxrc.wheel_jump = static_cast<unsigned int>
                (fl_get_counter_value(dialog_->counter_wm_jump));
+
+       if (fl_get_button(dialog_->radio_display_monochrome)) {
+               lyxrc.display_graphics = "mono";
+       } else if (fl_get_button(dialog_->radio_display_grayscale)) {
+               lyxrc.display_graphics = "gray";
+       } else if (fl_get_button(dialog_->radio_display_color)) {
+               lyxrc.display_graphics = "color";
+       } else {
+               lyxrc.display_graphics = "no";
+       }
 }
 
 
@@ -1871,7 +1865,12 @@ void FormPreferences::LnFmisc::build()
        setPreHandler(dialog_->counter_autosave);
        setPreHandler(dialog_->check_ask_new_file);
        setPreHandler(dialog_->check_cursor_follows_scrollbar);
+       setPreHandler(dialog_->check_dialogs_iconify_with_main);
        setPreHandler(dialog_->counter_wm_jump);
+       setPreHandler(dialog_->radio_display_monochrome);
+       setPreHandler(dialog_->radio_display_grayscale);
+       setPreHandler(dialog_->radio_display_color);
+       setPreHandler(dialog_->radio_no_display);
 }
 
 
@@ -1892,10 +1891,17 @@ FormPreferences::LnFmisc::feedback(FL_OBJECT const * const ob) const
                str = lyxrc.getDescription(LyXRC::RC_NEW_ASK_FILENAME);
        else if (ob == dialog_->check_cursor_follows_scrollbar)
                str = lyxrc.getDescription(LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR);
+       else if (ob == dialog_->check_dialogs_iconify_with_main)
+               str = lyxrc.getDescription(LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN);
        else if (ob == dialog_->counter_autosave)
                str = lyxrc.getDescription(LyXRC::RC_AUTOSAVE);
        else if (ob == dialog_->counter_wm_jump)
                str = lyxrc.getDescription(LyXRC::RC_WHEEL_JUMP);
+       else if (ob == dialog_->radio_display_monochrome ||
+                ob == dialog_->radio_display_grayscale ||
+                ob == dialog_->radio_display_color ||
+                ob == dialog_->radio_no_display)
+               str = lyxrc.getDescription(LyXRC::RC_DISPLAY_GRAPHICS);
 
        return str;
 }
@@ -1911,8 +1917,20 @@ void FormPreferences::LnFmisc::update()
        fl_set_button(dialog_->check_ask_new_file, lyxrc.new_ask_filename);
        fl_set_button(dialog_->check_cursor_follows_scrollbar,
                      lyxrc.cursor_follows_scrollbar);
+       fl_set_button(dialog_->check_dialogs_iconify_with_main,
+                     lyxrc.dialogs_iconify_with_main);
        fl_set_counter_value(dialog_->counter_autosave, lyxrc.autosave);
        fl_set_counter_value(dialog_->counter_wm_jump, lyxrc.wheel_jump);
+
+       if (lyxrc.display_graphics == "mono") {
+               fl_set_button(dialog_->radio_display_monochrome, 1);
+       } else if (lyxrc.display_graphics == "gray") {
+               fl_set_button(dialog_->radio_display_grayscale, 1);
+       } else if (lyxrc.display_graphics == "color") {
+               fl_set_button(dialog_->radio_display_color, 1);
+       } else {
+               fl_set_button(dialog_->radio_no_display, 1);
+       }
 }
 
 
@@ -1939,6 +1957,8 @@ void FormPreferences::OutputsMisc::apply() const
 
        lyxrc.ascii_roff_command = fl_get_input(dialog_->input_ascii_roff);
        lyxrc.chktex_command = fl_get_input(dialog_->input_checktex);
+       lyxrc.view_dvi_paper_option = fl_get_input(dialog_->input_paperoption);
+       lyxrc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt);
 }
 
 
@@ -1952,6 +1972,7 @@ void FormPreferences::OutputsMisc::build()
        fl_set_input_return(dialog_->input_tex_encoding, FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_ascii_roff,   FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_checktex,     FL_RETURN_CHANGED);
+       fl_set_input_return(dialog_->input_paperoption,  FL_RETURN_CHANGED);
 
        fl_addto_choice(dialog_->choice_default_papersize,
                        _(" default | US letter | legal | executive | A3 | A4 | A5 | B5 "));
@@ -1962,6 +1983,8 @@ void FormPreferences::OutputsMisc::build()
        setPreHandler(dialog_->choice_default_papersize);
        setPreHandler(dialog_->input_ascii_roff);
        setPreHandler(dialog_->input_checktex);
+       setPreHandler(dialog_->input_paperoption);
+       setPreHandler(dialog_->check_autoreset_classopt);
 }
 
 
@@ -1980,6 +2003,10 @@ FormPreferences::OutputsMisc::feedback(FL_OBJECT const * const ob) const
                str = lyxrc.getDescription(LyXRC::RC_CHKTEX_COMMAND);
        else if (ob == dialog_->choice_default_papersize)
                str = lyxrc.getDescription(LyXRC::RC_DEFAULT_PAPERSIZE);
+       else if (ob == dialog_->input_paperoption)
+               str = lyxrc.getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION);
+       else if (ob == dialog_->check_autoreset_classopt)
+               str = lyxrc.getDescription(LyXRC::RC_AUTORESET_OPTIONS);
 
        return str;
 }
@@ -1997,6 +2024,11 @@ void FormPreferences::OutputsMisc::update()
                     lyxrc.ascii_roff_command.c_str());
        fl_set_input(dialog_->input_checktex,
                     lyxrc.chktex_command.c_str());
+       fl_set_input(dialog_->input_paperoption,
+                     lyxrc.view_dvi_paper_option.c_str());
+       fl_set_button(dialog_->check_autoreset_classopt,
+                     lyxrc.auto_reset_options);
+
 }
 
 
@@ -2759,6 +2791,7 @@ void FormPreferences::SpellOptions::apply()
        
        lyxrc.isp_command = choice;
 
+#if 0
        // If spell checker == "none", all other input set to off.
        if (fl_get_choice(dialog_->choice_spell_command) == 1) {
                lyxrc.isp_use_alt_lang = false;
@@ -2773,6 +2806,7 @@ void FormPreferences::SpellOptions::apply()
                lyxrc.isp_accept_compound = false;
                lyxrc.isp_use_input_encoding = false;
        } else {
+#else
                int button = fl_get_button(dialog_->check_alt_lang);
                choice = fl_get_input(dialog_->input_alt_lang);
                if (button && choice.empty()) button = 0;
@@ -2802,7 +2836,10 @@ void FormPreferences::SpellOptions::apply()
 
                button = fl_get_button(dialog_->check_input_enc);
                lyxrc.isp_use_input_encoding = static_cast<bool>(button);
+#endif
+#if 0
        }
+#endif
 
        // Reset view
        update();
@@ -2814,7 +2851,11 @@ void FormPreferences::SpellOptions::build()
        dialog_.reset(parent_.build_spelloptions());
 
        fl_addto_choice(dialog_->choice_spell_command,
+#if 0
                        _(" none | ispell | aspell "));
+#else
+                       _(" ispell | aspell "));
+#endif
        fl_set_input_return(dialog_->input_alt_lang,      FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_escape_chars,  FL_RETURN_CHANGED);
        fl_set_input_return(dialog_->input_personal_dict, FL_RETURN_CHANGED);
@@ -2867,6 +2908,7 @@ bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
        // objects,
        // otherwise the function is called by an xforms CB via input().
 
+#if 0
        // If spell checker == "none", disable all input.
        if (!ob || ob == dialog_->choice_spell_command) {
                if (fl_get_choice(dialog_->choice_spell_command) == 1) {
@@ -2887,6 +2929,7 @@ bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
                        fl_activate_object(dialog_->check_input_enc);
                }
        }
+#endif
 
        if (!ob || ob == dialog_->check_alt_lang) {
                bool const enable = fl_get_button(dialog_->check_alt_lang);
@@ -2917,12 +2960,19 @@ bool FormPreferences::SpellOptions::input(FL_OBJECT const * const ob)
 void FormPreferences::SpellOptions::update()
 {
        int choice = 1;
+#if 0
        if (lyxrc.isp_command == "none")
                choice = 1;
        else if (lyxrc.isp_command == "ispell")
                choice = 2;
        else if (lyxrc.isp_command == "aspell")
                choice = 3;
+#else
+       if (lyxrc.isp_command == "ispell")
+               choice = 1;
+       else if (lyxrc.isp_command == "aspell")
+               choice = 2;
+#endif
        fl_set_choice(dialog_->choice_spell_command, choice);
        
        string str;
@@ -2991,13 +3041,20 @@ void FormPreferences::browse(FL_OBJECT * inpt,
 
 
 // C function wrapper, required by xforms.
-extern "C" int C_FormPreferencesFeedbackCB(FL_OBJECT * ob, int event,
-                                          FL_Coord mx, FL_Coord my,
-                                          int key, void * xev)
-{
-       return FormPreferences::FeedbackCB(ob, event, mx, my, key, xev);
+extern "C" {
+       
+       static
+       int C_FormPreferencesFeedbackCB(FL_OBJECT * ob, int event,
+                                       FL_Coord mx, FL_Coord my,
+                                       int key, void * xev)
+       {
+               return FormPreferences::FeedbackCB(ob, event,
+                                                  mx, my, key, xev);
+       }
+       
 }
 
+
 int FormPreferences::FeedbackCB(FL_OBJECT * ob, int event,
                                FL_Coord, FL_Coord, int, void *)
 {