mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
More jguiscale() usage.
This commit is contained in:
parent
4369afa2c5
commit
719374718d
@ -87,7 +87,7 @@ void AboutCommand::execute(Context* context)
|
||||
|
||||
jwidget_magnetic(button1, true);
|
||||
|
||||
jwidget_set_border(box1, 4, 4, 4, 4);
|
||||
jwidget_set_border(box1, 4 * jguiscale());
|
||||
jwidget_add_children(box1, label1, label2, separator1, NULL);
|
||||
if (textbox) {
|
||||
jview_attach(view, textbox);
|
||||
@ -103,9 +103,9 @@ void AboutCommand::execute(Context* context)
|
||||
jwidget_add_child(window, box1);
|
||||
|
||||
jwidget_set_border(button1,
|
||||
button1->border_width.l+16,
|
||||
button1->border_width.l + 16*jguiscale(),
|
||||
button1->border_width.t,
|
||||
button1->border_width.r+16,
|
||||
button1->border_width.r + 16*jguiscale(),
|
||||
button1->border_width.b);
|
||||
|
||||
window->open_window_fg();
|
||||
|
@ -341,7 +341,7 @@ static JWidget tips_load_box(FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
{
|
||||
JWidget vbox = jbox_new(JI_VERTICAL);
|
||||
|
||||
jwidget_set_border(vbox, 2, 2, 2, 2);
|
||||
jwidget_set_border(vbox, 2 * jguiscale());
|
||||
|
||||
for (;;) {
|
||||
if (*take) {
|
||||
|
@ -333,8 +333,11 @@ static bool combobox_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
/* get the text-length of every item and put in 'w' the maximum value */
|
||||
JI_LIST_FOR_EACH(combobox->items, link) {
|
||||
int item_w = 2+text_length(widget->getFont(),
|
||||
((ComboItem *)link->data)->text)+2;
|
||||
int item_w =
|
||||
2*jguiscale()+
|
||||
text_length(widget->getFont(),
|
||||
((ComboItem *)link->data)->text)+
|
||||
2*jguiscale();
|
||||
|
||||
w = MAX(w, item_w);
|
||||
}
|
||||
|
@ -138,14 +138,14 @@ bool PopupWindow::msg_proc(JMessage msg)
|
||||
if (msg->signal.num == JI_SIGNAL_INIT_THEME) {
|
||||
int w = 0, h = 0;
|
||||
|
||||
this->border_width.l = 3;
|
||||
this->border_width.t = 3;
|
||||
this->border_width.r = 3;
|
||||
this->border_width.b = 3;
|
||||
this->border_width.l = 3 * jguiscale();
|
||||
this->border_width.t = 3 * jguiscale();
|
||||
this->border_width.r = 3 * jguiscale();
|
||||
this->border_width.b = 3 * jguiscale();
|
||||
|
||||
_ji_theme_textbox_draw(NULL, this, &w, &h, 0, 0);
|
||||
|
||||
this->border_width.t = h-3;
|
||||
this->border_width.t = h - 3 * jguiscale();
|
||||
|
||||
/* setup the background color */
|
||||
jwidget_set_bg_color(this, makecol(255, 255, 200));
|
||||
@ -202,7 +202,7 @@ bool PopupWindow::msg_proc(JMessage msg)
|
||||
jdraw_rectfill(pos, this->getBgColor());
|
||||
|
||||
oldt = this->border_width.t;
|
||||
this->border_width.t = 3;
|
||||
this->border_width.t = 3 * jguiscale();
|
||||
_ji_theme_textbox_draw(ji_screen, this, NULL, NULL,
|
||||
this->getBgColor(),
|
||||
ji_color_foreground());
|
||||
|
@ -244,14 +244,14 @@ bool TipWindow::msg_proc(JMessage msg)
|
||||
if (msg->signal.num == JI_SIGNAL_INIT_THEME) {
|
||||
int w = 0, h = 0;
|
||||
|
||||
this->border_width.l = 3;
|
||||
this->border_width.t = 3;
|
||||
this->border_width.r = 3;
|
||||
this->border_width.b = 3;
|
||||
this->border_width.l = 3 * jguiscale();
|
||||
this->border_width.t = 3 * jguiscale();
|
||||
this->border_width.r = 3 * jguiscale();
|
||||
this->border_width.b = 3 * jguiscale();
|
||||
|
||||
_ji_theme_textbox_draw(NULL, this, &w, &h, 0, 0);
|
||||
|
||||
this->border_width.t = h-3;
|
||||
this->border_width.t = h - 3 * jguiscale();
|
||||
|
||||
/* setup the background color */
|
||||
setBgColor(makecol(255, 255, 200));
|
||||
@ -308,7 +308,7 @@ bool TipWindow::msg_proc(JMessage msg)
|
||||
jdraw_rectfill(pos, this->getBgColor());
|
||||
|
||||
oldt = this->border_width.t;
|
||||
this->border_width.t = 3;
|
||||
this->border_width.t = 3 * jguiscale();
|
||||
_ji_theme_textbox_draw(ji_screen, this, NULL, NULL,
|
||||
this->getBgColor(),
|
||||
ji_color_foreground());
|
||||
|
@ -327,12 +327,7 @@ static struct
|
||||
|
||||
SkinneableTheme::SkinneableTheme()
|
||||
{
|
||||
int scale = jguiscale();
|
||||
|
||||
this->name = "Skinneable Theme";
|
||||
this->check_icon_size = 8 * scale;
|
||||
this->radio_icon_size = 8 * scale;
|
||||
this->scrollbar_size = 12 * scale;
|
||||
|
||||
m_sheet_bmp = NULL;
|
||||
for (int c=0; c<PARTS; ++c)
|
||||
@ -374,6 +369,10 @@ SkinneableTheme::~SkinneableTheme()
|
||||
|
||||
void SkinneableTheme::regen()
|
||||
{
|
||||
check_icon_size = 8 * jguiscale();
|
||||
radio_icon_size = 8 * jguiscale();
|
||||
scrollbar_size = 12 * jguiscale();
|
||||
|
||||
desktop_color = COLOR_DISABLED;
|
||||
textbox_fg_color = COLOR_FOREGROUND;
|
||||
textbox_bg_color = COLOR_BACKGROUND;
|
||||
@ -536,7 +535,7 @@ void SkinneableTheme::init_widget(JWidget widget)
|
||||
break;
|
||||
|
||||
case JI_MENUITEM:
|
||||
BORDER(2);
|
||||
BORDER(2 * scale);
|
||||
widget->child_spacing = 18 * scale;
|
||||
break;
|
||||
|
||||
@ -574,10 +573,10 @@ void SkinneableTheme::init_widget(JWidget widget)
|
||||
break;
|
||||
|
||||
case JI_SLIDER:
|
||||
BORDER4(m_part[PART_SLIDER_EMPTY_W]->w-1,
|
||||
BORDER4(m_part[PART_SLIDER_EMPTY_W]->w-1*scale,
|
||||
m_part[PART_SLIDER_EMPTY_N]->h,
|
||||
m_part[PART_SLIDER_EMPTY_E]->w-1,
|
||||
m_part[PART_SLIDER_EMPTY_S]->h-1);
|
||||
m_part[PART_SLIDER_EMPTY_E]->w-1*scale,
|
||||
m_part[PART_SLIDER_EMPTY_S]->h-1*scale);
|
||||
widget->child_spacing = jwidget_get_text_height(widget);
|
||||
widget->setAlign(JI_CENTER | JI_MIDDLE);
|
||||
break;
|
||||
@ -588,10 +587,10 @@ void SkinneableTheme::init_widget(JWidget widget)
|
||||
break;
|
||||
|
||||
case JI_VIEW:
|
||||
BORDER4(m_part[PART_SUNKEN_NORMAL_W]->w-1,
|
||||
BORDER4(m_part[PART_SUNKEN_NORMAL_W]->w-1*scale,
|
||||
m_part[PART_SUNKEN_NORMAL_N]->h,
|
||||
m_part[PART_SUNKEN_NORMAL_E]->w-1,
|
||||
m_part[PART_SUNKEN_NORMAL_S]->h-1);
|
||||
m_part[PART_SUNKEN_NORMAL_E]->w-1*scale,
|
||||
m_part[PART_SUNKEN_NORMAL_S]->h-1*scale);
|
||||
widget->child_spacing = 0;
|
||||
break;
|
||||
|
||||
@ -1022,24 +1021,26 @@ void SkinneableTheme::draw_menuitem(JWidget widget, JRect clip)
|
||||
if (!bar) {
|
||||
/* draw the arrown (to indicate which this menu has a sub-menu) */
|
||||
if (jmenuitem_get_submenu(widget)) {
|
||||
int scale = jguiscale();
|
||||
|
||||
/* enabled */
|
||||
if (jwidget_is_enabled(widget)) {
|
||||
for (c=0; c<3; c++)
|
||||
for (c=0; c<3*scale; c++)
|
||||
vline(ji_screen,
|
||||
widget->rc->x2-3-c,
|
||||
widget->rc->x2-3*scale-c,
|
||||
(widget->rc->y1+widget->rc->y2)/2-c,
|
||||
(widget->rc->y1+widget->rc->y2)/2+c, fg);
|
||||
}
|
||||
/* disabled */
|
||||
else {
|
||||
for (c=0; c<3; c++)
|
||||
for (c=0; c<3*scale; c++)
|
||||
vline(ji_screen,
|
||||
widget->rc->x2-3-c+1,
|
||||
widget->rc->x2-3*scale-c+1,
|
||||
(widget->rc->y1+widget->rc->y2)/2-c+1,
|
||||
(widget->rc->y1+widget->rc->y2)/2+c+1, COLOR_BACKGROUND);
|
||||
for (c=0; c<3; c++)
|
||||
for (c=0; c<3*scale; c++)
|
||||
vline(ji_screen,
|
||||
widget->rc->x2-3-c,
|
||||
widget->rc->x2-3*scale-c,
|
||||
(widget->rc->y1+widget->rc->y2)/2-c,
|
||||
(widget->rc->y1+widget->rc->y2)/2+c, COLOR_DISABLED);
|
||||
}
|
||||
@ -1731,8 +1732,8 @@ bool SkinneableTheme::theme_combobox_button_msg_proc(JWidget widget, JMessage ms
|
||||
switch (msg->type) {
|
||||
|
||||
case JM_REQSIZE:
|
||||
msg->reqsize.w = 15;
|
||||
msg->reqsize.h = 16;
|
||||
msg->reqsize.w = 15 * jguiscale();
|
||||
msg->reqsize.h = 16 * jguiscale();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ Frame* colorselector_new(bool editable_palette)
|
||||
|
||||
/* data for a better layout */
|
||||
grid1->child_spacing = 0;
|
||||
grid2->border_width.t = 3;
|
||||
grid2->border_width.t = 3 * jguiscale();
|
||||
jwidget_expansive(grid2, true);
|
||||
|
||||
/* append a tab for each color-model */
|
||||
|
@ -53,7 +53,7 @@ JWidget colorviewer_new(color_t color, int imgtype)
|
||||
jwidget_add_hook(widget, colorviewer_type(),
|
||||
colorviewer_msg_proc, colorviewer);
|
||||
jwidget_focusrest(widget, true);
|
||||
jwidget_set_border(widget, 2, 2, 2, 2);
|
||||
jwidget_set_border(widget, 2 * jguiscale());
|
||||
widget->setAlign(JI_CENTER | JI_MIDDLE);
|
||||
|
||||
return widget;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "jinete/jsystem.h"
|
||||
#include "jinete/jview.h"
|
||||
#include "jinete/jwidget.h"
|
||||
#include "jinete/jtheme.h"
|
||||
|
||||
#include "core/color.h"
|
||||
#include "modules/gui.h"
|
||||
@ -74,9 +75,9 @@ JWidget paledit_new(Palette *palette, bool editable, int boxsize)
|
||||
jwidget_add_hook(widget, paledit_type(), paledit_msg_proc, paledit);
|
||||
jwidget_focusrest(widget, true);
|
||||
|
||||
widget->border_width.l = widget->border_width.r = 1;
|
||||
widget->border_width.t = widget->border_width.b = 1;
|
||||
widget->child_spacing = 1;
|
||||
widget->border_width.l = widget->border_width.r = 1 * jguiscale();
|
||||
widget->border_width.t = widget->border_width.b = 1 * jguiscale();
|
||||
widget->child_spacing = 1 * jguiscale();
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "jinete/jbox.h"
|
||||
#include "jinete/jbutton.h"
|
||||
#include "jinete/jhook.h"
|
||||
#include "jinete/jtheme.h"
|
||||
#include "jinete/jwidget.h"
|
||||
|
||||
#include "core/cfg.h"
|
||||
@ -47,7 +48,7 @@ JWidget target_button_new(int imgtype, bool with_channels)
|
||||
{
|
||||
#define ADD(box, widget, hook) \
|
||||
if (widget) { \
|
||||
jwidget_set_border(widget, 2, 2, 2, 2); \
|
||||
jwidget_set_border(widget, 2 * jguiscale()); \
|
||||
jwidget_add_child(box, widget); \
|
||||
HOOK(widget, \
|
||||
widget->type == JI_BUTTON ? \
|
||||
|
Loading…
x
Reference in New Issue
Block a user