Rename old _ji_* functions

This commit is contained in:
David Capello 2013-03-30 13:38:24 -03:00
parent 3171bd5ce7
commit cb0cdb3197
9 changed files with 27 additions and 49 deletions

View File

@ -354,7 +354,7 @@ void gui_setup_screen(bool reload_font)
} }
if (reinit) if (reinit)
_ji_reinit_theme_in_all_widgets(); reinitThemeForAllWidgets();
// Set the configuration // Set the configuration
save_gui_config(); save_gui_config();
@ -369,7 +369,7 @@ static void reload_default_font()
skin_theme->reload_fonts(); skin_theme->reload_fonts();
// Set all widgets 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) void load_window_pos(Widget* window, const char *section)

View File

@ -1597,9 +1597,9 @@ void SkinTheme::paintComboBoxButton(PaintEvent& ev)
void SkinTheme::draw_textbox(Widget* widget, JRect clip) void SkinTheme::draw_textbox(Widget* widget, JRect clip)
{ {
_ji_theme_textbox_draw(ji_screen, widget, NULL, NULL, drawTextBox(ji_screen, widget, NULL, NULL,
getColor(ThemeColor::TextBoxFace), getColor(ThemeColor::TextBoxFace),
getColor(ThemeColor::TextBoxText)); getColor(ThemeColor::TextBoxText));
} }
void SkinTheme::paintView(PaintEvent& ev) void SkinTheme::paintView(PaintEvent& ev)

View File

@ -41,7 +41,7 @@ FONT* ji_font_load_bmp(const char* filepathname)
if (bmp) { if (bmp) {
bmp = ji_apply_guiscale(bmp); bmp = ji_apply_guiscale(bmp);
f = _ji_bitmap2font(bmp); f = bitmapToFont(bmp);
destroy_bitmap(bmp); destroy_bitmap(bmp);
} }

View File

@ -170,7 +170,7 @@ static int bitmap_font_count(BITMAP* bmp)
namespace ui { namespace ui {
FONT *_ji_bitmap2font(BITMAP *bmp) FONT* bitmapToFont(BITMAP* bmp)
{ {
FONT *f; FONT *f;
int begin = ' '; int begin = ' ';

View File

@ -28,12 +28,12 @@ void _ji_widgets_exit()
delete widgets; delete widgets;
} }
void _ji_add_widget(Widget* widget) void addWidget(Widget* widget)
{ {
widgets->push_back(widget); widgets->push_back(widget);
} }
void _ji_remove_widget(Widget* widget) void removeWidget(Widget* widget)
{ {
std::list<Widget*>::iterator it = std::list<Widget*>::iterator it =
std::find(widgets->begin(), widgets->end(), widget); std::find(widgets->begin(), widgets->end(), widget);
@ -42,7 +42,7 @@ void _ji_remove_widget(Widget* widget)
widgets->erase(it); widgets->erase(it);
} }
void _ji_set_font_of_all_widgets(FONT* f) void setFontOfAllWidgets(FONT* f)
{ {
for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end(); for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end();
it != end; ++it) { 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 // Reinitialize the theme of each widget
for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end(); for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end();

View File

@ -18,33 +18,22 @@ namespace ui {
class Widget; class Widget;
class Window; class Window;
////////////////////////////////////////////////////////////////////// // intern.cpp
// jintern.c
void _ji_add_widget(Widget* widget); void addWidget(Widget* widget);
void _ji_remove_widget(Widget* widget); void removeWidget(Widget* widget);
void _ji_set_font_of_all_widgets(FONT* f); void setFontOfAllWidgets(FONT* f);
void _ji_reinit_theme_in_all_widgets(); void reinitThemeForAllWidgets();
//////////////////////////////////////////////////////////////////////
// jwindow.c
bool _jwindow_is_moving();
//////////////////////////////////////////////////////////////////////
// theme.cpp // theme.cpp
void _ji_theme_draw_sprite_color(BITMAP *bmp, BITMAP *sprite, void drawTextBox(BITMAP* bmp, Widget* textbox,
int x, int y, ui::Color color); int* w, int* h, ui::Color bg, ui::Color fg);
void _ji_theme_textbox_draw(BITMAP *bmp, Widget* textbox, // fontbmp.c
int *w, int *h, ui::Color bg, ui::Color fg);
////////////////////////////////////////////////////////////////////// struct FONT* bitmapToFont(BITMAP* bmp);
// jfontbmp.c
struct FONT *_ji_bitmap2font(BITMAP *bmp);
} // namespace ui } // namespace ui

View File

@ -156,7 +156,7 @@ void TextBox::onPreferredSize(PreferredSizeEvent& ev)
//w = widget->border_width.l + widget->border_width.r; //w = widget->border_width.l + widget->border_width.r;
//h = widget->border_width.t + widget->border_width.b; //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) { if (this->getAlign() & JI_WORDWRAP) {
View* view = View::getView(this); View* view = View::getView(this);
@ -170,7 +170,7 @@ void TextBox::onPreferredSize(PreferredSizeEvent& ev)
} }
w = MAX(min, width); w = MAX(min, width);
_ji_theme_textbox_draw(NULL, this, &w, &h, ColorNone, ColorNone); drawTextBox(NULL, this, &w, &h, ColorNone, ColorNone);
w = min; w = min;
} }

View File

@ -94,19 +94,8 @@ BITMAP* ji_apply_guiscale(BITMAP* original)
return original; return original;
} }
void _ji_theme_draw_sprite_color(BITMAP *bmp, BITMAP *sprite, void drawTextBox(BITMAP* bmp, Widget* widget,
int x, int y, int color) int* w, int* h, ui::Color bg, ui::Color fg)
{
int u, v, mask = bitmap_mask_color(sprite);
for (v=0; v<sprite->h; v++)
for (u=0; u<sprite->w; 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)
{ {
View* view = View::getView(widget); View* view = View::getView(widget);
char *text = (char*)widget->getText(); // TODO warning: removing const modifier char *text = (char*)widget->getText(); // TODO warning: removing const modifier

View File

@ -41,7 +41,7 @@ int ji_register_widget_type()
Widget::Widget(int type) Widget::Widget(int type)
{ {
_ji_add_widget(this); addWidget(this);
this->type = type; this->type = type;
this->rc = jrect_new(0, 0, 0, 0); this->rc = jrect_new(0, 0, 0, 0);
@ -103,8 +103,8 @@ Widget::~Widget()
// Delete the preferred size // Delete the preferred size
delete m_preferredSize; delete m_preferredSize;
/* low level free */ // Low level free
_ji_remove_widget(this); removeWidget(this);
} }
void Widget::deferDelete() void Widget::deferDelete()