Hi, all, I played with qt3 designer a bit and added rc.geometry_width, geometry_height, geometry_xysaved to the preference dialog. The problem is that I can not figure out a way to enable the spin boxes when checkbox load window size is unchecked. autoSaveCB autoSaveSB in the same page are playing this game, but I can not figure out how they achieve this. :-(
Please advise. Bo
Index: src/frontends/qt3/QPrefs.C =================================================================== --- src/frontends/qt3/QPrefs.C (revision 14504) +++ src/frontends/qt3/QPrefs.C (working copy) @@ -180,6 +180,11 @@ 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 = 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 +513,15 @@ 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); + 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); Index: src/frontends/qt3/QPrefsDialog.C =================================================================== --- src/frontends/qt3/QPrefsDialog.C (revision 14504) +++ src/frontends/qt3/QPrefsDialog.C (working copy) @@ -233,6 +233,10 @@ 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())); Index: src/frontends/qt3/ui/QPrefUIModule.ui =================================================================== --- src/frontends/qt3/ui/QPrefUIModule.ui (revision 14504) +++ src/frontends/qt3/ui/QPrefUIModule.ui (working copy) @@ -8,7 +8,7 @@ <rect> <x>0</x> <y>0</y> - <width>412</width> + <width>606</width> <height>441</height> </rect> </property> @@ -23,17 +23,11 @@ <property name="caption"> <string>QPrefUIModule</string> </property> - <grid> + <vbox> <property name="name"> <cstring>unnamed</cstring> </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget" row="0" column="0"> + <widget class="QLayoutWidget"> <property name="name"> <cstring>Layout2</cstring> </property> @@ -97,38 +91,10 @@ </widget> </grid> </widget> - <widget class="QCheckBox" row="3" column="0"> + <widget class="QLayoutWidget"> <property name="name"> - <cstring>cursorFollowsCB</cstring> + <cstring>layout7</cstring> </property> - <property name="text"> - <string>Cursor follows &scrollbar</string> - </property> - <property name="accel"> - <string>Alt+S</string> - </property> - </widget> - <spacer row="4" column="0"> - <property name="name"> - <cstring>Spacer7</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>90</height> - </size> - </property> - </spacer> - <widget class="QLayoutWidget" row="1" column="0"> - <property name="name"> - <cstring>layout8</cstring> - </property> <hbox> <property name="name"> <cstring>unnamed</cstring> @@ -267,21 +233,11 @@ </property> <property name="sizeHint"> <size> - <width>83</width> + <width>30</width> <height>20</height> </size> </property> </spacer> - </hbox> - </widget> - <widget class="QLayoutWidget" row="2" column="0"> - <property name="name"> - <cstring>layout9</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> <widget class="QGroupBox"> <property name="name"> <cstring>sessionGB</cstring> @@ -319,6 +275,149 @@ </widget> <spacer> <property name="name"> + <cstring>spacer4_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GeometryGB</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Geometry</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>loadWindowSizeCB</cstring> + </property> + <property name="text"> + <string>Save/restore window size, or use fixed window</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>Spacer6_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>widthLA</cstring> + </property> + <property name="text"> + <string>Width</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>windowWidthSB</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>heightLA</cstring> + </property> + <property name="text"> + <string>Height</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>windowHeightSB</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer6_2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>loadWindowLocationCB</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Save/restore window position</string> + </property> + <property name="toolTip" stdset="0"> + <string>Restore to cursor position when the file was last closed</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> <cstring>spacer4</cstring> </property> <property name="orientation"> @@ -329,14 +428,42 @@ </property> <property name="sizeHint"> <size> - <width>138</width> + <width>257</width> <height>31</height> </size> </property> </spacer> </hbox> </widget> - </grid> + <widget class="QCheckBox"> + <property name="name"> + <cstring>cursorFollowsCB</cstring> + </property> + <property name="text"> + <string>Cursor follows &scrollbar</string> + </property> + <property name="accel"> + <string>Alt+S</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>73</height> + </size> + </property> + </spacer> + </vbox> </widget> <connections> <connection>