diff --git a/ChangeLog b/ChangeLog index f06bd5f21f..845a7827b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +2000-10-30 Lars Gullik Bjønnes + + * src/tabular.C (AsciiBottomHLine): simplify? + (AsciiTopHLine): simplify? + (print_n_chars): simplify + (DocBook): remove most of the << endl; we should flush the stream + as seldom as possible. + (Latex): ditto + (TeXBottomHLine): ditto + (TeXTopHLine): ditto + (Write): formatting + (write_attribute): try a templified version. + (set_row_column_number_info): lesson scope of variables + + * src/support/lstrings.h (tostr): new specialization of tostr + + * src/trans.C (AddDeadkey): slightly cleaner fix. + +2000-10-28 Dekel Tsur + + * src/frontends/xforms/Menubar_pimpl.C (add_toc): Replace '%' by + '%%' in Toc menu labels. + (add_toc2): ditto + + * src/insets/insetlatexaccent.C (draw): Correct rendering when + font_norm is iso10646-1. + + * src/font.C (ascent): Fixed for 16bit fonts + (descent,lbearing,rbearing): ditto + +2000-10-30 Angus Leeming + + * src/lyxrc.C.[Ch]: moved LyXRCTags into public part of header file. + (getFeedback): new static method. + + * src/frontends/xforms/FormPreferences.[Ch]: one or two new inputs. + Now use combox rather than choice to display languages. + Feedback is now output using a new timer callback mechanism, identical + to that in Toolbar_pimpl. Individual messages obtained from lyxrc. + 2000-10-30 Jean-Marc Lasgouttes * src/minibuffer.C: fix for older compilers diff --git a/src/WorkArea.C b/src/WorkArea.C index 13d557e65b..f30c09489b 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -121,7 +121,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height) << width - 15 - 2 * bw << 'x' << height - 2 * bw << endl; - work_area = obj = fl_add_free(FL_INPUT_FREE, + work_area = obj = fl_add_free(FL_ALL_FREE, xpos + bw, ypos + bw, width - 15 - 2 * bw, // scrollbarwidth height - 2 * bw, "", @@ -309,7 +309,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, ev->xbutton.y - ob->y, ev->xbutton.button); break; - case FL_MOUSE: + case FL_DRAG: if (!ev || ! area->scrollbar) break; if (ev->xmotion.x != x_old || ev->xmotion.y != y_old || @@ -321,7 +321,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, ev->xbutton.state); } break; - case FL_KEYBOARD: + case FL_KEYPRESS: { lyxerr[Debug::KEY] << "Workarea event: KEYBOARD" << endl; @@ -408,6 +408,10 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event, area->workAreaKeyPress(ret_key, ret_state); } break; + case FL_KEYRELEASE: + lyxerr << "Workarea event: KEYRELEASE" << endl; + break; + case FL_FOCUS: lyxerr[Debug::GUI] << "Workarea event: FOCUS" << endl; area->workAreaFocus(); diff --git a/src/font.C b/src/font.C index 0ae9286b2b..5a6f4fa747 100644 --- a/src/font.C +++ b/src/font.C @@ -55,7 +55,7 @@ int lyxfont::ascent(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].ascent; else return finfo->ascent; @@ -68,7 +68,7 @@ int lyxfont::descent(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].descent; else return finfo->descent; @@ -81,7 +81,7 @@ int lyxfont::lbearing(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing; else return 0; @@ -94,7 +94,7 @@ int lyxfont::rbearing(char c, LyXFont const & f) unsigned int uc = static_cast(c); if (finfo->per_char && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) + && uc <= finfo->max_char_or_byte2+256*finfo->max_byte1) return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing; else return width(c, f); diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 4e5c5cc468..6ea7d22e42 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -10,8 +10,6 @@ #pragma implementation #endif -#include - #include "FormPreferences.h" #include "form_preferences.h" #include "input_validators.h" @@ -20,10 +18,12 @@ #include "lyxfunc.h" #include "Dialogs.h" #include "lyxrc.h" +#include "combox.h" #include "debug.h" #include "support/FileInfo.h" #include "support/filetools.h" #include "lyx_gui_misc.h" +#include "xform_macros.h" #ifdef SIGC_CXX_NAMESPACES using SigC::slot; @@ -33,14 +33,14 @@ using std::find; using std::vector; extern Languages languages; -static vector languageNames; FormPreferences::FormPreferences(LyXView * lv, Dialogs * d) : FormBaseBI(lv, d, _("Preferences"), new PreferencesPolicy), dialog_(0), outputs_tab_(0), look_n_feel_tab_(0), inputs_tab_(0), usage_tab_(0), colours_(0), inputs_misc_(0), interface_(0), language_(0), lnf_misc_(0), outputs_misc_(0), paths_(0), printer_(0), - screen_fonts_(0), spellchecker_(0) + screen_fonts_(0), spellchecker_(0), + combo_default_lang(0), combo_kbmap_1(0), combo_kbmap_2(0) { // let the dialog be shown // This is a permanent connection so we won't bother @@ -51,7 +51,10 @@ FormPreferences::FormPreferences(LyXView * lv, Dialogs * d) FormPreferences::~FormPreferences() { - delete dialog_; + delete combo_default_lang; + delete combo_kbmap_1; + delete combo_kbmap_2; + delete look_n_feel_tab_; delete inputs_tab_; delete outputs_tab_; @@ -66,6 +69,10 @@ FormPreferences::~FormPreferences() delete printer_; delete screen_fonts_; delete spellchecker_; + + // Must be last to be deleted, or we'll get a SIGSEGV. + // Something to do with the Timer mechanism. + delete dialog_; } @@ -220,6 +227,69 @@ void FormPreferences::apply() } +void FormPreferences::feedback( FL_OBJECT * ob ) +{ + if( ob->form->fdui == colours_ ) + feedbackColours( ob ); + if( ob->form->fdui == inputs_misc_ ) + feedbackInputsMisc( ob ); + if( ob->form->fdui == interface_ ) + feedbackInterface( ob ); + if( ob->form->fdui == language_ ) + feedbackLanguage( ob ); + if( ob->form->fdui == lnf_misc_ ) + feedbackLnFmisc( ob ); + if( ob->form->fdui == outputs_misc_ ) + feedbackOutputsMisc( ob ); + if( ob->form->fdui == paths_ ) + feedbackPaths( ob ); + if( ob->form->fdui == printer_ ) + feedbackPrinter( ob ); + if( ob->form->fdui == screen_fonts_ ) + feedbackScreenFonts( ob ); + if( ob->form->fdui == spellchecker_ ) + feedbackSpellChecker( ob ); +} + + +bool FormPreferences::input(FL_OBJECT * ob, long data) +{ + bool activate = true; + + // whatever checks you need to ensure the user hasn't entered + // some totally ridiculous value somewhere. Change activate to suit. + // comments before each test describe what is _valid_ + + State cb = static_cast( data ); + switch( cb ) { + case LANGUAGE: + if( ! inputLanguage( ob ) ) + activate = false; + break; + + case PATHS: + if( ! inputPaths( ob ) ) + activate = false; + break; + + case SCREENFONTS: + if( ! inputScreenFonts() ) + activate = false; + break; + + case SPELLCHECKER: + if( ! inputSpellChecker( ob ) ) + activate = false; + break; + + default: + break; + } + + return activate; +} + + void FormPreferences::update() { if (!dialog_) return; @@ -238,75 +308,6 @@ void FormPreferences::update() } -bool FormPreferences::input(FL_OBJECT * ob, long data) -{ - bool activate = true; - - // Remove any existing messages - fl_set_object_label(dialog_->text_warning, " "); - - // whatever checks you need to ensure the user hasn't entered - // some totally ridiculous value somewhere. Change activate to suit. - // comments before each test describe what is _valid_ - - State cb = static_cast( data ); - switch( cb ) { - case COLOURS: - feedbackColours( ob ); - break; - - case INPUTSMISC: - feedbackInputsMisc( ob ); - break; - - case INTERFACE: - feedbackInterface( ob ); - break; - - case LANGUAGE: - feedbackLanguage( ob ); - if( ! inputLanguage( ob ) ) - activate = false; - break; - - case LOOKNFEELMISC: - feedbackLnFmisc( ob ); - break; - - case OUTPUTSMISC: - feedbackOutputsMisc( ob ); - break; - - case PATHS: - feedbackPaths( ob ); - if( ! inputPaths( ob ) ) - activate = false; - break; - - case PRINTER: - feedbackPrinter( ob ); - break; - - case SCREENFONTS: - feedbackScreenFonts( ob ); - if( ! inputScreenFonts() ) - activate = false; - break; - - case SPELLCHECKER: - feedbackSpellChecker( ob ); - if( ! inputSpellChecker( ob ) ) - activate = false; - break; - - case TABS: - break; - } - - return activate; -} - - void FormPreferences::applyColours() { } @@ -340,6 +341,13 @@ void FormPreferences::buildInputsMisc() fl_set_input_return(inputs_misc_->input_date_format, FL_RETURN_CHANGED); + + // set up the feedback mechanism + fl_addto_form(inputs_misc_->form); + + setPostHandler( inputs_misc_->input_date_format ); + + fl_end_form(); } @@ -347,9 +355,8 @@ void FormPreferences::feedbackInputsMisc( FL_OBJECT const * const ob ) { string str; - if( ob == inputs_misc_->input_date_format ) { - str = N_("This accepts the normal strftime formats; see man strftime for full details.\nE.g.\"%A, %e. %B %Y\"."); - } + if( ob == inputs_misc_->input_date_format ) + str = lyxrc.getFeedback( LyXRC::RC_DATE_INSERT_FORMAT ); fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); @@ -393,26 +400,40 @@ void FormPreferences::buildInterface() fl_deactivate_object(interface_->button_ui_file_browse); fl_set_object_lcol(interface_->button_bind_file_browse, FL_INACTIVE); fl_set_object_lcol(interface_->button_ui_file_browse, FL_INACTIVE); + + // set up the feedback mechanism + fl_addto_form(interface_->form); + + setPostHandler( interface_->input_popup_font ); + setPostHandler( interface_->input_menu_font ); + setPostHandler( interface_->input_popup_encoding ); + setPostHandler( interface_->input_bind_file ); + setPostHandler( interface_->button_bind_file_browse ); + setPostHandler( interface_->input_ui_file ); + setPostHandler( interface_->button_ui_file_browse ); + setPostHandler( interface_->check_override_x_dead_keys ); + + fl_end_form(); } + void FormPreferences::feedbackInterface( FL_OBJECT const * const ob ) { string str; - if( ob == interface_->input_popup_font ) { - str = N_("The font for popups."); - } else if ( ob == interface_->input_menu_font ) { - str = N_("The font for menus (and groups titles in popups)."); - } else if ( ob == interface_->input_popup_encoding ) { - str = N_("The norm for the menu/popups fonts."); - } else if ( ob == interface_->input_bind_file ) { - str = N_("Keybindings file. Can either specify an absolute path,\nor LyX will look in its global and local bind/ directories."); - } else if ( ob == interface_->input_ui_file ) { - str = N_("The UI (user interface) file. Can either specify an absolute path,\nor LyX will look in its global and local ui/ directories."); - } else if ( ob == interface_->check_override_x_dead_keys ) { - str = N_("Set to true for LyX to take over the handling of the dead keys\n(a.k.a accent keys) that may be defined for your keyboard."); - } + if( ob == interface_->input_popup_font ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_POPUP ); + else if ( ob == interface_->input_menu_font ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_MENU ); + else if ( ob == interface_->input_popup_encoding ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_ENCODING_MENU ); + else if ( ob == interface_->input_bind_file ) + str = lyxrc.getFeedback( LyXRC::RC_BINDFILE ); + else if ( ob == interface_->input_ui_file ) + str = lyxrc.getFeedback( LyXRC::RC_UIFILE ); + else if ( ob == interface_->check_override_x_dead_keys ) + str = lyxrc.getFeedback( LyXRC::RC_OVERRIDE_X_DEADKEYS ); fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); @@ -438,19 +459,14 @@ void FormPreferences::updateInterface() void FormPreferences::applyLanguage() { - vector::size_type choice = - fl_get_choice(language_->choice_default_lang) - 1; - lyxrc.default_language = languageNames[choice]; + lyxrc.default_language = combo_default_lang->getline(); int button = fl_get_button(language_->check_use_kbmap); lyxrc.use_kbmap = static_cast(button); if( button ) { - choice = fl_get_choice(language_->choice_kbmap_1) - 1; - lyxrc.primary_kbmap = languageNames[choice]; - - choice = fl_get_choice(language_->choice_kbmap_2) - 1; - lyxrc.secondary_kbmap = languageNames[choice]; + lyxrc.primary_kbmap = combo_kbmap_1->getline(); + lyxrc.secondary_kbmap = combo_kbmap_2->getline(); } button = fl_get_button(language_->check_rtl_support); @@ -479,24 +495,62 @@ void FormPreferences::buildLanguage() fl_set_input_return(language_->input_command_begin, FL_RETURN_CHANGED); fl_set_input_return(language_->input_command_end, FL_RETURN_CHANGED); - // Only do this the first time buildLanguage() is called. - if( languageNames.empty() ) { - for( Languages::const_iterator lang = languages.begin(); - lang != languages.end(); lang++ ) { - languageNames.push_back( (*lang).second.lang() ); - } - } + // The default_language is a combo-box and has to be inserted manually + fl_addto_form(language_->form); - string names = " " + languageNames.front(); - for( vector::const_iterator lang = languageNames.begin(); - lang != languageNames.end(); ++lang ) { - names += " | " + (*lang); - } - names += " "; + FL_OBJECT * obj = language_->choice_default_lang; + combo_default_lang = new Combox(FL_COMBOX_DROPLIST); + combo_default_lang->add(obj->x, obj->y, obj->w, obj->h, 400); + combo_default_lang->shortcut("#L",1); + combo_default_lang->setcallback(ComboLanguageCB, this); + addLanguages( *combo_default_lang ); - fl_addto_choice(language_->choice_default_lang, names.c_str()); - fl_addto_choice(language_->choice_kbmap_1, names.c_str()); - fl_addto_choice(language_->choice_kbmap_2, names.c_str()); + // ditto kbmap_1 + obj = language_->choice_kbmap_1; + combo_kbmap_1 = new Combox(FL_COMBOX_DROPLIST); + combo_kbmap_1->add(obj->x, obj->y, obj->w, obj->h, 400); + combo_kbmap_1->shortcut("#1",1); + combo_kbmap_1->setcallback(ComboLanguageCB, this); + addLanguages( *combo_kbmap_1 ); + + // ditto kbmap_2 + obj = language_->choice_kbmap_2; + combo_kbmap_2 = new Combox(FL_COMBOX_DROPLIST); + combo_kbmap_2->add(obj->x, obj->y, obj->w, obj->h, 400); + combo_kbmap_2->shortcut("#2",1); + combo_kbmap_2->setcallback(ComboLanguageCB, this); + addLanguages( *combo_kbmap_2 ); + + fl_end_form(); + + // set up the feedback mechanism + fl_addto_form(language_->form); + + setPostHandler( language_->input_package ); + setPostHandler( language_->check_use_kbmap ); + + // these 3 should be replaced by the appropriate combox call + // setPostHandler( reinterpret_cast(combo_default_lang) ); + // setPostHandler( reinterpret_cast(combo_kbmap_1) ); + // setPostHandler( reinterpret_cast(combo_kbmap_2) ); + + setPostHandler( language_->check_rtl_support ); + setPostHandler( language_->check_mark_foreign ); + setPostHandler( language_->check_auto_begin ); + setPostHandler( language_->check_auto_end ); + setPostHandler( language_->input_command_begin ); + setPostHandler( language_->input_command_end ); + + fl_end_form(); +} + + +void FormPreferences::addLanguages( Combox & combo ) +{ + for(Languages::const_iterator cit = languages.begin(); + cit != languages.end(); cit++) { + combo.addto((*cit).second.lang()); + } } @@ -504,27 +558,28 @@ void FormPreferences::feedbackLanguage( FL_OBJECT const * const ob ) { string str; - if( ob == language_->choice_default_lang ) { - str = N_("New documents will be assigned this language."); - } else if( ob == language_->check_use_kbmap - || ob == language_->choice_kbmap_1 - || ob == language_->choice_kbmap_2 ) { - str = N_("Use this to set the correct mapping file for your keyboard.\nYou'll need this if you for instance want to type German documents\non an American keyboard."); - } else if( ob == language_->check_rtl_support ) { - str = N_("Use to enable support of right-to-left languages (e.g. Hebrew, Arabic)."); - } else if( ob == language_->check_auto_begin ) { - str = N_("Use if a language switching command is needed at the beginning\nof the document."); - } else if( ob == language_->check_auto_end ) { - str = N_("Use if a language switching command is needed at the end\nof the document."); - } else if( ob == language_->check_mark_foreign ) { - str = N_("Use to control the highlighting of words with a language foreign to\nthat of the document."); - } else if( ob == language_->input_package ) { - str = N_("The latex command for loading the language package.\nE.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\"."); - } else if( ob == language_->input_command_begin ) { - str = N_("The latex command for changing from the language of the document\nto another language.\nE.g. \\selectlanguage{$$lang} where $$lang is substituted by the name\nof the second language."); - } else if( ob == language_->input_command_end ) { - str = N_("The latex command for changing back to the language of the document."); - } + if( reinterpret_cast(ob) == combo_default_lang ) + str = lyxrc.getFeedback( LyXRC::RC_DEFAULT_LANGUAGE ); + else if( ob == language_->check_use_kbmap ) + str = lyxrc.getFeedback( LyXRC::RC_KBMAP ); + else if( reinterpret_cast(ob) == combo_kbmap_1) + str = lyxrc.getFeedback( LyXRC::RC_KBMAP_PRIMARY ); + else if( reinterpret_cast(ob) == combo_kbmap_2 ) + str = lyxrc.getFeedback( LyXRC::RC_KBMAP_SECONDARY ); + else if( ob == language_->check_rtl_support ) + str = lyxrc.getFeedback( LyXRC::RC_RTL_SUPPORT ); + else if( ob == language_->check_auto_begin ) + str = lyxrc.getFeedback( LyXRC::RC_LANGUAGE_AUTO_BEGIN ); + else if( ob == language_->check_auto_end ) + str = lyxrc.getFeedback( LyXRC::RC_LANGUAGE_AUTO_END ); + else if( ob == language_->check_mark_foreign ) + str = lyxrc.getFeedback( LyXRC::RC_MARK_FOREIGN_LANGUAGE ); + else if( ob == language_->input_package ) + str = lyxrc.getFeedback( LyXRC::RC_LANGUAGE_PACKAGE ); + else if( ob == language_->input_command_begin ) + str = lyxrc.getFeedback( LyXRC::RC_LANGUAGE_COMMAND_BEGIN ); + else if( ob == language_->input_command_end ) + str = lyxrc.getFeedback( LyXRC::RC_LANGUAGE_COMMAND_END ); fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); @@ -534,22 +589,14 @@ void FormPreferences::feedbackLanguage( FL_OBJECT const * const ob ) bool FormPreferences::inputLanguage( FL_OBJECT const * const ob ) { bool activate = true; - + if( !ob || ob == language_->check_use_kbmap ) { if( fl_get_button(language_->check_use_kbmap) ) { - fl_activate_object(language_->choice_kbmap_1); - fl_activate_object(language_->choice_kbmap_2); - fl_set_object_lcol(language_->choice_kbmap_1, - FL_BLACK); - fl_set_object_lcol(language_->choice_kbmap_2, - FL_BLACK); + combo_kbmap_1->activate(); + combo_kbmap_2->activate(); } else { - fl_deactivate_object(language_->choice_kbmap_1); - fl_deactivate_object(language_->choice_kbmap_2); - fl_set_object_lcol(language_->choice_kbmap_1, - FL_INACTIVE); - fl_set_object_lcol(language_->choice_kbmap_2, - FL_INACTIVE); + combo_kbmap_1->deactivate(); + combo_kbmap_2->deactivate(); } } @@ -562,30 +609,15 @@ void FormPreferences::updateLanguage() fl_set_button(language_->check_use_kbmap, lyxrc.use_kbmap); - vector::iterator it = - find( languageNames.begin(), languageNames.end(), - lyxrc.default_language ); - int choice = 0; - if( it != languageNames.end() ) - choice = static_cast( it - languageNames.begin() ); + combo_default_lang->select_text( lyxrc.default_language ); - fl_set_choice(language_->choice_default_lang, choice+1); - - it = find( languageNames.begin(), languageNames.end(), - lyxrc.primary_kbmap ); - choice = 0; - if( it != languageNames.end() ) - choice = static_cast( it - languageNames.begin() ); - - fl_set_choice(language_->choice_kbmap_1, choice+1); - - it = find( languageNames.begin(), languageNames.end(), - lyxrc.secondary_kbmap ); - choice = 0; - if( it != languageNames.end() ) - choice = static_cast( it - languageNames.begin() ); - - fl_set_choice(language_->choice_kbmap_2, choice+1); + if( lyxrc.use_kbmap ) { + combo_kbmap_1->select_text( lyxrc.primary_kbmap ); + combo_kbmap_2->select_text( lyxrc.secondary_kbmap ); + } else { + combo_kbmap_1->select_text( lyxrc.default_language ); + combo_kbmap_2->select_text( lyxrc.default_language ); + } fl_set_button(language_->check_rtl_support, lyxrc.rtl_support); fl_set_button(language_->check_auto_begin, lyxrc.language_auto_begin); @@ -632,6 +664,20 @@ void FormPreferences::buildLnFmisc() FL_RETURN_CHANGED); fl_set_counter_return(lnf_misc_->counter_wm_jump, FL_RETURN_CHANGED); + + // set up the feedback mechanism + fl_addto_form(lnf_misc_->form); + + setPostHandler( lnf_misc_->check_banner ); + setPostHandler( lnf_misc_->check_auto_region_delete ); + setPostHandler( lnf_misc_->check_exit_confirm ); + setPostHandler( lnf_misc_->check_display_shortcuts ); + setPostHandler( lnf_misc_->counter_autosave ); + setPostHandler( lnf_misc_->check_ask_new_file ); + setPostHandler( lnf_misc_->check_cursor_follows_scrollbar ); + setPostHandler( lnf_misc_->counter_wm_jump ); + + fl_end_form(); } @@ -639,24 +685,23 @@ void FormPreferences::feedbackLnFmisc( FL_OBJECT const * const ob ) { string str; - if( ob == lnf_misc_->check_banner ) { - str = N_("Set to false if you don't want the startup banner."); - } else if( ob == lnf_misc_->check_auto_region_delete ) { - str = N_("Set to false if you don't want the current selection to be replaced\nautomatically by what you type."); - } else if( ob == lnf_misc_->check_exit_confirm ) { - str = N_("Sets whether LyX asks for a second confirmation to exit when you have\nchanged documents.\n(LyX will still ask to save changed documents.)"); - } else if( ob == lnf_misc_->check_display_shortcuts ) { - str = N_("LyX continously displays names of last command executed,\nalong with a list of defined short-cuts for it in the minibuffer.\nSet to false if LyX seems slow."); - } else if( ob == lnf_misc_->check_ask_new_file ) { - str = N_("This sets the behaviour if you want to be asked for a filename when\ncreating a new document or wait until you save it and be asked then."); - } else if( ob == lnf_misc_->check_cursor_follows_scrollbar ) { - str = N_("LyX normally doesn't update the cursor position if you move the scrollbar.\nSet to true if you'd prefer to always have the cursor on screen."); - } else if( ob == lnf_misc_->counter_autosave ) { - str = N_("The time interval between auto-saves (in seconds).\n0 means no auto-save"); - } else if( ob == lnf_misc_->counter_wm_jump ) { - str = N_("The wheel movement factor (for mice with wheels or five button mice)"); - } - + if( ob == lnf_misc_->check_banner ) + str = lyxrc.getFeedback( LyXRC::RC_SHOW_BANNER ); + else if( ob == lnf_misc_->check_auto_region_delete ) + str = lyxrc.getFeedback( LyXRC::RC_AUTOREGIONDELETE ); + else if( ob == lnf_misc_->check_exit_confirm ) + str = lyxrc.getFeedback( LyXRC::RC_EXIT_CONFIRMATION ); + else if( ob == lnf_misc_->check_display_shortcuts ) + str = lyxrc.getFeedback( LyXRC::RC_DISPLAY_SHORTCUTS ); + else if( ob == lnf_misc_->check_ask_new_file ) + str = lyxrc.getFeedback( LyXRC::RC_NEW_ASK_FILENAME ); + else if( ob == lnf_misc_->check_cursor_follows_scrollbar ) + str = lyxrc.getFeedback( LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR ); + else if( ob == lnf_misc_->counter_autosave ) + str = lyxrc.getFeedback( LyXRC::RC_AUTOSAVE ); + else if( ob == lnf_misc_->counter_wm_jump ) + str = lyxrc.getFeedback( LyXRC::RC_WHEEL_JUMP ); + fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); } @@ -711,6 +756,17 @@ void FormPreferences::buildOutputsMisc() FL_RETURN_CHANGED); fl_addto_choice(outputs_misc_->choice_default_papersize, _(" default | US letter | legal | executive | A3 | A4 | A5 | B5 ")); + + // set up the feedback mechanism + fl_addto_form(outputs_misc_->form); + + setPostHandler( outputs_misc_->counter_line_len ); + setPostHandler( outputs_misc_->input_tex_encoding ); + setPostHandler( outputs_misc_->choice_default_papersize ); + setPostHandler( outputs_misc_->input_ascii_roff ); + setPostHandler( outputs_misc_->input_checktex ); + + fl_end_form(); } @@ -718,18 +774,17 @@ void FormPreferences::feedbackOutputsMisc(FL_OBJECT const * const ob ) { string str; - if( ob == outputs_misc_->counter_line_len ) { - str = N_("This is the maximum line length of an exported ASCII file\n(LaTeX, SGML or plain text)."); - } else if( ob == outputs_misc_->input_tex_encoding ) { - str = N_("The font encoding used for the LaTeX2e fontenc package.\nT1 is highly recommended for non-English languages."); - } else if( ob == outputs_misc_->input_ascii_roff ) { - str = N_("Use to define an external program to render tables in the ASCII output.\nE.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file.\nIf \"none\" is specified, an internal routine is used."); - } else if( ob == outputs_misc_->input_checktex ) { - str = N_("Define how to run chktex.\nE.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\"\nRefer to the ChkTeX documentation."); - } else if( ob == outputs_misc_->choice_default_papersize ) { - str = N_("Specify the default paper size."); - } - + if( ob == outputs_misc_->counter_line_len ) + str = lyxrc.getFeedback( LyXRC::RC_ASCII_LINELEN ); + else if( ob == outputs_misc_->input_tex_encoding ) + str = lyxrc.getFeedback( LyXRC::RC_FONT_ENCODING ); + else if( ob == outputs_misc_->input_ascii_roff ) + str = lyxrc.getFeedback( LyXRC::RC_ASCIIROFF_COMMAND ); + else if( ob == outputs_misc_->input_checktex ) + str = lyxrc.getFeedback( LyXRC::RC_CHKTEX_COMMAND ); + else if( ob == outputs_misc_->choice_default_papersize ) + str = lyxrc.getFeedback( LyXRC::RC_DEFAULT_PAPERSIZE ); + fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); } @@ -810,33 +865,54 @@ void FormPreferences::buildPaths() fl_set_object_lcol(paths_->button_lastfiles_browse, FL_INACTIVE); fl_set_object_lcol(paths_->button_backup_path_browse, FL_INACTIVE); fl_set_object_lcol(paths_->button_serverpipe_browse, FL_INACTIVE); + + // set up the feedback mechanism + fl_addto_form(paths_->form); + + setPostHandler( paths_->input_default_path ); + setPostHandler( paths_->button_document_browse ); + setPostHandler( paths_->counter_lastfiles ); + setPostHandler( paths_->input_template_path ); + setPostHandler( paths_->button_template_browse ); + setPostHandler( paths_->check_last_files ); + setPostHandler( paths_->button_temp_dir_browse ); + setPostHandler( paths_->input_lastfiles ); + setPostHandler( paths_->button_lastfiles_browse ); + setPostHandler( paths_->check_make_backups ); + setPostHandler( paths_->input_backup_path ); + setPostHandler( paths_->button_backup_path_browse ); + setPostHandler( paths_->input_serverpipe ); + setPostHandler( paths_->button_serverpipe_browse ); + setPostHandler( paths_->input_temp_dir ); + setPostHandler( paths_->check_use_temp_dir ); + + fl_end_form(); } void FormPreferences::feedbackPaths( FL_OBJECT const * const ob ) { string str; - if( ob == paths_->input_default_path ) { - str = N_("The default path for your documents."); - } else if ( ob == paths_->input_template_path ) { - str = N_("The path that LyX will set when offering to choose a template."); - } else if ( ob == paths_->check_use_temp_dir ) { - str = N_("Specify to use a temporary directory to store temporary TeX output.\nThis directory is deleted when you quit LyX."); - } else if ( ob == paths_->input_temp_dir ) { - str = N_("The path that LyX will use to store temporary TeX output."); - } else if ( ob == paths_->check_last_files ) { - str = N_("Specify to check whether the lastfiles still exist."); - } else if ( ob == paths_->input_lastfiles ) { - str = N_("The file where the last-files information should be stored."); - } else if ( ob == paths_->counter_lastfiles ) { - str = N_("Maximal number of lastfiles. Up to 9 can appear in the file menu."); - } else if ( ob == paths_->check_make_backups ) { - str = N_("Set to false if you don't want LyX to create backup files."); - } else if ( ob == paths_->input_backup_path ) { - str = N_("The path for storing backup files. If it is an empty string,\nLyX will store the backup file in the same directory as the original file."); - } else if ( ob == paths_->input_serverpipe ) { - str = N_("This starts the lyxserver. The pipes get an additional extension\n\".in\" and \".out\". Only for advanced users."); - } + if( ob == paths_->input_default_path ) + str = lyxrc.getFeedback( LyXRC::RC_DOCUMENTPATH ); + else if ( ob == paths_->input_template_path ) + str = lyxrc.getFeedback( LyXRC::RC_TEMPLATEPATH ); + else if ( ob == paths_->check_use_temp_dir ) + str = lyxrc.getFeedback( LyXRC::RC_USETEMPDIR ); + else if ( ob == paths_->input_temp_dir ) + str = lyxrc.getFeedback( LyXRC::RC_TEMPDIRPATH ); + else if ( ob == paths_->check_last_files ) + str = lyxrc.getFeedback( LyXRC::RC_CHECKLASTFILES ); + else if ( ob == paths_->input_lastfiles ) + str = lyxrc.getFeedback( LyXRC::RC_LASTFILES ); + else if ( ob == paths_->counter_lastfiles ) + str = lyxrc.getFeedback( LyXRC::RC_NUMLASTFILES ); + else if ( ob == paths_->check_make_backups ) + str = lyxrc.getFeedback( LyXRC::RC_MAKE_BACKUP ); + else if ( ob == paths_->input_backup_path ) + str = lyxrc.getFeedback( LyXRC::RC_BACKUPDIR_PATH ); + else if ( ob == paths_->input_serverpipe ) + str = lyxrc.getFeedback( LyXRC::RC_SERVERPIPE ); fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); @@ -1003,36 +1079,42 @@ void FormPreferences::feedbackPrinter( FL_OBJECT const * const ob ) { string str; - if( ob == printer_->input_command ) { - str = N_("Your favorite print program, eg \"dvips\", \"dvilj4\""); - } else if( ob == printer_->check_adapt_output ) { - str = N_("Set to true for LyX to pass the name of the destination printer to your\nprint command."); - } else if( ob == printer_->input_to_printer ) { - str = N_("Option to pass to the print program to print on a specific printer."); - } else if( ob == printer_->input_to_file ) { - str = N_("Option to pass to the print program to print to a file."); - } else if( ob == printer_->input_file_extension ) { - str = N_("Extension of printer program output file. Usually .ps"); - } else if( ob == printer_->input_extra_options ) { - str = N_("Extra options to pass to printing program after everything else,\nbut before the filename of the DVI file to be printed."); - } else if( ob == printer_->input_spool_command ) { - str = N_("When set, this printer option automatically prints to a file and then calls\na separate print spooling program on that file with the given name\nand arguments."); - } else if( ob == printer_->input_spool_prefix ) { - str = N_("If you specify a printer name in the print dialog, the following argument\nis prepended along with the printer name after the spool command."); - } else if( ob == printer_->input_name ) { - str = N_("The default printer to print on. If none is specified, LyX will\nuse the environment variable PRINTER."); - } else if( ob == printer_->input_even_pages - || ob == printer_->input_odd_pages - || ob == printer_->input_page_range - || ob == printer_->input_reverse - || ob == printer_->input_landscape - || ob == printer_->input_copies - || ob == printer_->input_collated - || ob == printer_->input_paper_type - || ob == printer_->input_paper_size ) { - str = N_("Look at the man page for your favorite print program to learn\nwhich options to use."); - } - + if( ob == printer_->input_command ) + str = lyxrc.getFeedback( LyXRC::RC_PRINT_COMMAND ); + else if( ob == printer_->check_adapt_output ) + str = lyxrc.getFeedback( LyXRC::RC_PRINT_ADAPTOUTPUT ); + else if( ob == printer_->input_to_printer ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTTOPRINTER ); + else if( ob == printer_->input_to_file ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTTOFILE ); + else if( ob == printer_->input_file_extension ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTFILEEXTENSION ); + else if( ob == printer_->input_extra_options ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTEXSTRAOPTIONS ); + else if( ob == printer_->input_spool_command ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTSPOOL_COMMAND ); + else if( ob == printer_->input_spool_prefix ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTSPOOL_PRINTERPREFIX ); + else if( ob == printer_->input_name ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTER ); + else if( ob == printer_->input_even_pages ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTEVENPAGEFLAG ); + else if( ob == printer_->input_odd_pages ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTODDPAGEFLAG ); + else if( ob == printer_->input_page_range ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTPAGERANGEFLAG ); + else if( ob == printer_->input_reverse ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTREVERSEFLAG ); + else if( ob == printer_->input_landscape ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTLANDSCAPEFLAG ); + else if( ob == printer_->input_copies ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTCOLLCOPIESFLAG ); + else if( ob == printer_->input_collated ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTCOPIESFLAG ); + else if( ob == printer_->input_paper_type ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTPAPERFLAG ); + else if( ob == printer_->input_paper_size ) + str = lyxrc.getFeedback( LyXRC::RC_PRINTPAPERDIMENSIONFLAG ); fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); @@ -1060,6 +1142,30 @@ void FormPreferences::buildPrinter() fl_set_input_return(printer_->input_spool_prefix, FL_RETURN_CHANGED); fl_set_input_return(printer_->input_paper_size, FL_RETURN_CHANGED); fl_set_input_return(printer_->input_name, FL_RETURN_CHANGED); + + // set up the feedback mechanism + fl_addto_form(printer_->form); + + setPostHandler( printer_->input_command ); + setPostHandler( printer_->input_page_range ); + setPostHandler( printer_->input_copies ); + setPostHandler( printer_->input_reverse ); + setPostHandler( printer_->input_to_printer ); + setPostHandler( printer_->input_file_extension ); + setPostHandler( printer_->input_spool_command ); + setPostHandler( printer_->input_paper_type ); + setPostHandler( printer_->input_even_pages ); + setPostHandler( printer_->input_odd_pages ); + setPostHandler( printer_->input_collated ); + setPostHandler( printer_->input_landscape ); + setPostHandler( printer_->input_to_file ); + setPostHandler( printer_->input_extra_options ); + setPostHandler( printer_->input_spool_prefix ); + setPostHandler( printer_->input_paper_size ); + setPostHandler( printer_->input_name ); + setPostHandler( printer_->check_adapt_output ); + + fl_end_form(); } @@ -1138,10 +1244,18 @@ void FormPreferences::applyScreenFonts() lyxrc.use_scalable_fonts = button; } - int ivalue = fl_get_counter_value(screen_fonts_->counter_zoom); - if( lyxrc.zoom != static_cast( ivalue ) ) { + unsigned int ivalue = static_cast + (fl_get_counter_value(screen_fonts_->counter_zoom)); + if( lyxrc.zoom != ivalue) { changed = true; - lyxrc.zoom = static_cast( ivalue ); + lyxrc.zoom = ivalue; + } + + ivalue = static_cast + (fl_get_counter_value(screen_fonts_->counter_dpi)); + if (lyxrc.dpi != ivalue) { + changed = true; + lyxrc.dpi = ivalue; } double dvalue = strToDbl(fl_get_input(screen_fonts_->input_tiny)); @@ -1223,6 +1337,7 @@ void FormPreferences::buildScreenFonts() fl_set_input_return(screen_fonts_->input_screen_encoding, FL_RETURN_CHANGED); fl_set_counter_return(screen_fonts_->counter_zoom, FL_RETURN_CHANGED); + fl_set_counter_return(screen_fonts_->counter_dpi, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_tiny, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_script, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_footnote, FL_RETURN_CHANGED); @@ -1233,6 +1348,29 @@ void FormPreferences::buildScreenFonts() fl_set_input_return(screen_fonts_->input_largest, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_huge, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_huger, FL_RETURN_CHANGED); + + // set up the feedback mechanism + fl_addto_form(screen_fonts_->form); + + setPostHandler( screen_fonts_->input_roman ); + setPostHandler( screen_fonts_->input_sans ); + setPostHandler( screen_fonts_->input_typewriter ); + setPostHandler( screen_fonts_->counter_zoom ); + setPostHandler( screen_fonts_->counter_dpi ); + setPostHandler( screen_fonts_->check_scalable ); + setPostHandler( screen_fonts_->input_screen_encoding ); + setPostHandler( screen_fonts_->input_tiny ); + setPostHandler( screen_fonts_->input_script ); + setPostHandler( screen_fonts_->input_footnote ); + setPostHandler( screen_fonts_->input_small ); + setPostHandler( screen_fonts_->input_large ); + setPostHandler( screen_fonts_->input_larger ); + setPostHandler( screen_fonts_->input_largest ); + setPostHandler( screen_fonts_->input_normal ); + setPostHandler( screen_fonts_->input_huge ); + setPostHandler( screen_fonts_->input_huger ); + + fl_end_form(); } @@ -1240,30 +1378,33 @@ void FormPreferences::feedbackScreenFonts(FL_OBJECT const * const ob ) { string str; - if( ob == screen_fonts_->input_roman - || ob == screen_fonts_->input_sans - || ob == screen_fonts_->input_typewriter ) { - str = N_("The screen fonts used to display the text while editing."); - } else if( ob == screen_fonts_->check_scalable ) { - str = N_("Allow the use of scalable screen fonts? If false, LyX will use the\nclosest existing size for a match. Use this if the scalable fonts\nlook bad and you have many fixed size fonts."); - } else if( ob == screen_fonts_->input_screen_encoding ) { - str = N_("The norm for the screen fonts."); - } else if( ob == screen_fonts_->counter_zoom ) { - str = N_("The zoom percentage for screen fonts.\nA setting of 100% will make the fonts roughly the same size as on paper."); - } else if( ob == screen_fonts_->input_tiny - || ob == screen_fonts_->input_script - || ob == screen_fonts_->input_footnote - || ob == screen_fonts_->input_small - || ob == screen_fonts_->input_large - || ob == screen_fonts_->input_larger - || ob == screen_fonts_->input_larger - || ob == screen_fonts_->input_largest - || ob == screen_fonts_->input_normal - || ob == screen_fonts_->input_huge - || ob == screen_fonts_->input_huger ) { - str = N_("The font sizes used for calculating the scaling of the screen fonts."); - } - + if( ob == screen_fonts_->input_roman ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_ROMAN ); + else if( ob == screen_fonts_->input_sans ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_SANS ); + else if( ob == screen_fonts_->input_typewriter ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_TYPEWRITER ); + else if( ob == screen_fonts_->check_scalable ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_SCALABLE ); + else if( ob == screen_fonts_->input_screen_encoding ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_ENCODING ); + else if( ob == screen_fonts_->counter_zoom ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_ZOOM ); + else if( ob == screen_fonts_->counter_dpi ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_DPI ); + else if( ob == screen_fonts_->input_tiny + || ob == screen_fonts_->input_script + || ob == screen_fonts_->input_footnote + || ob == screen_fonts_->input_small + || ob == screen_fonts_->input_large + || ob == screen_fonts_->input_larger + || ob == screen_fonts_->input_larger + || ob == screen_fonts_->input_largest + || ob == screen_fonts_->input_normal + || ob == screen_fonts_->input_huge + || ob == screen_fonts_->input_huger ) + str = lyxrc.getFeedback( LyXRC::RC_SCREEN_FONT_SIZES ); + fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); } @@ -1334,8 +1475,8 @@ void FormPreferences::updateScreenFonts() lyxrc.font_norm.c_str()); fl_set_button(screen_fonts_->check_scalable, lyxrc.use_scalable_fonts); - fl_set_counter_value(screen_fonts_->counter_zoom, - lyxrc.zoom); + fl_set_counter_value(screen_fonts_->counter_zoom, lyxrc.zoom); + fl_set_counter_value(screen_fonts_->counter_dpi, lyxrc.dpi); fl_set_input(screen_fonts_->input_tiny, tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str()); fl_set_input(screen_fonts_->input_script, @@ -1445,25 +1586,46 @@ void FormPreferences::buildSpellchecker() fl_deactivate_object(spellchecker_->button_personal_dict); fl_set_object_lcol(spellchecker_->button_personal_dict, FL_INACTIVE); + + // set up the feedback mechanism + fl_addto_form(spellchecker_->form); + + setPostHandler( spellchecker_->choice_spell_command ); + setPostHandler( spellchecker_->check_alt_lang ); + setPostHandler( spellchecker_->input_alt_lang ); + setPostHandler( spellchecker_->check_escape_chars ); + setPostHandler( spellchecker_->input_escape_chars ); + setPostHandler( spellchecker_->check_personal_dict ); + setPostHandler( spellchecker_->input_personal_dict ); + setPostHandler( spellchecker_->button_personal_dict ); + setPostHandler( spellchecker_->check_compound_words ); + setPostHandler( spellchecker_->check_input_enc ); + + fl_end_form(); } void FormPreferences::feedbackSpellChecker( FL_OBJECT const * const ob ) { string str; - if( ob == spellchecker_->choice_spell_command ) { - str = N_("What command runs the spell checker?"); - } else if( ob == spellchecker_->check_alt_lang ) { - str = N_("Specify an alternate language.\nThe default is to use the language of the document."); - } else if( ob == spellchecker_->check_escape_chars ) { - str = N_("Specify additional chars that can be part of a word."); - } else if( ob == spellchecker_->check_personal_dict ) { - str = N_("Specify an alternate personal dictionary file.\nE.g. \".ispell_english\"."); - } else if( ob == spellchecker_->check_compound_words ) { - str = N_("Consider run-together words, such as \"notthe\" for \"not the\",\nas legal words?"); - } else if( ob == spellchecker_->check_input_enc ) { - str = N_("Specify whether to pass the -T input encoding option to ispell.\nEnable this if you can't spellcheck words with international letters\nin them.\nThis may not work with all dictionaries."); - } + if( ob == spellchecker_->choice_spell_command ) + str = lyxrc.getFeedback( LyXRC::RC_SPELL_COMMAND ); + else if( ob == spellchecker_->check_alt_lang ) + str = lyxrc.getFeedback( LyXRC::RC_USE_ALT_LANG ); + else if( ob == spellchecker_->input_alt_lang ) + str = lyxrc.getFeedback( LyXRC::RC_ALT_LANG ); + else if( ob == spellchecker_->check_escape_chars ) + str = lyxrc.getFeedback( LyXRC::RC_USE_ESC_CHARS ); + else if( ob == spellchecker_->input_escape_chars ) + str = lyxrc.getFeedback( LyXRC::RC_ESC_CHARS ); + else if( ob == spellchecker_->check_personal_dict ) + str = lyxrc.getFeedback( LyXRC::RC_USE_PERS_DICT ); + else if( ob == spellchecker_->input_personal_dict ) + str = lyxrc.getFeedback( LyXRC::RC_PERS_DICT ); + else if( ob == spellchecker_->check_compound_words ) + str = lyxrc.getFeedback( LyXRC::RC_ACCEPT_COMPOUND ); + else if( ob == spellchecker_->check_input_enc ) + str = lyxrc.getFeedback( LyXRC::RC_USE_INP_ENC ); fl_set_object_label(dialog_->text_warning, str.c_str()); fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); @@ -1697,3 +1859,63 @@ bool FormPreferences::WriteableFile( string const & name, string const & suffix return success; } + + +void FormPreferences::ComboLanguageCB(int, void * v, Combox * combox) +{ + FormPreferences * pre = static_cast(v); + pre->bc_.valid( pre->input( reinterpret_cast(combox), + FormPreferences::LANGUAGE ) ); +} + + +// C functions for the timer callback used to give the user feedback +C_GENERICCB(FormPreferences, FeedbackCB) +extern "C" int C_FormPreferencesFeedbackPost(FL_OBJECT * ob, int event, + FL_Coord mx, FL_Coord my, + int key, void * xev) +{ + FormPreferences * pre = + static_cast(ob->form->u_vdata); + return pre->FeedbackPost(ob, event, mx, my, key, xev); +} + + +void FormPreferences::FeedbackCB(FL_OBJECT *, long data) +{ + FL_OBJECT * ob = reinterpret_cast(data); + FormPreferences * pre = + static_cast(ob->form->u_vdata); + pre->feedback( ob ); +} + +// post_handler for feedback messages +int FormPreferences::FeedbackPost(FL_OBJECT *ob, int event, + FL_Coord, FL_Coord, int, void *) +{ + FL_OBJECT * timer_feedback = reinterpret_cast(ob->u_cdata); + + // We do not test for empty help here, since this can never happen + if(event == FL_ENTER){ + fl_set_object_callback(timer_feedback, + C_FormPreferencesFeedbackCB, + reinterpret_cast(ob)); + fl_set_timer(timer_feedback, 0.5); + } + else if(event != FL_MOTION){ + fl_set_timer(timer_feedback, 0); + + FormPreferences * pre = + static_cast(ob->form->u_vdata); + + fl_set_object_label(pre->dialog_->text_warning, ""); + } + return 0; +} + + +void FormPreferences::setPostHandler( FL_OBJECT * ob ) const +{ + ob->u_cdata = reinterpret_cast(dialog_->timer_feedback); + fl_set_object_posthandler(ob, C_FormPreferencesFeedbackPost); +} diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index 0dbc60d048..f55ffa8f8e 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -38,6 +38,7 @@ struct FD_form_outputs_misc; struct FD_form_spellchecker; struct FD_form_language; struct FD_form_colours; +class Combox; /** This class provides an XForms implementation of the FormPreferences Dialog. The preferences dialog allows users to set/save their preferences. @@ -48,6 +49,14 @@ public: FormPreferences(LyXView *, Dialogs *); /// ~FormPreferences(); + /// + static void ComboLanguageCB(int, void *, Combox *); + /// + static void FeedbackCB(FL_OBJECT *, long); + /// + static int FeedbackPost(FL_OBJECT *ob, int, FL_Coord, FL_Coord, + int, void *); + private: /// enum State { @@ -70,10 +79,9 @@ private: /// SCREENFONTS, /// - SPELLCHECKER, - /// - TABS + SPELLCHECKER }; + /// Update the dialog. virtual void update(); /// @@ -88,6 +96,8 @@ private: virtual bool input(FL_OBJECT *, long); /// Build the dialog virtual void build(); + /// control which feedback message is output + void feedback( FL_OBJECT * ob ); /// virtual FL_FORM * form() const; /// @@ -119,6 +129,8 @@ private: /// void buildLanguage(); /// + void addLanguages( Combox & ); + /// void buildLnFmisc(); /// void buildOutputsMisc(); @@ -185,6 +197,8 @@ private: bool ReadableDir( string const & ) const; /// bool WriteableFile( string const &, string const & = string() ) const; + /// + void setPostHandler( FL_OBJECT * ) const; /// FD_form_preferences * build_preferences(); @@ -241,6 +255,12 @@ private: FD_form_screen_fonts * screen_fonts_; /// FD_form_spellchecker * spellchecker_; + /// + Combox * combo_default_lang; + /// + Combox * combo_kbmap_1; + /// + Combox * combo_kbmap_2; }; #endif diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index 420ae80e02..483af3bbad 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -205,6 +205,16 @@ int get_new_submenu(vector & smn, Window win) size_type const max_number_of_items = 25; +inline +string const fixlabel(string const & str) +{ +#if FL_REVISION < 89 + return subst(str, '%', '?'); +#else + return subst(str, "%", "%%"); +#endif +} + void add_toc2(int menu, string const & extra_label, vector & smn, Window win, vector const & toc_list, @@ -216,7 +226,7 @@ void add_toc2(int menu, string const & extra_label, getPseudoAction(LFUN_GOTO_PARAGRAPH, tostr(toc_list[i].par->id())); string label(4 * max(0, toc_list[i].depth - depth),' '); - label += toc_list[i].str; + label += fixlabel(toc_list[i].str); label = limit_string_length(label); label += "%x" + tostr(action); if (i == to - 1 && depth == 0) @@ -248,7 +258,7 @@ void add_toc2(int menu, string const & extra_label, getPseudoAction(LFUN_GOTO_PARAGRAPH, tostr(toc_list[pos].par->id())); string label(4 * max(0, toc_list[pos].depth - depth), ' '); - label += toc_list[pos].str; + label += fixlabel(toc_list[pos].str); label = limit_string_length(label); if (new_pos == to && depth == 0) label += extra_label; @@ -298,8 +308,8 @@ void Menubar::Pimpl::add_toc(int menu, string const & extra_label, int action = lyxaction. getPseudoAction(LFUN_GOTO_PARAGRAPH, tostr(toc_list[j][i].par->id())); - string label = - limit_string_length(toc_list[j][i].str); + string label = fixlabel(toc_list[j][i].str); + label = limit_string_length(label); label += "%x" + tostr(action); fl_addtopup(menu2, label.c_str()); } diff --git a/src/frontends/xforms/form_preferences.C b/src/frontends/xforms/form_preferences.C index f8d97fc7d2..f615dd31fd 100644 --- a/src/frontends/xforms/form_preferences.C +++ b/src/frontends/xforms/form_preferences.C @@ -27,7 +27,6 @@ FD_form_preferences * FormPreferences::build_preferences() obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 500, ""); fdui->tabfolder_prefs = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 5, 10, 455, 375, ""); fl_set_object_boxtype(obj, FL_FLAT_BOX); - fl_set_object_callback(obj, C_FormBaseInputCB, TABS); fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 390, 90, 30, idex(_("Apply|#A"))); fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -46,6 +45,7 @@ FD_form_preferences * FormPreferences::build_preferences() obj = fl_add_frame(FL_ENGRAVED_FRAME, 0, 425, 470, 1, ""); fdui->text_warning = obj = fl_add_text(FL_NORMAL_TEXT, 5, 430, 460, 70, ""); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + fdui->timer_feedback = obj = fl_add_timer(FL_HIDDEN_TIMER, 107, 390, 50, 30, ""); fl_end_form(); fdui->form->fdui = fdui; @@ -71,7 +71,6 @@ FD_form_outer_tab * FormPreferences::build_outer_tab() obj = fl_add_box(FL_FLAT_BOX, 0, 0, 455, 375, ""); fdui->tabfolder_outer = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 455, 375, ""); fl_set_object_boxtype(obj, FL_FLAT_BOX); - fl_set_object_callback(obj, C_FormBaseInputCB, TABS); fl_end_form(); fdui->form->fdui = fdui; @@ -104,50 +103,60 @@ FD_form_screen_fonts * FormPreferences::build_screen_fonts() fdui->input_typewriter = obj = fl_add_input(FL_NORMAL_INPUT, 210, 65, 200, 30, _("Typewriter")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->counter_zoom = obj = fl_add_counter(FL_SIMPLE_COUNTER, 210, 125, 200, 30, _("%")); + fdui->counter_zoom = obj = fl_add_counter(FL_SIMPLE_COUNTER, 345, 130, 65, 30, idex(_("Zoom %|#Z"))); + fl_set_button_shortcut(obj, scex(_("Zoom %|#Z")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_RIGHT); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fl_set_counter_precision(obj, 0); fl_set_counter_bounds(obj, 0, 999); fl_set_counter_value(obj, 150); fl_set_counter_step(obj, 1, 1); - fdui->check_scalable = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 168, 125, 33, 31, _("Allow scaling")); + fdui->check_scalable = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 60, 143, 33, 31, _("Use scalable fonts")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT); + fl_set_object_lalign(obj, FL_ALIGN_RIGHT); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fl_set_button(obj, 1); fdui->input_screen_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 210, 95, 200, 30, _("Encoding")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_tiny = obj = fl_add_input(FL_FLOAT_INPUT, 140, 165, 70, 30, _("tiny")); + fdui->input_script = obj = fl_add_input(FL_FLOAT_INPUT, 200, 199, 70, 30, _("script")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_script = obj = fl_add_input(FL_FLOAT_INPUT, 340, 165, 70, 30, _("script")); + fdui->input_footnote = obj = fl_add_input(FL_FLOAT_INPUT, 340, 198, 70, 30, _("footnote")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_footnote = obj = fl_add_input(FL_FLOAT_INPUT, 140, 195, 70, 30, _("footnote")); + fdui->input_large = obj = fl_add_input(FL_FLOAT_INPUT, 340, 228, 70, 30, _("large")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_small = obj = fl_add_input(FL_FLOAT_INPUT, 340, 195, 70, 30, _("small")); + fdui->input_largest = obj = fl_add_input(FL_FLOAT_INPUT, 200, 259, 70, 30, _("largest")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_large = obj = fl_add_input(FL_FLOAT_INPUT, 340, 225, 70, 30, _("large")); + fdui->input_huge = obj = fl_add_input(FL_FLOAT_INPUT, 340, 258, 70, 30, _("huge")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_larger = obj = fl_add_input(FL_FLOAT_INPUT, 140, 255, 70, 30, _("larger")); + fdui->input_normal = obj = fl_add_input(FL_FLOAT_INPUT, 200, 229, 70, 30, _("normal")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_largest = obj = fl_add_input(FL_FLOAT_INPUT, 340, 255, 70, 30, _("largest")); + fdui->counter_dpi = obj = fl_add_counter(FL_SIMPLE_COUNTER, 345, 162, 65, 30, idex(_("Screen DPI|#D"))); + fl_set_button_shortcut(obj, scex(_("Screen DPI|#D")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); + fl_set_counter_precision(obj, 0); + fl_set_counter_bounds(obj, 0, 999); + fl_set_counter_value(obj, 150); + fl_set_counter_step(obj, 1, 1); + fdui->input_tiny = obj = fl_add_input(FL_FLOAT_INPUT, 60, 198, 70, 30, _("tiny")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_normal = obj = fl_add_input(FL_FLOAT_INPUT, 140, 225, 70, 30, _("normal")); + fdui->input_larger = obj = fl_add_input(FL_FLOAT_INPUT, 60, 258, 70, 30, _("larger")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_huge = obj = fl_add_input(FL_FLOAT_INPUT, 140, 285, 70, 30, _("huge")); + fdui->input_small = obj = fl_add_input(FL_FLOAT_INPUT, 60, 228, 70, 30, _("small")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); - fdui->input_huger = obj = fl_add_input(FL_FLOAT_INPUT, 340, 285, 70, 30, _("huger")); + fdui->input_huger = obj = fl_add_input(FL_FLOAT_INPUT, 60, 288, 70, 30, _("huger")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fl_end_form(); @@ -316,6 +325,14 @@ FD_form_language * FormPreferences::build_language() fdui->form = fl_bgn_form(FL_NO_BOX, 450, 360); fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 360, ""); + fdui->input_package = obj = fl_add_input(FL_NORMAL_INPUT, 131, 18, 300, 30, idex(_("Package|#P"))); + fl_set_button_shortcut(obj, scex(_("Package|#P")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); + fdui->choice_default_lang = obj = fl_add_choice(FL_NORMAL_CHOICE, 231, 56, 200, 30, idex(_("Default language|#D"))); + fl_set_button_shortcut(obj, scex(_("Default language|#D")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); fdui->check_use_kbmap = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 158, 113, 30, 30, idex(_("Keyboard map|#K"))); fl_set_button_shortcut(obj, scex(_("Keyboard map|#K")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -325,6 +342,10 @@ FD_form_language * FormPreferences::build_language() fl_set_button_shortcut(obj, scex(_("1st|#1")), 1); fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); + fdui->choice_kbmap_2 = obj = fl_add_choice(FL_NORMAL_CHOICE, 231, 128, 200, 30, idex(_("2nd|#2"))); + fl_set_button_shortcut(obj, scex(_("2nd|#2")), 1); + fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); fdui->check_rtl_support = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 154, 161, 30, 30, idex(_("RtL support|#R"))); fl_set_button_shortcut(obj, scex(_("RtL support|#R")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -335,19 +356,15 @@ FD_form_language * FormPreferences::build_language() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); - fdui->check_auto_end = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 362, 187, 30, 30, idex(_("Auto finish|#f"))); - fl_set_button_shortcut(obj, scex(_("Auto finish|#f")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); fdui->check_auto_begin = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 362, 161, 30, 30, idex(_("Auto begin|#b"))); fl_set_button_shortcut(obj, scex(_("Auto begin|#b")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); - fdui->input_package = obj = fl_add_input(FL_NORMAL_INPUT, 131, 18, 300, 30, idex(_("Package|#P"))); - fl_set_button_shortcut(obj, scex(_("Package|#P")), 1); + fdui->check_auto_end = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 362, 187, 30, 30, idex(_("Auto finish|#f"))); + fl_set_button_shortcut(obj, scex(_("Auto finish|#f")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_lalign(obj, FL_ALIGN_LEFT); fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); fdui->input_command_begin = obj = fl_add_input(FL_NORMAL_INPUT, 131, 224, 300, 30, idex(_("Command start|#s"))); fl_set_button_shortcut(obj, scex(_("Command start|#s")), 1); @@ -357,14 +374,6 @@ FD_form_language * FormPreferences::build_language() fl_set_button_shortcut(obj, scex(_("Command end|#e")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); - fdui->choice_kbmap_2 = obj = fl_add_choice(FL_NORMAL_CHOICE, 231, 128, 200, 30, idex(_("2nd|#2"))); - fl_set_button_shortcut(obj, scex(_("2nd|#2")), 1); - fl_set_object_boxtype(obj, FL_FRAME_BOX); - fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); - fdui->choice_default_lang = obj = fl_add_choice(FL_NORMAL_CHOICE, 231, 56, 200, 30, idex(_("Default language|#D"))); - fl_set_button_shortcut(obj, scex(_("Default language|#D")), 1); - fl_set_object_boxtype(obj, FL_FRAME_BOX); - fl_set_object_callback(obj, C_FormBaseInputCB, LANGUAGE); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_preferences.h b/src/frontends/xforms/form_preferences.h index 88bdbc5a2c..2aecde4106 100644 --- a/src/frontends/xforms/form_preferences.h +++ b/src/frontends/xforms/form_preferences.h @@ -5,13 +5,11 @@ #define FD_form_preferences_h_ /** Callbacks, globals and object handlers **/ -extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long); -extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); @@ -44,6 +42,7 @@ struct FD_form_preferences { FL_OBJECT *button_ok; FL_OBJECT *button_restore; FL_OBJECT *text_warning; + FL_OBJECT *timer_feedback; }; struct FD_form_outer_tab { ~FD_form_outer_tab(); @@ -61,15 +60,16 @@ struct FD_form_screen_fonts { FL_OBJECT *counter_zoom; FL_OBJECT *check_scalable; FL_OBJECT *input_screen_encoding; - FL_OBJECT *input_tiny; FL_OBJECT *input_script; FL_OBJECT *input_footnote; - FL_OBJECT *input_small; FL_OBJECT *input_large; - FL_OBJECT *input_larger; FL_OBJECT *input_largest; - FL_OBJECT *input_normal; FL_OBJECT *input_huge; + FL_OBJECT *input_normal; + FL_OBJECT *counter_dpi; + FL_OBJECT *input_tiny; + FL_OBJECT *input_larger; + FL_OBJECT *input_small; FL_OBJECT *input_huger; }; struct FD_form_outputs_misc { @@ -107,17 +107,17 @@ struct FD_form_language { ~FD_form_language(); FL_FORM *form; + FL_OBJECT *input_package; + FL_OBJECT *choice_default_lang; FL_OBJECT *check_use_kbmap; FL_OBJECT *choice_kbmap_1; + FL_OBJECT *choice_kbmap_2; FL_OBJECT *check_rtl_support; FL_OBJECT *check_mark_foreign; - FL_OBJECT *check_auto_end; FL_OBJECT *check_auto_begin; - FL_OBJECT *input_package; + FL_OBJECT *check_auto_end; FL_OBJECT *input_command_begin; FL_OBJECT *input_command_end; - FL_OBJECT *choice_kbmap_2; - FL_OBJECT *choice_default_lang; }; struct FD_form_colours { ~FD_form_colours(); diff --git a/src/frontends/xforms/forms/form_preferences.fd b/src/frontends/xforms/forms/form_preferences.fd index 01c5f6b332..419ee1a1ff 100644 --- a/src/frontends/xforms/forms/form_preferences.fd +++ b/src/frontends/xforms/forms/form_preferences.fd @@ -11,7 +11,7 @@ SnapGrid: 1 Name: form_preferences Width: 470 Height: 500 -Number of Objects: 8 +Number of Objects: 9 -------------------- class: FL_BOX @@ -46,8 +46,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: tabfolder_prefs -callback: C_FormBaseInputCB -argument: TABS +callback: +argument: -------------------- class: FL_BUTTON @@ -157,6 +157,24 @@ name: text_warning callback: argument: +-------------------- +class: FL_TIMER +type: HIDDEN_TIMER +box: 107 390 50 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_RED +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: timer_feedback +callback: +argument: + =============== FORM =============== Name: form_outer_tab Width: 455 @@ -196,14 +214,14 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: tabfolder_outer -callback: C_FormBaseInputCB -argument: TABS +callback: +argument: =============== FORM =============== Name: form_screen_fonts Width: 455 Height: 375 -Number of Objects: 17 +Number of Objects: 18 -------------------- class: FL_BOX @@ -280,14 +298,14 @@ argument: SCREENFONTS -------------------- class: FL_COUNTER type: SIMPLE_COUNTER -box: 210 125 200 30 +box: 345 130 65 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_BLUE -alignment: FL_ALIGN_RIGHT +alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: % +label: Zoom %|#Z shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity @@ -302,14 +320,14 @@ argument: SCREENFONTS -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON -box: 168 125 33 31 +box: 60 143 33 31 boxtype: FL_NO_BOX colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_LEFT +alignment: FL_ALIGN_RIGHT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Allow scaling +label: Use scalable fonts shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity @@ -339,25 +357,7 @@ argument: SCREENFONTS -------------------- class: FL_INPUT type: FLOAT_INPUT -box: 140 165 70 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: tiny -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_tiny -callback: C_FormBaseInputCB -argument: SCREENFONTS - --------------------- -class: FL_INPUT -type: FLOAT_INPUT -box: 340 165 70 30 +box: 200 199 70 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -375,7 +375,7 @@ argument: SCREENFONTS -------------------- class: FL_INPUT type: FLOAT_INPUT -box: 140 195 70 30 +box: 340 198 70 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -393,25 +393,7 @@ argument: SCREENFONTS -------------------- class: FL_INPUT type: FLOAT_INPUT -box: 340 195 70 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: small -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_small -callback: C_FormBaseInputCB -argument: SCREENFONTS - --------------------- -class: FL_INPUT -type: FLOAT_INPUT -box: 340 225 70 30 +box: 340 228 70 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -429,25 +411,7 @@ argument: SCREENFONTS -------------------- class: FL_INPUT type: FLOAT_INPUT -box: 140 255 70 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: larger -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_larger -callback: C_FormBaseInputCB -argument: SCREENFONTS - --------------------- -class: FL_INPUT -type: FLOAT_INPUT -box: 340 255 70 30 +box: 200 259 70 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -465,25 +429,7 @@ argument: SCREENFONTS -------------------- class: FL_INPUT type: FLOAT_INPUT -box: 140 225 70 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: normal -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: input_normal -callback: C_FormBaseInputCB -argument: SCREENFONTS - --------------------- -class: FL_INPUT -type: FLOAT_INPUT -box: 140 285 70 30 +box: 340 258 70 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -501,7 +447,101 @@ argument: SCREENFONTS -------------------- class: FL_INPUT type: FLOAT_INPUT -box: 340 285 70 30 +box: 200 229 70 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: normal +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_normal +callback: C_FormBaseInputCB +argument: SCREENFONTS + +-------------------- +class: FL_COUNTER +type: SIMPLE_COUNTER +box: 345 162 65 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_BLUE +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Screen DPI|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: counter_dpi +callback: C_FormBaseInputCB +argument: SCREENFONTS + bounds: 0 999 + precision: 0 + value: 150 + sstep: 1 + +-------------------- +class: FL_INPUT +type: FLOAT_INPUT +box: 60 198 70 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: tiny +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_tiny +callback: C_FormBaseInputCB +argument: SCREENFONTS + +-------------------- +class: FL_INPUT +type: FLOAT_INPUT +box: 60 258 70 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: larger +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_larger +callback: C_FormBaseInputCB +argument: SCREENFONTS + +-------------------- +class: FL_INPUT +type: FLOAT_INPUT +box: 60 228 70 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: small +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_small +callback: C_FormBaseInputCB +argument: SCREENFONTS + +-------------------- +class: FL_INPUT +type: FLOAT_INPUT +box: 60 288 70 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -922,6 +962,42 @@ name: callback: argument: +-------------------- +class: FL_INPUT +type: NORMAL_INPUT +box: 131 18 300 30 +boxtype: FL_DOWN_BOX +colors: FL_COL1 FL_MCOL +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Package|#P +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: input_package +callback: C_FormBaseInputCB +argument: LANGUAGE + +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 231 56 200 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: Default language|#D +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_default_lang +callback: C_FormBaseInputCB +argument: LANGUAGE + -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON @@ -958,6 +1034,24 @@ name: choice_kbmap_1 callback: C_FormBaseInputCB argument: LANGUAGE +-------------------- +class: FL_CHOICE +type: NORMAL_CHOICE +box: 231 128 200 30 +boxtype: FL_FRAME_BOX +colors: FL_COL1 FL_BLACK +alignment: FL_ALIGN_LEFT +style: FL_NORMAL_STYLE +size: FL_DEFAULT_SIZE +lcol: FL_BLACK +label: 2nd|#2 +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: choice_kbmap_2 +callback: C_FormBaseInputCB +argument: LANGUAGE + -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON @@ -994,24 +1088,6 @@ name: check_mark_foreign callback: C_FormBaseInputCB argument: LANGUAGE --------------------- -class: FL_CHECKBUTTON -type: PUSH_BUTTON -box: 362 187 30 30 -boxtype: FL_NO_BOX -colors: FL_COL1 FL_YELLOW -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Auto finish|#f -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: check_auto_end -callback: C_FormBaseInputCB -argument: LANGUAGE - -------------------- class: FL_CHECKBUTTON type: PUSH_BUTTON @@ -1031,20 +1107,20 @@ callback: C_FormBaseInputCB argument: LANGUAGE -------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 131 18 300 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL +class: FL_CHECKBUTTON +type: PUSH_BUTTON +box: 362 187 30 30 +boxtype: FL_NO_BOX +colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Package|#P +label: Auto finish|#f shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity -name: input_package +name: check_auto_end callback: C_FormBaseInputCB argument: LANGUAGE @@ -1084,42 +1160,6 @@ name: input_command_end callback: C_FormBaseInputCB argument: LANGUAGE --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 231 128 200 30 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: 2nd|#2 -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: choice_kbmap_2 -callback: C_FormBaseInputCB -argument: LANGUAGE - --------------------- -class: FL_CHOICE -type: NORMAL_CHOICE -box: 231 56 200 30 -boxtype: FL_FRAME_BOX -colors: FL_COL1 FL_BLACK -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: Default language|#D -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: choice_default_lang -callback: C_FormBaseInputCB -argument: LANGUAGE - =============== FORM =============== Name: form_colours Width: 450 diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index eca8a50121..77619a2d76 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -354,19 +354,23 @@ bool InsetLatexAccent::DisplayISO8859_9(BufferView * bv, LyXFont const & font, } -void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font, +void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0, int baseline, float & x, bool) const { Painter & pain = bv->painter(); - if (lyxrc.font_norm == "iso8859-9") - if (DisplayISO8859_9(bv, font, baseline, x)) + if (lyxrc.font_norm_type == LyXRC::ISO_8859_9) + if (DisplayISO8859_9(bv, font0, baseline, x)) return; /* draw it! */ // All the manually drawn accents in this function could use an // overhaul. Different ways of drawing (what metrics to use) // should also be considered. + + LyXFont font(font0); + if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) + font.setLanguage(english_language); if (candisp) { int asc = ascent(bv, font); diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index a9b6769188..b66a7e0cef 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -146,7 +146,7 @@ string const InsetQuotes::DispString() const if (times == InsetQuotes::DoubleQ) disp += disp; - if (lyxrc.font_norm == "iso8859-1") + if (lyxrc.font_norm_type == LyXRC::ISO_8859_1) if (disp == "<<") disp = '«'; else if (disp == ">>") diff --git a/src/language.C b/src/language.C index 909768ba07..9a1d26c945 100644 --- a/src/language.C +++ b/src/language.C @@ -25,6 +25,7 @@ using std::endl; Languages languages; +Language const * english_language; Language const * default_language; Language ignore_lang("ignore", "ignore", "Ignore", false, 0, "ignore"); Language const * ignore_language = &ignore_lang; @@ -35,7 +36,7 @@ void Languages::setDefaults() false, encodings.getEncoding("iso8859-1"), "en"); - default_language = &languagelist["english"]; + english_language = default_language = &languagelist["english"]; } void Languages::read(string const & filename) @@ -87,6 +88,9 @@ void Languages::read(string const & filename) lyxerr << "Using \"" << default_language->lang() << "\" instead!" << endl; } + english_language = getLanguage("english"); + if (!english_language) + english_language = default_language; } Language const * Languages::getLanguage(string const & language) const diff --git a/src/language.h b/src/language.h index 8124285382..e009d88703 100644 --- a/src/language.h +++ b/src/language.h @@ -101,6 +101,7 @@ private: extern Languages languages; extern Language const * default_language; +extern Language const * english_language; extern Language const *ignore_language; #endif diff --git a/src/lyxrc.C b/src/lyxrc.C index 2f71cef68f..58d2c92bc2 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -46,193 +46,98 @@ extern LyXAction lyxaction; extern kb_keymap * toplevel_keymap; -enum LyXRCTags { - RC_FONT_ENCODING = 1, - RC_PRINTER, - RC_PRINT_COMMAND, - RC_PRINTEVENPAGEFLAG, - RC_PRINTODDPAGEFLAG, - RC_PRINTPAGERANGEFLAG, - RC_PRINTCOPIESFLAG, - RC_PRINTCOLLCOPIESFLAG, - RC_PRINTREVERSEFLAG, - RC_PRINTLANDSCAPEFLAG, - RC_PRINTTOPRINTER, - RC_PRINT_ADAPTOUTPUT, - RC_PRINTTOFILE, - RC_PRINTFILEEXTENSION, - RC_PRINTEXSTRAOPTIONS, - RC_PRINTSPOOL_COMMAND, - RC_PRINTSPOOL_PRINTERPREFIX, - RC_PRINTPAPERFLAG, - RC_PRINTPAPERDIMENSIONFLAG, - RC_CUSTOM_EXPORT_COMMAND, - RC_CUSTOM_EXPORT_FORMAT, - RC_SCREEN_DPI, - RC_SCREEN_ZOOM, - RC_SCREEN_FONT_SIZES, - RC_SCREEN_FONT_ROMAN, - RC_SCREEN_FONT_SANS, - RC_SCREEN_FONT_TYPEWRITER, - RC_SCREEN_FONT_MENU, - RC_SCREEN_FONT_POPUP, - RC_SCREEN_FONT_ENCODING, - RC_SCREEN_FONT_ENCODING_MENU, - RC_SET_COLOR, - RC_AUTOSAVE, - RC_DOCUMENTPATH, - RC_TEMPLATEPATH, - RC_TEMPDIRPATH, - RC_USETEMPDIR, - RC_LASTFILES, - RC_AUTOREGIONDELETE, - RC_BIND, - RC_OVERRIDE_X_DEADKEYS, - RC_SERVERPIPE, - RC_INPUT, - RC_BINDFILE, - RC_UIFILE, - RC_KBMAP, - RC_KBMAP_PRIMARY, - RC_KBMAP_SECONDARY, - RC_FAX_COMMAND, - RC_PHONEBOOK, - RC_FAXPROGRAM, - RC_ASCIIROFF_COMMAND, - RC_ASCII_LINELEN, - RC_NUMLASTFILES, - RC_CHECKLASTFILES, - RC_VIEWDVI_PAPEROPTION, - RC_DEFAULT_PAPERSIZE, - RC_PS_COMMAND, - RC_ACCEPT_COMPOUND, - RC_SPELL_COMMAND, - RC_USE_INP_ENC, - RC_USE_ALT_LANG, - RC_USE_PERS_DICT, - RC_USE_ESC_CHARS, - RC_SCREEN_FONT_SCALABLE, - RC_ALT_LANG, - RC_PERS_DICT, - RC_ESC_CHARS, - RC_CHKTEX_COMMAND, - RC_CURSOR_FOLLOWS_SCROLLBAR, - RC_EXIT_CONFIRMATION, - RC_DISPLAY_SHORTCUTS, - RC_MAKE_BACKUP, - RC_BACKUPDIR_PATH, - RC_RTL_SUPPORT, - RC_AUTO_NUMBER, - RC_MARK_FOREIGN_LANGUAGE, - RC_LANGUAGE_PACKAGE, - RC_LANGUAGE_AUTO_BEGIN, - RC_LANGUAGE_AUTO_END, - RC_LANGUAGE_COMMAND_BEGIN, - RC_LANGUAGE_COMMAND_END, - RC_DATE_INSERT_FORMAT, - RC_SHOW_BANNER, - RC_WHEEL_JUMP, - RC_CONVERTER, - RC_VIEWER, - RC_FORMAT, - RC_NEW_ASK_FILENAME, - RC_DEFAULT_LANGUAGE, - RC_LAST -}; - - static keyword_item lyxrcTags[] = { - { "\\accept_compound", RC_ACCEPT_COMPOUND }, - { "\\alternate_language", RC_ALT_LANG }, - { "\\ascii_linelen", RC_ASCII_LINELEN }, - { "\\ascii_roff_command", RC_ASCIIROFF_COMMAND }, - { "\\auto_number", RC_AUTO_NUMBER }, - { "\\auto_region_delete", RC_AUTOREGIONDELETE }, - { "\\autosave", RC_AUTOSAVE }, - { "\\backupdir_path", RC_BACKUPDIR_PATH }, - { "\\bind", RC_BIND }, - { "\\bind_file", RC_BINDFILE }, - { "\\check_lastfiles", RC_CHECKLASTFILES }, - { "\\chktex_command", RC_CHKTEX_COMMAND }, - { "\\converter", RC_CONVERTER }, - { "\\cursor_follows_scrollbar", RC_CURSOR_FOLLOWS_SCROLLBAR }, - { "\\custom_export_command", RC_CUSTOM_EXPORT_COMMAND }, - { "\\custom_export_format", RC_CUSTOM_EXPORT_FORMAT }, - { "\\date_insert_format", RC_DATE_INSERT_FORMAT }, - { "\\default_language", RC_DEFAULT_LANGUAGE }, - { "\\default_papersize", RC_DEFAULT_PAPERSIZE }, - { "\\display_shortcuts", RC_DISPLAY_SHORTCUTS }, - { "\\document_path", RC_DOCUMENTPATH }, - { "\\escape_chars", RC_ESC_CHARS }, - { "\\exit_confirmation", RC_EXIT_CONFIRMATION }, - { "\\fax_command", RC_FAX_COMMAND }, - { "\\fax_program", RC_FAXPROGRAM }, - { "\\font_encoding", RC_FONT_ENCODING }, - { "\\format", RC_FORMAT }, - { "\\input", RC_INPUT }, - { "\\kbmap", RC_KBMAP }, - { "\\kbmap_primary", RC_KBMAP_PRIMARY }, - { "\\kbmap_secondary", RC_KBMAP_SECONDARY }, - { "\\language_auto_begin", RC_LANGUAGE_AUTO_BEGIN }, - { "\\language_auto_end", RC_LANGUAGE_AUTO_END }, - { "\\language_command_begin", RC_LANGUAGE_COMMAND_BEGIN }, - { "\\language_command_end", RC_LANGUAGE_COMMAND_END }, - { "\\language_package", RC_LANGUAGE_PACKAGE }, - { "\\lastfiles", RC_LASTFILES }, - { "\\make_backup", RC_MAKE_BACKUP }, - { "\\mark_foreign_language", RC_MARK_FOREIGN_LANGUAGE }, - { "\\new_ask_filename", RC_NEW_ASK_FILENAME }, - { "\\num_lastfiles", RC_NUMLASTFILES }, - { "\\override_x_deadkeys", RC_OVERRIDE_X_DEADKEYS }, - { "\\personal_dictionary", RC_PERS_DICT }, - { "\\phone_book", RC_PHONEBOOK }, - { "\\print_adapt_output", RC_PRINT_ADAPTOUTPUT }, - { "\\print_collcopies_flag", RC_PRINTCOLLCOPIESFLAG }, - { "\\print_command", RC_PRINT_COMMAND }, - { "\\print_copies_flag", RC_PRINTCOPIESFLAG }, - { "\\print_evenpage_flag", RC_PRINTEVENPAGEFLAG }, - { "\\print_extra_options", RC_PRINTEXSTRAOPTIONS }, - { "\\print_file_extension", RC_PRINTFILEEXTENSION }, - { "\\print_landscape_flag", RC_PRINTLANDSCAPEFLAG }, - { "\\print_oddpage_flag", RC_PRINTODDPAGEFLAG }, - { "\\print_pagerange_flag", RC_PRINTPAGERANGEFLAG }, - { "\\print_paper_dimension_flag", RC_PRINTPAPERDIMENSIONFLAG }, - { "\\print_paper_flag", RC_PRINTPAPERFLAG }, - { "\\print_reverse_flag", RC_PRINTREVERSEFLAG }, - { "\\print_spool_command", RC_PRINTSPOOL_COMMAND }, - { "\\print_spool_printerprefix", RC_PRINTSPOOL_PRINTERPREFIX }, - { "\\print_to_file", RC_PRINTTOFILE }, - { "\\print_to_printer", RC_PRINTTOPRINTER }, - { "\\printer", RC_PRINTER }, - { "\\ps_command", RC_PS_COMMAND }, - { "\\rtl", RC_RTL_SUPPORT }, - { "\\screen_dpi", RC_SCREEN_DPI }, - { "\\screen_font_encoding", RC_SCREEN_FONT_ENCODING }, - { "\\screen_font_encoding_menu", RC_SCREEN_FONT_ENCODING_MENU }, - { "\\screen_font_menu", RC_SCREEN_FONT_MENU }, - { "\\screen_font_popup", RC_SCREEN_FONT_POPUP }, - { "\\screen_font_roman", RC_SCREEN_FONT_ROMAN }, - { "\\screen_font_sans", RC_SCREEN_FONT_SANS }, - { "\\screen_font_scalable", RC_SCREEN_FONT_SCALABLE }, - { "\\screen_font_sizes", RC_SCREEN_FONT_SIZES }, - { "\\screen_font_typewriter", RC_SCREEN_FONT_TYPEWRITER }, - { "\\screen_zoom", RC_SCREEN_ZOOM }, - { "\\serverpipe", RC_SERVERPIPE }, - { "\\set_color", RC_SET_COLOR }, - { "\\show_banner", RC_SHOW_BANNER }, - { "\\spell_command", RC_SPELL_COMMAND }, - { "\\tempdir_path", RC_TEMPDIRPATH }, - { "\\template_path", RC_TEMPLATEPATH }, - { "\\ui_file", RC_UIFILE }, - { "\\use_alt_language", RC_USE_ALT_LANG }, - { "\\use_escape_chars", RC_USE_ESC_CHARS }, - { "\\use_input_encoding", RC_USE_INP_ENC }, - { "\\use_personal_dictionary", RC_USE_PERS_DICT }, - { "\\use_tempdir", RC_USETEMPDIR }, - { "\\view_dvi_paper_option", RC_VIEWDVI_PAPEROPTION }, - { "\\viewer" ,RC_VIEWER}, - { "\\wheel_jump", RC_WHEEL_JUMP } + { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND }, + { "\\alternate_language", LyXRC::RC_ALT_LANG }, + { "\\ascii_linelen", LyXRC::RC_ASCII_LINELEN }, + { "\\ascii_roff_command", LyXRC::RC_ASCIIROFF_COMMAND }, + { "\\auto_number", LyXRC::RC_AUTO_NUMBER }, + { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE }, + { "\\autosave", LyXRC::RC_AUTOSAVE }, + { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH }, + { "\\bind", LyXRC::RC_BIND }, + { "\\bind_file", LyXRC::RC_BINDFILE }, + { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES }, + { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND }, + { "\\converter", LyXRC::RC_CONVERTER }, + { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR }, + { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND }, + { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT }, + { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT }, + { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE }, + { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE }, + { "\\display_shortcuts", LyXRC::RC_DISPLAY_SHORTCUTS }, + { "\\document_path", LyXRC::RC_DOCUMENTPATH }, + { "\\escape_chars", LyXRC::RC_ESC_CHARS }, + { "\\exit_confirmation", LyXRC::RC_EXIT_CONFIRMATION }, + { "\\fax_command", LyXRC::RC_FAX_COMMAND }, + { "\\fax_program", LyXRC::RC_FAXPROGRAM }, + { "\\font_encoding", LyXRC::RC_FONT_ENCODING }, + { "\\format", LyXRC::RC_FORMAT }, + { "\\input", LyXRC::RC_INPUT }, + { "\\kbmap", LyXRC::RC_KBMAP }, + { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY }, + { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY }, + { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN }, + { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END }, + { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN }, + { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END }, + { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE }, + { "\\lastfiles", LyXRC::RC_LASTFILES }, + { "\\make_backup", LyXRC::RC_MAKE_BACKUP }, + { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE }, + { "\\new_ask_filename", LyXRC::RC_NEW_ASK_FILENAME }, + { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES }, + { "\\override_x_deadkeys", LyXRC::RC_OVERRIDE_X_DEADKEYS }, + { "\\personal_dictionary", LyXRC::RC_PERS_DICT }, + { "\\phone_book", LyXRC::RC_PHONEBOOK }, + { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT }, + { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG }, + { "\\print_command", LyXRC::RC_PRINT_COMMAND }, + { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG }, + { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG }, + { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS }, + { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION }, + { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG }, + { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG }, + { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG }, + { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG }, + { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG }, + { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG }, + { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND }, + { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX }, + { "\\print_to_file", LyXRC::RC_PRINTTOFILE }, + { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER }, + { "\\printer", LyXRC::RC_PRINTER }, + { "\\ps_command", LyXRC::RC_PS_COMMAND }, + { "\\rtl", LyXRC::RC_RTL_SUPPORT }, + { "\\screen_dpi", LyXRC::RC_SCREEN_DPI }, + { "\\screen_font_encoding", LyXRC::RC_SCREEN_FONT_ENCODING }, + { "\\screen_font_encoding_menu", LyXRC::RC_SCREEN_FONT_ENCODING_MENU }, + { "\\screen_font_menu", LyXRC::RC_SCREEN_FONT_MENU }, + { "\\screen_font_popup", LyXRC::RC_SCREEN_FONT_POPUP }, + { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN }, + { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS }, + { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE }, + { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES }, + { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER }, + { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM }, + { "\\serverpipe", LyXRC::RC_SERVERPIPE }, + { "\\set_color", LyXRC::RC_SET_COLOR }, + { "\\show_banner", LyXRC::RC_SHOW_BANNER }, + { "\\spell_command", LyXRC::RC_SPELL_COMMAND }, + { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH }, + { "\\template_path", LyXRC::RC_TEMPLATEPATH }, + { "\\ui_file", LyXRC::RC_UIFILE }, + { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG }, + { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS }, + { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC }, + { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT }, + { "\\use_tempdir", LyXRC::RC_USETEMPDIR }, + { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION }, + { "\\viewer" ,LyXRC::RC_VIEWER}, + { "\\wheel_jump", LyXRC::RC_WHEEL_JUMP } }; /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */ @@ -1569,12 +1474,315 @@ void LyXRC::set_font_norm_type() { if (font_norm == "iso10646-1") font_norm_type = ISO_10646_1; + else if (font_norm == "iso8859-1") + font_norm_type = ISO_8859_1; else if (font_norm == "iso8859-6.8x") font_norm_type = ISO_8859_6_8; + else if (font_norm == "iso8859-9") + font_norm_type = ISO_8859_9; else font_norm_type = OTHER_ENCODING; } +string LyXRC::getFeedback(LyXRCTags tag) +{ + string str; + + switch( tag ) { + case RC_FONT_ENCODING: + str = N_("The font encoding used for the LaTeX2e fontenc package.\nT1 is highly recommended for non-English languages."); + break; + + case RC_PRINTER: + str = N_("The default printer to print on. If none is specified, LyX will\nuse the environment variable PRINTER."); + break; + + case RC_PRINT_COMMAND: + str = N_("Your favorite print program, eg \"dvips\", \"dvilj4\""); + break; + + case RC_PRINTEVENPAGEFLAG: + case RC_PRINTODDPAGEFLAG: + case RC_PRINTPAGERANGEFLAG: + case RC_PRINTCOPIESFLAG: + case RC_PRINTCOLLCOPIESFLAG: + case RC_PRINTREVERSEFLAG: + case RC_PRINTLANDSCAPEFLAG: + case RC_PRINTPAPERFLAG: + case RC_PRINTPAPERDIMENSIONFLAG: + str = N_("Look at the man page for your favorite print program to learn\nwhich options to use."); + break; + + case RC_PRINTTOPRINTER: + str = N_("Option to pass to the print program to print on a specific printer."); + break; + + case RC_PRINT_ADAPTOUTPUT: + str = N_("Set to true for LyX to pass the name of the destination printer to your\nprint command."); + break; + + case RC_PRINTTOFILE: + str = N_("Option to pass to the print program to print to a file."); + break; + + case RC_PRINTFILEEXTENSION: + str = N_("Extension of printer program output file. Usually .ps"); + break; + + case RC_PRINTEXSTRAOPTIONS: + str = N_("Extra options to pass to printing program after everything else,\nbut before the filename of the DVI file to be printed."); + break; + + case RC_PRINTSPOOL_COMMAND: + str = N_("When set, this printer option automatically prints to a file and then calls\na separate print spooling program on that file with the given name\nand arguments."); + break; + + case RC_PRINTSPOOL_PRINTERPREFIX: + str = N_("If you specify a printer name in the print dialog, the following argument\nis prepended along with the printer name after the spool command."); + break; + + case RC_SCREEN_DPI: + str = N_("DPI (dots per inch) of your monitor is auto-detected by LyX.\nIf that goes wrong, override the setting here."); + break; + + case RC_SCREEN_ZOOM: + str = N_("The zoom percentage for screen fonts.\nA setting of 100% will make the fonts roughly the same size as on paper."); + break; + + case RC_SCREEN_FONT_SIZES: + str = N_("The font sizes used for calculating the scaling of the screen fonts."); + break; + + case RC_SCREEN_FONT_ROMAN: + case RC_SCREEN_FONT_SANS: + case RC_SCREEN_FONT_TYPEWRITER: + str = N_("The screen fonts used to display the text while editing."); + break; + + case RC_SCREEN_FONT_MENU: + str = N_("The font for menus (and groups titles in popups)."); + break; + + case RC_SCREEN_FONT_POPUP: + str = N_("The font for popups."); + break; + + case RC_SCREEN_FONT_ENCODING: + str = N_("The norm for the screen fonts."); + break; + + case RC_SCREEN_FONT_ENCODING_MENU: + str = N_("The norm for the menu/popups fonts."); + break; + + case RC_SET_COLOR: + break; + + case RC_AUTOSAVE: + str = N_("The time interval between auto-saves (in seconds).\n0 means no auto-save"); + break; + + case RC_DOCUMENTPATH: + str = N_("The default path for your documents."); + break; + + case RC_TEMPLATEPATH: + str = N_("The path that LyX will set when offering to choose a template."); + break; + + case RC_TEMPDIRPATH: + str = N_("The path that LyX will use to store temporary TeX output."); + break; + + case RC_USETEMPDIR: + str = N_("Specify to use a temporary directory to store temporary TeX output.\nThis directory is deleted when you quit LyX."); + break; + + case RC_LASTFILES: + str = N_("The file where the last-files information should be stored."); + break; + + case RC_AUTOREGIONDELETE: + str = N_("Set to false if you don't want the current selection to be replaced\nautomatically by what you type."); + break; + + case RC_OVERRIDE_X_DEADKEYS: + str = N_("Set to true for LyX to take over the handling of the dead keys\n(a.k.a accent keys) that may be defined for your keyboard."); + break; + + + case RC_SERVERPIPE: + str = N_("This starts the lyxserver. The pipes get an additional extension\n\".in\" and \".out\". Only for advanced users."); + break; + + case RC_BINDFILE: + str = N_("Keybindings file. Can either specify an absolute path,\nor LyX will look in its global and local bind/ directories."); + break; + + case RC_UIFILE: + str = N_("The UI (user interface) file. Can either specify an absolute path,\nor LyX will look in its global and local ui/ directories."); + break; + + case RC_KBMAP: + case RC_KBMAP_PRIMARY: + case RC_KBMAP_SECONDARY: + str = N_("Use this to set the correct mapping file for your keyboard.\nYou'll need this if you for instance want to type German documents\non an American keyboard."); + break; + + case RC_FAX_COMMAND: + break; + + case RC_PHONEBOOK: + break; + + case RC_FAXPROGRAM: + break; + + case RC_ASCIIROFF_COMMAND: + str = N_("Use to define an external program to render tables in the ASCII output.\nE.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file.\nIf \"none\" is specified, an internal routine is used."); + break; + + case RC_ASCII_LINELEN: + str = N_("This is the maximum line length of an exported ASCII file\n(LaTeX, SGML or plain text)."); + break; + + case RC_NUMLASTFILES: + str = N_("Maximal number of lastfiles. Up to 9 can appear in the file menu."); + break; + + case RC_CHECKLASTFILES: + str = N_("Specify to check whether the lastfiles still exist."); + break; + + case RC_VIEWDVI_PAPEROPTION: + break; + + case RC_DEFAULT_PAPERSIZE: + str = N_("Specify the default paper size."); + break; + + case RC_PS_COMMAND: + break; + + case RC_ACCEPT_COMPOUND: + str = N_("Consider run-together words, such as \"notthe\" for \"not the\",\nas legal words?"); + break; + + case RC_SPELL_COMMAND: + str = N_("What command runs the spell checker?"); + break; + + case RC_USE_INP_ENC: + str = N_("Specify whether to pass the -T input encoding option to ispell.\nEnable this if you can't spellcheck words with international letters\nin them.\nThis may not work with all dictionaries."); + break; + + case RC_USE_ALT_LANG: + case RC_ALT_LANG: + str = N_("Specify an alternate language.\nThe default is to use the language of the document."); + break; + + case RC_USE_PERS_DICT: + case RC_PERS_DICT: + str = N_("Specify an alternate personal dictionary file.\nE.g. \".ispell_english\"."); + break; + + case RC_USE_ESC_CHARS: + case RC_ESC_CHARS: + str = N_("Specify additional chars that can be part of a word."); + break; + + case RC_SCREEN_FONT_SCALABLE: + str = N_("Allow the use of scalable screen fonts? If false, LyX will use the\nclosest existing size for a match. Use this if the scalable fonts\nlook bad and you have many fixed size fonts."); + break; + + case RC_CHKTEX_COMMAND: + str = N_("Define how to run chktex.\nE.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\"\nRefer to the ChkTeX documentation."); + break; + + case RC_CURSOR_FOLLOWS_SCROLLBAR: + str = N_("LyX normally doesn't update the cursor position if you move the scrollbar.\nSet to true if you'd prefer to always have the cursor on screen."); + break; + + case RC_EXIT_CONFIRMATION: + str = N_("Sets whether LyX asks for a second confirmation to exit when you have\nchanged documents.\n(LyX will still ask to save changed documents.)"); + break; + + case RC_DISPLAY_SHORTCUTS: + str = N_("LyX continously displays names of last command executed,\nalong with a list of defined short-cuts for it in the minibuffer.\nSet to false if LyX seems slow."); + break; + + case RC_MAKE_BACKUP: + str = N_("Set to false if you don't want LyX to create backup files."); + break; + + case RC_BACKUPDIR_PATH: + str = N_("The path for storing backup files. If it is an empty string,\nLyX will store the backup file in the same directory as the original file."); + break; + + case RC_RTL_SUPPORT: + str = N_("Use to enable support of right-to-left languages (e.g. Hebrew, Arabic)."); + break; + + case RC_MARK_FOREIGN_LANGUAGE: + str = N_("Use to control the highlighting of words with a language foreign to\nthat of the document."); + break; + + case RC_LANGUAGE_PACKAGE: + str = N_("The latex command for loading the language package.\nE.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\"."); + break; + + case RC_LANGUAGE_AUTO_BEGIN: + str = N_("Use if a language switching command is needed at the beginning\nof the document."); + break; + + case RC_LANGUAGE_AUTO_END: + str = N_("Use if a language switching command is needed at the end\nof the document."); + break; + + case RC_LANGUAGE_COMMAND_BEGIN: + str = N_("The latex command for changing from the language of the document\nto another language.\nE.g. \\selectlanguage{$$lang} where $$lang is substituted by the name\nof the second language."); + break; + + case RC_LANGUAGE_COMMAND_END: + str = N_("The latex command for changing back to the language of the document."); + break; + + case RC_DATE_INSERT_FORMAT: + str = N_("This accepts the normal strftime formats; see man strftime for full details.\nE.g.\"%A, %e. %B %Y\"."); + break; + + case RC_SHOW_BANNER: + str = N_("Set to false if you don't want the startup banner."); + break; + + case RC_WHEEL_JUMP: + str = N_("The wheel movement factor (for mice with wheels or five button mice)"); + break; + + case RC_CONVERTER: + break; + + case RC_VIEWER: + break; + + case RC_FORMAT: + break; + + case RC_NEW_ASK_FILENAME: + str = N_("This sets the behaviour if you want to be asked for a filename when\ncreating a new document or wait until you save it and be asked then."); + break; + + case RC_DEFAULT_LANGUAGE: + str = N_("New documents will be assigned this language."); + break; + + default: + break; + } + + return str; +} + // The global instance LyXRC lyxrc; diff --git a/src/lyxrc.h b/src/lyxrc.h index b6065dcb10..5e547d2d5b 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -25,6 +25,101 @@ class LyXRC //: public noncopyable { // noncopyable again. For now I want to minimise changes. ARRae 20001010 { public: +enum LyXRCTags { + RC_FONT_ENCODING = 1, + RC_PRINTER, + RC_PRINT_COMMAND, + RC_PRINTEVENPAGEFLAG, + RC_PRINTODDPAGEFLAG, + RC_PRINTPAGERANGEFLAG, + RC_PRINTCOPIESFLAG, + RC_PRINTCOLLCOPIESFLAG, + RC_PRINTREVERSEFLAG, + RC_PRINTLANDSCAPEFLAG, + RC_PRINTTOPRINTER, + RC_PRINT_ADAPTOUTPUT, + RC_PRINTTOFILE, + RC_PRINTFILEEXTENSION, + RC_PRINTEXSTRAOPTIONS, + RC_PRINTSPOOL_COMMAND, + RC_PRINTSPOOL_PRINTERPREFIX, + RC_PRINTPAPERFLAG, + RC_PRINTPAPERDIMENSIONFLAG, + RC_CUSTOM_EXPORT_COMMAND, + RC_CUSTOM_EXPORT_FORMAT, + RC_SCREEN_DPI, + RC_SCREEN_ZOOM, + RC_SCREEN_FONT_SIZES, + RC_SCREEN_FONT_ROMAN, + RC_SCREEN_FONT_SANS, + RC_SCREEN_FONT_TYPEWRITER, + RC_SCREEN_FONT_MENU, + RC_SCREEN_FONT_POPUP, + RC_SCREEN_FONT_ENCODING, + RC_SCREEN_FONT_ENCODING_MENU, + RC_SET_COLOR, + RC_AUTOSAVE, + RC_DOCUMENTPATH, + RC_TEMPLATEPATH, + RC_TEMPDIRPATH, + RC_USETEMPDIR, + RC_LASTFILES, + RC_AUTOREGIONDELETE, + RC_BIND, + RC_OVERRIDE_X_DEADKEYS, + RC_SERVERPIPE, + RC_INPUT, + RC_BINDFILE, + RC_UIFILE, + RC_KBMAP, + RC_KBMAP_PRIMARY, + RC_KBMAP_SECONDARY, + RC_FAX_COMMAND, + RC_PHONEBOOK, + RC_FAXPROGRAM, + RC_ASCIIROFF_COMMAND, + RC_ASCII_LINELEN, + RC_NUMLASTFILES, + RC_CHECKLASTFILES, + RC_VIEWDVI_PAPEROPTION, + RC_DEFAULT_PAPERSIZE, + RC_PS_COMMAND, + RC_ACCEPT_COMPOUND, + RC_SPELL_COMMAND, + RC_USE_INP_ENC, + RC_USE_ALT_LANG, + RC_USE_PERS_DICT, + RC_USE_ESC_CHARS, + RC_SCREEN_FONT_SCALABLE, + RC_ALT_LANG, + RC_PERS_DICT, + RC_ESC_CHARS, + RC_CHKTEX_COMMAND, + RC_CURSOR_FOLLOWS_SCROLLBAR, + RC_EXIT_CONFIRMATION, + RC_DISPLAY_SHORTCUTS, + RC_MAKE_BACKUP, + RC_BACKUPDIR_PATH, + RC_RTL_SUPPORT, + RC_AUTO_NUMBER, + RC_MARK_FOREIGN_LANGUAGE, + RC_LANGUAGE_PACKAGE, + RC_LANGUAGE_AUTO_BEGIN, + RC_LANGUAGE_AUTO_END, + RC_LANGUAGE_COMMAND_BEGIN, + RC_LANGUAGE_COMMAND_END, + RC_DATE_INSERT_FORMAT, + RC_SHOW_BANNER, + RC_WHEEL_JUMP, + RC_CONVERTER, + RC_VIEWER, + RC_FORMAT, + RC_NEW_ASK_FILENAME, + RC_DEFAULT_LANGUAGE, + RC_LAST +}; + + /// LyXRC(); /// @@ -42,6 +137,8 @@ public: /// int ReadBindFile(string const & name = "cua"); /// + static string getFeedback( LyXRCTags ); + /// string bind_file; /// string ui_file; @@ -146,8 +243,12 @@ public: /// ISO_10646_1, /// + ISO_8859_1, + /// ISO_8859_6_8, /// + ISO_8859_9, + /// OTHER_ENCODING }; /// diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 963a5779fd..9541cd0cbc 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -86,7 +86,15 @@ string const tostr(bool const & b) { return (b ? "true" : "false"); } - + +/// +template<> +inline +string const tostr(string const & s) +{ + return s; +} + /// Does the string start with this prefix? bool prefixIs(string const &, char const *); diff --git a/src/tabular.C b/src/tabular.C index 3acf0117d9..4dee6913c4 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -148,14 +148,12 @@ LyXTabular * LyXTabular::Clone(InsetTabular * inset) /* activates all lines and sets all widths to 0 */ void LyXTabular::Init(int rows_arg, int columns_arg) { - rows_ = rows_arg; columns_ = columns_arg; row_info = row_vector(rows_, rowstruct()); column_info = column_vector(columns_, columnstruct()); cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct())); - // Jürgen, use iterators. int cellno = 0; for (int i = 0; i < rows_; ++i) { for (int j = 0; j < columns_; ++j) { @@ -163,17 +161,14 @@ void LyXTabular::Init(int rows_arg, int columns_arg) cell_info[i][j].inset.SetDrawFrame(0, InsetText::LOCKED); cell_info[i][j].cellno = cellno++; } - cell_info[i][columns_-1].right_line = true; + cell_info[i].back().right_line = true; } - //row_info[i - 1].bottom_line = true; - //row_info[0].bottom_line = true; row_info.back().bottom_line = true; row_info.front().bottom_line = true; for (int i = 0; i < columns_; ++i) { calculate_width_of_column(i); } - //column_info[columns_ - 1].right_line = true; column_info.back().right_line = true; calculate_width_of_tabular(); @@ -246,7 +241,7 @@ void LyXTabular::AppendColumn(int cell) cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_, cellstruct())); - int column = column_of_cell(cell); + int const column = column_of_cell(cell); column_vector::iterator cit = column_info.begin() + column + 1; column_info.insert(cit, columnstruct()); @@ -267,9 +262,10 @@ void LyXTabular::AppendColumn(int cell) } } cell_info = c_info; - ++column; + //++column; for (int i = 0; i < rows_; ++i) { - cell_info[i][column].inset.clear(); + //cell_info[i][column].inset.clear(); + cell_info[i][column + 1].inset.clear(); } Reinit(); } @@ -293,7 +289,6 @@ void LyXTabular::DeleteColumn(int column) void LyXTabular::Reinit() { - // Jürgen, use iterators. for (int i = 0; i < rows_; ++i) { for (int j = 0; j < columns_; ++j) { cell_info[i][j].width_of_cell = 0; @@ -312,12 +307,12 @@ void LyXTabular::Reinit() void LyXTabular::set_row_column_number_info(bool oldformat) { - int c = 0; - int column = 0; + //int c = 0; + //int column = 0; numberofcells = -1; - int row = 0; - for (; row < rows_; ++row) { - for (column = 0; column 0 int width = (new_width + 2 * WIDTH_OF_LINE); - for (i = column1; - i < column2 && width > column_info[i].width_of_column; - ++i) { + + int i = column1; + for (; i < column2 && width > column_info[i].width_of_column; ++i) { cell_info[row][i].width_of_cell = column_info[i].width_of_column; width -= column_info[i].width_of_column; } @@ -738,7 +753,8 @@ LyXAlignment LyXTabular::GetAlignment(int cell, bool onlycolumn) const } -LyXTabular::VAlignment LyXTabular::GetVAlignment(int cell, bool onlycolumn) const +LyXTabular::VAlignment +LyXTabular::GetVAlignment(int cell, bool onlycolumn) const { if (!onlycolumn && IsMultiColumn(cell)) return cellinfo_of_cell(cell)->valignment; @@ -883,7 +899,7 @@ void LyXTabular::calculate_width_of_tabular() int LyXTabular::row_of_cell(int cell) const { if (cell >= numberofcells) - return rows_-1; + return rows_ - 1; else if (cell < 0) return 0; return rowofcell[cell]; @@ -893,7 +909,7 @@ int LyXTabular::row_of_cell(int cell) const int LyXTabular::column_of_cell(int cell) const { if (cell >= numberofcells) - return columns_-1; + return columns_ - 1; else if (cell < 0) return 0; return columnofcell[cell]; @@ -905,82 +921,102 @@ int LyXTabular::right_column_of_cell(int cell) const int const row = row_of_cell(cell); int column = column_of_cell(cell); while (column < (columns_ - 1) && - cell_info[row][column+1].multicolumn == LyXTabular::CELL_PART_OF_MULTICOLUMN) + cell_info[row][column + 1].multicolumn == LyXTabular::CELL_PART_OF_MULTICOLUMN) ++column; return column; } -const string write_attribute(const string name, const int value) +// Perfect case for a template... (Lgb) +#if 1 +template +string const write_attribute(string const & name, T const & t) +{ + string str = " " + name + "=\"" + tostr(t) + "\""; + return str; +} + +template <> +string const write_attribute(string const & name, bool const & b) +{ + return write_attribute(name, int(b)); +} + +#else + +string const write_attribute(string const & name, int value) { string str = " " + name + "=\"" + tostr(value) + "\""; return str; } -const string write_attribute(string name, const string & value) +string const write_attribute(string const & name, string const & value) { string str = " " + name + "=\"" + value + "\""; return str; } -const string write_attribute(string name, const bool value) +string const write_attribute(string const & name, bool value) { string str = " " + name + "=\"" + tostr((int)value) + "\""; return str; } +#endif void LyXTabular::Write(Buffer const * buf, ostream & os) const { // header line - os << "\n"; + os << "\n"; // global longtable options - os << "\n\n"; + os << "\n\n"; for (int i = 0; i < rows_; ++i) { - os << "\n"; + os << "\n"; for (int j = 0; j < columns_; ++j) { if (!i) { - os << "\n"; + os << "\n"; } else { os << "\n"; } - os << "\n"; + os << "\n"; os << "\\begin_inset "; cell_info[i][j].inset.Write(buf, os); os << "\n\\end_inset \n" @@ -994,21 +1030,21 @@ void LyXTabular::Write(Buffer const * buf, ostream & os) const static -bool getTokenValue(string const str, const char * token, string & ret) +bool getTokenValue(string const & str, const char * token, string & ret) { - int pos = str.find(token); - char ch = str[pos+strlen(token)]; + string::size_type pos = str.find(token); + char ch = str[pos + strlen(token)]; - if ((pos < 0) || (ch != '=')) + if ((pos == string::npos) || (ch != '=')) return false; ret.erase(); - pos += strlen(token)+1; + pos += strlen(token) + 1; ch = str[pos]; if ((ch != '"') && (ch != '\'')) { // only read till next space ret += ch; ch = ' '; } - while((pos < int(str.length()-1)) && (str[++pos] != ch)) + while((pos < str.length() - 1) && (str[++pos] != ch)) ret += str[pos]; return true; @@ -1016,16 +1052,15 @@ bool getTokenValue(string const str, const char * token, string & ret) static -bool getTokenValue(string const str, const char * token, int & num) +bool getTokenValue(string const & str, const char * token, int & num) { - int pos = str.find(token); - char ch = str[pos+strlen(token)]; + string::size_type pos = str.find(token); + char ch = str[pos + strlen(token)]; - if ((pos < 0) || (ch != '=')) + if ((pos == string::npos) || (ch != '=')) return false; string ret; - //ret.erase(); // why? (Lgb) - pos += strlen(token)+1; + pos += strlen(token) + 1; ch = str[pos]; if ((ch != '"') && (ch != '\'')) { // only read till next space if (!isdigit(ch)) @@ -1033,7 +1068,7 @@ bool getTokenValue(string const str, const char * token, int & num) ret += ch; } ++pos; - while((pos < int(str.length()-1)) && isdigit(str[pos])) + while((pos < str.length() - 1) && isdigit(str[pos])) ret += str[pos++]; num = strToInt(ret); @@ -1042,28 +1077,28 @@ bool getTokenValue(string const str, const char * token, int & num) static -bool getTokenValue(string const str, const char * token, LyXAlignment & num) +bool getTokenValue(string const & str, const char * token, LyXAlignment & num) { int tmp; - bool ret = getTokenValue(str, token, tmp); + bool const ret = getTokenValue(str, token, tmp); num = static_cast(tmp); return ret; } static -bool getTokenValue(string const str, const char * token, +bool getTokenValue(string const & str, const char * token, LyXTabular::VAlignment & num) { int tmp; - bool ret = getTokenValue(str, token, tmp); + bool const ret = getTokenValue(str, token, tmp); num = static_cast(tmp); return ret; } static -bool getTokenValue(string const str, const char * token, +bool getTokenValue(string const & str, const char * token, LyXTabular::BoxType & num) { int tmp; @@ -1074,16 +1109,15 @@ bool getTokenValue(string const str, const char * token, static -bool getTokenValue(string const str, const char * token, bool & flag) +bool getTokenValue(string const & str, const char * token, bool & flag) { - int pos = str.find(token); - char ch = str[pos+strlen(token)]; + string::size_type pos = str.find(token); + char ch = str[pos + strlen(token)]; - if ((pos < 0) || (ch != '=')) + if ((pos == string::npos) || (ch != '=')) return false; string ret; - //ret.erase(); // Why? (Lgb) - pos += strlen(token)+1; + pos += strlen(token) + 1; ch = str[pos]; if ((ch != '"') && (ch != '\'')) { // only read till next space if (!isdigit(ch)) @@ -1091,7 +1125,7 @@ bool getTokenValue(string const str, const char * token, bool & flag) ret += ch; } ++pos; - while((pos < int(str.length()-1)) && isdigit(str[pos])) + while((pos < str.length() - 1) && isdigit(str[pos])) ret += str[pos++]; flag = strToInt(ret); @@ -1140,8 +1174,8 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex) getTokenValue(line, "endfirsthead", endfirsthead); getTokenValue(line, "endfoot", endfoot); getTokenValue(line, "endlastfoot", endlastfoot); - int i, j; - for(i = 0; i < rows_; ++i) { + + for(int i = 0; i < rows_; ++i) { l_getline(is, line); if (!prefixIs(line, " got" << @@ -1151,7 +1185,7 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex) getTokenValue(line, "topline", row_info[i].top_line); getTokenValue(line, "bottomline", row_info[i].bottom_line); getTokenValue(line, "newpage", row_info[i].newpage); - for (j = 0; j < columns_; ++j) { + for (int j = 0; j < columns_; ++j) { l_getline(is,line); if (!prefixIs(line," got" << @@ -1923,7 +1957,7 @@ bool LyXTabular::IsPartOfMultiColumn(int row, int column) const { if ((row >= rows_) || (column >= columns_)) return false; - return (cell_info[row][column].multicolumn==CELL_PART_OF_MULTICOLUMN); + return (cell_info[row][column].multicolumn == CELL_PART_OF_MULTICOLUMN); } @@ -1952,7 +1986,7 @@ int LyXTabular::TeXTopHLine(ostream & os, int row) const } else { return 0; } - os << endl; + os << "\n"; return 1; } @@ -1982,7 +2016,7 @@ int LyXTabular::TeXBottomHLine(ostream & os, int row) const } else { return 0; } - os << endl; + os << "\n"; return 1; } @@ -1992,7 +2026,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const int ret = 0; if (GetRotateCell(cell)) { - os << "\\begin{sideways}" << endl; + os << "\\begin{sideways}\n"; ++ret; } if (IsMultiColumn(cell)) { @@ -2103,7 +2137,7 @@ int LyXTabular::Latex(Buffer const * buf, //+--------------------------------------------------------------------- if (rotate) { - os << "\\begin{sideways}" << endl; + os << "\\begin{sideways}\n"; ++ret; } if (is_long_tabular) @@ -2146,17 +2180,17 @@ int LyXTabular::Latex(Buffer const * buf, if (column_info[i].right_line) os << '|'; } - os << "}" << endl; + os << "}\n"; ++ret; //+--------------------------------------------------------------------- //+ the single row and columns (cells) + //+--------------------------------------------------------------------- - int bret; + //int bret; for(int i = 0; i < rows_; ++i) { ret += TeXTopHLine(os, i); - bret = ret; + int bret = ret; if (IsLongTabular()) { if ((endhead < 0) && (i == (abs(endhead)-1))) { os << "\\endhead\n"; @@ -2187,12 +2221,12 @@ int LyXTabular::Latex(Buffer const * buf, ret += GetCellInset(cell)->Latex(buf, os, fragile, fp); ret += TeXCellPostamble(os, cell); if (!IsLastCellInRow(cell)) { // not last cell in row - os << "&" << endl; + os << "&\n"; ++ret; } ++cell; } - os << "\\\\" << endl; + os << "\\\\\n"; ret += TeXBottomHLine(os, i); bret = ret; if (IsLongTabular()) { @@ -2241,14 +2275,13 @@ int LyXTabular::Latex(Buffer const * buf, int LyXTabular::DocBook(Buffer const * buf, ostream & os) const { int ret = 0; - int cell = 0; //+--------------------------------------------------------------------- //+ first the opening preamble + //+--------------------------------------------------------------------- os << "" << endl; + << "\" colsep=\"1\" rowsep=\"1\">\n"; for (int i = 0; i < columns_; ++i) { os << "" << endl; + os << "\"/>\n"; ++ret; } @@ -2271,11 +2304,12 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const //+ the single row and columns (cells) + //+--------------------------------------------------------------------- - os << "" << endl; + int cell = 0; + os << "\n"; for(int i = 0; i < rows_; ++i) { - os << "" << endl; + os << "\n"; for(int j = 0; j < columns_; ++j) { - if (IsPartOfMultiColumn(i,j)) + if (IsPartOfMultiColumn(i, j)) continue; os << ""; ++cell; } - os << "" << endl; + os << "\n"; } - os << "" << endl; + os << "\n"; //+--------------------------------------------------------------------- //+ the closing of the tabular + //+--------------------------------------------------------------------- @@ -2328,20 +2362,29 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const } -static void print_n_chars(ostream & os, unsigned char ch, int const n) +static +inline +void print_n_chars(ostream & os, unsigned char ch, int n) { - for(int i=0; i < n; ++i) - os << ch; +#if 0 + for(int i = 0; i < n; ++i) + os << ch; +#else + os << string(n, ch); +#endif } + int LyXTabular::AsciiTopHLine(ostream & os, int row, vector const & clen) const { int const fcell = GetFirstCellInRow(row); int const n = NumberOfCellsInRow(fcell) + fcell; - int len; - int column = 0; - unsigned char ch; + //int len; + //int column = 0; + //unsigned char ch; + +#if 0 int tmp = 0; for (int i = fcell; i < n; ++i) { @@ -2350,7 +2393,15 @@ int LyXTabular::AsciiTopHLine(ostream & os, int row, } if (!tmp) return 0; +#else + // Isn't this equivalent? (Lgb) + for (int i = fcell; i < n; ++i) { + if (TopLine(i)) + return 0; + } +#endif + unsigned char ch; for (int i = fcell; i < n; ++i) { if (TopLine(i)) { if (LeftLine(i)) @@ -2362,8 +2413,8 @@ int LyXTabular::AsciiTopHLine(ostream & os, int row, os << " "; ch = ' '; } - column = column_of_cell(i); - len = clen[column]; + int column = column_of_cell(i); + int len = clen[column]; while(IsPartOfMultiColumn(row, ++column)) len += clen[column] + 4; print_n_chars(os, ch, len); @@ -2386,9 +2437,10 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row, { int const fcell = GetFirstCellInRow(row); int const n = NumberOfCellsInRow(fcell) + fcell; - int len; - int column = 0; - unsigned char ch; + //int len; + //int column = 0; + //unsigned char ch; +#if 0 int tmp = 0; for (int i = fcell; i < n; ++i) { @@ -2397,7 +2449,14 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row, } if (!tmp) return 0; - +#else + // Isn't this equivalent? (Lgb) + for (int i = fcell; i < n; ++i) { + if (BottomLine(i)) + return 0; + } +#endif + unsigned char ch; for (int i = fcell; i < n; ++i) { if (BottomLine(i)) { if (LeftLine(i)) @@ -2409,8 +2468,8 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row, os << " "; ch = ' '; } - column = column_of_cell(i); - len = clen[column]; + int column = column_of_cell(i); + int len = clen[column]; while(IsPartOfMultiColumn(row, ++column)) len += clen[column] + 4; print_n_chars(os, ch, len); diff --git a/src/trans.C b/src/trans.C index c6417dd26a..bbf4c39200 100644 --- a/src/trans.C +++ b/src/trans.C @@ -48,8 +48,7 @@ string const DefaultTrans::process(char c, TransManager & k) Trans::Trans() { - int i = 0; - for(i = 0; i < TEX_MAX_ACCENT + 1; ++i) + for(int i = 0; i < TEX_MAX_ACCENT + 1; ++i) kmod_list_[i] = 0; } @@ -90,7 +89,6 @@ void Trans::FreeKeymap() { for(int i = 0; i < 256; ++i) if (!keymap_[i].empty()) { - //delete keymap_[i]; keymap_[i].erase(); } for(int i = 0; i < TEX_MAX_ACCENT + 1; ++i) @@ -114,7 +112,7 @@ string const & Trans::GetName() const } -enum _kmaptags { +enum kmaptags_ { KCOMB = 1, KMOD, KMAP, @@ -153,15 +151,31 @@ void Trans::AddDeadkey(tex_accent accent, string const & keys, } for(string::size_type i = 0; i < keys.length(); ++i) { +#if 0 string * temp = &keymap_[static_cast(keys[i])]; #warning this is not really clean we should find a cleaner way (Jug) - *temp = "xx"; /* this is needed for the being sure that the below - assignment is not assigned to a nullpointer - (if size of string = 0) + *temp = "xx"; /* this is needed for the being sure that + the below assignment is not assigned to + a nullpointer (if size of string = 0) */ (*temp)[0] = 0; - (*temp)[1] = accent; + (*temp)[1] = accent; +#else + string & temp = + keymap_[static_cast(keys[i])]; + if (!temp.empty()) { + temp[0] = 0; + temp[1] = accent; + } else { + // But the question remains: "Should we be allowed + // to change bindings, without unbinding first?" + // Lgb + lyxerr << "Hey... keymap_[xx] not empty." << endl; + temp.push_back(0); + temp.push_back(accent); + } +#endif } kmod_list_[accent]->exception_list = 0; }