const char* SERVER_HISTORY="tigervnc.history";
ServerDialog::ServerDialog()
- : Fl_Window(450, 160, _("VNC Viewer: Connection Details"))
+ : Fl_Window(450, 0, _("VNC Viewer: Connection Details"))
{
- int x, y;
+ int x, y, x2;
Fl_Button *button;
Fl_Box *divider;
- int margin = 20;
- int server_label_width = gui_str_len(_("VNC server:"));
-
- x = margin + server_label_width;
- y = margin;
-
- serverName = new Fl_Input_Choice(x, y, w() - margin*2 - server_label_width, INPUT_HEIGHT, _("VNC server:"));
usedDir = NULL;
- int adjust = (w() - 20) / 4;
- int button_width = adjust - margin/2;
+ x = OUTER_MARGIN;
+ y = OUTER_MARGIN;
- x = margin;
- y = margin + margin/2 + INPUT_HEIGHT;
+ serverName = new Fl_Input_Choice(LBLLEFT(x, y, w() - OUTER_MARGIN*2,
+ INPUT_HEIGHT, _("VNC server:")));
+ y += INPUT_HEIGHT + INNER_MARGIN;
- y += margin/2;
+ x2 = x;
- button = new Fl_Button(x, y, button_width, BUTTON_HEIGHT, _("Options..."));
+ button = new Fl_Button(x2, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("Options..."));
button->callback(this->handleOptions, this);
-
- x += adjust;
-
- button = new Fl_Button(x, y, button_width, BUTTON_HEIGHT, _("Load..."));
- button->callback(this->handleLoad, this);
+ x2 += BUTTON_WIDTH + INNER_MARGIN;
- x += adjust;
+ button = new Fl_Button(x2, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("Load..."));
+ button->callback(this->handleLoad, this);
+ x2 += BUTTON_WIDTH + INNER_MARGIN;
- button = new Fl_Button(x, y, button_width, BUTTON_HEIGHT, _("Save As..."));
+ button = new Fl_Button(x2, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("Save As..."));
button->callback(this->handleSaveAs, this);
-
- x = 0;
- y += margin/2 + BUTTON_HEIGHT;
+ x2 += BUTTON_WIDTH + INNER_MARGIN;
- divider = new Fl_Box(x, y, w(), 2);
+ y += BUTTON_HEIGHT + INNER_MARGIN;
+
+ divider = new Fl_Box(0, y, w(), 2);
divider->box(FL_THIN_DOWN_FRAME);
-
- x += margin;
- y += margin/2;
- button = new Fl_Button(x, y, button_width, BUTTON_HEIGHT, _("About..."));
+ y += divider->h() + INNER_MARGIN;
+
+ // Symmetric margin around bottom button bar
+ y += OUTER_MARGIN - INNER_MARGIN;
+
+ button = new Fl_Button(x, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("About..."));
button->callback(this->handleAbout, this);
- x = w() - margin - adjust - button_width - 20;
+ x2 = w() - OUTER_MARGIN - BUTTON_WIDTH*2 - INNER_MARGIN*1;
- button = new Fl_Button(x, y, button_width, BUTTON_HEIGHT, _("Cancel"));
+ button = new Fl_Button(x2, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("Cancel"));
button->callback(this->handleCancel, this);
+ x2 += BUTTON_WIDTH + INNER_MARGIN;
- x += adjust;
-
- button = new Fl_Return_Button(x, y, button_width+20, BUTTON_HEIGHT, _("Connect"));
+ button = new Fl_Return_Button(x2, y, BUTTON_WIDTH, BUTTON_HEIGHT, _("Connect"));
button->callback(this->handleConnect, this);
+ x2 += BUTTON_WIDTH + INNER_MARGIN;
+
+ y += BUTTON_HEIGHT + INNER_MARGIN;
+
+ /* Needed for resize to work sanely */
+ resizable(NULL);
+ h(y-INNER_MARGIN+OUTER_MARGIN);
callback(this->handleCancel, this);
}