From d46b4d4360ffb10a06ae0dcd508de8f42dc9affd Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 27 Oct 2000 10:04:51 +0000 Subject: [PATCH] Jose's DocBook tables patch; Angus latest preference patch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1169 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 30 + src/buffer.C | 2 +- src/buffer.h | 9 +- src/frontends/Dialogs.h | 2 - src/frontends/xforms/FormPreferences.C | 1754 +++++++++++------ src/frontends/xforms/FormPreferences.h | 131 +- src/frontends/xforms/FormRef.C | 11 +- src/frontends/xforms/FormRef.h | 2 +- src/frontends/xforms/form_preferences.C | 247 ++- src/frontends/xforms/form_preferences.h | 22 +- .../xforms/forms/form_preferences.fd | 238 ++- src/insets/insettabular.C | 4 +- src/insets/insettext.C | 16 + src/insets/insettext.h | 2 +- src/tabular.C | 90 + src/tabular.h | 2 + 16 files changed, 1760 insertions(+), 802 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d931e78f5..18b144a4bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2000-10-27 Angus Leeming + + * src/frontends/Dialogs.h: remove hideTabular signal as it is no + longer used. + + * src/frontends/xforms/FormRef.[Ch]: fix bug when setting the min + size. + + * src/frontends/xforms/FormPreferences.[Ch]: + * src/frontends/xforms/forms/form_preferences.fd: lots and lots! + Reorganised as modules based on tabs. Much easier to follow the + flow and to add new tabs. Added warning and feedback messages. + Added new tabs. + +2000-10-27 Jean-Marc Lasgouttes + + * src/tabular.h (DocBook): add std:: qualifier. + +2000-10-26 José Abílio Matos + + * src/buffer.h (SimpleDocBookOnePar): becomes public and const. + * src/buffer.C (SimpleDocBookOnePar): this method goes const. + + * insettabular.h + * insettabular.C (DocBook): uses the tabular methods to export + docbook + + * src/insets/insettext.h + * src/insets/insettext.C (DocBook): Implemented export for docbooc. + 2000-10-26 Lars Gullik Bjønnes * src/frontends/ButtonPolicies.h (operator<<): reinsert for State diff --git a/src/buffer.C b/src/buffer.C index 96dfea3bef..ff79a73d82 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -3260,7 +3260,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body) void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, LyXParagraph * par, int & desc_on, - int depth) + int depth) const { bool emph_flag = false; diff --git a/src/buffer.h b/src/buffer.h index ca1e2692be..3a6465b3b1 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -166,6 +166,11 @@ public: void latexParagraphs(std::ostream & os, LyXParagraph * par, LyXParagraph * endpar, TexRow & texrow) const; + /// + void SimpleDocBookOnePar(std::ostream &, string & extra, + LyXParagraph * par, int & desc_on, + int depth) const ; + /// int runChktex(); @@ -366,10 +371,6 @@ private: /// void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par, int desc_on, int depth); - /// - void SimpleDocBookOnePar(std::ostream &, string & extra, - LyXParagraph * par, int & desc_on, - int depth); /// LinuxDoc. void push_tag(std::ostream & os, string const & tag, diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 2e459d073a..b8efb4d323 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -127,8 +127,6 @@ public: /// Signal1 updateTabular; /// - Signal1 hideTabular; - /// Signal0 showTabularCreate; /// Signal1 showTOC; diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 38c53d57b3..a5fd2ca510 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -30,8 +30,9 @@ using SigC::slot; 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), - spellchecker_tab_(0), lnf_general_(0), screen_fonts_(0), - interface_(0), printer_(0), paths_(0), outputs_general_(0) + usage_tab_(0), colours_(0), interface_(0), language_(0), + lnf_misc_(0), outputs_misc_(0), paths_(0), printer_(0), + screen_fonts_(0), spellchecker_(0) { // let the dialog be shown // This is a permanent connection so we won't bother @@ -46,13 +47,39 @@ FormPreferences::~FormPreferences() delete look_n_feel_tab_; delete inputs_tab_; delete outputs_tab_; - delete spellchecker_tab_; - delete lnf_general_; - delete screen_fonts_; + delete usage_tab_; + delete colours_; delete interface_; - delete printer_; + delete language_; + delete lnf_misc_; + delete outputs_misc_; delete paths_; - delete outputs_general_; + delete printer_; + delete screen_fonts_; + delete spellchecker_; +} + + +FL_FORM * FormPreferences::form() const +{ + if (dialog_) return dialog_->form; + return 0; +} + + +void FormPreferences::ok() +{ + FormBase::ok(); + lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES); +} + + +void FormPreferences::restore() +{ + update(); +// if I add an error message line to the dialog it'll have to be controlled +// within input(). I don't need it yet so I'll leave it commented out. +// bc_.valid(input(0)); } @@ -87,94 +114,20 @@ void FormPreferences::build() // build the tab folders outputs_tab_ = build_outer_tab(); look_n_feel_tab_ = build_outer_tab(); - inputs_tab_ = build_outer_tab(); - spellchecker_tab_ = build_spellchecker(); + inputs_tab_ = build_outer_tab(); + usage_tab_ = build_outer_tab(); // build actual tabfolder contents // these will become nested tabfolders - screen_fonts_ = build_screen_fonts(); - interface_ = build_interface(); - lnf_general_ = build_lnf_general(); - printer_ = build_printer(); - paths_ = build_paths(); - outputs_general_ = build_outputs_general(); - - // setup the input returns - // Lnf_General tab - fl_set_counter_return(lnf_general_->counter_autosave, FL_RETURN_CHANGED); - fl_set_counter_return(lnf_general_->counter_wm_jump, FL_RETURN_CHANGED); - // Screen fonts - fl_set_input_return(screen_fonts_->input_roman, FL_RETURN_CHANGED); - fl_set_input_return(screen_fonts_->input_sans, FL_RETURN_CHANGED); - fl_set_input_return(screen_fonts_->input_typewriter, - FL_RETURN_CHANGED); - 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_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); - fl_set_input_return(screen_fonts_->input_small, FL_RETURN_CHANGED); - fl_set_input_return(screen_fonts_->input_normal, FL_RETURN_CHANGED); - fl_set_input_return(screen_fonts_->input_large, FL_RETURN_CHANGED); - fl_set_input_return(screen_fonts_->input_larger, FL_RETURN_CHANGED); - 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); - // interface - fl_set_input_return(interface_->input_popup_font, - FL_RETURN_CHANGED); - fl_set_input_return(interface_->input_menu_font, - FL_RETURN_CHANGED); - fl_set_input_return(interface_->input_popup_encoding, - FL_RETURN_CHANGED); - fl_set_input_return(interface_->input_bind_file, - FL_RETURN_CHANGED); - fl_set_input_return(interface_->input_ui_file, - FL_RETURN_CHANGED); - // printer - fl_set_input_return(printer_->input_command, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_page_range, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_copies, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_reverse, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_to_printer, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_file_extension, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_spool_command, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_paper_type, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_even_pages, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_odd_pages, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_collated, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_landscape, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_to_file, FL_RETURN_CHANGED); - fl_set_input_return(printer_->input_extra_options, FL_RETURN_CHANGED); - 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); - // paths - fl_set_input_return(paths_->input_default_path, FL_RETURN_CHANGED); - fl_set_input_return(paths_->input_template_path, FL_RETURN_CHANGED); - fl_set_input_return(paths_->input_temp_dir, FL_RETURN_CHANGED); - fl_set_input_return(paths_->input_lastfiles, FL_RETURN_CHANGED); - fl_set_input_return(paths_->input_backup_path, FL_RETURN_CHANGED); - fl_set_counter_return(paths_->counter_lastfiles, FL_RETURN_CHANGED); - fl_set_input_return(paths_->input_serverpipe, FL_RETURN_CHANGED); - // outputs general - fl_set_counter_return(outputs_general_->counter_line_len, - FL_RETURN_CHANGED); - fl_set_input_return(outputs_general_->input_tex_encoding, - FL_RETURN_CHANGED); - fl_addto_choice(outputs_general_->choice_default_papersize, - _(" default | US letter | legal | executive | A3 | A4 | A5 | B5 ")); - - // spell checker - fl_addto_choice(spellchecker_tab_->choice_spell_command, - _(" none | ispell | aspell ")); - fl_set_input_return(spellchecker_tab_->input_alt_lang, - FL_RETURN_CHANGED); - fl_set_input_return(spellchecker_tab_->input_escape_chars, - FL_RETURN_CHANGED); - fl_set_input_return(spellchecker_tab_->input_personal_dict, - FL_RETURN_CHANGED); + buildColours(); + buildInterface(); + buildLanguage(); + buildLnFmisc(); + buildOutputsMisc(); + buildPaths(); + buildPrinter(); + buildScreenFonts(); + buildSpellchecker(); // Now add them to the tabfolder fl_addto_tabfolder(dialog_->tabfolder_prefs, @@ -187,8 +140,8 @@ void FormPreferences::build() _("Outputs"), outputs_tab_->form); fl_addto_tabfolder(dialog_->tabfolder_prefs, - _("Spell checker"), - spellchecker_tab_->form); + _("Usage"), + usage_tab_->form); // now build the nested tabfolders // Starting with look and feel @@ -199,8 +152,11 @@ void FormPreferences::build() _("Interface"), interface_->form); fl_addto_tabfolder(look_n_feel_tab_->tabfolder_outer, - _("General"), - lnf_general_->form); + _("Colours"), + colours_->form); + fl_addto_tabfolder(look_n_feel_tab_->tabfolder_outer, + _("Misc"), + lnf_misc_->form); // then build inputs // Paths should probably go in a few outer_tab called Files @@ -213,36 +169,16 @@ void FormPreferences::build() _("Printer"), printer_->form); fl_addto_tabfolder(outputs_tab_->tabfolder_outer, - _("General"), - outputs_general_->form); - - // deactivate the various browse buttons because they - // currently aren't implemented - fl_deactivate_object(interface_->button_bind_file_browse); - fl_deactivate_object(interface_->button_ui_file_browse); - fl_deactivate_object(paths_->button_document_browse); - fl_deactivate_object(paths_->button_template_browse); - fl_deactivate_object(paths_->button_temp_dir_browse); - fl_deactivate_object(paths_->button_lastfiles_browse); - fl_deactivate_object(paths_->button_backup_path_browse); - fl_deactivate_object(paths_->button_serverpipe_browse); - fl_deactivate_object(spellchecker_tab_->button_personal_dict); - fl_set_object_lcol(interface_->button_bind_file_browse, FL_INACTIVE); - fl_set_object_lcol(interface_->button_ui_file_browse, FL_INACTIVE); - fl_set_object_lcol(paths_->button_document_browse, FL_INACTIVE); - fl_set_object_lcol(paths_->button_template_browse, FL_INACTIVE); - fl_set_object_lcol(paths_->button_temp_dir_browse, FL_INACTIVE); - 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); - fl_set_object_lcol(spellchecker_tab_->button_personal_dict, FL_INACTIVE); -} + _("Misc"), + outputs_misc_->form); - -FL_FORM * FormPreferences::form() const -{ - if (dialog_) return dialog_->form; - return 0; + // then building usage + fl_addto_tabfolder(usage_tab_->tabfolder_outer, + _("Spell checker"), + spellchecker_->form); + fl_addto_tabfolder(usage_tab_->tabfolder_outer, + _("Language"), + language_->form); } @@ -257,22 +193,101 @@ void FormPreferences::apply() // what we copy to make sure that it really is necessary to do things // like update the screen fonts because that flushes the textcache // and other stuff which may cost us a lot on slower/high-load machines. - - // Look 'n Feel General tab - lyxrc.show_banner = fl_get_button(lnf_general_->check_banner); - lyxrc.auto_region_delete = fl_get_button(lnf_general_-> - check_auto_region_delete); - lyxrc.exit_confirmation = fl_get_button(lnf_general_->check_exit_confirm); - lyxrc.display_shortcuts = - fl_get_button(lnf_general_->check_display_shortcuts); - lyxrc.new_ask_filename = fl_get_button(lnf_general_->check_ask_new_file); - lyxrc.cursor_follows_scrollbar = - fl_get_button(lnf_general_->check_cursor_follows_scrollbar); - lyxrc.autosave = static_cast - (fl_get_counter_value(lnf_general_->counter_autosave)); - lyxrc.wheel_jump = static_cast - (fl_get_counter_value(lnf_general_->counter_wm_jump)); - // Interface + + applyInterface(); + applyLnFmisc(); + applyOutputsMisc(); + applyPaths(); + applyPrinter(); + applyScreenFonts(); + applySpellChecker(); +} + + +void FormPreferences::update() +{ + if (!dialog_) return; + + // read lyxrc entries + updateInterface(); + updateLnFmisc(); + updateOutputsMisc(); + updatePaths(); + updatePrinter(); + updateScreenFonts(); + updateSpellChecker(); +} + + +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: + break; + + case INTERFACE: + feedbackInterface( ob ); + break; + + case LANGUAGE: + 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::buildColours() +{ + colours_ = build_colours(); +} + + +void FormPreferences::applyInterface() +{ lyxrc.popup_font_name = fl_get_input(interface_->input_popup_font); lyxrc.menu_font_name = fl_get_input(interface_->input_menu_font); @@ -282,121 +297,809 @@ void FormPreferences::apply() lyxrc.ui_file = fl_get_input(interface_->input_ui_file); lyxrc.override_x_deadkeys = fl_get_button(interface_->check_override_x_dead_keys); - // Screen fonts - if (lyxrc.roman_font_name != - fl_get_input(screen_fonts_->input_roman) || - lyxrc.sans_font_name != - fl_get_input(screen_fonts_->input_sans) || - lyxrc.typewriter_font_name != - fl_get_input(screen_fonts_->input_typewriter) || - lyxrc.font_norm != - fl_get_input(screen_fonts_->input_screen_encoding) || - lyxrc.use_scalable_fonts != - fl_get_button(screen_fonts_->check_scalable) || - lyxrc.zoom != static_cast - (fl_get_counter_value(screen_fonts_->counter_zoom)) || - lyxrc.font_sizes[LyXFont::SIZE_TINY] != - strToDbl(fl_get_input(screen_fonts_->input_tiny)) || - lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] != - strToDbl(fl_get_input(screen_fonts_->input_script)) || - lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] != - strToDbl(fl_get_input(screen_fonts_->input_footnote)) || - lyxrc.font_sizes[LyXFont::SIZE_SMALL] != - strToDbl(fl_get_input(screen_fonts_->input_small)) || - lyxrc.font_sizes[LyXFont::SIZE_NORMAL] != - strToDbl(fl_get_input(screen_fonts_->input_normal)) || - lyxrc.font_sizes[LyXFont::SIZE_LARGE] != - strToDbl(fl_get_input(screen_fonts_->input_large)) || - lyxrc.font_sizes[LyXFont::SIZE_LARGER] != - strToDbl(fl_get_input(screen_fonts_->input_larger)) || - lyxrc.font_sizes[LyXFont::SIZE_LARGEST] != - strToDbl(fl_get_input(screen_fonts_->input_largest)) || - lyxrc.font_sizes[LyXFont::SIZE_HUGE] != - strToDbl(fl_get_input(screen_fonts_->input_huge)) || - lyxrc.font_sizes[LyXFont::SIZE_HUGER] != - strToDbl(fl_get_input(screen_fonts_->input_huger))) { - // Something has changed so copy all of them and then force - // an update of the screen fonts (ie. redraw every buffer) - lyxrc.roman_font_name = fl_get_input(screen_fonts_->input_roman); - lyxrc.sans_font_name = fl_get_input(screen_fonts_->input_sans); - lyxrc.typewriter_font_name = fl_get_input(screen_fonts_-> - input_typewriter); - lyxrc.font_norm = fl_get_input(screen_fonts_-> - input_screen_encoding); - lyxrc.use_scalable_fonts = - fl_get_button(screen_fonts_->check_scalable); - lyxrc.zoom = static_cast - (fl_get_counter_value(screen_fonts_->counter_zoom)); - lyxrc.font_sizes[LyXFont::SIZE_TINY] = - strToDbl(fl_get_input(screen_fonts_->input_tiny)); - lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] = - strToDbl(fl_get_input(screen_fonts_->input_script)); - lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] = - strToDbl(fl_get_input(screen_fonts_->input_footnote)); - lyxrc.font_sizes[LyXFont::SIZE_SMALL] = - strToDbl(fl_get_input(screen_fonts_->input_small)); - lyxrc.font_sizes[LyXFont::SIZE_NORMAL] = - strToDbl(fl_get_input(screen_fonts_->input_normal)); - lyxrc.font_sizes[LyXFont::SIZE_LARGE] = - strToDbl(fl_get_input(screen_fonts_->input_large)); - lyxrc.font_sizes[LyXFont::SIZE_LARGER] = - strToDbl(fl_get_input(screen_fonts_->input_larger)); - lyxrc.font_sizes[LyXFont::SIZE_LARGEST] = - strToDbl(fl_get_input(screen_fonts_->input_largest)); - lyxrc.font_sizes[LyXFont::SIZE_HUGE] = - strToDbl(fl_get_input(screen_fonts_->input_huge)); - lyxrc.font_sizes[LyXFont::SIZE_HUGER] = - strToDbl(fl_get_input(screen_fonts_->input_huger)); - // Now update the buffers - // Can anything below here affect the redraw process? - lv_->getLyXFunc()->Dispatch(LFUN_SCREEN_FONT_UPDATE); +} + + +void FormPreferences::buildInterface() +{ + interface_ = build_interface(); + + fl_set_input_return(interface_->input_popup_font, FL_RETURN_CHANGED); + fl_set_input_return(interface_->input_menu_font, FL_RETURN_CHANGED); + fl_set_input_return(interface_->input_popup_encoding, + FL_RETURN_CHANGED); + fl_set_input_return(interface_->input_bind_file, FL_RETURN_CHANGED); + fl_set_input_return(interface_->input_ui_file, FL_RETURN_CHANGED); + + // deactivate the browse buttons because they aren't implemented + fl_deactivate_object(interface_->button_bind_file_browse); + 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); +} + + +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."); } - // printer - lyxrc.print_adapt_output = fl_get_button(printer_->check_adapt_output); - lyxrc.print_command = fl_get_input(printer_->input_command); - lyxrc.print_pagerange_flag = fl_get_input(printer_->input_page_range); - lyxrc.print_copies_flag = fl_get_input(printer_->input_copies); - lyxrc.print_reverse_flag = fl_get_input(printer_->input_reverse); - lyxrc.print_to_printer = fl_get_input(printer_->input_to_printer); - lyxrc.print_file_extension = - fl_get_input(printer_->input_file_extension); - lyxrc.print_spool_command = - fl_get_input(printer_->input_spool_command); - lyxrc.print_paper_flag = fl_get_input(printer_->input_paper_type); - lyxrc.print_evenpage_flag = fl_get_input(printer_->input_even_pages); - lyxrc.print_oddpage_flag = fl_get_input(printer_->input_odd_pages); - lyxrc.print_collcopies_flag = fl_get_input(printer_->input_collated); - lyxrc.print_landscape_flag = fl_get_input(printer_->input_landscape); - lyxrc.print_to_file = fl_get_input(printer_->input_to_file); - lyxrc.print_extra_options = - fl_get_input(printer_->input_extra_options); - lyxrc.print_spool_printerprefix = - fl_get_input(printer_->input_spool_prefix); - lyxrc.print_paper_dimension_flag = - fl_get_input(printer_->input_paper_size); - lyxrc.printer = fl_get_input(printer_->input_name); - // paths - lyxrc.document_path = fl_get_input(paths_->input_default_path); - lyxrc.template_path = fl_get_input(paths_->input_template_path); - lyxrc.tempdir_path = fl_get_input(paths_->input_temp_dir); - lyxrc.lastfiles = fl_get_input(paths_->input_lastfiles); - lyxrc.backupdir_path = fl_get_input(paths_->input_backup_path); - lyxrc.use_tempdir = fl_get_button(paths_->check_use_temp_dir); - lyxrc.check_lastfiles = fl_get_button(paths_->check_last_files); - lyxrc.make_backup = fl_get_button(paths_->check_make_backups); - lyxrc.num_lastfiles = static_cast - (fl_get_counter_value(paths_->counter_lastfiles)); - lyxrc.lyxpipes = fl_get_input(paths_->input_serverpipe); - // outputs general - lyxrc.ascii_linelen = static_cast - (fl_get_counter_value(outputs_general_->counter_line_len)); - lyxrc.fontenc = fl_get_input(outputs_general_->input_tex_encoding); - int choice = - fl_get_choice(outputs_general_->choice_default_papersize) - 1; - lyxrc.default_papersize = static_cast(choice); + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); +} - applySpellChecker(); + +void FormPreferences::updateInterface() +{ + fl_set_input(interface_->input_popup_font, + lyxrc.popup_font_name.c_str()); + fl_set_input(interface_->input_menu_font, + lyxrc.menu_font_name.c_str()); + fl_set_input(interface_->input_popup_encoding, + lyxrc.font_norm_menu.c_str()); + fl_set_input(interface_->input_bind_file, + lyxrc.bind_file.c_str()); + fl_set_input(interface_->input_ui_file, + lyxrc.ui_file.c_str()); + fl_set_button(interface_->check_override_x_dead_keys, + lyxrc.override_x_deadkeys); +} + + +void FormPreferences::buildLanguage() +{ + language_ = build_language(); +} + + +void FormPreferences::applyLnFmisc() +{ + lyxrc.show_banner = fl_get_button(lnf_misc_->check_banner); + lyxrc.auto_region_delete = fl_get_button(lnf_misc_-> + check_auto_region_delete); + lyxrc.exit_confirmation = fl_get_button(lnf_misc_->check_exit_confirm); + lyxrc.display_shortcuts = + fl_get_button(lnf_misc_->check_display_shortcuts); + lyxrc.new_ask_filename = fl_get_button(lnf_misc_->check_ask_new_file); + lyxrc.cursor_follows_scrollbar = + fl_get_button(lnf_misc_->check_cursor_follows_scrollbar); + lyxrc.autosave = static_cast + (fl_get_counter_value(lnf_misc_->counter_autosave)); + lyxrc.wheel_jump = static_cast + (fl_get_counter_value(lnf_misc_->counter_wm_jump)); +} + + +void FormPreferences::buildLnFmisc() +{ + lnf_misc_ = build_lnf_misc(); + + fl_set_counter_return(lnf_misc_->counter_autosave, + FL_RETURN_CHANGED); + fl_set_counter_return(lnf_misc_->counter_wm_jump, + FL_RETURN_CHANGED); +} + + +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)"); + } + + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); +} + +void FormPreferences::updateLnFmisc() +{ + fl_set_button(lnf_misc_->check_banner, + lyxrc.show_banner); + fl_set_button(lnf_misc_->check_auto_region_delete, + lyxrc.auto_region_delete); + fl_set_button(lnf_misc_->check_exit_confirm, + lyxrc.exit_confirmation); + fl_set_button(lnf_misc_->check_display_shortcuts, + lyxrc.display_shortcuts); + fl_set_button(lnf_misc_->check_ask_new_file, + lyxrc.new_ask_filename); + fl_set_button(lnf_misc_->check_cursor_follows_scrollbar, + lyxrc.cursor_follows_scrollbar); + fl_set_counter_value(lnf_misc_->counter_autosave, + lyxrc.autosave); + fl_set_counter_value(lnf_misc_->counter_wm_jump, + lyxrc.wheel_jump); +} + + +void FormPreferences::applyOutputsMisc() +{ + lyxrc.ascii_linelen = static_cast + (fl_get_counter_value(outputs_misc_->counter_line_len)); + lyxrc.fontenc = fl_get_input(outputs_misc_->input_tex_encoding); + + int choice = + fl_get_choice(outputs_misc_->choice_default_papersize) - 1; + lyxrc.default_papersize = static_cast(choice); +} + + +void FormPreferences::buildOutputsMisc() +{ + outputs_misc_ = build_outputs_misc(); + + fl_set_counter_return(outputs_misc_->counter_line_len, + FL_RETURN_CHANGED); + fl_set_input_return(outputs_misc_->input_tex_encoding, + FL_RETURN_CHANGED); + fl_addto_choice(outputs_misc_->choice_default_papersize, + _(" default | US letter | legal | executive | A3 | A4 | A5 | B5 ")); +} + + +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_->choice_default_papersize ) { + str = N_("Specify the default paper size."); + } + + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); +} + + +void FormPreferences::updateOutputsMisc() +{ + fl_set_counter_value(outputs_misc_->counter_line_len, + lyxrc.ascii_linelen); + fl_set_input(outputs_misc_->input_tex_encoding, + lyxrc.fontenc.c_str()); + fl_set_choice(outputs_misc_->choice_default_papersize, + lyxrc.default_papersize+1); +} + + +void FormPreferences::applyPaths() +{ + lyxrc.document_path = fl_get_input(paths_->input_default_path); + lyxrc.template_path = fl_get_input(paths_->input_template_path); + + int button = fl_get_button(paths_->check_use_temp_dir); + string str = fl_get_input(paths_->input_temp_dir); + if( !button ) str.erase(); + + lyxrc.use_tempdir = button; + lyxrc.tempdir_path = str; + + button = fl_get_button(paths_->check_last_files); + str = fl_get_input(paths_->input_lastfiles); + if( !button ) str.erase(); + + lyxrc.check_lastfiles = button; + lyxrc.lastfiles = str; + lyxrc.num_lastfiles = static_cast + (fl_get_counter_value(paths_->counter_lastfiles)); + + button = fl_get_button(paths_->check_make_backups); + str = fl_get_input(paths_->input_backup_path); + if( !button ) str.erase(); + + lyxrc.make_backup = button; + lyxrc.backupdir_path = str; + + lyxrc.lyxpipes = fl_get_input(paths_->input_serverpipe); + + // update view + updatePaths(); +} + + +void FormPreferences::buildPaths() +{ + paths_ = build_paths(); + + fl_set_input_return(paths_->input_default_path, FL_RETURN_CHANGED); + fl_set_input_return(paths_->input_template_path, FL_RETURN_CHANGED); + fl_set_input_return(paths_->input_temp_dir, FL_RETURN_CHANGED); + fl_set_input_return(paths_->input_lastfiles, FL_RETURN_CHANGED); + fl_set_input_return(paths_->input_backup_path, FL_RETURN_CHANGED); + fl_set_counter_return(paths_->counter_lastfiles, FL_RETURN_CHANGED); + fl_set_input_return(paths_->input_serverpipe, FL_RETURN_CHANGED); + + // deactivate the browse buttons because they aren't implemented + fl_deactivate_object(paths_->button_document_browse); + fl_deactivate_object(paths_->button_template_browse); + fl_deactivate_object(paths_->button_temp_dir_browse); + fl_deactivate_object(paths_->button_lastfiles_browse); + fl_deactivate_object(paths_->button_backup_path_browse); + fl_deactivate_object(paths_->button_serverpipe_browse); + fl_set_object_lcol(paths_->button_document_browse, FL_INACTIVE); + fl_set_object_lcol(paths_->button_template_browse, FL_INACTIVE); + fl_set_object_lcol(paths_->button_temp_dir_browse, FL_INACTIVE); + 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); +} + + +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."); + } + + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); +} + + +bool FormPreferences::inputPaths( FL_OBJECT const * const ob ) +{ + bool activate = true; + + if( !ob || ob == paths_->check_use_temp_dir ) { + if( fl_get_button(paths_->check_use_temp_dir) ) { + fl_activate_object(paths_->input_temp_dir); + fl_set_object_lcol(paths_->input_temp_dir, + FL_BLACK); + } else { + fl_deactivate_object(paths_->input_temp_dir); + fl_set_object_lcol(paths_->input_temp_dir, + FL_INACTIVE); + } + } + + if( !ob || ob == paths_->check_last_files ) { + if( fl_get_button(paths_->check_last_files) ) { + fl_activate_object(paths_->input_lastfiles); + fl_set_object_lcol(paths_->input_lastfiles, + FL_BLACK); + } else { + fl_deactivate_object(paths_->input_lastfiles); + fl_set_object_lcol(paths_->input_lastfiles, + FL_INACTIVE); + } + } + + if( !ob || ob == paths_->check_make_backups ) { + if( fl_get_button(paths_->check_make_backups) ) { + fl_activate_object(paths_->input_backup_path); + fl_set_object_lcol(paths_->input_backup_path, + FL_BLACK); + } else { + fl_deactivate_object(paths_->input_backup_path); + fl_set_object_lcol(paths_->input_backup_path, + FL_INACTIVE); + } + } + + if( !ob || ob == paths_->input_default_path ) { + string name = fl_get_input(paths_->input_default_path); + if( !WriteableDir(name) ) + return false; + } + + if( !ob || ob == paths_->input_template_path ) { + string name = fl_get_input(paths_->input_template_path); + if( !ReadableDir(name) ) + return false; + } + + if( !ob || ob == paths_->input_temp_dir ) { + string name = fl_get_input(paths_->input_temp_dir); + if( fl_get_button(paths_->check_make_backups) + && !name.empty() + && !WriteableDir(name) ) + return false; + } + + if( !ob || ob == paths_->input_backup_path ) { + string name = fl_get_input(paths_->input_backup_path); + if( fl_get_button(paths_->check_make_backups) + && !name.empty() + && !WriteableDir(name) ) + return false; + } + + if( !ob || ob == paths_->input_lastfiles ) { + string name = fl_get_input(paths_->input_lastfiles); + if( fl_get_button(paths_->check_last_files) + && !name.empty() + && !WriteableFile(name) ) + return false; + } + + if( !ob || ob == paths_->input_serverpipe ) { + string name = fl_get_input(paths_->input_serverpipe); + if( !name.empty() ) { + if( !WriteableFile(name, ".in") ) + return false; + if( !WriteableFile(name, ".out") ) + return false; + } + } + + return activate; +} + + +void FormPreferences::updatePaths() +{ + fl_set_input(paths_->input_default_path, + lyxrc.document_path.c_str()); + fl_set_input(paths_->input_template_path, + lyxrc.template_path.c_str()); + + string str = string(); + if( lyxrc.make_backup ) str = lyxrc.backupdir_path; + + fl_set_button(paths_->check_make_backups, + lyxrc.make_backup); + fl_set_input(paths_->input_backup_path, str.c_str()); + + str.erase(); + if( lyxrc.use_tempdir ) str = lyxrc.tempdir_path; + + fl_set_button(paths_->check_use_temp_dir, + lyxrc.use_tempdir); + fl_set_input(paths_->input_temp_dir, str.c_str()); + + str.erase(); + if( lyxrc.check_lastfiles ) str = lyxrc.lastfiles; + + fl_set_button(paths_->check_last_files, + lyxrc.check_lastfiles); + fl_set_input(paths_->input_lastfiles, str.c_str()); + fl_set_counter_value(paths_->counter_lastfiles, + lyxrc.num_lastfiles); + + fl_set_input(paths_->input_serverpipe, lyxrc.lyxpipes.c_str()); + + // Activate/Deactivate the input fields dependent on the state of the + // buttons. + inputPaths( 0 ); +} + + +void FormPreferences::applyPrinter() +{ + lyxrc.print_adapt_output = fl_get_button(printer_->check_adapt_output); + lyxrc.print_command = fl_get_input(printer_->input_command); + lyxrc.print_pagerange_flag = fl_get_input(printer_->input_page_range); + lyxrc.print_copies_flag = fl_get_input(printer_->input_copies); + lyxrc.print_reverse_flag = fl_get_input(printer_->input_reverse); + lyxrc.print_to_printer = fl_get_input(printer_->input_to_printer); + lyxrc.print_file_extension = + fl_get_input(printer_->input_file_extension); + lyxrc.print_spool_command = + fl_get_input(printer_->input_spool_command); + lyxrc.print_paper_flag = fl_get_input(printer_->input_paper_type); + lyxrc.print_evenpage_flag = fl_get_input(printer_->input_even_pages); + lyxrc.print_oddpage_flag = fl_get_input(printer_->input_odd_pages); + lyxrc.print_collcopies_flag = fl_get_input(printer_->input_collated); + lyxrc.print_landscape_flag = fl_get_input(printer_->input_landscape); + lyxrc.print_to_file = fl_get_input(printer_->input_to_file); + lyxrc.print_extra_options = + fl_get_input(printer_->input_extra_options); + lyxrc.print_spool_printerprefix = + fl_get_input(printer_->input_spool_prefix); + lyxrc.print_paper_dimension_flag = + fl_get_input(printer_->input_paper_size); + lyxrc.printer = fl_get_input(printer_->input_name); +} + + +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."); + } + + + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); +} + + +void FormPreferences::buildPrinter() +{ + printer_ = build_printer(); + + fl_set_input_return(printer_->input_command, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_page_range, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_copies, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_reverse, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_to_printer, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_file_extension, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_spool_command, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_paper_type, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_even_pages, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_odd_pages, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_collated, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_landscape, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_to_file, FL_RETURN_CHANGED); + fl_set_input_return(printer_->input_extra_options, FL_RETURN_CHANGED); + 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); +} + + +void FormPreferences::updatePrinter() +{ + fl_set_button(printer_->check_adapt_output, + lyxrc.print_adapt_output); + fl_set_input(printer_->input_command, + lyxrc.print_command.c_str()); + fl_set_input(printer_->input_page_range, + lyxrc.print_pagerange_flag.c_str()); + fl_set_input(printer_->input_copies, + lyxrc.print_copies_flag.c_str()); + fl_set_input(printer_->input_reverse, + lyxrc.print_reverse_flag.c_str()); + fl_set_input(printer_->input_to_printer, + lyxrc.print_to_printer.c_str()); + fl_set_input(printer_->input_file_extension, + lyxrc.print_file_extension.c_str()); + fl_set_input(printer_->input_spool_command, + lyxrc.print_spool_command.c_str()); + fl_set_input(printer_->input_paper_type, + lyxrc.print_paper_flag.c_str()); + fl_set_input(printer_->input_even_pages, + lyxrc.print_evenpage_flag.c_str()); + fl_set_input(printer_->input_odd_pages, + lyxrc.print_oddpage_flag.c_str()); + fl_set_input(printer_->input_collated, + lyxrc.print_collcopies_flag.c_str()); + fl_set_input(printer_->input_landscape, + lyxrc.print_landscape_flag.c_str()); + fl_set_input(printer_->input_to_file, + lyxrc.print_to_file.c_str()); + fl_set_input(printer_->input_extra_options, + lyxrc.print_extra_options.c_str()); + fl_set_input(printer_->input_spool_prefix, + lyxrc.print_spool_printerprefix.c_str()); + fl_set_input(printer_->input_paper_size, + lyxrc.print_paper_dimension_flag.c_str()); + fl_set_input(printer_->input_name, + lyxrc.printer.c_str()); +} + + +void FormPreferences::applyScreenFonts() +{ + bool changed = false; + + string str = fl_get_input(screen_fonts_->input_roman); + if( lyxrc.roman_font_name != str ) { + changed = true; + lyxrc.roman_font_name = str; + } + + str = fl_get_input(screen_fonts_->input_sans); + if( lyxrc.sans_font_name != str ) { + changed = true; + lyxrc.sans_font_name = str; + } + + str = fl_get_input(screen_fonts_->input_typewriter); + if( lyxrc.typewriter_font_name != str ) { + changed = true; + lyxrc.typewriter_font_name = str; + } + + str = fl_get_input(screen_fonts_->input_screen_encoding); + if( lyxrc.font_norm != str ) { + changed = true; + lyxrc.font_norm = str; + } + + bool button = fl_get_button(screen_fonts_->check_scalable); + if( lyxrc.use_scalable_fonts != button ) { + changed = true; + lyxrc.use_scalable_fonts = button; + } + + int ivalue = fl_get_counter_value(screen_fonts_->counter_zoom); + if( lyxrc.zoom != static_cast( ivalue ) ) { + changed = true; + lyxrc.zoom = static_cast( ivalue ); + } + + double dvalue = strToDbl(fl_get_input(screen_fonts_->input_tiny)); + if( lyxrc.font_sizes[LyXFont::SIZE_TINY] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_TINY] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_script)); + if( lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_footnote)); + if( lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_small)); + if( lyxrc.font_sizes[LyXFont::SIZE_SMALL] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_SMALL] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_normal)); + if( lyxrc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_large)); + if( lyxrc.font_sizes[LyXFont::SIZE_LARGE] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_LARGE] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_larger)); + if( lyxrc.font_sizes[LyXFont::SIZE_LARGER] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_LARGER] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_largest)); + if( lyxrc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_huge)); + if( lyxrc.font_sizes[LyXFont::SIZE_HUGE] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_HUGE] = dvalue; + } + + dvalue = strToDbl(fl_get_input(screen_fonts_->input_huger)); + if( lyxrc.font_sizes[LyXFont::SIZE_HUGER] != dvalue ) { + changed = true; + lyxrc.font_sizes[LyXFont::SIZE_HUGER] = dvalue; + } + + if( changed ) { + // Now update the buffers + // Can anything below here affect the redraw process? + lv_->getLyXFunc()->Dispatch(LFUN_SCREEN_FONT_UPDATE); + } +} + + +void FormPreferences::buildScreenFonts() +{ + screen_fonts_ = build_screen_fonts(); + + fl_set_input_return(screen_fonts_->input_roman, FL_RETURN_CHANGED); + fl_set_input_return(screen_fonts_->input_sans, FL_RETURN_CHANGED); + fl_set_input_return(screen_fonts_->input_typewriter, + FL_RETURN_CHANGED); + 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_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); + fl_set_input_return(screen_fonts_->input_small, FL_RETURN_CHANGED); + fl_set_input_return(screen_fonts_->input_normal, FL_RETURN_CHANGED); + fl_set_input_return(screen_fonts_->input_large, FL_RETURN_CHANGED); + fl_set_input_return(screen_fonts_->input_larger, FL_RETURN_CHANGED); + 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); +} + + +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."); + } + + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); +} + + +bool FormPreferences::inputScreenFonts() +{ + bool activate = true; + string str; + + // Make sure that all fonts all have positive entries + // Also note that an empty entry is returned as 0.0 by strToDbl + if (0.0 >= strToDbl(fl_get_input(screen_fonts_->input_tiny)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_script)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_footnote)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_small)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_normal)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_large)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_larger)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_largest)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huge)) + || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huger))) { + activate = false; + str = N_("WARNING! Fonts must be positive!"); + + // Fontsizes -- tiny < script < footnote etc. + } else if (strToDbl(fl_get_input(screen_fonts_->input_tiny)) > + strToDbl(fl_get_input(screen_fonts_->input_script)) || + strToDbl(fl_get_input(screen_fonts_->input_script)) > + strToDbl(fl_get_input(screen_fonts_->input_footnote)) || + strToDbl(fl_get_input(screen_fonts_->input_footnote)) > + strToDbl(fl_get_input(screen_fonts_->input_small)) || + strToDbl(fl_get_input(screen_fonts_->input_small)) > + strToDbl(fl_get_input(screen_fonts_->input_normal)) || + strToDbl(fl_get_input(screen_fonts_->input_normal)) > + strToDbl(fl_get_input(screen_fonts_->input_large)) || + strToDbl(fl_get_input(screen_fonts_->input_large)) > + strToDbl(fl_get_input(screen_fonts_->input_larger)) || + strToDbl(fl_get_input(screen_fonts_->input_larger)) > + strToDbl(fl_get_input(screen_fonts_->input_largest)) || + strToDbl(fl_get_input(screen_fonts_->input_largest)) > + strToDbl(fl_get_input(screen_fonts_->input_huge)) || + strToDbl(fl_get_input(screen_fonts_->input_huge)) > + strToDbl(fl_get_input(screen_fonts_->input_huger))) { + activate = false; + + str = N_("WARNING! Fonts must be input in the order tiny > script>\nfootnote > small > normal > large > larger > largest > huge > huger."); + } + + if( !activate ) { + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); + } + + return activate; +} + + +void FormPreferences::updateScreenFonts() +{ + fl_set_input(screen_fonts_->input_roman, + lyxrc.roman_font_name.c_str()); + fl_set_input(screen_fonts_->input_sans, + lyxrc.sans_font_name.c_str()); + fl_set_input(screen_fonts_->input_typewriter, + lyxrc.typewriter_font_name.c_str()); + fl_set_input(screen_fonts_->input_screen_encoding, + 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_input(screen_fonts_->input_tiny, + tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str()); + fl_set_input(screen_fonts_->input_script, + tostr(lyxrc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str()); + fl_set_input(screen_fonts_->input_footnote, + tostr(lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str()); + fl_set_input(screen_fonts_->input_small, + tostr(lyxrc.font_sizes[LyXFont::SIZE_SMALL]).c_str()); + fl_set_input(screen_fonts_->input_normal, + tostr(lyxrc.font_sizes[LyXFont::SIZE_NORMAL]).c_str()); + fl_set_input(screen_fonts_->input_large, + tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGE]).c_str()); + fl_set_input(screen_fonts_->input_larger, + tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGER]).c_str()); + fl_set_input(screen_fonts_->input_largest, + tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGEST]).c_str()); + fl_set_input(screen_fonts_->input_huge, + tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGE]).c_str()); + fl_set_input(screen_fonts_->input_huger, + tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGER]).c_str()); } @@ -404,7 +1107,7 @@ void FormPreferences::applySpellChecker() { string choice = "none"; - switch(fl_get_choice(spellchecker_tab_->choice_spell_command)) { + switch(fl_get_choice(spellchecker_->choice_spell_command)) { case 1: choice = "none"; break; @@ -420,7 +1123,7 @@ void FormPreferences::applySpellChecker() lyxrc.isp_command = choice; // If spell checker == "none", all other input set to off. - if( fl_get_choice(spellchecker_tab_->choice_spell_command) == 1 ) { + if( fl_get_choice(spellchecker_->choice_spell_command) == 1 ) { lyxrc.isp_use_alt_lang = false; lyxrc.isp_alt_lang.erase(); @@ -433,175 +1136,146 @@ void FormPreferences::applySpellChecker() lyxrc.isp_accept_compound = false; lyxrc.isp_use_input_encoding = false; } else { - int button = fl_get_button(spellchecker_tab_->check_alt_lang); - choice = fl_get_input(spellchecker_tab_->input_alt_lang); + int button = fl_get_button(spellchecker_->check_alt_lang); + choice = fl_get_input(spellchecker_->input_alt_lang); if( button && choice.empty() ) button = 0; if( !button ) choice.erase(); lyxrc.isp_use_alt_lang = static_cast(button); lyxrc.isp_alt_lang = choice; - button = fl_get_button(spellchecker_tab_->check_escape_chars); - choice = fl_get_input(spellchecker_tab_->input_escape_chars); + button = fl_get_button(spellchecker_->check_escape_chars); + choice = fl_get_input(spellchecker_->input_escape_chars); if( button && choice.empty() ) button = 0; if( !button ) choice.erase(); lyxrc.isp_use_esc_chars = static_cast(button); lyxrc.isp_esc_chars = choice; - button = fl_get_button(spellchecker_tab_->check_personal_dict); - choice = fl_get_input(spellchecker_tab_->input_personal_dict); + button = fl_get_button(spellchecker_->check_personal_dict); + choice = fl_get_input(spellchecker_->input_personal_dict); if( button && choice.empty() ) button = 0; if( !button ) choice.erase(); lyxrc.isp_use_pers_dict = static_cast(button); lyxrc.isp_pers_dict = choice; - button = fl_get_button(spellchecker_tab_->check_compound_words); + button = fl_get_button(spellchecker_->check_compound_words); lyxrc.isp_accept_compound = static_cast(button); - button = fl_get_button(spellchecker_tab_->check_input_enc); + button = fl_get_button(spellchecker_->check_input_enc); lyxrc.isp_use_input_encoding = static_cast(button); } - + + // Reset view updateSpellChecker(); } -void FormPreferences::update() +void FormPreferences::buildSpellchecker() { - if (!dialog_) return; - - // read lyxrc entries - // Lnf_General tab - fl_set_button(lnf_general_->check_banner, - lyxrc.show_banner); - fl_set_button(lnf_general_->check_auto_region_delete, - lyxrc.auto_region_delete); - fl_set_button(lnf_general_->check_exit_confirm, - lyxrc.exit_confirmation); - fl_set_button(lnf_general_->check_display_shortcuts, - lyxrc.display_shortcuts); - fl_set_button(lnf_general_->check_ask_new_file, - lyxrc.new_ask_filename); - fl_set_button(lnf_general_->check_cursor_follows_scrollbar, - lyxrc.cursor_follows_scrollbar); - fl_set_counter_value(lnf_general_->counter_autosave, - lyxrc.autosave); - fl_set_counter_value(lnf_general_->counter_wm_jump, - lyxrc.wheel_jump); - // Screen fonts - fl_set_input(screen_fonts_->input_roman, - lyxrc.roman_font_name.c_str()); - fl_set_input(screen_fonts_->input_sans, - lyxrc.sans_font_name.c_str()); - fl_set_input(screen_fonts_->input_typewriter, - lyxrc.typewriter_font_name.c_str()); - fl_set_input(screen_fonts_->input_screen_encoding, - 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_input(screen_fonts_->input_tiny, - tostr(lyxrc.font_sizes[LyXFont::SIZE_TINY]).c_str()); - fl_set_input(screen_fonts_->input_script, - tostr(lyxrc.font_sizes[LyXFont::SIZE_SCRIPT]).c_str()); - fl_set_input(screen_fonts_->input_footnote, - tostr(lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE]).c_str()); - fl_set_input(screen_fonts_->input_small, - tostr(lyxrc.font_sizes[LyXFont::SIZE_SMALL]).c_str()); - fl_set_input(screen_fonts_->input_normal, - tostr(lyxrc.font_sizes[LyXFont::SIZE_NORMAL]).c_str()); - fl_set_input(screen_fonts_->input_large, - tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGE]).c_str()); - fl_set_input(screen_fonts_->input_larger, - tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGER]).c_str()); - fl_set_input(screen_fonts_->input_largest, - tostr(lyxrc.font_sizes[LyXFont::SIZE_LARGEST]).c_str()); - fl_set_input(screen_fonts_->input_huge, - tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGE]).c_str()); - fl_set_input(screen_fonts_->input_huger, - tostr(lyxrc.font_sizes[LyXFont::SIZE_HUGER]).c_str()); - // interface - fl_set_input(interface_->input_popup_font, - lyxrc.popup_font_name.c_str()); - fl_set_input(interface_->input_menu_font, - lyxrc.menu_font_name.c_str()); - fl_set_input(interface_->input_popup_encoding, - lyxrc.font_norm_menu.c_str()); - fl_set_input(interface_->input_bind_file, - lyxrc.bind_file.c_str()); - fl_set_input(interface_->input_ui_file, - lyxrc.ui_file.c_str()); - fl_set_button(interface_->check_override_x_dead_keys, - lyxrc.override_x_deadkeys); - // printer - fl_set_button(printer_->check_adapt_output, - lyxrc.print_adapt_output); - fl_set_input(printer_->input_command, - lyxrc.print_command.c_str()); - fl_set_input(printer_->input_page_range, - lyxrc.print_pagerange_flag.c_str()); - fl_set_input(printer_->input_copies, - lyxrc.print_copies_flag.c_str()); - fl_set_input(printer_->input_reverse, - lyxrc.print_reverse_flag.c_str()); - fl_set_input(printer_->input_to_printer, - lyxrc.print_to_printer.c_str()); - fl_set_input(printer_->input_file_extension, - lyxrc.print_file_extension.c_str()); - fl_set_input(printer_->input_spool_command, - lyxrc.print_spool_command.c_str()); - fl_set_input(printer_->input_paper_type, - lyxrc.print_paper_flag.c_str()); - fl_set_input(printer_->input_even_pages, - lyxrc.print_evenpage_flag.c_str()); - fl_set_input(printer_->input_odd_pages, - lyxrc.print_oddpage_flag.c_str()); - fl_set_input(printer_->input_collated, - lyxrc.print_collcopies_flag.c_str()); - fl_set_input(printer_->input_landscape, - lyxrc.print_landscape_flag.c_str()); - fl_set_input(printer_->input_to_file, - lyxrc.print_to_file.c_str()); - fl_set_input(printer_->input_extra_options, - lyxrc.print_extra_options.c_str()); - fl_set_input(printer_->input_spool_prefix, - lyxrc.print_spool_printerprefix.c_str()); - fl_set_input(printer_->input_paper_size, - lyxrc.print_paper_dimension_flag.c_str()); - fl_set_input(printer_->input_name, - lyxrc.printer.c_str()); - // paths - fl_set_input(paths_->input_default_path, - lyxrc.document_path.c_str()); - fl_set_input(paths_->input_template_path, - lyxrc.template_path.c_str()); - fl_set_input(paths_->input_temp_dir, - lyxrc.tempdir_path.c_str()); - fl_set_input(paths_->input_lastfiles, - lyxrc.lastfiles.c_str()); - fl_set_input(paths_->input_backup_path, - lyxrc.backupdir_path.c_str()); - fl_set_button(paths_->check_use_temp_dir, - lyxrc.use_tempdir); - fl_set_button(paths_->check_last_files, - lyxrc.check_lastfiles); - fl_set_button(paths_->check_make_backups, - lyxrc.make_backup); - fl_set_counter_value(paths_->counter_lastfiles, - lyxrc.num_lastfiles); - fl_set_input(paths_->input_serverpipe, lyxrc.lyxpipes.c_str()); - // outputs general - fl_set_counter_value(outputs_general_->counter_line_len, - lyxrc.ascii_linelen); - fl_set_input(outputs_general_->input_tex_encoding, - lyxrc.fontenc.c_str()); - fl_set_choice(outputs_general_->choice_default_papersize, - lyxrc.default_papersize+1); + spellchecker_ = build_spellchecker(); - updateSpellChecker(); + fl_addto_choice(spellchecker_->choice_spell_command, + _(" none | ispell | aspell ")); + fl_set_input_return(spellchecker_->input_alt_lang, + FL_RETURN_CHANGED); + fl_set_input_return(spellchecker_->input_escape_chars, + FL_RETURN_CHANGED); + fl_set_input_return(spellchecker_->input_personal_dict, + FL_RETURN_CHANGED); + + // deactivate the browse button because it isn't implemented + fl_deactivate_object(spellchecker_->button_personal_dict); + fl_set_object_lcol(spellchecker_->button_personal_dict, + FL_INACTIVE); +} + + +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."); + } + + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); +} + + +bool FormPreferences::inputSpellChecker( FL_OBJECT const * const ob ) +{ + // Allow/dissallow input + + // If spell checker == "none", disable all input. + if( !ob || ob == spellchecker_->choice_spell_command ) { + if( fl_get_choice(spellchecker_->choice_spell_command) == 1 ) { + fl_deactivate_object( spellchecker_->check_alt_lang ); + fl_deactivate_object( spellchecker_->input_alt_lang ); + fl_deactivate_object( spellchecker_->check_escape_chars ); + fl_deactivate_object( spellchecker_->input_escape_chars ); + fl_deactivate_object( spellchecker_->check_personal_dict ); + fl_deactivate_object( spellchecker_->input_personal_dict ); + fl_deactivate_object( spellchecker_->check_compound_words ); + fl_deactivate_object( spellchecker_->check_input_enc ); + return true; + } else { + fl_activate_object( spellchecker_->check_alt_lang ); + fl_activate_object( spellchecker_->check_escape_chars ); + fl_activate_object( spellchecker_->check_personal_dict ); + fl_activate_object( spellchecker_->check_compound_words ); + fl_activate_object( spellchecker_->check_input_enc ); + } + } + + if( !ob || ob == spellchecker_->check_alt_lang ) { + if( fl_get_button(spellchecker_->check_alt_lang) ) { + fl_activate_object(spellchecker_->input_alt_lang); + fl_set_object_lcol(spellchecker_->input_alt_lang, + FL_BLACK); + } else { + fl_deactivate_object(spellchecker_->input_alt_lang); + fl_set_object_lcol(spellchecker_->input_alt_lang, + FL_INACTIVE); + } + } + + if( !ob || ob == spellchecker_->check_escape_chars ) { + if( fl_get_button(spellchecker_->check_escape_chars) ) { + fl_activate_object(spellchecker_->input_escape_chars); + fl_set_object_lcol(spellchecker_->input_escape_chars, + FL_BLACK); + } else { + fl_deactivate_object(spellchecker_->input_escape_chars); + fl_set_object_lcol(spellchecker_->input_escape_chars, + FL_INACTIVE); + } + } + + if( !ob || ob == spellchecker_->check_personal_dict ) { + if( fl_get_button(spellchecker_->check_personal_dict) ) { + fl_activate_object(spellchecker_->input_personal_dict); + fl_set_object_lcol(spellchecker_->input_personal_dict, + FL_BLACK); + } else { + fl_deactivate_object(spellchecker_->input_personal_dict); + fl_set_object_lcol(spellchecker_->input_personal_dict, + FL_INACTIVE); + } + } + + return true; // all input is valid! } @@ -614,240 +1288,156 @@ void FormPreferences::updateSpellChecker() choice = 2; else if( lyxrc.isp_command == "aspell" ) choice = 3; - fl_set_choice(spellchecker_tab_->choice_spell_command, choice); + fl_set_choice(spellchecker_->choice_spell_command, choice); string str = string(); if( lyxrc.isp_use_alt_lang ) str = lyxrc.isp_alt_lang; - fl_set_button(spellchecker_tab_->check_alt_lang, + fl_set_button(spellchecker_->check_alt_lang, lyxrc.isp_use_alt_lang); - fl_set_input(spellchecker_tab_->input_alt_lang, str.c_str()); + fl_set_input(spellchecker_->input_alt_lang, str.c_str()); - str = string(); + str.erase(); if( lyxrc.isp_use_esc_chars ) str = lyxrc.isp_esc_chars; - fl_set_button(spellchecker_tab_->check_escape_chars, + fl_set_button(spellchecker_->check_escape_chars, lyxrc.isp_use_esc_chars); - fl_set_input(spellchecker_tab_->input_escape_chars, str.c_str()); + fl_set_input(spellchecker_->input_escape_chars, str.c_str()); - str = string(); + str.erase(); if( lyxrc.isp_use_pers_dict ) str = lyxrc.isp_pers_dict; - fl_set_button(spellchecker_tab_->check_personal_dict, + fl_set_button(spellchecker_->check_personal_dict, lyxrc.isp_use_pers_dict); - fl_set_input(spellchecker_tab_->input_personal_dict, str.c_str()); + fl_set_input(spellchecker_->input_personal_dict, str.c_str()); - fl_set_button(spellchecker_tab_->check_compound_words, + fl_set_button(spellchecker_->check_compound_words, lyxrc.isp_accept_compound); - fl_set_button(spellchecker_tab_->check_input_enc, + fl_set_button(spellchecker_->check_input_enc, lyxrc.isp_use_input_encoding); // Activate/Deactivate the input fields dependent on the state of the // buttons. - inputSpellChecker(); + inputSpellChecker( 0 ); } -bool FormPreferences::input(FL_OBJECT *, long) +bool FormPreferences::WriteableDir( string const & name ) const { - 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_ + bool success = true; + string str; - // input path -- dir should exist, be writable & absolute - if (!AbsolutePath(fl_get_input(paths_->input_default_path)) - || 1 != IsDirWriteable(fl_get_input(paths_->input_default_path))) { - activate = false; - lyxerr[Debug::GUI] << "Preferences: input path is wrong\n"; + if( !AbsolutePath(name) ) { + success = false; + str = N_("WARNING! The absolute path is required."); } - { - // template_path should be a readable directory - string temp(fl_get_input(paths_->input_template_path)); - FileInfo tp(temp); - if (!AbsolutePath(temp) - || !tp.isDir() - || !tp.readable()) { - activate = false; - lyxerr[Debug::GUI] << "Preferences: template path is wrong\n"; - } + FileInfo tp(name); + if( success && !tp.isDir() ) { + success = false; + str = N_("WARNING! Directory does not exist."); } - // tmpdir: not used - // || writable directory - if (fl_get_button(paths_->check_use_temp_dir) - && (1 != IsDirWriteable(fl_get_input(paths_->input_temp_dir)) - || !AbsolutePath(fl_get_input(paths_->input_temp_dir)))) { - activate = false; - lyxerr[Debug::GUI] << "Preferences: tmpdir is wrong\n"; - } - - // backupdir: not used - // || empty - // || writable dir - if (fl_get_button(paths_->check_make_backups) - && (!string(fl_get_input(paths_->input_backup_path)).empty() - && (1 != IsDirWriteable(fl_get_input(paths_-> - input_backup_path)) - || !AbsolutePath(fl_get_input(paths_-> - input_backup_path))))) { - activate = false; - lyxerr[Debug::GUI] << "Preferences: backupdir is wrong\n"; + if( success && !tp.writable() ) { + success = false; + str = N_("WARNING! Cannot write to this directory."); } - // lastfiles: exists && writeable - // || non-existent && isn't a dir -#ifdef WITH_WARNINGS -#warning incorrectly allows files in /, other tests might also do this -#endif - { - string lastfiles(fl_get_input(paths_->input_lastfiles)); - FileInfo lf(lastfiles); - if (!AbsolutePath(lastfiles) - || 1 != IsDirWriteable(OnlyPath(lastfiles)) - || (lf.exist() - && (lf.isDir() - || !lf.writable()))) { - activate = false; - lyxerr[Debug::GUI] << "Preferences: lastfiles is wrong\n"; - } + if( !success ) { + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); } + + return success; +} - // serverpipe: empty - // || non-existent && isn't a dir - // || exists && writeable - // remember we append .in and .out later - if (!string(fl_get_input(paths_->input_serverpipe)).empty()) { - string pipe(fl_get_input(paths_->input_serverpipe)); - FileInfo sp_in(pipe + ".in"); - FileInfo sp_out(pipe + ".out"); - if (!AbsolutePath(pipe) - || 1 != IsDirWriteable(OnlyPath(pipe)) - || (sp_in.exist() - && (!sp_in.writable() - || sp_in.isDir())) - || (sp_out.exist() - && (!sp_out.writable() - || sp_out.isDir()))) { - activate = false; - lyxerr[Debug::GUI] << "Preferences: Serverpipe is wrong\n"; - } + +bool FormPreferences::ReadableDir( string const & name ) const +{ + bool success = true; + string str; + + if( !AbsolutePath(name) ) { + success = false; + str = N_("WARNING! The absolute path is required."); } - // fontsizes -- tiny < script < footnote etc. - if (0.0 >= strToDbl(fl_get_input(screen_fonts_->input_tiny)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_script)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_footnote)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_small)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_normal)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_large)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_larger)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_largest)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huge)) - || 0.0 >= strToDbl(fl_get_input(screen_fonts_->input_huger))) { - // make sure they all have positive entries - // Also note that an empty entry is returned as 0.0 by strToDbl - activate = false; - lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n"; - } else if (strToDbl(fl_get_input(screen_fonts_->input_tiny)) > - strToDbl(fl_get_input(screen_fonts_->input_script)) || - strToDbl(fl_get_input(screen_fonts_->input_script)) > - strToDbl(fl_get_input(screen_fonts_->input_footnote)) || - strToDbl(fl_get_input(screen_fonts_->input_footnote)) > - strToDbl(fl_get_input(screen_fonts_->input_small)) || - strToDbl(fl_get_input(screen_fonts_->input_small)) > - strToDbl(fl_get_input(screen_fonts_->input_normal)) || - strToDbl(fl_get_input(screen_fonts_->input_normal)) > - strToDbl(fl_get_input(screen_fonts_->input_large)) || - strToDbl(fl_get_input(screen_fonts_->input_large)) > - strToDbl(fl_get_input(screen_fonts_->input_larger)) || - strToDbl(fl_get_input(screen_fonts_->input_larger)) > - strToDbl(fl_get_input(screen_fonts_->input_largest)) || - strToDbl(fl_get_input(screen_fonts_->input_largest)) > - strToDbl(fl_get_input(screen_fonts_->input_huge)) || - strToDbl(fl_get_input(screen_fonts_->input_huge)) > - strToDbl(fl_get_input(screen_fonts_->input_huger))) { - activate = false; - lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n"; + FileInfo tp(name); + if( success && !tp.isDir() ) { + success = false; + str = N_("WARNING! Directory does not exist."); } - if( ! inputSpellChecker() ) - activate = false; + if( success && !tp.readable() ) { + success = false; + str = N_("WARNING! Cannot read this directory."); + } - return activate; + if( !success ) { + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); + } + + return success; } -bool FormPreferences::inputSpellChecker() +bool FormPreferences::WriteableFile( string const & name, string const & suffix ) const { - // Allow/dissallow input + // A writeable file is either: + // * An existing file to which we have write access, or + // * A file that doesn't yet exist but that would exist in a writeable + // directory. - // If spell checker == "none", disable all input. - if( fl_get_choice(spellchecker_tab_->choice_spell_command) == 1 ) { - fl_deactivate_object( spellchecker_tab_->check_alt_lang ); - fl_deactivate_object( spellchecker_tab_->input_alt_lang ); - fl_deactivate_object( spellchecker_tab_->check_escape_chars ); - fl_deactivate_object( spellchecker_tab_->input_escape_chars ); - fl_deactivate_object( spellchecker_tab_->check_personal_dict ); - fl_deactivate_object( spellchecker_tab_->input_personal_dict ); - fl_deactivate_object( spellchecker_tab_->check_compound_words ); - fl_deactivate_object( spellchecker_tab_->check_input_enc ); - return true; - } else { - fl_activate_object( spellchecker_tab_->check_alt_lang ); - fl_activate_object( spellchecker_tab_->check_escape_chars ); - fl_activate_object( spellchecker_tab_->check_personal_dict ); - fl_activate_object( spellchecker_tab_->check_compound_words ); - fl_activate_object( spellchecker_tab_->check_input_enc ); - } - - if( fl_get_button(spellchecker_tab_->check_alt_lang) ) { - fl_activate_object(spellchecker_tab_->input_alt_lang); - fl_set_object_lcol(spellchecker_tab_->input_alt_lang, - FL_BLACK); - } else { - fl_deactivate_object(spellchecker_tab_->input_alt_lang); - fl_set_object_lcol(spellchecker_tab_->input_alt_lang, - FL_INACTIVE); - } + bool success = true; + string str; - if( fl_get_button(spellchecker_tab_->check_escape_chars) ) { - fl_activate_object(spellchecker_tab_->input_escape_chars); - fl_set_object_lcol(spellchecker_tab_->input_escape_chars, - FL_BLACK); - } else { - fl_deactivate_object(spellchecker_tab_->input_escape_chars); - fl_set_object_lcol(spellchecker_tab_->input_escape_chars, - FL_INACTIVE); + if( name.empty() ) { + success = false; + str = N_("WARNING! No file input."); } - if( fl_get_button(spellchecker_tab_->check_personal_dict) ) { - fl_activate_object(spellchecker_tab_->input_personal_dict); - fl_set_object_lcol(spellchecker_tab_->input_personal_dict, - FL_BLACK); - } else { - fl_deactivate_object(spellchecker_tab_->input_personal_dict); - fl_set_object_lcol(spellchecker_tab_->input_personal_dict, - FL_INACTIVE); + string dir = OnlyPath(name); + if( success && !AbsolutePath(dir) ) { + success = false; + str = N_("WARNING! The absolute path is required."); } - return true; // all input is valid! -} - + FileInfo d; + { + FileInfo d1(dir); + FileInfo d2(name); + if( d2.isDir() ) + d = d2; + else + d = d1; + } + + if( success && !d.isDir()) { + success = false; + str = N_("WARNING! Directory does not exist."); + } + + if( success && !d.writable() ) { + success = false; + str = N_("WARNING! Cannot write to this directory."); + } -void FormPreferences::ok() -{ - FormBase::ok(); - lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES); -} + FileInfo f(name+suffix); + if( success && (dir == name || f.isDir()) ) { + success = false; + str = N_("WARNING! A file is required, not a directory."); + } + if( success && (f.exist() && !f.writable()) ) { + success = false; + str = N_("WARNING! Cannot write to this file."); + } + + if( !success ) { + fl_set_object_label(dialog_->text_warning, str.c_str()); + fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE); + } -void FormPreferences::restore() -{ - update(); -// if I add an error message line to the dialog it'll have to be controlled -// within input(). I don't need it yet so I'll leave it commented out. -// bc_.valid(input(0)); + return success; } diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index a3401e7bf0..3743dd8d94 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -27,14 +27,16 @@ class LyXView; class Dialogs; struct FD_form_preferences; -struct FD_form_lnf_general; +struct FD_form_lnf_misc; struct FD_form_screen_fonts; struct FD_form_interface; struct FD_form_printer; struct FD_form_paths; struct FD_form_outer_tab; -struct FD_form_outputs_general; +struct FD_form_outputs_misc; struct FD_form_spellchecker; +struct FD_form_language; +struct FD_form_colours; /** This class provides an XForms implementation of the FormPreferences Dialog. The preferences dialog allows users to set/save their preferences. @@ -46,6 +48,29 @@ public: /// ~FormPreferences(); private: + /// + enum State { + /// + COLOURS, + /// + INTERFACE, + /// + LANGUAGE, + /// + LOOKNFEELMISC, + /// + OUTPUTSMISC, + /// + PATHS, + /// + PRINTER, + /// + SCREENFONTS, + /// + SPELLCHECKER, + /// + TABS + }; /// Update the dialog. virtual void update(); /// @@ -63,27 +88,99 @@ private: /// virtual FL_FORM * form() const; /// + void applyInterface(); + /// + void applyLnFmisc(); + /// + void applyOutputsMisc(); + /// + void applyPaths(); + /// + void applyPrinter(); + /// + void applyScreenFonts(); + /// void applySpellChecker(); /// + void buildColours(); + /// + void buildInterface(); + /// + void buildLanguage(); + /// + void buildLnFmisc(); + /// + void buildOutputsMisc(); + /// + void buildPaths(); + /// + void buildPrinter(); + /// + void buildScreenFonts(); + /// + void buildSpellchecker(); + /// + void feedbackInterface(FL_OBJECT const * const); + /// + void feedbackLnFmisc(FL_OBJECT const * const); + /// + void feedbackOutputsMisc(FL_OBJECT const * const); + /// + void feedbackPaths(FL_OBJECT const * const); + /// + void feedbackPrinter(FL_OBJECT const * const); + /// + void feedbackScreenFonts(FL_OBJECT const * const); + /// + void feedbackSpellChecker(FL_OBJECT const * const); + /// + bool inputPaths(FL_OBJECT const * const); + /// + bool inputScreenFonts(); + /// + bool inputSpellChecker(FL_OBJECT const * const); + /// + void updateInterface(); + /// + void updateLnFmisc(); + /// + void updateOutputsMisc(); + /// + void updatePaths(); + /// + void updatePrinter(); + /// + void updateScreenFonts(); + /// void updateSpellChecker(); + /// - bool inputSpellChecker(); + bool WriteableDir( string const & ) const; + /// + bool ReadableDir( string const & ) const; + /// + bool WriteableFile( string const &, string const & = string() ) const; + /// FD_form_preferences * build_preferences(); /// FD_form_outer_tab * build_outer_tab(); /// - FD_form_lnf_general * build_lnf_general(); - /// - FD_form_screen_fonts * build_screen_fonts(); + FD_form_colours * build_colours(); /// FD_form_interface * build_interface(); /// - FD_form_printer * build_printer(); + FD_form_language * build_language(); + /// + FD_form_lnf_misc * build_lnf_misc(); + /// + FD_form_outputs_misc * build_outputs_misc(); /// FD_form_paths * build_paths(); /// - FD_form_outputs_general * build_outputs_general(); + FD_form_printer * build_printer(); + /// + FD_form_screen_fonts * build_screen_fonts(); /// FD_form_spellchecker * build_spellchecker(); @@ -95,20 +192,26 @@ private: FD_form_outer_tab * look_n_feel_tab_; /// reLyX and other import/input stuff FD_form_outer_tab * inputs_tab_; + /// Spellchecker, language stuff, etc + FD_form_outer_tab * usage_tab_; /// - FD_form_spellchecker * spellchecker_tab_; + FD_form_colours * colours_; /// - FD_form_lnf_general * lnf_general_; + FD_form_interface * interface_; /// - FD_form_screen_fonts * screen_fonts_; + FD_form_language * language_; /// - FD_form_interface * interface_; + FD_form_lnf_misc * lnf_misc_; /// - FD_form_printer * printer_; + FD_form_outputs_misc * outputs_misc_; /// FD_form_paths * paths_; /// - FD_form_outputs_general * outputs_general_; + FD_form_printer * printer_; + /// + FD_form_screen_fonts * screen_fonts_; + /// + FD_form_spellchecker * spellchecker_; }; #endif diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 8acdaa6502..fafb1475ec 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -30,6 +30,9 @@ using std::sort; using std::vector; +static int const minw_hb = 250; +static int minw_sb; + FormRef::FormRef(LyXView * lv, Dialogs * d) : FormCommand(lv, d, _("Reference")), toggle(GOBACK), dialog_(0) { @@ -78,6 +81,7 @@ void FormRef::build() // Workaround dumb xforms sizing bug minw_ = form()->w; minh_ = form()->h; + minw_sb = minw_; // Name is irrelevant to LaTeX documents if ( lv_->buffer()->isLatex() ) { @@ -156,7 +160,7 @@ void FormRef::showBrowser() const fl_show_object( dialog_->button_update ); fl_show_object( dialog_->sort ); - setSize( minw_, minh_, 0 ); + setSize( minw_sb, 0 ); fl_deactivate_object( dialog_->type ); fl_set_object_lcol( dialog_->type, FL_INACTIVE ); @@ -173,7 +177,7 @@ void FormRef::hideBrowser() const fl_hide_object( dialog_->button_update ); fl_hide_object( dialog_->sort ); - setSize( 250, minh_, 280 ); + setSize( minw_hb, 280 ); fl_activate_object( dialog_->type ); fl_set_object_lcol( dialog_->type, FL_BLACK ); @@ -184,7 +188,7 @@ void FormRef::hideBrowser() const } -void FormRef::setSize( int w, int h, int dx ) const +void FormRef::setSize( int w, int dx ) const { static int x1 = dialog_->name->x; static int y1 = dialog_->name->y; @@ -201,7 +205,6 @@ void FormRef::setSize( int w, int h, int dx ) const if ( form()->w != w ) { minw_ = w; - minh_ = h; fl_set_form_size( form(), minw_, minh_ ); } else return; diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index f314d837fd..98a718a13e 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -74,7 +74,7 @@ private: /// void hideBrowser() const; /// - void setSize( int, int, int ) const; + void setSize( int, int ) const; /// FD_form_ref * build_ref(); /// diff --git a/src/frontends/xforms/form_preferences.C b/src/frontends/xforms/form_preferences.C index 9324279ede..fd3680129f 100644 --- a/src/frontends/xforms/form_preferences.C +++ b/src/frontends/xforms/form_preferences.C @@ -27,6 +27,7 @@ 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); @@ -70,6 +71,7 @@ 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; @@ -95,17 +97,17 @@ FD_form_screen_fonts * FormPreferences::build_screen_fonts() obj = fl_add_box(FL_FLAT_BOX, 0, 0, 455, 375, ""); fdui->input_roman = obj = fl_add_input(FL_NORMAL_INPUT, 210, 5, 200, 30, _("Roman")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_sans = obj = fl_add_input(FL_NORMAL_INPUT, 210, 35, 200, 30, _("Sans Serif")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); 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, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->counter_zoom = obj = fl_add_counter(FL_SIMPLE_COUNTER, 210, 125, 200, 30, _("%")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_RIGHT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + 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); @@ -113,41 +115,41 @@ FD_form_screen_fonts * FormPreferences::build_screen_fonts() fdui->check_scalable = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 168, 125, 33, 31, _("Allow scaling")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + 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, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_tiny = obj = fl_add_input(FL_FLOAT_INPUT, 140, 165, 70, 30, _("tiny")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_script = obj = fl_add_input(FL_FLOAT_INPUT, 340, 165, 70, 30, _("script")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_footnote = obj = fl_add_input(FL_FLOAT_INPUT, 140, 195, 70, 30, _("footnote")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_small = obj = fl_add_input(FL_FLOAT_INPUT, 340, 195, 70, 30, _("small")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_large = obj = fl_add_input(FL_FLOAT_INPUT, 340, 225, 70, 30, _("large")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_larger = obj = fl_add_input(FL_FLOAT_INPUT, 140, 255, 70, 30, _("larger")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_largest = obj = fl_add_input(FL_FLOAT_INPUT, 340, 255, 70, 30, _("largest")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_normal = obj = fl_add_input(FL_FLOAT_INPUT, 140, 225, 70, 30, _("normal")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_huge = obj = fl_add_input(FL_FLOAT_INPUT, 140, 285, 70, 30, _("huge")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fdui->input_huger = obj = fl_add_input(FL_FLOAT_INPUT, 340, 285, 70, 30, _("huger")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SCREENFONTS); fl_end_form(); fdui->form->fdui = fdui; @@ -156,17 +158,17 @@ FD_form_screen_fonts * FormPreferences::build_screen_fonts() } /*---------------------------------------*/ -FD_form_outputs_general::~FD_form_outputs_general() +FD_form_outputs_misc::~FD_form_outputs_misc() { if( form->visible ) fl_hide_form( form ); fl_free_form( form ); } -FD_form_outputs_general * FormPreferences::build_outputs_general() +FD_form_outputs_misc * FormPreferences::build_outputs_misc() { FL_OBJECT *obj; - FD_form_outputs_general *fdui = new FD_form_outputs_general; + FD_form_outputs_misc *fdui = new FD_form_outputs_misc; fdui->form = fl_bgn_form(FL_NO_BOX, 455, 375); fdui->form->u_vdata = this; @@ -175,16 +177,17 @@ FD_form_outputs_general * FormPreferences::build_outputs_general() fl_set_button_shortcut(obj, scex(_("Ascii line length|#A")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, OUTPUTSMISC); fl_set_counter_precision(obj, 0); fl_set_counter_bounds(obj, 0, 120); fl_set_counter_value(obj, 75); fl_set_counter_step(obj, 1, 1); fdui->input_tex_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 216, 95, 200, 30, _("TeX encoding")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, OUTPUTSMISC); fdui->choice_default_papersize = obj = fl_add_choice(FL_NORMAL_CHOICE, 217, 142, 199, 29, _("Default paper size")); fl_set_object_boxtype(obj, FL_FRAME_BOX); + fl_set_object_callback(obj, C_FormBaseInputCB, OUTPUTSMISC); fl_end_form(); fdui->form->fdui = fdui; @@ -205,43 +208,50 @@ FD_form_spellchecker * FormPreferences::build_spellchecker() FL_OBJECT *obj; FD_form_spellchecker *fdui = new FD_form_spellchecker; - fdui->form = fl_bgn_form(FL_NO_BOX, 450, 375); + 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, 375, ""); - fdui->choice_spell_command = obj = fl_add_choice(FL_NORMAL_CHOICE, 141, 47, 171, 34, _("Spell command")); + obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 360, ""); + fdui->choice_spell_command = obj = fl_add_choice(FL_NORMAL_CHOICE, 141, 47, 171, 34, idex(_("Spell command|#S"))); + fl_set_button_shortcut(obj, scex(_("Spell command|#S")), 1); fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_TOP); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->check_alt_lang = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 208, 100, 30, 30, _("Use alternative language")); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); + fdui->check_alt_lang = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 208, 100, 30, 30, idex(_("Use alternative language|#a"))); + fl_set_button_shortcut(obj, scex(_("Use alternative language|#a")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); fdui->input_alt_lang = obj = fl_add_input(FL_NORMAL_INPUT, 239, 100, 170, 30, ""); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->check_escape_chars = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 208, 130, 30, 30, _("Use escape characters")); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); + fdui->check_escape_chars = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 208, 130, 30, 30, idex(_("Use escape characters|#e"))); + fl_set_button_shortcut(obj, scex(_("Use escape characters|#e")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); fdui->input_escape_chars = obj = fl_add_input(FL_NORMAL_INPUT, 239, 130, 170, 30, ""); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->check_personal_dict = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 208, 160, 30, 30, _("Use personal dictionary")); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); + fdui->check_personal_dict = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 208, 160, 30, 30, idex(_("Use personal dictionary|#d"))); + fl_set_button_shortcut(obj, scex(_("Use personal dictionary|#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, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); fdui->input_personal_dict = obj = fl_add_input(FL_NORMAL_INPUT, 239, 160, 170, 30, ""); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->button_personal_dict = obj = fl_add_button(FL_NORMAL_BUTTON, 239, 190, 89, 30, _("Browse...")); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); + fdui->button_personal_dict = obj = fl_add_button(FL_NORMAL_BUTTON, 239, 190, 89, 30, idex(_("Browse...|#B"))); + fl_set_button_shortcut(obj, scex(_("Browse...|#B")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->check_compound_words = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 130, 230, 30, 30, _("Accept compound words")); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); + fdui->check_compound_words = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 130, 230, 30, 30, idex(_("Accept compound words|#w"))); + fl_set_button_shortcut(obj, scex(_("Accept compound words|#w")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_RIGHT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->check_input_enc = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 130, 260, 30, 30, _("Use input encoding")); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); + fdui->check_input_enc = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 130, 260, 30, 30, idex(_("Use input encoding|#i"))); + fl_set_button_shortcut(obj, scex(_("Use input encoding|#i")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_RIGHT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, SPELLCHECKER); fl_end_form(); fdui->form->fdui = fdui; @@ -250,17 +260,63 @@ FD_form_spellchecker * FormPreferences::build_spellchecker() } /*---------------------------------------*/ -FD_form_lnf_general::~FD_form_lnf_general() +FD_form_language::~FD_form_language() { if( form->visible ) fl_hide_form( form ); fl_free_form( form ); } -FD_form_lnf_general * FormPreferences::build_lnf_general() +FD_form_language * FormPreferences::build_language() { FL_OBJECT *obj; - FD_form_lnf_general *fdui = new FD_form_lnf_general; + FD_form_language *fdui = new FD_form_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, ""); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_colours::~FD_form_colours() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_colours * FormPreferences::build_colours() +{ + FL_OBJECT *obj; + FD_form_colours *fdui = new FD_form_colours; + + 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, ""); + fl_end_form(); + + fdui->form->fdui = fdui; + + return fdui; +} +/*---------------------------------------*/ + +FD_form_lnf_misc::~FD_form_lnf_misc() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + +FD_form_lnf_misc * FormPreferences::build_lnf_misc() +{ + FL_OBJECT *obj; + FD_form_lnf_misc *fdui = new FD_form_lnf_misc; fdui->form = fl_bgn_form(FL_NO_BOX, 450, 350); fdui->form->u_vdata = this; @@ -268,26 +324,26 @@ FD_form_lnf_general * FormPreferences::build_lnf_general() fdui->check_banner = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 15, 310, 30, idex(_("Show banner|#S"))); fl_set_button_shortcut(obj, scex(_("Show banner|#S")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_button(obj, 1); fdui->check_auto_region_delete = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 45, 310, 30, idex(_("Auto region delete|#A"))); fl_set_button_shortcut(obj, scex(_("Auto region delete|#A")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_button(obj, 1); fdui->check_exit_confirm = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 75, 310, 30, idex(_("Exit confirmation|#E"))); fl_set_button_shortcut(obj, scex(_("Exit confirmation|#E")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_button(obj, 1); fdui->check_display_shortcuts = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 105, 310, 30, _("Display keyboard shortcuts")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_button(obj, 1); fdui->counter_autosave = obj = fl_add_counter(FL_SIMPLE_COUNTER, 320, 255, 115, 30, _("Autosave interval")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_counter_precision(obj, 0); fl_set_counter_bounds(obj, 0, 1200); fl_set_counter_value(obj, 300); @@ -295,17 +351,17 @@ FD_form_lnf_general * FormPreferences::build_lnf_general() fdui->check_ask_new_file = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 135, 310, 30, idex(_("File->New asks for name|#N"))); fl_set_button_shortcut(obj, scex(_("File->New asks for name|#N")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_button(obj, 1); fdui->check_cursor_follows_scrollbar = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 15, 165, 310, 30, idex(_("Cursor follows scrollbar|#C"))); fl_set_button_shortcut(obj, scex(_("Cursor follows scrollbar|#C")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_button(obj, 1); fdui->counter_wm_jump = obj = fl_add_counter(FL_SIMPLE_COUNTER, 320, 225, 115, 30, _("Wheel mouse jump")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, LOOKNFEELMISC); fl_set_counter_precision(obj, 0); fl_set_counter_bounds(obj, 0, 250); fl_set_counter_value(obj, 100); @@ -335,29 +391,29 @@ FD_form_interface * FormPreferences::build_interface() obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 350, ""); fdui->input_popup_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 30, 200, 30, _("Popup Font")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, INTERFACE); fdui->input_menu_font = obj = fl_add_input(FL_NORMAL_INPUT, 230, 60, 200, 30, _("Menu Font")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, INTERFACE); fdui->input_popup_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 230, 90, 200, 30, _("Popup Encoding")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, INTERFACE); fdui->input_bind_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 178, 190, 30, idex(_("Bind file|#B"))); fl_set_button_shortcut(obj, scex(_("Bind file|#B")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, INTERFACE); fdui->button_bind_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 178, 80, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->input_ui_file = obj = fl_add_input(FL_NORMAL_INPUT, 160, 148, 190, 30, idex(_("User Interface file|#U"))); fl_set_button_shortcut(obj, scex(_("User Interface file|#U")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, INTERFACE); fdui->button_ui_file_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 148, 80, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->check_override_x_dead_keys = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 24, 230, 310, 30, idex(_("Override X-Windows dead-keys|#O"))); fl_set_button_shortcut(obj, scex(_("Override X-Windows dead-keys|#O")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, INTERFACE); fl_set_button(obj, 1); fl_end_form(); @@ -384,58 +440,58 @@ FD_form_printer * FormPreferences::build_printer() obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 350, ""); fdui->input_command = obj = fl_add_input(FL_NORMAL_INPUT, 130, 75, 80, 30, _("command")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_page_range = obj = fl_add_input(FL_NORMAL_INPUT, 130, 105, 80, 30, _("page range")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_copies = obj = fl_add_input(FL_NORMAL_INPUT, 130, 135, 80, 30, _("copies")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_reverse = obj = fl_add_input(FL_NORMAL_INPUT, 130, 165, 80, 30, _("reverse")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_to_printer = obj = fl_add_input(FL_NORMAL_INPUT, 130, 195, 80, 30, _("to printer")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_file_extension = obj = fl_add_input(FL_NORMAL_INPUT, 130, 225, 80, 30, _("file extension")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_spool_command = obj = fl_add_input(FL_NORMAL_INPUT, 130, 255, 80, 30, _("spool command")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_paper_type = obj = fl_add_input(FL_NORMAL_INPUT, 130, 285, 80, 30, _("paper type")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_even_pages = obj = fl_add_input(FL_NORMAL_INPUT, 360, 75, 80, 30, _("even pages")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_odd_pages = obj = fl_add_input(FL_NORMAL_INPUT, 360, 105, 80, 30, _("odd pages")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_collated = obj = fl_add_input(FL_NORMAL_INPUT, 360, 135, 80, 30, _("collated")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_landscape = obj = fl_add_input(FL_NORMAL_INPUT, 360, 165, 80, 30, _("landscape")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_to_file = obj = fl_add_input(FL_NORMAL_INPUT, 360, 195, 80, 30, _("to file")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_extra_options = obj = fl_add_input(FL_NORMAL_INPUT, 360, 225, 80, 30, _("extra options")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_spool_prefix = obj = fl_add_input(FL_NORMAL_INPUT, 360, 255, 80, 30, _("spool printer prefix")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_paper_size = obj = fl_add_input(FL_NORMAL_INPUT, 360, 285, 80, 30, _("paper size")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 130, 10, 80, 30, _("name")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); fdui->check_adapt_output = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 240, 10, 120, 30, _("adapt output")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PRINTER); obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 0, 60, 452, 260, _("Printer Command and Flags")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_form(); @@ -461,58 +517,65 @@ FD_form_paths * FormPreferences::build_paths() fdui->form = fl_bgn_form(FL_NO_BOX, 450, 350); fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 350, ""); - fdui->input_default_path = obj = fl_add_input(FL_NORMAL_INPUT, 170, 10, 170, 30, _("Default path")); + fdui->input_default_path = obj = fl_add_input(FL_NORMAL_INPUT, 170, 10, 170, 30, idex(_("Default path|#p"))); + fl_set_button_shortcut(obj, scex(_("Default path|#p")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fdui->button_document_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 10, 90, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->counter_lastfiles = obj = fl_add_counter(FL_SIMPLE_COUNTER, 170, 130, 90, 30, _("Last file count")); + fdui->counter_lastfiles = obj = fl_add_counter(FL_SIMPLE_COUNTER, 170, 130, 90, 30, idex(_("Last file count|#L"))); + fl_set_button_shortcut(obj, scex(_("Last file count|#L")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fl_set_counter_precision(obj, 0); fl_set_counter_bounds(obj, 0, 9); fl_set_counter_value(obj, 4); fl_set_counter_step(obj, 1, 1); - fdui->input_template_path = obj = fl_add_input(FL_NORMAL_INPUT, 170, 40, 170, 30, _("Template path")); + fdui->input_template_path = obj = fl_add_input(FL_NORMAL_INPUT, 170, 40, 170, 30, idex(_("Template path|#T"))); + fl_set_button_shortcut(obj, scex(_("Template path|#T")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fdui->button_template_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 40, 90, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->check_last_files = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 134, 100, 30, 30, _("Check last files")); + fdui->check_last_files = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 134, 100, 30, 30, idex(_("Check last files|#C"))); + fl_set_button_shortcut(obj, scex(_("Check last files|#C")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fl_set_button(obj, 1); fdui->button_temp_dir_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 70, 90, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->input_lastfiles = obj = fl_add_input(FL_NORMAL_INPUT, 170, 100, 170, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fdui->button_lastfiles_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 100, 90, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->check_make_backups = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 134, 170, 30, 30, _("Backup path")); + fdui->check_make_backups = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 134, 170, 30, 30, idex(_("Backup path|#B"))); + fl_set_button_shortcut(obj, scex(_("Backup path|#B")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fl_set_button(obj, 1); fdui->input_backup_path = obj = fl_add_input(FL_NORMAL_INPUT, 170, 170, 170, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fdui->button_backup_path_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 340, 170, 90, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fdui->input_serverpipe = obj = fl_add_input(FL_NORMAL_INPUT, 169, 217, 170, 30, _("LyXServer pipe")); + fdui->input_serverpipe = obj = fl_add_input(FL_NORMAL_INPUT, 169, 217, 170, 30, idex(_("LyXServer pipe|#S"))); + fl_set_button_shortcut(obj, scex(_("LyXServer pipe|#S")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fdui->button_serverpipe_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 339, 217, 90, 30, _("Browse...")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fdui->input_temp_dir = obj = fl_add_input(FL_NORMAL_INPUT, 170, 70, 170, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseInputCB, 0); - fdui->check_use_temp_dir = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 134, 70, 30, 30, _("Temp dir")); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); + fdui->check_use_temp_dir = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 134, 70, 30, 30, idex(_("Temp dir|#d"))); + fl_set_button_shortcut(obj, scex(_("Temp dir|#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, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, PATHS); fl_set_button(obj, 1); fl_end_form(); diff --git a/src/frontends/xforms/form_preferences.h b/src/frontends/xforms/form_preferences.h index 7fb946baae..13407b9f67 100644 --- a/src/frontends/xforms/form_preferences.h +++ b/src/frontends/xforms/form_preferences.h @@ -5,11 +5,13 @@ #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); @@ -17,6 +19,8 @@ extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); + + extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); @@ -65,8 +69,8 @@ struct FD_form_screen_fonts { FL_OBJECT *input_huge; FL_OBJECT *input_huger; }; -struct FD_form_outputs_general { - ~FD_form_outputs_general(); +struct FD_form_outputs_misc { + ~FD_form_outputs_misc(); FL_FORM *form; FL_OBJECT *counter_line_len; @@ -88,8 +92,18 @@ struct FD_form_spellchecker { FL_OBJECT *check_compound_words; FL_OBJECT *check_input_enc; }; -struct FD_form_lnf_general { - ~FD_form_lnf_general(); +struct FD_form_language { + ~FD_form_language(); + + FL_FORM *form; +}; +struct FD_form_colours { + ~FD_form_colours(); + + FL_FORM *form; +}; +struct FD_form_lnf_misc { + ~FD_form_lnf_misc(); FL_FORM *form; FL_OBJECT *check_banner; diff --git a/src/frontends/xforms/forms/form_preferences.fd b/src/frontends/xforms/forms/form_preferences.fd index 0ca904243c..febdaf0264 100644 --- a/src/frontends/xforms/forms/form_preferences.fd +++ b/src/frontends/xforms/forms/form_preferences.fd @@ -3,7 +3,7 @@ Magic: 13000 Internal Form Definition File (do not change) -Number of forms: 9 +Number of forms: 11 Unit of measure: FL_COORD_PIXEL SnapGrid: 1 @@ -46,8 +46,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: tabfolder_prefs -callback: -argument: +callback: C_FormBaseInputCB +argument: TABS -------------------- class: FL_BUTTON @@ -196,8 +196,8 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: tabfolder_outer -callback: -argument: +callback: C_FormBaseInputCB +argument: TABS =============== FORM =============== Name: form_screen_fonts @@ -239,7 +239,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_roman callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -257,7 +257,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_sans callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -275,7 +275,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_typewriter callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_COUNTER @@ -293,7 +293,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: counter_zoom callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS bounds: 0 999 precision: 0 value: 150 @@ -315,7 +315,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_scalable callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS value: 1 -------------------- @@ -334,7 +334,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_screen_encoding callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -352,7 +352,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_tiny callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -370,7 +370,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_script callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -388,7 +388,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_footnote callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -406,7 +406,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_small callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -424,7 +424,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_large callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -442,7 +442,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_larger callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -460,7 +460,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_largest callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -478,7 +478,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_normal callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -496,7 +496,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_huge callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS -------------------- class: FL_INPUT @@ -514,10 +514,10 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_huger callback: C_FormBaseInputCB -argument: 0 +argument: SCREENFONTS =============== FORM =============== -Name: form_outputs_general +Name: form_outputs_misc Width: 455 Height: 375 Number of Objects: 4 @@ -556,7 +556,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: counter_line_len callback: C_FormBaseInputCB -argument: 0 +argument: OUTPUTSMISC bounds: 0 120 precision: 0 value: 75 @@ -578,7 +578,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_tex_encoding callback: C_FormBaseInputCB -argument: 0 +argument: OUTPUTSMISC -------------------- class: FL_CHOICE @@ -595,19 +595,19 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_default_papersize -callback: -argument: +callback: C_FormBaseInputCB +argument: OUTPUTSMISC =============== FORM =============== Name: form_spellchecker Width: 450 -Height: 375 +Height: 360 Number of Objects: 11 -------------------- class: FL_BOX type: FLAT_BOX -box: 0 0 450 375 +box: 0 0 450 360 boxtype: FL_FLAT_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -632,13 +632,13 @@ alignment: FL_ALIGN_TOP style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Spell command +label: Spell command|#S shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_spell_command callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_CHECKBUTTON @@ -650,13 +650,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Use alternative language +label: Use alternative language|#a shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_alt_lang callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_INPUT @@ -674,7 +674,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_alt_lang callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_CHECKBUTTON @@ -686,13 +686,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Use escape characters +label: Use escape characters|#e shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_escape_chars callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_INPUT @@ -710,7 +710,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_escape_chars callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_CHECKBUTTON @@ -722,13 +722,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Use personal dictionary +label: Use personal dictionary|#d shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_personal_dict callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_INPUT @@ -746,7 +746,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_personal_dict callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_BUTTON @@ -758,13 +758,13 @@ alignment: FL_ALIGN_CENTER style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Browse... +label: Browse...|#B shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_personal_dict callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_CHECKBUTTON @@ -776,13 +776,13 @@ alignment: FL_ALIGN_RIGHT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Accept compound words +label: Accept compound words|#w shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_compound_words callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER -------------------- class: FL_CHECKBUTTON @@ -794,16 +794,64 @@ alignment: FL_ALIGN_RIGHT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Use input encoding +label: Use input encoding|#i shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_input_enc callback: C_FormBaseInputCB -argument: 0 +argument: SPELLCHECKER + +=============== FORM =============== +Name: form_language +Width: 450 +Height: 360 +Number of Objects: 1 + +-------------------- +class: FL_BOX +type: FLAT_BOX +box: 0 0 450 360 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +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: +callback: +argument: =============== FORM =============== -Name: form_lnf_general +Name: form_colours +Width: 450 +Height: 360 +Number of Objects: 1 + +-------------------- +class: FL_BOX +type: FLAT_BOX +box: 0 0 450 360 +boxtype: FL_FLAT_BOX +colors: FL_COL1 FL_COL1 +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: +callback: +argument: + +=============== FORM =============== +Name: form_lnf_misc Width: 450 Height: 350 Number of Objects: 9 @@ -842,7 +890,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_banner callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC value: 1 -------------------- @@ -861,7 +909,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_auto_region_delete callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC value: 1 -------------------- @@ -880,7 +928,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_exit_confirm callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC value: 1 -------------------- @@ -899,7 +947,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_display_shortcuts callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC value: 1 -------------------- @@ -918,7 +966,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: counter_autosave callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC bounds: 0 1200 precision: 0 value: 300 @@ -940,7 +988,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_ask_new_file callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC value: 1 -------------------- @@ -959,7 +1007,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_cursor_follows_scrollbar callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC value: 1 -------------------- @@ -978,7 +1026,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: counter_wm_jump callback: C_FormBaseInputCB -argument: 0 +argument: LOOKNFEELMISC bounds: 0 250 precision: 0 value: 100 @@ -1024,7 +1072,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_popup_font callback: C_FormBaseInputCB -argument: 0 +argument: INTERFACE -------------------- class: FL_INPUT @@ -1042,7 +1090,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_menu_font callback: C_FormBaseInputCB -argument: 0 +argument: INTERFACE -------------------- class: FL_INPUT @@ -1060,7 +1108,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_popup_encoding callback: C_FormBaseInputCB -argument: 0 +argument: INTERFACE -------------------- class: FL_INPUT @@ -1078,7 +1126,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_bind_file callback: C_FormBaseInputCB -argument: 0 +argument: INTERFACE -------------------- class: FL_BUTTON @@ -1114,7 +1162,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_ui_file callback: C_FormBaseInputCB -argument: 0 +argument: INTERFACE -------------------- class: FL_BUTTON @@ -1150,7 +1198,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_override_x_dead_keys callback: C_FormBaseInputCB -argument: 0 +argument: INTERFACE value: 1 =============== FORM =============== @@ -1193,7 +1241,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_command callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1211,7 +1259,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_page_range callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1229,7 +1277,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_copies callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1247,7 +1295,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_reverse callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1265,7 +1313,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_to_printer callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1283,7 +1331,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_file_extension callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1301,7 +1349,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_spool_command callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1319,7 +1367,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_paper_type callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1337,7 +1385,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_even_pages callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1355,7 +1403,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_odd_pages callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1373,7 +1421,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_collated callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1391,7 +1439,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_landscape callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1409,7 +1457,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_to_file callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1427,7 +1475,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_extra_options callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1445,7 +1493,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_spool_prefix callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1463,7 +1511,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_paper_size callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_INPUT @@ -1481,7 +1529,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_name callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_CHECKBUTTON @@ -1499,7 +1547,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_adapt_output callback: C_FormBaseInputCB -argument: 0 +argument: PRINTER -------------------- class: FL_LABELFRAME @@ -1553,13 +1601,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Default path +label: Default path|#p shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_default_path callback: C_FormBaseInputCB -argument: 0 +argument: PATHS -------------------- class: FL_BUTTON @@ -1589,13 +1637,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Last file count +label: Last file count|#L shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: counter_lastfiles callback: C_FormBaseInputCB -argument: 0 +argument: PATHS bounds: 0 9 precision: 0 value: 4 @@ -1611,13 +1659,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Template path +label: Template path|#T shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_template_path callback: C_FormBaseInputCB -argument: 0 +argument: PATHS -------------------- class: FL_BUTTON @@ -1647,13 +1695,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Check last files +label: Check last files|#C shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_last_files callback: C_FormBaseInputCB -argument: 0 +argument: PATHS value: 1 -------------------- @@ -1690,7 +1738,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_lastfiles callback: C_FormBaseInputCB -argument: 0 +argument: PATHS -------------------- class: FL_BUTTON @@ -1720,13 +1768,13 @@ alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Backup path +label: Backup path|#B shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_make_backups callback: C_FormBaseInputCB -argument: 0 +argument: PATHS value: 1 -------------------- @@ -1745,7 +1793,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_backup_path callback: C_FormBaseInputCB -argument: 0 +argument: PATHS -------------------- class: FL_BUTTON @@ -1775,13 +1823,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: LyXServer pipe +label: LyXServer pipe|#S shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_serverpipe callback: C_FormBaseInputCB -argument: 0 +argument: PATHS -------------------- class: FL_BUTTON @@ -1817,7 +1865,7 @@ resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_temp_dir callback: C_FormBaseInputCB -argument: 0 +argument: PATHS -------------------- class: FL_CHECKBUTTON @@ -1829,13 +1877,13 @@ alignment: FL_ALIGN_LEFT style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Temp dir +label: Temp dir|#d shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_use_temp_dir callback: C_FormBaseInputCB -argument: 0 +argument: PATHS value: 1 ============================== diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index bed00cf7c8..82eec2b119 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -937,9 +937,9 @@ int InsetTabular::Linuxdoc(Buffer const *, ostream &) const } -int InsetTabular::DocBook(Buffer const *, ostream &) const +int InsetTabular::DocBook(Buffer const * buf, ostream & os) const { - return 0; + return tabular->DocBook(buf,os); } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 3938da614a..e4094c7c87 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1091,6 +1091,22 @@ int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const } +int InsetText::DocBook(Buffer const * buf, ostream & os) const +{ + LyXParagraph * p = par; + unsigned int lines = 0; + int desc=0; + + string tmp; + while (p) { + buf->SimpleDocBookOnePar(os,tmp,p,desc,0); + p = p->next; + } + + return lines; +} + + void InsetText::Validate(LaTeXFeatures & features) const { LyXParagraph * p = par; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 349caf60ea..cfa525aea5 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -130,7 +130,7 @@ public: /// int Linuxdoc(Buffer const *, std::ostream &) const { return 0; } /// - int DocBook(Buffer const *, std::ostream &) const { return 0; } + int DocBook(Buffer const *, std::ostream &) const ; /// void Validate(LaTeXFeatures & features) const; /// diff --git a/src/tabular.C b/src/tabular.C index 38441ab2df..bff92ff888 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -2247,6 +2247,96 @@ 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; + + for (int i = 0; i < columns_; ++i) { + os << "" << endl; + ++ret; + } + + //+--------------------------------------------------------------------- + //+ the single row and columns (cells) + + //+--------------------------------------------------------------------- + + os << "" << endl; + for(int i = 0; i < rows_; ++i) { + os << "" << endl; + for(int j = 0; j < columns_; ++j) { + if (IsPartOfMultiColumn(i,j)) + continue; + + os << ""; + ret += GetCellInset(cell)->DocBook(buf, os); + os << ""; + ++cell; + } + os << "" << endl; + } + os << "" << endl; + //+--------------------------------------------------------------------- + //+ the closing of the tabular + + //+--------------------------------------------------------------------- + + os << ""; + ++ret; + + return ret; +} + + static void print_n_chars(ostream & os, unsigned char ch, int const n) { for(int i=0; i < n; ++i) diff --git a/src/tabular.h b/src/tabular.h index c74ef8ee19..9e93003673 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -280,6 +280,8 @@ public: /// int Latex(Buffer const *, std::ostream &, bool, bool) const; /// + int DocBook(Buffer const * buf, std::ostream & os) const; + /// // helper function for Latex returns number of newlines /// int AsciiTopHLine(std::ostream &, int row, -- 2.39.2