Added jwidget_set_max_size.

Modified some dialogs for a better look.
Fixed the interactive movement of the layer.
This commit is contained in:
David Capello 2007-12-06 20:05:32 +00:00
parent 549210b95f
commit d87b0dc8ff
33 changed files with 310 additions and 388 deletions

View File

@ -1,3 +1,9 @@
2007-12-06 David A. Capello <dacap@users.sourceforge.net>
* src/util/misc.c (interactive_move_layer): Fixed problem with
scroll in windowed moded and mouse-paint problem in
double-buffering mode.
2007-12-05 David A. Capello <dacap@users.sourceforge.net>
* src/widgets/statebar.c (status_bar_set_text): Uses dirty

View File

@ -5,6 +5,7 @@ NEWS
0.6
---
+ Added support to load and save PNG files (through libpng).
+ Replaced the "List" menu with the tabs selector.
+ Better file selector.
+ Restructured all the menus (more user friendly options).
@ -18,7 +19,6 @@ NEWS
+ GUI enhanced:
+ more borders for windows and more spacing between widgets.
+ better mouse behavior (in Windows).
+ Added support to load and save PNG files (through libpng).
+ Finished the support for ICO files.
+ Finally screen scaling supported (with double-buffering). This means
that you can use a screen of 320x240 between a window of 640x480

View File

@ -40,9 +40,13 @@
<listitem text="Custom" />
</listbox>
</view>
<box horizontal homogeneous>
<button text="&OK" name="ok_button" magnetic />
<button text="&Cancel" />
<box horizontal>
<box horizontal expansive />
<box horizontal homogeneous>
<button text="&OK" name="ok_button" magnetic width="60" />
<button text="&Cancel" />
</box>
</box>
</box>
</window>

View File

@ -5,47 +5,36 @@
<window text="Options" name="options">
<box vertical>
<box horizontal>
<box vertical>
<box vertical>
<label text="Mouse Speed:" />
<box horizontal>
<box vertical homogeneous>
<label text="X:" />
<label text="Y:" />
</box>
<box vertical homogeneous expansive>
<slider min="-8" max="8" name="mouse_x" />
<slider min="-8" max="8" name="mouse_y" />
</box>
<label text="Mouse Speed:" />
<box horizontal>
<box vertical homogeneous>
<label text="X:" />
<label text="Y:" />
</box>
<box vertical homogeneous expansive>
<slider min="-8" max="8" name="mouse_x" />
<slider min="-8" max="8" name="mouse_y" />
</box>
<check text="Lock X/Y" name="lock_axis" />
<separator horizontal />
<label text="Movement Delay (milliseconds):" />
<slider min="0" max="1000" name="move_delay" />
<check text="Smooth auto-scroll" name="smooth" />
<check text="Real-time ordered dithering" name="dither" />
</box>
<separator vertical />
<box vertical>
<check text="Lock X/Y" name="lock_axis" />
<label text="" name="label_font" />
<button text="Change GUI Font" name="button_font" />
<button text="Change Language" name="button_lang" />
<separator horizontal />
<check text="2 Click Movement" name="move_click2" />
<check text="2 Click Drawing" name="draw_click2" />
<separator horizontal />
<check text="Smooth auto-scroll" name="smooth" />
<check text="Real-time ordered dithering" name="dither" />
<check text="2 Click Movement" name="move_click2" />
<check text="2 Click Drawing" name="draw_click2" />
</box>
</box>
<box horizontal homogeneous>
<button text="&OK" name="button_ok" magnetic />
<button text="&Save" name="button_save" />
<button text="&Cancel" />
<box horizontal>
<box horizontal expansive />
<box horizontal homogeneous>
<button text="&OK" name="button_ok" magnetic width="60" />
<button text="&Cancel" />
</box>
</box>
</box>
</window>

View File

@ -14,17 +14,22 @@
<label text="Background:" />
</box>
<box vertical homogeneous expansive>
<label text="" name="name" />
<entry text="" name="name" maxsize="256" readonly maxwidth="100" />
<label text="" name="type" />
<label text="" name="size" />
<label text="" name="frames" />
<box vertical name="bgcolor_box" />
<box horizontal>
<box vertical name="bgcolor_box" />
</box>
</box>
</box>
<button text="Constant Frame-Rate Speed" name="speed" />
<box horizontal homogeneous>
<button text="&OK" name="ok" magnetic />
<button text="&Cancel" />
<box horizontal>
<button text="Constant Frame-Rate Speed" name="speed" />
<box horizontal expansive />
<box horizontal homogeneous>
<button text="&OK" name="ok" magnetic width="60" />
<button text="&Cancel" />
</box>
</box>
</box>
</window>

View File

@ -73,7 +73,7 @@ static void cmd_about_execute(const char *argument)
if (textbox) {
jview_attach(view, textbox);
jwidget_expansive(view, TRUE);
jwidget_set_static_size(view, JI_SCREEN_W/3, JI_SCREEN_H/4);
jwidget_set_min_size(view, JI_SCREEN_W/3, JI_SCREEN_H/4);
jwidget_add_childs(box1, view, separator2, NULL);
}
jwidget_expansive(box3, TRUE);

View File

@ -111,10 +111,10 @@ static void cmd_configure_tools_execute(const char *argument)
cursor_color = color_button_new (get_cursor_color (), IMAGE_INDEXED);
/* brush-preview */
brush_preview = jwidget_new (JI_WIDGET);
brush_preview->static_w = 32 + 4;
brush_preview->static_h = 32 + 4;
jwidget_add_hook (brush_preview, JI_WIDGET,
brush_preview_msg_proc, NULL);
brush_preview->min_w = 32 + 4;
brush_preview->min_h = 32 + 4;
jwidget_add_hook(brush_preview, JI_WIDGET,
brush_preview_msg_proc, NULL);
/* brush-type */
brush_type = group_button_new (3, 1, get_brush_type (),
GFX_BRUSH_CIRCLE,

View File

@ -88,7 +88,7 @@ static void cmd_layer_properties_execute(const char *argument)
jlistbox_select_index(list_bm, layer->blend_mode);
jview_attach(view_bm, list_bm);
jwidget_set_static_size(view_bm, 128, 64);
jwidget_set_min_size(view_bm, 128, 64);
jwidget_expansive(view_bm, TRUE);
}

