summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/pixmaps.h36
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/prefsparser.cc1
-rw-r--r--src/ui.cc32
-rw-r--r--src/ui.hh2
7 files changed, 72 insertions, 3 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 0994c9fc..95da3d05 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-AM_CPPFLAGS=-DDILLO_SYSCONF='"$(sysconfdir)/"' @LIBJPEG_CPPFLAGS@
+AM_CPPFLAGS=-DDILLO_SYSCONF='"$(sysconfdir)/"' -DDILLO_DOCDIR='"$(docdir)/"' @LIBJPEG_CPPFLAGS@
AM_CFLAGS = @LIBPNG_CFLAGS@
AM_CXXFLAGS = -I.. @LIBPNG_CFLAGS@ @LIBFLTK_CXXFLAGS@
diff --git a/src/pixmaps.h b/src/pixmaps.h
index 060ec2cb..83235dd2 100644
--- a/src/pixmaps.h
+++ b/src/pixmaps.h
@@ -1521,6 +1521,42 @@ static const char *const search_xpm[] = {
" 11 "};
/* XPM */
+static const char *const help_xpm[] = {
+"14 16 16 1",
+" c None",
+"1 c #DBDBDB",
+"2 c #B6B6B6",
+"3 c #929292",
+"4 c #6D6D6D",
+"5 c #F1EFEF",
+"6 c #018B00",
+"7 c #A48A53",
+"8 c #A4BDA4",
+"9 c #000000",
+"A c #000000",
+"B c #000000",
+"C c #000000",
+"D c #000000",
+"E c #000000",
+"F c #000000",
+" 5555555 ",
+" 544433355 ",
+" 54555438455 ",
+" 44555542835 ",
+" 44445548245 ",
+" 4444554274 ",
+" 544554274 ",
+" 55474 ",
+" 5474 ",
+" 544 ",
+" 44 ",
+" ",
+" 5445 ",
+" 4764 ",
+" 4674 ",
+" 5445 "};
+
+/* XPM */
static const char *const full_screen_on_xpm[] = {
"13 15 2 1",
" c None",
diff --git a/src/prefs.c b/src/prefs.c
index e65d8e1a..6d073251 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -76,6 +76,7 @@ void a_Prefs_init(void)
prefs.show_extra_warnings = FALSE;
prefs.show_filemenu=TRUE;
prefs.show_forw = TRUE;
+ prefs.show_help = TRUE;
prefs.show_home = TRUE;
prefs.show_msg = TRUE;
prefs.show_progress_box = TRUE;
diff --git a/src/prefs.h b/src/prefs.h
index f3e0a977..f5eef724 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -63,6 +63,7 @@ struct _DilloPrefs {
bool_t show_clear_url;
bool_t show_url;
bool_t show_search;
+ bool_t show_help;
bool_t show_progress_box;
bool_t fullwindow_start;
bool_t load_images;
diff --git a/src/prefsparser.cc b/src/prefsparser.cc
index e77aecf6..3b4dc6e1 100644
--- a/src/prefsparser.cc
+++ b/src/prefsparser.cc
@@ -84,6 +84,7 @@ int PrefsParser::parseOption(char *name, char *value)
{ "show_extra_warnings", &prefs.show_extra_warnings, PREFS_BOOL },
{ "show_filemenu", &prefs.show_filemenu, PREFS_BOOL },
{ "show_forw", &prefs.show_forw, PREFS_BOOL },
+ { "show_help", &prefs.show_help, PREFS_BOOL },
{ "show_home", &prefs.show_home, PREFS_BOOL },
{ "show_msg", &prefs.show_msg, PREFS_BOOL },
{ "show_progress_box", &prefs.show_progress_box, PREFS_BOOL },
diff --git a/src/ui.cc b/src/ui.cc
index cc99b5ac..1561d5ac 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -11,6 +11,7 @@
// UI for Dillo
+#include <unistd.h>
#include <stdio.h>
#include <fltk/HighlightButton.h>
@@ -40,7 +41,7 @@ using namespace fltk;
struct iconset {
Image *ImgMeterOK, *ImgMeterBug,
*ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
- *ImgClear,*ImgSearch;
+ *ImgClear,*ImgSearch, *ImgHelp;
MultiImage *ImgLeftMulti, *ImgRightMulti, *ImgStopMulti;
};
@@ -54,6 +55,7 @@ static struct iconset standard_icons = {
new xpmImage(tools_xpm),
new xpmImage(new_s_xpm),
new xpmImage(search_xpm),
+ new xpmImage(help_xpm),
new MultiImage(*new xpmImage(left_xpm), INACTIVE_R,
*new xpmImage(left_i_xpm)),
new MultiImage(*new xpmImage(right_xpm), INACTIVE_R,
@@ -72,6 +74,7 @@ static struct iconset small_icons = {
new xpmImage(tools_s_xpm),
new xpmImage(new_s_xpm),
standard_icons.ImgSearch,
+ standard_icons.ImgHelp,
new MultiImage(*new xpmImage(left_s_xpm), INACTIVE_R,
*new xpmImage(left_si_xpm)),
new MultiImage(*new xpmImage(right_s_xpm), INACTIVE_R,
@@ -216,6 +219,25 @@ static void search_cb(Widget *wid, void *data)
}
/*
+ * Callback for the help button.
+ */
+static void help_cb(Widget *w, void *)
+{
+ char *path = dStrconcat(DILLO_DOCDIR, "user_help.html", NULL);
+ BrowserWindow *bw = a_UIcmd_get_bw_by_widget(w);
+
+ if (access(path, R_OK) == 0) {
+ char *urlstr = dStrconcat("file:", path, NULL);
+ a_UIcmd_open_urlstr(bw, urlstr);
+ dFree(urlstr);
+ } else {
+ MSG("Can't read local help file at \"%s\". Getting remote help...\n", path);
+ a_UIcmd_open_urlstr(bw, "http://www.dillo.org/dillo2-help.html");
+ }
+ dFree(path);
+}
+
+/*
* Callback for the File menu button.
*/
static void filemenu_cb(Widget *wid, void *)
@@ -455,6 +477,11 @@ PackedGroup *UI::make_location()
b->callback(search_cb, this);
b->clear_tab_to_focus();
+ Help = b = new HighlightButton(0,0,16,22,0);
+ b->image(icons->ImgHelp);
+ b->callback(help_cb, this);
+ b->clear_tab_to_focus();
+
pg->type(PackedGroup::ALL_CHILDREN_VERTICAL);
pg->resizable(i);
pg->end();
@@ -463,6 +490,7 @@ PackedGroup *UI::make_location()
Clear->tooltip("Clear the URL box.\nMiddle-click to paste a URL.");
Location->tooltip("Location");
Search->tooltip("Search the Web");
+ Help->tooltip("Help");
}
return pg;
}
@@ -986,6 +1014,8 @@ void UI::customize(int flags)
Location->hide();
if ( !prefs.show_search )
Search->hide();
+ if ( !prefs.show_help )
+ Help->hide();
if ( !prefs.show_progress_box )
ProgBox->hide();
}
diff --git a/src/ui.hh b/src/ui.hh
index 92297643..9e1b6d4f 100644
--- a/src/ui.hh
+++ b/src/ui.hh
@@ -48,7 +48,7 @@ class UI : public fltk::Group {
fltk::Group *TopGroup;
fltk::Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, *Tools,
- *Clear, *Search, *FullScreen, *BugMeter, *FileButton;
+ *Clear, *Search, *Help, *FullScreen, *BugMeter, *FileButton;
fltk::Input *Location;
fltk::PackedGroup *ProgBox;
CustProgressBox *PProg, *IProg;