# HG changeset patch # User Justus Winter <justus.winter@informatik.uni-hamburg.de> # Date 1236615692 -3600 # Node ID 78c0fa261c84df53da7f69cc8f33dc85fa152f9c # Parent 9638f05098cf2687dbb863f47fd82461c5417403 Add a bookmark button to the toolbar This is useful for embedded devices with touch screens which lack a proper keyboard and the ability to generate right click events. diff -r 9638f05098cf -r 78c0fa261c84 src/pixmaps.h --- a/src/pixmaps.h Mon Mar 09 17:17:51 2009 +0100 +++ b/src/pixmaps.h Mon Mar 09 17:21:32 2009 +0100 @@ -789,6 +789,34 @@ " . . "}; /* XPM */ +static const char * bm_add_xpm[] = { +"22 22 2 1", +" c None", +". c #FF0000", +" ", +" ", +" ", +" ... ", +" ... ", +" ... ", +" ... ", +" ... ", +" ... ", +" ............... ", +" ............... ", +" ............... ", +" ... ", +" ... ", +" ... ", +" ... ", +" ... ", +" ... ", +" ", +" ", +" ", +" "}; + +/* XPM */ static const char *const tools_xpm[] = { "22 22 25 1", " c #None", @@ -1373,6 +1401,28 @@ " .v. wx. "}; /* XPM */ +static const char * bm_add_s_xpm[] = { +"16 16 2 1", +" c None", +". c #FF0000", +" ", +" ", +" .. ", +" .. ", +" .. ", +" .. ", +" .. ", +" ........... ", +" ........... ", +" .. ", +" .. ", +" .. ", +" .. ", +" ", +" ", +" "}; + +/* XPM */ static const char *const tools_s_xpm[] = { "16 16 45 1", " c #7B127D1C7D08", diff -r 9638f05098cf -r 78c0fa261c84 src/ui.cc --- a/src/ui.cc Mon Mar 09 17:17:51 2009 +0100 +++ b/src/ui.cc Mon Mar 09 17:21:32 2009 +0100 @@ -28,6 +28,7 @@ #include "ui.hh" #include "msg.h" #include "timeout.hh" +#include "html_common.hh" // for DilloHtml using namespace fltk; @@ -38,7 +39,7 @@ struct iconset { Image *ImgMeterOK, *ImgMeterBug, - *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools, + *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgBookAdd, *ImgTools, *ImgClear,*ImgSearch; MultiImage *ImgLeftMulti, *ImgRightMulti, *ImgStopMulti; }; @@ -50,6 +51,7 @@ new xpmImage(reload_xpm), new xpmImage(save_xpm), new xpmImage(bm_xpm), + new xpmImage(bm_add_xpm), new xpmImage(tools_xpm), new xpmImage(new_s_xpm), new xpmImage(search_xpm), @@ -68,6 +70,7 @@ new xpmImage(reload_s_xpm), new xpmImage(save_s_xpm), new xpmImage(bm_s_xpm), + new xpmImage(bm_add_s_xpm), new xpmImage(tools_s_xpm), new xpmImage(new_s_xpm), standard_icons.ImgSearch, @@ -324,6 +327,12 @@ a_UIcmd_book(a_UIcmd_get_bw_by_widget(wid)); } break; + case UI_BOOK_ADD: + if (k == 1) { + BrowserWindow *bw = a_UIcmd_get_bw_by_widget(wid); + a_UIcmd_add_bookmark(bw, ((DilloHtml *) a_Bw_get_current_doc(bw))->page_url); + } + break; case UI_TOOLS: if (k == 1 || k == 3) { a_UIcmd_tools(a_UIcmd_get_bw_by_widget(wid), wid); @@ -416,6 +425,12 @@ b->callback(b1_cb, (void *)UI_BOOK); b->clear_tab_to_focus(); + Bookmarks = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Add" : 0); + b->image(icons->ImgBookAdd); + b->tooltip("Add bookmark"); + b->callback(b1_cb, (void *)UI_BOOK_ADD); + b->clear_tab_to_focus(); + Tools = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Tools" : 0); b->image(icons->ImgTools); b->tooltip("Settings"); diff -r 9638f05098cf -r 78c0fa261c84 src/ui.hh --- a/src/ui.hh Mon Mar 09 17:17:51 2009 +0100 +++ b/src/ui.hh Mon Mar 09 17:21:32 2009 +0100 @@ -26,6 +26,7 @@ UI_SAVE, UI_STOP, UI_BOOK, + UI_BOOK_ADD, UI_TOOLS, UI_CLEAR, UI_SEARCH