std::map<OptionsCallback*, void*> OptionsDialog::callbacks;
OptionsDialog::OptionsDialog()
- : Fl_Window(450, 450, _("VNC Viewer: Connection Options"))
+ : Fl_Window(450, 460, _("VNC Viewer: Connection Options"))
{
int x, y;
Fl_Button *button;
{
Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Input"));
+ int orig_tx;
+ int width;
+
tx += OUTER_MARGIN;
ty += OUTER_MARGIN;
+ width = tw - OUTER_MARGIN * 2;
+
viewOnlyCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
CHECK_MIN_WIDTH,
CHECK_HEIGHT,
_("View only (ignore mouse and keyboard)")));
ty += CHECK_HEIGHT + TIGHT_MARGIN;
- emulateMBCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
- CHECK_MIN_WIDTH,
- CHECK_HEIGHT,
- _("Emulate middle mouse button")));
- ty += CHECK_HEIGHT + TIGHT_MARGIN;
+ orig_tx = tx;
- acceptClipboardCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
- CHECK_MIN_WIDTH,
- CHECK_HEIGHT,
- _("Accept clipboard from server")));
- acceptClipboardCheckbox->callback(handleClipboard, this);
- ty += CHECK_HEIGHT + TIGHT_MARGIN;
+ /* Mouse */
+ ty += GROUP_LABEL_OFFSET;
+ mouseGroup = new Fl_Group(tx, ty, width, 0, _("Mouse"));
+ mouseGroup->box(FL_ENGRAVED_BOX);
+ mouseGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP);
-#if !defined(WIN32) && !defined(__APPLE__)
- setPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx + INDENT, ty,
- CHECK_MIN_WIDTH,
- CHECK_HEIGHT,
- _("Also set primary selection")));
- ty += CHECK_HEIGHT + TIGHT_MARGIN;
-#endif
+ /* Needed for final resize to work sanely */
+ mouseGroup->resizable(NULL);
- sendClipboardCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
- CHECK_MIN_WIDTH,
- CHECK_HEIGHT,
- _("Send clipboard to server")));
- sendClipboardCheckbox->callback(handleClipboard, this);
- ty += CHECK_HEIGHT + TIGHT_MARGIN;
+ {
+ tx += GROUP_MARGIN;
+ ty += GROUP_MARGIN;
-#if !defined(WIN32) && !defined(__APPLE__)
- sendPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx + INDENT, ty,
+ emulateMBCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
CHECK_MIN_WIDTH,
CHECK_HEIGHT,
- _("Send primary selection as clipboard")));
- ty += CHECK_HEIGHT + TIGHT_MARGIN;
-#endif
+ _("Emulate middle mouse button")));
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
- systemKeysCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
+ dotCursorCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
CHECK_MIN_WIDTH,
CHECK_HEIGHT,
- _("Pass system keys directly to server (full screen)")));
- ty += CHECK_HEIGHT + TIGHT_MARGIN;
+ _("Show dot when no cursor")));
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
+ }
+ ty += GROUP_MARGIN - TIGHT_MARGIN;
- menuKeyChoice = new Fl_Choice(LBLLEFT(tx, ty, 150, CHOICE_HEIGHT, _("Menu key")));
+ mouseGroup->end();
+ mouseGroup->size(mouseGroup->w(), ty - mouseGroup->y());
- fltk_menu_add(menuKeyChoice, _("None"), 0, NULL, (void*)0, FL_MENU_DIVIDER);
- for (int i = 0; i < getMenuKeySymbolCount(); i++)
- fltk_menu_add(menuKeyChoice, getMenuKeySymbols()[i].name, 0, NULL, 0, 0);
+ /* Back to normal */
+ tx = orig_tx;
+ ty += INNER_MARGIN;
+
+ /* Keyboard */
+ ty += GROUP_LABEL_OFFSET;
+ keyboardGroup = new Fl_Group(tx, ty, width, 0, _("Keyboard"));
+ keyboardGroup->box(FL_ENGRAVED_BOX);
+ keyboardGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP);
+
+ /* Needed for final resize to work sanely */
+ keyboardGroup->resizable(NULL);
+
+ {
+ tx += GROUP_MARGIN;
+ ty += GROUP_MARGIN;
+
+ systemKeysCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
+ CHECK_MIN_WIDTH,
+ CHECK_HEIGHT,
+ _("Pass system keys directly to server (full screen)")));
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
+
+ menuKeyChoice = new Fl_Choice(LBLLEFT(tx, ty, 150, CHOICE_HEIGHT, _("Menu key")));
+
+ fltk_menu_add(menuKeyChoice, _("None"), 0, NULL, (void*)0, FL_MENU_DIVIDER);
+ for (int i = 0; i < getMenuKeySymbolCount(); i++)
+ fltk_menu_add(menuKeyChoice, getMenuKeySymbols()[i].name, 0, NULL, 0, 0);
- ty += CHOICE_HEIGHT + TIGHT_MARGIN;
+ ty += CHOICE_HEIGHT + TIGHT_MARGIN;
+ }
+ ty += GROUP_MARGIN - TIGHT_MARGIN;
+
+ keyboardGroup->end();
+ keyboardGroup->size(keyboardGroup->w(), ty - keyboardGroup->y());
+
+ /* Back to normal */
+ tx = orig_tx;
+ ty += INNER_MARGIN;
+
+ /* Clipboard */
+ ty += GROUP_LABEL_OFFSET;
+ clipboardGroup = new Fl_Group(tx, ty, width, 0, _("Clipboard"));
+ clipboardGroup->box(FL_ENGRAVED_BOX);
+ clipboardGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP);
+
+ /* Needed for final resize to work sanely */
+ clipboardGroup->resizable(NULL);
+
+ {
+ tx += GROUP_MARGIN;
+ ty += GROUP_MARGIN;
+
+ acceptClipboardCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
+ CHECK_MIN_WIDTH,
+ CHECK_HEIGHT,
+ _("Accept clipboard from server")));
+ acceptClipboardCheckbox->callback(handleClipboard, this);
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
+
+#if !defined(WIN32) && !defined(__APPLE__)
+ setPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx + INDENT, ty,
+ CHECK_MIN_WIDTH,
+ CHECK_HEIGHT,
+ _("Also set primary selection")));
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
+#endif
+
+ sendClipboardCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
+ CHECK_MIN_WIDTH,
+ CHECK_HEIGHT,
+ _("Send clipboard to server")));
+ sendClipboardCheckbox->callback(handleClipboard, this);
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
+
+#if !defined(WIN32) && !defined(__APPLE__)
+ sendPrimaryCheckbox = new Fl_Check_Button(LBLRIGHT(tx + INDENT, ty,
+ CHECK_MIN_WIDTH,
+ CHECK_HEIGHT,
+ _("Send primary selection as clipboard")));
+ ty += CHECK_HEIGHT + TIGHT_MARGIN;
+#endif
+ }
+ ty += GROUP_MARGIN - TIGHT_MARGIN;
+
+ clipboardGroup->end();
+ clipboardGroup->size(clipboardGroup->w(), ty - clipboardGroup->y());
+
+ /* Back to normal */
+ tx = orig_tx;
+ ty += INNER_MARGIN;
group->end();
}
{
Fl_Group *group = new Fl_Group(tx, ty, tw, th, _("Display"));
+ int orig_tx;
+ int width;
+
tx += OUTER_MARGIN;
ty += OUTER_MARGIN;
- windowedButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
- RADIO_MIN_WIDTH,
- RADIO_HEIGHT,
- _("Windowed")));
- windowedButton->type(FL_RADIO_BUTTON);
- windowedButton->callback(handleFullScreenMode, this);
- ty += RADIO_HEIGHT + TIGHT_MARGIN;
-
- currentMonitorButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
- RADIO_MIN_WIDTH,
- RADIO_HEIGHT,
- _("Full screen on current monitor")));
- currentMonitorButton->type(FL_RADIO_BUTTON);
- currentMonitorButton->callback(handleFullScreenMode, this);
- ty += RADIO_HEIGHT + TIGHT_MARGIN;
-
- allMonitorsButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
- RADIO_MIN_WIDTH,
- RADIO_HEIGHT,
- _("Full screen on all monitors")));
- allMonitorsButton->type(FL_RADIO_BUTTON);
- allMonitorsButton->callback(handleFullScreenMode, this);
- ty += RADIO_HEIGHT + TIGHT_MARGIN;
-
- selectedMonitorsButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
- RADIO_MIN_WIDTH,
- RADIO_HEIGHT,
- _("Full screen on selected monitor(s)")));
- selectedMonitorsButton->type(FL_RADIO_BUTTON);
- selectedMonitorsButton->callback(handleFullScreenMode, this);
- ty += RADIO_HEIGHT + TIGHT_MARGIN;
-
- /*
- * Right now these occupy all remaining space, but that can probably
- * be reduced if we add more stuff to this page.
- */
- int full_width = tw - OUTER_MARGIN * 2;
- int margin_width = full_width - INDENT;
- int full_height = th;
- int margin_height = full_height - ty + INNER_MARGIN;
-
- monitorArrangement = new MonitorArrangement(
- tx + INDENT,
- ty,
- margin_width,
- margin_height);
-
- ty += CHECK_HEIGHT + margin_height;
+ width = tw - OUTER_MARGIN * 2;
+
+ orig_tx = tx;
+
+ /* Display mode */
+ ty += GROUP_LABEL_OFFSET;
+ displayModeGroup = new Fl_Group(tx, ty, width, 0, _("Display mode"));
+ displayModeGroup->box(FL_ENGRAVED_BOX);
+ displayModeGroup->align(FL_ALIGN_LEFT | FL_ALIGN_TOP);
+
+ /* Needed for final resize to work sanely */
+ displayModeGroup->resizable(NULL);
+
+ {
+ tx += GROUP_MARGIN;
+ ty += GROUP_MARGIN;
+ width -= GROUP_MARGIN * 2;
+
+ windowedButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
+ RADIO_MIN_WIDTH,
+ RADIO_HEIGHT,
+ _("Windowed")));
+ windowedButton->type(FL_RADIO_BUTTON);
+ windowedButton->callback(handleFullScreenMode, this);
+ ty += RADIO_HEIGHT + TIGHT_MARGIN;
+
+ currentMonitorButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
+ RADIO_MIN_WIDTH,
+ RADIO_HEIGHT,
+ _("Full screen on current monitor")));
+ currentMonitorButton->type(FL_RADIO_BUTTON);
+ currentMonitorButton->callback(handleFullScreenMode, this);
+ ty += RADIO_HEIGHT + TIGHT_MARGIN;
+
+ allMonitorsButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
+ RADIO_MIN_WIDTH,
+ RADIO_HEIGHT,
+ _("Full screen on all monitors")));
+ allMonitorsButton->type(FL_RADIO_BUTTON);
+ allMonitorsButton->callback(handleFullScreenMode, this);
+ ty += RADIO_HEIGHT + TIGHT_MARGIN;
+
+ selectedMonitorsButton = new Fl_Round_Button(LBLRIGHT(tx, ty,
+ RADIO_MIN_WIDTH,
+ RADIO_HEIGHT,
+ _("Full screen on selected monitor(s)")));
+ selectedMonitorsButton->type(FL_RADIO_BUTTON);
+ selectedMonitorsButton->callback(handleFullScreenMode, this);
+ ty += RADIO_HEIGHT + TIGHT_MARGIN;
+
+ monitorArrangement = new MonitorArrangement(
+ tx + INDENT, ty,
+ width - INDENT, 150);
+ ty += 150 + TIGHT_MARGIN;
+ }
+ ty += GROUP_MARGIN - TIGHT_MARGIN;
+
+ displayModeGroup->end();
+ displayModeGroup->size(displayModeGroup->w(),
+ ty - displayModeGroup->y());
+
+ /* Back to normal */
+ tx = orig_tx;
+ ty += INNER_MARGIN;
+ width = tw - OUTER_MARGIN * 2;
group->end();
}
_("Ask to reconnect on connection errors")));
ty += CHECK_HEIGHT + TIGHT_MARGIN;
- dotCursorCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
- CHECK_MIN_WIDTH,
- CHECK_HEIGHT,
- _("Show dot when no cursor")));
- ty += CHECK_HEIGHT + TIGHT_MARGIN;
-
group->end();
}