diff options
author | Pierre Ossman <ossman@cendio.se> | 2022-06-16 13:13:03 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2022-12-22 13:36:11 +0100 |
commit | 547c761b2dc26e4ad5f500b5cef9e8a71acd168b (patch) | |
tree | de509d212ea166475e76bcb1a903a9fea8fb0c7a /vncviewer | |
parent | 5b3c7608e00c5d5e50f0df92058e99074894811e (diff) | |
download | tigervnc-547c761b2dc26e4ad5f500b5cef9e8a71acd168b.tar.gz tigervnc-547c761b2dc26e4ad5f500b5cef9e8a71acd168b.zip |
Make ServerDialog use standard layout constants
Makes it easier to adjust the UI from a central place.
Diffstat (limited to 'vncviewer')
-rw-r--r-- | vncviewer/ServerDialog.cxx | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index e153d3d3..54c34b4f 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -55,63 +55,63 @@ static LogWriter vlog("ServerDialog"); 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); } |