View File

@ -50,7 +50,7 @@ static void cmd_new_layer_execute(const char *argument)
name_widget = jwidget_find_name(window, "name");
jwidget_set_text(name_widget, GetUniqueLayerName());
jwidget_set_static_size(name_widget, 128, 0);
jwidget_set_min_size(name_widget, 128, 0);
sprintf(buf, "%d", sprite->w);
jwidget_set_text(jwidget_find_name(window, "width"), buf);

View File

@ -87,7 +87,6 @@ static void cmd_sprite_properties_execute(const char *argument)
/* filename */
jwidget_set_text(name, sprite->filename);
jwidget_set_static_size(name, 256, 0);
/* color mode */
jwidget_set_text(type, imgtype_text);

View File

@ -105,7 +105,7 @@ static void cmd_color_curve_execute(const char *argument)
jwidget_select(check_preview);
jview_attach(view_curve, curve_editor);
jwidget_set_static_size(view_curve, 128, 64);
jwidget_set_min_size(view_curve, 128, 64);
jwidget_add_child(box_target, target_button);
jwidget_add_child(window, preview);

View File

@ -126,7 +126,7 @@ static void cmd_convolution_matrix_execute(const char *argument)
jwidget_select(check_tiled);
jview_attach(view_convmatr, list_convmatr);
jwidget_set_static_size(view_convmatr, 128, 64);
jwidget_set_min_size(view_convmatr, 128, 64);
jwidget_add_child(box_target, target_button);
jwidget_add_child(window, preview);
@ -239,7 +239,7 @@ static int reload_select_hook(JWidget widget, int user_data)
return TRUE; /* do not close */
}
static int generate_select_hook (JWidget widget, int user_data)
static int generate_select_hook(JWidget widget, int user_data)
{
JWidget window;
JWidget view_x;
@ -251,61 +251,61 @@ static int generate_select_hook (JWidget widget, int user_data)
JWidget div, div_auto;
JWidget bias, bias_auto;
window = load_widget ("convmatr.jid", "generate_convolution_matrix");
window = load_widget("convmatr.jid", "generate_convolution_matrix");
if (!window)
return TRUE; /* don't close */
if (!get_widgets (window,
"view_x", &view_x,
"view_y", &view_y,
"div", &div,
"bias", &bias,
"div_auto", &div_auto,
"bias_auto", &bias_auto, NULL)) {
jwidget_free (window);
if (!get_widgets(window,
"view_x", &view_x,
"view_y", &view_y,
"div", &div,
"bias", &bias,
"div_auto", &div_auto,
"bias_auto", &bias_auto, NULL)) {
jwidget_free(window);
return TRUE; /* don't close */
}
/* curve_x = curve_new (CURVE_SPLINE); */
/* curve_y = curve_new (CURVE_SPLINE); */
curve_x = curve_new (CURVE_LINEAR);
curve_y = curve_new (CURVE_LINEAR);
curve_add_point (curve_x, curve_point_new (-100, 0));
curve_add_point (curve_x, curve_point_new (0, +100));
curve_add_point (curve_x, curve_point_new (+100, 0));
curve_add_point (curve_y, curve_point_new (-100, 0));
curve_add_point (curve_y, curve_point_new (0, +100));
curve_add_point (curve_y, curve_point_new (+100, 0));
/* curve_x = curve_new(CURVE_SPLINE); */
/* curve_y = curve_new(CURVE_SPLINE); */
curve_x = curve_new(CURVE_LINEAR);
curve_y = curve_new(CURVE_LINEAR);
curve_add_point(curve_x, curve_point_new (-100, 0));
curve_add_point(curve_x, curve_point_new (0, +100));
curve_add_point(curve_x, curve_point_new (+100, 0));
curve_add_point(curve_y, curve_point_new (-100, 0));
curve_add_point(curve_y, curve_point_new (0, +100));
curve_add_point(curve_y, curve_point_new (+100, 0));
curvedit_x = curve_editor_new (curve_x, -200, -200, 200, 200);
curvedit_y = curve_editor_new (curve_y, -200, -200, 200, 200);
curvedit_x = curve_editor_new(curve_x, -200, -200, 200, 200);
curvedit_y = curve_editor_new(curve_y, -200, -200, 200, 200);
jview_attach (view_x, curvedit_x);
jview_attach (view_y, curvedit_y);
jview_attach(view_x, curvedit_x);
jview_attach(view_y, curvedit_y);
jwidget_set_static_size (view_x, 64, 64);
jwidget_set_static_size (view_y, 64, 64);
jwidget_set_min_size(view_x, 64, 64);
jwidget_set_min_size(view_y, 64, 64);
/* TODO fix this */
/* jwidget_get_vtable (div)->request_size = NULL; */
/* jwidget_get_vtable (bias)->request_size = NULL; */
jwidget_set_static_size (div, 1, 1);
jwidget_set_static_size (bias, 1, 1);
jwidget_set_min_size(div, 1, 1);
jwidget_set_min_size(bias, 1, 1);
jwindow_open_fg (window);
jwindow_open_fg(window);
/* TODO do something */
jwidget_free (window);
jwidget_free(window);
curve_free (curve_x);
curve_free (curve_y);
curve_free(curve_x);
curve_free(curve_y);
return TRUE; /* do not close */
}
static int list_change_hook (JWidget widget, int user_data)
static int list_change_hook(JWidget widget, int user_data)
{
JWidget selected = jlistbox_get_selected_child (widget);
ConvMatr *convmatr = selected->user_data[0];
@ -317,25 +317,25 @@ static int list_change_hook (JWidget widget, int user_data)
return FALSE;
}
static int target_change_hook (JWidget widget, int user_data)
static int target_change_hook(JWidget widget, int user_data)
{
effect_load_target (preview_get_effect (preview));
make_preview ();
return FALSE;
}
static int preview_change_hook (JWidget widget, int user_data)
static int preview_change_hook(JWidget widget, int user_data)
{
set_config_bool ("ConvolutionMatrix", "Preview",
jwidget_is_selected (widget));
make_preview ();
set_config_bool("ConvolutionMatrix", "Preview",
jwidget_is_selected (widget));
make_preview();
return FALSE;
}
static int tiled_change_hook (JWidget widget, int user_data)
static int tiled_change_hook(JWidget widget, int user_data)
{
set_tiled_mode (jwidget_is_selected (widget));
make_preview ();
set_tiled_mode(jwidget_is_selected(widget));
make_preview();
return FALSE;
}

View File

@ -128,7 +128,7 @@ void console_printf(const char *format, ...)
if (!console_locked) {
console_locked = TRUE;
jwidget_set_static_size(wid_view, JI_SCREEN_W*9/10, JI_SCREEN_H*6/10);
jwidget_set_min_size(wid_view, JI_SCREEN_W*9/10, JI_SCREEN_H*6/10);
jwidget_show(wid_view);
jwindow_remap(wid_console);

View File

@ -363,7 +363,7 @@ static void mkdir_command(JWidget widget)
button_create = jbutton_new(_("&OK"));
button_cancel = jbutton_new(_("&Cancel"));
jwidget_set_static_size(entry_name, JI_SCREEN_W*75/100, 0);
jwidget_set_min_size(entry_name, JI_SCREEN_W*75/100, 0);
jwidget_add_child(box2, button_create);
jwidget_add_child(box2, button_cancel);

View File

@ -31,159 +31,101 @@
#include "intl/intl.h"
#endif
/* show the language selection dialog */
void dialogs_select_language(bool force)
{
#if 0 /* No more languages by now */
bool select_language = get_config_bool("Options", "SelectLanguage", TRUE);
if (force || select_language) {
JWidget window = jwindow_new("Select Language");
JWidget box = jbox_new(JI_HORIZONTAL + JI_HOMOGENEOUS);
JWidget button_en = jbutton_new("English");
JWidget button_es = jbutton_new("Español");
JWidget killer;
jwidget_add_child(window, box);
jwidget_add_child(box, button_en);
jwidget_add_child(box, button_es);
jwindow_open_fg(window);
killer = jwindow_get_killer(window);
/* en */
if (killer == button_en) {
intl_set_lang("en");
set_config_bool("Options", "SelectLanguage", FALSE);
}
/* es */
else if (killer == button_es) {
intl_set_lang("es");
set_config_bool("Options", "SelectLanguage", FALSE);
}
jwidget_free(window);
}
#else /* Just english */
/* only english */
intl_set_lang("en");
set_config_bool("Options", "SelectLanguage", FALSE);
#endif
}
/**********************************************************************/
/* Options */
static JWidget label_font, slider_x, slider_y, check_lockmouse;
static JWidget slider_x, slider_y, check_lockmouse;
static int slider_mouse_hook(JWidget widget, int user_data);
static void button_font_command(JWidget widget);
static void button_lang_command(JWidget widget);
static void set_label_font_text(void);
/* shows option dialog */
void dialogs_options(void)
{
JWidget window, move_delay, check_smooth, check_dither;
JWidget button_font, button_lang, button_ok, button_save;
JWidget window, check_smooth, check_dither;
JWidget button_ok;
JWidget move_click2, draw_click2, killer;
int x, y, old_x, old_y;
char *default_font;
x = get_config_int ("Options", "MouseX", 6);
y = get_config_int ("Options", "MouseY", 6);
x = MID (-8, x, 8);
y = MID (-8, y, 8);
x = get_config_int("Options", "MouseX", 6);
y = get_config_int("Options", "MouseY", 6);
x = MID(-8, x, 8);
y = MID(-8, y, 8);
old_x = x;
old_y = y;
/* load the window widget */
window = load_widget ("options.jid", "options");
window = load_widget("options.jid", "options");
if (!window)
return;
if (!get_widgets (window,
"mouse_x", &slider_x,
"mouse_y", &slider_y,
"lock_axis", &check_lockmouse,
"move_delay", &move_delay,
"smooth", &check_smooth,
"dither", &check_dither,
"label_font", &label_font,
"move_click2", &move_click2,
"draw_click2", &draw_click2,
"button_font", &button_font,
"button_lang", &button_lang,
"button_ok", &button_ok,
"button_save", &button_save, NULL)) {
if (!get_widgets(window,
"mouse_x", &slider_x,
"mouse_y", &slider_y,
"lock_axis", &check_lockmouse,
"smooth", &check_smooth,
"dither", &check_dither,
"move_click2", &move_click2,
"draw_click2", &draw_click2,
"button_ok", &button_ok, NULL)) {
jwidget_free (window);
return;
}
jslider_set_value (slider_x, x);
jslider_set_value (slider_y, y);
if (get_config_bool ("Options", "LockMouse", TRUE))
jwidget_select (check_lockmouse);
if (get_config_bool ("Options", "MoveClick2", FALSE))
jwidget_select (move_click2);
if (get_config_bool ("Options", "DrawClick2", FALSE))
jwidget_select (draw_click2);
jslider_set_value(slider_x, x);
jslider_set_value(slider_y, y);
if (get_config_bool("Options", "LockMouse", TRUE))
jwidget_select(check_lockmouse);
if (get_config_bool("Options", "MoveClick2", FALSE))
jwidget_select(move_click2);
if (get_config_bool("Options", "DrawClick2", FALSE))
jwidget_select(draw_click2);
jslider_set_value (move_delay,
get_config_int ("Options", "MoveDelay", 250));
if (get_config_bool("Options", "MoveSmooth", TRUE))
jwidget_select(check_smooth);
if (get_config_bool ("Options", "MoveSmooth", TRUE))
jwidget_select (check_smooth);
if (get_config_bool("Options", "Dither", FALSE))
jwidget_select(check_dither);
if (get_config_bool ("Options", "Dither", FALSE))
jwidget_select (check_dither);
HOOK(slider_x, JI_SIGNAL_SLIDER_CHANGE, slider_mouse_hook, NULL);
HOOK(slider_y, JI_SIGNAL_SLIDER_CHANGE, slider_mouse_hook, NULL);
default_font = jstrdup (get_config_string ("Options", "DefaultFont", ""));
set_label_font_text ();
jwindow_open_fg(window);
killer = jwindow_get_killer(window);
HOOK (slider_x, JI_SIGNAL_SLIDER_CHANGE, slider_mouse_hook, NULL);
HOOK (slider_y, JI_SIGNAL_SLIDER_CHANGE, slider_mouse_hook, NULL);
if (killer == button_ok) {
set_config_bool("Options", "LockMouse", jwidget_is_selected(check_lockmouse));
set_config_bool("Options", "MoveSmooth", jwidget_is_selected(check_smooth));
set_config_bool("Options", "MoveClick2", jwidget_is_selected(move_click2));
set_config_bool("Options", "DrawClick2", jwidget_is_selected(draw_click2));
jbutton_add_command (button_font, button_font_command);
jbutton_add_command (button_lang, button_lang_command);
jwindow_open_fg (window);
killer = jwindow_get_killer (window);
if (killer == button_ok || killer == button_save) {
set_config_bool ("Options", "LockMouse", jwidget_is_selected (check_lockmouse));
set_config_int ("Options", "MoveDelay", jslider_get_value (move_delay));
set_config_bool ("Options", "MoveSmooth", jwidget_is_selected (check_smooth));
set_config_bool ("Options", "MoveClick2", jwidget_is_selected (move_click2));
set_config_bool ("Options", "DrawClick2", jwidget_is_selected (draw_click2));
if (get_config_bool ("Options", "Dither", FALSE)
!= jwidget_is_selected (check_dither)) {
set_config_bool ("Options", "Dither", jwidget_is_selected (check_dither));
refresh_all_editors ();
if (get_config_bool("Options", "Dither", FALSE) != jwidget_is_selected(check_dither)) {
set_config_bool("Options", "Dither", jwidget_is_selected(check_dither));
refresh_all_editors();
}
/* save configuration */
if (killer == button_save)
flush_config_file ();
flush_config_file();
}
else {
/* restore mouse speed */
set_config_int ("Options", "MouseX", old_x);
set_config_int ("Options", "MouseY", old_y);
set_config_int("Options", "MouseX", old_x);
set_config_int("Options", "MouseY", old_y);
set_mouse_speed (8-old_x, 8-old_y);
/* restore default font */
set_config_string ("Options", "DefaultFont", default_font);
reload_default_font ();
set_mouse_speed(8-old_x, 8-old_y);
}
jwidget_free (window);
jfree (default_font);
jwidget_free(window);
}
static int slider_mouse_hook (JWidget widget, int user_data)
static int slider_mouse_hook(JWidget widget, int user_data)
{
int x, y;
@ -206,39 +148,6 @@ static int slider_mouse_hook (JWidget widget, int user_data)
return FALSE;
}
static void button_font_command (JWidget widget)
{
char *filename;
filename = GUI_FileSelect(_("Open Font (TTF or Allegro bitmap format)"),
get_config_string("Options", "DefaultFont", ""),
"pcx,bmp,tga,lbm,ttf");
if (filename) {
set_config_string ("Options", "DefaultFont", filename);
set_label_font_text ();
reload_default_font ();
jfree (filename);
}
}
static void button_lang_command(JWidget widget)
{
dialogs_select_language(TRUE);
}
static void set_label_font_text(void)
{
const char *default_font = get_config_string ("Options", "DefaultFont", "");
char buf[1024];
usprintf(buf, _("GUI Font: %s"),
*default_font ? get_filename (default_font): _("*Default*"));
jwidget_set_text(label_font, buf);
}
/**********************************************************************/
/* setup the mouse speed reading the configuration file */

View File

@ -199,27 +199,27 @@ static void do_quick (int action)
update_screen_for_sprite(sprite);
}
static int my_callback (void)
static int my_callback(void)
{
int ret = FALSE;
if (keypressed ()) {
int scancode = (readkey ()>>8);
if (keypressed()) {
int scancode = (readkey()>>8);
if (scancode == KEY_M) {
ret = TRUE;
/* switch mask status */
if (get_config_bool ("QuickMovement", "UseMask", TRUE))
set_config_bool ("QuickMovement", "UseMask", FALSE);
if (get_config_bool("QuickMovement", "UseMask", TRUE))
set_config_bool("QuickMovement", "UseMask", FALSE);
else
set_config_bool ("QuickMovement", "UseMask", TRUE);
set_config_bool("QuickMovement", "UseMask", TRUE);
/* set layer blend mode */
if (get_config_bool ("QuickMovement", "UseMask", TRUE))
layer_set_blend_mode (handle_layer, BLEND_MODE_NORMAL);
if (get_config_bool("QuickMovement", "UseMask", TRUE))
layer_set_blend_mode(handle_layer, BLEND_MODE_NORMAL);
else
layer_set_blend_mode (handle_layer, BLEND_MODE_COPY);
layer_set_blend_mode(handle_layer, BLEND_MODE_COPY);
}
}

View File

@ -62,11 +62,11 @@ void ji_show_repo_dlg (RepoDlg *repo_dlg)
jbutton_add_command_data (repo_dlg->button_add, add_command, repo_dlg);
jbutton_add_command_data (repo_dlg->button_delete, delete_command, repo_dlg);
jwidget_magnetic (repo_dlg->button_use, TRUE);
jwidget_magnetic(repo_dlg->button_use, TRUE);
jwidget_expansive (view, TRUE);
jview_attach (view, repo_dlg->listbox);
jwidget_set_static_size (view, JI_SCREEN_W*25/100, JI_SCREEN_H*25/100);
jwidget_expansive(view, TRUE);
jview_attach(view, repo_dlg->listbox);
jwidget_set_min_size(view, JI_SCREEN_W*25/100, JI_SCREEN_H*25/100);
/* fill the list */
fill_listbox (repo_dlg);

View File

@ -97,9 +97,9 @@ void dialogs_tips(bool forced)
tips = tips_new();
check = jcheck_new(_("Show me it in the start up"));
jwidget_set_static_size(button_close, 50, 0);
jwidget_set_static_size(button_prev, 50, 0);
jwidget_set_static_size(button_next, 50, 0);
jwidget_set_min_size(button_close, 50, 0);
jwidget_set_min_size(button_prev, 50, 0);
jwidget_set_min_size(button_next, 50, 0);
jbutton_add_command_data(button_prev, prev_command, tips);
jbutton_add_command_data(button_next, next_command, tips);
@ -124,15 +124,15 @@ void dialogs_tips(bool forced)
jwidget_add_child(window, vbox);
/* if (JI_SCREEN_W > 320) */
jwidget_set_static_size(window,
MIN(400, JI_SCREEN_W-32),
MIN(300, JI_SCREEN_H-16));
jwidget_set_min_size(window,
MIN(400, JI_SCREEN_W-32),
MIN(300, JI_SCREEN_H-16));
/* else */
/* jwidget_set_static_size(window, 282, 200); */
/* open the window */
jwindow_open(window);
jwidget_set_static_size(window, 0, 0);
jwidget_set_min_size(window, 0, 0);
/* load first page */
memcpy(old_pal, current_palette, sizeof (PALETTE));
@ -365,9 +365,9 @@ static JWidget tips_load_box(FILE *f, char *buf, int sizeof_buf, int *take)
/* add a box with an static size to separate paragraphs */
JWidget box = jbox_new (0);
jwidget_set_static_size (box, 0, text_height (box->text_font));
jwidget_set_min_size(box, 0, text_height(box->text_font));
jwidget_add_child (vbox, box);
jwidget_add_child(vbox, box);
}
/************************************************************/
/* special object (line start with \) */

View File

@ -403,7 +403,7 @@ static void combobox_open_window(JWidget widget)
jwidget_noborders(combobox->window);
size = jlist_length(combobox->items);
jwidget_set_static_size
jwidget_set_min_size
(view,
jrect_w(combobox->entry->rc),
2+(2+jwidget_get_text_height(listbox))*MID(1, size, 10)+2);

View File

@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "jinete/jinete.h"
@ -171,9 +172,14 @@ static JWidget convert_tag_to_widget(Tag *tag)
Attr *text = tag_get_attr(tag, "text");
if (maxsize && maxsize->value) {
Attr *readonly = tag_get_attr(tag, "readonly");
widget = jentry_new(strtol(maxsize->value, NULL, 10),
text && text->value ?
TRANSLATE_ATTR(text): "");
text && text->value ?
TRANSLATE_ATTR(text): "");
if (readonly)
jentry_readonly(widget, TRUE);
}
}
/* label */
@ -297,6 +303,10 @@ static JWidget convert_tag_to_widget(Tag *tag)
Attr *noborders = tag_get_attr(tag, "noborders");
Attr *width = tag_get_attr(tag, "width");
Attr *height = tag_get_attr(tag, "height");
Attr *minwidth = tag_get_attr(tag, "minwidth");
Attr *minheight = tag_get_attr(tag, "minheight");
Attr *maxwidth = tag_get_attr(tag, "maxwidth");
Attr *maxheight = tag_get_attr(tag, "maxheight");
JLink link;
if (name)
@ -311,10 +321,15 @@ static JWidget convert_tag_to_widget(Tag *tag)
if (noborders)
jwidget_noborders(widget);
if (width || height) {
int w = (width) ? strtol(width->value, NULL, 10): 0;
int h = (height) ? strtol(height->value, NULL, 10): 0;
jwidget_set_static_size(widget, w, h);
if (width || minwidth || maxwidth ||
height || minheight || maxheight) {
int w = (width || minwidth) ? strtol(width ? width->value: minwidth->value, NULL, 10): 0;
int h = (height || minheight) ? strtol(height ? height->value: minheight->value, NULL, 10): 0;
jwidget_set_min_size(widget, w, h);
w = (width || maxwidth) ? strtol(width ? width->value: maxwidth->value, NULL, 10): INT_MAX;
h = (height || maxheight) ? strtol(height ? height->value: maxheight->value, NULL, 10): INT_MAX;
jwidget_set_max_size(widget, w, h);
}
/* children */

View File

@ -214,7 +214,7 @@ char *ji_file_select_ex(const char *message,
jwidget_magnetic(button_select, TRUE);
/* setup window size */
jwidget_set_static_size(panel, JI_SCREEN_W*9/10, JI_SCREEN_H*3/5);
jwidget_set_min_size(panel, JI_SCREEN_W*9/10, JI_SCREEN_H*3/5);
jwindow_remap(window);
jwindow_center(window);
/* jwidget_set_static_size(panel, JI_SCREEN_W*9/10, JI_SCREEN_H*3/5); */

View File

@ -297,7 +297,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
else if (mouse_widget)
jmessage_broadcast_to_parents(msg, mouse_widget);
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
@ -312,7 +312,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
else if (mouse_widget)
jmessage_broadcast_to_parents(msg, mouse_widget);
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
@ -379,7 +379,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
}
}
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
@ -396,7 +396,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
if (mouse_widget)
jmessage_broadcast_to_parents(msg, mouse_widget);
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
@ -422,8 +422,8 @@ bool jmanager_poll(JWidget manager, bool all_windows)
jmessage_free(sub_msg);
}
jmanager_send_message (msg);
jmessage_free (msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
/* generate JM_KEYRELEASED messages */
@ -433,8 +433,8 @@ bool jmanager_poll(JWidget manager, bool all_windows)
msg = new_key_msg (JM_KEYRELEASED, (c << 8) | scancode_to_ascii (c));
old_readed_key[c] = key[c];
broadcast_key_msg (manager, msg);
jmanager_send_message (msg);
jmessage_free (msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
}
@ -445,7 +445,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
jmessage_broadcast_to_children (msg, window);
}
jmessage_add_dest(msg, manager);
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
/* process messages queue */
@ -489,7 +489,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
return ret;
}
void jmanager_send_message(const JMessage msg)
void jmanager_enqueue_message(const JMessage msg)
{
jlist_append(msg_queue, jmessage_new_copy(msg));
}
@ -556,7 +556,7 @@ void jmanager_set_focus(JWidget widget)
}
}
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
jlist_free(focus_parents);
}
@ -583,8 +583,8 @@ void jmanager_set_focus(JWidget widget)
}
}
jmanager_send_message (msg);
jmessage_free (msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
jlist_free(widget_parents);
@ -629,7 +629,7 @@ void jmanager_set_mouse(JWidget widget)
}
}
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
jlist_free(mouse_parents);
}
@ -651,7 +651,7 @@ void jmanager_set_mouse(JWidget widget)
jmessage_add_dest(msg, link->data);
}
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
}
@ -757,7 +757,7 @@ void _jmanager_open_window(JWidget manager, JWidget window)
/* broadcast the open message */
msg = jmessage_new(JM_OPEN);
jmessage_broadcast_to_children(msg, window);
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
/* update the new windows list to show */
@ -814,7 +814,7 @@ void _jmanager_close_window(JWidget manager, JWidget window,
/* close message */
msg = jmessage_new(JM_CLOSE);
jmessage_broadcast_to_children(msg, window);
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
jmanager_dispatch_messages(); /* TODO WARNING!!! */

View File

@ -46,7 +46,7 @@ bool jmanager_poll(JWidget manager, bool all_windows);
/* routines that uses the ji_get_default_manager() */
void jmanager_send_message(const JMessage msg);
void jmanager_enqueue_message(const JMessage msg);
void jmanager_dispatch_messages(void);
JWidget jmanager_get_focus(void);

View File

@ -110,21 +110,21 @@ void jview_attach(JWidget widget, JWidget viewable_widget)
/* jwidget_emit_signal(widget, JI_SIGNAL_VIEW_ATTACH); */
}
void jview_maxsize (JWidget widget)
void jview_maxsize(JWidget widget)
{
View *view = jwidget_get_data(widget, JI_VIEW);
int req_w, req_h;
viewport_needed_size(view->viewport, &req_w, &req_h);
widget->static_w =
widget->min_w =
+ widget->border_width.l
+ view->viewport->border_width.l
+ req_w
+ view->viewport->border_width.r
+ widget->border_width.r;
widget->static_h =
widget->min_h =
+ widget->border_width.t
+ view->viewport->border_width.t
+ req_h

View File

@ -32,6 +32,7 @@
/* #define REPORT_SIGNALS */
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#ifdef REPORT_SIGNALS
@ -70,8 +71,10 @@ JWidget jwidget_new(int type)
widget->child_spacing = 0;
widget->flags = 0;
widget->emit_signals = 0;
widget->static_w = 0;
widget->static_h = 0;
widget->min_w = 0;
widget->min_h = 0;
widget->max_w = INT_MAX;
widget->max_h = INT_MAX;
widget->children = jlist_new();
widget->parent = NULL;
widget->theme = ji_get_theme();
@ -679,8 +682,8 @@ void jwidget_request_size(JWidget widget, int *w, int *h)
{
JMessage msg = jmessage_new(JM_REQSIZE);
jwidget_send_message(widget, msg);
*w = MAX(msg->reqsize.w, widget->static_w);
*h = MAX(msg->reqsize.h, widget->static_h);
*w = MID(widget->min_w, msg->reqsize.w, widget->max_w);
*h = MID(widget->min_h, msg->reqsize.h, widget->max_h);
jmessage_free(msg);
}
@ -982,10 +985,16 @@ void jwidget_set_rect(JWidget widget, JRect rect)
jmessage_free (msg);
}
void jwidget_set_static_size(JWidget widget, int w, int h)
void jwidget_set_min_size(JWidget widget, int w, int h)
{
widget->static_w = w;
widget->static_h = h;
widget->min_w = w;
widget->min_h = h;
}
void jwidget_set_max_size(JWidget widget, int w, int h)
{
widget->max_w = w;
widget->max_h = h;
}
void jwidget_set_bg_color(JWidget widget, int color)
@ -1032,7 +1041,7 @@ void jwidget_flush_redraw(JWidget widget)
/* send the draw message */
msg->draw.count--;
msg->draw.rect = *rc;
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
}
jmessage_free(msg);
@ -1332,8 +1341,8 @@ static bool widget_msg_proc (JWidget widget, JMessage msg)
break;
case JM_REQSIZE:
msg->reqsize.w = widget->static_w;
msg->reqsize.h = widget->static_h;
msg->reqsize.w = widget->min_w;
msg->reqsize.h = widget->min_h;
return TRUE;
case JM_SETPOS: {
@ -1384,8 +1393,8 @@ static bool widget_msg_proc (JWidget widget, JMessage msg)
/* draw the widget */
for (it=region2->rects; it; it=it->next) {
msg2->draw.count--;
jrect_copy (&msg2->draw.rect, (JRect)it->data);
jmanager_send_message (msg2);
jrect_copy(&msg2->draw.rect, (JRect)it->data);
jmanager_enqueue_message(msg2);
}
jmessage_free (msg2);

View File

@ -55,8 +55,9 @@ struct jwidget
int flags;
int emit_signals; /* emit signal counter */
/* default widget size */
int static_w, static_h; /* static widget size */
/* widget size limits */
int min_w, min_h;
int max_w, max_h;
/* structures */
JList children; /* sub-objects */
@ -189,7 +190,8 @@ void jwidget_get_texticon_info(JWidget widget,
void jwidget_noborders(JWidget widget);
void jwidget_set_border(JWidget widget, int l, int t, int r, int b);
void jwidget_set_rect(JWidget widget, JRect rect);
void jwidget_set_static_size(JWidget widget, int w, int h);
void jwidget_set_min_size(JWidget widget, int w, int h);
void jwidget_set_max_size(JWidget widget, int w, int h);
void jwidget_set_bg_color(JWidget widget, int color);
void jwidget_set_theme(JWidget widget, JTheme theme);

View File

@ -622,7 +622,7 @@ static void move_window(JWidget widget, JRect rect, bool use_blit)
msg = jmessage_new(JM_WINMOVE);
jmessage_broadcast_to_children(msg, widget);
jmanager_send_message(msg);
jmanager_enqueue_message(msg);
jmessage_free(msg);
old_reg = jwidget_get_region (widget);

View File

@ -402,25 +402,25 @@ static void do_rect (BITMAP *bmp, int x1, int y1, int x2, int y2, int c,
}
}
static void count_rect (BITMAP *bmp, int x, int y, int c)
static void count_rect(BITMAP *bmp, int x, int y, int c)
{
RECT_DATA *data = (RECT_DATA *)c;
data->npixel++;
}
static void save_rect (BITMAP *bmp, int x, int y, int c)
static void save_rect(BITMAP *bmp, int x, int y, int c)
{
RECT_DATA *data = (RECT_DATA *)c;
data->pixel[data->npixel++] = getpixel (bmp, x, y);
data->pixel[data->npixel++] = getpixel(bmp, x, y);
}
static void restore_rect (BITMAP *bmp, int x, int y, int c)
static void restore_rect(BITMAP *bmp, int x, int y, int c)
{
RECT_DATA *data = (RECT_DATA *)c;
putpixel (bmp, x, y, data->pixel[data->npixel++]);
putpixel(bmp, x, y, data->pixel[data->npixel++]);
}
void *rectsave (BITMAP *bmp, int x1, int y1, int x2, int y2)
void *rectsave(BITMAP *bmp, int x1, int y1, int x2, int y2)
{
RECT_DATA *data;
int x, y;
@ -428,7 +428,7 @@ void *rectsave (BITMAP *bmp, int x1, int y1, int x2, int y2)
if (x1 > x2) { x = x1; x1 = x2; x2 = x; }
if (y1 > y2) { y = y1; y1 = y2; y2 = y; }
data = jnew (RECT_DATA, 1);
data = jnew(RECT_DATA, 1);
data->bmp = bmp;
data->x1 = x1;
@ -437,23 +437,23 @@ void *rectsave (BITMAP *bmp, int x1, int y1, int x2, int y2)
data->y2 = y2;
data->npixel = 0;
do_rect (bmp, x1, y1, x2, y2, (int)data, count_rect);
do_rect(bmp, x1, y1, x2, y2, (int)data, count_rect);
data->pixel = jmalloc (sizeof (int) * data->npixel);
data->pixel = jmalloc(sizeof(int) * data->npixel);
data->npixel = 0;
do_rect (bmp, x1, y1, x2, y2, (int)data, save_rect);
do_rect(bmp, x1, y1, x2, y2, (int)data, save_rect);
return data;
}
void rectrestore (void *_data)
void rectrestore(void *_data)
{
RECT_DATA *data = _data;
data->npixel = 0;
do_rect (data->bmp, data->x1, data->y1, data->x2, data->y2,
(int)data, restore_rect);
do_rect(data->bmp, data->x1, data->y1, data->x2, data->y2,
(int)data, restore_rect);
}
void rectdiscard (void *_data)
@ -461,8 +461,8 @@ void rectdiscard (void *_data)
RECT_DATA *data = _data;
if (data->pixel)
jfree (data->pixel);
jfree (data);
jfree(data->pixel);
jfree(data);
}

