Re: Feature idea: zoom buttons

<[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
On Sat, 6 Jul 2024 14:30:01 +0200
Rodrigo Arias <[email protected]> wrote:

> Hi Alex,
> 
> >Here is a patch which allows zooming in and out using the Refresh
> >button. Right clicking on it zooms the page in. Middle clicking zooms
> >out. It's not especially intuitive, but it's simple and it works.  
> 
> I agree is not very intuitive, maybe using the scroll wheel may be
> more clear. But still, tying it to the refresh button is weird to me.
> 
> On the other hand, I like that you can see the whole page while
> changing the zoom level using the mouse (which doesn't happen in
> other browsers). I'm thinking if it could make sense to add another
> "appearance" bar (usually hidden) like the "find text" where we can
> put some knobs to change the page appearance, like the zoom buttons
> or sliders but also maybe some of the CSS options too.
> 
> I think this would also make more sense if we can select multiple
> "user" styles to implement some king of reader mode, as you will want
> to see the effect without covering the canvas.

Your idea of an "appearance" bar sounds interesting. I was originally
thinking it would be neat to have the zoom buttons on the bottom next
to the bugmeter, similar to what you are suggesting.

Since that sounds more like a long-term goal, I have come up with a
patch to create a dedicated zoom button on the toolbar. Left-click
zooms in, right-click zooms out. Its just a proof of concept, but if you
like the idea, maybe I could polish it up and make an optional setting
for it, etc. Here you go:


diff -u ./pixmaps.h mod/pixmaps.h
--- ./pixmaps.h	Sat Jul  6 18:03:43 2024
+++ mod/pixmaps.h	Sat Jul  6 18:23:27 2024
@@ -1410,6 +1410,28 @@
 };
 
 /* XPM */
+static const char *const zoom_xpm[] = {
+"16 16 2 1",
+"       c None",
+"@      c gray70",
+"                ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+" @@@@@@@@@@@@@  ",
+" @@@@@@@@@@@@@  ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"                "};
+
+/* XPM */
 static const char *const new_s_xpm[] = {
 "11 11 35 1",
 "       c None",
diff -u ./ui.cc mod/ui.cc
--- ./ui.cc	Sat Jul  6 18:26:52 2024
+++ mod/ui.cc	Sat Jul  6 18:03:57 2024
@@ -38,7 +38,7 @@
 
 struct iconset {
    Fl_Image *ImgMeterOK, *ImgMeterBug,
-            *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
+            *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools, *ImgZoom,
             *ImgClear,*ImgSearch, *ImgHelp, *ImgLeft, *ImgLeftIn,
             *ImgRight, *ImgRightIn, *ImgStop, *ImgStopIn;
 };
@@ -51,6 +51,7 @@
    new Fl_Pixmap(save_xpm),
    new Fl_Pixmap(bm_xpm),
    new Fl_Pixmap(tools_xpm),
+   new Fl_Pixmap(zoom_xpm),
    new Fl_Pixmap(new_s_xpm),
    new Fl_Pixmap(search_xpm),
    new Fl_Pixmap(help_xpm),
@@ -70,6 +71,7 @@
    new Fl_Pixmap(save_s_xpm),
    new Fl_Pixmap(bm_s_xpm),
    new Fl_Pixmap(tools_s_xpm),
+   new Fl_Pixmap(zoom_xpm),
    new Fl_Pixmap(new_s_xpm),
    standard_icons.ImgSearch,
    standard_icons.ImgHelp,
@@ -356,6 +358,13 @@
                        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));
+      } 
+      break;      
    default:
       break;
    }
@@ -433,6 +442,7 @@
    Stop = make_button("Stop", icons->ImgStop, icons->ImgStopIn, UI_STOP);
    Bookmarks = make_button("Book", icons->ImgBook, NULL, UI_BOOK);
    Tools = make_button("Tools", icons->ImgTools, NULL, UI_TOOLS);
+   Zoom = make_button("Zoom", icons->ImgZoom, NULL, UI_ZOOM);
 
    Back->set_tooltip("Previous page");
    Forw->set_tooltip("Next page");
@@ -442,6 +452,7 @@
    Stop->set_tooltip("Stop loading");
    Bookmarks->set_tooltip("View bookmarks");
    Tools->set_tooltip("Settings");
