Navigation by pages
<[email protected]> Sun, 6 Oct 2024 13:40:17 +0200
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Rodrigo, I saw your recent issue on GH: https://github.com/dillo-browser/dillo/issues/268 This is something I have thought about for quite a while. Basically, scrolling sucks, and it would be nice to be able to move up and down the page more cleanly. Obviously we can use PgUP/PgDN keys and spacebar, but I always wanted a way to do this with mouse-only. In the past I had scripted a small window which sits on-top of Dillo in the corner, which had 2 buttons: up and down. This works, but is a bit clunky. So, while I don't have a quick solution to the layout / pagination issues you mentioned, I created a simple toolbar icon which allows page navigation with the mouse. I think it really makes it easier when reading a long page. Patch and screenshot attached. Regards, Alex _______________________________________________ Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected] To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected]
page-button.png
(image/png, 50.7 KB) - not displayed
08-page-button.patch
(text/x-patch, 6.5 KB)
diff -upr a/dillorc b/dillorc
--- a/dillorc Sat Oct 5 09:47:01 2024
+++ b/dillorc Sun Oct 6 13:05:30 2024
@@ -366,7 +366,8 @@ ui_tab_bg_color=#b7beb7
#show_forw=YES
#show_home=YES
#show_reload=YES
-#show_save=YES
+#show_page=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 Sat Oct 5 09:47:01 2024
+++ b/src/pixmaps.h Sun Oct 6 13:05:40 2024
@@ -809,6 +809,35 @@ static const char *const tools_xpm[] = {
" -&X6&=# ",
" "};
+/* XPM */
+static const char *page_xpm[] = {
+"22 22 3 1",
+" c None",
+"1 c #B3B3B3",
+"2 c #000000",
+" ",
+" 2 ",
+" 212 ",
+" 21212 ",
+" 212 212 ",
+" 212 212 ",
+" 212 212 ",
+" 212 212 ",
+" 212 212 ",
+" 21222222222222212 ",
+" 2111111111111111112 ",
+"222222222222222222222 ",
+" 2111111111111111112 ",
+" 21222222222222212 ",
+" 212 212 ",
+" 212 212 ",
+" 212 212 ",
+" 212 212 ",
+" 212 212 ",
+" 21212 ",
+" 212 ",
+" 2 "};
+
/* Small icons here */
/* XPM */
@@ -1408,6 +1437,29 @@ static const char *const tools_s_xpm[] = {
" u-%#*%0",
" feww0g"
};
+
+/* XPM */
+static const char *page_s_xpm[] = {
+"16 16 3 1",
+" c None",
+"1 c #B3B3B3",
+"2 c #000000",
+" ",
+" 2 ",
+" 212 ",
+" 21212 ",
+" 212 212 ",
+" 212 212 ",
+" 21222222212 ",
+" 2111111111112 ",
+"222222222222222 ",
+" 2111111111112 ",
+" 21222222212 ",
+" 212 212 ",
+" 212 212 ",
+" 21212 ",
+" 212 ",
+" 2 "};
/* XPM */
static const char *const new_s_xpm[] = {
diff -upr a/src/prefs.c b/src/prefs.c
--- a/src/prefs.c Sat Oct 5 09:47:01 2024
+++ b/src/prefs.c Sun Oct 6 13:05:30 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_page = 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 Sat Oct 5 09:47:01 2024
+++ b/src/prefs.h Sun Oct 6 13:05:30 2024
@@ -81,6 +81,7 @@ typedef struct {
bool_t show_forw;
bool_t show_home;
bool_t show_reload;
+ bool_t show_page;
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 Sat Oct 5 09:47:01 2024
+++ b/src/prefsparser.cc Sun Oct 6 13:05:30 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_page", &prefs.show_page, 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 Sat Oct 5 09:47:01 2024
+++ b/src/ui.cc Sun Oct 6 13:05:30 2024
@@ -38,7 +38,7 @@
struct iconset {
Fl_Image *ImgMeterOK, *ImgMeterBug,
- *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
+ *ImgHome, *ImgReload, *ImgPage, *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(page_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(page_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_PAGE:
+ if (b == FL_LEFT_MOUSE) {
+ a_UIcmd_scroll(a_UIcmd_get_bw_by_widget(wid), KEYS_SCREEN_DOWN);
+ } else if (b == FL_RIGHT_MOUSE) {
+ a_UIcmd_scroll(a_UIcmd_get_bw_by_widget(wid), KEYS_SCREEN_UP);
+ } else if (b == FL_MIDDLE_MOUSE) {
+
+ }
+ 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);
+ Page = make_button("Page", icons->ImgPage, NULL, UI_PAGE);
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");
+ Page->set_tooltip("Left-click: page-down, Right-click: page-up");
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_page )
+ Page->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 Sat Oct 5 09:47:01 2024
+++ b/src/ui.hh Sun Oct 6 13:05:30 2024
@@ -19,6 +19,7 @@ typedef enum {
UI_FORW,
UI_HOME,
UI_RELOAD,
+ UI_PAGE,
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, *Page, *Save, *Stop, *Bookmarks,
*Tools, *Clear, *Search, *Help, *BugMeter, *FileButton;
CustGroupHorizontal *LocBar, *NavBar, *StatusBar;
Fl_Input *Location;