View File

@ -72,7 +72,7 @@ struct Image
unsigned char *dat; /* pixmap data */
unsigned char **line; /* start of each scanline */
struct ImageMethods *method;
/* struct BITMAP *bmp; */
// struct BITMAP *bmp;
};
typedef struct ImageMethods

View File

@ -263,8 +263,7 @@ Image *GetLayerImage(Layer *layer, int *x, int *y, int frame)
/* Gives to the user the possibility to move the sprite's layer in the
current editor, returns TRUE if the position was changed. */
int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
int interactive_move_layer(int mode, int use_undo, int (*callback)(void))
{
JWidget editor = current_editor;
Sprite *sprite = editor_get_sprite (editor);
@ -279,7 +278,6 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
int first_time = TRUE;
int begin_x;
int begin_y;
int delay;
if (!cel)
return FALSE;
@ -287,10 +285,6 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
begin_x = cel->x;
begin_y = cel->y;
delay = get_config_int ("Options", "MoveDelay", 250);
delay = MID (0, delay, 1000);
delay = JI_TICKS_PER_SEC * delay / 1000;
hide_drawing_cursor(editor);
jmouse_set_cursor(JI_CURSOR_MOVE);
@ -302,10 +296,7 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
cel->y = begin_y - start_y + new_y;
/* update layer-bounds */
jmouse_hide();
editor_update_layer_boundary(editor);
editor_draw_layer_boundary_safe(editor);
jmouse_show();
jwidget_dirty(editor);
/* update status bar */
status_bar_set_text
@ -315,8 +306,6 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
(int)cel->y,
(int)(cel->x - begin_x),
(int)(cel->y - begin_y));
jwidget_flush_redraw(app_get_status_bar());
jmanager_dispatch_messages();
/* update clock */
quiet_clock = ji_clock;
@ -324,19 +313,12 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
}
/* call the user's routine */
if (callback) {
if ((*callback)())
quiet_clock = delay;
}
if (callback)
(*callback)();
/* this control the redraw of the sprite when the cursor is quiet
for some time */
if ((quiet_clock >= 0) && (ji_clock-quiet_clock >= delay)) {
quiet_clock = -1;
jwidget_dirty(editor);
jwidget_flush_redraw(editor);
jmanager_dispatch_messages();
}
/* redraw dirty widgets */
jwidget_flush_redraw(ji_get_default_manager());
jmanager_dispatch_messages();
gui_feedback();
} while (editor_click(editor, &new_x, &new_y, &update, NULL));

