From 47c5be88e3d96353d5aa4713e9d675eb29d0cdcf Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sat, 15 Mar 2008 22:12:19 +0000 Subject: [PATCH] Tools->Preference: move editing and fullscreen from user interface to a new panel editing git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23767 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/scons/scons_manifest.py | 1 + src/frontends/qt4/GuiPrefs.cpp | 104 ++++++++----- src/frontends/qt4/GuiPrefs.h | 13 ++ src/frontends/qt4/Makefile.am | 1 + src/frontends/qt4/ui/PrefEditUi.ui | 225 ++++++++++++++++++++++++++++ src/frontends/qt4/ui/PrefUi.ui | 176 +--------------------- 6 files changed, 306 insertions(+), 214 deletions(-) create mode 100644 src/frontends/qt4/ui/PrefEditUi.ui diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index 269dd0fdde..b322c868a0 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -926,6 +926,7 @@ src_frontends_qt4_ui_files = Split(''' PrefConvertersUi.ui PrefDateUi.ui PrefDisplayUi.ui + PrefEditUi.ui PrefFileformatsUi.ui PrefIdentityUi.ui PrefInputUi.ui diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index c00fdec526..23eb5a44cc 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1795,14 +1795,6 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent) this, SIGNAL(changed())); connect(allowGeometrySessionCB, SIGNAL(clicked()), this, SIGNAL(changed())); - connect(cursorFollowsCB, SIGNAL(clicked()), - this, SIGNAL(changed())); - connect(sortEnvironmentsCB, SIGNAL(clicked()), - this, SIGNAL(changed())); - connect(groupEnvironmentsCB, SIGNAL(clicked()), - this, SIGNAL(changed())); - connect(macroEditStyleCO, SIGNAL(activated(int)), - this, SIGNAL(changed())); connect(autoSaveSB, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); connect(autoSaveCB, SIGNAL(clicked()), @@ -1811,16 +1803,6 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent) this, SIGNAL(changed())); connect(tooltipCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(fullscreenLimitGB, SIGNAL(clicked()), - this, SIGNAL(changed())); - connect(fullscreenWidthSB, SIGNAL(valueChanged(int)), - this, SIGNAL(changed())); - connect(toggleTabbarCB, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); - connect(toggleScrollbarCB, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); - connect(toggleToolbarsCB, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); lastfilesSB->setMaximum(maxlastfiles); } @@ -1831,23 +1813,10 @@ void PrefUserInterface::apply(LyXRC & rc) const rc.use_lastfilepos = restoreCursorCB->isChecked(); rc.load_session = loadSessionCB->isChecked(); rc.allow_geometry_session = allowGeometrySessionCB->isChecked(); - rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked(); - rc.sort_layouts = sortEnvironmentsCB->isChecked(); - rc.group_layouts = groupEnvironmentsCB->isChecked(); - switch (macroEditStyleCO->currentIndex()) { - case 0: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE_BOX; break; - case 1: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE; break; - case 2: rc.macro_edit_style = LyXRC::MACRO_EDIT_LIST; break; - } rc.autosave = autoSaveSB->value() * 60; rc.make_backup = autoSaveCB->isChecked(); rc.num_lastfiles = lastfilesSB->value(); rc.use_tooltip = tooltipCB->isChecked(); - rc.full_screen_toolbars = toggleToolbarsCB->isChecked(); - rc.full_screen_scrollbar = toggleScrollbarCB->isChecked(); - rc.full_screen_tabbar = toggleTabbarCB->isChecked(); - rc.full_screen_width = fullscreenWidthSB->value(); - rc.full_screen_limit = fullscreenLimitGB->isChecked(); rc.open_buffers_in_tabs = openDocumentsInTabsCB->isChecked(); } @@ -1858,10 +1827,6 @@ void PrefUserInterface::update(LyXRC const & rc) restoreCursorCB->setChecked(rc.use_lastfilepos); loadSessionCB->setChecked(rc.load_session); allowGeometrySessionCB->setChecked(rc.allow_geometry_session); - cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); - sortEnvironmentsCB->setChecked(rc.sort_layouts); - groupEnvironmentsCB->setChecked(rc.group_layouts); - macroEditStyleCO->setCurrentIndex(rc.macro_edit_style); // convert to minutes int mins(rc.autosave / 60); if (rc.autosave && !mins) @@ -1870,11 +1835,6 @@ void PrefUserInterface::update(LyXRC const & rc) autoSaveCB->setChecked(rc.make_backup); lastfilesSB->setValue(rc.num_lastfiles); tooltipCB->setChecked(rc.use_tooltip); - toggleScrollbarCB->setChecked(rc.full_screen_scrollbar); - toggleToolbarsCB->setChecked(rc.full_screen_toolbars); - toggleTabbarCB->setChecked(rc.full_screen_tabbar); - fullscreenWidthSB->setValue(rc.full_screen_width); - fullscreenLimitGB->setChecked(rc.full_screen_limit); openDocumentsInTabsCB->setChecked(rc.open_buffers_in_tabs); } @@ -1886,6 +1846,69 @@ void PrefUserInterface::select_ui() uiFileED->setText(file); } +///////////////////////////////////////////////////////////////////// +// +// PrefEdit +// +///////////////////////////////////////////////////////////////////// + +PrefEdit::PrefEdit(GuiPreferences * form, QWidget * parent) + : PrefModule(qt_("Editing"), form, parent) +{ + setupUi(this); + + connect(cursorFollowsCB, SIGNAL(clicked()), + this, SIGNAL(changed())); + connect(sortEnvironmentsCB, SIGNAL(clicked()), + this, SIGNAL(changed())); + connect(groupEnvironmentsCB, SIGNAL(clicked()), + this, SIGNAL(changed())); + connect(macroEditStyleCO, SIGNAL(activated(int)), + this, SIGNAL(changed())); + connect(fullscreenLimitGB, SIGNAL(clicked()), + this, SIGNAL(changed())); + connect(fullscreenWidthSB, SIGNAL(valueChanged(int)), + this, SIGNAL(changed())); + connect(toggleTabbarCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + connect(toggleScrollbarCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + connect(toggleToolbarsCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); +} + + +void PrefEdit::apply(LyXRC & rc) const +{ + rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked(); + rc.sort_layouts = sortEnvironmentsCB->isChecked(); + rc.group_layouts = groupEnvironmentsCB->isChecked(); + switch (macroEditStyleCO->currentIndex()) { + case 0: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE_BOX; break; + case 1: rc.macro_edit_style = LyXRC::MACRO_EDIT_INLINE; break; + case 2: rc.macro_edit_style = LyXRC::MACRO_EDIT_LIST; break; + } + rc.full_screen_toolbars = toggleToolbarsCB->isChecked(); + rc.full_screen_scrollbar = toggleScrollbarCB->isChecked(); + rc.full_screen_tabbar = toggleTabbarCB->isChecked(); + rc.full_screen_width = fullscreenWidthSB->value(); + rc.full_screen_limit = fullscreenLimitGB->isChecked(); +} + + +void PrefEdit::update(LyXRC const & rc) +{ + cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); + sortEnvironmentsCB->setChecked(rc.sort_layouts); + groupEnvironmentsCB->setChecked(rc.group_layouts); + macroEditStyleCO->setCurrentIndex(rc.macro_edit_style); + toggleScrollbarCB->setChecked(rc.full_screen_scrollbar); + toggleToolbarsCB->setChecked(rc.full_screen_toolbars); + toggleTabbarCB->setChecked(rc.full_screen_tabbar); + fullscreenWidthSB->setValue(rc.full_screen_width); + fullscreenLimitGB->setChecked(rc.full_screen_limit); +} + ///////////////////////////////////////////////////////////////////// // @@ -2340,6 +2363,7 @@ GuiPreferences::GuiPreferences(GuiView & lv) connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); add(new PrefUserInterface(this)); + add(new PrefEdit(this)); add(new PrefShortcuts(this)); add(new PrefScreenFonts(this)); add(new PrefColors(this)); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 515fee03c7..77a5382fe3 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -33,6 +33,7 @@ #include "ui_PrefScreenFontsUi.h" #include "ui_PrefColorsUi.h" #include "ui_PrefDisplayUi.h" +#include "ui_PrefEditUi.h" #include "ui_PrefPathsUi.h" #include "ui_PrefShortcutsUi.h" #include "ui_PrefSpellcheckerUi.h" @@ -347,6 +348,18 @@ public Q_SLOTS: }; +class PrefEdit : public PrefModule, public Ui::PrefEditUi +{ + Q_OBJECT +public: + PrefEdit(GuiPreferences * form, QWidget * parent = 0); + + void apply(LyXRC & rc) const; + void update(LyXRC const & rc); +}; + + + class GuiShortcutDialog : public QDialog, public Ui::shortcutUi { public: diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index 32f85df599..f6b6fcde2e 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -265,6 +265,7 @@ UIFILES = \ PrefConvertersUi.ui \ PrefDateUi.ui \ PrefDisplayUi.ui \ + PrefEditUi.ui \ PrefFileformatsUi.ui \ PrefIdentityUi.ui \ PrefInputUi.ui \ diff --git a/src/frontends/qt4/ui/PrefEditUi.ui b/src/frontends/qt4/ui/PrefEditUi.ui new file mode 100644 index 0000000000..a242940124 --- /dev/null +++ b/src/frontends/qt4/ui/PrefEditUi.ui @@ -0,0 +1,225 @@ + + PrefEditUi + + + + 0 + 0 + 459 + 406 + + + + + 0 + 0 + 0 + 0 + + + + + + + + 9 + + + 6 + + + + + Editing + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + 9 + + + 6 + + + + + Cursor follows &scrollbar + + + + + + + Sort &environments alphabetically + + + + + + + &Group environments by their category + + + + + + + + Edit Math Macros inline with a box around + + + + + Edit Math Macros inline with the name in the status bar + + + + + Edit Math Macros with a parameter list (like in LyX < 1.6) + + + + + + + + + + + Fullscreen + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + 9 + + + 6 + + + + + &Limit text width + + + true + + + + 9 + + + 6 + + + + + 10000 + + + 0 + + + 10 + + + 700 + + + + + + + Screen us&ed (pixels): + + + fullscreenWidthSB + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Toggle tabba&r + + + + + + + To&ggle scrollbar + + + + + + + + 0 + 0 + 0 + 0 + + + + T&oggle toolbars + + + + + + + + + + Qt::Vertical + + + + 395 + 16 + + + + + + + + + cursorFollowsCB + sortEnvironmentsCB + groupEnvironmentsCB + macroEditStyleCO + + + qt_helpers.h + + + + diff --git a/src/frontends/qt4/ui/PrefUi.ui b/src/frontends/qt4/ui/PrefUi.ui index 8645dc0016..eacc496685 100644 --- a/src/frontends/qt4/ui/PrefUi.ui +++ b/src/frontends/qt4/ui/PrefUi.ui @@ -6,7 +6,7 @@ 0 0 459 - 596 + 459 @@ -72,174 +72,6 @@ - - - - Fullscreen - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - 9 - - - 6 - - - - - &Limit text width - - - true - - - - 9 - - - 6 - - - - - 10000 - - - 0 - - - 10 - - - 700 - - - - - - - Screen us&ed (pixels): - - - fullscreenWidthSB - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Toggle tabba&r - - - - - - - To&ggle scrollbar - - - - - - - - 0 - 0 - 0 - 0 - - - - T&oggle toolbars - - - - - - - - - - Editing - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - 9 - - - 4 - - - - - Cursor follows &scrollbar - - - - - - - Sort &environments alphabetically - - - - - - - - Edit Math Macros inline with a box around - - - - - Edit Math Macros inline with the name in the status bar - - - - - Edit Math Macros with a parameter list (like in LyX < 1.6) - - - - - - - - &Group environments by their category - - - - - - @@ -332,7 +164,7 @@ - + Open documents in &tabs @@ -420,10 +252,6 @@ autoSaveSB lastfilesSB openDocumentsInTabsCB - cursorFollowsCB - sortEnvironmentsCB - groupEnvironmentsCB - macroEditStyleCO qt_helpers.h -- 2.39.5