diff --git a/src/dialogs/aniedit.cpp b/src/dialogs/aniedit.cpp index 4d535a899..e6627a2ce 100644 --- a/src/dialogs/aniedit.cpp +++ b/src/dialogs/aniedit.cpp @@ -980,9 +980,8 @@ static void anieditor_draw_header_part(JWidget widget, JRect clip, int x1, int y else x = x2 - 3 - text_length(widget->getFont(), line1); - jdraw_text(widget->getFont(), line1, - x, y1+3, - fg, face, true); + jdraw_text(widget->getFont(), line1, x, y1+3, + fg, face, true, guiscale()); } if (line2 != NULL) { @@ -995,7 +994,7 @@ static void anieditor_draw_header_part(JWidget widget, JRect clip, int x1, int y jdraw_text(widget->getFont(), line2, x, y1+3+ji_font_get_size(widget->getFont())+3, - fg, face, true); + fg, face, true, guiscale()); } } @@ -1101,7 +1100,7 @@ static void anieditor_draw_layer(JWidget widget, JRect clip, int layer_index) /* draw the layer's name */ jdraw_text(widget->getFont(), layer->get_name().c_str(), u, y_mid - ji_font_get_size(widget->getFont())/2, - fg, bg, true); + fg, bg, true, guiscale()); /* the background should be underlined */ if (layer->is_background()) { diff --git a/src/jinete/jdraw.cpp b/src/jinete/jdraw.cpp index 0faa673dd..6d04f18ab 100644 --- a/src/jinete/jdraw.cpp +++ b/src/jinete/jdraw.cpp @@ -155,18 +155,17 @@ void jdraw_rectexclude(const JRect rc, const JRect exclude, int color) exclude->x2-1, exclude->y2-1, color); } -void jdraw_char(FONT *f, int chr, int x, int y, int fg, int bg, bool fill_bg) +void jdraw_char(FONT* f, int chr, int x, int y, int fg, int bg, bool fill_bg) { SETUP_ANTIALISING(f, bg, fill_bg); f->vtable->render_char(f, chr, fg, fill_bg ? bg: -1, ji_screen, x, y); } -/* see ji_font_text_len */ -void jdraw_text(FONT *font, const char *s, int x, int y, - int fg_color, int bg_color, bool fill_bg) +void jdraw_text(FONT* font, const char *s, int x, int y, + int fg_color, int bg_color, bool fill_bg, int underline_height) { - /* original code from allegro/src/guiproc.c */ + // original code from allegro/src/guiproc.c char tmp[1024]; int hline_pos = -1; int len = 0; @@ -207,20 +206,11 @@ void jdraw_text(FONT *font, const char *s, int x, int y, c = usetc(tmp, c); usetc(tmp+c, 0); c = text_length(font, tmp); - hline(ji_screen, x+hline_pos, - /* y+text_height(font)-1, */ - y+text_height(font), - x+hline_pos+c-1, fg_color); - } -} -void jdraw_widget_text(JWidget widget, int fg, int bg, bool fill_bg) -{ - if (widget->getText()) { - struct jrect box, text, icon; - jwidget_get_texticon_info(widget, &box, &text, &icon, 0, 0, 0); - jdraw_text(widget->getFont(), widget->getText(), - text.x1, text.y1, fg, bg, fill_bg); + rectfill(ji_screen, x+hline_pos, + y+text_height(font), + x+hline_pos+c-1, + y+text_height(font)+underline_height-1, fg_color); } } diff --git a/src/jinete/jdraw.h b/src/jinete/jdraw.h index 724b91c89..aa6ae57d5 100644 --- a/src/jinete/jdraw.h +++ b/src/jinete/jdraw.h @@ -60,9 +60,8 @@ void jdraw_rectedge(const JRect rect, int c1, int c2); void jdraw_rectshade(const JRect rect, int c1, int c2, int align); void jdraw_rectexclude(const JRect rc, const JRect exclude, int color); -void jdraw_char(struct FONT *f, int chr, int x, int y, int fg, int bg, bool fill_bg); -void jdraw_text(struct FONT *f, const char *text, int x, int y, int fg, int bg, bool fill_bg); -void jdraw_widget_text(JWidget widget, int fg, int bg, bool fill_bg); +void jdraw_char(FONT* f, int chr, int x, int y, int fg, int bg, bool fill_bg); +void jdraw_text(FONT* f, const char* text, int x, int y, int fg, int bg, bool fill_bg, int underline_height = 1); void jdraw_inverted_sprite(struct BITMAP *bmp, struct BITMAP *sprite, int x, int y); diff --git a/src/jinete/jfont.cpp b/src/jinete/jfont.cpp index 09d25a09d..cfe23f93d 100644 --- a/src/jinete/jfont.cpp +++ b/src/jinete/jfont.cpp @@ -593,7 +593,7 @@ int ji_font_char_len(FONT* f, int chr) return f->vtable->char_length(f, chr); } -/* see jdraw_text */ +// see jdraw_text int ji_font_text_len(struct FONT* f, const char *s) { int in_pos = 0; @@ -1024,7 +1024,7 @@ int ji_font_char_len(FONT* f, int chr) return f->vtable->char_length(f, chr); } -/* see jdraw_text */ +// see jdraw_text int ji_font_text_len(struct FONT* f, const char* s) { int in_pos = 0; diff --git a/src/modules/skinneable_theme.cpp b/src/modules/skinneable_theme.cpp index 1f530fedb..df6927a05 100644 --- a/src/modules/skinneable_theme.cpp +++ b/src/modules/skinneable_theme.cpp @@ -930,7 +930,7 @@ void SkinneableTheme::draw_listitem(JWidget widget, JRect clip) if (widget->hasText()) { /* text */ - jdraw_text(widget->getFont(), widget->getText(), x, y, fg, bg, true); + jdraw_text(widget->getFont(), widget->getText(), x, y, fg, bg, true, guiscale()); /* background */ jrectexclude @@ -1444,7 +1444,7 @@ void SkinneableTheme::draw_frame(Frame* window, JRect clip) jdraw_text(window->getFont(), window->getText(), cpos->x1, pos->y1+jrect_h(pos)/2-text_height(window->getFont())/2, - COLOR_BACKGROUND, -1, false); + COLOR_BACKGROUND, -1, false, guiscale()); } // menubox else { @@ -1539,11 +1539,11 @@ void SkinneableTheme::draw_textstring(const char *t, int fg_color, int bg_color, if (jwidget_is_disabled (widget)) { /* TODO avoid this */ if (fill_bg) /* only to draw the background */ - jdraw_text(widget->getFont(), t, x, y, 0, bg_color, fill_bg); + jdraw_text(widget->getFont(), t, x, y, 0, bg_color, fill_bg, guiscale()); /* draw white part */ jdraw_text(widget->getFont(), t, x+1, y+1, - COLOR_BACKGROUND, bg_color, fill_bg); + COLOR_BACKGROUND, bg_color, fill_bg, guiscale()); if (fill_bg) fill_bg = false; @@ -1553,7 +1553,7 @@ void SkinneableTheme::draw_textstring(const char *t, int fg_color, int bg_color, jwidget_is_disabled(widget) ? COLOR_DISABLED: (fg_color >= 0 ? fg_color : COLOR_FOREGROUND), - bg_color, fill_bg); + bg_color, fill_bg, guiscale()); } } diff --git a/src/widgets/colbut.cpp b/src/widgets/colbut.cpp index 8a388330e..ab3a0882f 100644 --- a/src/widgets/colbut.cpp +++ b/src/widgets/colbut.cpp @@ -24,6 +24,7 @@ #include "core/color.h" #include "modules/gfx.h" +#include "modules/gui.h" #include "raster/sprite.h" #include "widgets/colbar.h" #include "widgets/colbut.h" @@ -242,7 +243,7 @@ static void colorbutton_draw(JWidget widget) rectfill(ji_screen, text.x1, text.y1, text.x2-1, text.y2-1, makecol(0, 0, 0)); jdraw_text(widget->getFont(), widget->getText(), text.x1, text.y1, makecol(255, 255, 255), - makecol(0, 0, 0), false); + makecol(0, 0, 0), false, guiscale()); } static void colorbutton_open_tooltip(JWidget widget) diff --git a/src/widgets/colview.cpp b/src/widgets/colview.cpp index 780b46eff..8009eee62 100644 --- a/src/widgets/colview.cpp +++ b/src/widgets/colview.cpp @@ -30,6 +30,7 @@ #include "jinete/jwidget.h" #include "modules/gfx.h" +#include "modules/gui.h" #include "widgets/colview.h" typedef struct ColorViewer @@ -142,7 +143,7 @@ static bool colorviewer_msg_proc(JWidget widget, JMessage msg) jdraw_rectfill(&text, makecol(0, 0, 0)); jdraw_text(widget->getFont(), widget->getText(), text.x1, text.y1, - makecol(255, 255, 255), makecol(0, 0, 0), false); + makecol(255, 255, 255), makecol(0, 0, 0), false, guiscale()); jrect_free(rect); return true; diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index 47c02b6e2..78c7f478d 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -273,7 +273,7 @@ static bool fileview_msg_proc(JWidget widget, JMessage msg) jdraw_text(widget->getFont(), "[+]", x, y+2, - fgcolor, bgcolor, true); + fgcolor, bgcolor, true, guiscale()); // background for the icon jrectexclude(ji_screen, @@ -300,7 +300,7 @@ static bool fileview_msg_proc(JWidget widget, JMessage msg) // item name jdraw_text(widget->getFont(), fileitem_get_displayname(fi).c_str(), x, y+2, - fgcolor, bgcolor, true); + fgcolor, bgcolor, true, guiscale()); // background for the item name jrectexclude(ji_screen, diff --git a/src/widgets/tabs.cpp b/src/widgets/tabs.cpp index 56e6b850b..6ba6728a5 100644 --- a/src/widgets/tabs.cpp +++ b/src/widgets/tabs.cpp @@ -275,7 +275,7 @@ static bool tabs_msg_proc(JWidget widget, JMessage msg) jdraw_text(widget->getFont(), tab->text.c_str(), box->x1+4, (box->y1+box->y2)/2-text_height(widget->getFont())/2+1, - text_color, face_color, false); + text_color, face_color, false, guiscale()); } box->x1 = box->x2;