patch for UI and font_factor
"corvid" <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <20110912073656.GE1530@local> |
I just tried changing the value of FL_NORMAL_SIZE, and I was very surprised by how well everything copes overall. If I had bad vision and needed, say, font_factor=1.4, I'd _strongly_ prefer this patch despite the various bits of UI size hardcoding that it reveals. - I think the Tools menu imperfection comes from "if (flags & (FL_MENU_TOGGLE|FL_MENU_RADIO)) w += 14;" in Fl_Menu.cxx, but I haven't taken the minute to verify that yet. - Choice5 does not handle it well. I made a nicer choice5 a few months ago, but Jorge didn't like it. _______________________________________________ Dillo-dev mailing list [email protected] http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
ui_font_factor.patch
(text/plain, 4.7 KB)
diff -r 9f58c2c1faf3 dw/fltkplatform.cc
--- a/dw/fltkplatform.cc Sun Sep 11 21:38:28 2011 +0000
+++ b/dw/fltkplatform.cc Mon Sep 12 07:21:20 2011 +0000
@@ -307,7 +307,6 @@
b->color(fl_color_cube(FL_NUM_RED-1, FL_NUM_GREEN-1, FL_NUM_BLUE-2));
b->labelcolor(FL_BLACK);
b->labelfont(FL_HELVETICA);
- b->labelsize(14);
b->align(FL_ALIGN_WRAP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
tt_window->resizable(b);
tt_window->end();
diff -r 9f58c2c1faf3 src/dialog.cc
--- a/src/dialog.cc Sun Sep 11 21:38:28 2011 +0000
+++ b/src/dialog.cc Mon Sep 12 07:21:20 2011 +0000
@@ -148,12 +148,9 @@
Fl_Box *box = new Fl_Box(ih+2*gap,gap,ww-(ih+3*gap),ih/2, msg);
box->labelfont(FL_HELVETICA);
- box->labelsize(14);
box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP|FL_ALIGN_WRAP);
CustInput3 *c_inp = new CustInput3(ih+2*gap,gap+ih/2+gap,ww-(ih+3*gap),24);
- c_inp->labelsize(14);
- c_inp->textsize(14);
CustChoice *ch = new CustChoice(1*gap,ih+3*gap,180,24);
if (!pm) {
@@ -276,7 +273,6 @@
buf->text(txt);
Fl_Text_Display *td = new Fl_Text_Display(0,0,ww, wh-bh);
td->buffer(buf);
- td->textsize((int) rint(14.0 * prefs.font_factor));
/* enable wrapping lines; text uses entire width of window */
td->wrap_mode(true, false);
@@ -346,7 +342,6 @@
Fl_Box *box = new Fl_Box(60,0,ww-60,wh-bh, QuestionTxt);
box->labelfont(FL_HELVETICA);
- box->labelsize(14);
box->align(FL_ALIGN_WRAP);
Fl_Button *b;
@@ -402,7 +397,6 @@
Fl_Box *msg = new Fl_Box(20, y, msg_w, 100); /* resized below */
msg->label(message);
msg->labelfont(FL_HELVETICA);
- msg->labelsize(14);
msg->align(FL_ALIGN_INSIDE | FL_ALIGN_TOP_LEFT | FL_ALIGN_WRAP);
fl_font(msg->labelfont(), msg->labelsize());
@@ -414,27 +408,21 @@
/* inputs */
y += msg_h + 20;
Fl_Input *user_input = new Fl_Input(input_x, y, input_w, input_h, "User");
- user_input->labelsize(14);
- user_input->textsize(14);
window->add(user_input);
y += input_h + 10;
Fl_Secret_Input *password_input =
new Fl_Secret_Input(input_x, y, input_w, input_h, "Password");
- password_input->labelsize(14);
- password_input->textsize(14);
window->add(password_input);
/* "OK" button */
y += input_h + 20;
Fl_Button *ok_button = new Fl_Button(200, y, 50, button_h, "OK");
- ok_button->labelsize(14);
ok_button->callback(Dialog_user_password_cb);
window->add(ok_button);
/* "Cancel" button */
Fl_Button *cancel_button =
new Fl_Button(50, y, 100, button_h, "Cancel");
- cancel_button->labelsize(14);
cancel_button->callback(Dialog_user_password_cb);
window->add(cancel_button);
diff -r 9f58c2c1faf3 src/dillo.cc
--- a/src/dillo.cc Sun Sep 11 21:38:28 2011 +0000
+++ b/src/dillo.cc Mon Sep 12 07:21:20 2011 +0000
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
+#include <math.h>
#include <time.h>
#include <signal.h>
#include <locale.h>
@@ -384,6 +385,8 @@
// only way to set the
// default font in fltk1.3
+ FL_NORMAL_SIZE = (Fl_Fontsize) rint(FL_NORMAL_SIZE * prefs.font_factor);
+
// Create a new UI/bw pair
BrowserWindow *bw = a_UIcmd_browser_window_new(0, 0, xid, NULL);
diff -r 9f58c2c1faf3 src/ui.cc
--- a/src/ui.cc Sun Sep 11 21:38:28 2011 +0000
+++ b/src/ui.cc Mon Sep 12 07:21:20 2011 +0000
@@ -13,6 +13,7 @@
#include <unistd.h>
#include <stdio.h>
+#include <math.h>
#include "keys.hh"
#include "ui.hh"
@@ -465,14 +466,14 @@
{
// Images
IProg = new CustProgressBox(p_xpos,p_ypos,pw,bh);
- IProg->labelsize(12);
+ IProg->labelsize(rint(0.85 * FL_NORMAL_SIZE));
IProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
IProg->labelcolor(FL_GRAY_RAMP + 2);
IProg->update_label(wide ? "Images\n0 of 0" : "0 of 0");
p_xpos += pw;
// Page
PProg = new CustProgressBox(p_xpos,p_ypos,pw,bh);
- PProg->labelsize(12);
+ PProg->labelsize(rint(0.85 * FL_NORMAL_SIZE));
PProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
PProg->labelcolor(FL_GRAY_RAMP + 2);
PProg->update_label(wide ? "Page\n0.0KB" : "0.0KB");
diff -r 9f58c2c1faf3 test/dw_ui_test.cc
--- a/test/dw_ui_test.cc Sun Sep 11 21:38:28 2011 +0000
+++ b/test/dw_ui_test.cc Mon Sep 12 07:21:20 2011 +0000
@@ -40,6 +40,8 @@
int main(int argc, char **argv)
{
+ FL_NORMAL_SIZE = 18;
+
FltkPlatform *platform = new FltkPlatform ();
Layout *layout = new Layout (platform);
@@ -58,7 +60,7 @@
FontAttrs fontAttrs;
fontAttrs.name = "Helvetica";
- fontAttrs.size = 14;
+ fontAttrs.size = FL_NORMAL_SIZE;
fontAttrs.weight = 400;
fontAttrs.style = FONT_STYLE_NORMAL;
fontAttrs.letterSpacing = 0;