Re: ui colors again
"corvid" <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <20121230210017.GE29296@local> |
I wrote: > Perhaps it would be good to be able to change colors at runtime, especially > since we already allow the panel size to change. I'll have a look at that > color chooser that fltk has. Here's a quick little toy: _______________________________________________ Dillo-dev mailing list [email protected] http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
color_chooser.diff
(text/plain, 1.4 KB)
diff -r ad415fc9a5ce src/menu.cc
--- a/src/menu.cc Sun Dec 30 17:06:11 2012 +0000
+++ b/src/menu.cc Sun Dec 30 20:58:50 2012 +0000
@@ -13,6 +13,7 @@
#include <FL/Fl.H>
#include <FL/Fl_Menu_Item.H>
+#include <FL/Fl_Color_Chooser.H>
#include "lout/misc.hh" /* SimpleVector */
#include "msg.h"
@@ -659,6 +660,20 @@
ui->change_panel(VOIDP2INT(user_data), ui->get_smallicons());
}
+static void Menu_color_change_cb(Fl_Widget*, void *user_data)
+{
+ int colornum = VOIDP2INT(user_data);
+ int old_rgb = Fl::get_color(colornum);
+ uchar r = old_rgb >> 24,
+ g = (old_rgb >> 16) & 0xff,
+ b = (old_rgb >> 8) & 0xff;
+
+ if (fl_color_chooser("Dillo: select color", r, g, b)) {
+ Fl::set_color(colornum, r, g, b);
+ ((UI*)popup_bw->ui)->redraw();
+ }
+}
+
/*
* Toggle loading of images -- and load them if enabling.
*/
@@ -700,6 +715,14 @@
{"small icons", 0,Menu_panel_change_cb,(void*)10,
FL_MENU_TOGGLE,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
+ {"UI colors", 0, Menu_nop_cb, (void*)0, FL_SUBMENU,0,0,0,0},
+ {"foreground", 0, Menu_color_change_cb, (void*)FL_FOREGROUND_COLOR,0,
+ 0,0,0,0},
+ {"main bg", 0, Menu_color_change_cb, (void*)FL_BACKGROUND_COLOR,0,0,0,
+ 0,0},
+ {"text bg", 0, Menu_color_change_cb, (void*)FL_BACKGROUND2_COLOR,0,0,
+ 0,0,0},
+ {0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0}
};