Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 1 | /* Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB |
| 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 | |
Peter Åstrand | c359f36 | 2011-08-23 12:04:46 +0000 | [diff] [blame] | 19 | #ifdef HAVE_CONFIG_H |
| 20 | #include <config.h> |
| 21 | #endif |
| 22 | |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 23 | #include <stdlib.h> |
| 24 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 25 | #include <list> |
| 26 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 27 | #include <rdr/types.h> |
| 28 | #include <rfb/encodings.h> |
| 29 | |
| 30 | #ifdef HAVE_GNUTLS |
| 31 | #include <rfb/Security.h> |
| 32 | #include <rfb/SecurityClient.h> |
| 33 | #include <rfb/CSecurityTLS.h> |
| 34 | #endif |
| 35 | |
| 36 | #include "OptionsDialog.h" |
| 37 | #include "fltk_layout.h" |
| 38 | #include "i18n.h" |
Martin Koegler | 498ef46 | 2011-09-04 07:04:43 +0000 | [diff] [blame] | 39 | #include "menukey.h" |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 40 | #include "parameters.h" |
| 41 | |
DRC | b65bb93 | 2011-06-24 03:17:00 +0000 | [diff] [blame] | 42 | #include <FL/Fl_Tabs.H> |
| 43 | #include <FL/Fl_Button.H> |
| 44 | #include <FL/Fl_Return_Button.H> |
| 45 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 46 | using namespace std; |
| 47 | using namespace rdr; |
| 48 | using namespace rfb; |
| 49 | |
Pierre Ossman | 0c41e1d | 2011-05-17 09:36:04 +0000 | [diff] [blame] | 50 | std::map<OptionsCallback*, void*> OptionsDialog::callbacks; |
| 51 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 52 | OptionsDialog::OptionsDialog() |
| 53 | : Fl_Window(450, 450, _("VNC Viewer: Connection Options")) |
| 54 | { |
| 55 | int x, y; |
| 56 | Fl_Button *button; |
| 57 | |
| 58 | Fl_Tabs *tabs = new Fl_Tabs(OUTER_MARGIN, OUTER_MARGIN, |
| 59 | w() - OUTER_MARGIN*2, |
| 60 | h() - OUTER_MARGIN*2 - INNER_MARGIN - BUTTON_HEIGHT); |
| 61 | |
| 62 | { |
| 63 | int tx, ty, tw, th; |
| 64 | |
| 65 | tabs->client_area(tx, ty, tw, th, TABS_HEIGHT); |
| 66 | |
| 67 | createCompressionPage(tx, ty, tw, th); |
| 68 | createSecurityPage(tx, ty, tw, th); |
| 69 | createInputPage(tx, ty, tw, th); |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 70 | createScreenPage(tx, ty, tw, th); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 71 | createMiscPage(tx, ty, tw, th); |
| 72 | } |
| 73 | |
| 74 | tabs->end(); |
| 75 | |
| 76 | x = w() - BUTTON_WIDTH * 2 - INNER_MARGIN - OUTER_MARGIN; |
| 77 | y = h() - BUTTON_HEIGHT - OUTER_MARGIN; |
| 78 | |
| 79 | button = new Fl_Button(x, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("Cancel")); |
| 80 | button->callback(this->handleCancel, this); |
| 81 | |
| 82 | x += BUTTON_WIDTH + INNER_MARGIN; |
| 83 | |
| 84 | button = new Fl_Return_Button(x, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("OK")); |
| 85 | button->callback(this->handleOK, this); |
| 86 | |
| 87 | callback(this->handleCancel, this); |
| 88 | |
| 89 | set_modal(); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | OptionsDialog::~OptionsDialog() |
| 94 | { |
| 95 | } |
| 96 | |
| 97 | |
| 98 | void OptionsDialog::showDialog(void) |
| 99 | { |
| 100 | static OptionsDialog *dialog = NULL; |
| 101 | |
| 102 | if (!dialog) |
| 103 | dialog = new OptionsDialog(); |
| 104 | |
| 105 | if (dialog->shown()) |
| 106 | return; |
| 107 | |
| 108 | dialog->show(); |
| 109 | } |
| 110 | |
| 111 | |
Pierre Ossman | 0c41e1d | 2011-05-17 09:36:04 +0000 | [diff] [blame] | 112 | void OptionsDialog::addCallback(OptionsCallback *cb, void *data) |
| 113 | { |
| 114 | callbacks[cb] = data; |
| 115 | } |
| 116 | |
| 117 | |
| 118 | void OptionsDialog::removeCallback(OptionsCallback *cb) |
| 119 | { |
| 120 | callbacks.erase(cb); |
| 121 | } |
| 122 | |
| 123 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 124 | void OptionsDialog::show(void) |
| 125 | { |
Pierre Ossman | 33a233b | 2011-09-30 12:21:58 +0000 | [diff] [blame] | 126 | /* show() gets called for raise events as well */ |
| 127 | if (!shown()) |
| 128 | loadOptions(); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 129 | |
| 130 | Fl_Window::show(); |
| 131 | } |
| 132 | |
| 133 | |
| 134 | void OptionsDialog::loadOptions(void) |
| 135 | { |
| 136 | /* Compression */ |
| 137 | autoselectCheckbox->value(autoSelect); |
| 138 | |
| 139 | int encNum = encodingNum(preferredEncoding); |
| 140 | |
| 141 | switch (encNum) { |
| 142 | case encodingTight: |
| 143 | tightButton->setonly(); |
| 144 | break; |
| 145 | case encodingZRLE: |
| 146 | zrleButton->setonly(); |
| 147 | break; |
| 148 | case encodingHextile: |
| 149 | hextileButton->setonly(); |
| 150 | break; |
| 151 | case encodingRaw: |
| 152 | rawButton->setonly(); |
| 153 | break; |
| 154 | } |
| 155 | |
| 156 | if (fullColour) |
| 157 | fullcolorCheckbox->setonly(); |
| 158 | else { |
| 159 | switch (lowColourLevel) { |
| 160 | case 0: |
Pierre Ossman | cf836f2 | 2011-07-14 14:34:09 +0000 | [diff] [blame] | 161 | verylowcolorCheckbox->setonly(); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 162 | break; |
| 163 | case 1: |
| 164 | lowcolorCheckbox->setonly(); |
| 165 | break; |
| 166 | case 2: |
Pierre Ossman | cf836f2 | 2011-07-14 14:34:09 +0000 | [diff] [blame] | 167 | mediumcolorCheckbox->setonly(); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 168 | break; |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | char digit[2] = "0"; |
| 173 | |
| 174 | compressionCheckbox->value(customCompressLevel); |
| 175 | jpegCheckbox->value(!noJpeg); |
| 176 | digit[0] = '0' + compressLevel; |
| 177 | compressionInput->value(digit); |
| 178 | digit[0] = '0' + qualityLevel; |
| 179 | jpegInput->value(digit); |
| 180 | |
| 181 | handleAutoselect(autoselectCheckbox, this); |
| 182 | handleCompression(compressionCheckbox, this); |
| 183 | handleJpeg(jpegCheckbox, this); |
| 184 | |
| 185 | #ifdef HAVE_GNUTLS |
| 186 | /* Security */ |
| 187 | Security security(SecurityClient::secTypes); |
| 188 | |
| 189 | list<U8> secTypes; |
| 190 | list<U8>::iterator iter; |
| 191 | |
| 192 | list<U32> secTypesExt; |
| 193 | list<U32>::iterator iterExt; |
| 194 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 195 | encNoneCheckbox->value(false); |
| 196 | encTLSCheckbox->value(false); |
| 197 | encX509Checkbox->value(false); |
| 198 | |
| 199 | authNoneCheckbox->value(false); |
| 200 | authVncCheckbox->value(false); |
| 201 | authPlainCheckbox->value(false); |
| 202 | |
| 203 | secTypes = security.GetEnabledSecTypes(); |
| 204 | for (iter = secTypes.begin(); iter != secTypes.end(); ++iter) { |
| 205 | switch (*iter) { |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 206 | case secTypeNone: |
| 207 | encNoneCheckbox->value(true); |
| 208 | authNoneCheckbox->value(true); |
| 209 | break; |
| 210 | case secTypeVncAuth: |
| 211 | encNoneCheckbox->value(true); |
| 212 | authVncCheckbox->value(true); |
| 213 | break; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | secTypesExt = security.GetEnabledExtSecTypes(); |
| 218 | for (iterExt = secTypesExt.begin(); iterExt != secTypesExt.end(); ++iterExt) { |
| 219 | switch (*iterExt) { |
| 220 | case secTypePlain: |
| 221 | encNoneCheckbox->value(true); |
| 222 | authPlainCheckbox->value(true); |
| 223 | break; |
| 224 | case secTypeTLSNone: |
| 225 | encTLSCheckbox->value(true); |
| 226 | authNoneCheckbox->value(true); |
| 227 | break; |
| 228 | case secTypeTLSVnc: |
| 229 | encTLSCheckbox->value(true); |
| 230 | authVncCheckbox->value(true); |
| 231 | break; |
| 232 | case secTypeTLSPlain: |
| 233 | encTLSCheckbox->value(true); |
| 234 | authPlainCheckbox->value(true); |
| 235 | break; |
| 236 | case secTypeX509None: |
| 237 | encX509Checkbox->value(true); |
| 238 | authNoneCheckbox->value(true); |
| 239 | break; |
| 240 | case secTypeX509Vnc: |
| 241 | encX509Checkbox->value(true); |
| 242 | authVncCheckbox->value(true); |
| 243 | break; |
| 244 | case secTypeX509Plain: |
| 245 | encX509Checkbox->value(true); |
| 246 | authPlainCheckbox->value(true); |
| 247 | break; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | caInput->value(CSecurityTLS::x509ca); |
| 252 | crlInput->value(CSecurityTLS::x509crl); |
| 253 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 254 | handleX509(encX509Checkbox, this); |
| 255 | #endif |
| 256 | |
| 257 | /* Input */ |
Pierre Ossman | 4e7271e | 2011-05-24 12:47:12 +0000 | [diff] [blame] | 258 | const char *menuKeyBuf; |
| 259 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 260 | viewOnlyCheckbox->value(viewOnly); |
| 261 | acceptClipboardCheckbox->value(acceptClipboard); |
| 262 | sendClipboardCheckbox->value(sendClipboard); |
| 263 | sendPrimaryCheckbox->value(sendPrimary); |
Pierre Ossman | 407a5c3 | 2011-05-26 14:48:29 +0000 | [diff] [blame] | 264 | systemKeysCheckbox->value(fullscreenSystemKeys); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 265 | |
Pierre Ossman | 4e7271e | 2011-05-24 12:47:12 +0000 | [diff] [blame] | 266 | menuKeyChoice->value(0); |
| 267 | |
| 268 | menuKeyBuf = menuKey; |
Martin Koegler | 498ef46 | 2011-09-04 07:04:43 +0000 | [diff] [blame] | 269 | for (int i = 0; i < getMenuKeySymbolCount(); i++) |
| 270 | if (!strcmp(getMenuKeySymbols()[i].name, menuKeyBuf)) |
| 271 | menuKeyChoice->value(i + 1); |
Pierre Ossman | 4e7271e | 2011-05-24 12:47:12 +0000 | [diff] [blame] | 272 | |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 273 | /* Screen */ |
Pierre Ossman | 9ff733a | 2012-07-05 11:01:23 +0000 | [diff] [blame] | 274 | int width, height; |
| 275 | |
| 276 | if (sscanf(desktopSize.getValueStr(), "%dx%d", &width, &height) != 2) { |
| 277 | desktopSizeCheckbox->value(false); |
| 278 | desktopWidthInput->value("1024"); |
| 279 | desktopHeightInput->value("768"); |
| 280 | } else { |
| 281 | char buf[32]; |
| 282 | desktopSizeCheckbox->value(true); |
| 283 | snprintf(buf, sizeof(buf), "%d", width); |
| 284 | desktopWidthInput->value(buf); |
| 285 | snprintf(buf, sizeof(buf), "%d", height); |
| 286 | desktopHeightInput->value(buf); |
| 287 | } |
Pierre Ossman | 9919701 | 2012-07-05 11:06:18 +0000 | [diff] [blame] | 288 | remoteResizeCheckbox->value(remoteResize); |
Pierre Ossman | 2441e82 | 2012-07-10 11:11:23 +0000 | [diff] [blame] | 289 | #ifdef HAVE_FLTK_FULLSCREEN |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 290 | fullScreenCheckbox->value(fullScreen); |
Pierre Ossman | aae3891 | 2012-07-13 11:22:55 +0000 | [diff] [blame] | 291 | #ifdef HAVE_FLTK_FULLSCREEN_SCREENS |
| 292 | fullScreenAllMonitorsCheckbox->value(fullScreenAllMonitors); |
| 293 | #endif // HAVE_FLTK_FULLSCREEN_SCREENS |
Pierre Ossman | 2441e82 | 2012-07-10 11:11:23 +0000 | [diff] [blame] | 294 | #endif // HAVE_FLTK_FULLSCREEN |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 295 | |
Pierre Ossman | 9ff733a | 2012-07-05 11:01:23 +0000 | [diff] [blame] | 296 | handleDesktopSize(desktopSizeCheckbox, this); |
| 297 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 298 | /* Misc. */ |
| 299 | sharedCheckbox->value(shared); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 300 | dotCursorCheckbox->value(dotWhenNoCursor); |
| 301 | } |
| 302 | |
| 303 | |
| 304 | void OptionsDialog::storeOptions(void) |
| 305 | { |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 306 | /* Compression */ |
| 307 | autoSelect.setParam(autoselectCheckbox->value()); |
| 308 | |
| 309 | if (tightButton->value()) |
| 310 | preferredEncoding.setParam(encodingName(encodingTight)); |
| 311 | else if (zrleButton->value()) |
| 312 | preferredEncoding.setParam(encodingName(encodingZRLE)); |
| 313 | else if (hextileButton->value()) |
| 314 | preferredEncoding.setParam(encodingName(encodingHextile)); |
| 315 | else if (rawButton->value()) |
| 316 | preferredEncoding.setParam(encodingName(encodingRaw)); |
| 317 | |
| 318 | fullColour.setParam(fullcolorCheckbox->value()); |
Pierre Ossman | cf836f2 | 2011-07-14 14:34:09 +0000 | [diff] [blame] | 319 | if (verylowcolorCheckbox->value()) |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 320 | lowColourLevel.setParam(0); |
| 321 | else if (lowcolorCheckbox->value()) |
| 322 | lowColourLevel.setParam(1); |
Pierre Ossman | cf836f2 | 2011-07-14 14:34:09 +0000 | [diff] [blame] | 323 | else if (mediumcolorCheckbox->value()) |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 324 | lowColourLevel.setParam(2); |
| 325 | |
| 326 | customCompressLevel.setParam(compressionCheckbox->value()); |
| 327 | noJpeg.setParam(!jpegCheckbox->value()); |
| 328 | compressLevel.setParam(atoi(compressionInput->value())); |
| 329 | qualityLevel.setParam(atoi(jpegInput->value())); |
| 330 | |
| 331 | #ifdef HAVE_GNUTLS |
| 332 | /* Security */ |
| 333 | Security security; |
| 334 | |
| 335 | /* Process security types which don't use encryption */ |
| 336 | if (encNoneCheckbox->value()) { |
| 337 | if (authNoneCheckbox->value()) |
| 338 | security.EnableSecType(secTypeNone); |
| 339 | if (authVncCheckbox->value()) |
| 340 | security.EnableSecType(secTypeVncAuth); |
Pierre Ossman | c1764bd | 2011-09-30 12:26:25 +0000 | [diff] [blame] | 341 | if (authPlainCheckbox->value()) |
| 342 | security.EnableSecType(secTypePlain); |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 343 | } |
| 344 | |
Pierre Ossman | c1764bd | 2011-09-30 12:26:25 +0000 | [diff] [blame] | 345 | /* Process security types which use TLS encryption */ |
| 346 | if (encTLSCheckbox->value()) { |
| 347 | if (authNoneCheckbox->value()) |
| 348 | security.EnableSecType(secTypeTLSNone); |
| 349 | if (authVncCheckbox->value()) |
| 350 | security.EnableSecType(secTypeTLSVnc); |
| 351 | if (authPlainCheckbox->value()) |
| 352 | security.EnableSecType(secTypeTLSPlain); |
| 353 | } |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 354 | |
Pierre Ossman | c1764bd | 2011-09-30 12:26:25 +0000 | [diff] [blame] | 355 | /* Process security types which use X509 encryption */ |
| 356 | if (encX509Checkbox->value()) { |
| 357 | if (authNoneCheckbox->value()) |
| 358 | security.EnableSecType(secTypeX509None); |
| 359 | if (authVncCheckbox->value()) |
| 360 | security.EnableSecType(secTypeX509Vnc); |
| 361 | if (authPlainCheckbox->value()) |
| 362 | security.EnableSecType(secTypeX509Plain); |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 363 | } |
| 364 | |
Pierre Ossman | 5535fe6 | 2011-09-30 12:11:52 +0000 | [diff] [blame] | 365 | SecurityClient::secTypes.setParam(security.ToString()); |
| 366 | |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 367 | CSecurityTLS::x509ca.setParam(caInput->value()); |
| 368 | CSecurityTLS::x509crl.setParam(crlInput->value()); |
| 369 | #endif |
| 370 | |
| 371 | /* Input */ |
| 372 | viewOnly.setParam(viewOnlyCheckbox->value()); |
| 373 | acceptClipboard.setParam(acceptClipboardCheckbox->value()); |
| 374 | sendClipboard.setParam(sendClipboardCheckbox->value()); |
| 375 | sendPrimary.setParam(sendPrimaryCheckbox->value()); |
Pierre Ossman | 407a5c3 | 2011-05-26 14:48:29 +0000 | [diff] [blame] | 376 | fullscreenSystemKeys.setParam(systemKeysCheckbox->value()); |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 377 | |
Pierre Ossman | 4e7271e | 2011-05-24 12:47:12 +0000 | [diff] [blame] | 378 | if (menuKeyChoice->value() == 0) |
| 379 | menuKey.setParam(""); |
| 380 | else { |
Martin Koegler | 498ef46 | 2011-09-04 07:04:43 +0000 | [diff] [blame] | 381 | menuKey.setParam(menuKeyChoice->text()); |
Pierre Ossman | 4e7271e | 2011-05-24 12:47:12 +0000 | [diff] [blame] | 382 | } |
| 383 | |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 384 | /* Screen */ |
Pierre Ossman | 9ff733a | 2012-07-05 11:01:23 +0000 | [diff] [blame] | 385 | int width, height; |
| 386 | |
| 387 | if (desktopSizeCheckbox->value() && |
| 388 | (sscanf(desktopWidthInput->value(), "%d", &width) == 1) && |
| 389 | (sscanf(desktopHeightInput->value(), "%d", &height) == 1)) { |
| 390 | char buf[64]; |
| 391 | snprintf(buf, sizeof(buf), "%dx%d", width, height); |
| 392 | desktopSize.setParam(buf); |
| 393 | } else { |
| 394 | desktopSize.setParam(""); |
| 395 | } |
Pierre Ossman | 9919701 | 2012-07-05 11:06:18 +0000 | [diff] [blame] | 396 | remoteResize.setParam(remoteResizeCheckbox->value()); |
Pierre Ossman | 2441e82 | 2012-07-10 11:11:23 +0000 | [diff] [blame] | 397 | #ifdef HAVE_FLTK_FULLSCREEN |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 398 | fullScreen.setParam(fullScreenCheckbox->value()); |
Pierre Ossman | aae3891 | 2012-07-13 11:22:55 +0000 | [diff] [blame] | 399 | #ifdef HAVE_FLTK_FULLSCREEN_SCREENS |
| 400 | fullScreenAllMonitors.setParam(fullScreenAllMonitorsCheckbox->value()); |
| 401 | #endif // HAVE_FLTK_FULLSCREEN_SCREENS |
Pierre Ossman | 2441e82 | 2012-07-10 11:11:23 +0000 | [diff] [blame] | 402 | #endif // HAVE_FLTK_FULLSCREEN |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 403 | |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 404 | /* Misc. */ |
| 405 | shared.setParam(sharedCheckbox->value()); |
Pierre Ossman | 61fd486 | 2011-05-16 12:46:51 +0000 | [diff] [blame] | 406 | dotWhenNoCursor.setParam(dotCursorCheckbox->value()); |
Pierre Ossman | 0c41e1d | 2011-05-17 09:36:04 +0000 | [diff] [blame] | 407 | |
| 408 | std::map<OptionsCallback*, void*>::const_iterator iter; |
| 409 | |
| 410 | for (iter = callbacks.begin();iter != callbacks.end();++iter) |
| 411 | iter->first(iter->second); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | |
| 415 | void OptionsDialog::createCompressionPage(int tx, int ty, int tw, int th) |
| 416 | { |
| 417 | Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Compression")); |
| 418 | |
| 419 | int orig_tx, orig_ty; |
| 420 | int half_width, full_width; |
| 421 | int width, height; |
| 422 | |
| 423 | tx += OUTER_MARGIN; |
| 424 | ty += OUTER_MARGIN; |
| 425 | |
| 426 | full_width = tw - OUTER_MARGIN * 2; |
| 427 | half_width = (full_width - INNER_MARGIN) / 2; |
| 428 | |
| 429 | /* AutoSelect checkbox */ |
| 430 | autoselectCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 431 | CHECK_MIN_WIDTH, |
| 432 | CHECK_HEIGHT, |
| 433 | _("Auto select"))); |
| 434 | autoselectCheckbox->callback(handleAutoselect, this); |
| 435 | ty += CHECK_HEIGHT + INNER_MARGIN; |
| 436 | |
| 437 | /* Two columns */ |
| 438 | orig_tx = tx; |
| 439 | orig_ty = ty; |
| 440 | |
| 441 | /* VNC encoding box */ |
| 442 | ty += GROUP_LABEL_OFFSET; |
| 443 | height = GROUP_MARGIN * 2 + TIGHT_MARGIN * 3 + RADIO_HEIGHT * 4; |
| 444 | encodingGroup = new Fl_Group(tx, ty, half_width, height, |
| 445 | _("Preferred encoding")); |
| 446 | encodingGroup->box(FL_ENGRAVED_BOX); |
| 447 | encodingGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP); |
| 448 | |
| 449 | { |
| 450 | tx += GROUP_MARGIN; |
| 451 | ty += GROUP_MARGIN; |
| 452 | |
| 453 | width = encodingGroup->w() - GROUP_MARGIN * 2; |
| 454 | |
| 455 | tightButton = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 456 | RADIO_MIN_WIDTH, |
| 457 | RADIO_HEIGHT, |
Peter Åstrand | 4c44600 | 2011-08-15 12:33:06 +0000 | [diff] [blame] | 458 | "Tight")); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 459 | tightButton->type(FL_RADIO_BUTTON); |
| 460 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 461 | |
| 462 | zrleButton = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 463 | RADIO_MIN_WIDTH, |
| 464 | RADIO_HEIGHT, |
Peter Åstrand | 4c44600 | 2011-08-15 12:33:06 +0000 | [diff] [blame] | 465 | "ZRLE")); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 466 | zrleButton->type(FL_RADIO_BUTTON); |
| 467 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 468 | |
| 469 | hextileButton = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 470 | RADIO_MIN_WIDTH, |
| 471 | RADIO_HEIGHT, |
Peter Åstrand | 4c44600 | 2011-08-15 12:33:06 +0000 | [diff] [blame] | 472 | "Hextile")); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 473 | hextileButton->type(FL_RADIO_BUTTON); |
| 474 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 475 | |
| 476 | rawButton = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 477 | RADIO_MIN_WIDTH, |
| 478 | RADIO_HEIGHT, |
Peter Åstrand | 4c44600 | 2011-08-15 12:33:06 +0000 | [diff] [blame] | 479 | "Raw")); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 480 | rawButton->type(FL_RADIO_BUTTON); |
| 481 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 482 | } |
| 483 | |
| 484 | ty += GROUP_MARGIN - TIGHT_MARGIN; |
| 485 | |
| 486 | encodingGroup->end(); |
| 487 | |
| 488 | /* Second column */ |
| 489 | tx = orig_tx + half_width + INNER_MARGIN; |
| 490 | ty = orig_ty; |
| 491 | |
| 492 | /* Color box */ |
| 493 | ty += GROUP_LABEL_OFFSET; |
| 494 | height = GROUP_MARGIN * 2 + TIGHT_MARGIN * 3 + RADIO_HEIGHT * 4; |
| 495 | colorlevelGroup = new Fl_Group(tx, ty, half_width, height, _("Color level")); |
| 496 | colorlevelGroup->box(FL_ENGRAVED_BOX); |
| 497 | colorlevelGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP); |
| 498 | |
| 499 | { |
| 500 | tx += GROUP_MARGIN; |
| 501 | ty += GROUP_MARGIN; |
| 502 | |
| 503 | width = colorlevelGroup->w() - GROUP_MARGIN * 2; |
| 504 | |
| 505 | fullcolorCheckbox = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 506 | RADIO_MIN_WIDTH, |
| 507 | RADIO_HEIGHT, |
| 508 | _("Full (all available colors)"))); |
| 509 | fullcolorCheckbox->type(FL_RADIO_BUTTON); |
| 510 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 511 | |
| 512 | mediumcolorCheckbox = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 513 | RADIO_MIN_WIDTH, |
| 514 | RADIO_HEIGHT, |
| 515 | _("Medium (256 colors)"))); |
| 516 | mediumcolorCheckbox->type(FL_RADIO_BUTTON); |
| 517 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 518 | |
| 519 | lowcolorCheckbox = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 520 | RADIO_MIN_WIDTH, |
| 521 | RADIO_HEIGHT, |
| 522 | _("Low (64 colors)"))); |
| 523 | lowcolorCheckbox->type(FL_RADIO_BUTTON); |
| 524 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 525 | |
| 526 | verylowcolorCheckbox = new Fl_Round_Button(LBLRIGHT(tx, ty, |
| 527 | RADIO_MIN_WIDTH, |
| 528 | RADIO_HEIGHT, |
| 529 | _("Very low (8 colors)"))); |
| 530 | verylowcolorCheckbox->type(FL_RADIO_BUTTON); |
| 531 | ty += RADIO_HEIGHT + TIGHT_MARGIN; |
| 532 | } |
| 533 | |
| 534 | ty += GROUP_MARGIN - TIGHT_MARGIN; |
| 535 | |
| 536 | colorlevelGroup->end(); |
| 537 | |
| 538 | /* Back to normal */ |
| 539 | tx = orig_tx; |
| 540 | ty += INNER_MARGIN; |
| 541 | |
| 542 | /* Checkboxes */ |
| 543 | compressionCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 544 | CHECK_MIN_WIDTH, |
| 545 | CHECK_HEIGHT, |
| 546 | _("Custom compression level:"))); |
| 547 | compressionCheckbox->callback(handleCompression, this); |
| 548 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 549 | |
| 550 | compressionInput = new Fl_Int_Input(tx + INDENT, ty, |
| 551 | INPUT_HEIGHT, INPUT_HEIGHT, |
DRC | ba7bc51 | 2011-08-17 02:30:34 +0000 | [diff] [blame] | 552 | _("level (1=fast, 6=best [4-6 are rarely useful])")); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 553 | compressionInput->align(FL_ALIGN_RIGHT); |
| 554 | ty += INPUT_HEIGHT + INNER_MARGIN; |
| 555 | |
| 556 | jpegCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 557 | CHECK_MIN_WIDTH, |
| 558 | CHECK_HEIGHT, |
| 559 | _("Allow JPEG compression:"))); |
| 560 | jpegCheckbox->callback(handleJpeg, this); |
| 561 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 562 | |
| 563 | jpegInput = new Fl_Int_Input(tx + INDENT, ty, |
| 564 | INPUT_HEIGHT, INPUT_HEIGHT, |
DRC | 41036ed | 2011-08-23 20:36:50 +0000 | [diff] [blame] | 565 | _("quality (0=poor, 9=best)")); |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 566 | jpegInput->align(FL_ALIGN_RIGHT); |
| 567 | ty += INPUT_HEIGHT + INNER_MARGIN; |
| 568 | |
| 569 | group->end(); |
| 570 | } |
| 571 | |
| 572 | |
| 573 | void OptionsDialog::createSecurityPage(int tx, int ty, int tw, int th) |
| 574 | { |
| 575 | #ifdef HAVE_GNUTLS |
| 576 | Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Security")); |
| 577 | |
| 578 | int orig_tx; |
| 579 | int width, height; |
| 580 | |
| 581 | tx += OUTER_MARGIN; |
| 582 | ty += OUTER_MARGIN; |
| 583 | |
| 584 | width = tw - OUTER_MARGIN * 2; |
| 585 | |
| 586 | orig_tx = tx; |
| 587 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 588 | /* Encryption */ |
| 589 | ty += GROUP_LABEL_OFFSET; |
| 590 | height = GROUP_MARGIN * 2 + TIGHT_MARGIN * 4 + CHECK_HEIGHT * 3 + (INPUT_LABEL_OFFSET + INPUT_HEIGHT) * 2; |
| 591 | encryptionGroup = new Fl_Group(tx, ty, width, height, _("Encryption")); |
| 592 | encryptionGroup->box(FL_ENGRAVED_BOX); |
| 593 | encryptionGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP); |
| 594 | |
| 595 | { |
| 596 | tx += GROUP_MARGIN; |
| 597 | ty += GROUP_MARGIN; |
| 598 | |
| 599 | encNoneCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 600 | CHECK_MIN_WIDTH, |
| 601 | CHECK_HEIGHT, |
| 602 | _("None"))); |
| 603 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 604 | |
| 605 | encTLSCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 606 | CHECK_MIN_WIDTH, |
| 607 | CHECK_HEIGHT, |
| 608 | _("TLS with anonymous certificates"))); |
| 609 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 610 | |
| 611 | encX509Checkbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 612 | CHECK_MIN_WIDTH, |
| 613 | CHECK_HEIGHT, |
| 614 | _("TLS with X509 certificates"))); |
| 615 | encX509Checkbox->callback(handleX509, this); |
| 616 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 617 | |
| 618 | ty += INPUT_LABEL_OFFSET; |
| 619 | caInput = new Fl_Input(tx + INDENT, ty, |
| 620 | width - GROUP_MARGIN*2 - INDENT, INPUT_HEIGHT, |
| 621 | _("Path to X509 CA certificate")); |
| 622 | caInput->align(FL_ALIGN_LEFT | FL_ALIGN_TOP); |
| 623 | ty += INPUT_HEIGHT + TIGHT_MARGIN; |
| 624 | |
| 625 | ty += INPUT_LABEL_OFFSET; |
| 626 | crlInput = new Fl_Input(tx + INDENT, ty, |
| 627 | width - GROUP_MARGIN*2 - INDENT, INPUT_HEIGHT, |
| 628 | _("Path to X509 CRL file")); |
| 629 | crlInput->align(FL_ALIGN_LEFT | FL_ALIGN_TOP); |
| 630 | ty += INPUT_HEIGHT + TIGHT_MARGIN; |
| 631 | } |
| 632 | |
| 633 | ty += GROUP_MARGIN - TIGHT_MARGIN; |
| 634 | |
| 635 | encryptionGroup->end(); |
| 636 | |
| 637 | /* Back to normal */ |
| 638 | tx = orig_tx; |
| 639 | ty += INNER_MARGIN; |
| 640 | |
| 641 | /* Authentication */ |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 642 | ty += GROUP_LABEL_OFFSET; |
| 643 | height = GROUP_MARGIN * 2 + TIGHT_MARGIN * 2 + CHECK_HEIGHT * 3; |
| 644 | authenticationGroup = new Fl_Group(tx, ty, width, height, _("Authentication")); |
| 645 | authenticationGroup->box(FL_ENGRAVED_BOX); |
| 646 | authenticationGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP); |
| 647 | |
| 648 | { |
| 649 | tx += GROUP_MARGIN; |
| 650 | ty += GROUP_MARGIN; |
| 651 | |
| 652 | authNoneCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 653 | CHECK_MIN_WIDTH, |
| 654 | CHECK_HEIGHT, |
| 655 | _("None"))); |
| 656 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 657 | |
| 658 | authVncCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 659 | CHECK_MIN_WIDTH, |
| 660 | CHECK_HEIGHT, |
| 661 | _("Standard VNC (insecure without encryption)"))); |
| 662 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 663 | |
| 664 | authPlainCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 665 | CHECK_MIN_WIDTH, |
| 666 | CHECK_HEIGHT, |
| 667 | _("Username and password (insecure without encryption)"))); |
| 668 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 669 | } |
| 670 | |
| 671 | ty += GROUP_MARGIN - TIGHT_MARGIN; |
| 672 | |
| 673 | authenticationGroup->end(); |
| 674 | |
| 675 | /* Back to normal */ |
| 676 | tx = orig_tx; |
| 677 | ty += INNER_MARGIN; |
| 678 | |
| 679 | group->end(); |
| 680 | #endif |
| 681 | } |
| 682 | |
| 683 | |
| 684 | void OptionsDialog::createInputPage(int tx, int ty, int tw, int th) |
| 685 | { |
| 686 | Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Input")); |
| 687 | |
| 688 | tx += OUTER_MARGIN; |
| 689 | ty += OUTER_MARGIN; |
| 690 | |
| 691 | viewOnlyCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 692 | CHECK_MIN_WIDTH, |
| 693 | CHECK_HEIGHT, |
| 694 | _("View only (ignore mouse and keyboard)"))); |
| 695 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 696 | |
| 697 | acceptClipboardCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 698 | CHECK_MIN_WIDTH, |
| 699 | CHECK_HEIGHT, |
| 700 | _("Accept clipboard from server"))); |
| 701 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 702 | |
| 703 | sendClipboardCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 704 | CHECK_MIN_WIDTH, |
| 705 | CHECK_HEIGHT, |
| 706 | _("Send clipboard to server"))); |
| 707 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 708 | |
| 709 | sendPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 710 | CHECK_MIN_WIDTH, |
| 711 | CHECK_HEIGHT, |
| 712 | _("Send primary selection and cut buffer as clipboard"))); |
| 713 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 714 | |
Pierre Ossman | 407a5c3 | 2011-05-26 14:48:29 +0000 | [diff] [blame] | 715 | systemKeysCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 716 | CHECK_MIN_WIDTH, |
| 717 | CHECK_HEIGHT, |
| 718 | _("Pass system keys directly to server (full screen)"))); |
| 719 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 720 | |
Pierre Ossman | 4e7271e | 2011-05-24 12:47:12 +0000 | [diff] [blame] | 721 | menuKeyChoice = new Fl_Choice(LBLLEFT(tx, ty, 150, CHOICE_HEIGHT, _("Menu key"))); |
| 722 | |
| 723 | menuKeyChoice->add(_("None"), 0, NULL, (void*)0, FL_MENU_DIVIDER); |
Martin Koegler | 498ef46 | 2011-09-04 07:04:43 +0000 | [diff] [blame] | 724 | for (int i = 0; i < getMenuKeySymbolCount(); i++) |
| 725 | menuKeyChoice->add(getMenuKeySymbols()[i].name, 0, NULL, 0, 0); |
Pierre Ossman | 4e7271e | 2011-05-24 12:47:12 +0000 | [diff] [blame] | 726 | |
| 727 | ty += CHOICE_HEIGHT + TIGHT_MARGIN; |
| 728 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 729 | group->end(); |
| 730 | } |
| 731 | |
| 732 | |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 733 | void OptionsDialog::createScreenPage(int tx, int ty, int tw, int th) |
| 734 | { |
Pierre Ossman | 9ff733a | 2012-07-05 11:01:23 +0000 | [diff] [blame] | 735 | int x; |
| 736 | |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 737 | Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Screen")); |
| 738 | |
| 739 | tx += OUTER_MARGIN; |
| 740 | ty += OUTER_MARGIN; |
| 741 | |
Pierre Ossman | 9ff733a | 2012-07-05 11:01:23 +0000 | [diff] [blame] | 742 | desktopSizeCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 743 | CHECK_MIN_WIDTH, |
| 744 | CHECK_HEIGHT, |
| 745 | _("Resize remote session on connect"))); |
| 746 | desktopSizeCheckbox->callback(handleDesktopSize, this); |
| 747 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 748 | |
| 749 | desktopWidthInput = new Fl_Int_Input(tx + INDENT, ty, 50, INPUT_HEIGHT); |
| 750 | x = desktopWidthInput->x() + desktopWidthInput->w() + \ |
| 751 | gui_str_len("x") + 3 * 2; |
| 752 | desktopHeightInput = new Fl_Int_Input(x, ty, 50, INPUT_HEIGHT, "x"); |
| 753 | ty += INPUT_HEIGHT + TIGHT_MARGIN; |
| 754 | |
Pierre Ossman | 9919701 | 2012-07-05 11:06:18 +0000 | [diff] [blame] | 755 | remoteResizeCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 756 | CHECK_MIN_WIDTH, |
| 757 | CHECK_HEIGHT, |
| 758 | _("Resize remote session to the local window"))); |
| 759 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 760 | |
Pierre Ossman | 2441e82 | 2012-07-10 11:11:23 +0000 | [diff] [blame] | 761 | #ifdef HAVE_FLTK_FULLSCREEN |
| 762 | |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 763 | fullScreenCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 764 | CHECK_MIN_WIDTH, |
| 765 | CHECK_HEIGHT, |
| 766 | _("Full-screen mode"))); |
| 767 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 768 | |
Pierre Ossman | aae3891 | 2012-07-13 11:22:55 +0000 | [diff] [blame] | 769 | #ifdef HAVE_FLTK_FULLSCREEN_SCREENS |
| 770 | |
| 771 | fullScreenAllMonitorsCheckbox = new Fl_Check_Button(LBLRIGHT(tx + INDENT, ty, |
| 772 | CHECK_MIN_WIDTH, |
| 773 | CHECK_HEIGHT, |
| 774 | _("Enable full-screen mode over all monitors"))); |
| 775 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 776 | |
| 777 | #endif // HAVE_FLTK_FULLSCREEN_SCREENS |
| 778 | |
Pierre Ossman | 2441e82 | 2012-07-10 11:11:23 +0000 | [diff] [blame] | 779 | #endif // HAVE_FLTK_FULLSCREEN |
| 780 | |
Pierre Ossman | 1c2189b | 2012-07-05 09:23:03 +0000 | [diff] [blame] | 781 | group->end(); |
| 782 | } |
| 783 | |
| 784 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 785 | void OptionsDialog::createMiscPage(int tx, int ty, int tw, int th) |
| 786 | { |
| 787 | Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Misc.")); |
| 788 | |
| 789 | tx += OUTER_MARGIN; |
| 790 | ty += OUTER_MARGIN; |
| 791 | |
| 792 | sharedCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 793 | CHECK_MIN_WIDTH, |
| 794 | CHECK_HEIGHT, |
| 795 | _("Shared (don't disconnect other viewers)"))); |
| 796 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 797 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 798 | dotCursorCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty, |
| 799 | CHECK_MIN_WIDTH, |
| 800 | CHECK_HEIGHT, |
| 801 | _("Show dot when no cursor"))); |
| 802 | ty += CHECK_HEIGHT + TIGHT_MARGIN; |
| 803 | |
| 804 | group->end(); |
| 805 | } |
| 806 | |
| 807 | |
| 808 | void OptionsDialog::handleAutoselect(Fl_Widget *widget, void *data) |
| 809 | { |
| 810 | OptionsDialog *dialog = (OptionsDialog*)data; |
| 811 | |
| 812 | if (dialog->autoselectCheckbox->value()) { |
| 813 | dialog->encodingGroup->deactivate(); |
| 814 | dialog->colorlevelGroup->deactivate(); |
| 815 | } else { |
| 816 | dialog->encodingGroup->activate(); |
| 817 | dialog->colorlevelGroup->activate(); |
| 818 | } |
| 819 | |
| 820 | // JPEG setting is also affected by autoselection |
| 821 | dialog->handleJpeg(dialog->jpegCheckbox, dialog); |
| 822 | } |
| 823 | |
| 824 | |
| 825 | void OptionsDialog::handleCompression(Fl_Widget *widget, void *data) |
| 826 | { |
| 827 | OptionsDialog *dialog = (OptionsDialog*)data; |
| 828 | |
| 829 | if (dialog->compressionCheckbox->value()) |
| 830 | dialog->compressionInput->activate(); |
| 831 | else |
| 832 | dialog->compressionInput->deactivate(); |
| 833 | } |
| 834 | |
| 835 | |
| 836 | void OptionsDialog::handleJpeg(Fl_Widget *widget, void *data) |
| 837 | { |
| 838 | OptionsDialog *dialog = (OptionsDialog*)data; |
| 839 | |
| 840 | if (dialog->jpegCheckbox->value() && |
| 841 | !dialog->autoselectCheckbox->value()) |
| 842 | dialog->jpegInput->activate(); |
| 843 | else |
| 844 | dialog->jpegInput->deactivate(); |
| 845 | } |
| 846 | |
| 847 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 848 | void OptionsDialog::handleX509(Fl_Widget *widget, void *data) |
| 849 | { |
| 850 | OptionsDialog *dialog = (OptionsDialog*)data; |
| 851 | |
| 852 | if (dialog->encX509Checkbox->value()) { |
| 853 | dialog->caInput->activate(); |
| 854 | dialog->crlInput->activate(); |
| 855 | } else { |
| 856 | dialog->caInput->deactivate(); |
| 857 | dialog->crlInput->deactivate(); |
| 858 | } |
| 859 | } |
| 860 | |
| 861 | |
Pierre Ossman | 9ff733a | 2012-07-05 11:01:23 +0000 | [diff] [blame] | 862 | void OptionsDialog::handleDesktopSize(Fl_Widget *widget, void *data) |
| 863 | { |
| 864 | OptionsDialog *dialog = (OptionsDialog*)data; |
| 865 | |
| 866 | if (dialog->desktopSizeCheckbox->value()) { |
| 867 | dialog->desktopWidthInput->activate(); |
| 868 | dialog->desktopHeightInput->activate(); |
| 869 | } else { |
| 870 | dialog->desktopWidthInput->deactivate(); |
| 871 | dialog->desktopHeightInput->deactivate(); |
| 872 | } |
| 873 | } |
| 874 | |
Pierre Ossman | d463b57 | 2011-05-16 12:04:43 +0000 | [diff] [blame] | 875 | void OptionsDialog::handleCancel(Fl_Widget *widget, void *data) |
| 876 | { |
| 877 | OptionsDialog *dialog = (OptionsDialog*)data; |
| 878 | |
| 879 | dialog->hide(); |
| 880 | } |
| 881 | |
| 882 | |
| 883 | void OptionsDialog::handleOK(Fl_Widget *widget, void *data) |
| 884 | { |
| 885 | OptionsDialog *dialog = (OptionsDialog*)data; |
| 886 | |
| 887 | dialog->hide(); |
| 888 | |
| 889 | dialog->storeOptions(); |
| 890 | } |