Hi list, Here is an improved version of my previous patch. The icon is fixed, it's basic but does the job. If someone wants to make a prettier one, I'm open to it. Other improvements as discussed with Rodrigo: - Middle click resets zoom level - There is now a 'show_zoom' preference in dillorc (enabled by default) - The save button has been disabled by default - The zoom button has been moved to the right of the refresh button Please let me know if you find any issues, and hope you enjoy it :) Regards, Alex diff -upr a/dillorc b/dillorc --- a/dillorc Sun Jul 14 18:25:44 2024 +++ b/dillorc Sun Jul 14 18:25:59 2024 @@ -366,7 +366,8 @@ ui_tab_bg_color=#b7beb7 #show_forw=YES #show_home=YES #show_reload=YES -#show_save=YES +#show_zoom=YES +#show_save=NO #show_stop=YES #show_bookmarks=YES #show_tools=YES diff -upr a/src/pixmaps.h b/src/pixmaps.h --- a/src/pixmaps.h Sun Jul 14 18:25:44 2024 +++ b/src/pixmaps.h Sun Jul 14 18:25:59 2024 @@ -809,6 +809,35 @@ static const char *const tools_xpm[] = { " -&X6&=# ", " "}; +/* XPM */ +static const char *const zoom_xpm[] = { +"22 22 3 1", +" c None", +"1 c #B3B3B3", +"2 c #000000", +" 111111 ", +" 1122222211 ", +" 122 221 ", +" 12 21 ", +" 12 21 ", +" 12 11 21 ", +" 12 1221 21 ", +" 12 1221 21 ", +"12 1221 21", +"12 1111221111 21", +"12 122222222221 21", +"12 122222222221 21", +"12 1111221111 21", +"12 1221 21", +" 12 1221 21 ", +" 12 1221 21 ", +" 12 11 21 ", +" 12 21 ", +" 12 2221 ", +" 122 2211221 ", +" 1122222211 1221", +" 111111 122"}; + /* Small icons here */ /* XPM */ @@ -1408,6 +1437,29 @@ static const char *const tools_s_xpm[] = { " u-%#*%0", " feww0g" }; + +/* XPM */ +static const char *const zoom_s_xpm[] = { +"16 16 3 1", +" c None", +"1 c #000000", +"2 c #B3B3B3", +" 222222 ", +" 21111112 ", +" 21 12 ", +" 21 22 12 ", +" 21 2112 12 ", +"21 2112 12", +"21 22211222 12", +"21 2111111112 12", +"21 2111111112 12", +"21 22211222 12", +" 21 2112 12 ", +" 21 2112 122 ", +" 21 22 11112", +" 211111122111", +" 222222 211", +" 22"}; /* XPM */ static const char *const new_s_xpm[] = { diff -upr a/src/prefs.c b/src/prefs.c --- a/src/prefs.c Sun Jul 14 18:25:44 2024 +++ b/src/prefs.c Sun Jul 14 18:25:59 2024 @@ -103,7 +103,8 @@ void a_Prefs_init(void) prefs.show_progress_box = TRUE; prefs.show_quit_dialog = TRUE; prefs.show_reload = TRUE; - prefs.show_save = TRUE; + prefs.show_zoom = TRUE; + prefs.show_save = FALSE; prefs.show_url = TRUE; prefs.show_search = TRUE; prefs.show_stop = TRUE; diff -upr a/src/prefs.h b/src/prefs.h --- a/src/prefs.h Sun Jul 14 18:25:44 2024 +++ b/src/prefs.h Sun Jul 14 18:25:59 2024 @@ -81,6 +81,7 @@ typedef struct { bool_t show_forw; bool_t show_home; bool_t show_reload; + bool_t show_zoom; bool_t show_save; bool_t show_stop; bool_t show_bookmarks; diff -upr a/src/prefsparser.cc b/src/prefsparser.cc --- a/src/prefsparser.cc Sun Jul 14 18:25:44 2024 +++ b/src/prefsparser.cc Sun Jul 14 18:25:59 2024 @@ -213,6 +213,7 @@ void PrefsParser::parse(FILE *fp) { "show_progress_box", &prefs.show_progress_box, PREFS_BOOL, 0 }, { "show_quit_dialog", &prefs.show_quit_dialog, PREFS_BOOL, 0 }, { "show_reload", &prefs.show_reload, PREFS_BOOL, 0 }, + { "show_zoom", &prefs.show_zoom, PREFS_BOOL, 0 }, { "show_save", &prefs.show_save, PREFS_BOOL, 0 }, { "show_url", &prefs.show_url, PREFS_BOOL, 0 }, { "show_search", &prefs.show_search, PREFS_BOOL, 0 }, diff -upr a/src/ui.cc b/src/ui.cc --- a/src/ui.cc Sun Jul 14 18:25:44 2024 +++ b/src/ui.cc Sun Jul 14 18:25:59 2024 @@ -38,7 +38,7 @@ struct iconset { Fl_Image *ImgMeterOK, *ImgMeterBug, - *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools, + *ImgHome, *ImgReload, *ImgZoom, *ImgSave, *ImgBook, *ImgTools, *ImgClear,*ImgSearch, *ImgHelp, *ImgLeft, *ImgLeftIn, *ImgRight, *ImgRightIn, *ImgStop, *ImgStopIn; }; @@ -48,6 +48,7 @@ static struct iconset standard_icons = { new Fl_Pixmap(mini_bug_xpm), new Fl_Pixmap(home_xpm), new Fl_Pixmap(reload_xpm), + new Fl_Pixmap(zoom_xpm), new Fl_Pixmap(save_xpm), new Fl_Pixmap(bm_xpm), new Fl_Pixmap(tools_xpm), @@ -67,6 +68,7 @@ static struct iconset small_icons = { standard_icons.ImgMeterBug, new Fl_Pixmap(home_s_xpm), new Fl_Pixmap(reload_s_xpm), + new Fl_Pixmap(zoom_s_xpm), new Fl_Pixmap(save_s_xpm), new Fl_Pixmap(bm_s_xpm), new Fl_Pixmap(tools_s_xpm), @@ -356,6 +358,15 @@ static void b1_cb(Fl_Widget *wid, void *cb_data) wid->y() + wid->h()); } break; + case UI_ZOOM: + if (b == FL_LEFT_MOUSE) { + a_UIcmd_zoom_in(a_UIcmd_get_bw_by_widget(wid)); + } else if (b == FL_RIGHT_MOUSE) { + a_UIcmd_zoom_out(a_UIcmd_get_bw_by_widget(wid)); + } else if (b == FL_MIDDLE_MOUSE) { + a_UIcmd_zoom_reset(a_UIcmd_get_bw_by_widget(wid)); + } + break; default: break; } @@ -429,6 +440,7 @@ void UI::make_toolbar(int tw, int th) Forw = make_button("Forw", icons->ImgRight, icons->ImgRightIn, UI_FORW); Home = make_button("Home", icons->ImgHome, NULL, UI_HOME); Reload = make_button("Reload", icons->ImgReload, NULL, UI_RELOAD); + Zoom = make_button("Zoom", icons->ImgZoom, NULL, UI_ZOOM); Save = make_button("Save", icons->ImgSave, NULL, UI_SAVE); Stop = make_button("Stop", icons->ImgStop, icons->ImgStopIn, UI_STOP); Bookmarks = make_button("Book", icons->ImgBook, NULL, UI_BOOK); @@ -438,6 +450,7 @@ void UI::make_toolbar(int tw, int th) Forw->set_tooltip("Next page"); Home->set_tooltip("Go to the Home page"); Reload->set_tooltip("Reload"); + Zoom->set_tooltip("Zoom: left-click, Zoom out: right-click, Reset: middle"); Save->set_tooltip("Save this page"); Stop->set_tooltip("Stop loading"); Bookmarks->set_tooltip("View bookmarks"); @@ -952,6 +965,8 @@ void UI::customize() Home->hide(); if ( !prefs.show_reload ) Reload->hide(); + if ( !prefs.show_zoom ) + Zoom->hide(); if ( !prefs.show_save ) Save->hide(); if ( !prefs.show_stop ) diff -upr a/src/ui.hh b/src/ui.hh --- a/src/ui.hh Sun Jul 14 18:25:44 2024 +++ b/src/ui.hh Sun Jul 14 18:25:59 2024 @@ -19,6 +19,7 @@ typedef enum { UI_FORW, UI_HOME, UI_RELOAD, + UI_ZOOM, UI_SAVE, UI_STOP, UI_BOOK, @@ -124,7 +125,7 @@ class UI : public CustGroupVertical { CustTabs *Tabs; CustGroupVertical *TopGroup; - CustButton *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, + CustButton *Back, *Forw, *Home, *Reload, *Zoom, *Save, *Stop, *Bookmarks, *Tools, *Clear, *Search, *Help, *BugMeter, *FileButton; CustGroupHorizontal *LocBar, *NavBar, *StatusBar; Fl_Input *Location;
Hi, On Sun, Jul 14, 2024 at 07:02:50PM +0200, a1ex@dismail.de wrote:
Hi list,
Here is an improved version of my previous patch.
The icon is fixed, it's basic but does the job. If someone wants to make a prettier one, I'm open to it.
Other improvements as discussed with Rodrigo:
- Middle click resets zoom level - There is now a 'show_zoom' preference in dillorc (enabled by default) - The save button has been disabled by default - The zoom button has been moved to the right of the refresh button
Please let me know if you find any issues, and hope you enjoy it :)
Thanks!, so far it seems to be working fine. I'll try to get it merged soon. Best, Rodrigo.
Hi Rodrigo, On Sun, 14 Jul 2024 20:17:44 +0200 Rodrigo Arias <rodarima@gmail.com> wrote:
Hi,
On Sun, Jul 14, 2024 at 07:02:50PM +0200, a1ex@dismail.de wrote:
Hi list,
Here is an improved version of my previous patch.
The icon is fixed, it's basic but does the job. If someone wants to make a prettier one, I'm open to it.
Other improvements as discussed with Rodrigo:
- Middle click resets zoom level - There is now a 'show_zoom' preference in dillorc (enabled by default) - The save button has been disabled by default - The zoom button has been moved to the right of the refresh button
Please let me know if you find any issues, and hope you enjoy it :)
Thanks!, so far it seems to be working fine.
I'll try to get it merged soon.
Just wanted to check if there is anything else that needs to be addressed with this patch. If so, please let me know and I will work on it. Thanks, Alex
Hi, On Tue, Aug 06, 2024 at 01:14:26PM +0200, a1ex@dismail.de wrote:
Thanks!, so far it seems to be working fine.
I'll try to get it merged soon.
Just wanted to check if there is anything else that needs to be addressed with this patch. If so, please let me know and I will work on it.
I think it is good as-is, I just need to test it for a bit. I'll try to merge it once I finish with other changes I'm working on. It is queued for 3.2.0: https://github.com/dillo-browser/dillo/issues/235 Best, Rodrigo.
Hi, On Tue, Aug 06, 2024 at 01:27:38PM +0200, Rodrigo Arias wrote:
Hi,
On Tue, Aug 06, 2024 at 01:14:26PM +0200, a1ex@dismail.de wrote:
Thanks!, so far it seems to be working fine.
I'll try to get it merged soon.
Just wanted to check if there is anything else that needs to be addressed with this patch. If so, please let me know and I will work on it.
I think it is good as-is, I just need to test it for a bit. I'll try to merge it once I finish with other changes I'm working on. It is queued for 3.2.0:
I'm working on a zoom icon that a bit more similar to the other icons, but I'm having problems to avoid aliasing in the border due to the limitations of XPM with the alpha transparency. I attach two screenshots, one (zoom.png) with the icon background set to the same color of the menu so the alpha is blended properly (but the icon is not transparent). And another one (zoom-alias.png) with the alpha cutoff at half, so alpha values less than 127 are converted to transparent pixels. This one shows some aliasing in the borders, but it works fine if you change the menu color. Not sure if there is a good solution to this problem, other than manually making the aliasing work well with a sharp border. The other icons cleverly avoid this problem by doing rectangular shapes. I'm also considering leaving the save button by default for now, and moving the zoom button to the right, so we preserve the "muscle memory" of users. I need to play a bit more to see how it "feels". Best, Rodrigo.
Hi, On Thu, 8 Aug 2024 14:45:33 +0200 Rodrigo Arias <rodarima@gmail.com> wrote:
I'm working on a zoom icon that a bit more similar to the other icons, but I'm having problems to avoid aliasing in the border due to the limitations of XPM with the alpha transparency.
I attach two screenshots, one (zoom.png) with the icon background set to the same color of the menu so the alpha is blended properly (but the icon is not transparent).
And another one (zoom-alias.png) with the alpha cutoff at half, so alpha values less than 127 are converted to transparent pixels. This one shows some aliasing in the borders, but it works fine if you change the menu color.
Not sure if there is a good solution to this problem, other than manually making the aliasing work well with a sharp border. The other icons cleverly avoid this problem by doing rectangular shapes.
The reload button, especially the small one, shows the same issue. But for me it's barely noticable, and I think your icon looks fine!
I'm also considering leaving the save button by default for now, and moving the zoom button to the right, so we preserve the "muscle memory" of users. I need to play a bit more to see how it "feels".
Yeah, I had also considered that, and agree it might be better to leave the save button. It could result in an unexpected surprise to users upgrading to a new version and saying "Hey, where's the save button!". Regards, Alex
participants (2)
-
a1ex@dismail.de
-
Rodrigo Arias