mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Now SkinneableTheme::draw_bounds*() member functions
receive destination BITMAP. With this we eliminated all hacks of the ji_screen <-> double-buffer switching style.
This commit is contained in:
parent
917127ce37
commit
1e3e4a7bc7
@ -507,21 +507,16 @@ void draw_color_button(BITMAP* bmp,
|
||||
outer_sw ? PART_COLORBAR_2_SW: (outer_s ? PART_COLORBAR_3_SW: PART_COLORBAR_1_SW),
|
||||
outer_w ? PART_COLORBAR_0_W : PART_COLORBAR_1_W,
|
||||
};
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO fix this ugly hack
|
||||
ji_screen = bmp;
|
||||
theme->draw_bounds0(rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, parts);
|
||||
ji_screen = old_ji_screen;
|
||||
theme->draw_bounds_array(bmp, rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, parts);
|
||||
}
|
||||
|
||||
// Draw hot
|
||||
if (hot) {
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO fix this ugly hack
|
||||
ji_screen = bmp;
|
||||
theme->draw_trans_bounds(rc.x, rc.y,
|
||||
rc.x+rc.w-1,
|
||||
rc.y+rc.h-1 - (outer_s ? 1*scale: 0),
|
||||
PART_COLORBAR_BORDER_HOTFG_NW);
|
||||
ji_screen = old_ji_screen;
|
||||
theme->draw_bounds_nw(bmp,
|
||||
rc.x, rc.y,
|
||||
rc.x+rc.w-1,
|
||||
rc.y+rc.h-1 - (outer_s ? 1*scale: 0),
|
||||
PART_COLORBAR_BORDER_HOTFG_NW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ void SkinneableTheme::draw_button(JWidget widget, JRect clip)
|
||||
rectfill(ji_screen, x1, y1, x2, y2, BGCOLOR);
|
||||
|
||||
// draw borders
|
||||
draw_bounds(x1, y1, x2, y2, part_nw, bg);
|
||||
draw_bounds_nw(ji_screen, x1, y1, x2, y2, part_nw, bg);
|
||||
|
||||
// text
|
||||
crect = jwidget_get_child_rect(widget);
|
||||
@ -729,10 +729,11 @@ void SkinneableTheme::draw_check(JWidget widget, JRect clip)
|
||||
|
||||
// draw focus
|
||||
if (jwidget_has_focus(widget)) {
|
||||
draw_bounds(widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1, PART_CHECK_FOCUS_NW, -1);
|
||||
draw_bounds_nw(ji_screen,
|
||||
widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1, PART_CHECK_FOCUS_NW, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -760,9 +761,10 @@ void SkinneableTheme::draw_entry(JWidget widget, JRect clip)
|
||||
|
||||
bg = COLOR_BACKGROUND;
|
||||
|
||||
draw_bounds(x1, y1, x2, y2,
|
||||
jwidget_has_focus(widget) ? PART_SUNKEN_FOCUSED_NW:
|
||||
PART_SUNKEN_NORMAL_NW, bg);
|
||||
draw_bounds_nw(ji_screen,
|
||||
x1, y1, x2, y2,
|
||||
jwidget_has_focus(widget) ? PART_SUNKEN_FOCUSED_NW:
|
||||
PART_SUNKEN_NORMAL_NW, bg);
|
||||
|
||||
/* draw the text */
|
||||
x = widget->rc->x1 + widget->border_width.l;
|
||||
@ -1021,10 +1023,11 @@ void SkinneableTheme::draw_radio(JWidget widget, JRect clip)
|
||||
|
||||
// draw focus
|
||||
if (jwidget_has_focus(widget)) {
|
||||
draw_bounds(widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1, PART_RADIO_FOCUS_NW, -1);
|
||||
draw_bounds_nw(ji_screen,
|
||||
widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1, PART_RADIO_FOCUS_NW, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1042,10 +1045,11 @@ void SkinneableTheme::draw_separator(JWidget widget, JRect clip)
|
||||
jdraw_rectfill(widget->rc, BGCOLOR);
|
||||
|
||||
if (widget->getAlign() & JI_HORIZONTAL) {
|
||||
draw_hline(widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1, PART_SEPARATOR);
|
||||
draw_part_as_hline(ji_screen,
|
||||
widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1, PART_SEPARATOR);
|
||||
}
|
||||
|
||||
// text
|
||||
@ -1117,14 +1121,15 @@ void SkinneableTheme::draw_slider(JWidget widget, JRect clip)
|
||||
}
|
||||
|
||||
if (value == min)
|
||||
draw_bounds(x1, y1, x2, y2, empty_part_nw, get_slider_empty_face_color());
|
||||
draw_bounds_nw(ji_screen, x1, y1, x2, y2, empty_part_nw, get_slider_empty_face_color());
|
||||
else if (value == max)
|
||||
draw_bounds(x1, y1, x2, y2, full_part_nw, get_slider_full_face_color());
|
||||
draw_bounds_nw(ji_screen, x1, y1, x2, y2, full_part_nw, get_slider_full_face_color());
|
||||
else
|
||||
draw_bounds2(x1, y1, x2, y2, x,
|
||||
full_part_nw, empty_part_nw,
|
||||
get_slider_full_face_color(),
|
||||
get_slider_empty_face_color());
|
||||
draw_bounds_nw2(ji_screen,
|
||||
x1, y1, x2, y2, x,
|
||||
full_part_nw, empty_part_nw,
|
||||
get_slider_full_face_color(),
|
||||
get_slider_empty_face_color());
|
||||
|
||||
/* text */
|
||||
{
|
||||
@ -1177,9 +1182,10 @@ void SkinneableTheme::draw_combobox_entry(JWidget widget, JRect clip)
|
||||
|
||||
bg = COLOR_BACKGROUND;
|
||||
|
||||
draw_bounds(x1, y1, x2, y2,
|
||||
jwidget_has_focus(widget) ? PART_SUNKEN2_FOCUSED_NW:
|
||||
PART_SUNKEN2_NORMAL_NW, bg);
|
||||
draw_bounds_nw(ji_screen,
|
||||
x1, y1, x2, y2,
|
||||
jwidget_has_focus(widget) ? PART_SUNKEN2_FOCUSED_NW:
|
||||
PART_SUNKEN2_NORMAL_NW, bg);
|
||||
|
||||
/* draw the text */
|
||||
x = widget->rc->x1 + widget->border_width.l;
|
||||
@ -1260,7 +1266,7 @@ void SkinneableTheme::draw_combobox_button(JWidget widget, JRect clip)
|
||||
rectfill(ji_screen, x1, y1, x2, y2, BGCOLOR);
|
||||
|
||||
// draw borders
|
||||
draw_bounds(x1, y1, x2, y2, part_nw, bg);
|
||||
draw_bounds_nw(ji_screen, x1, y1, x2, y2, part_nw, bg);
|
||||
|
||||
// icon
|
||||
icon.x1 = (x1+x2)/2 - icon_bmp->w/2;
|
||||
@ -1286,13 +1292,14 @@ void SkinneableTheme::draw_textbox(JWidget widget, JRect clip)
|
||||
|
||||
void SkinneableTheme::draw_view(JWidget widget, JRect clip)
|
||||
{
|
||||
draw_bounds(widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1,
|
||||
jwidget_has_focus(widget) ? PART_SUNKEN_FOCUSED_NW:
|
||||
PART_SUNKEN_NORMAL_NW,
|
||||
COLOR_BACKGROUND);
|
||||
draw_bounds_nw(ji_screen,
|
||||
widget->rc->x1,
|
||||
widget->rc->y1,
|
||||
widget->rc->x2-1,
|
||||
widget->rc->y2-1,
|
||||
jwidget_has_focus(widget) ? PART_SUNKEN_FOCUSED_NW:
|
||||
PART_SUNKEN_NORMAL_NW,
|
||||
COLOR_BACKGROUND);
|
||||
}
|
||||
|
||||
void SkinneableTheme::draw_view_scrollbar(JWidget widget, JRect clip)
|
||||
@ -1363,11 +1370,12 @@ void SkinneableTheme::draw_frame(Frame* window, JRect clip)
|
||||
if (!window->is_desktop()) {
|
||||
// window frame
|
||||
if (window->hasText()) {
|
||||
draw_bounds(pos->x1,
|
||||
pos->y1,
|
||||
pos->x2-1,
|
||||
pos->y2-1, PART_WINDOW_NW,
|
||||
get_window_face_color());
|
||||
draw_bounds_nw(ji_screen,
|
||||
pos->x1,
|
||||
pos->y1,
|
||||
pos->x2-1,
|
||||
pos->y2-1, PART_WINDOW_NW,
|
||||
get_window_face_color());
|
||||
|
||||
pos->y2 = cpos->y1;
|
||||
|
||||
@ -1379,11 +1387,12 @@ void SkinneableTheme::draw_frame(Frame* window, JRect clip)
|
||||
}
|
||||
// menubox
|
||||
else {
|
||||
draw_bounds(pos->x1,
|
||||
pos->y1,
|
||||
pos->x2-1,
|
||||
pos->y2-1, PART_MENU_NW,
|
||||
get_window_face_color());
|
||||
draw_bounds_nw(ji_screen,
|
||||
pos->x1,
|
||||
pos->y1,
|
||||
pos->x2-1,
|
||||
pos->y2-1, PART_MENU_NW,
|
||||
get_window_face_color());
|
||||
}
|
||||
}
|
||||
// desktop
|
||||
@ -1506,67 +1515,67 @@ BITMAP* SkinneableTheme::get_toolicon(const char* tool_id) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define draw_bounds_template(_nw, _n, _ne, _e, _se, _s, _sw, _w, draw_func) \
|
||||
#define draw_bounds_template(_bmp, _nw, _n, _ne, _e, _se, _s, _sw, _w, draw_func) \
|
||||
{ \
|
||||
int x, y; \
|
||||
int cx1, cy1, cx2, cy2; \
|
||||
get_clip_rect(ji_screen, &cx1, &cy1, &cx2, &cy2); \
|
||||
get_clip_rect(_bmp, &cx1, &cy1, &cx2, &cy2); \
|
||||
\
|
||||
/* top */ \
|
||||
\
|
||||
draw_func(ji_screen, m_part[_nw], x1, y1); \
|
||||
draw_func(_bmp, m_part[_nw], x1, y1); \
|
||||
\
|
||||
if (my_add_clip_rect(ji_screen, \
|
||||
if (my_add_clip_rect(_bmp, \
|
||||
x1+m_part[_nw]->w, y1, \
|
||||
x2-m_part[_ne]->w, y2)) { \
|
||||
for (x = x1+m_part[_nw]->w; \
|
||||
x <= x2-m_part[_ne]->w; \
|
||||
x += m_part[_n]->w) { \
|
||||
draw_func(ji_screen, m_part[_n], x, y1); \
|
||||
draw_func(_bmp, m_part[_n], x, y1); \
|
||||
} \
|
||||
} \
|
||||
set_clip_rect(ji_screen, cx1, cy1, cx2, cy2); \
|
||||
set_clip_rect(_bmp, cx1, cy1, cx2, cy2); \
|
||||
\
|
||||
draw_func(ji_screen, m_part[_ne], x2-m_part[_ne]->w+1, y1); \
|
||||
draw_func(_bmp, m_part[_ne], x2-m_part[_ne]->w+1, y1); \
|
||||
\
|
||||
/* bottom */ \
|
||||
\
|
||||
draw_func(ji_screen, m_part[_sw], x1, y2-m_part[_sw]->h+1); \
|
||||
draw_func(_bmp, m_part[_sw], x1, y2-m_part[_sw]->h+1); \
|
||||
\
|
||||
if (my_add_clip_rect(ji_screen, \
|
||||
if (my_add_clip_rect(_bmp, \
|
||||
x1+m_part[_sw]->w, y1, \
|
||||
x2-m_part[_se]->w, y2)) { \
|
||||
for (x = x1+m_part[_sw]->w; \
|
||||
x <= x2-m_part[_se]->w; \
|
||||
x += m_part[_s]->w) { \
|
||||
draw_func(ji_screen, m_part[_s], x, y2-m_part[_s]->h+1); \
|
||||
draw_func(_bmp, m_part[_s], x, y2-m_part[_s]->h+1); \
|
||||
} \
|
||||
} \
|
||||
set_clip_rect(ji_screen, cx1, cy1, cx2, cy2); \
|
||||
set_clip_rect(_bmp, cx1, cy1, cx2, cy2); \
|
||||
\
|
||||
draw_func(ji_screen, m_part[_se], x2-m_part[_se]->w+1, y2-m_part[_se]->h+1); \
|
||||
draw_func(_bmp, m_part[_se], x2-m_part[_se]->w+1, y2-m_part[_se]->h+1); \
|
||||
\
|
||||
if (my_add_clip_rect(ji_screen, \
|
||||
if (my_add_clip_rect(_bmp, \
|
||||
x1, y1+m_part[_nw]->h, \
|
||||
x2, y2-m_part[_sw]->h)) { \
|
||||
/* left */ \
|
||||
for (y = y1+m_part[_nw]->h; \
|
||||
y <= y2-m_part[_sw]->h; \
|
||||
y += m_part[_w]->h) { \
|
||||
draw_func(ji_screen, m_part[_w], x1, y); \
|
||||
draw_func(_bmp, m_part[_w], x1, y); \
|
||||
} \
|
||||
\
|
||||
/* right */ \
|
||||
for (y = y1+m_part[_ne]->h; \
|
||||
y <= y2-m_part[_se]->h; \
|
||||
y += m_part[_e]->h) { \
|
||||
draw_func(ji_screen, m_part[_e], x2-m_part[_e]->w+1, y); \
|
||||
draw_func(_bmp, m_part[_e], x2-m_part[_e]->w+1, y); \
|
||||
} \
|
||||
} \
|
||||
set_clip_rect(ji_screen, cx1, cy1, cx2, cy2); \
|
||||
set_clip_rect(_bmp, cx1, cy1, cx2, cy2); \
|
||||
}
|
||||
|
||||
void SkinneableTheme::draw_bounds0(int x1, int y1, int x2, int y2, int parts[8])
|
||||
void SkinneableTheme::draw_bounds_array(BITMAP* bmp, int x1, int y1, int x2, int y2, int parts[8])
|
||||
{
|
||||
int nw = parts[0];
|
||||
int n = parts[1];
|
||||
@ -1578,27 +1587,16 @@ void SkinneableTheme::draw_bounds0(int x1, int y1, int x2, int y2, int parts[8])
|
||||
int w = parts[7];
|
||||
|
||||
set_alpha_blender();
|
||||
draw_bounds_template(nw, n, ne, e, se, s, sw, w, draw_trans_sprite);
|
||||
draw_bounds_template(bmp,
|
||||
nw, n, ne, e,
|
||||
se, s, sw, w, draw_trans_sprite);
|
||||
}
|
||||
|
||||
void SkinneableTheme::draw_trans_bounds0(int x1, int y1, int x2, int y2, int parts[8])
|
||||
{
|
||||
int nw = parts[0];
|
||||
int n = parts[1];
|
||||
int ne = parts[2];
|
||||
int e = parts[3];
|
||||
int se = parts[4];
|
||||
int s = parts[5];
|
||||
int sw = parts[6];
|
||||
int w = parts[7];
|
||||
|
||||
draw_bounds_template(nw, n, ne, e, se, s, sw, w, draw_trans_sprite);
|
||||
}
|
||||
|
||||
void SkinneableTheme::draw_bounds(int x1, int y1, int x2, int y2, int nw, int bg)
|
||||
void SkinneableTheme::draw_bounds_nw(BITMAP* bmp, int x1, int y1, int x2, int y2, int nw, int bg)
|
||||
{
|
||||
set_alpha_blender();
|
||||
draw_bounds_template(nw+0, nw+1, nw+2, nw+3,
|
||||
draw_bounds_template(bmp,
|
||||
nw+0, nw+1, nw+2, nw+3,
|
||||
nw+4, nw+5, nw+6, nw+7, draw_trans_sprite);
|
||||
|
||||
// Center
|
||||
@ -1608,33 +1606,27 @@ void SkinneableTheme::draw_bounds(int x1, int y1, int x2, int y2, int nw, int bg
|
||||
x2 -= m_part[nw+3]->w;
|
||||
y2 -= m_part[nw+5]->h;
|
||||
|
||||
rectfill(ji_screen, x1, y1, x2, y2, bg);
|
||||
rectfill(bmp, x1, y1, x2, y2, bg);
|
||||
}
|
||||
}
|
||||
|
||||
void SkinneableTheme::draw_trans_bounds(int x1, int y1, int x2, int y2, int nw)
|
||||
{
|
||||
draw_bounds_template(nw+0, nw+1, nw+2, nw+3,
|
||||
nw+4, nw+5, nw+6, nw+7, draw_trans_sprite);
|
||||
}
|
||||
|
||||
void SkinneableTheme::draw_bounds2(int x1, int y1, int x2, int y2, int x_mid, int nw1, int nw2, int bg1, int bg2)
|
||||
void SkinneableTheme::draw_bounds_nw2(BITMAP* bmp, int x1, int y1, int x2, int y2, int x_mid, int nw1, int nw2, int bg1, int bg2)
|
||||
{
|
||||
int cx1, cy1, cx2, cy2;
|
||||
get_clip_rect(ji_screen, &cx1, &cy1, &cx2, &cy2);
|
||||
get_clip_rect(bmp, &cx1, &cy1, &cx2, &cy2);
|
||||
|
||||
if (my_add_clip_rect(ji_screen, x1, y1, x_mid, y2))
|
||||
draw_bounds(x1, y1, x2, y2, nw1, bg1);
|
||||
if (my_add_clip_rect(bmp, x1, y1, x_mid, y2))
|
||||
draw_bounds_nw(bmp, x1, y1, x2, y2, nw1, bg1);
|
||||
|
||||
set_clip_rect(ji_screen, cx1, cy1, cx2, cy2);
|
||||
set_clip_rect(bmp, cx1, cy1, cx2, cy2);
|
||||
|
||||
if (my_add_clip_rect(ji_screen, x_mid+1, y1, x2, y2))
|
||||
draw_bounds(x1, y1, x2, y2, nw2, bg2);
|
||||
if (my_add_clip_rect(bmp, x_mid+1, y1, x2, y2))
|
||||
draw_bounds_nw(bmp, x1, y1, x2, y2, nw2, bg2);
|
||||
|
||||
set_clip_rect(ji_screen, cx1, cy1, cx2, cy2);
|
||||
set_clip_rect(bmp, cx1, cy1, cx2, cy2);
|
||||
}
|
||||
|
||||
void SkinneableTheme::draw_hline(int x1, int y1, int x2, int y2, int part)
|
||||
void SkinneableTheme::draw_part_as_hline(BITMAP* bmp, int x1, int y1, int x2, int y2, int part)
|
||||
{
|
||||
int x;
|
||||
|
||||
@ -1643,17 +1635,17 @@ void SkinneableTheme::draw_hline(int x1, int y1, int x2, int y2, int part)
|
||||
for (x = x1;
|
||||
x <= x2-m_part[part]->w;
|
||||
x += m_part[part]->w) {
|
||||
draw_trans_sprite(ji_screen, m_part[part], x, y1);
|
||||
draw_trans_sprite(bmp, m_part[part], x, y1);
|
||||
}
|
||||
|
||||
if (x <= x2) {
|
||||
int cx1, cy1, cx2, cy2;
|
||||
get_clip_rect(ji_screen, &cx1, &cy1, &cx2, &cy2);
|
||||
get_clip_rect(bmp, &cx1, &cy1, &cx2, &cy2);
|
||||
|
||||
if (my_add_clip_rect(ji_screen, x, y1, x2, y1+m_part[part]->h-1))
|
||||
draw_trans_sprite(ji_screen, m_part[part], x, y1);
|
||||
if (my_add_clip_rect(bmp, x, y1, x2, y1+m_part[part]->h-1))
|
||||
draw_trans_sprite(bmp, m_part[part], x, y1);
|
||||
|
||||
set_clip_rect(ji_screen, cx1, cy1, cx2, cy2);
|
||||
set_clip_rect(bmp, cx1, cy1, cx2, cy2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,17 +485,15 @@ public:
|
||||
BITMAP* get_part(int part_i) const { return m_part[part_i]; }
|
||||
BITMAP* get_toolicon(const char* tool_id) const;
|
||||
|
||||
// helper functions to draw parts
|
||||
void draw_bounds0(int x1, int y1, int x2, int y2, int parts[8]);
|
||||
void draw_trans_bounds0(int x1, int y1, int x2, int y2, int parts[8]);
|
||||
void draw_bounds(int x1, int y1, int x2, int y2, int nw, int bg);
|
||||
void draw_trans_bounds(int x1, int y1, int x2, int y2, int nw);
|
||||
void draw_bounds2(int x1, int y1, int x2, int y2, int x_mid, int nw1, int nw2, int bg1, int bg2);
|
||||
void draw_hline(int x1, int y1, int x2, int y2, int part);
|
||||
// helper functions to draw bounds/hlines with sheet parts
|
||||
void draw_bounds_array(BITMAP* bmp, int x1, int y1, int x2, int y2, int parts[8]);
|
||||
void draw_bounds_nw(BITMAP* bmp, int x1, int y1, int x2, int y2, int nw, int bg = -1);
|
||||
void draw_bounds_nw2(BITMAP* bmp, int x1, int y1, int x2, int y2, int x_mid, int nw1, int nw2, int bg1, int bg2);
|
||||
void draw_part_as_hline(BITMAP* bmp, int x1, int y1, int x2, int y2, int part);
|
||||
|
||||
// Wrapper to use the new "Rect" class (x, y, w, h)
|
||||
void draw_bounds(const Rect& rc, int nw, int bg) {
|
||||
draw_bounds(rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, nw, bg);
|
||||
void draw_bounds_nw(BITMAP* bmp, const Rect& rc, int nw, int bg) {
|
||||
draw_bounds_nw(bmp, rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, nw, bg);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -218,22 +218,18 @@ bool ColorBar::msg_proc(JMessage msg)
|
||||
m_hot_drag != m_hot_drop));
|
||||
|
||||
if (color_equals(m_bgcolor, color)) {
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO fix this ugly hack
|
||||
ji_screen = doublebuffer;
|
||||
theme->draw_bounds(entryBounds.x, entryBounds.y,
|
||||
entryBounds.x+entryBounds.w-1,
|
||||
entryBounds.y+entryBounds.h-1 - (row == m_colorsPerColumn-1 ? jguiscale(): 0),
|
||||
PART_COLORBAR_BORDER_BG_NW, -1);
|
||||
ji_screen = old_ji_screen;
|
||||
theme->draw_bounds_nw(doublebuffer,
|
||||
entryBounds.x, entryBounds.y,
|
||||
entryBounds.x+entryBounds.w-1,
|
||||
entryBounds.y+entryBounds.h-1 - (row == m_colorsPerColumn-1 ? jguiscale(): 0),
|
||||
PART_COLORBAR_BORDER_BG_NW, -1);
|
||||
}
|
||||
if (color_equals(m_fgcolor, color)) {
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO fix this ugly hack
|
||||
ji_screen = doublebuffer;
|
||||
theme->draw_bounds(entryBounds.x, entryBounds.y,
|
||||
entryBounds.x+entryBounds.w-1,
|
||||
entryBounds.y+entryBounds.h-1 - (row == m_colorsPerColumn-1 ? jguiscale(): 0),
|
||||
PART_COLORBAR_BORDER_FG_NW, -1);
|
||||
ji_screen = old_ji_screen;
|
||||
theme->draw_bounds_nw(doublebuffer,
|
||||
entryBounds.x, entryBounds.y,
|
||||
entryBounds.x+entryBounds.w-1,
|
||||
entryBounds.y+entryBounds.h-1 - (row == m_colorsPerColumn-1 ? jguiscale(): 0),
|
||||
PART_COLORBAR_BORDER_FG_NW, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -717,10 +717,11 @@ static bool editor_view_msg_proc(JWidget widget, JMessage msg)
|
||||
JRect pos = jwidget_get_rect(widget);
|
||||
SkinneableTheme* theme = static_cast<SkinneableTheme*>(widget->theme);
|
||||
|
||||
theme->draw_bounds(pos->x1, pos->y1,
|
||||
pos->x2-1, pos->y2-1,
|
||||
(child == current_editor) ? PART_EDITOR_SELECTED_NW:
|
||||
PART_EDITOR_NORMAL_NW, false);
|
||||
theme->draw_bounds_nw(ji_screen,
|
||||
pos->x1, pos->y1,
|
||||
pos->x2-1, pos->y2-1,
|
||||
(child == current_editor) ? PART_EDITOR_SELECTED_NW:
|
||||
PART_EDITOR_NORMAL_NW, false);
|
||||
|
||||
jrect_free(pos);
|
||||
}
|
||||
|
@ -359,16 +359,12 @@ bool StatusBar::msg_proc(JMessage msg)
|
||||
bool hot = (*it == sprite->getCurrentLayer())
|
||||
|| (c == m_hot_layer);
|
||||
|
||||
{
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO fix this ugly hack
|
||||
ji_screen = doublebuffer;
|
||||
theme->draw_bounds(x1, rc->y1, x2, rc->y2,
|
||||
hot ? PART_TOOLBUTTON_HOT_NW:
|
||||
PART_TOOLBUTTON_NORMAL_NW,
|
||||
hot ? theme->get_button_hot_face_color():
|
||||
theme->get_button_normal_face_color());
|
||||
ji_screen = old_ji_screen;
|
||||
}
|
||||
theme->draw_bounds_nw(doublebuffer,
|
||||
x1, rc->y1, x2, rc->y2,
|
||||
hot ? PART_TOOLBUTTON_HOT_NW:
|
||||
PART_TOOLBUTTON_NORMAL_NW,
|
||||
hot ? theme->get_button_hot_face_color():
|
||||
theme->get_button_normal_face_color());
|
||||
|
||||
if (count == 1)
|
||||
uszprintf(buf, sizeof(buf), "%s", (*it)->get_name().c_str());
|
||||
@ -386,14 +382,10 @@ bool StatusBar::msg_proc(JMessage msg)
|
||||
int x1 = rc->x2-width;
|
||||
int x2 = rc->x2;
|
||||
|
||||
{
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO fix this ugly hack
|
||||
ji_screen = doublebuffer;
|
||||
theme->draw_bounds(x1, rc->y1, x2, rc->y2,
|
||||
PART_TOOLBUTTON_NORMAL_NW,
|
||||
theme->get_button_normal_face_color());
|
||||
ji_screen = old_ji_screen;
|
||||
}
|
||||
theme->draw_bounds_nw(doublebuffer,
|
||||
x1, rc->y1, x2, rc->y2,
|
||||
PART_TOOLBUTTON_NORMAL_NW,
|
||||
theme->get_button_normal_face_color());
|
||||
|
||||
textout_centre_ex(doublebuffer, this->getFont(), "No Sprite",
|
||||
(x1+x2)/2,
|
||||
|
@ -237,8 +237,8 @@ static bool tabs_msg_proc(JWidget widget, JMessage msg)
|
||||
rect->y1+theme->get_part(PART_TAB_FILLER)->h);
|
||||
JLink link;
|
||||
|
||||
theme->draw_hline(box->x1, box->y1, box->x2-1, box->y2-1, PART_TAB_FILLER);
|
||||
theme->draw_hline(box->x1, box->y2, box->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
|
||||
theme->draw_part_as_hline(ji_screen, box->x1, box->y1, box->x2-1, box->y2-1, PART_TAB_FILLER);
|
||||
theme->draw_part_as_hline(ji_screen, box->x1, box->y2, box->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
|
||||
|
||||
box->x1 = box->x2;
|
||||
|
||||
@ -264,16 +264,21 @@ static bool tabs_msg_proc(JWidget widget, JMessage msg)
|
||||
face_color = theme->get_tab_normal_face_color();
|
||||
}
|
||||
|
||||
theme->draw_bounds(box->x1, box->y1, box->x2-1, box->y2-1,
|
||||
(tabs->selected == tab) ? PART_TAB_SELECTED_NW:
|
||||
PART_TAB_NORMAL_NW, face_color);
|
||||
theme->draw_bounds_nw(ji_screen,
|
||||
box->x1, box->y1, box->x2-1, box->y2-1,
|
||||
(tabs->selected == tab) ? PART_TAB_SELECTED_NW:
|
||||
PART_TAB_NORMAL_NW, face_color);
|
||||
|
||||
if (tabs->selected == tab)
|
||||
theme->draw_bounds(box->x1, box->y2, box->x2-1, rect->y2-1,
|
||||
PART_TAB_BOTTOM_SELECTED_NW,
|
||||
theme->get_tab_selected_face_color());
|
||||
else
|
||||
theme->draw_hline(box->x1, box->y2, box->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
|
||||
if (tabs->selected == tab) {
|
||||
theme->draw_bounds_nw(ji_screen,
|
||||
box->x1, box->y2, box->x2-1, rect->y2-1,
|
||||
PART_TAB_BOTTOM_SELECTED_NW,
|
||||
theme->get_tab_selected_face_color());
|
||||
}
|
||||
else {
|
||||
theme->draw_part_as_hline(ji_screen,
|
||||
box->x1, box->y2, box->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
|
||||
}
|
||||
|
||||
jdraw_text(widget->getFont(), tab->text.c_str(),
|
||||
box->x1+4*jguiscale(),
|
||||
@ -286,8 +291,8 @@ static bool tabs_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
/* fill the gap to the right-side */
|
||||
if (box->x1 < rect->x2) {
|
||||
theme->draw_hline(box->x1, box->y1, rect->x2-1, box->y2-1, PART_TAB_FILLER);
|
||||
theme->draw_hline(box->x1, box->y2, rect->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
|
||||
theme->draw_part_as_hline(ji_screen, box->x1, box->y1, rect->x2-1, box->y2-1, PART_TAB_FILLER);
|
||||
theme->draw_part_as_hline(ji_screen, box->x1, box->y2, rect->x2-1, rect->y2-1, PART_TAB_BOTTOM_NORMAL);
|
||||
}
|
||||
|
||||
jrect_free(rect);
|
||||
|
@ -182,8 +182,6 @@ bool ToolBar::msg_proc(JMessage msg)
|
||||
}
|
||||
|
||||
case JM_DRAW: {
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO switching ji_screen is an horrible hack,
|
||||
// JM_DRAW must be changed to onPaint event as in Vaca library
|
||||
BITMAP *doublebuffer = create_bitmap(jrect_w(&msg->draw.rect),
|
||||
jrect_h(&msg->draw.rect));
|
||||
SkinneableTheme* theme = static_cast<SkinneableTheme*>(this->theme);
|
||||
@ -192,7 +190,6 @@ bool ToolBar::msg_proc(JMessage msg)
|
||||
int groups = toolbox->getGroupsCount();
|
||||
Rect toolrc;
|
||||
|
||||
ji_screen = doublebuffer;
|
||||
clear_to_color(doublebuffer, theme->get_tab_selected_face_color());
|
||||
|
||||
for (int c=0; c<groups; ++c, ++it) {
|
||||
@ -213,7 +210,7 @@ bool ToolBar::msg_proc(JMessage msg)
|
||||
|
||||
toolrc = getToolGroupBounds(c);
|
||||
toolrc.offset(-msg->draw.rect.x1, -msg->draw.rect.y1);
|
||||
theme->draw_bounds(toolrc, nw, face);
|
||||
theme->draw_bounds_nw(doublebuffer, toolrc, nw, face);
|
||||
|
||||
// Draw the tool icon
|
||||
BITMAP* icon = theme->get_toolicon(tool->getId().c_str());
|
||||
@ -227,11 +224,12 @@ bool ToolBar::msg_proc(JMessage msg)
|
||||
|
||||
toolrc = getToolGroupBounds(-1);
|
||||
toolrc.offset(-msg->draw.rect.x1, -msg->draw.rect.y1);
|
||||
theme->draw_bounds(toolrc,
|
||||
m_hot_conf ? PART_TOOLBUTTON_HOT_NW:
|
||||
PART_TOOLBUTTON_LAST_NW,
|
||||
m_hot_conf ? theme->get_button_hot_face_color():
|
||||
theme->get_button_normal_face_color());
|
||||
theme->draw_bounds_nw(doublebuffer,
|
||||
toolrc,
|
||||
m_hot_conf ? PART_TOOLBUTTON_HOT_NW:
|
||||
PART_TOOLBUTTON_LAST_NW,
|
||||
m_hot_conf ? theme->get_button_hot_face_color():
|
||||
theme->get_button_normal_face_color());
|
||||
|
||||
// Draw the tool icon
|
||||
BITMAP* icon = theme->get_toolicon("configuration");
|
||||
@ -242,8 +240,6 @@ bool ToolBar::msg_proc(JMessage msg)
|
||||
toolrc.y+toolrc.h/2-icon->h/2);
|
||||
}
|
||||
|
||||
ji_screen = old_ji_screen;
|
||||
|
||||
blit(doublebuffer, ji_screen, 0, 0,
|
||||
msg->draw.rect.x1,
|
||||
msg->draw.rect.y1,
|
||||
@ -543,8 +539,6 @@ bool ToolStrip::msg_proc(JMessage msg)
|
||||
}
|
||||
|
||||
case JM_DRAW: {
|
||||
BITMAP* old_ji_screen = ji_screen; // TODO switching ji_screen is an horrible hack,
|
||||
// JM_DRAW must be changed to onPaint event as in Vaca library
|
||||
BITMAP *doublebuffer = create_bitmap(jrect_w(&msg->draw.rect),
|
||||
jrect_h(&msg->draw.rect));
|
||||
SkinneableTheme* theme = static_cast<SkinneableTheme*>(this->theme);
|
||||
@ -552,7 +546,6 @@ bool ToolStrip::msg_proc(JMessage msg)
|
||||
Rect toolrc;
|
||||
int index = 0;
|
||||
|
||||
ji_screen = doublebuffer;
|
||||
clear_to_color(doublebuffer, theme->get_tab_selected_face_color());
|
||||
|
||||
for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) {
|
||||
@ -572,7 +565,7 @@ bool ToolStrip::msg_proc(JMessage msg)
|
||||
|
||||
toolrc = getToolBounds(index++);
|
||||
toolrc.offset(-msg->draw.rect.x1, -msg->draw.rect.y1);
|
||||
theme->draw_bounds(toolrc, nw, face);
|
||||
theme->draw_bounds_nw(doublebuffer, toolrc, nw, face);
|
||||
|
||||
// Draw the tool icon
|
||||
BITMAP* icon = theme->get_toolicon(tool->getId().c_str());
|
||||
@ -585,8 +578,6 @@ bool ToolStrip::msg_proc(JMessage msg)
|
||||
}
|
||||
}
|
||||
|
||||
ji_screen = old_ji_screen;
|
||||
|
||||
blit(doublebuffer, ji_screen, 0, 0,
|
||||
msg->draw.rect.x1,
|
||||
msg->draw.rect.y1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user