Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. |
| 2 | * |
| 3 | * This is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This software is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this software; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 16 | * USA. |
| 17 | */ |
| 18 | |
| 19 | #include <vncviewer/OptionsDialog.h> |
| 20 | #include <vncviewer/CConn.h> |
| 21 | #include <vncviewer/resource.h> |
| 22 | #include <rfb_win32/Registry.h> |
| 23 | #include <rfb_win32/MsgBox.h> |
| 24 | #include <rfb_win32/OSVersion.h> |
| 25 | #include <rfb/encodings.h> |
| 26 | #include <rfb/CConnection.h> |
| 27 | #include <commdlg.h> |
| 28 | #include <rfb/LogWriter.h> |
| 29 | |
| 30 | using namespace rfb; |
| 31 | using namespace rfb::win32; |
| 32 | |
| 33 | static LogWriter vlog("Options"); |
| 34 | |
| 35 | |
| 36 | struct OptionsInfo { |
| 37 | CConn* view; |
| 38 | CConnOptions options; |
| 39 | }; |
| 40 | |
| 41 | |
| 42 | OptionsDialog rfb::win32::OptionsDialog::global; |
| 43 | |
| 44 | |
| 45 | class ViewerOptions : public PropSheet { |
| 46 | public: |
| 47 | ViewerOptions(OptionsInfo& info_, std::list<PropSheetPage*> pages) |
| 48 | : PropSheet(GetModuleHandle(0), |
| 49 | info_.view ? _T("VNC Viewer Options") : _T("VNC Viewer Defaults"), pages), |
Peter Åstrand | e133cba | 2008-12-11 09:35:12 +0000 | [diff] [blame] | 50 | changed(false), info(info_) { |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 51 | } |
| 52 | ~ViewerOptions() { |
| 53 | if (changed) { |
| 54 | if (info.view) |
| 55 | // Apply the settings to the supplied session object |
| 56 | info.view->applyOptions(info.options); |
| 57 | else { |
| 58 | // Commit the settings to the user's registry area |
| 59 | info.options.writeDefaults(); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void setChanged() {changed = true;} |
| 65 | |
| 66 | bool changed; |
| 67 | OptionsInfo& info; |
| 68 | }; |
| 69 | |
| 70 | |
| 71 | class FormatPage : public PropSheetPage { |
| 72 | public: |
| 73 | FormatPage(OptionsInfo* dlg_) |
| 74 | : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_FORMAT)), dlg(dlg_) { |
| 75 | } |
| 76 | virtual void initDialog() { |
| 77 | setItemChecked(IDC_ENCODING_AUTO, dlg->options.autoSelect); |
| 78 | setItemChecked(IDC_FORMAT_FULLCOLOUR, dlg->options.fullColour); |
| 79 | if (!dlg->options.fullColour) { |
| 80 | switch (dlg->options.lowColourLevel) { |
| 81 | case 0: setItemChecked(IDC_FORMAT_VERYLOWCOLOUR, true); break; |
| 82 | case 1: setItemChecked(IDC_FORMAT_LOWCOLOUR, true); break; |
| 83 | case 2: setItemChecked(IDC_FORMAT_MEDIUMCOLOUR, true); break; |
| 84 | } |
| 85 | } |
| 86 | switch (dlg->options.preferredEncoding) { |
| 87 | case encodingTight: setItemChecked(IDC_ENCODING_TIGHT, true); break; |
| 88 | case encodingZRLE: setItemChecked(IDC_ENCODING_ZRLE, true); break; |
| 89 | case encodingHextile: setItemChecked(IDC_ENCODING_HEXTILE, true); break; |
| 90 | case encodingRaw: setItemChecked(IDC_ENCODING_RAW, true); break; |
| 91 | } |
| 92 | setItemChecked(IDC_CUSTOM_COMPRESSLEVEL, dlg->options.customCompressLevel); |
| 93 | setItemInt(IDC_COMPRESSLEVEL, dlg->options.compressLevel); |
| 94 | setItemChecked(IDC_ALLOW_JPEG, !dlg->options.noJpeg); |
| 95 | setItemInt(IDC_QUALITYLEVEL, dlg->options.qualityLevel); |
| 96 | onCommand(IDC_ENCODING_AUTO, 0 /* ? */); // Force enableItem status to refresh |
| 97 | onCommand(IDC_CUSTOM_COMPRESSLEVEL, 0 /* ? */); // Force enableItem status to refresh |
| 98 | onCommand(IDC_ALLOW_JPEG, 0 /* ? */); // Force enableItem status to refresh |
| 99 | } |
| 100 | virtual bool onOk() { |
| 101 | dlg->options.autoSelect = isItemChecked(IDC_ENCODING_AUTO); |
| 102 | dlg->options.fullColour = isItemChecked(IDC_FORMAT_FULLCOLOUR); |
| 103 | dlg->options.customCompressLevel = isItemChecked(IDC_CUSTOM_COMPRESSLEVEL); |
| 104 | dlg->options.compressLevel = getItemInt(IDC_COMPRESSLEVEL); |
| 105 | dlg->options.noJpeg = !isItemChecked(IDC_ALLOW_JPEG); |
| 106 | dlg->options.qualityLevel = getItemInt(IDC_QUALITYLEVEL); |
| 107 | if (isItemChecked(IDC_FORMAT_VERYLOWCOLOUR)) |
| 108 | dlg->options.lowColourLevel = 0; |
| 109 | if (isItemChecked(IDC_FORMAT_LOWCOLOUR)) |
| 110 | dlg->options.lowColourLevel = 1; |
| 111 | if (isItemChecked(IDC_FORMAT_MEDIUMCOLOUR)) |
| 112 | dlg->options.lowColourLevel = 2; |
| 113 | dlg->options.preferredEncoding = encodingTight; |
| 114 | if (isItemChecked(IDC_ENCODING_ZRLE)) |
| 115 | dlg->options.preferredEncoding = encodingZRLE; |
| 116 | if (isItemChecked(IDC_ENCODING_HEXTILE)) |
| 117 | dlg->options.preferredEncoding = encodingHextile; |
| 118 | if (isItemChecked(IDC_ENCODING_RAW)) |
| 119 | dlg->options.preferredEncoding = encodingRaw; |
| 120 | ((ViewerOptions*)propSheet)->setChanged(); |
| 121 | return true; |
| 122 | } |
| 123 | virtual bool onCommand(int id, int cmd) { |
Pierre Ossman | 78b2359 | 2009-03-12 12:25:11 +0000 | [diff] [blame] | 124 | bool aut = isItemChecked(IDC_ENCODING_AUTO); |
| 125 | bool jpeg = isItemChecked(IDC_ALLOW_JPEG); |
| 126 | bool custom_comp = isItemChecked(IDC_CUSTOM_COMPRESSLEVEL); |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 127 | if (id == IDC_ENCODING_AUTO) { |
Pierre Ossman | 78b2359 | 2009-03-12 12:25:11 +0000 | [diff] [blame] | 128 | enableItem(IDC_ENCODING_TIGHT, !aut); |
| 129 | enableItem(IDC_ENCODING_ZRLE, !aut); |
| 130 | enableItem(IDC_ENCODING_HEXTILE, !aut); |
| 131 | enableItem(IDC_ENCODING_RAW, !aut); |
| 132 | enableItem(IDC_FORMAT_FULLCOLOUR, !aut); |
| 133 | enableItem(IDC_FORMAT_MEDIUMCOLOUR, !aut); |
| 134 | enableItem(IDC_FORMAT_LOWCOLOUR, !aut); |
| 135 | enableItem(IDC_FORMAT_VERYLOWCOLOUR, !aut); |
| 136 | enableItem(IDC_QUALITYLEVEL, !aut && jpeg); |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 137 | return true; |
| 138 | } |
| 139 | if (id == IDC_CUSTOM_COMPRESSLEVEL) { |
Pierre Ossman | 78b2359 | 2009-03-12 12:25:11 +0000 | [diff] [blame] | 140 | enableItem(IDC_COMPRESSLEVEL, custom_comp); |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 141 | return true; |
| 142 | } |
| 143 | if (id == IDC_ALLOW_JPEG) { |
Pierre Ossman | 78b2359 | 2009-03-12 12:25:11 +0000 | [diff] [blame] | 144 | enableItem(IDC_QUALITYLEVEL, !aut && jpeg); |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 145 | return true; |
| 146 | } |
| 147 | return false; |
| 148 | } |
| 149 | protected: |
| 150 | OptionsInfo* dlg; |
| 151 | }; |
| 152 | |
| 153 | class MiscPage : public PropSheetPage { |
| 154 | public: |
| 155 | MiscPage(OptionsInfo* dlg_) |
| 156 | : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_MISC)), dlg(dlg_) { |
| 157 | } |
| 158 | virtual void initDialog() { |
| 159 | setItemChecked(IDC_CONN_SHARED, dlg->options.shared); |
| 160 | enableItem(IDC_CONN_SHARED, (!dlg->view) || (dlg->view->state() != CConnection::RFBSTATE_NORMAL)); |
| 161 | setItemChecked(IDC_FULL_SCREEN, dlg->options.fullScreen); |
| 162 | setItemChecked(IDC_LOCAL_CURSOR, dlg->options.useLocalCursor); |
| 163 | setItemChecked(IDC_DESKTOP_RESIZE, dlg->options.useDesktopResize); |
| 164 | enableItem(IDC_PROTOCOL_3_3, (!dlg->view) || (dlg->view->state() != CConnection::RFBSTATE_NORMAL)); |
| 165 | setItemChecked(IDC_PROTOCOL_3_3, dlg->options.protocol3_3); |
| 166 | setItemChecked(IDC_ACCEPT_BELL, dlg->options.acceptBell); |
| 167 | setItemChecked(IDC_AUTO_RECONNECT, dlg->options.autoReconnect); |
| 168 | setItemChecked(IDC_SHOW_TOOLBAR, dlg->options.showToolbar); |
george82 | 57160b0 | 2006-09-11 04:11:51 +0000 | [diff] [blame] | 169 | char scale_values[10][20] = { |
| 170 | "10","25","50","75","90","100","125","150","200","Auto" |
Constantin Kaplinsky | 1ae2eb0 | 2006-05-26 05:24:24 +0000 | [diff] [blame] | 171 | }; |
| 172 | HWND hScaleCombo = GetDlgItem(handle, IDC_COMBO_SCALE); |
george82 | 57160b0 | 2006-09-11 04:11:51 +0000 | [diff] [blame] | 173 | for (int i = 0; i <= 9; i++) { |
Constantin Kaplinsky | 1ae2eb0 | 2006-05-26 05:24:24 +0000 | [diff] [blame] | 174 | SendMessage(hScaleCombo, CB_INSERTSTRING, |
| 175 | (WPARAM)i, (LPARAM)(int FAR*)scale_values[i]); |
| 176 | } |
george82 | 04a7771 | 2006-05-29 14:18:14 +0000 | [diff] [blame] | 177 | if (dlg->options.autoScaling) { |
Adam Tkac | 8517ea5 | 2009-10-08 11:49:12 +0000 | [diff] [blame^] | 178 | SetDlgItemText(handle, IDC_COMBO_SCALE, (LPCTSTR) "Auto"); |
george82 | 04a7771 | 2006-05-29 14:18:14 +0000 | [diff] [blame] | 179 | } else { |
| 180 | SetDlgItemInt(handle, IDC_COMBO_SCALE, dlg->options.scale, FALSE); |
| 181 | } |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 182 | } |
| 183 | virtual bool onOk() { |
| 184 | dlg->options.shared = isItemChecked(IDC_CONN_SHARED); |
| 185 | dlg->options.fullScreen = isItemChecked(IDC_FULL_SCREEN); |
| 186 | dlg->options.useLocalCursor = isItemChecked(IDC_LOCAL_CURSOR); |
| 187 | dlg->options.useDesktopResize = isItemChecked(IDC_DESKTOP_RESIZE); |
| 188 | dlg->options.protocol3_3 = isItemChecked(IDC_PROTOCOL_3_3); |
| 189 | dlg->options.acceptBell = isItemChecked(IDC_ACCEPT_BELL); |
| 190 | dlg->options.autoReconnect = isItemChecked(IDC_AUTO_RECONNECT); |
| 191 | dlg->options.showToolbar = isItemChecked(IDC_SHOW_TOOLBAR); |
george82 | 04a7771 | 2006-05-29 14:18:14 +0000 | [diff] [blame] | 192 | int s = GetDlgItemInt(handle, IDC_COMBO_SCALE, NULL, FALSE); |
| 193 | if (s > 0) { |
| 194 | dlg->options.scale = s; |
| 195 | dlg->options.autoScaling = false; |
george82 | 04a7771 | 2006-05-29 14:18:14 +0000 | [diff] [blame] | 196 | } else { |
| 197 | char scaleStr[20]; |
Adam Tkac | 8517ea5 | 2009-10-08 11:49:12 +0000 | [diff] [blame^] | 198 | GetDlgItemText(handle, IDC_COMBO_SCALE, (LPTSTR) scaleStr, 20); |
| 199 | if (strcmp(scaleStr, (const char *) "Auto") == 0) { |
george82 | 04a7771 | 2006-05-29 14:18:14 +0000 | [diff] [blame] | 200 | dlg->options.autoScaling = true; |
george82 | 04a7771 | 2006-05-29 14:18:14 +0000 | [diff] [blame] | 201 | } |
| 202 | } |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 203 | ((ViewerOptions*)propSheet)->setChanged(); |
| 204 | return true; |
| 205 | } |
george82 | a9a3387 | 2007-04-30 11:37:36 +0000 | [diff] [blame] | 206 | virtual bool onCommand(int id, int cmd) { |
| 207 | if (id == IDC_COMBO_SCALE) { |
| 208 | if (cmd == CBN_SELENDOK || cmd == CBN_EDITCHANGE) { |
| 209 | char scaleStr[20]; |
| 210 | if (cmd == CBN_SELENDOK) { |
| 211 | HWND handleComboScale = GetDlgItem(handle, IDC_COMBO_SCALE); |
| 212 | int index = SendMessage(handleComboScale, CB_GETCURSEL, 0, 0); |
| 213 | SendMessage(handleComboScale, CB_GETLBTEXT, (WPARAM)index, (LPARAM)scaleStr); |
| 214 | } else { |
Adam Tkac | 8517ea5 | 2009-10-08 11:49:12 +0000 | [diff] [blame^] | 215 | GetDlgItemText(handle, IDC_COMBO_SCALE, (LPTSTR) scaleStr, 20); |
george82 | a9a3387 | 2007-04-30 11:37:36 +0000 | [diff] [blame] | 216 | } |
george82 | a9a3387 | 2007-04-30 11:37:36 +0000 | [diff] [blame] | 217 | return true; |
| 218 | } |
| 219 | } |
| 220 | return false; |
| 221 | } |
Constantin Kaplinsky | 729598c | 2006-05-25 05:12:25 +0000 | [diff] [blame] | 222 | protected: |
| 223 | OptionsInfo* dlg; |
| 224 | }; |
| 225 | |
| 226 | class InputsPage : public PropSheetPage { |
| 227 | public: |
| 228 | InputsPage(OptionsInfo* dlg_) |
| 229 | : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_INPUTS)), dlg(dlg_) { |
| 230 | } |
| 231 | virtual void initDialog() { |
| 232 | setItemChecked(IDC_SEND_POINTER, dlg->options.sendPtrEvents); |
| 233 | setItemChecked(IDC_SEND_KEYS, dlg->options.sendKeyEvents); |
| 234 | setItemChecked(IDC_CLIENT_CUTTEXT, dlg->options.clientCutText); |
| 235 | setItemChecked(IDC_SERVER_CUTTEXT, dlg->options.serverCutText); |
| 236 | setItemChecked(IDC_DISABLE_WINKEYS, dlg->options.disableWinKeys && !osVersion.isPlatformWindows); |
| 237 | enableItem(IDC_DISABLE_WINKEYS, !osVersion.isPlatformWindows); |
| 238 | setItemChecked(IDC_EMULATE3, dlg->options.emulate3); |
| 239 | setItemChecked(IDC_POINTER_INTERVAL, dlg->options.pointerEventInterval != 0); |
| 240 | |
| 241 | // Populate the Menu Key tab |
| 242 | HWND menuKey = GetDlgItem(handle, IDC_MENU_KEY); |
| 243 | SendMessage(menuKey, CB_RESETCONTENT, 0, 0); |
| 244 | SendMessage(menuKey, CB_ADDSTRING, 0, (LPARAM)_T("none")); |
| 245 | if (!dlg->options.menuKey) |
| 246 | SendMessage(menuKey, CB_SETCURSEL, 0, 0); |
| 247 | for (int i=0; i<12; i++) { |
| 248 | TCHAR buf[4]; |
| 249 | _stprintf(buf, _T("F%d"), i+1); |
| 250 | int index = SendMessage(menuKey, CB_ADDSTRING, 0, (LPARAM)buf); |
| 251 | if (i == (dlg->options.menuKey - VK_F1)) |
| 252 | SendMessage(menuKey, CB_SETCURSEL, index, 0); |
| 253 | } |
| 254 | } |
| 255 | virtual bool onOk() { |
| 256 | dlg->options.sendPtrEvents = isItemChecked(IDC_SEND_POINTER); |
| 257 | dlg->options.sendKeyEvents = isItemChecked(IDC_SEND_KEYS); |
| 258 | dlg->options.clientCutText = isItemChecked(IDC_CLIENT_CUTTEXT); |
| 259 | dlg->options.serverCutText = isItemChecked(IDC_SERVER_CUTTEXT); |
| 260 | dlg->options.disableWinKeys = isItemChecked(IDC_DISABLE_WINKEYS); |
| 261 | dlg->options.emulate3 = isItemChecked(IDC_EMULATE3); |
| 262 | dlg->options.pointerEventInterval = |
| 263 | isItemChecked(IDC_POINTER_INTERVAL) ? 200 : 0; |
| 264 | |
| 265 | HWND mkHwnd = GetDlgItem(handle, IDC_MENU_KEY); |
| 266 | int index = SendMessage(mkHwnd, CB_GETCURSEL, 0, 0); |
| 267 | TCharArray keyName(SendMessage(mkHwnd, CB_GETLBTEXTLEN, index, 0)+1); |
| 268 | SendMessage(mkHwnd, CB_GETLBTEXT, index, (LPARAM)keyName.buf); |
| 269 | if (_tcscmp(keyName.buf, _T("none")) == 0) |
| 270 | dlg->options.setMenuKey(""); |
| 271 | else |
| 272 | dlg->options.setMenuKey(CStr(keyName.buf)); |
| 273 | |
| 274 | ((ViewerOptions*)propSheet)->setChanged(); |
| 275 | return true; |
| 276 | } |
| 277 | protected: |
| 278 | OptionsInfo* dlg; |
| 279 | }; |
| 280 | |
| 281 | class DefaultsPage : public PropSheetPage { |
| 282 | public: |
| 283 | DefaultsPage(OptionsInfo* dlg_) |
| 284 | : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_DEFAULTS)), dlg(dlg_) { |
| 285 | } |
| 286 | virtual void initDialog() { |
| 287 | enableItem(IDC_LOAD_CONFIG, dlg->options.configFileName.buf); |
| 288 | enableItem(IDC_SAVE_CONFIG, dlg->options.configFileName.buf); |
| 289 | } |
| 290 | virtual bool onCommand(int id, int cmd) { |
| 291 | switch (id) { |
| 292 | case IDC_LOAD_DEFAULTS: |
| 293 | dlg->options = CConnOptions(); |
| 294 | break; |
| 295 | case IDC_SAVE_DEFAULTS: |
| 296 | propSheet->commitPages(); |
| 297 | dlg->options.writeDefaults(); |
| 298 | break; |
| 299 | case IDC_LOAD_CONFIG: |
| 300 | dlg->options.readFromFile(dlg->options.configFileName.buf); |
| 301 | break; |
| 302 | case IDC_SAVE_CONFIG: |
| 303 | propSheet->commitPages(); |
| 304 | dlg->options.writeToFile(dlg->options.configFileName.buf); |
| 305 | MsgBox(handle, _T("Options saved successfully"), |
| 306 | MB_OK | MB_ICONINFORMATION); |
| 307 | return 0; |
| 308 | case IDC_SAVE_CONFIG_AS: |
| 309 | propSheet->commitPages(); |
| 310 | // Get a filename to save to |
| 311 | TCHAR newFilename[4096]; |
| 312 | TCHAR currentDir[4096]; |
| 313 | if (dlg->options.configFileName.buf) |
| 314 | _tcscpy(newFilename, TStr(dlg->options.configFileName.buf)); |
| 315 | else |
| 316 | newFilename[0] = 0; |
| 317 | OPENFILENAME ofn; |
| 318 | memset(&ofn, 0, sizeof(ofn)); |
| 319 | #ifdef OPENFILENAME_SIZE_VERSION_400 |
| 320 | ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; |
| 321 | #else |
| 322 | ofn.lStructSize = sizeof(ofn); |
| 323 | #endif |
| 324 | ofn.hwndOwner = handle; |
| 325 | ofn.lpstrFilter = _T("VNC Connection Options\000*.vnc\000"); |
| 326 | ofn.lpstrFile = newFilename; |
| 327 | currentDir[0] = 0; |
| 328 | GetCurrentDirectory(4096, currentDir); |
| 329 | ofn.lpstrInitialDir = currentDir; |
| 330 | ofn.nMaxFile = 4096; |
| 331 | ofn.lpstrDefExt = _T(".vnc"); |
| 332 | ofn.Flags = OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; |
| 333 | if (!GetSaveFileName(&ofn)) { |
| 334 | if (CommDlgExtendedError()) |
| 335 | throw rdr::Exception("GetSaveFileName failed"); |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | // Save the Options |
| 340 | dlg->options.writeToFile(CStr(newFilename)); |
| 341 | MsgBox(handle, _T("Options saved successfully"), |
| 342 | MB_OK | MB_ICONINFORMATION); |
| 343 | return 0; |
| 344 | }; |
| 345 | propSheet->reInitPages(); |
| 346 | return true; |
| 347 | } |
| 348 | protected: |
| 349 | OptionsInfo* dlg; |
| 350 | }; |
| 351 | |
| 352 | |
| 353 | OptionsDialog::OptionsDialog() : visible(false) { |
| 354 | } |
| 355 | |
| 356 | bool OptionsDialog::showDialog(CConn* view, bool capture) { |
| 357 | if (visible) return false; |
| 358 | visible = true; |
| 359 | |
| 360 | // Grab the current properties |
| 361 | OptionsInfo info; |
| 362 | if (view) |
| 363 | info.options = view->getOptions(); |
| 364 | info.view = view; |
| 365 | |
| 366 | // Build a list of pages to display |
| 367 | std::list<PropSheetPage*> pages; |
| 368 | FormatPage formatPage(&info); pages.push_back(&formatPage); |
| 369 | InputsPage inputsPage(&info); pages.push_back(&inputsPage); |
| 370 | MiscPage miscPage(&info); pages.push_back(&miscPage); |
| 371 | DefaultsPage defPage(&info); if (view) pages.push_back(&defPage); |
| 372 | |
| 373 | // Show the property sheet |
| 374 | ViewerOptions dialog(info, pages); |
| 375 | dialog.showPropSheet(view && view->getWindow() ? view->getWindow()->getHandle() : 0, |
| 376 | false, false, capture); |
| 377 | |
| 378 | visible = false; |
| 379 | return dialog.changed; |
| 380 | } |