+   Tools->set_tooltip("Zoom");   
 }
 
 /**
diff -u ./ui.hh mod/ui.hh
--- ./ui.hh	Sat Jul  6 18:03:43 2024
+++ mod/ui.hh	Sat Jul  6 18:03:57 2024
@@ -23,6 +23,7 @@
    UI_STOP,
    UI_BOOK,
    UI_TOOLS,
+   UI_ZOOM,
    UI_CLEAR,
    UI_SEARCH
 } UIButton;
@@ -125,7 +126,7 @@
 
    CustGroupVertical *TopGroup;
    CustButton *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks,
-              *Tools, *Clear, *Search, *Help, *BugMeter, *FileButton;
+              *Tools, *Zoom, *Clear, *Search, *Help, *BugMeter, *FileButton;
    CustGroupHorizontal *LocBar, *NavBar, *StatusBar;
    Fl_Input *Location;
    CustProgressBox *PProg, *IProg;


Regards,
Alex

_______________________________________________
Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected]
To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected]
zoom-button.patch (text/x-patch, 3 KB)
Only in .: mod
diff -u ./pixmaps.h mod/pixmaps.h
--- ./pixmaps.h	Sat Jul  6 18:03:43 2024
+++ mod/pixmaps.h	Sat Jul  6 18:23:27 2024
@@ -1410,6 +1410,28 @@
 };
 
 /* XPM */
+static const char *const zoom_xpm[] = {
+"16 16 2 1",
+"       c None",
+"@      c gray70",
+"                ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+" @@@@@@@@@@@@@  ",
+" @@@@@@@@@@@@@  ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"       @@       ",
+"                "};
+
+/* XPM */
 static const char *const new_s_xpm[] = {
 "11 11 35 1",
 "       c None",
diff -u ./ui.cc mod/ui.cc
--- ./ui.cc	Sat Jul  6 18:26:52 2024
+++ mod/ui.cc	Sat Jul  6 18:03:57 2024
@@ -38,7 +38,7 @@
 
 struct iconset {
    Fl_Image *ImgMeterOK, *ImgMeterBug,
-            *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
+            *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools, *ImgZoom,
             *ImgClear,*ImgSearch, *ImgHelp, *ImgLeft, *ImgLeftIn,
             *ImgRight, *ImgRightIn, *ImgStop, *ImgStopIn;
 };
@@ -51,6 +51,7 @@
    new Fl_Pixmap(save_xpm),
    new Fl_Pixmap(bm_xpm),
    new Fl_Pixmap(tools_xpm),
+   new Fl_Pixmap(zoom_xpm),
    new Fl_Pixmap(new_s_xpm),
    new Fl_Pixmap(search_xpm),
    new Fl_Pixmap(help_xpm),
@@ -70,6 +71,7 @@
    new Fl_Pixmap(save_s_xpm),
    new Fl_Pixmap(bm_s_xpm),
    new Fl_Pixmap(tools_s_xpm),
+   new Fl_Pixmap(zoom_xpm),
    new Fl_Pixmap(new_s_xpm),
    standard_icons.ImgSearch,
    standard_icons.ImgHelp,
@@ -356,6 +358,13 @@
                        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));
+      } 
+      break;      
    default:
       break;
    }
@@ -433,6 +442,7 @@
    Stop = make_button("Stop", icons->ImgStop, icons->ImgStopIn, UI_STOP);
    Bookmarks = make_button("Book", icons->ImgBook, NULL, UI_BOOK);
    Tools = make_button("Tools", icons->ImgTools, NULL, UI_TOOLS);
+   Zoom = make_button("Zoom", icons->ImgZoom, NULL, UI_ZOOM);
 
    Back->set_tooltip("Previous page");
    Forw->set_tooltip("Next page");
@@ -442,6 +452,7 @@
    Stop->set_tooltip("Stop loading");
    Bookmarks->set_tooltip("View bookmarks");
    Tools->set_tooltip("Settings");
+   Tools->set_tooltip("Zoom");   
 }
 
 /**
diff -u ./ui.hh mod/ui.hh
--- ./ui.hh	Sat Jul  6 18:03:43 2024
+++ mod/ui.hh	Sat Jul  6 18:03:57 2024
@@ -23,6 +23,7 @@
    UI_STOP,
    UI_BOOK,
    UI_TOOLS,
+   UI_ZOOM,
    UI_CLEAR,
    UI_SEARCH
 } UIButton;
@@ -125,7 +126,7 @@
 
    CustGroupVertical *TopGroup;
    CustButton *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks,
-              *Tools, *Clear, *Search, *Help, *BugMeter, *FileButton;
+              *Tools, *Zoom, *Clear, *Search, *Help, *BugMeter, *FileButton;
    CustGroupHorizontal *LocBar, *NavBar, *StatusBar;
    Fl_Input *Location;
    CustProgressBox *PProg, *IProg;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.