diff --git a/src/modules/gui.cpp b/src/modules/gui.cpp index 1cd896ae8..8d248127d 100644 --- a/src/modules/gui.cpp +++ b/src/modules/gui.cpp @@ -354,7 +354,7 @@ void gui_setup_screen(bool reload_font) } if (reinit) - _ji_reinit_theme_in_all_widgets(); + reinitThemeForAllWidgets(); // Set the configuration save_gui_config(); @@ -369,7 +369,7 @@ static void reload_default_font() skin_theme->reload_fonts(); // Set all widgets fonts - _ji_set_font_of_all_widgets(theme->default_font); + setFontOfAllWidgets(theme->default_font); } void load_window_pos(Widget* window, const char *section) diff --git a/src/skin/skin_theme.cpp b/src/skin/skin_theme.cpp index 7dceedc59..86cd85efb 100644 --- a/src/skin/skin_theme.cpp +++ b/src/skin/skin_theme.cpp @@ -1597,9 +1597,9 @@ void SkinTheme::paintComboBoxButton(PaintEvent& ev) void SkinTheme::draw_textbox(Widget* widget, JRect clip) { - _ji_theme_textbox_draw(ji_screen, widget, NULL, NULL, - getColor(ThemeColor::TextBoxFace), - getColor(ThemeColor::TextBoxText)); + drawTextBox(ji_screen, widget, NULL, NULL, + getColor(ThemeColor::TextBoxFace), + getColor(ThemeColor::TextBoxText)); } void SkinTheme::paintView(PaintEvent& ev) diff --git a/src/ui/font.cpp b/src/ui/font.cpp index 32476dcbc..c03602f51 100644 --- a/src/ui/font.cpp +++ b/src/ui/font.cpp @@ -41,7 +41,7 @@ FONT* ji_font_load_bmp(const char* filepathname) if (bmp) { bmp = ji_apply_guiscale(bmp); - f = _ji_bitmap2font(bmp); + f = bitmapToFont(bmp); destroy_bitmap(bmp); } diff --git a/src/ui/fontbmp.cpp b/src/ui/fontbmp.cpp index 1bc037af5..7e572eafc 100644 --- a/src/ui/fontbmp.cpp +++ b/src/ui/fontbmp.cpp @@ -170,7 +170,7 @@ static int bitmap_font_count(BITMAP* bmp) namespace ui { -FONT *_ji_bitmap2font(BITMAP *bmp) +FONT* bitmapToFont(BITMAP* bmp) { FONT *f; int begin = ' '; diff --git a/src/ui/intern.cpp b/src/ui/intern.cpp index 1fcd61506..c6509ba1b 100644 --- a/src/ui/intern.cpp +++ b/src/ui/intern.cpp @@ -28,12 +28,12 @@ void _ji_widgets_exit() delete widgets; } -void _ji_add_widget(Widget* widget) +void addWidget(Widget* widget) { widgets->push_back(widget); } -void _ji_remove_widget(Widget* widget) +void removeWidget(Widget* widget) { std::list::iterator it = std::find(widgets->begin(), widgets->end(), widget); @@ -42,7 +42,7 @@ void _ji_remove_widget(Widget* widget) widgets->erase(it); } -void _ji_set_font_of_all_widgets(FONT* f) +void setFontOfAllWidgets(FONT* f) { for (std::list::iterator it=widgets->begin(), end=widgets->end(); it != end; ++it) { @@ -50,7 +50,7 @@ void _ji_set_font_of_all_widgets(FONT* f) } } -void _ji_reinit_theme_in_all_widgets() +void reinitThemeForAllWidgets() { // Reinitialize the theme of each widget for (std::list::iterator it=widgets->begin(), end=widgets->end(); diff --git a/src/ui/intern.h b/src/ui/intern.h index 8c286a8be..7a825c8f5 100644 --- a/src/ui/intern.h +++ b/src/ui/intern.h @@ -18,33 +18,22 @@ namespace ui { class Widget; class Window; - ////////////////////////////////////////////////////////////////////// - // jintern.c + // intern.cpp - void _ji_add_widget(Widget* widget); - void _ji_remove_widget(Widget* widget); + void addWidget(Widget* widget); + void removeWidget(Widget* widget); - void _ji_set_font_of_all_widgets(FONT* f); - void _ji_reinit_theme_in_all_widgets(); + void setFontOfAllWidgets(FONT* f); + void reinitThemeForAllWidgets(); - ////////////////////////////////////////////////////////////////////// - // jwindow.c - - bool _jwindow_is_moving(); - - ////////////////////////////////////////////////////////////////////// // theme.cpp - void _ji_theme_draw_sprite_color(BITMAP *bmp, BITMAP *sprite, - int x, int y, ui::Color color); + void drawTextBox(BITMAP* bmp, Widget* textbox, + int* w, int* h, ui::Color bg, ui::Color fg); - void _ji_theme_textbox_draw(BITMAP *bmp, Widget* textbox, - int *w, int *h, ui::Color bg, ui::Color fg); + // fontbmp.c - ////////////////////////////////////////////////////////////////////// - // jfontbmp.c - - struct FONT *_ji_bitmap2font(BITMAP *bmp); + struct FONT* bitmapToFont(BITMAP* bmp); } // namespace ui diff --git a/src/ui/textbox.cpp b/src/ui/textbox.cpp index f3eb715c1..a95201aa2 100644 --- a/src/ui/textbox.cpp +++ b/src/ui/textbox.cpp @@ -156,7 +156,7 @@ void TextBox::onPreferredSize(PreferredSizeEvent& ev) //w = widget->border_width.l + widget->border_width.r; //h = widget->border_width.t + widget->border_width.b; - _ji_theme_textbox_draw(NULL, this, &w, &h, ColorNone, ColorNone); + drawTextBox(NULL, this, &w, &h, ColorNone, ColorNone); if (this->getAlign() & JI_WORDWRAP) { View* view = View::getView(this); @@ -170,7 +170,7 @@ void TextBox::onPreferredSize(PreferredSizeEvent& ev) } w = MAX(min, width); - _ji_theme_textbox_draw(NULL, this, &w, &h, ColorNone, ColorNone); + drawTextBox(NULL, this, &w, &h, ColorNone, ColorNone); w = min; } diff --git a/src/ui/theme.cpp b/src/ui/theme.cpp index 62ea7fb6f..679afc272 100644 --- a/src/ui/theme.cpp +++ b/src/ui/theme.cpp @@ -94,19 +94,8 @@ BITMAP* ji_apply_guiscale(BITMAP* original) return original; } -void _ji_theme_draw_sprite_color(BITMAP *bmp, BITMAP *sprite, - int x, int y, int color) -{ - int u, v, mask = bitmap_mask_color(sprite); - - for (v=0; vh; v++) - for (u=0; uw; u++) - if (getpixel(sprite, u, v) != mask) - putpixel(bmp, x+u, y+v, color); -} - -void _ji_theme_textbox_draw(BITMAP *bmp, Widget* widget, - int *w, int *h, ui::Color bg, ui::Color fg) +void drawTextBox(BITMAP* bmp, Widget* widget, + int* w, int* h, ui::Color bg, ui::Color fg) { View* view = View::getView(widget); char *text = (char*)widget->getText(); // TODO warning: removing const modifier diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp index 8be9e981e..d2a7b601c 100644 --- a/src/ui/widget.cpp +++ b/src/ui/widget.cpp @@ -41,7 +41,7 @@ int ji_register_widget_type() Widget::Widget(int type) { - _ji_add_widget(this); + addWidget(this); this->type = type; this->rc = jrect_new(0, 0, 0, 0); @@ -103,8 +103,8 @@ Widget::~Widget() // Delete the preferred size delete m_preferredSize; - /* low level free */ - _ji_remove_widget(this); + // Low level free + removeWidget(this); } void Widget::deferDelete()