2000-06-12 11:55:12 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* This file copyright 1999-2000
|
|
|
|
* Allan Rae
|
|
|
|
*======================================================*/
|
|
|
|
/* FormPreferences.h
|
|
|
|
* FormPreferences Interface Class
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FORMPREFERENCES_H
|
|
|
|
#define FORMPREFERENCES_H
|
|
|
|
|
2000-10-02 00:10:25 +00:00
|
|
|
#include "FormBase.h"
|
2000-07-27 10:26:38 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG_
|
|
|
|
#pragma interface
|
2000-06-12 11:55:12 +00:00
|
|
|
#endif
|
|
|
|
|
2000-11-09 15:28:42 +00:00
|
|
|
class Combox;
|
|
|
|
class Command;
|
2000-06-12 11:55:12 +00:00
|
|
|
class Dialogs;
|
2000-11-09 15:28:42 +00:00
|
|
|
class Format;
|
|
|
|
class LyXView;
|
2000-11-03 09:47:02 +00:00
|
|
|
struct FD_form_colours;
|
2000-11-03 17:05:42 +00:00
|
|
|
struct FD_form_converters;
|
2000-11-03 09:47:02 +00:00
|
|
|
struct FD_form_formats;
|
|
|
|
struct FD_form_inputs_misc;
|
2000-10-11 07:59:25 +00:00
|
|
|
struct FD_form_interface;
|
2000-11-03 09:47:02 +00:00
|
|
|
struct FD_form_language;
|
|
|
|
struct FD_form_lnf_misc;
|
2000-10-03 05:53:25 +00:00
|
|
|
struct FD_form_outer_tab;
|
2000-10-27 10:04:51 +00:00
|
|
|
struct FD_form_outputs_misc;
|
2000-11-03 09:47:02 +00:00
|
|
|
struct FD_form_paths;
|
|
|
|
struct FD_form_preferences;
|
|
|
|
struct FD_form_printer;
|
|
|
|
struct FD_form_screen_fonts;
|
2000-10-25 10:19:25 +00:00
|
|
|
struct FD_form_spellchecker;
|
2000-06-12 11:55:12 +00:00
|
|
|
|
|
|
|
/** This class provides an XForms implementation of the FormPreferences Dialog.
|
|
|
|
The preferences dialog allows users to set/save their preferences.
|
|
|
|
*/
|
2000-10-13 05:57:05 +00:00
|
|
|
class FormPreferences : public FormBaseBI {
|
2000-06-12 11:55:12 +00:00
|
|
|
public:
|
|
|
|
/// #FormPreferences x(LyXFunc ..., Dialogs ...);#
|
|
|
|
FormPreferences(LyXView *, Dialogs *);
|
|
|
|
///
|
|
|
|
~FormPreferences();
|
2000-10-30 21:53:29 +00:00
|
|
|
///
|
|
|
|
static void ComboLanguageCB(int, void *, Combox *);
|
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
static int FeedbackCB(FL_OBJECT *, int,
|
|
|
|
FL_Coord, FL_Coord, int, void *);
|
2000-10-30 21:53:29 +00:00
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
private:
|
2000-11-03 17:05:42 +00:00
|
|
|
/// helper struct for Colours
|
|
|
|
struct RGB {
|
|
|
|
int r;
|
|
|
|
int g;
|
|
|
|
int b;
|
|
|
|
RGB() : r(0), g(0), b(0) {}
|
|
|
|
RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
|
|
|
|
};
|
2000-11-08 09:39:46 +00:00
|
|
|
///
|
|
|
|
friend bool operator==(RGB const &, RGB const &);
|
|
|
|
///
|
|
|
|
friend bool operator!=(RGB const &, RGB const &);
|
|
|
|
///
|
|
|
|
typedef std::pair<string, RGB> X11Colour;
|
2000-11-03 17:05:42 +00:00
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
/// Update the dialog.
|
2000-10-24 13:13:59 +00:00
|
|
|
virtual void update();
|
2000-10-10 04:12:56 +00:00
|
|
|
///
|
|
|
|
virtual void hide();
|
2000-10-02 00:10:25 +00:00
|
|
|
/// OK from dialog
|
|
|
|
virtual void ok();
|
2000-06-12 11:55:12 +00:00
|
|
|
/// Apply from dialog
|
2000-10-02 00:10:25 +00:00
|
|
|
virtual void apply();
|
2000-08-14 05:24:35 +00:00
|
|
|
/// Filter the inputs -- return true if entries are valid
|
2000-10-05 07:57:00 +00:00
|
|
|
virtual bool input(FL_OBJECT *, long);
|
2000-06-12 11:55:12 +00:00
|
|
|
/// Build the dialog
|
2000-10-02 00:10:25 +00:00
|
|
|
virtual void build();
|
2000-10-30 21:53:29 +00:00
|
|
|
/// control which feedback message is output
|
2000-11-02 14:47:47 +00:00
|
|
|
void feedback( FL_OBJECT * );
|
2000-11-09 15:28:42 +00:00
|
|
|
/// The handler for the preemptive feedback
|
|
|
|
void Feedback(FL_OBJECT *, int);
|
2000-10-02 00:10:25 +00:00
|
|
|
///
|
2000-10-03 05:53:25 +00:00
|
|
|
virtual FL_FORM * form() const;
|
2000-11-03 17:05:42 +00:00
|
|
|
|
|
|
|
/** Folder specific apply functions.
|
|
|
|
*/
|
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyColours() const;
|
2000-10-30 11:33:05 +00:00
|
|
|
///
|
2000-11-03 17:05:42 +00:00
|
|
|
void applyConverters() const;
|
|
|
|
///
|
2000-11-03 09:47:02 +00:00
|
|
|
void applyFormats() const;
|
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyInputsMisc() const;
|
2000-10-30 11:33:05 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyInterface() const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-08 09:39:46 +00:00
|
|
|
void applyLanguage(); // not const because calls updateLanguage!
|
2000-10-30 11:33:05 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyLnFmisc() const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyOutputsMisc() const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyPaths(); // not const because calls updatePaths!
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyPrinter() const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applyScreenFonts() const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-02 14:47:47 +00:00
|
|
|
void applySpellChecker(); // not const because calls updateSpellChecker!
|
2000-11-03 17:05:42 +00:00
|
|
|
|
|
|
|
/** Folder specific build functions.
|
|
|
|
*/
|
|
|
|
|
2000-10-25 10:19:25 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
void buildColours();
|
|
|
|
///
|
2000-11-03 17:05:42 +00:00
|
|
|
void buildConverters();
|
2000-11-03 09:47:02 +00:00
|
|
|
///
|
|
|
|
void buildFormats();
|
|
|
|
///
|
2000-10-30 11:33:05 +00:00
|
|
|
void buildInputsMisc();
|
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
void buildInterface();
|
|
|
|
///
|
|
|
|
void buildLanguage();
|
|
|
|
///
|
|
|
|
void buildLnFmisc();
|
|
|
|
///
|
|
|
|
void buildOutputsMisc();
|
|
|
|
///
|
|
|
|
void buildPaths();
|
|
|
|
///
|
|
|
|
void buildPrinter();
|
|
|
|
///
|
|
|
|
void buildScreenFonts();
|
|
|
|
///
|
|
|
|
void buildSpellchecker();
|
2000-11-03 17:05:42 +00:00
|
|
|
|
|
|
|
/** Folder specific feedback functions.
|
|
|
|
*/
|
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackColours(FL_OBJECT const * const) const;
|
2000-10-30 11:33:05 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackConverters(FL_OBJECT const * const) const;
|
2000-11-03 17:05:42 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackFormats( FL_OBJECT const * const ) const;
|
2000-11-03 09:47:02 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackInputsMisc(FL_OBJECT const * const) const;
|
2000-10-30 11:33:05 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackInterface(FL_OBJECT const * const) const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackLanguage(FL_OBJECT const * const) const;
|
2000-10-30 11:33:05 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackLnFmisc(FL_OBJECT const * const) const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackOutputsMisc(FL_OBJECT const * const) const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackPaths(FL_OBJECT const * const) const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackPrinter(FL_OBJECT const * const) const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackScreenFonts(FL_OBJECT const * const) const;
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
string const feedbackSpellChecker(FL_OBJECT const * const) const;
|
2000-11-03 17:05:42 +00:00
|
|
|
|
|
|
|
/** Folder specific input functions. Not all folders require one.
|
|
|
|
*/
|
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-03 09:47:02 +00:00
|
|
|
bool inputColours(FL_OBJECT const * const);
|
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
bool inputConverters( FL_OBJECT const * const );
|
|
|
|
///
|
2000-11-03 09:47:02 +00:00
|
|
|
bool inputFormats( FL_OBJECT const * const );
|
|
|
|
///
|
2000-10-30 11:33:05 +00:00
|
|
|
bool inputLanguage(FL_OBJECT const * const);
|
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
bool inputPaths(FL_OBJECT const * const);
|
|
|
|
///
|
|
|
|
bool inputScreenFonts();
|
|
|
|
///
|
|
|
|
bool inputSpellChecker(FL_OBJECT const * const);
|
2000-11-03 17:05:42 +00:00
|
|
|
|
|
|
|
/** Folder specific update functions.
|
|
|
|
*/
|
|
|
|
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-10-30 11:33:05 +00:00
|
|
|
void updateColours();
|
|
|
|
///
|
2000-11-03 17:05:42 +00:00
|
|
|
void updateConverters();
|
2000-11-03 09:47:02 +00:00
|
|
|
///
|
|
|
|
void updateFormats();
|
|
|
|
///
|
2000-10-30 11:33:05 +00:00
|
|
|
void updateInputsMisc();
|
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
void updateInterface();
|
|
|
|
///
|
2000-10-30 11:33:05 +00:00
|
|
|
void updateLanguage();
|
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
void updateLnFmisc();
|
|
|
|
///
|
|
|
|
void updateOutputsMisc();
|
|
|
|
///
|
|
|
|
void updatePaths();
|
|
|
|
///
|
|
|
|
void updatePrinter();
|
|
|
|
///
|
|
|
|
void updateScreenFonts();
|
|
|
|
///
|
2000-10-25 10:19:25 +00:00
|
|
|
void updateSpellChecker();
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-03 17:05:42 +00:00
|
|
|
/** Some helper functions for specific folders.
|
|
|
|
*/
|
|
|
|
|
|
|
|
///
|
|
|
|
bool ColoursLoadBrowser( string const & );
|
|
|
|
///
|
|
|
|
int ColoursSearchEntry(RGB const & ) const;
|
|
|
|
///
|
|
|
|
void ColoursUpdateBrowser( int );
|
|
|
|
///
|
|
|
|
void ColoursUpdateRGB();
|
2000-11-09 15:28:42 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool ConvertersAdd();
|
|
|
|
///
|
|
|
|
bool ConvertersBrowser();
|
2000-11-08 09:39:46 +00:00
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
void ConvertersClear() const;
|
2000-11-08 09:39:46 +00:00
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
bool ConvertersContainFormat( Format const &) const;
|
2000-11-08 09:39:46 +00:00
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
bool ConvertersDelete();
|
2000-11-08 09:39:46 +00:00
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
bool ConvertersInput();
|
|
|
|
///
|
|
|
|
bool ConvertersSetCommand( Command & ) const;
|
|
|
|
///
|
|
|
|
void ConvertersUpdateChoices();
|
|
|
|
|
|
|
|
bool FormatsAdd();
|
|
|
|
///
|
|
|
|
bool FormatsBrowser();
|
|
|
|
///
|
|
|
|
void FormatsClear() const;
|
|
|
|
///
|
|
|
|
bool FormatsDelete();
|
|
|
|
///
|
|
|
|
bool FormatsInput();
|
2000-11-03 17:05:42 +00:00
|
|
|
|
2000-10-25 10:19:25 +00:00
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
bool WriteableDir( string const & );
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
bool ReadableDir( string const & );
|
2000-10-27 10:04:51 +00:00
|
|
|
///
|
2000-11-09 15:28:42 +00:00
|
|
|
bool WriteableFile( string const &, string const & = string() );
|
2000-11-03 17:05:42 +00:00
|
|
|
|
2000-11-09 15:28:42 +00:00
|
|
|
///
|
|
|
|
void setPreHandler( FL_OBJECT * ) const;
|
|
|
|
///
|
|
|
|
void printWarning( string const & );
|
2000-10-27 10:04:51 +00:00
|
|
|
|
2000-11-03 17:05:42 +00:00
|
|
|
/// Type definitions from the fdesign produced header file.
|
2000-06-12 11:55:12 +00:00
|
|
|
FD_form_preferences * build_preferences();
|
|
|
|
///
|
2000-10-03 05:53:25 +00:00
|
|
|
FD_form_outer_tab * build_outer_tab();
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_colours * build_colours();
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
2000-11-03 17:05:42 +00:00
|
|
|
FD_form_converters * build_converters();
|
|
|
|
///
|
2000-11-03 09:47:02 +00:00
|
|
|
FD_form_formats * build_formats();
|
|
|
|
///
|
2000-10-30 11:33:05 +00:00
|
|
|
FD_form_inputs_misc * build_inputs_misc();
|
|
|
|
///
|
2000-10-11 07:59:25 +00:00
|
|
|
FD_form_interface * build_interface();
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_language * build_language();
|
|
|
|
///
|
|
|
|
FD_form_lnf_misc * build_lnf_misc();
|
|
|
|
///
|
|
|
|
FD_form_outputs_misc * build_outputs_misc();
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
|
|
|
FD_form_paths * build_paths();
|
2000-10-11 07:59:25 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_printer * build_printer();
|
|
|
|
///
|
|
|
|
FD_form_screen_fonts * build_screen_fonts();
|
2000-10-25 10:19:25 +00:00
|
|
|
///
|
|
|
|
FD_form_spellchecker * build_spellchecker();
|
2000-06-12 11:55:12 +00:00
|
|
|
|
|
|
|
/// Real GUI implementation.
|
|
|
|
FD_form_preferences * dialog_;
|
2000-11-03 17:05:42 +00:00
|
|
|
/// Converters tabfolder
|
|
|
|
FD_form_outer_tab * converters_tab_;
|
2000-10-03 05:53:25 +00:00
|
|
|
/// reLyX and other import/input stuff
|
|
|
|
FD_form_outer_tab * inputs_tab_;
|
2000-11-03 17:05:42 +00:00
|
|
|
/// HCI configuration
|
|
|
|
FD_form_outer_tab * look_n_feel_tab_;
|
|
|
|
/// Outputs tabfolder
|
|
|
|
FD_form_outer_tab * outputs_tab_;
|
2000-10-27 10:04:51 +00:00
|
|
|
/// Spellchecker, language stuff, etc
|
|
|
|
FD_form_outer_tab * usage_tab_;
|
2000-10-03 05:53:25 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_colours * colours_;
|
2000-10-25 10:19:25 +00:00
|
|
|
///
|
2000-11-04 10:00:12 +00:00
|
|
|
FD_form_converters * converters_;
|
|
|
|
///
|
2000-11-03 09:47:02 +00:00
|
|
|
FD_form_formats * formats_;
|
|
|
|
///
|
2000-10-30 11:33:05 +00:00
|
|
|
FD_form_inputs_misc * inputs_misc_;
|
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_interface * interface_;
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_language * language_;
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_lnf_misc * lnf_misc_;
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_outputs_misc * outputs_misc_;
|
2000-06-12 11:55:12 +00:00
|
|
|
///
|
|
|
|
FD_form_paths * paths_;
|
2000-10-11 07:59:25 +00:00
|
|
|
///
|
2000-10-27 10:04:51 +00:00
|
|
|
FD_form_printer * printer_;
|
|
|
|
///
|
|
|
|
FD_form_screen_fonts * screen_fonts_;
|
|
|
|
///
|
|
|
|
FD_form_spellchecker * spellchecker_;
|
2000-10-30 21:53:29 +00:00
|
|
|
///
|
|
|
|
Combox * combo_default_lang;
|
|
|
|
///
|
|
|
|
Combox * combo_kbmap_1;
|
|
|
|
///
|
|
|
|
Combox * combo_kbmap_2;
|
2000-11-06 11:20:22 +00:00
|
|
|
|
2000-11-08 09:39:46 +00:00
|
|
|
/// A vector of Formats, to be manipulated in the Format browser.
|
|
|
|
std::vector<Format> formats_vec;
|
2000-11-09 15:28:42 +00:00
|
|
|
/// A vector of Commands, to be manipulated in the Converter browser.
|
|
|
|
std::vector<Command> commands_vec;
|
2000-11-08 09:39:46 +00:00
|
|
|
/// A vector of RGB colours and associated name.
|
|
|
|
static std::vector<X11Colour> colourDB;
|
|
|
|
/** A collection of kmap files.
|
|
|
|
First entry is the file name, full path.
|
|
|
|
Second entry is the shorthand, as appears in the fl_choice.
|
|
|
|
Eg, system_lyxdir/kbd/american2.kmap, american2
|
|
|
|
*/
|
|
|
|
static std::pair<std::vector<string>, std::vector<string> > dirlist;
|
2000-11-09 15:28:42 +00:00
|
|
|
///
|
|
|
|
bool warningPosted;
|
2000-06-12 11:55:12 +00:00
|
|
|
};
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
inline
|
|
|
|
bool operator==(FormPreferences::RGB const & c1,
|
|
|
|
FormPreferences::RGB const & c2)
|
|
|
|
{
|
|
|
|
return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
bool operator!=(FormPreferences::RGB const & c1,
|
|
|
|
FormPreferences::RGB const & c2)
|
|
|
|
{
|
|
|
|
return !(c1 == c2);
|
|
|
|
}
|
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
#endif
|