aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dialog.cc6
-rw-r--r--src/dillo.cc66
-rw-r--r--src/domain.c12
-rw-r--r--src/form.cc27
-rw-r--r--src/prefs.h7
-rw-r--r--src/tipwin.cc2
-rw-r--r--src/uicmd.cc16
7 files changed, 58 insertions, 78 deletions
diff --git a/src/dialog.cc b/src/dialog.cc
index 484eebc4..92b99041 100644
--- a/src/dialog.cc
+++ b/src/dialog.cc
@@ -82,9 +82,9 @@ int CustInput3::handle(int e)
/*
* Used to make the ENTER key activate the CustChoice
*/
-class CustChoice : public Fl_Choice {
+class CustChoice2 : public Fl_Choice {
public:
- CustChoice (int x, int y, int w, int h, const char* l=0) :
+ CustChoice2 (int x, int y, int w, int h, const char* l=0) :
Fl_Choice(x,y,w,h,l) {};
int handle(int e) {
if (e == FL_KEYBOARD &&
@@ -178,7 +178,7 @@ const char *a_Dialog_input(const char *title, const char *msg)
c_inp->labelsize(14);
c_inp->textsize(14);
- CustChoice *ch = new CustChoice(1*gap,ih+3*gap,180,24);
+ CustChoice2 *ch = new CustChoice2(1*gap,ih+3*gap,180,24);
if (!pm) {
int n_it = dList_length(prefs.search_urls);
pm = new Fl_Menu_Item[n_it+1];
diff --git a/src/dillo.cc b/src/dillo.cc
index 5ad34e78..cef3e451 100644
--- a/src/dillo.cc
+++ b/src/dillo.cc
@@ -237,43 +237,47 @@ static void checkPreferredFonts()
checkFont(prefs.font_fantasy, "fantasy");
}
-static void setColorFLTK(int32_t color, void (*fn) (uchar, uchar, uchar))
+/*
+ * Set UI color. 'color' is an 0xrrggbb value, whereas 'default_val' is a fltk
+ * color (index 0-0xFF, or 0xrrggbb00).
+ */
+static void setUIColorWdef(Fl_Color idx, int32_t color, Fl_Color default_val)
{
if (color != -1)
- fn(color >> 16, (color >> 8) & 0xff, color & 0xff);
-}
-
-static void setColorPrefWdef(int32_t &color, int32_t default_val)
-{
- if (color == -1)
- color = default_val;
- else if (color == 0)
- color = FL_BLACK;
- else
- color <<= 8;
+ Fl::set_color(idx, color << 8);
+ else if (default_val != 0xFFFFFFFF)
+ Fl::set_color(idx, default_val);
}
static void setColors()
{
- unsigned rgb;
-
- setColorFLTK(prefs.ui_main_bg_color, Fl::background);
- setColorFLTK(prefs.ui_text_bg_color, Fl::background2);
- setColorFLTK(prefs.ui_fg_color, Fl::foreground);
-
- if (prefs.ui_selection_color == -1)
- rgb = Fl::get_color(fl_contrast(FL_SELECTION_COLOR,
- FL_BACKGROUND2_COLOR));
- else
- rgb = prefs.ui_selection_color << 8;
- Fl::set_color(FL_SELECTION_COLOR, rgb);
-
- setColorPrefWdef(prefs.ui_button_highlight_color,
- fl_lighter(FL_BACKGROUND_COLOR));
- setColorPrefWdef(prefs.ui_tab_active_bg_color, FL_BACKGROUND2_COLOR);
- setColorPrefWdef(prefs.ui_tab_bg_color, FL_BACKGROUND_COLOR);
- setColorPrefWdef(prefs.ui_tab_active_fg_color, FL_FOREGROUND_COLOR);
- setColorPrefWdef(prefs.ui_tab_fg_color, FL_FOREGROUND_COLOR);
+ /* The main background is a special case because Fl::background() will
+ * set the "gray ramp", which is a set of lighter and darker colors based
+ * on the main background and used for box edges and such.
+ */
+ if (prefs.ui_main_bg_color != -1) {
+ uchar r = prefs.ui_main_bg_color >> 16,
+ g = prefs.ui_main_bg_color >> 8 & 0xff,
+ b = prefs.ui_main_bg_color & 0xff;
+
+ Fl::background(r, g, b);
+ }
+
+ setUIColorWdef(FL_BACKGROUND2_COLOR, prefs.ui_text_bg_color, 0xFFFFFFFF);
+ setUIColorWdef(FL_FOREGROUND_COLOR, prefs.ui_fg_color, 0xFFFFFFFF);
+ setUIColorWdef(FL_SELECTION_COLOR, prefs.ui_selection_color,
+ fl_contrast(FL_SELECTION_COLOR, FL_BACKGROUND2_COLOR));
+ setUIColorWdef(PREFS_UI_BUTTON_HIGHLIGHT_COLOR,
+ prefs.ui_button_highlight_color,
+ fl_lighter(FL_BACKGROUND_COLOR));
+ setUIColorWdef(PREFS_UI_TAB_ACTIVE_BG_COLOR, prefs.ui_tab_active_bg_color,
+ Fl::get_color(FL_BACKGROUND2_COLOR));
+ setUIColorWdef(PREFS_UI_TAB_BG_COLOR, prefs.ui_tab_bg_color,
+ Fl::get_color(FL_BACKGROUND_COLOR));
+ setUIColorWdef(PREFS_UI_TAB_ACTIVE_FG_COLOR, prefs.ui_tab_active_fg_color,
+ Fl::get_color(FL_FOREGROUND_COLOR));
+ setUIColorWdef(PREFS_UI_TAB_FG_COLOR, prefs.ui_tab_fg_color,
+ Fl::get_color(FL_FOREGROUND_COLOR));
}
/*
diff --git a/src/domain.c b/src/domain.c
index be5d2221..70cdaaa3 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -33,7 +33,7 @@ void a_Domain_parse(FILE *fp)
char *line;
uint_t lineno = 0;
- MSG("Reading domainrc...\n");
+ _MSG("Reading domainrc...\n");
while ((line = dGetline(fp)) != NULL) {
++lineno;
@@ -68,7 +68,7 @@ void a_Domain_parse(FILE *fp)
exceptions[num_exceptions].origin = dStrdup(tok1);
exceptions[num_exceptions].destination = dStrdup(tok2);
num_exceptions++;
- MSG("Domain: Exception from %s to %s.\n", tok1, tok2);
+ _MSG("Domain: Exception from %s to %s.\n", tok1, tok2);
}
}
}
@@ -138,14 +138,14 @@ bool_t a_Domain_permit(const DilloUrl *source, const DilloUrl *dest)
if (Domain_match(source_host, exceptions[i].origin) &&
Domain_match(dest_host, exceptions[i].destination)) {
ret = default_deny;
- MSG("Domain: Matched rule from %s to %s.\n", exceptions[i].origin,
- exceptions[i].destination);
+ _MSG("Domain: Matched rule from %s to %s.\n", exceptions[i].origin,
+ exceptions[i].destination);
break;
}
}
- MSG("Domain: %s from %s to %s.\n",
- (ret == TRUE ? "permitted" : "DENIED"), source_host, dest_host);
+ if (ret == FALSE)
+ MSG("Domain: DENIED from %s to %s.\n", source_host, dest_host);
return ret;
}
diff --git a/src/form.cc b/src/form.cc
index 8ec340bb..d9537036 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -363,29 +363,6 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
void Html_tag_close_form(DilloHtml *html)
{
-// DilloHtmlForm *form;
-// int i;
-//
-// if (html->InFlags & IN_FORM) {
-// form = html->getCurrentForm ();
-//
-// /* Make buttons sensitive again */
-// for (i = 0; i < form->inputs->size(); i++) {
-// input_i = form->inputs->get(i);
-// /* Check for tricky HTML (e.g. <input type=image>) */
-// if (!input_i->widget)
-// continue;
-// if (input_i->type == DILLO_HTML_INPUT_SUBMIT ||
-// input_i->type == DILLO_HTML_INPUT_RESET) {
-// gtk_widget_set_sensitive(input_i->widget, TRUE);
-// } else if (input_i->type == DILLO_HTML_INPUT_IMAGE ||
-// input_i->type == DILLO_HTML_INPUT_BUTTON_SUBMIT ||
-// input_i->type == DILLO_HTML_INPUT_BUTTON_RESET) {
-// a_Dw_button_set_sensitive(DW_BUTTON(input_i->widget), TRUE);
-// }
-// }
-// }
-
html->InFlags &= ~IN_FORM;
html->InFlags &= ~IN_SELECT;
html->InFlags &= ~IN_OPTION;
@@ -471,12 +448,10 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize)
inp_type = DILLO_HTML_INPUT_SUBMIT;
init_str = (value) ? value : dStrdup("submit");
resource = factory->createLabelButtonResource(init_str);
-// gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
} else if (!dStrAsciiCasecmp(type, "reset")) {
inp_type = DILLO_HTML_INPUT_RESET;
init_str = (value) ? value : dStrdup("Reset");
resource = factory->createLabelButtonResource(init_str);
-// gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
} else if (!dStrAsciiCasecmp(type, "image")) {
if (URL_FLAGS(html->base_url) & URL_SpamSafe) {
/* Don't request the image; make a text submit button instead */
@@ -485,7 +460,6 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize)
label = attrbuf ? attrbuf : value ? value : name ? name : "Submit";
init_str = dStrdup(label);
resource = factory->createLabelButtonResource(init_str);
-// gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
} else {
inp_type = DILLO_HTML_INPUT_IMAGE;
/* use a dw_image widget */
@@ -1942,7 +1916,6 @@ static Embed *Html_input_image(DilloHtml *html, const char *tag, int tagsize)
factory->createComplexButtonResource(IM2DW(Image), false);
button = new Embed(complex_b_r);
HT2TB(html)->addWidget (button, html->styleEngine->style ());
-// gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
}
if (!button)
MSG("Html_input_image: unable to create image submit.\n");
diff --git a/src/prefs.h b/src/prefs.h
index 2b0f15e4..c7a04a9a 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -23,6 +23,13 @@ extern "C" {
#define PREFS_GEOMETRY_DEFAULT_XPOS -9999
#define PREFS_GEOMETRY_DEFAULT_YPOS -9999
+/* FLTK has free color indices from 16 to 31 */
+#define PREFS_UI_BUTTON_HIGHLIGHT_COLOR 16
+#define PREFS_UI_TAB_ACTIVE_BG_COLOR 17
+#define PREFS_UI_TAB_ACTIVE_FG_COLOR 18
+#define PREFS_UI_TAB_BG_COLOR 19
+#define PREFS_UI_TAB_FG_COLOR 20
+
/* Panel sizes */
enum { P_tiny = 0, P_small, P_medium };
diff --git a/src/tipwin.cc b/src/tipwin.cc
index b3d18f27..100eb1c0 100644
--- a/src/tipwin.cc
+++ b/src/tipwin.cc
@@ -174,7 +174,7 @@ CustButton::CustButton(int x, int y, int w, int h, const char *l) :
TipWinButton(x,y,w,h,l)
{
norm_color = color();
- light_color = prefs.ui_button_highlight_color;
+ light_color = PREFS_UI_BUTTON_HIGHLIGHT_COLOR;
}
int CustButton::handle(int e)
diff --git a/src/uicmd.cc b/src/uicmd.cc
index be2359da..153d5fb4 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -110,7 +110,6 @@ class CustTabs : public Fl_Group {
Fl_Pack *Pack;
Fl_Group *Control;
CustButton *CloseBtn;
- int tabcolor_inactive, tabcolor_active;
void update_pack_offset(void);
void resize(int x, int y, int w, int h)
@@ -138,8 +137,6 @@ public:
Pack = NULL;
focus_counter = 0;
tab_w = 50, tab_h = th, ctab_h = 1, btn_w = 20, ctl_w = 1*btn_w+2;
- tabcolor_active = prefs.ui_tab_active_bg_color;
- tabcolor_inactive = prefs.ui_tab_bg_color;
resize(0,0,ww,ctab_h);
/* tab buttons go inside a pack within a scroll */
Scroll = new Fl_Scroll(0,0,ww-ctl_w,ctab_h);
@@ -283,9 +280,8 @@ UI *CustTabs::add_new_tab(UI *old_ui, int focus)
btn->copy_label(DEFAULT_TAB_LABEL);
btn->clear_visible_focus();
btn->box(FL_GTK_THIN_UP_BOX);
- btn->color(focus ? tabcolor_active : tabcolor_inactive);
- btn->labelcolor(focus ? prefs.ui_tab_active_fg_color :
- prefs.ui_tab_fg_color);
+ btn->color(focus ? PREFS_UI_TAB_ACTIVE_BG_COLOR : PREFS_UI_TAB_BG_COLOR);
+ btn->labelcolor(focus ? PREFS_UI_TAB_ACTIVE_FG_COLOR:PREFS_UI_TAB_FG_COLOR);
btn->ui(new_ui);
btn->callback(tab_btn_cb, this);
Pack->add(btn); // append
@@ -413,8 +409,8 @@ void CustTabs::switch_tab(CustTabButton *cbtn)
// Set old tab label to normal color
if ((idx = get_btn_idx(old_ui)) != -1) {
btn = (CustTabButton*)Pack->child(idx);
- btn->color(tabcolor_inactive);
- btn->labelcolor(prefs.ui_tab_fg_color);
+ btn->color(PREFS_UI_TAB_BG_COLOR);
+ btn->labelcolor(PREFS_UI_TAB_FG_COLOR);
btn->redraw();
}
/* We make a point of calling show() before value() is changed because
@@ -428,8 +424,8 @@ void CustTabs::switch_tab(CustTabButton *cbtn)
*/
cbtn->ui()->show();
Wizard->value(cbtn->ui());
- cbtn->color(tabcolor_active);
- cbtn->labelcolor(prefs.ui_tab_active_fg_color);
+ cbtn->color(PREFS_UI_TAB_ACTIVE_BG_COLOR);
+ cbtn->labelcolor(PREFS_UI_TAB_ACTIVE_FG_COLOR);
cbtn->redraw();
update_pack_offset();