diff options
author | corvid <corvid@lavabit.com> | 2011-02-09 01:31:14 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2011-02-09 01:31:14 +0000 |
commit | a11a2e0366866db9409760d312eda22a5bf0a690 (patch) | |
tree | c3aaaaf329bd6725bf02a38d2af5cf04bbcf05b6 | |
parent | 5f25bfeed977c88e2b9ee2cb5f84bb2ba46f719f (diff) |
disable symbol-interpretation in labels
There was some discussion of how to do this last month in fltk-dev
http://fltk.org/newsgroups.php?s10630+gfltk.development+v10640+T0
-rw-r--r-- | dw/fltkcomplexbutton.cc | 1 | ||||
-rw-r--r-- | dw/fltkplatform.cc | 24 | ||||
-rw-r--r-- | dw/fltkplatform.hh | 1 | ||||
-rw-r--r-- | dw/fltkui.cc | 4 | ||||
-rw-r--r-- | src/dillo.cc | 26 |
5 files changed, 26 insertions, 30 deletions
diff --git a/dw/fltkcomplexbutton.cc b/dw/fltkcomplexbutton.cc index e1427a9e..435ccb03 100644 --- a/dw/fltkcomplexbutton.cc +++ b/dw/fltkcomplexbutton.cc @@ -173,7 +173,6 @@ ComplexButton::ComplexButton(int X, int Y, int W, int H, const char *L) down_box(FL_NO_BOX); value_ = oldval = 0; shortcut_ = 0; - set_flag(SHORTCUT_LABEL); } ComplexButton::~ComplexButton() { diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index b3e33bce..dba4ab3f 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -191,26 +191,6 @@ FltkColor * FltkColor::create (int col) FltkTooltip::FltkTooltip (const char *text) : Tooltip(text) { shown = false; - - if (!text || !strpbrk(text, "&@")) { - escaped_str = NULL; - } else { - /* - * WORKAROUND: ::fltk::Tooltip::tooltip_timeout() makes instance_ - * if necessary, and immediately uses it. This means that we can't - * get our hands on it to set RAW_LABEL until after it has been shown - * once. So let's escape the special characters ourselves. - */ - const char *src = text; - char *dest = escaped_str = (char *) malloc(strlen(text) * 2 + 1); - - while (*src) { - if (*src == '&' || *src == '@') - *dest++ = *src; - *dest++ = *src++; - } - *dest = '\0'; - } } FltkTooltip::~FltkTooltip () @@ -221,8 +201,6 @@ probably can remember the one from onEnter if (shown) Fl_Tooltip::exit(); #endif - if (escaped_str) - free(escaped_str); } FltkTooltip *FltkTooltip::create (const char *text) @@ -235,7 +213,7 @@ void FltkTooltip::onEnter() Fl_Widget *widget = Fl::belowmouse(); Fl_Tooltip::enter_area(widget, widget->x(), widget->y(), widget->w(), - widget->h(), escaped_str ? escaped_str : str); + widget->h(), str); shown = true; } diff --git a/dw/fltkplatform.hh b/dw/fltkplatform.hh index 791dcc82..6a81da4d 100644 --- a/dw/fltkplatform.hh +++ b/dw/fltkplatform.hh @@ -60,7 +60,6 @@ private: FltkTooltip (const char *text); ~FltkTooltip (); bool shown; - char *escaped_str; /* fltk WORKAROUND */ public: static FltkTooltip *create(const char *text); void onEnter(); diff --git a/dw/fltkui.cc b/dw/fltkui.cc index 0ffafe35..9ce5a816 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -244,7 +244,6 @@ Fl_Widget *FltkLabelButtonResource::createNewWidget (core::Allocation Fl_Button *button = new Fl_Button (allocation->x, allocation->y, allocation->width, allocation->ascent + allocation->descent, label); -// button->clear_flag (SHORTCUT_LABEL); button->callback (widgetCallback, this); button->when (FL_WHEN_RELEASE); return button; @@ -736,7 +735,6 @@ Fl_Button *FltkCheckButtonResource::createNewButton (core::Allocation Fl_Check_Button *cb = new Fl_Check_Button (allocation->x, allocation->y, allocation->width, allocation->ascent + allocation->descent); -// cb->clear_flag (SHORTCUT_LABEL); return cb; } @@ -848,7 +846,6 @@ Fl_Button *FltkRadioButtonResource::createNewButton (core::Allocation Fl_Button *button = new Fl_Round_Button (allocation->x, allocation->y, allocation->width, allocation->ascent + allocation->descent); -// button->clear_flag (SHORTCUT_LABEL); button->when (FL_WHEN_CHANGED); button->callback (widgetCallback, this); button->type (FL_TOGGLE_BUTTON); @@ -1061,7 +1058,6 @@ Fl_Widget *FltkListResource::createNewWidget (core::Allocation *allocation) tree->showroot(0); tree->connectorstyle(FL_TREE_CONNECTOR_NONE); tree->marginleft(-14); -// tree->clear_flag (SHORTCUT_LABEL); tree->callback(widgetCallback,this); tree->when(FL_WHEN_CHANGED); diff --git a/src/dillo.cc b/src/dillo.cc index 440457a6..86f0a57b 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -24,8 +24,9 @@ #include <signal.h> #include <locale.h> -#include <FL/Fl_Window.H> #include <FL/Fl.H> +#include <FL/Fl_Window.H> +#include <FL/fl_draw.H> #include "msg.h" #include "paths.hh" @@ -167,6 +168,25 @@ static OptID getCmdOption(const CLI_options *options, int argc, char **argv, } return opt_id; } + +static void custLabelDraw(const Fl_Label* o, int X, int Y, int W, int H, + Fl_Align align) +{ + const int interpret_symbols = 0; + + fl_font(o->font, o->size); + fl_color((Fl_Color)o->color); + fl_draw(o->value, X, Y, W, H, align, o->image, interpret_symbols); +} + +static void custLabelMeasure(const Fl_Label* o, int& W, int& H) +{ + const int interpret_symbols = 0; + + fl_font(o->font, o->size); + fl_measure(o->value, W, H, interpret_symbols); +} + #if 0 PORT1.3 /* @@ -318,6 +338,10 @@ int main(int argc, char **argv) // Sets WM_CLASS hint on X11 Fl_Window::default_xclass("dillo"); + + // Disable '@' interpretation in labels + Fl::set_labeltype(FL_NORMAL_LABEL, custLabelDraw, custLabelMeasure); + #if 0 PORT1.3 checkPreferredFonts(); |