From 7119a923d894112f9b365b1d7031968d80dc4130 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sun, 30 Jul 2006 15:52:43 +0000 Subject: [PATCH] Add rc.geometry_height, geometry_width, geometry_xysaved to the preference dialogs (qt3/qt4). * src/frontends/qt3/QPrefs.C, QPrefsDialog.C, ui/QPrefUIModule.ui * src/frontends/qt4/QPrefsDialog.C, ui/QPrefUi.ui git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14518 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt3/QPrefs.C | 19 + src/frontends/qt3/QPrefsDialog.C | 4 + src/frontends/qt3/ui/QPrefUIModule.ui | 279 ++++++++++--- src/frontends/qt4/QPrefsDialog.C | 35 ++ src/frontends/qt4/ui/QPrefUi.ui | 562 +++++++++++++++++--------- 5 files changed, 664 insertions(+), 235 deletions(-) diff --git a/src/frontends/qt3/QPrefs.C b/src/frontends/qt3/QPrefs.C index bf9365965d..2e185d05ef 100644 --- a/src/frontends/qt3/QPrefs.C +++ b/src/frontends/qt3/QPrefs.C @@ -180,6 +180,14 @@ void QPrefs::apply() rc.bind_file = internal_path(uimod->bindFileED->text()); rc.use_lastfilepos = uimod->restoreCursorCB->isChecked(); rc.load_session = uimod->loadSessionCB->isChecked(); + if (uimod->loadWindowSizeCB->isChecked()) { + rc.geometry_width = 0; + rc.geometry_height = 0; + } else { + rc.geometry_width = uimod->windowWidthSB->value(); + rc.geometry_height = uimod->windowHeightSB->value(); + } + rc.geometry_xysaved = uimod->loadWindowLocationCB->isChecked(); rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked(); rc.autosave = uimod->autoSaveSB->value() * 60; rc.make_backup = uimod->autoSaveCB->isChecked(); @@ -508,6 +516,17 @@ void QPrefs::update_contents() uimod->bindFileED->setText(external_path(rc.bind_file)); uimod->restoreCursorCB->setChecked(rc.use_lastfilepos); uimod->loadSessionCB->setChecked(rc.load_session); + bool loadWindowSize = rc.geometry_width == 0 && rc.geometry_height == 0; + uimod->loadWindowSizeCB->setChecked(loadWindowSize); + uimod->windowWidthSB->setEnabled(!loadWindowSize); + uimod->windowHeightSB->setEnabled(!loadWindowSize); + uimod->windowWidthLA->setEnabled(!loadWindowSize); + uimod->windowHeightLA->setEnabled(!loadWindowSize); + if (!loadWindowSize) { + uimod->windowWidthSB->setValue(rc.geometry_width); + uimod->windowHeightSB->setValue(rc.geometry_height); + } + uimod->loadWindowLocationCB->setChecked(rc.geometry_xysaved); uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); // convert to minutes int mins(rc.autosave / 60); diff --git a/src/frontends/qt3/QPrefsDialog.C b/src/frontends/qt3/QPrefsDialog.C index f5e927d799..ed6e454b6a 100644 --- a/src/frontends/qt3/QPrefsDialog.C +++ b/src/frontends/qt3/QPrefsDialog.C @@ -233,6 +233,10 @@ QPrefsDialog::QPrefsDialog(QPrefs * form) connect(uiModule->bindFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(uiModule->restoreCursorCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(uiModule->loadSessionCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); + connect(uiModule->loadWindowSizeCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); + connect(uiModule->loadWindowLocationCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); + connect(uiModule->windowWidthSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor())); + connect(uiModule->windowHeightSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor())); connect(uiModule->cursorFollowsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(uiModule->autoSaveSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor())); connect(uiModule->autoSaveCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); diff --git a/src/frontends/qt3/ui/QPrefUIModule.ui b/src/frontends/qt3/ui/QPrefUIModule.ui index bc91bc5872..166bc6e887 100644 --- a/src/frontends/qt3/ui/QPrefUIModule.ui +++ b/src/frontends/qt3/ui/QPrefUIModule.ui @@ -8,7 +8,7 @@ 0 0 - 412 + 606 441 @@ -23,17 +23,11 @@ QPrefUIModule - + unnamed - - 11 - - - 6 - - + Layout2 @@ -97,37 +91,9 @@ - + - cursorFollowsCB - - - Cursor follows &scrollbar - - - Alt+S - - - - - Spacer7 - - - Vertical - - - Expanding - - - - 20 - 90 - - - - - - layout8 + layout7 @@ -267,21 +233,11 @@ - 83 + 30 20 - - - - - layout9 - - - - unnamed - sessionGB @@ -317,6 +273,173 @@ + + + spacer4_2 + + + Horizontal + + + Expanding + + + + 40 + 31 + + + + + + + + layout15 + + + + unnamed + + + + GeometryGB + + + + 5 + 5 + 0 + 0 + + + + Geometry + + + + unnamed + + + + loadWindowSizeCB + + + Save/restore window size, or use fixed window + + + true + + + + + layoutWidthHeight + + + + unnamed + + + + Spacer6_2 + + + Horizontal + + + Fixed + + + + 30 + 20 + + + + + + windowWidthLA + + + false + + + Width + + + + + windowWidthSB + + + 9999 + + + 200 + + + 10 + + + + + windowHeightLA + + + false + + + Height + + + + + windowHeightSB + + + 9999 + + + 200 + + + 10 + + + + + Spacer6_2_2 + + + Horizontal + + + Fixed + + + + 30 + 20 + + + + + + + + loadWindowLocationCB + + + true + + + Save/restore window position + + + Restore to cursor position when the file was last closed + + + + spacer4 @@ -329,14 +452,42 @@ - 138 + 257 31 - + + + cursorFollowsCB + + + Cursor follows &scrollbar + + + Alt+S + + + + + Spacer7 + + + Vertical + + + Expanding + + + + 20 + 73 + + + + @@ -357,6 +508,30 @@ TextLabel1 setEnabled(bool) + + loadWindowSizeCB + toggled(bool) + windowWidthSB + setDisabled(bool) + + + loadWindowSizeCB + toggled(bool) + windowHeightSB + setDisabled(bool) + + + loadWindowSizeCB + toggled(bool) + windowWidthLA + setDisabled(bool) + + + loadWindowSizeCB + toggled(bool) + windowHeightLA + setDisabled(bool) + uiFileED diff --git a/src/frontends/qt4/QPrefsDialog.C b/src/frontends/qt4/QPrefsDialog.C index 0c9b0485be..b491f5e460 100644 --- a/src/frontends/qt4/QPrefsDialog.C +++ b/src/frontends/qt4/QPrefsDialog.C @@ -1695,6 +1695,22 @@ PrefUserInterface::PrefUserInterface(QPrefs * form, QWidget * parent) this, SIGNAL(changed())); connect(loadSessionCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(loadWindowSizeCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + connect(loadWindowSizeCB, SIGNAL(toggled(bool)), + windowWidthLA, SLOT(setDisabled(bool))); + connect(loadWindowSizeCB, SIGNAL(toggled(bool)), + windowHeightLA, SLOT(setDisabled(bool))); + connect(loadWindowSizeCB, SIGNAL(toggled(bool)), + windowWidthSB, SLOT(setDisabled(bool))); + connect(loadWindowSizeCB, SIGNAL(toggled(bool)), + windowHeightSB, SLOT(setDisabled(bool))); + connect(loadWindowLocationCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + connect(windowWidthSB, SIGNAL(valueChanged(int)), + this, SIGNAL(changed())); + connect(windowHeightSB, SIGNAL(valueChanged(int)), + this, SIGNAL(changed())); connect(cursorFollowsCB, SIGNAL(toggled(bool)), this, SIGNAL(changed())); connect(autoSaveSB, SIGNAL(valueChanged(int)), @@ -1713,6 +1729,14 @@ void PrefUserInterface::apply(LyXRC & rc) const rc.bind_file = internal_path(bindFileED->text()); rc.use_lastfilepos = restoreCursorCB->isChecked(); rc.load_session = loadSessionCB->isChecked(); + if (loadWindowSizeCB->isChecked()) { + rc.geometry_width = 0; + rc.geometry_height = 0; + } else { + rc.geometry_width = windowWidthSB->value(); + rc.geometry_height = windowHeightSB->value(); + } + rc.geometry_xysaved = loadWindowLocationCB->isChecked(); rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked(); rc.autosave = autoSaveSB->value() * 60; rc.make_backup = autoSaveCB->isChecked(); @@ -1726,6 +1750,17 @@ void PrefUserInterface::update(LyXRC const & rc) bindFileED->setText(external_path(rc.bind_file)); restoreCursorCB->setChecked(rc.use_lastfilepos); loadSessionCB->setChecked(rc.load_session); + bool loadWindowSize = rc.geometry_width == 0 && rc.geometry_height == 0; + loadWindowSizeCB->setChecked(loadWindowSize); + windowWidthSB->setEnabled(!loadWindowSize); + windowHeightSB->setEnabled(!loadWindowSize); + windowWidthLA->setEnabled(!loadWindowSize); + windowHeightLA->setEnabled(!loadWindowSize); + if (!loadWindowSize) { + windowWidthSB->setValue(rc.geometry_width); + windowHeightSB->setValue(rc.geometry_height); + } + loadWindowLocationCB->setChecked(rc.geometry_xysaved); cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); // convert to minutes int mins(rc.autosave / 60); diff --git a/src/frontends/qt4/ui/QPrefUi.ui b/src/frontends/qt4/ui/QPrefUi.ui index e78e203589..30d18edd2e 100644 --- a/src/frontends/qt4/ui/QPrefUi.ui +++ b/src/frontends/qt4/ui/QPrefUi.ui @@ -8,8 +8,8 @@ 0 0 - 416 - 513 + 728 + 657 @@ -23,193 +23,439 @@ - + 9 6 - - - - Session + + + + 0 + + + 6 - - - 9 - - - 6 - - + + + + B&rowse... + + + + + + + &User interface file: + + + uiFileED + + + + + + + &Bind file: + + + bindFileED + + + + + + + + + + Bro&wse... + + + + + + + + + + + + 0 + + + 6 + + + + + Documents + - 0 + 11 6 - + - Restore cursor positions + B&ackup documents - - - Load opened files from last session + + + 0 - + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 21 + 20 + + + + + + + + every + + + autoSaveSB + + + + + + + 300 + + + 1 + + + + + + + minutes + + + + + + + + + 0 + + + 6 + + + + + &Maximum last files: + + + lastfilesSB + + + + + + + 9 + + + + - - - - - - - - Scrolling - - - - 11 - - - 6 - - - - - Cursor follows &scrollbar - - - - - - - - - - Documents - - - - 11 - - - 6 - - - - - B&ackup documents - - - - - + + + + + + + 5 + 5 + 0 + 0 + + + + Geometry + + - 0 + 9 6 - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 21 - 20 - - - - - - + - every + Save/restore window size, or use fixed window - - autoSaveSB + + true - - - 300 + + + 0 - - 1 + + 6 - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + false + + + Width + + + + + + + 9999 + + + 200 + + + 10 + + + + + + + false + + + Height + + + + + + + 9999 + + + 200 + + + 10 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + - + + + true + + + Restore to cursor position when the file was last closed + - minutes + Save/restore window position - - - + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 51 + 174 + + + + + + + + + + 0 + + + 6 + + + + + Session + + - 0 + 9 6 - - - - &Maximum last files: + + + + 0 - - lastfilesSB + + 6 - + + + + Restore cursor positions + + + + + + + Load opened files from last session + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 351 + 124 + + + + + + + + + + 0 + + + 6 + + + + + Scrolling + + + + 11 + + + 6 + - - - 9 + + + Cursor follows &scrollbar - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 51 - 258 - - - + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 351 + 20 + + + + + - + Qt::Vertical @@ -220,61 +466,11 @@ 394 - 21 + 31 - - - - 0 - - - 6 - - - - - B&rowse... - - - - - - - &User interface file: - - - uiFileED - - - - - - - &Bind file: - - - bindFileED - - - - - - - - - - Bro&wse... - - - - - - - - qPixmapFromMimeSource -- 2.39.5