2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiPrefs.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#ifndef GUIPREFS_H
|
|
|
|
#define GUIPREFS_H
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "GuiDialog.h"
|
2007-10-07 09:47:12 +00:00
|
|
|
|
2007-04-26 17:34:20 +00:00
|
|
|
#include "Color.h"
|
2007-10-07 09:47:12 +00:00
|
|
|
#include "Converter.h"
|
2007-09-15 17:09:57 +00:00
|
|
|
#include "Format.h"
|
2007-10-07 09:47:12 +00:00
|
|
|
#include "LyXRC.h"
|
|
|
|
#include "Mover.h"
|
2007-04-25 07:13:54 +00:00
|
|
|
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_PrefsUi.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2007-08-11 15:48:15 +00:00
|
|
|
#include "ui_PrefPlaintextUi.h"
|
|
|
|
#include "ui_PrefDateUi.h"
|
|
|
|
#include "ui_PrefKeyboardUi.h"
|
|
|
|
#include "ui_PrefLatexUi.h"
|
|
|
|
#include "ui_PrefScreenFontsUi.h"
|
|
|
|
#include "ui_PrefColorsUi.h"
|
|
|
|
#include "ui_PrefDisplayUi.h"
|
|
|
|
#include "ui_PrefPathsUi.h"
|
|
|
|
#include "ui_PrefSpellcheckerUi.h"
|
|
|
|
#include "ui_PrefConvertersUi.h"
|
|
|
|
#include "ui_PrefFileformatsUi.h"
|
|
|
|
#include "ui_PrefLanguageUi.h"
|
|
|
|
#include "ui_PrefPrinterUi.h"
|
|
|
|
#include "ui_PrefUi.h"
|
|
|
|
#include "ui_PrefIdentityUi.h"
|
2007-04-25 07:13:54 +00:00
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#include <QDialog>
|
2007-09-15 17:09:57 +00:00
|
|
|
#include <QValidator>
|
2007-08-31 22:16:11 +00:00
|
|
|
|
2007-10-07 09:47:12 +00:00
|
|
|
#include <string>
|
2007-08-31 22:16:11 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2007-10-07 09:47:12 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2007-10-07 09:47:12 +00:00
|
|
|
class Color_color;
|
2006-03-05 17:24:44 +00:00
|
|
|
class Converters;
|
|
|
|
class Formats;
|
|
|
|
class Movers;
|
|
|
|
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-10-07 09:47:12 +00:00
|
|
|
class GuiPreferences;
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
class PrefModule : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-08-30 14:22:56 +00:00
|
|
|
PrefModule(docstring const & t,
|
2007-10-07 09:47:12 +00:00
|
|
|
GuiPreferences * form = 0, QWidget * parent = 0)
|
2007-08-30 14:22:56 +00:00
|
|
|
: QWidget(parent), title_(t), form_(form)
|
2007-04-25 10:57:54 +00:00
|
|
|
{}
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
virtual void apply(LyXRC & rc) const = 0;
|
|
|
|
virtual void update(LyXRC const & rc) = 0;
|
|
|
|
|
2007-04-25 10:57:54 +00:00
|
|
|
docstring const & title() const { return title_; }
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
protected:
|
2007-04-25 10:57:54 +00:00
|
|
|
docstring title_;
|
2007-10-07 09:47:12 +00:00
|
|
|
GuiPreferences * form_;
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void changed();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefPlaintext : public PrefModule, public Ui::PrefPlaintextUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PrefPlaintext(QWidget * parent = 0);
|
|
|
|
|
|
|
|
virtual void apply(LyXRC & rc) const;
|
|
|
|
virtual void update(LyXRC const & rc);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefDate : public PrefModule, public Ui::PrefDateUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PrefDate(QWidget * parent = 0);
|
|
|
|
|
|
|
|
virtual void apply(LyXRC & rc) const;
|
|
|
|
virtual void update(LyXRC const & rc);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefKeyboard : public PrefModule, public Ui::PrefKeyboardUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefKeyboard(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
virtual void apply(LyXRC & rc) const;
|
|
|
|
virtual void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void on_firstKeymapPB_clicked(bool);
|
|
|
|
void on_secondKeymapPB_clicked(bool);
|
|
|
|
void on_keymapCB_toggled(bool);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString testKeymap(QString keymap);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefLatex : public PrefModule, public Ui::PrefLatexUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefLatex(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
virtual void apply(LyXRC & rc) const;
|
|
|
|
virtual void update(LyXRC const & rc);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefScreenFonts : public PrefModule, public Ui::PrefScreenFontsUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefScreenFonts(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
virtual void apply(LyXRC & rc) const;
|
|
|
|
virtual void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void select_roman(const QString&);
|
|
|
|
void select_sans(const QString&);
|
|
|
|
void select_typewriter(const QString&);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefColors : public PrefModule, public Ui::PrefColorsUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefColors(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void change_color();
|
2007-05-09 20:09:03 +00:00
|
|
|
void change_lyxObjects_selection();
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
private:
|
2007-04-26 17:34:20 +00:00
|
|
|
std::vector<Color_color> lcolors_;
|
2007-04-25 07:13:54 +00:00
|
|
|
// FIXME the use of mutable here is required due to the
|
|
|
|
// fact that initialization is not done in the controller
|
|
|
|
// but in the constructor.
|
2007-05-09 20:16:31 +00:00
|
|
|
std::vector<QString> curcolors_;
|
2007-04-25 07:13:54 +00:00
|
|
|
std::vector<QString> newcolors_;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefDisplay : public PrefModule, public Ui::PrefDisplayUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PrefDisplay(QWidget * parent = 0);
|
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefPaths : public PrefModule, public Ui::PrefPathsUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefPaths(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void select_templatedir();
|
|
|
|
void select_tempdir();
|
|
|
|
void select_backupdir();
|
|
|
|
void select_workingdir();
|
|
|
|
void select_lyxpipe();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefSpellchecker : public PrefModule, public Ui::PrefSpellcheckerUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefSpellchecker(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void select_dict();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefConverters : public PrefModule, public Ui::PrefConvertersUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefConverters(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void updateGui();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void update_converter();
|
|
|
|
void switch_converter();
|
|
|
|
void converter_changed();
|
|
|
|
void remove_converter();
|
|
|
|
void on_cacheCB_stateChanged(int state);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateButtons();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-15 17:09:57 +00:00
|
|
|
class FormatValidator : public QValidator
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-09-15 17:09:57 +00:00
|
|
|
FormatValidator(QWidget *, Formats const & f);
|
|
|
|
void fixup(QString & input) const;
|
|
|
|
QValidator::State validate(QString & input, int & pos) const;
|
|
|
|
private:
|
|
|
|
virtual std::string str(Formats::const_iterator it) const = 0;
|
|
|
|
int nr() const;
|
|
|
|
Formats const & formats_;
|
|
|
|
};
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
|
2007-09-15 17:09:57 +00:00
|
|
|
class FormatNameValidator : public FormatValidator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FormatNameValidator(QWidget *, Formats const & f);
|
|
|
|
private:
|
|
|
|
std::string str(Formats::const_iterator it) const;
|
|
|
|
};
|
2007-04-25 07:13:54 +00:00
|
|
|
|
2007-09-15 17:09:57 +00:00
|
|
|
class FormatPrettynameValidator : public FormatValidator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FormatPrettynameValidator(QWidget *, Formats const & f);
|
2007-04-25 07:13:54 +00:00
|
|
|
private:
|
2007-09-15 17:09:57 +00:00
|
|
|
std::string str(Formats::const_iterator it) const;
|
2007-04-25 07:13:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefFileformats : public PrefModule, public Ui::PrefFileformatsUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefFileformats(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
2007-09-03 20:28:26 +00:00
|
|
|
void updateView();
|
2007-09-15 17:09:57 +00:00
|
|
|
|
2007-04-25 07:13:54 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void formatsChanged();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
2007-09-15 17:09:57 +00:00
|
|
|
void on_copierED_textEdited(const QString & s);
|
|
|
|
void on_extensionED_textEdited(const QString &);
|
|
|
|
void on_viewerED_textEdited(const QString &);
|
|
|
|
void on_editorED_textEdited(const QString &);
|
|
|
|
void on_shortcutED_textEdited(const QString &);
|
|
|
|
void on_formatED_editingFinished();
|
|
|
|
void on_formatED_textChanged(const QString &);
|
|
|
|
void on_formatsCB_currentIndexChanged(int);
|
|
|
|
void on_formatsCB_editTextChanged(const QString &);
|
|
|
|
void on_formatNewPB_clicked();
|
|
|
|
void on_formatRemovePB_clicked();
|
|
|
|
void setFlags();
|
|
|
|
void updatePrettyname();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Format & currentFormat();
|
2007-04-25 07:13:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefLanguage : public PrefModule, public Ui::PrefLanguageUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PrefLanguage(QWidget * parent = 0);
|
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<std::string> lang_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefPrinter : public PrefModule, public Ui::PrefPrinterUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PrefPrinter(QWidget * parent = 0);
|
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefUserInterface : public PrefModule, public Ui::PrefUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
PrefUserInterface(GuiPreferences * form, QWidget * parent = 0);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void select_ui();
|
|
|
|
void select_bind();
|
|
|
|
void on_loadWindowSizeCB_toggled(bool);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
class PrefIdentity : public PrefModule, public Ui::PrefIdentityUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PrefIdentity(QWidget * parent = 0);
|
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void update(LyXRC const & rc);
|
|
|
|
};
|
|
|
|
|
2007-10-07 09:47:12 +00:00
|
|
|
|
2007-10-09 19:34:27 +00:00
|
|
|
class GuiPreferences : public GuiDialog, public Ui::PrefsUi
|
2007-04-25 07:13:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-10-07 09:47:12 +00:00
|
|
|
GuiPreferences(LyXView & lv);
|
2007-04-25 07:13:54 +00:00
|
|
|
|
|
|
|
void apply(LyXRC & rc) const;
|
|
|
|
void updateRc(LyXRC const & rc);
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void change_adaptor();
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
public:
|
|
|
|
//
|
2007-04-25 07:13:54 +00:00
|
|
|
void closeEvent(QCloseEvent * e);
|
2007-09-05 20:33:29 +00:00
|
|
|
///
|
2007-04-25 07:13:54 +00:00
|
|
|
void add(PrefModule * module);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// Apply changes
|
2007-09-05 20:33:29 +00:00
|
|
|
void applyView();
|
2006-03-05 17:24:44 +00:00
|
|
|
/// update (do we need this?)
|
2007-09-11 18:33:42 +00:00
|
|
|
void updateContents();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
std::vector<PrefModule *> modules_;
|
2007-10-07 09:47:12 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool initialiseParams(std::string const &);
|
|
|
|
///
|
|
|
|
void clearParams() {}
|
|
|
|
///
|
|
|
|
void dispatchParams();
|
|
|
|
///
|
|
|
|
bool isBufferDependent() const { return false; }
|
|
|
|
|
|
|
|
/// various file pickers
|
|
|
|
docstring const browsebind(docstring const & file) const;
|
|
|
|
docstring const browseUI(docstring const & file) const;
|
|
|
|
docstring const browsekbmap(docstring const & file) const;
|
|
|
|
docstring const browsedict(docstring const & file) const;
|
|
|
|
|
|
|
|
/// general browse
|
|
|
|
docstring const browse(docstring const & file,
|
|
|
|
docstring const & title) const;
|
|
|
|
|
|
|
|
/// browse directory
|
|
|
|
docstring const browsedir(docstring const & path,
|
|
|
|
docstring const & title) const;
|
|
|
|
|
|
|
|
/// set a color
|
|
|
|
void setColor(Color_color col, std::string const & hex);
|
|
|
|
|
|
|
|
/// update the screen fonts after change
|
|
|
|
void updateScreenFonts();
|
|
|
|
|
|
|
|
/// adjust the prefs paper sizes
|
|
|
|
PAPER_SIZE toPaperSize(int i) const;
|
|
|
|
/// adjust the prefs paper sizes
|
|
|
|
int fromPaperSize(PAPER_SIZE papersize) const;
|
|
|
|
|
|
|
|
LyXRC & rc() { return rc_; }
|
|
|
|
Converters & converters() { return converters_; }
|
|
|
|
Formats & formats() { return formats_; }
|
|
|
|
Movers & movers() { return movers_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// temporary lyxrc
|
|
|
|
LyXRC rc_;
|
|
|
|
/// temporary converters
|
|
|
|
Converters converters_;
|
|
|
|
/// temporary formats
|
|
|
|
Formats formats_;
|
|
|
|
/// temporary movers
|
|
|
|
Movers movers_;
|
|
|
|
|
|
|
|
/// A list of colors to be dispatched
|
|
|
|
std::vector<std::string> colors_;
|
|
|
|
|
|
|
|
bool redraw_gui_;
|
|
|
|
bool update_screen_font_;
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#endif // GUIPREFS_H
|