View File

@ -27,6 +27,7 @@
#include "jinete/jmanager.h"
#include "jinete/jsystem.h"
#include "jinete/jview.h"
#include "jinete/jwidget.h"
#include "core/cfg.h"
#include "modules/gui.h"
@ -64,10 +65,13 @@ void editor_click_start(JWidget widget, int mode, int *x, int *y, int *b)
screen_to_editor(widget, click_start_x, click_start_y, x, y);
*b = click_start_b;
jwidget_capture_mouse(widget);
}
void editor_click_done(JWidget widget)
{
jwidget_release_mouse(widget);
clear_keybuf();
}
@ -138,8 +142,6 @@ int editor_click(JWidget widget, int *x, int *y, int *update,
scroll_x+click_last_x-jmouse_x(0),
scroll_y+click_last_y-jmouse_y(0), TRUE);
/* editor_refresh_region(widget); */
click_last_x = jmouse_x(0);
click_last_y = jmouse_y(0);

View File

@ -93,25 +93,25 @@ JWidget editor_view_new (void)
return widget;
}
JWidget editor_new (void)
JWidget editor_new(void)
{
JWidget widget = jwidget_new (editor_type ());
Editor *editor = jnew0 (Editor, 1);
JWidget widget = jwidget_new(editor_type());
Editor *editor = jnew0(Editor, 1);
editor->widget = widget;
editor->state = EDIT_STANDBY;
jwidget_add_hook (widget, editor_type (), editor_msg_proc, editor);
jwidget_focusrest (widget, TRUE);
jwidget_add_hook(widget, editor_type(), editor_msg_proc, editor);
jwidget_focusrest(widget, TRUE);
return widget;
}
int editor_type (void)
int editor_type(void)
{
static int type = 0;
if (!type)
type = ji_register_widget_type ();
type = ji_register_widget_type();
return type;
}
@ -127,7 +127,7 @@ Sprite *editor_get_sprite(JWidget widget)
void editor_set_sprite(JWidget widget, Sprite *sprite)
{
Editor *editor = editor_data (widget);
Editor *editor = editor_data(widget);
if (jwidget_has_mouse(widget))
jmanager_free_mouse();
@ -366,14 +366,14 @@ void editor_draw_sprite(JWidget widget, int x1, int y1, int x2, int y2)
/* draw the sprite */
if ((width > 0) && (height > 0)) {
Image *rendered;
rendered = render_sprite(editor->sprite,
source_x, source_y,
width, height,
editor->sprite->frame,
editor->zoom);
/* generate the rendered image */
Image *rendered = render_sprite(editor->sprite,
source_x, source_y,
width, height,
editor->sprite->frame,
editor->zoom);
/* dithering */
if (use_dither &&
rendered &&
rendered->imgtype == IMAGE_RGB &&
@ -646,63 +646,63 @@ void editor_draw_layer_boundary_safe(JWidget widget)
c<nrects;
c++, rc++) {
set_clip(ji_screen, rc->x1, rc->y1, rc->x2-1, rc->y2-1);
editor_draw_layer_boundary (widget);
editor_draw_layer_boundary(widget);
}
set_clip (ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1);
set_clip(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1);
jregion_free (region);
jregion_free(region);
}
void editor_update_layer_boundary(JWidget widget)
{
int x, y, x1, y1, x2, y2;
Sprite *sprite = editor_get_sprite (widget);
Image *image = GetImage2 (sprite, &x, &y, NULL);
Editor *editor = editor_data (widget);
Sprite *sprite = editor_get_sprite(widget);
Image *image = GetImage2(sprite, &x, &y, NULL);
Editor *editor = editor_data(widget);
if (editor->rect_data) {
rectrestore (editor->rect_data);
rectdiscard (editor->rect_data);
rectrestore(editor->rect_data);
rectdiscard(editor->rect_data);
editor->rect_data = NULL;
}
if (image) {
editor_to_screen (widget, x, y, &x1, &y1);
editor_to_screen (widget, x+image->w, y+image->h, &x2, &y2);
editor_to_screen(widget, x, y, &x1, &y1);
editor_to_screen(widget, x+image->w, y+image->h, &x2, &y2);
editor->rect_data = rectsave (ji_screen, x1-1, y1-1, x2, y2);
editor->rect_data = rectsave(ji_screen, x1-1, y1-1, x2, y2);
}
}
void editor_draw_path(JWidget widget, int draw_extras)
{
#if 0
Sprite *sprite = editor_get_sprite (widget);
Sprite *sprite = editor_get_sprite(widget);
if (sprite->path) {
GList *it;
PathNode *node;
int points[8], x1, y1, x2, y2;
JWidget color_bar = app_get_color_bar ();
int splines_color = get_color_for_allegro (bitmap_color_depth (ji_screen),
color_bar_get_color (color_bar, 0));
int extras_color = get_color_for_allegro (bitmap_color_depth (ji_screen),
color_bar_get_color (color_bar, 1));
JWidget color_bar = app_get_color_bar();
int splines_color = get_color_for_allegro(bitmap_color_depth(ji_screen),
color_bar_get_color(color_bar, 0));
int extras_color = get_color_for_allegro(bitmap_color_depth(ji_screen),
color_bar_get_color(color_bar, 1));
splines_color = makecol (255, 0, 0);
extras_color = makecol (0, 0, 255);
splines_color = makecol(255, 0, 0);
extras_color = makecol(0, 0, 255);
/* draw splines */
for (it=sprite->path->nodes; it; it=it->next) {
node = it->data;
if (node->n) {
editor_to_screen (widget, node->x, node->y, points+0, points+1);
editor_to_screen (widget, node->nx, node->ny, points+2, points+3);
editor_to_screen (widget, node->n->px, node->n->py, points+4, points+5);
editor_to_screen (widget, node->n->x, node->n->y, points+6, points+7);
editor_to_screen(widget, node->x, node->y, points+0, points+1);
editor_to_screen(widget, node->nx, node->ny, points+2, points+3);
editor_to_screen(widget, node->n->px, node->n->py, points+4, points+5);
editor_to_screen(widget, node->n->x, node->n->y, points+6, points+7);
spline (ji_screen, points, splines_color);
spline(ji_screen, points, splines_color);
}
}

View File

@ -99,7 +99,7 @@ JWidget status_bar_new(void)
ICON_NEW(status_bar->b_last, GFX_ANI_LAST, ACTION_LAST);
HOOK(status_bar->slider, JI_SIGNAL_SLIDER_CHANGE, slider_change_signal, 0);
jwidget_set_static_size(status_bar->slider, JI_SCREEN_W/5, 0);
jwidget_set_min_size(status_bar->slider, JI_SCREEN_W/5, 0);
jwidget_noborders(box1);
jwidget_noborders(box2);