mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 06:50:07 +00:00
Added command_execute_open_file.
Removed jmanager_dispatch_draw_messages. Fixed wheel behavior in the editor (only when the editor is in standby state). Replaced scare/unscare_mouse jmouse_hide/show. Renamed ji_mouse -> jmouse. Added command_execute_close_file
This commit is contained in:
parent
018e27058a
commit
670d468252
@ -135,6 +135,7 @@ THANKFULNESS
|
||||
Jorge Ramírez Flores
|
||||
Juraj Michalek
|
||||
Manuel De Miguel Moreno
|
||||
Manuel Quiñones
|
||||
Mateusz Czaplinski
|
||||
Nathan Smith (whitedoor)
|
||||
Peter Wang (tjaden)
|
||||
|
26
ChangeLog
26
ChangeLog
@ -1,9 +1,29 @@
|
||||
2007-09-26 David A. Capello <dacap@users.sourceforge.net>
|
||||
|
||||
* src/commands/cmd_open_file.c (command_execute_open_file):
|
||||
Added (based on openspr.lua).
|
||||
|
||||
* jinete/src/jmanager.c (jmanager_dispatch_draw_messages): Removed.
|
||||
(dispatch_msgs): Fixed for ji_screen != screen.
|
||||
|
||||
2007-09-25 David A. Capello <dacap@users.sourceforge.net>
|
||||
|
||||
* src/widgets/editor/editor.c (editor_msg_proc): Fixed wheel
|
||||
behavior (only when the editor is in standby state).
|
||||
|
||||
* jinete/src/jsystem.c (jmouse_hide, jmouse_show): Added (replaced
|
||||
scare/unscare_mouse by these functions). Renamed ji_mouse -> jmouse.
|
||||
|
||||
2007-09-23 David A. Capello <dacap@users.sourceforge.net>
|
||||
|
||||
* src/commands/cmd_new_sprite.c: Added (based on newspr.lua).
|
||||
* src/commands/cmd_close_file.c: Added (based on closespr.lua and
|
||||
sprite.lua).
|
||||
|
||||
* src/commands/cmd_exit.c (command_execute_exit): Added (based on
|
||||
exit.lua).
|
||||
* src/commands/cmd_about.c: Added (based on dialogs/about.c).
|
||||
|
||||
* src/commands/cmd_new_file.c: Added (based on newspr.lua).
|
||||
|
||||
* src/commands/cmd_exit.c: Added (based on exit.lua).
|
||||
|
||||
2007-09-21 David A. Capello <dacap@users.sourceforge.net>
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
-- ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
-- Copyright (C) 2001-2005 by David A. Capello
|
||||
|
||||
function GUI_CloseSprite()
|
||||
if not current_sprite then return end
|
||||
|
||||
-- see if the sprite has changes
|
||||
while sprite_is_modified(current_sprite) do
|
||||
-- ask what want to do the user with the changes in the sprite
|
||||
local ret = jalert(_("Warning")..
|
||||
"<<".._("Saving changes in:")..
|
||||
"<<"..get_filename(current_sprite.filename)..
|
||||
"||".._("&Save||&Discard||&Cancel"))
|
||||
|
||||
if ret == 1 then
|
||||
-- "save": save the changes
|
||||
GUI_SaveSprite() -- call this routine from savespr.lua
|
||||
elseif ret != 2 then
|
||||
-- "cancel" or <esc>
|
||||
return -- we back doing nothing
|
||||
else
|
||||
-- "discard"
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
CloseSprite()
|
||||
end
|
@ -1,113 +0,0 @@
|
||||
-- ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
-- Copyright (C) 2001-2005 by David A. Capello
|
||||
|
||||
local _sprite_counter = 0
|
||||
|
||||
function NewSprite(imgtype, w, h)
|
||||
-- new sprite
|
||||
local sprite = sprite_new_with_layer(imgtype, w, h)
|
||||
if not sprite then return nil end
|
||||
|
||||
sprite_mount(sprite)
|
||||
set_current_sprite(sprite)
|
||||
return sprite
|
||||
end
|
||||
|
||||
-- shows the "New Sprite" dialog
|
||||
function GUI_NewSprite()
|
||||
-- load the window widget
|
||||
local window = ji_load_widget("newspr.jid", "new_sprite")
|
||||
if not window then return end
|
||||
|
||||
local width = jwidget_find_name(window, "width")
|
||||
local height = jwidget_find_name(window, "height")
|
||||
local radio1 = jwidget_find_name(window, "radio1")
|
||||
local radio2 = jwidget_find_name(window, "radio2")
|
||||
local radio3 = jwidget_find_name(window, "radio3")
|
||||
local button_ok = jwidget_find_name(window, "ok_button")
|
||||
local bg_box = jwidget_find_name(window, "bg_box")
|
||||
local imgtype, w, h, bg
|
||||
|
||||
-- default values: Indexed, 320x200, Transparent
|
||||
imgtype = get_config_int("NewSprite", "Type", IMAGE_INDEXED)
|
||||
imgtype = MID(IMAGE_RGB, imgtype, IMAGE_INDEXED)
|
||||
w = get_config_int("NewSprite", "Width", 320)
|
||||
h = get_config_int("NewSprite", "Height", 200)
|
||||
bg = get_config_int("NewSprite", "Background", 0)
|
||||
|
||||
jwidget_set_text(width, w)
|
||||
jwidget_set_text(height, h)
|
||||
|
||||
-- select image-type
|
||||
if imgtype == IMAGE_RGB then
|
||||
jwidget_select(radio1)
|
||||
elseif imgtype == IMAGE_GRAYSCALE then
|
||||
jwidget_select(radio2)
|
||||
elseif imgtype == IMAGE_INDEXED then
|
||||
jwidget_select(radio3)
|
||||
end
|
||||
|
||||
-- select background color
|
||||
jlistbox_select_index(bg_box, bg)
|
||||
|
||||
-- open the window
|
||||
jwindow_open_fg(window)
|
||||
|
||||
if jwindow_get_killer(window) == button_ok then
|
||||
-- get the options
|
||||
if jwidget_is_selected(radio1) then
|
||||
imgtype = IMAGE_RGB
|
||||
elseif jwidget_is_selected(radio2) then
|
||||
imgtype = IMAGE_GRAYSCALE
|
||||
elseif jwidget_is_selected(radio3) then
|
||||
imgtype = IMAGE_INDEXED
|
||||
end
|
||||
|
||||
w = tonumber(jwidget_get_text(width))
|
||||
h = tonumber(jwidget_get_text(height))
|
||||
bg = jlistbox_get_selected_index(bg_box)
|
||||
|
||||
w = MID(1, w, 9999)
|
||||
h = MID(1, h, 9999)
|
||||
|
||||
-- select the color
|
||||
local color = nil
|
||||
|
||||
if bg >= 0 and bg <= 3 then
|
||||
local bg_table = {
|
||||
"mask",
|
||||
"rgb{0,0,0}",
|
||||
"rgb{255,255,255}",
|
||||
"rgb{255,0,255}" }
|
||||
color = bg_table[bg+1]
|
||||
else
|
||||
local default_color = get_config_string("NewSprite", "BackgroundCustom",
|
||||
"rgb{0,0,0}")
|
||||
|
||||
color = ji_color_select(imgtype, default_color)
|
||||
if color then
|
||||
set_config_string("NewSprite", "BackgroundCustom", color)
|
||||
end
|
||||
end
|
||||
|
||||
if color then
|
||||
-- save the configuration
|
||||
set_config_int("NewSprite", "Type", imgtype)
|
||||
set_config_int("NewSprite", "Width", w)
|
||||
set_config_int("NewSprite", "Height", h)
|
||||
set_config_int("NewSprite", "Background", bg)
|
||||
|
||||
-- create the new sprite
|
||||
local sprite = NewSprite(imgtype, w, h)
|
||||
|
||||
_sprite_counter = _sprite_counter + 1
|
||||
sprite_set_filename(sprite, "Sprite-" .. _sprite_counter)
|
||||
|
||||
image_clear(GetImage(), get_color_for_image(imgtype, color))
|
||||
|
||||
sprite_show(sprite)
|
||||
end
|
||||
end
|
||||
|
||||
jwidget_free(window)
|
||||
end
|
@ -1,22 +0,0 @@
|
||||
-- ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
-- Copyright (C) 2001-2005 by David A. Capello
|
||||
|
||||
function sprite_recent_load(filename)
|
||||
local sprite = sprite_load(filename)
|
||||
if sprite then
|
||||
recent_file(filename)
|
||||
sprite_mount(sprite)
|
||||
sprite_show(sprite)
|
||||
else
|
||||
unrecent_file(filename)
|
||||
end
|
||||
return sprite
|
||||
end
|
||||
|
||||
function GUI_OpenSprite()
|
||||
local filename = ji_file_select(_("Open Sprite"), "",
|
||||
get_readable_extensions())
|
||||
if filename then
|
||||
sprite_recent_load(filename)
|
||||
end
|
||||
end
|
@ -1,11 +0,0 @@
|
||||
-- ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
-- Copyright (C) 2001-2005 by David A. Capello
|
||||
|
||||
-- closes the current sprite
|
||||
function CloseSprite()
|
||||
local sprite = current_sprite
|
||||
if sprite then
|
||||
sprite_unmount(sprite)
|
||||
sprite_free(sprite)
|
||||
end
|
||||
end
|
@ -48,7 +48,6 @@ bool jmanager_poll(JWidget manager, bool all_windows);
|
||||
|
||||
void jmanager_send_message(const JMessage msg);
|
||||
void jmanager_dispatch_messages(void);
|
||||
void jmanager_dispatch_draw_messages(void);
|
||||
|
||||
JWidget jmanager_get_focus(void);
|
||||
JWidget jmanager_get_mouse(void);
|
||||
|
@ -88,23 +88,29 @@ enum {
|
||||
JI_CURSORS
|
||||
};
|
||||
|
||||
int ji_mouse_get_cursor(void);
|
||||
int ji_mouse_set_cursor(int type);
|
||||
void ji_mouse_draw_cursor();
|
||||
int jmouse_get_cursor(void);
|
||||
int jmouse_set_cursor(int type);
|
||||
void jmouse_draw_cursor();
|
||||
|
||||
bool ji_mouse_poll(void);
|
||||
void ji_mouse_set_position(int x, int y);
|
||||
void jmouse_hide();
|
||||
void jmouse_show();
|
||||
|
||||
int ji_mouse_b(int antique);
|
||||
int ji_mouse_x(int antique);
|
||||
int ji_mouse_y(int antique);
|
||||
int ji_mouse_z(int antique);
|
||||
bool jmouse_is_hidden();
|
||||
bool jmouse_is_shown();
|
||||
|
||||
bool ji_mouse_control_infinite_scroll(JRect rect);
|
||||
bool jmouse_poll(void);
|
||||
void jmouse_set_position(int x, int y);
|
||||
|
||||
int ji_mouse_get_click_button(void);
|
||||
int ji_mouse_get_click_level(void);
|
||||
void ji_mouse_set_click_level(int level);
|
||||
int jmouse_b(int antique);
|
||||
int jmouse_x(int antique);
|
||||
int jmouse_y(int antique);
|
||||
int jmouse_z(int antique);
|
||||
|
||||
bool jmouse_control_infinite_scroll(JRect rect);
|
||||
|
||||
int jmouse_get_click_button(void);
|
||||
int jmouse_get_click_level(void);
|
||||
void jmouse_set_click_level(int level);
|
||||
|
||||
JI_END_DECLS
|
||||
|
||||
|
@ -60,8 +60,8 @@ static JRect combobox_get_windowpos(ComboBox *combobox);
|
||||
|
||||
JWidget jcombobox_new (void)
|
||||
{
|
||||
JWidget widget = jbox_new (JI_HORIZONTAL);
|
||||
ComboBox *combobox = jnew (ComboBox, 1);
|
||||
JWidget widget = jbox_new(JI_HORIZONTAL);
|
||||
ComboBox *combobox = jnew(ComboBox, 1);
|
||||
|
||||
combobox->entry = jentry_new (256, "");
|
||||
combobox->button = jbutton_new ("^");
|
||||
@ -75,21 +75,21 @@ JWidget jcombobox_new (void)
|
||||
combobox->entry->user_data[0] = widget;
|
||||
combobox->button->user_data[0] = widget;
|
||||
|
||||
/* XXXX */
|
||||
/* widget->child_spacing = 0; */
|
||||
/* TODO this separation should be from the JTheme */
|
||||
widget->child_spacing = 0;
|
||||
|
||||
jwidget_focusrest (widget, TRUE);
|
||||
jwidget_add_hook (widget, JI_COMBOBOX, combobox_msg_proc, combobox);
|
||||
jwidget_add_hook (combobox->entry, JI_WIDGET, combobox_entry_msg_proc, NULL);
|
||||
jwidget_focusrest(widget, TRUE);
|
||||
jwidget_add_hook(widget, JI_COMBOBOX, combobox_msg_proc, combobox);
|
||||
jwidget_add_hook(combobox->entry, JI_WIDGET, combobox_entry_msg_proc, NULL);
|
||||
|
||||
jwidget_expansive (combobox->entry, TRUE);
|
||||
jbutton_set_bevel (combobox->button, 0, 2, 0, 2);
|
||||
jbutton_add_command_data (combobox->button, combobox_button_cmd, widget);
|
||||
jwidget_expansive(combobox->entry, TRUE);
|
||||
jbutton_set_bevel(combobox->button, 0, 2, 0, 2);
|
||||
jbutton_add_command_data(combobox->button, combobox_button_cmd, widget);
|
||||
|
||||
jwidget_add_child (widget, combobox->entry);
|
||||
jwidget_add_child (widget, combobox->button);
|
||||
jwidget_add_child(widget, combobox->entry);
|
||||
jwidget_add_child(widget, combobox->button);
|
||||
|
||||
jcombobox_editable (widget, combobox->editable);
|
||||
jcombobox_editable(widget, combobox->editable);
|
||||
|
||||
return widget;
|
||||
}
|
||||
@ -161,14 +161,14 @@ void jcombobox_del_string(JWidget widget, const char *string)
|
||||
jcombobox_del_index (widget, jcombobox_get_index (widget, string));
|
||||
}
|
||||
|
||||
void jcombobox_del_index (JWidget widget, int index)
|
||||
void jcombobox_del_index(JWidget widget, int index)
|
||||
{
|
||||
ComboBox *combobox = jwidget_get_data(widget, JI_COMBOBOX);
|
||||
|
||||
jlist_remove (combobox->items, jlist_nth_data (combobox->items, index));
|
||||
jlist_remove(combobox->items, jlist_nth_data (combobox->items, index));
|
||||
}
|
||||
|
||||
void jcombobox_select_index (JWidget widget, int index)
|
||||
void jcombobox_select_index(JWidget widget, int index)
|
||||
{
|
||||
ComboBox *combobox = jwidget_get_data (widget, JI_COMBOBOX);
|
||||
JLink link = jlist_nth_link (combobox->items, index);
|
||||
@ -273,7 +273,7 @@ static bool combobox_msg_proc(JWidget widget, JMessage msg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool combobox_entry_msg_proc (JWidget widget, JMessage msg)
|
||||
static bool combobox_entry_msg_proc(JWidget widget, JMessage msg)
|
||||
{
|
||||
switch (msg->type) {
|
||||
|
||||
@ -312,7 +312,7 @@ static bool combobox_entry_msg_proc (JWidget widget, JMessage msg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool combobox_listbox_msg_proc (JWidget widget, JMessage msg)
|
||||
static bool combobox_listbox_msg_proc(JWidget widget, JMessage msg)
|
||||
{
|
||||
switch (msg->type) {
|
||||
|
||||
@ -354,12 +354,12 @@ static bool combobox_listbox_msg_proc (JWidget widget, JMessage msg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void combobox_button_cmd (JWidget widget, void *data)
|
||||
static void combobox_button_cmd(JWidget widget, void *data)
|
||||
{
|
||||
combobox_switch_window ((JWidget)data);
|
||||
}
|
||||
|
||||
static void combobox_open_window (JWidget widget)
|
||||
static void combobox_open_window(JWidget widget)
|
||||
{
|
||||
ComboBox *combobox = jwidget_get_data (widget, JI_COMBOBOX);
|
||||
if (!combobox->window) {
|
||||
@ -405,35 +405,35 @@ static void combobox_open_window (JWidget widget)
|
||||
}
|
||||
}
|
||||
|
||||
static void combobox_close_window (JWidget widget)
|
||||
static void combobox_close_window(JWidget widget)
|
||||
{
|
||||
ComboBox *combobox = jwidget_get_data (widget, JI_COMBOBOX);
|
||||
ComboBox *combobox = jwidget_get_data(widget, JI_COMBOBOX);
|
||||
if (combobox->window) {
|
||||
jwindow_close (combobox->window, widget);
|
||||
combobox->window = NULL;
|
||||
|
||||
jmanager_set_focus (combobox->entry);
|
||||
jmanager_set_focus(combobox->entry);
|
||||
}
|
||||
}
|
||||
|
||||
static void combobox_switch_window (JWidget widget)
|
||||
static void combobox_switch_window(JWidget widget)
|
||||
{
|
||||
ComboBox *combobox = jwidget_get_data (widget, JI_COMBOBOX);
|
||||
ComboBox *combobox = jwidget_get_data(widget, JI_COMBOBOX);
|
||||
if (!combobox->window)
|
||||
combobox_open_window (widget);
|
||||
combobox_open_window(widget);
|
||||
else
|
||||
combobox_close_window (widget);
|
||||
combobox_close_window(widget);
|
||||
}
|
||||
|
||||
static JRect combobox_get_windowpos(ComboBox *combobox)
|
||||
{
|
||||
JRect rc = jrect_new(combobox->entry->rc->x1,
|
||||
combobox->entry->rc->y2,
|
||||
combobox->entry->rc->x2,
|
||||
combobox->entry->rc->y2+
|
||||
jrect_h(combobox->window->rc));
|
||||
combobox->entry->rc->y2,
|
||||
combobox->entry->rc->x2,
|
||||
combobox->entry->rc->y2+
|
||||
jrect_h(combobox->window->rc));
|
||||
if (rc->y2 > JI_SCREEN_H)
|
||||
jrect_displace (rc, 0, -(jrect_h(rc)+jrect_h(combobox->entry->rc)));
|
||||
jrect_displace(rc, 0, -(jrect_h(rc)+jrect_h(combobox->entry->rc)));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -239,10 +239,10 @@ static bool listbox_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
jview_set_scroll(view,
|
||||
scroll_x,
|
||||
scroll_y +
|
||||
(ji_mouse_z (1) - ji_mouse_z (0))
|
||||
*jwidget_get_text_height(widget)*3);
|
||||
scroll_x,
|
||||
scroll_y +
|
||||
(jmouse_z(1) - jmouse_z(0))
|
||||
*jwidget_get_text_height(widget)*3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ static void manager_request_size(JWidget widget, int *w, int *h);
|
||||
static void manager_set_position(JWidget widget, JRect rect);
|
||||
static void manager_redraw_region(JWidget widget, JRegion region);
|
||||
|
||||
static void dispatch_msgs(bool force_draw);
|
||||
static void dispatch_msgs(void);
|
||||
static void destroy_window(JWidget window);
|
||||
static void remove_msgs_for(JWidget widget, JMessage msg);
|
||||
static void generate_proc_windows_list(void);
|
||||
@ -163,7 +163,7 @@ void jmanager_free(JWidget widget)
|
||||
/* finish with main manager */
|
||||
if (default_manager == widget) {
|
||||
/* no more cursor */
|
||||
ji_mouse_set_cursor(JI_CURSOR_NULL);
|
||||
jmouse_set_cursor(JI_CURSOR_NULL);
|
||||
|
||||
/* XXX destroy the AUTODESTROY windows in these lists */
|
||||
jlist_free(new_windows);
|
||||
@ -219,7 +219,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
first_time_poll = FALSE;
|
||||
|
||||
jmanager_refresh_screen();
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
}
|
||||
|
||||
/* first check */
|
||||
@ -256,14 +256,14 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
generate_proc_windows_list();
|
||||
|
||||
/* update mouse status */
|
||||
mousemove = ji_mouse_poll();
|
||||
mousemove = jmouse_poll();
|
||||
|
||||
/* get the widget under the mouse */
|
||||
widget = NULL;
|
||||
|
||||
JI_LIST_FOR_EACH(proc_windows_list, link) {
|
||||
window = link->data;
|
||||
widget = jwidget_pick(window, ji_mouse_x(0), ji_mouse_y(0));
|
||||
widget = jwidget_pick(window, jmouse_x(0), jmouse_y(0));
|
||||
if (widget)
|
||||
break;
|
||||
}
|
||||
@ -282,7 +282,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
/* XXX rigid marshal */
|
||||
|
||||
/* reset double click status */
|
||||
ji_mouse_set_click_level(JI_CLICK_NOT);
|
||||
jmouse_set_click_level(JI_CLICK_NOT);
|
||||
|
||||
/* send the mouse movement message */
|
||||
if (capture_widget)
|
||||
@ -295,7 +295,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
}
|
||||
|
||||
/* mouse wheel */
|
||||
if (ji_mouse_z (0) != ji_mouse_z (1)) {
|
||||
if (jmouse_z(0) != jmouse_z(1)) {
|
||||
msg = new_mouse_msg(JM_WHEEL);
|
||||
/* XXX rigid marshal */
|
||||
|
||||
@ -310,16 +310,16 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
}
|
||||
|
||||
/* mouse clicks */
|
||||
if ((ji_mouse_b (0) != ji_mouse_b (1)) &&
|
||||
((!ji_mouse_b (0)) || (!ji_mouse_b (1)))) {
|
||||
if ((jmouse_b(0) != jmouse_b(1)) &&
|
||||
((!jmouse_b(0)) || (!jmouse_b(1)))) {
|
||||
/* press and release button messages */
|
||||
msg = new_mouse_msg((!ji_mouse_b (1))? JM_BUTTONPRESSED:
|
||||
JM_BUTTONRELEASED);
|
||||
msg = new_mouse_msg((!jmouse_b(1))? JM_BUTTONPRESSED:
|
||||
JM_BUTTONRELEASED);
|
||||
/* XXX rigid marshal */
|
||||
|
||||
if (msg->type == JM_BUTTONPRESSED)
|
||||
if (ji_mouse_get_click_level () == JI_CLICK_NOT)
|
||||
ji_mouse_set_click_level (JI_CLICK_START);
|
||||
if (jmouse_get_click_level() == JI_CLICK_NOT)
|
||||
jmouse_set_click_level(JI_CLICK_START);
|
||||
|
||||
if (capture_widget)
|
||||
jmessage_broadcast_to_parents (msg, capture_widget);
|
||||
@ -360,7 +360,7 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
jmessage_broadcast_to_parents(msg, mouse_widget);
|
||||
}
|
||||
else {
|
||||
ji_mouse_set_click_level(JI_CLICK_NOT);
|
||||
jmouse_set_click_level(JI_CLICK_NOT);
|
||||
|
||||
/* maybe someone want catch this lost click (menus use this to
|
||||
down to parents) */
|
||||
@ -377,11 +377,11 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
}
|
||||
|
||||
/* double clicks */
|
||||
if (ji_mouse_get_click_level () == JI_CLICK_AGAIN) {
|
||||
if (jmouse_get_click_level() == JI_CLICK_AGAIN) {
|
||||
msg = new_mouse_msg(JM_DOUBLECLICK);
|
||||
/* XXX rigid marshal */
|
||||
|
||||
ji_mouse_set_click_level(JI_CLICK_NOT);
|
||||
jmouse_set_click_level(JI_CLICK_NOT);
|
||||
|
||||
if (capture_widget)
|
||||
jmessage_broadcast_to_parents(msg, capture_widget);
|
||||
@ -489,12 +489,7 @@ void jmanager_send_message(const JMessage msg)
|
||||
|
||||
void jmanager_dispatch_messages(void)
|
||||
{
|
||||
dispatch_msgs(FALSE);
|
||||
}
|
||||
|
||||
void jmanager_dispatch_draw_messages(void)
|
||||
{
|
||||
dispatch_msgs(TRUE);
|
||||
dispatch_msgs();
|
||||
}
|
||||
|
||||
JWidget jmanager_get_focus(void)
|
||||
@ -724,14 +719,14 @@ void jmanager_free_capture(void)
|
||||
void jmanager_free_widget(JWidget widget)
|
||||
{
|
||||
/* break any relationship with the GUI manager */
|
||||
if (jwidget_has_capture (widget))
|
||||
jmanager_free_capture ();
|
||||
if (jwidget_has_capture(widget))
|
||||
jmanager_free_capture();
|
||||
|
||||
if (jwidget_has_mouse (widget))
|
||||
jmanager_free_mouse ();
|
||||
if (jwidget_has_mouse(widget))
|
||||
jmanager_free_mouse();
|
||||
|
||||
if (jwidget_has_focus (widget) || (widget == focus_widget))
|
||||
jmanager_free_focus ();
|
||||
if (jwidget_has_focus(widget) || (widget == focus_widget))
|
||||
jmanager_free_focus();
|
||||
}
|
||||
|
||||
void jmanager_remove_message(JMessage msg)
|
||||
@ -995,7 +990,7 @@ static void manager_redraw_region(JWidget widget, JRegion region)
|
||||
Internal routines
|
||||
**********************************************************************/
|
||||
|
||||
static void dispatch_msgs (bool force_draw)
|
||||
static void dispatch_msgs(void)
|
||||
{
|
||||
JMessage msg, first_msg;
|
||||
JLink link, link2, next;
|
||||
@ -1009,25 +1004,6 @@ static void dispatch_msgs (bool force_draw)
|
||||
while (link != msg_queue->end) {
|
||||
msg = link->data;
|
||||
|
||||
/* if ji_screen isn't the screen (maybe the user want to double
|
||||
buffered or something) */
|
||||
if (ji_screen != screen) {
|
||||
/* the force_draw is false, we must skip all "Draw" messages */
|
||||
if (!force_draw) {
|
||||
if (msg->type == JM_DRAW) {
|
||||
link = link->next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* the force_draw is TRUE, we must process only the "Draw" messages */
|
||||
else {
|
||||
if (msg->type != JM_DRAW) {
|
||||
link = link->next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LIMIT_DISPATCH_TIME
|
||||
if (ji_clock-t > JI_TICKS_PER_SEC/4)
|
||||
break;
|
||||
@ -1080,7 +1056,7 @@ static void dispatch_msgs (bool force_draw)
|
||||
msg->type <= JM_WHEEL) ? msg_name[msg->type]:
|
||||
"Unknown";
|
||||
|
||||
printf ("Event: %s (%d)\n", string, widget->id);
|
||||
printf("Event: %s (%d)\n", string, widget->id);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1090,7 +1066,7 @@ static void dispatch_msgs (bool force_draw)
|
||||
if (widget->flags & JI_HIDDEN)
|
||||
continue;
|
||||
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
acquire_bitmap(ji_screen);
|
||||
|
||||
/* set clip */
|
||||
@ -1114,7 +1090,7 @@ static void dispatch_msgs (bool force_draw)
|
||||
set_clip(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1);
|
||||
|
||||
release_bitmap(ji_screen);
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
}
|
||||
|
||||
if (done) /* XXX use marshal? */
|
||||
@ -1219,12 +1195,12 @@ static JMessage new_mouse_msg(int type)
|
||||
{
|
||||
JMessage msg = jmessage_new(type);
|
||||
|
||||
msg->mouse.x = ji_mouse_x(0);
|
||||
msg->mouse.y = ji_mouse_y(0);
|
||||
msg->mouse.x = jmouse_x(0);
|
||||
msg->mouse.y = jmouse_y(0);
|
||||
msg->mouse.flags =
|
||||
type == JM_DOUBLECLICK ? ji_mouse_get_click_button():
|
||||
type == JM_BUTTONRELEASED ? ji_mouse_b(1):
|
||||
ji_mouse_b(0);
|
||||
type == JM_DOUBLECLICK ? jmouse_get_click_button():
|
||||
type == JM_BUTTONRELEASED ? jmouse_b(1):
|
||||
jmouse_b(0);
|
||||
msg->mouse.left = msg->mouse.flags & 1 ? TRUE: FALSE;
|
||||
msg->mouse.right = msg->mouse.flags & 2 ? TRUE: FALSE;
|
||||
msg->mouse.middle = msg->mouse.flags & 4 ? TRUE: FALSE;
|
||||
|
@ -41,13 +41,13 @@
|
||||
#define DO_GOTODEST 2
|
||||
|
||||
#define MOUSE_IN(pos) \
|
||||
((ji_mouse_x(0) >= pos->x1) && (ji_mouse_x(0) < pos->x2) && \
|
||||
(ji_mouse_y(0) >= pos->y1) && (ji_mouse_y(0) < pos->y2))
|
||||
((jmouse_x(0) >= pos->x1) && (jmouse_x(0) < pos->x2) && \
|
||||
(jmouse_y(0) >= pos->y1) && (jmouse_y(0) < pos->y2))
|
||||
|
||||
#define MBOX(widget) \
|
||||
#define MBOX(widget) \
|
||||
((MenuBox *)jwidget_get_data(((JWidget)widget), JI_MENUBOX))
|
||||
|
||||
#define MITEM(widget) \
|
||||
#define MITEM(widget) \
|
||||
((MenuItem *)jwidget_get_data(((JWidget)widget), JI_MENUITEM))
|
||||
|
||||
/* JWidget *menuitem */
|
||||
@ -56,7 +56,7 @@
|
||||
(!jlist_empty(MITEM(menuitem)->submenu->children)))
|
||||
|
||||
/* MenuBox *menubox_data */
|
||||
#define HAS_MENU(menubox_data) \
|
||||
#define HAS_MENU(menubox_data) \
|
||||
((menubox_data->menu) && (!jlist_empty(menubox_data->menu->children)))
|
||||
|
||||
typedef struct MenuBox
|
||||
@ -227,8 +227,8 @@ void jmenu_popup(JWidget menu, int x, int y)
|
||||
JWidget window, menubox;
|
||||
|
||||
do {
|
||||
ji_mouse_poll();
|
||||
} while (ji_mouse_b(0));
|
||||
jmouse_poll();
|
||||
} while (jmouse_b(0));
|
||||
|
||||
was_clicked = TRUE;
|
||||
current_level = 1;
|
||||
@ -715,7 +715,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
||||
/* mouse outside the box? */
|
||||
if (!MOUSE_IN (widget->rc)) {
|
||||
/* control button press outside the menubox */
|
||||
if (ji_mouse_b (0) || was_clicked) {
|
||||
if (jmouse_b(0) || was_clicked) {
|
||||
JWidget picked_menubox = widget;
|
||||
JWidget open_menubox = NULL;
|
||||
JWidget picked = pick_menuitem (&picked_menubox, &open_menubox);
|
||||
@ -750,7 +750,7 @@ static bool menubox_msg_proc(JWidget widget, JMessage msg)
|
||||
}
|
||||
|
||||
/* control button-released outside menubox */
|
||||
if ((!ji_mouse_b (0)) && (ji_mouse_b (1))) {
|
||||
if ((!jmouse_b(0)) && (jmouse_b(1))) {
|
||||
JWidget picked =
|
||||
jwidget_pick
|
||||
(menubox->parent_menuitem ?
|
||||
@ -1123,7 +1123,7 @@ static JWidget pick_menuitem(JWidget *_menubox, JWidget *open_menubox)
|
||||
if (MOUSE_IN(menubox->rc)) {
|
||||
*_menubox = menubox;
|
||||
picked = jwidget_pick(MBOX(menubox)->menu,
|
||||
ji_mouse_x(0), ji_mouse_y(0));
|
||||
jmouse_x(0), jmouse_y(0));
|
||||
if (picked->type != JI_MENUITEM)
|
||||
picked = NULL;
|
||||
break;
|
||||
|
@ -144,15 +144,15 @@ static bool panel_msg_proc(JWidget widget, JMessage msg)
|
||||
Panel *panel = jwidget_get_data(widget, JI_PANEL);
|
||||
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (ji_mouse_get_cursor() != JI_CURSOR_SIZE_L)
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_L);
|
||||
if (jmouse_get_cursor() != JI_CURSOR_SIZE_L)
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_L);
|
||||
|
||||
panel->pos =
|
||||
100.0 * (msg->mouse.x-widget->rc->x1) / jrect_w(widget->rc);
|
||||
}
|
||||
else {
|
||||
if (ji_mouse_get_cursor() != JI_CURSOR_SIZE_T)
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_T);
|
||||
if (jmouse_get_cursor() != JI_CURSOR_SIZE_T)
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_T);
|
||||
|
||||
panel->pos =
|
||||
100.0 * (msg->mouse.y-widget->rc->y1) / jrect_h(widget->rc);
|
||||
@ -199,18 +199,18 @@ static bool panel_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
if (change_cursor) {
|
||||
if (widget->align & JI_HORIZONTAL) {
|
||||
if (ji_mouse_get_cursor() != JI_CURSOR_SIZE_L)
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_L);
|
||||
if (jmouse_get_cursor() != JI_CURSOR_SIZE_L)
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_L);
|
||||
}
|
||||
else {
|
||||
if (ji_mouse_get_cursor() != JI_CURSOR_SIZE_T)
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_T);
|
||||
if (jmouse_get_cursor() != JI_CURSOR_SIZE_T)
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_T);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
if (ji_mouse_get_cursor() != JI_CURSOR_NORMAL)
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
if (jmouse_get_cursor() != JI_CURSOR_NORMAL)
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -218,7 +218,7 @@ static bool panel_msg_proc(JWidget widget, JMessage msg)
|
||||
case JM_BUTTONRELEASED:
|
||||
if (jwidget_has_capture(widget)) {
|
||||
jwidget_release_mouse(widget);
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -137,9 +137,9 @@ static bool slider_msg_proc (JWidget widget, JMessage msg)
|
||||
slider_press_left = msg->mouse.left;
|
||||
|
||||
if (slider_press_left)
|
||||
ji_mouse_set_cursor (JI_CURSOR_HAND);
|
||||
jmouse_set_cursor(JI_CURSOR_HAND);
|
||||
else
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
|
||||
case JM_MOTION:
|
||||
if (jwidget_has_capture (widget)) {
|
||||
@ -172,8 +172,8 @@ static bool slider_msg_proc (JWidget widget, JMessage msg)
|
||||
|
||||
/* for right click */
|
||||
if ((!slider_press_left) &&
|
||||
(ji_mouse_control_infinite_scroll (rect))) {
|
||||
slider_press_x = ji_mouse_x (0);
|
||||
(jmouse_control_infinite_scroll(rect))) {
|
||||
slider_press_x = jmouse_x(0);
|
||||
slider_press_value = slider->value;
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ static bool slider_msg_proc (JWidget widget, JMessage msg)
|
||||
jwidget_deselect (widget);
|
||||
jwidget_release_mouse (widget);
|
||||
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -237,7 +237,7 @@ static bool slider_msg_proc (JWidget widget, JMessage msg)
|
||||
|
||||
case JM_WHEEL:
|
||||
if (jwidget_is_enabled(widget)) {
|
||||
int value = slider->value + ji_mouse_z(0) - ji_mouse_z(1);
|
||||
int value = slider->value + jmouse_z(0) - jmouse_z(1);
|
||||
|
||||
value = MID(slider->min, value, slider->max);
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <allegro.h>
|
||||
|
||||
#include "jinete/intern.h"
|
||||
@ -65,6 +66,7 @@ static int m_y[2];
|
||||
static int m_z[2];
|
||||
|
||||
static bool moved;
|
||||
static int mouse_scares = 0;
|
||||
|
||||
/* For double click management. */
|
||||
|
||||
@ -162,7 +164,7 @@ int _ji_system_init(void)
|
||||
(install_int(check_click, 20) < 0))
|
||||
return -1;
|
||||
|
||||
ji_mouse_poll();
|
||||
jmouse_poll();
|
||||
|
||||
moved = TRUE;
|
||||
m_cursor = JI_CURSOR_NULL;
|
||||
@ -180,9 +182,9 @@ void _ji_system_exit(void)
|
||||
|
||||
void ji_set_screen(BITMAP *bmp)
|
||||
{
|
||||
int cursor = ji_mouse_get_cursor(); /* get mouse cursor */
|
||||
int cursor = jmouse_get_cursor(); /* get mouse cursor */
|
||||
|
||||
ji_mouse_set_cursor(JI_CURSOR_NULL);
|
||||
jmouse_set_cursor(JI_CURSOR_NULL);
|
||||
ji_screen = bmp;
|
||||
|
||||
if (ji_screen) {
|
||||
@ -196,7 +198,7 @@ void ji_set_screen(BITMAP *bmp)
|
||||
jrect_free(rect);
|
||||
}
|
||||
|
||||
ji_mouse_set_cursor(cursor); /* restore mouse cursor */
|
||||
jmouse_set_cursor(cursor); /* restore mouse cursor */
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,16 +215,15 @@ const char *ji_translate_string(const char *msgid)
|
||||
return msgid;
|
||||
}
|
||||
|
||||
int ji_mouse_get_cursor(void)
|
||||
int jmouse_get_cursor(void)
|
||||
{
|
||||
return m_cursor;
|
||||
}
|
||||
|
||||
int ji_mouse_set_cursor(int type)
|
||||
int jmouse_set_cursor(int type)
|
||||
{
|
||||
JTheme theme = ji_get_theme();
|
||||
int old = m_cursor;
|
||||
|
||||
m_cursor = type;
|
||||
|
||||
if (m_cursor == JI_CURSOR_NULL) {
|
||||
@ -231,14 +232,16 @@ int ji_mouse_set_cursor(int type)
|
||||
}
|
||||
else {
|
||||
show_mouse(NULL);
|
||||
|
||||
if (theme->set_cursor) {
|
||||
BITMAP *sprite;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
sprite = (*theme->set_cursor)(m_cursor, &x, &y);
|
||||
sprite = (*theme->set_cursor)(type, &x, &y);
|
||||
set_cursor(sprite, x, y);
|
||||
}
|
||||
|
||||
if (ji_screen == screen)
|
||||
show_mouse(ji_screen);
|
||||
}
|
||||
@ -250,9 +253,9 @@ int ji_mouse_set_cursor(int type)
|
||||
* Use this routine if your "ji_screen" isn't Allegro's "screen" so
|
||||
* you must to draw the cursor by your self using this routine.
|
||||
*/
|
||||
void ji_mouse_draw_cursor()
|
||||
void jmouse_draw_cursor()
|
||||
{
|
||||
if (sprite_cursor != NULL) {
|
||||
if (sprite_cursor != NULL && mouse_scares == 0) {
|
||||
int x = m_x[0]-focus_x;
|
||||
int y = m_y[0]-focus_y;
|
||||
JRect rect = jrect_new(x, y,
|
||||
@ -260,15 +263,44 @@ void ji_mouse_draw_cursor()
|
||||
y+sprite_cursor->h);
|
||||
|
||||
jwidget_invalidate_rect(ji_get_default_manager(), rect);
|
||||
/* rectfill(ji_screen, rect->x1, rect->y1, rect->x2-1, rect->y2-1, makecol(0, 0, 255)); */
|
||||
draw_sprite(ji_screen, sprite_cursor, x, y);
|
||||
|
||||
jrect_free(rect);
|
||||
}
|
||||
}
|
||||
|
||||
void jmouse_hide()
|
||||
{
|
||||
assert(mouse_scares >= 0);
|
||||
if (ji_screen == screen)
|
||||
scare_mouse();
|
||||
mouse_scares++;
|
||||
}
|
||||
|
||||
void jmouse_show()
|
||||
{
|
||||
assert(mouse_scares > 0);
|
||||
mouse_scares--;
|
||||
if (ji_screen == screen)
|
||||
unscare_mouse();
|
||||
}
|
||||
|
||||
bool jmouse_is_hidden()
|
||||
{
|
||||
assert(mouse_scares >= 0);
|
||||
return mouse_scares > 0;
|
||||
}
|
||||
|
||||
bool jmouse_is_shown()
|
||||
{
|
||||
assert(mouse_scares >= 0);
|
||||
return mouse_scares == 0;
|
||||
}
|
||||
|
||||
/* Returns TRUE if the mouse moved. */
|
||||
|
||||
bool ji_mouse_poll(void)
|
||||
bool jmouse_poll(void)
|
||||
{
|
||||
m_b[1] = m_b[0];
|
||||
m_x[1] = m_x[0];
|
||||
@ -310,7 +342,7 @@ bool ji_mouse_poll(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void ji_mouse_set_position(int x, int y)
|
||||
void jmouse_set_position(int x, int y)
|
||||
{
|
||||
moved = TRUE;
|
||||
|
||||
@ -326,17 +358,17 @@ void ji_mouse_set_position(int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
int ji_mouse_x(int antique) { return m_x[antique & 1]; }
|
||||
int ji_mouse_y(int antique) { return m_y[antique & 1]; }
|
||||
int ji_mouse_z(int antique) { return m_z[antique & 1]; }
|
||||
int ji_mouse_b(int antique) { return m_b[antique & 1]; }
|
||||
int jmouse_x(int antique) { return m_x[antique & 1]; }
|
||||
int jmouse_y(int antique) { return m_y[antique & 1]; }
|
||||
int jmouse_z(int antique) { return m_z[antique & 1]; }
|
||||
int jmouse_b(int antique) { return m_b[antique & 1]; }
|
||||
|
||||
bool ji_mouse_control_infinite_scroll(JRect rect)
|
||||
bool jmouse_control_infinite_scroll(JRect rect)
|
||||
{
|
||||
int x, y, u, v;
|
||||
|
||||
u = ji_mouse_x(0);
|
||||
v = ji_mouse_y(0);
|
||||
u = jmouse_x(0);
|
||||
v = jmouse_y(0);
|
||||
|
||||
if (u <= rect->x1)
|
||||
x = rect->x2-2;
|
||||
@ -353,24 +385,24 @@ bool ji_mouse_control_infinite_scroll(JRect rect)
|
||||
y = v;
|
||||
|
||||
if ((x != u) || (y != v)) {
|
||||
ji_mouse_set_position(x, y);
|
||||
jmouse_set_position(x, y);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int ji_mouse_get_click_button(void)
|
||||
int jmouse_get_click_button(void)
|
||||
{
|
||||
return click_mouse_b;
|
||||
}
|
||||
|
||||
int ji_mouse_get_click_level(void)
|
||||
int jmouse_get_click_level(void)
|
||||
{
|
||||
return click_level;
|
||||
}
|
||||
|
||||
void ji_mouse_set_click_level(int level)
|
||||
void jmouse_set_click_level(int level)
|
||||
{
|
||||
click_level = level;
|
||||
if (level == JI_CLICK_START) {
|
||||
|
@ -136,7 +136,7 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
if (view) {
|
||||
jwidget_hard_capture_mouse(widget);
|
||||
ji_mouse_set_cursor(JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
@ -150,10 +150,10 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
jview_set_scroll(view,
|
||||
scroll_x + ji_mouse_x(1) - ji_mouse_x(0),
|
||||
scroll_y + ji_mouse_y(1) - ji_mouse_y(0));
|
||||
scroll_x + jmouse_x(1) - jmouse_x(0),
|
||||
scroll_y + jmouse_y(1) - jmouse_y(0));
|
||||
|
||||
ji_mouse_control_infinite_scroll(vp);
|
||||
jmouse_control_infinite_scroll(vp);
|
||||
jrect_free(vp);
|
||||
}
|
||||
break;
|
||||
@ -163,7 +163,7 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
if (view && jwidget_has_capture(widget)) {
|
||||
jwidget_release_mouse(widget);
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
@ -178,7 +178,7 @@ static bool textbox_msg_proc(JWidget widget, JMessage msg)
|
||||
jview_set_scroll(view,
|
||||
scroll_x,
|
||||
scroll_y +
|
||||
(ji_mouse_z(1) - ji_mouse_z(0))
|
||||
(jmouse_z(1) - jmouse_z(0))
|
||||
*jwidget_get_text_height(widget)*3);
|
||||
}
|
||||
break;
|
||||
|
@ -163,14 +163,18 @@ void ji_regen_theme(void)
|
||||
{
|
||||
if (ji_current_theme) {
|
||||
/* hide the cursor */
|
||||
show_mouse(NULL);
|
||||
set_mouse_sprite(NULL);
|
||||
/* if () { */
|
||||
/* show_mouse(NULL); */
|
||||
/* set_mouse_sprite(NULL); */
|
||||
/* } */
|
||||
int type = jmouse_get_cursor();
|
||||
jmouse_set_cursor(JI_CURSOR_NULL);
|
||||
|
||||
if (ji_current_theme->regen)
|
||||
(*ji_current_theme->regen)();
|
||||
|
||||
/* ok, reset the mouse cursor */
|
||||
ji_mouse_set_cursor(ji_mouse_get_cursor());
|
||||
jmouse_set_cursor(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1102,9 +1102,9 @@ void jwidget_scroll(JWidget widget, int dx, int dy, const JRect rect,
|
||||
jregion_translate(reg1, -dx, -dy);
|
||||
jregion_intersect(reg2, reg2, reg1);
|
||||
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
ji_blit_region(reg2, dx, dy);
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
|
||||
if (!update_region) {
|
||||
jregion_union(widget->update_region, widget->update_region, reg1);
|
||||
|
@ -341,7 +341,7 @@ static bool window_msg_proc (JWidget widget, JMessage msg)
|
||||
case JM_BUTTONRELEASED:
|
||||
if (jwidget_has_capture (widget)) {
|
||||
jwidget_release_mouse (widget);
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
|
||||
window_action = WINDOW_NONE;
|
||||
return TRUE;
|
||||
@ -600,8 +600,8 @@ static int setup_cursor (JWidget widget, int x, int y)
|
||||
cursor = JI_CURSOR_SIZE_B;
|
||||
}
|
||||
|
||||
if (ji_mouse_get_cursor () != cursor)
|
||||
ji_mouse_set_cursor (cursor);
|
||||
if (jmouse_get_cursor() != cursor)
|
||||
jmouse_set_cursor(cursor);
|
||||
|
||||
jrect_free (pos);
|
||||
jrect_free (cpos);
|
||||
@ -699,7 +699,7 @@ static void move_window(JWidget widget, JRect rect, bool use_blit)
|
||||
/* jregion_union(manager_refresh_region, manager_refresh_region, reg1); */
|
||||
|
||||
/* move the window's graphics */
|
||||
scare_mouse ();
|
||||
jmouse_hide();
|
||||
set_clip(ji_screen,
|
||||
man_pos->x1, man_pos->y1, man_pos->x2-1, man_pos->y2-1);
|
||||
/* blit (ji_screen, ji_screen, */
|
||||
@ -713,7 +713,7 @@ static void move_window(JWidget widget, JRect rect, bool use_blit)
|
||||
widget->rc->x1 - old_pos->x1,
|
||||
widget->rc->y1 - old_pos->y1);
|
||||
set_clip(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1);
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
|
||||
jregion_free(reg1);
|
||||
jregion_free(reg2);
|
||||
|
@ -309,22 +309,22 @@ static void theme_init_widget(JWidget widget)
|
||||
case JI_MENU:
|
||||
case JI_MENUBAR:
|
||||
case JI_MENUBOX:
|
||||
BORDER (0);
|
||||
BORDER(0);
|
||||
widget->child_spacing = 0;
|
||||
break;
|
||||
|
||||
case JI_MENUITEM:
|
||||
BORDER (2);
|
||||
BORDER(2);
|
||||
widget->child_spacing = 18;
|
||||
break;
|
||||
|
||||
case JI_PANEL:
|
||||
BORDER (0);
|
||||
BORDER(0);
|
||||
widget->child_spacing = 3;
|
||||
break;
|
||||
|
||||
case JI_RADIO:
|
||||
BORDER (2);
|
||||
BORDER(2);
|
||||
/* widget->child_spacing = 2; */
|
||||
widget->child_spacing = 4;
|
||||
break;
|
||||
@ -353,17 +353,17 @@ static void theme_init_widget(JWidget widget)
|
||||
break;
|
||||
|
||||
case JI_SLIDER:
|
||||
BORDER (4);
|
||||
BORDER(4);
|
||||
widget->child_spacing = jwidget_get_text_height (widget);
|
||||
break;
|
||||
|
||||
case JI_TEXTBOX:
|
||||
BORDER (2);
|
||||
BORDER(2);
|
||||
widget->child_spacing = 0;
|
||||
break;
|
||||
|
||||
case JI_VIEW:
|
||||
BORDER (2);
|
||||
BORDER(2);
|
||||
widget->child_spacing = 0;
|
||||
break;
|
||||
|
||||
@ -373,15 +373,14 @@ static void theme_init_widget(JWidget widget)
|
||||
break;
|
||||
|
||||
case JI_VIEW_VIEWPORT:
|
||||
BORDER (0);
|
||||
BORDER(0);
|
||||
widget->child_spacing = 0;
|
||||
break;
|
||||
|
||||
case JI_WINDOW:
|
||||
if (!jwindow_is_desktop (widget)) {
|
||||
if (widget->text) {
|
||||
/* BORDER4(4, 4+jwidget_get_text_height(widget)+4, 4, 4); */
|
||||
BORDER4(6, 4+jwidget_get_text_height(widget)+4, 6, 6);
|
||||
BORDER4(6, 4+jwidget_get_text_height(widget)+6, 6, 6);
|
||||
#if 1 /* add close button */
|
||||
if (!(widget->flags & JI_INITIALIZED)) {
|
||||
JWidget button = jbutton_new("x");
|
||||
@ -395,13 +394,12 @@ static void theme_init_widget(JWidget widget)
|
||||
#endif
|
||||
}
|
||||
else if (!(widget->flags & JI_INITIALIZED)) {
|
||||
BORDER (3);
|
||||
BORDER(3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BORDER (0);
|
||||
}
|
||||
/* widget->child_spacing = 2; */
|
||||
widget->child_spacing = 4;
|
||||
break;
|
||||
|
||||
@ -1355,7 +1353,8 @@ static void theme_draw_window(JWidget widget)
|
||||
int bg = makecol(44, 76, 145);
|
||||
|
||||
jrect_shrink(pos, 1);
|
||||
pos->y2 = cpos->y1-1;
|
||||
/* pos->y2 = cpos->y1-1; */
|
||||
pos->y2 = cpos->y1-3;
|
||||
jdraw_rectfill(pos, bg);
|
||||
|
||||
jrect_stretch(pos, 1);
|
||||
|
13
makefile.mgw
13
makefile.mgw
@ -15,13 +15,12 @@ endif
|
||||
# Flags for MinGW
|
||||
|
||||
CFLAGS =
|
||||
# LFLAGS = -Wl,--subsystem,windows
|
||||
LFLAGS = -mconsole
|
||||
# LFLAGS = -mwindows
|
||||
#LFLAGS_LAST = -lalleg -lmoldname-msvc
|
||||
# LFLAGS_LAST = -lalleg -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lcomctl32 -lsecur32 -lmsimg32
|
||||
# LFLAGS_LAST = -lalleg
|
||||
LFLAGS_LAST = -lalld
|
||||
LFLAGS = -mwindows
|
||||
ifdef DEBUGMODE
|
||||
LFLAGS_LAST = -lalld
|
||||
else
|
||||
LFLAGS_LAST = -lalleg
|
||||
endif
|
||||
WITHICON = 1
|
||||
|
||||
######################################################################
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2007 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,14 +20,14 @@
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include "jinete.h"
|
||||
|
||||
#include "core/app.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
#endif
|
||||
|
||||
void command_execute_advanced_mode(const char *argument)
|
||||
{
|
||||
app_switch(app_get_tool_bar());
|
||||
app_switch(app_get_menu_bar());
|
||||
app_switch(app_get_status_bar());
|
||||
app_switch(app_get_color_bar());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2007 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,14 +20,49 @@
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include <allegro.h>
|
||||
#include "jinete.h"
|
||||
|
||||
#include "commands/commands.h"
|
||||
#include "core/app.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
#endif
|
||||
|
||||
bool command_enabled_close_file(const char *argument)
|
||||
{
|
||||
return current_sprite != NULL;
|
||||
}
|
||||
|
||||
void command_execute_close_file(const char *argument)
|
||||
{
|
||||
Sprite *sprite = current_sprite;
|
||||
|
||||
/* see if the sprite has changes */
|
||||
while (sprite_is_modified(sprite)) {
|
||||
/* ask what want to do the user with the changes in the sprite */
|
||||
int ret = jalert("%s<<%s<<%s||%s",
|
||||
_("Warning"),
|
||||
_("Saving changes in:"),
|
||||
get_filename(sprite->filename),
|
||||
_("&Save||&Discard||&Cancel"));
|
||||
|
||||
if (ret == 1) {
|
||||
/* "save": save the changes */
|
||||
command_execute(command_get_by_name(CMD_SAVE_FILE), NULL);
|
||||
}
|
||||
else if (ret != 2) {
|
||||
/* "cancel" or "ESC" */
|
||||
return; /* we back doing nothing */
|
||||
}
|
||||
else {
|
||||
/* "discard" */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* closes the sprite */
|
||||
sprite_unmount(sprite);
|
||||
sprite_free(sprite);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2007 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,14 +20,40 @@
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include "jinete.h"
|
||||
|
||||
#include "core/app.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "dialogs/filesel.h"
|
||||
#include "file/file.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "modules/recent.h"
|
||||
#include "modules/sprites.h"
|
||||
|
||||
#endif
|
||||
|
||||
void command_execute_open_file(const char *argument)
|
||||
{
|
||||
char *filename;
|
||||
|
||||
/* interactive */
|
||||
if (!argument) {
|
||||
filename = GUI_FileSelect(_("Open Sprite"), "",
|
||||
get_readable_extensions());
|
||||
}
|
||||
/* load the file specified in the argument */
|
||||
else {
|
||||
filename = (char *)argument;
|
||||
}
|
||||
|
||||
if (filename) {
|
||||
Sprite *sprite = sprite_load(filename);
|
||||
if (sprite) {
|
||||
recent_file(filename);
|
||||
sprite_mount(sprite);
|
||||
sprite_show(sprite);
|
||||
}
|
||||
else {
|
||||
unrecent_file(filename);
|
||||
}
|
||||
|
||||
if (filename != argument)
|
||||
jfree(filename);
|
||||
}
|
||||
}
|
||||
|
@ -20,14 +20,17 @@
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include "jinete.h"
|
||||
|
||||
#include "core/app.h"
|
||||
#include "dialogs/viewspr.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
#endif
|
||||
|
||||
bool command_enabled_preview_fit_to_screen(const char *argument)
|
||||
{
|
||||
return current_sprite != NULL;
|
||||
}
|
||||
|
||||
void command_execute_preview_fit_to_screen(const char *argument)
|
||||
{
|
||||
preview_sprite(PREVIEW_FIT_ON_SCREEN);
|
||||
}
|
||||
|
@ -20,14 +20,17 @@
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include "jinete.h"
|
||||
|
||||
#include "core/app.h"
|
||||
#include "dialogs/viewspr.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
#endif
|
||||
|
||||
bool command_enabled_preview_normal(const char *argument)
|
||||
{
|
||||
return current_sprite != NULL;
|
||||
}
|
||||
|
||||
void command_execute_preview_normal(const char *argument)
|
||||
{
|
||||
preview_sprite(0);
|
||||
}
|
||||
|
@ -20,14 +20,17 @@
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include "jinete.h"
|
||||
|
||||
#include "core/app.h"
|
||||
#include "dialogs/viewspr.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
#endif
|
||||
|
||||
bool command_enabled_preview_tiled(const char *argument)
|
||||
{
|
||||
return current_sprite != NULL;
|
||||
}
|
||||
|
||||
void command_execute_preview_tiled(const char *argument)
|
||||
{
|
||||
preview_sprite(PREVIEW_TILED);
|
||||
}
|
||||
|
@ -20,14 +20,13 @@
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include "jinete.h"
|
||||
#include "jinete/base.h"
|
||||
|
||||
#include "core/app.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "dialogs/tips.h"
|
||||
|
||||
#endif
|
||||
|
||||
void command_execute_tips(const char *argument)
|
||||
{
|
||||
dialogs_tips(TRUE);
|
||||
}
|
||||
|
@ -27,20 +27,11 @@
|
||||
#include "jinete.h"
|
||||
|
||||
#include "commands/commands.h"
|
||||
/* #include "core/app.h" */
|
||||
/* #include "core/core.h" */
|
||||
/* #include "core/dirs.h" */
|
||||
/* #include "intl/intl.h" */
|
||||
/* #include "modules/chkmthds.h" */
|
||||
/* #include "modules/rootmenu.h" */
|
||||
/* #include "util/hash.h" */
|
||||
/* #include "util/filetoks.h" */
|
||||
/* #include "widgets/menu.h" */
|
||||
|
||||
#endif
|
||||
|
||||
#define CMD0(name) { #name, NULL, NULL, command_execute_##name, NULL }
|
||||
/* #define CMD1(name) { #name, NULL, NULL, NULL, NULL } */
|
||||
#define CMD1(name) { #name, command_enabled_##name, NULL, command_execute_##name, NULL }
|
||||
/* #define CMD2(name) { #name, NULL, NULL, NULL, NULL } */
|
||||
/* #define CMD3(name) { #name, NULL, NULL, NULL, NULL } */
|
||||
/* #define CMD4(name) { #name, NULL, NULL, NULL, NULL } */
|
||||
@ -53,6 +44,7 @@ void command_execute_change_image_type(const char *argument);
|
||||
void command_execute_clear(const char *argument);
|
||||
void command_execute_close_all_files(const char *argument);
|
||||
void command_execute_close_editor(const char *argument);
|
||||
bool command_enabled_close_file(const char *argument);
|
||||
void command_execute_close_file(const char *argument);
|
||||
void command_execute_color_curve(const char *argument);
|
||||
void command_execute_configure_screen(const char *argument);
|
||||
@ -73,7 +65,6 @@ void command_execute_duplicate_layer(const char *argument);
|
||||
void command_execute_duplicate_sprite(const char *argument);
|
||||
void command_execute_ellipse_tool(const char *argument);
|
||||
void command_execute_exit(const char *argument);
|
||||
void command_execute_exit(const char *argument);
|
||||
void command_execute_film_editor(const char *argument);
|
||||
void command_execute_flatten_layers(const char *argument);
|
||||
void command_execute_flip_horizontal(const char *argument);
|
||||
@ -106,8 +97,11 @@ void command_execute_palette_editor(const char *argument);
|
||||
void command_execute_paste(const char *argument);
|
||||
void command_execute_pencil_tool(const char *argument);
|
||||
void command_execute_play_flic(const char *argument);
|
||||
bool command_enabled_preview_fit_to_screen(const char *argument);
|
||||
void command_execute_preview_fit_to_screen(const char *argument);
|
||||
bool command_enabled_preview_normal(const char *argument);
|
||||
void command_execute_preview_normal(const char *argument);
|
||||
bool command_enabled_preview_tiled(const char *argument);
|
||||
void command_execute_preview_tiled(const char *argument);
|
||||
void command_execute_quick_copy(const char *argument);
|
||||
void command_execute_quick_move(const char *argument);
|
||||
@ -135,10 +129,10 @@ void command_execute_undo(const char *argument);
|
||||
|
||||
static Command commands[] = {
|
||||
CMD0(new_file),
|
||||
{ CMD_OPEN_FILE, NULL, NULL, NULL, NULL },
|
||||
CMD0(open_file),
|
||||
{ CMD_SAVE_FILE, NULL, NULL, NULL, NULL },
|
||||
{ CMD_SAVE_FILE_AS, NULL, NULL, NULL, NULL },
|
||||
{ CMD_CLOSE_FILE, NULL, NULL, NULL, NULL },
|
||||
CMD1(close_file),
|
||||
{ CMD_CLOSE_ALL_FILES, NULL, NULL, NULL, NULL },
|
||||
{ CMD_SCREEN_SHOT, NULL, NULL, NULL, NULL },
|
||||
{ CMD_RECORD_SCREEN, NULL, NULL, NULL, NULL },
|
||||
@ -160,14 +154,14 @@ static Command commands[] = {
|
||||
{ CMD_INVERT_COLOR, NULL, NULL, NULL, NULL },
|
||||
{ CMD_REFRESH, NULL, NULL, NULL, NULL },
|
||||
{ CMD_CONFIGURE_SCREEN, NULL, NULL, NULL, NULL },
|
||||
{ CMD_ADVANCED_MODE, NULL, NULL, NULL, NULL },
|
||||
CMD0(advanced_mode),
|
||||
{ CMD_MAKE_UNIQUE_EDITOR, NULL, NULL, NULL, NULL },
|
||||
{ CMD_SPLIT_EDITOR_VERTICALLY, NULL, NULL, NULL, NULL },
|
||||
{ CMD_SPLIT_EDITOR_HORIZONTALLY, NULL, NULL, NULL, NULL },
|
||||
{ CMD_CLOSE_EDITOR, NULL, NULL, NULL, NULL },
|
||||
{ CMD_PREVIEW_TILED, NULL, NULL, NULL, NULL },
|
||||
{ CMD_PREVIEW_NORMAL, NULL, NULL, NULL, NULL },
|
||||
{ CMD_PREVIEW_FIT_TO_SCREEN, NULL, NULL, NULL, NULL },
|
||||
CMD1(preview_tiled),
|
||||
CMD1(preview_normal),
|
||||
CMD1(preview_fit_to_screen),
|
||||
{ CMD_SPRITE_PROPERTIES, NULL, NULL, NULL, NULL },
|
||||
{ CMD_DUPLICATE_SPRITE, NULL, NULL, NULL, NULL },
|
||||
{ CMD_CHANGE_IMAGE_TYPE, NULL, NULL, NULL, NULL },
|
||||
@ -215,7 +209,7 @@ static Command commands[] = {
|
||||
{ CMD_PLAY_FLIC, NULL, NULL, NULL, NULL },
|
||||
{ CMD_MAPGEN, NULL, NULL, NULL, NULL },
|
||||
{ CMD_RUN_SCRIPT, NULL, NULL, NULL, NULL },
|
||||
{ CMD_TIPS, NULL, NULL, NULL, NULL },
|
||||
CMD0(tips),
|
||||
{ CMD_CUSTOMIZE, NULL, NULL, NULL, NULL },
|
||||
{ CMD_OPTIONS, NULL, NULL, NULL, NULL },
|
||||
{ NULL, NULL, NULL, NULL, NULL }
|
||||
|
@ -173,7 +173,7 @@ void app_loop(void)
|
||||
PRINTF("GUI mode\n");
|
||||
|
||||
/* setup the GUI screen */
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmanager_refresh_screen();
|
||||
|
||||
/* load main window */
|
||||
@ -569,37 +569,37 @@ static int check_args(int argc, char *argv[])
|
||||
arg = argv[i];
|
||||
|
||||
for (n=0; arg[n] == '-'; n++);
|
||||
len = strlen (arg+n);
|
||||
len = strlen(arg+n);
|
||||
|
||||
/* option */
|
||||
if ((n > 0) && (len > 0)) {
|
||||
/* use in batch mode only */
|
||||
if (strncmp (arg+n, "batch", len) == 0) {
|
||||
if (strncmp(arg+n, "batch", len) == 0) {
|
||||
ase_mode |= MODE_BATCH;
|
||||
}
|
||||
/* do script expression */
|
||||
else if (strncmp (arg+n, "exp", len) == 0) {
|
||||
else if (strncmp(arg+n, "exp", len) == 0) {
|
||||
if (++i < argc)
|
||||
jlist_append(options, option_new(DO_SCRIPT_EXPR, argv[i]));
|
||||
else
|
||||
usage (1);
|
||||
}
|
||||
/* open script file */
|
||||
else if (strncmp (arg+n, "file", len) == 0) {
|
||||
else if (strncmp(arg+n, "file", len) == 0) {
|
||||
if (++i < argc)
|
||||
jlist_append(options, option_new(DO_SCRIPT_FILE, argv[i]));
|
||||
else
|
||||
usage (1);
|
||||
usage(1);
|
||||
}
|
||||
/* use other palette file */
|
||||
else if (strncmp (arg+n, "palette", len) == 0) {
|
||||
else if (strncmp(arg+n, "palette", len) == 0) {
|
||||
if (++i < argc)
|
||||
palette_filename = argv[i];
|
||||
else
|
||||
usage (1);
|
||||
usage(1);
|
||||
}
|
||||
/* video resolution */
|
||||
else if (strncmp (arg+n, "resolution", len) == 0) {
|
||||
else if (strncmp(arg+n, "resolution", len) == 0) {
|
||||
if (++i < argc) {
|
||||
int c, num1=0, num2=0, num3=0;
|
||||
char *tok;
|
||||
@ -608,26 +608,26 @@ static int check_args(int argc, char *argv[])
|
||||
resolución algo como esto: 320x240[x8] o [8] */
|
||||
c = 0;
|
||||
|
||||
for (tok=ustrtok (argv[i], "x"); tok;
|
||||
tok=ustrtok (NULL, "x")) {
|
||||
for (tok=ustrtok(argv[i], "x"); tok;
|
||||
tok=ustrtok(NULL, "x")) {
|
||||
switch (c) {
|
||||
case 0: num1 = ustrtol (tok, NULL, 10); break;
|
||||
case 1: num2 = ustrtol (tok, NULL, 10); break;
|
||||
case 2: num3 = ustrtol (tok, NULL, 10); break;
|
||||
case 0: num1 = ustrtol(tok, NULL, 10); break;
|
||||
case 1: num2 = ustrtol(tok, NULL, 10); break;
|
||||
case 2: num3 = ustrtol(tok, NULL, 10); break;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
case 1:
|
||||
set_config_int ("GfxMode", "Depth", num1);
|
||||
set_config_int("GfxMode", "Depth", num1);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
set_config_int ("GfxMode", "Width", num1);
|
||||
set_config_int ("GfxMode", "Height", num2);
|
||||
set_config_int("GfxMode", "Width", num1);
|
||||
set_config_int("GfxMode", "Height", num2);
|
||||
if (c == 3)
|
||||
set_config_int ("GfxMode", "Depth", num3);
|
||||
set_config_int("GfxMode", "Depth", num3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "jinete/base.h"
|
||||
#include "jinete/list.h"
|
||||
#include "jinete/system.h"
|
||||
|
||||
#include "modules/sprites.h"
|
||||
#include "util/session.h"
|
||||
@ -122,11 +123,11 @@ static void do_shutdown_exit(void)
|
||||
}
|
||||
|
||||
if (screen) {
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
text_mode(makecol(0, 0, 0));
|
||||
textprintf(screen, font, 0, 0, makecol(255, 255, 255),
|
||||
"Saving session in %s", get_filename(buf));
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
}
|
||||
else
|
||||
printf("Saving session in %s", get_filename (buf));
|
||||
|
@ -264,26 +264,26 @@ static bool image_viewer_msg_proc (JWidget widget, JMessage msg)
|
||||
case JM_BUTTONPRESSED: {
|
||||
JWidget view = jwidget_get_view (widget);
|
||||
if (view) {
|
||||
jwidget_hard_capture_mouse (widget);
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
jwidget_hard_capture_mouse(widget);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case JM_MOTION: {
|
||||
JWidget view = jwidget_get_view (widget);
|
||||
if (view && jwidget_has_capture (widget)) {
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
if (view && jwidget_has_capture(widget)) {
|
||||
JRect vp = jview_get_viewport_position (view);
|
||||
int scroll_x, scroll_y;
|
||||
|
||||
jview_get_scroll (view, &scroll_x, &scroll_y);
|
||||
jview_set_scroll (view,
|
||||
scroll_x + ji_mouse_x (1) - ji_mouse_x (0),
|
||||
scroll_y + ji_mouse_y (1) - ji_mouse_y (0));
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
jview_set_scroll(view,
|
||||
scroll_x + jmouse_x(1) - jmouse_x(0),
|
||||
scroll_y + jmouse_y(1) - jmouse_y(0));
|
||||
|
||||
ji_mouse_control_infinite_scroll (vp);
|
||||
jrect_free (vp);
|
||||
jmouse_control_infinite_scroll(vp);
|
||||
jrect_free(vp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -292,7 +292,7 @@ static bool image_viewer_msg_proc (JWidget widget, JMessage msg)
|
||||
JWidget view = jwidget_get_view (widget);
|
||||
if (view && jwidget_has_capture (widget)) {
|
||||
jwidget_release_mouse (widget);
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "jinete.h"
|
||||
#include "jinete/intern.h"
|
||||
|
||||
#include "commands/commands.h"
|
||||
#include "core/app.h"
|
||||
#include "core/cfg.h"
|
||||
#include "core/core.h"
|
||||
@ -317,16 +318,18 @@ static bool layer_box_msg_proc (JWidget widget, JMessage msg)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case JM_CHAR:
|
||||
case JM_CHAR: {
|
||||
Command *command = command_get_by_key(msg);
|
||||
|
||||
/* close film editor */
|
||||
if (check_for_accel (ACCEL_FOR_FILMEDITOR, msg) ||
|
||||
msg->key.scancode == KEY_ESC) {
|
||||
jwidget_close_window (widget);
|
||||
if ((command && (strcmp(command->name, CMD_FILM_EDITOR) == 0)) ||
|
||||
(msg->key.scancode == KEY_ESC)) {
|
||||
jwidget_close_window(widget);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* undo */
|
||||
if (check_for_accel (ACCEL_FOR_UNDO, msg)) {
|
||||
if (command && strcmp(command->name, CMD_UNDO) == 0) {
|
||||
if (undo_can_undo (sprite->undo)) {
|
||||
undo_undo (sprite->undo);
|
||||
destroy_thumbnails ();
|
||||
@ -336,7 +339,7 @@ static bool layer_box_msg_proc (JWidget widget, JMessage msg)
|
||||
}
|
||||
|
||||
/* redo */
|
||||
if (check_for_accel (ACCEL_FOR_REDO, msg)) {
|
||||
if (command && strcmp(command->name, CMD_REDO) == 0) {
|
||||
if (undo_can_redo (sprite->undo)) {
|
||||
undo_redo (sprite->undo);
|
||||
destroy_thumbnails ();
|
||||
@ -354,19 +357,20 @@ static bool layer_box_msg_proc (JWidget widget, JMessage msg)
|
||||
/* GUI_Refresh (sprite); */
|
||||
/* break; */
|
||||
break;
|
||||
}
|
||||
|
||||
case JM_BUTTONPRESSED:
|
||||
jwidget_hard_capture_mouse (widget);
|
||||
|
||||
if (msg->any.shifts & KB_SHIFT_FLAG) {
|
||||
state = STATE_SCROLLING;
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
}
|
||||
else {
|
||||
state = STATE_MOVING;
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
|
||||
select_layer_motion (widget, layer_box, layer_box->frame_box);
|
||||
select_layer_motion(widget, layer_box, layer_box->frame_box);
|
||||
layer_box->layer = current_sprite->layer;
|
||||
/* layer_box->rect = rect; */
|
||||
/* layer_box->rect_data = NULL; */
|
||||
@ -390,7 +394,7 @@ static bool layer_box_msg_proc (JWidget widget, JMessage msg)
|
||||
jwidget_release_mouse (widget);
|
||||
|
||||
if ((state == STATE_SCROLLING) || (state == STATE_MOVING))
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
|
||||
if (state == STATE_MOVING) {
|
||||
/* layer popup menu */
|
||||
@ -620,7 +624,7 @@ static bool frame_box_msg_proc (JWidget widget, JMessage msg)
|
||||
|
||||
if (msg->any.shifts & KB_SHIFT_FLAG) {
|
||||
state = STATE_SCROLLING;
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
}
|
||||
else {
|
||||
Frame *frame;
|
||||
@ -643,7 +647,7 @@ static bool frame_box_msg_proc (JWidget widget, JMessage msg)
|
||||
current_sprite->frpos);
|
||||
if (frame) {
|
||||
state = STATE_MOVING; /* now we will moving a frame */
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
|
||||
frame_box->layer = current_sprite->layer;
|
||||
frame_box->frame = frame;
|
||||
@ -651,7 +655,7 @@ static bool frame_box_msg_proc (JWidget widget, JMessage msg)
|
||||
|
||||
get_frame_rect (widget, &frame_box->rect);
|
||||
|
||||
scare_mouse ();
|
||||
jmouse_hide();
|
||||
frame_box->rect_data = rectsave
|
||||
(ji_screen,
|
||||
frame_box->rect.x1, frame_box->rect.y1,
|
||||
@ -660,7 +664,7 @@ static bool frame_box_msg_proc (JWidget widget, JMessage msg)
|
||||
frame_box->rect.x1, frame_box->rect.y1,
|
||||
frame_box->rect.x2-1, frame_box->rect.y2-1,
|
||||
makecol (0, 0, 0), makecol (255, 255, 255));
|
||||
unscare_mouse ();
|
||||
jmouse_show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,29 +675,29 @@ static bool frame_box_msg_proc (JWidget widget, JMessage msg)
|
||||
control_scroll_motion (widget, frame_box->layer_box, frame_box);
|
||||
/* move */
|
||||
else if (state == STATE_MOVING) {
|
||||
scare_mouse ();
|
||||
jmouse_hide();
|
||||
|
||||
rectrestore (frame_box->rect_data);
|
||||
rectdiscard (frame_box->rect_data);
|
||||
rectrestore(frame_box->rect_data);
|
||||
rectdiscard(frame_box->rect_data);
|
||||
|
||||
select_frpos_motion (widget);
|
||||
select_layer_motion (widget, frame_box->layer_box, frame_box);
|
||||
select_frpos_motion(widget);
|
||||
select_layer_motion(widget, frame_box->layer_box, frame_box);
|
||||
|
||||
get_frame_rect (widget, &frame_box->rect);
|
||||
get_frame_rect(widget, &frame_box->rect);
|
||||
|
||||
jwidget_flush_redraw (widget);
|
||||
jwidget_flush_redraw(widget);
|
||||
|
||||
frame_box->rect_data = rectsave
|
||||
(ji_screen,
|
||||
frame_box->rect.x1, frame_box->rect.y1,
|
||||
frame_box->rect.x2-1, frame_box->rect.y2-1);
|
||||
|
||||
rectdotted (ji_screen,
|
||||
frame_box->rect.x1, frame_box->rect.y1,
|
||||
frame_box->rect.x2-1, frame_box->rect.y2-1,
|
||||
makecol (0, 0, 0), makecol (255, 255, 255));
|
||||
rectdotted(ji_screen,
|
||||
frame_box->rect.x1, frame_box->rect.y1,
|
||||
frame_box->rect.x2-1, frame_box->rect.y2-1,
|
||||
makecol (0, 0, 0), makecol (255, 255, 255));
|
||||
|
||||
unscare_mouse ();
|
||||
jmouse_show();
|
||||
}
|
||||
/* select */
|
||||
else if (state == STATE_SELECTING) {
|
||||
@ -709,14 +713,14 @@ static bool frame_box_msg_proc (JWidget widget, JMessage msg)
|
||||
jwidget_release_mouse (widget);
|
||||
|
||||
if ((state == STATE_SCROLLING) || (state == STATE_MOVING))
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
|
||||
if ((state == STATE_SELECTING) || (state == STATE_MOVING)) {
|
||||
if (state == STATE_MOVING) {
|
||||
scare_mouse ();
|
||||
rectrestore (frame_box->rect_data);
|
||||
rectdiscard (frame_box->rect_data);
|
||||
unscare_mouse ();
|
||||
jmouse_hide();
|
||||
rectrestore(frame_box->rect_data);
|
||||
rectdiscard(frame_box->rect_data);
|
||||
jmouse_show();
|
||||
}
|
||||
|
||||
set_frame_to_handle (frame_box->layer, frame_box->frame);
|
||||
@ -864,9 +868,9 @@ static Layer *get_layer_in_pos(Layer *layer, int pos)
|
||||
static void select_frpos_motion(JWidget widget)
|
||||
{
|
||||
Sprite *sprite = current_sprite;
|
||||
int frpos = (ji_mouse_x (0) - widget->rc->x1) / FRMSIZE;
|
||||
int frpos = (jmouse_x(0) - widget->rc->x1) / FRMSIZE;
|
||||
|
||||
frpos = MID (0, frpos, sprite->frames-1);
|
||||
frpos = MID(0, frpos, sprite->frames-1);
|
||||
|
||||
/* the frame change */
|
||||
if (sprite->frpos != frpos) {
|
||||
@ -891,8 +895,7 @@ static void select_frpos_motion(JWidget widget)
|
||||
scroll_change = FALSE;
|
||||
|
||||
if (scroll_change)
|
||||
ji_mouse_set_position(widget->rc->x1+frpos*FRMSIZE+FRMSIZE/2,
|
||||
ji_mouse_y (0));
|
||||
jmouse_set_position(widget->rc->x1+frpos*FRMSIZE+FRMSIZE/2, jmouse_y(0));
|
||||
|
||||
jwidget_dirty(widget);
|
||||
jrect_free(vp);
|
||||
@ -910,7 +913,7 @@ static void select_layer_motion(JWidget widget,
|
||||
get_layer_pos(sprite->set, sprite->layer, ¤t_layer);
|
||||
|
||||
/* get new selected pos */
|
||||
layer = (ji_mouse_y (0) - (widget->rc->y1 + LAYSIZE)) / LAYSIZE;
|
||||
layer = (jmouse_y(0) - (widget->rc->y1 + LAYSIZE)) / LAYSIZE;
|
||||
layer = MID(0, layer, count_layers(sprite->set)-1);
|
||||
|
||||
/* the layer change? */
|
||||
@ -940,8 +943,8 @@ static void select_layer_motion(JWidget widget,
|
||||
scroll_change = FALSE;
|
||||
|
||||
if (scroll_change)
|
||||
ji_mouse_set_position(ji_mouse_x (0),
|
||||
widget->rc->y1+LAYSIZE+layer*LAYSIZE+LAYSIZE/2);
|
||||
jmouse_set_position(jmouse_x(0),
|
||||
widget->rc->y1+LAYSIZE+layer*LAYSIZE+LAYSIZE/2);
|
||||
|
||||
jwidget_dirty(layer_box->widget);
|
||||
jwidget_dirty(frame_box->widget);
|
||||
@ -966,22 +969,22 @@ static void control_scroll_motion (JWidget widget,
|
||||
|
||||
/* horizontal scroll for layer_box */
|
||||
if (widget == layer_box->widget)
|
||||
scroll1_x += ji_mouse_x (1)-ji_mouse_x (0);
|
||||
scroll1_x += jmouse_x(1)-jmouse_x(0);
|
||||
/* horizontal scroll for frame_box */
|
||||
else
|
||||
scroll2_x += ji_mouse_x (1)-ji_mouse_x (0);
|
||||
scroll2_x += jmouse_x(1)-jmouse_x(0);
|
||||
|
||||
jview_set_scroll(view1,
|
||||
scroll1_x,
|
||||
/* vertical scroll */
|
||||
scroll1_y+ji_mouse_y (1)-ji_mouse_y (0));
|
||||
scroll1_y+jmouse_y(1)-jmouse_y(0));
|
||||
|
||||
jview_set_scroll(view2,
|
||||
scroll2_x,
|
||||
/* vertical scroll */
|
||||
scroll2_y+ji_mouse_y (1)-ji_mouse_y (0));
|
||||
scroll2_x,
|
||||
/* vertical scroll */
|
||||
scroll2_y+jmouse_y(1)-jmouse_y(0));
|
||||
|
||||
ji_mouse_control_infinite_scroll(vp);
|
||||
jmouse_control_infinite_scroll(vp);
|
||||
jrect_free(vp);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2001-2005 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -62,18 +62,18 @@ void ji_minipal_new (JWidget color_bar, int x, int y)
|
||||
|
||||
static int paledit_change_signal (JWidget widget, int user_data)
|
||||
{
|
||||
if (ji_mouse_b (0)) {
|
||||
if (jmouse_b(0)) {
|
||||
PaletteEditor *paledit = palette_editor_data (widget);
|
||||
JWidget color_bar = (JWidget)user_data;
|
||||
|
||||
if (paledit->color[0] == paledit->color[1]) {
|
||||
char *color = color_index (paledit->color[1]);
|
||||
|
||||
color_bar_set_color (color_bar,
|
||||
ji_mouse_b (0) == 1 ? 0: 1,
|
||||
color, FALSE);
|
||||
color_bar_set_color(color_bar,
|
||||
jmouse_b(0) == 1 ? 0: 1,
|
||||
color, FALSE);
|
||||
|
||||
jfree (color);
|
||||
jfree(color);
|
||||
}
|
||||
else {
|
||||
bool array[256];
|
||||
|
@ -41,53 +41,53 @@ static void my_play_fli (const char *filename, bool loop, bool fullscreen,
|
||||
|
||||
void play_fli_animation (const char *filename, bool loop, bool fullscreen)
|
||||
{
|
||||
if (is_interactive ()) {
|
||||
if (is_interactive()) {
|
||||
PALETTE backup;
|
||||
|
||||
jmanager_free_mouse ();
|
||||
jmanager_free_mouse();
|
||||
|
||||
/* hide the mouse */
|
||||
scare_mouse ();
|
||||
jmouse_hide();
|
||||
|
||||
/* get the current color palette */
|
||||
get_palette (backup);
|
||||
get_palette(backup);
|
||||
|
||||
/* clear the screen */
|
||||
clear (ji_screen);
|
||||
clear(ji_screen);
|
||||
|
||||
/* clear the keyboard buffer */
|
||||
clear_keybuf ();
|
||||
clear_keybuf();
|
||||
|
||||
/* play the fli */
|
||||
my_play_fli (filename, loop, fullscreen, my_callback);
|
||||
my_play_fli(filename, loop, fullscreen, my_callback);
|
||||
/* play_fli (filename, ji_screen, loop, my_callback); */
|
||||
|
||||
/* clear the screen */
|
||||
clear (ji_screen);
|
||||
clear(ji_screen);
|
||||
|
||||
/* restore the color palette */
|
||||
set_palette (backup);
|
||||
set_palette(backup);
|
||||
|
||||
/* show the mouse cursor */
|
||||
unscare_mouse ();
|
||||
jmouse_show();
|
||||
|
||||
/* wait while the user has pushed some mouse button */
|
||||
do {
|
||||
ji_mouse_poll ();
|
||||
} while (ji_mouse_b (0));
|
||||
jmouse_poll();
|
||||
} while (jmouse_b(0));
|
||||
|
||||
/* clear again the keyboard buffer */
|
||||
clear_keybuf ();
|
||||
clear_keybuf();
|
||||
|
||||
jmanager_refresh_screen ();
|
||||
jmanager_refresh_screen();
|
||||
}
|
||||
}
|
||||
|
||||
static bool my_callback (void)
|
||||
{
|
||||
ji_mouse_poll ();
|
||||
jmouse_poll();
|
||||
|
||||
return (keypressed () || ji_mouse_b (0));
|
||||
return (keypressed () || jmouse_b(0));
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
@ -129,7 +129,7 @@ static void my_play_fli (const char *filename, bool loop, bool fullscreen,
|
||||
old = create_bitmap_ex (8, fli_header.width, fli_header.height);
|
||||
|
||||
/* stretch routine doesn't support bitmaps of different color depths */
|
||||
if (bitmap_color_depth (ji_screen) != 8)
|
||||
if (bitmap_color_depth(ji_screen) != 8)
|
||||
fullscreen = FALSE;
|
||||
|
||||
w = fli_header.width;
|
||||
|
@ -43,7 +43,7 @@ void dialogs_screen_saver(void)
|
||||
return;
|
||||
|
||||
/* hide the mouse */
|
||||
ji_mouse_set_cursor(JI_CURSOR_NULL);
|
||||
jmouse_set_cursor(JI_CURSOR_NULL);
|
||||
|
||||
/* get the current color palette */
|
||||
get_palette(backup);
|
||||
@ -115,9 +115,9 @@ void dialogs_screen_saver(void)
|
||||
POLYTYPE_GCOL: POLYTYPE_GRGB, NULL, &v1, &v2, &v3);
|
||||
|
||||
/* poll GUI */
|
||||
ji_mouse_poll();
|
||||
jmouse_poll();
|
||||
gui_feedback();
|
||||
} while ((!keypressed()) && (!ji_mouse_b(0)));
|
||||
} while ((!keypressed()) && (!jmouse_b(0)));
|
||||
|
||||
/* clear the screen */
|
||||
clear(ji_screen);
|
||||
@ -127,12 +127,12 @@ void dialogs_screen_saver(void)
|
||||
|
||||
/* wait while the user has pushed some mouse button */
|
||||
do {
|
||||
ji_mouse_poll();
|
||||
jmouse_poll();
|
||||
gui_feedback();
|
||||
} while (ji_mouse_b(0));
|
||||
} while (jmouse_b(0));
|
||||
|
||||
jmanager_refresh_screen();
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
|
||||
/* clear again the keyboard buffer */
|
||||
clear_keybuf();
|
||||
|
@ -182,7 +182,7 @@ static bool tips_msg_proc(JWidget widget, JMessage msg)
|
||||
{
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
JRect vp = jview_get_viewport_position(view);
|
||||
int dz = ji_mouse_z(1) - ji_mouse_z(0);
|
||||
int dz = jmouse_z(1) - jmouse_z(0);
|
||||
int scroll_x, scroll_y;
|
||||
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
@ -221,7 +221,7 @@ static void tips_request_size(JWidget widget, int *w, int *h)
|
||||
static JWidget tips_image_new(BITMAP *bmp)
|
||||
{
|
||||
JWidget widget = jimage_new(bmp, JI_CENTER | JI_MIDDLE);
|
||||
jwidget_add_hook(widget, tips_image_type (),
|
||||
jwidget_add_hook(widget, tips_image_type(),
|
||||
tips_image_msg_proc, bmp);
|
||||
return widget;
|
||||
}
|
||||
@ -234,15 +234,15 @@ static int tips_image_type(void)
|
||||
return type;
|
||||
}
|
||||
|
||||
static bool tips_image_msg_proc (JWidget widget, JMessage msg)
|
||||
static bool tips_image_msg_proc(JWidget widget, JMessage msg)
|
||||
{
|
||||
if (msg->type == JM_DESTROY)
|
||||
destroy_bitmap (jwidget_get_data (widget, tips_image_type ()));
|
||||
destroy_bitmap(jwidget_get_data(widget, tips_image_type()));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static FILE *tips_open_file (void)
|
||||
static FILE *tips_open_file(void)
|
||||
{
|
||||
char filename[1024];
|
||||
DIRS *dirs, *dir;
|
||||
@ -290,7 +290,7 @@ static int tips_count_pages (void)
|
||||
return page;
|
||||
}
|
||||
|
||||
static void tips_load_page (JWidget widget)
|
||||
static void tips_load_page(JWidget widget)
|
||||
{
|
||||
int use_page = get_config_int("Tips", "Page", 0);
|
||||
char buf[1024];
|
||||
@ -301,8 +301,8 @@ static void tips_load_page (JWidget widget)
|
||||
/* destroy old page */
|
||||
if (!jlist_empty(widget->children)) {
|
||||
JWidget child = jlist_first(widget->children)->data;
|
||||
jwidget_remove_child (widget, child);
|
||||
jwidget_free (child);
|
||||
jwidget_remove_child(widget, child);
|
||||
jwidget_free(child);
|
||||
}
|
||||
|
||||
/* set default palette */
|
||||
@ -310,32 +310,32 @@ static void tips_load_page (JWidget widget)
|
||||
|
||||
f = tips_open_file();
|
||||
if (!f) {
|
||||
jwidget_add_child (widget, jlabel_new (_("Error loading tips file.")));
|
||||
jwidget_add_child(widget, jlabel_new(_("Error loading tips file.")));
|
||||
return;
|
||||
}
|
||||
|
||||
while (fgets (buf, sizeof (buf), f)) {
|
||||
while (fgets(buf, sizeof(buf), f)) {
|
||||
if (*buf == 12) {
|
||||
/* read this page */
|
||||
if (use_page == page) {
|
||||
JWidget vbox = tips_load_box (f, buf, sizeof (buf), &take);
|
||||
JWidget vbox = tips_load_box(f, buf, sizeof (buf), &take);
|
||||
if (vbox)
|
||||
jwidget_add_child (widget, vbox);
|
||||
jwidget_add_child(widget, vbox);
|
||||
break;
|
||||
}
|
||||
page++;
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
fclose(f);
|
||||
|
||||
jview_update (jwidget_get_view (widget));
|
||||
jview_set_scroll (jwidget_get_view (widget), 0, 0);
|
||||
jview_update(jwidget_get_view(widget));
|
||||
jview_set_scroll(jwidget_get_view(widget), 0, 0);
|
||||
|
||||
jmanager_refresh_screen ();
|
||||
jmanager_refresh_screen();
|
||||
}
|
||||
|
||||
static JWidget tips_load_box (FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
static JWidget tips_load_box(FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
{
|
||||
JWidget vbox = jbox_new (JI_VERTICAL);
|
||||
|
||||
@ -432,7 +432,7 @@ static JWidget tips_load_box (FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
|
||||
/* read more text (to generate a paragraph) */
|
||||
if (*text != '*') {
|
||||
while (fgets (buf, sizeof_buf, f)) {
|
||||
while (fgets(buf, sizeof_buf, f)) {
|
||||
if (*buf == 12 || *buf == '\\') {
|
||||
*take = FALSE;
|
||||
break;
|
||||
@ -442,8 +442,8 @@ static JWidget tips_load_box (FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
continue;
|
||||
|
||||
/* remove trailing space chars */
|
||||
while (*buf && isspace (ugetat (buf, -1)))
|
||||
usetat (buf, -1, 0);
|
||||
while (*buf && isspace(ugetat (buf, -1)))
|
||||
usetat(buf, -1, 0);
|
||||
|
||||
/* empty? */
|
||||
if (!*buf) {
|
||||
@ -452,20 +452,20 @@ static JWidget tips_load_box (FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
}
|
||||
|
||||
/* add chars */
|
||||
text = jrealloc (text, strlen (text) + 1 + strlen (buf) + 1);
|
||||
strcat (text, " ");
|
||||
strcpy (text+strlen (text), buf);
|
||||
text = jrealloc(text, strlen (text) + 1 + strlen (buf) + 1);
|
||||
strcat(text, " ");
|
||||
strcpy(text+strlen (text), buf);
|
||||
}
|
||||
|
||||
/* add the textbox */
|
||||
jwidget_add_child (vbox, jtextbox_new (text, JI_WORDWRAP | JI_CENTER));
|
||||
jwidget_add_child(vbox, jtextbox_new(text, JI_WORDWRAP | JI_CENTER));
|
||||
}
|
||||
else {
|
||||
/* add a label */
|
||||
jwidget_add_child (vbox, jtextbox_new (text+2, JI_WORDWRAP | JI_LEFT));
|
||||
jwidget_add_child(vbox, jtextbox_new(text+2, JI_WORDWRAP | JI_LEFT));
|
||||
}
|
||||
|
||||
jfree (text);
|
||||
jfree(text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,20 +475,20 @@ static JWidget tips_load_box (FILE *f, char *buf, int sizeof_buf, int *take)
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static BITMAP *tips_load_image (const char *filename, PALETTE pal)
|
||||
static BITMAP *tips_load_image(const char *filename, PALETTE pal)
|
||||
{
|
||||
BITMAP *bmp = NULL;
|
||||
DIRS *dir, *dirs;
|
||||
|
||||
dirs = filename_in_datadir (filename);
|
||||
dirs = filename_in_datadir(filename);
|
||||
|
||||
for (dir=dirs; dir; dir=dir->next) {
|
||||
bmp = load_bitmap (dir->path, pal);
|
||||
bmp = load_bitmap(dir->path, pal);
|
||||
if (bmp)
|
||||
break;
|
||||
}
|
||||
|
||||
dirs_free (dirs);
|
||||
dirs_free(dirs);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "core/app.h"
|
||||
#include "core/core.h"
|
||||
#include "dialogs/viewspr.h"
|
||||
#include "modules/editors.h"
|
||||
#include "modules/gfx.h"
|
||||
#include "modules/gui.h"
|
||||
@ -36,16 +37,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define JUST_ONE 1
|
||||
#define FIT_ON_SCREEN 2
|
||||
|
||||
static void view_sprite(int flags);
|
||||
|
||||
void view_tiled(void) { view_sprite(0); }
|
||||
void view_normal(void) { view_sprite(JUST_ONE); }
|
||||
void view_fullscreen(void) { view_sprite(JUST_ONE | FIT_ON_SCREEN); }
|
||||
|
||||
static void view_sprite(int flags)
|
||||
void preview_sprite(int flags)
|
||||
{
|
||||
JWidget widget = current_editor;
|
||||
|
||||
@ -68,8 +60,8 @@ static void view_sprite(int flags)
|
||||
vp = jview_get_viewport_position(view);
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
|
||||
old_mouse_x = ji_mouse_x(0);
|
||||
old_mouse_y = ji_mouse_y(0);
|
||||
old_mouse_x = jmouse_x(0);
|
||||
old_mouse_y = jmouse_y(0);
|
||||
|
||||
bmp = create_bitmap (sprite->w, sprite->h);
|
||||
if (bmp) {
|
||||
@ -78,8 +70,8 @@ static void view_sprite(int flags)
|
||||
jwidget_flush_redraw(app_get_status_bar());
|
||||
jmanager_dispatch_messages();
|
||||
|
||||
ji_mouse_set_cursor(JI_CURSOR_NULL);
|
||||
ji_mouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
|
||||
jmouse_set_cursor(JI_CURSOR_NULL);
|
||||
jmouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
|
||||
|
||||
/* render the sprite in the bitmap */
|
||||
image = render_sprite(sprite, 0, 0, sprite->w, sprite->h,
|
||||
@ -89,7 +81,7 @@ static void view_sprite(int flags)
|
||||
image_free(image);
|
||||
}
|
||||
|
||||
if (flags & JUST_ONE)
|
||||
if (!(flags & PREVIEW_TILED))
|
||||
bg_color = palette_color[index_bg_color=0];
|
||||
else
|
||||
bg_color = makecol(128, 128, 128);
|
||||
@ -103,11 +95,11 @@ static void view_sprite(int flags)
|
||||
redraw = TRUE;
|
||||
do {
|
||||
/* update scroll */
|
||||
if (ji_mouse_poll()) {
|
||||
shiftx += ji_mouse_x(0) - JI_SCREEN_W/2;
|
||||
shifty += ji_mouse_y(0) - JI_SCREEN_H/2;
|
||||
ji_mouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
|
||||
ji_mouse_poll();
|
||||
if (jmouse_poll()) {
|
||||
shiftx += jmouse_x(0) - JI_SCREEN_W/2;
|
||||
shifty += jmouse_y(0) - JI_SCREEN_H/2;
|
||||
jmouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
|
||||
jmouse_poll();
|
||||
|
||||
redraw = TRUE;
|
||||
}
|
||||
@ -116,7 +108,7 @@ static void view_sprite(int flags)
|
||||
redraw = FALSE;
|
||||
|
||||
/* fit on screen */
|
||||
if (flags & FIT_ON_SCREEN) {
|
||||
if (flags & PREVIEW_FIT_ON_SCREEN) {
|
||||
double sx, sy, scale, outw, outh;
|
||||
|
||||
sx = (double)JI_SCREEN_W / (double)bmp->w;
|
||||
@ -132,7 +124,7 @@ static void view_sprite(int flags)
|
||||
}
|
||||
/* draw in normal size */
|
||||
else {
|
||||
if (flags & JUST_ONE) {
|
||||
if (!(flags & PREVIEW_TILED)) {
|
||||
x = shiftx;
|
||||
y = shifty;
|
||||
}
|
||||
@ -141,7 +133,7 @@ static void view_sprite(int flags)
|
||||
y = SGN(shifty) * (ABS(shifty)%h);
|
||||
}
|
||||
|
||||
if (flags & JUST_ONE) {
|
||||
if (!(flags & PREVIEW_TILED)) {
|
||||
/* rectfill_exclude(ji_screen, 0, 0, JI_SCREEN_W-1, JI_SCREEN_H-1, */
|
||||
/* x, y, x+w-1, y+h-1, bg_color); */
|
||||
clear_to_color(ji_screen, bg_color);
|
||||
@ -149,7 +141,7 @@ static void view_sprite(int flags)
|
||||
|
||||
if (!editor->zoom) {
|
||||
/* in the center */
|
||||
if (flags & JUST_ONE)
|
||||
if (!(flags & PREVIEW_TILED))
|
||||
draw_sprite(ji_screen, bmp, x, y);
|
||||
/* tiled */
|
||||
else
|
||||
@ -159,7 +151,7 @@ static void view_sprite(int flags)
|
||||
}
|
||||
else {
|
||||
/* in the center */
|
||||
if (flags & JUST_ONE)
|
||||
if (!(flags & PREVIEW_TILED))
|
||||
masked_stretch_blit(bmp, ji_screen, 0, 0, bmp->w, bmp->h, x, y, w, h);
|
||||
/* tiled */
|
||||
else
|
||||
@ -204,19 +196,19 @@ static void view_sprite(int flags)
|
||||
else
|
||||
break;
|
||||
}
|
||||
} while (!ji_mouse_b(0));
|
||||
} while (!jmouse_b(0));
|
||||
|
||||
destroy_bitmap(bmp);
|
||||
}
|
||||
|
||||
do {
|
||||
ji_mouse_poll();
|
||||
jmouse_poll();
|
||||
gui_feedback();
|
||||
} while (ji_mouse_b(0));
|
||||
} while (jmouse_b(0));
|
||||
clear_keybuf();
|
||||
|
||||
ji_mouse_set_position(old_mouse_x, old_mouse_y);
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_position(old_mouse_x, old_mouse_y);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
|
||||
jmanager_refresh_screen();
|
||||
jrect_free(vp);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2001-2005 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -19,9 +19,10 @@
|
||||
#ifndef DIALOGS_VIEWSPR_H
|
||||
#define DIALOGS_VIEWSPR_H
|
||||
|
||||
void view_tiled(void);
|
||||
void view_normal(void);
|
||||
void view_fullscreen(void);
|
||||
#define PREVIEW_TILED 1
|
||||
#define PREVIEW_FIT_ON_SCREEN 2
|
||||
|
||||
void preview_sprite(int flags);
|
||||
|
||||
#endif /* DIALOGS_VIEWSPR_H */
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
|
||||
static JWidget manager = NULL;
|
||||
|
||||
static int next_idle_flags = 0;
|
||||
static volatile int next_idle_flags = 0;
|
||||
static JList icon_buttons;
|
||||
|
||||
/* default GUI screen configuration */
|
||||
@ -88,6 +88,8 @@ static void display_switch_in_callback()
|
||||
next_idle_flags |= REBUILD_FULLREFRESH;
|
||||
}
|
||||
|
||||
END_OF_STATIC_FUNCTION(display_switch_in_callback);
|
||||
|
||||
/**
|
||||
* Initializes GUI.
|
||||
*/
|
||||
@ -173,6 +175,8 @@ int init_module_gui(void)
|
||||
|
||||
/* add a hook to display-switch so when the user returns to the
|
||||
screen it's completelly refreshed/redrawn */
|
||||
LOCK_VARIABLE(next_idle_flags);
|
||||
LOCK_FUNCTION(display_switch_in_callback);
|
||||
set_display_switch_callback(SWITCH_IN, display_switch_in_callback);
|
||||
|
||||
/* set graphics options for next time */
|
||||
@ -288,8 +292,8 @@ void gui_feedback(void)
|
||||
|
||||
/* double buffering? */
|
||||
if (double_buffering) {
|
||||
jmanager_dispatch_draw_messages();
|
||||
ji_mouse_draw_cursor();
|
||||
/* jmanager_dispatch_draw_messages(); */
|
||||
jmouse_draw_cursor();
|
||||
|
||||
if (JI_SCREEN_W == SCREEN_W && JI_SCREEN_H == SCREEN_H) {
|
||||
blit(ji_screen, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
|
||||
@ -299,6 +303,8 @@ void gui_feedback(void)
|
||||
0, 0, ji_screen->w, ji_screen->h,
|
||||
0, 0, SCREEN_W, SCREEN_H);
|
||||
}
|
||||
|
||||
/* jmanager_dispatch_draw_messages(); */
|
||||
}
|
||||
|
||||
/* don't eat CPU... rest some time */
|
||||
@ -688,6 +694,8 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
|
||||
|
||||
case JM_CHAR: {
|
||||
Command *command = command_get_by_key(msg);
|
||||
if (!command)
|
||||
break;
|
||||
|
||||
/* the screen shot is available in everywhere */
|
||||
if (strcmp(command->name, CMD_SCREEN_SHOT) == 0) {
|
||||
@ -710,11 +718,9 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
|
||||
else if (jwindow_is_desktop(child) && child == app_get_top_window()) {
|
||||
/* ok, so we can execute the command represented by the
|
||||
pressed-key in the message... */
|
||||
if (command) {
|
||||
if (command_is_enabled(command, NULL)) {
|
||||
command_execute(command, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
if (command_is_enabled(command, NULL)) {
|
||||
command_execute(command, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -45,10 +45,7 @@ static JWidget recent_list_menuitem;
|
||||
static JWidget layer_popup_menuitem;
|
||||
static JWidget frame_popup_menuitem;
|
||||
static JWidget filters_popup_menuitem;
|
||||
static JWidget accel_menuitem[ACCEL_MAX];
|
||||
|
||||
/* static JAccel read_accel(FILE *f, char *buf, char *leavings, int sizeof_leavings); */
|
||||
/* static JWidget read_menu(FILE *f, char *leavings, int sizeof_leavings); */
|
||||
/* static JWidget accel_menuitem[ACCEL_MAX]; */
|
||||
|
||||
static JWidget convert_xmlelem_to_menu(JXmlElem elem);
|
||||
static JWidget convert_xmlelem_to_menuitem(JXmlElem elem);
|
||||
@ -95,7 +92,12 @@ int load_root_menu(void)
|
||||
filters_popup_menuitem = 0;
|
||||
|
||||
dirs = filename_in_datadir("usergui.xml");
|
||||
dirs_cat_dirs(dirs, filename_in_datadir("defgui.xml"));
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "defgui-%s.xml", intl_get_lang());
|
||||
dirs_cat_dirs(dirs, filename_in_datadir(buf));
|
||||
dirs_cat_dirs(dirs, filename_in_datadir("defgui-en.xml"));
|
||||
}
|
||||
|
||||
for (dir=dirs; dir; dir=dir->next) {
|
||||
PRINTF("Trying to load GUI definition file from \"%s\"...\n", dir->path);
|
||||
@ -200,66 +202,6 @@ int load_root_menu(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* int load_root_menu(void) */
|
||||
/* { */
|
||||
/* char leavings[4096]; */
|
||||
/* char buf[512]; */
|
||||
/* DIRS *dirs, *dir; */
|
||||
/* JWidget menuitem; */
|
||||
/* int ret = -1; */
|
||||
/* FILE *f; */
|
||||
|
||||
/* if (app_get_menu_bar()) */
|
||||
/* jmenubar_set_menu(app_get_menu_bar(), NULL); */
|
||||
|
||||
/* /\* destroy `root-menu' if it exists *\/ */
|
||||
/* if (root_menu) */
|
||||
/* jwidget_free(root_menu); */
|
||||
|
||||
/* /\* create a new empty-menu *\/ */
|
||||
/* root_menu = jmenu_new(); */
|
||||
/* sprite_list_menuitem = 0; */
|
||||
/* recent_list_menuitem = 0; */
|
||||
/* layer_popup_menuitem = 0; */
|
||||
/* frame_popup_menuitem = 0; */
|
||||
/* filters_popup_menuitem = 0; */
|
||||
|
||||
/* sprintf(buf, "menus.%s", intl_get_lang()); */
|
||||
/* dirs = filename_in_datadir(buf); */
|
||||
|
||||
/* for (dir=dirs; dir; dir=dir->next) { */
|
||||
/* /\* open the menu definition file *\/ */
|
||||
/* f = fopen(dir->path, "r"); */
|
||||
/* if (f) { */
|
||||
/* tok_reset_line_num(); */
|
||||
/* strcpy(leavings, ""); */
|
||||
|
||||
/* /\* read other menu *\/ */
|
||||
/* while ((menuitem = read_menu (f, leavings, sizeof (leavings)))) { */
|
||||
/* /\* insert it to the root menu *\/ */
|
||||
/* jwidget_add_child (root_menu, menuitem); */
|
||||
/* } */
|
||||
|
||||
/* /\* close the file *\/ */
|
||||
/* fclose (f); */
|
||||
/* ret = 0; */
|
||||
|
||||
/* break; */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* dirs_free (dirs); */
|
||||
|
||||
/* /\* sets the "menu" of the "menu-bar" to the new "root-menu" *\/ */
|
||||
/* if (app_get_menu_bar ()) { */
|
||||
/* jmenubar_set_menu (app_get_menu_bar (), root_menu); */
|
||||
/* jwindow_remap (app_get_top_window ()); */
|
||||
/* jwidget_dirty (app_get_top_window ()); */
|
||||
/* } */
|
||||
|
||||
/* return ret; */
|
||||
/* } */
|
||||
|
||||
JWidget get_root_menu(void) { return root_menu; }
|
||||
|
||||
JWidget get_sprite_list_menuitem(void) { return sprite_list_menuitem; }
|
||||
@ -267,18 +209,18 @@ JWidget get_recent_list_menuitem(void) { return recent_list_menuitem; }
|
||||
JWidget get_layer_popup_menuitem(void) { return layer_popup_menuitem; }
|
||||
JWidget get_frame_popup_menuitem(void) { return frame_popup_menuitem; }
|
||||
|
||||
int check_for_accel(int accel_type, JMessage msg)
|
||||
{
|
||||
if (accel_menuitem[accel_type]) {
|
||||
JAccel accel = jmenuitem_get_accel(accel_menuitem[accel_type]);
|
||||
if (accel)
|
||||
return jaccel_check(accel,
|
||||
msg->any.shifts,
|
||||
msg->key.ascii,
|
||||
msg->key.scancode);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
/* int check_for_accel(int accel_type, JMessage msg) */
|
||||
/* { */
|
||||
/* if (accel_menuitem[accel_type]) { */
|
||||
/* JAccel accel = jmenuitem_get_accel(accel_menuitem[accel_type]); */
|
||||
/* if (accel) */
|
||||
/* return jaccel_check(accel, */
|
||||
/* msg->any.shifts, */
|
||||
/* msg->key.ascii, */
|
||||
/* msg->key.scancode); */
|
||||
/* } */
|
||||
/* return FALSE; */
|
||||
/* } */
|
||||
|
||||
void show_fx_popup_menu(void)
|
||||
{
|
||||
@ -286,164 +228,10 @@ void show_fx_popup_menu(void)
|
||||
filters_popup_menuitem &&
|
||||
jmenuitem_get_submenu(filters_popup_menuitem)) {
|
||||
jmenu_popup(jmenuitem_get_submenu(filters_popup_menuitem),
|
||||
ji_mouse_x(0),
|
||||
ji_mouse_y(0));
|
||||
jmouse_x(0), jmouse_y(0));
|
||||
}
|
||||
}
|
||||
|
||||
/* static JAccel read_accel(FILE *f, char *buf, char *leavings, int sizeof_leavings) */
|
||||
/* { */
|
||||
/* char keybuf[256]; */
|
||||
/* JAccel accel; */
|
||||
|
||||
/* strcpy (keybuf, ""); */
|
||||
|
||||
/* while (tok_read (f, buf, leavings, sizeof_leavings)) { */
|
||||
/* if (strcmp (buf, ";") == 0) */
|
||||
/* break; */
|
||||
/* else */
|
||||
/* sprintf (keybuf+strlen (keybuf), " %s", buf); */
|
||||
/* } */
|
||||
|
||||
/* accel = jaccel_new (); */
|
||||
/* jaccel_add_keys_from_string (accel, keybuf); */
|
||||
|
||||
/* if (jaccel_is_empty (accel)) { */
|
||||
/* jaccel_free (accel); */
|
||||
/* accel = NULL; */
|
||||
/* } */
|
||||
|
||||
/* return accel; */
|
||||
/* } */
|
||||
|
||||
/* /\* reads a new menu *\/ */
|
||||
/* static JWidget read_menu (FILE *f, char *leavings, int sizeof_leavings) */
|
||||
/* { */
|
||||
/* char buf[1024*4]; */
|
||||
/* int read_to_end; */
|
||||
/* JWidget menuitem; */
|
||||
|
||||
/* /\* read the name of the menu, *\/ */
|
||||
/* if (!tok_read (f, buf, leavings, sizeof_leavings)) */
|
||||
/* /\* no name, end of the file *\/ */
|
||||
/* return 0; */
|
||||
|
||||
/* /\* a separator *\/ */
|
||||
/* if (strcmp (buf, "----") == 0) */
|
||||
/* return ji_separator_new (NULL, JI_HORIZONTAL); */
|
||||
/* /\* close a menu item *\/ */
|
||||
/* else if (strcmp(buf, "}") == 0) */
|
||||
/* return 0; */
|
||||
|
||||
/* /\* create the item *\/ */
|
||||
/* menuitem = menuitem_new(buf, NULL, NULL); */
|
||||
/* if (!menuitem) */
|
||||
/* return 0; */
|
||||
|
||||
/* /\* read next token *\/ */
|
||||
/* tok_read (f, buf, leavings, sizeof_leavings); */
|
||||
/* read_to_end = FALSE; */
|
||||
|
||||
/* /\* could be a menu name *\/ */
|
||||
/* if ((strcmp (buf, "{") != 0) && */
|
||||
/* (strcmp (buf, "=") != 0)) { */
|
||||
/* /\* yes, this token is a menu name... *\/ */
|
||||
|
||||
/* /\* sprite list menu *\/ */
|
||||
/* if (strcmp (buf, "SPRITE_LIST") == 0) { */
|
||||
/* sprite_list_menuitem = menuitem; */
|
||||
/* read_to_end = TRUE; */
|
||||
/* } */
|
||||
/* /\* recent list menu *\/ */
|
||||
/* else if (strcmp (buf, "RECENT_LIST") == 0) { */
|
||||
/* recent_list_menuitem = menuitem; */
|
||||
/* read_to_end = TRUE; */
|
||||
/* } */
|
||||
/* /\* layer popup menu *\/ */
|
||||
/* else if (strcmp (buf, "LAYER_POPUP") == 0) */
|
||||
/* layer_popup_menuitem = menuitem; */
|
||||
/* /\* frame popup menu *\/ */
|
||||
/* else if (strcmp (buf, "FRAME_POPUP") == 0) */
|
||||
/* frame_popup_menuitem = menuitem; */
|
||||
/* /\* filters popup menu *\/ */
|
||||
/* else if (strcmp (buf, "FILTERS_POPUP") == 0) */
|
||||
/* filters_popup_menuitem = menuitem; */
|
||||
/* /\* accelerator keys *\/ */
|
||||
/* else if (strcmp (buf, "UNDO_ACCEL") == 0) */
|
||||
/* accel_menuitem[ACCEL_FOR_UNDO] = menuitem; */
|
||||
/* else if (strcmp (buf, "REDO_ACCEL") == 0) */
|
||||
/* accel_menuitem[ACCEL_FOR_REDO] = menuitem; */
|
||||
/* else if (strcmp (buf, "FILMEDITOR_ACCEL") == 0) */
|
||||
/* accel_menuitem[ACCEL_FOR_FILMEDITOR] = menuitem; */
|
||||
/* else if (strcmp (buf, "SCREENSHOT_ACCEL") == 0) */
|
||||
/* accel_menuitem[ACCEL_FOR_SCREENSHOT] = menuitem; */
|
||||
|
||||
/* /\* read other token *\/ */
|
||||
/* tok_read (f, buf, leavings, sizeof_leavings); */
|
||||
/* } */
|
||||
|
||||
/* /\* sub-menu *\/ */
|
||||
/* if (strcmp (buf, "{") == 0) { */
|
||||
/* JWidget sub_menuitem; */
|
||||
/* JWidget sub_menu; */
|
||||
|
||||
/* /\* create the sub-menu *\/ */
|
||||
/* sub_menu = jmenu_new (); */
|
||||
/* if (!sub_menu) */
|
||||
/* return menuitem; */
|
||||
|
||||
/* jmenuitem_set_submenu (menuitem, sub_menu); */
|
||||
|
||||
/* /\* read other menu *\/ */
|
||||
/* while ((sub_menuitem = read_menu (f, leavings, sizeof_leavings))) { */
|
||||
/* /\* insert it to the root menu *\/ */
|
||||
/* jwidget_add_child (sub_menu, sub_menuitem); */
|
||||
/* } */
|
||||
/* } */
|
||||
/* /\* just a item *\/ */
|
||||
/* else if (strcmp (buf, "=") == 0) { */
|
||||
/* JAccel accel; */
|
||||
|
||||
/* /\* read the check method name *\/ */
|
||||
/* tok_read (f, buf, leavings, sizeof_leavings); */
|
||||
|
||||
/* /\* none *\/ */
|
||||
/* if (strcmp (buf, ";") == 0) */
|
||||
/* return menuitem; */
|
||||
|
||||
/* /\* search the `check' method *\/ */
|
||||
/* menuitem_set_check_method (menuitem, get_check_method (buf)); */
|
||||
|
||||
/* /\* read the command script *\/ */
|
||||
/* tok_read (f, buf, leavings, sizeof_leavings); */
|
||||
/* if (strcmp (buf, ";") == 0) */
|
||||
/* return menuitem; */
|
||||
|
||||
/* menuitem_set_script (menuitem, buf); */
|
||||
|
||||
/* accel = read_accel (f, buf, leavings, sizeof_leavings); */
|
||||
/* if (accel) */
|
||||
/* jmenuitem_set_accel (menuitem, accel); */
|
||||
/* } */
|
||||
/* /\* well... *\/ */
|
||||
/* else if (strcmp (buf, ";") != 0) { */
|
||||
/* /\* Read to end? *\/ */
|
||||
/* if (read_to_end) { */
|
||||
/* /\* Jump all to the next ";" *\/ */
|
||||
/* while (tok_read (f, buf, leavings, sizeof_leavings)) */
|
||||
/* if (strcmp (buf, ";") == 0) */
|
||||
/* break; */
|
||||
/* } */
|
||||
/* /\* invalid syntaxis *\/ */
|
||||
/* else { */
|
||||
/* jwidget_free (menuitem); */
|
||||
/* return 0; */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* return menuitem; */
|
||||
/* } */
|
||||
|
||||
static JWidget convert_xmlelem_to_menu(JXmlElem elem)
|
||||
{
|
||||
JWidget menu = jmenu_new();
|
||||
|
@ -41,7 +41,7 @@ JWidget get_recent_list_menuitem(void);
|
||||
JWidget get_layer_popup_menuitem(void);
|
||||
JWidget get_frame_popup_menuitem(void);
|
||||
|
||||
int check_for_accel(int accel_type, JMessage msg);
|
||||
/* int check_for_accel(int accel_type, JMessage msg); */
|
||||
void show_fx_popup_menu(void);
|
||||
|
||||
#endif /* MODULES_ROOTMENU_H */
|
||||
|
@ -1012,7 +1012,7 @@ void control_tool(JWidget widget, Tool *tool, const char *_color)
|
||||
}
|
||||
|
||||
/* draw the cursor in the screen */
|
||||
editor_draw_cursor(widget, ji_mouse_x(0), ji_mouse_y(0));
|
||||
editor_draw_cursor(widget, jmouse_x(0), jmouse_y(0));
|
||||
|
||||
/* update the state-bar */
|
||||
if (jwidget_is_visible(status_bar)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2001-2005 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -101,13 +101,13 @@ int main (int argc, char *argv[])
|
||||
if (redraw) {
|
||||
redraw = FALSE;
|
||||
|
||||
scare_mouse ();
|
||||
clear (bmp);
|
||||
image_to_allegro (image, bmp, 0, 0);
|
||||
text_mode (0);
|
||||
textout (bmp, font, "R:restore image", 0, 0, 15);
|
||||
blit (bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
|
||||
unscare_mouse ();
|
||||
jmouse_hide();
|
||||
clear(bmp);
|
||||
image_to_allegro(image, bmp, 0, 0);
|
||||
text_mode(0);
|
||||
textout(bmp, font, "R:restore image", 0, 0, 15);
|
||||
blit(bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
|
||||
jmouse_show();
|
||||
}
|
||||
} while (!key[KEY_ESC]);
|
||||
return 0;
|
||||
|
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
xend = mouse_x;
|
||||
yend = mouse_y;
|
||||
|
||||
scare_mouse ();
|
||||
jmouse_hide();
|
||||
|
||||
if (xold >= 0) {
|
||||
xor_mode (TRUE);
|
||||
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
||||
rect (screen, xbeg, ybeg, xold = xend, yold = yend, 0xff);
|
||||
xor_mode (FALSE);
|
||||
|
||||
unscare_mouse ();
|
||||
jmouse_show ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,11 +134,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
scare_mouse ();
|
||||
blit (bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
|
||||
unscare_mouse ();
|
||||
jmouse_hide();
|
||||
blit(bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
|
||||
jmouse_show();
|
||||
|
||||
destroy_bitmap (bmp);
|
||||
destroy_bitmap(bmp);
|
||||
}
|
||||
} while (!key[KEY_ESC]);
|
||||
return 0;
|
||||
|
@ -716,7 +716,6 @@ static int bind_jwidget_hook_signal (lua_State *L)
|
||||
|
||||
#ifndef USE_PRECOMPILED_HEADER
|
||||
|
||||
#include "dialogs/about.h"
|
||||
#include "dialogs/canvasze.h"
|
||||
#include "dialogs/dfrlen.h"
|
||||
#include "dialogs/dmapgen.h"
|
||||
|
@ -97,8 +97,6 @@ JWidget app_get_status_bar(void);
|
||||
JWidget app_get_color_bar(void);
|
||||
JWidget app_get_tool_bar(void);
|
||||
|
||||
void app_switch(JWidget widget);
|
||||
|
||||
/* intl/intl.c */
|
||||
|
||||
void intl_load_lang(void);
|
||||
@ -886,8 +884,6 @@ void jmanager_run(JWidget manager);
|
||||
bool jmanager_poll(JWidget manager, bool all_windows);
|
||||
|
||||
void jmanager_send_message(JMessage msg);
|
||||
void jmanager_dispatch_messages(void);
|
||||
void jmanager_dispatch_draw_messages(void);
|
||||
|
||||
JWidget jmanager_get_focus(void);
|
||||
JWidget jmanager_get_mouse(void);
|
||||
|
@ -525,14 +525,6 @@ static int bind_app_get_tool_bar(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int bind_app_switch(lua_State *L)
|
||||
{
|
||||
JWidget widget;
|
||||
GetUD(1, widget, JWidget);
|
||||
app_switch(widget);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_intl_load_lang(lua_State *L)
|
||||
{
|
||||
intl_load_lang();
|
||||
@ -1393,12 +1385,6 @@ static int bind_set_gfx(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int bind_dialogs_about(lua_State *L)
|
||||
{
|
||||
dialogs_about();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_dialogs_color_curve(lua_State *L)
|
||||
{
|
||||
dialogs_color_curve();
|
||||
@ -1505,24 +1491,6 @@ static int bind_dialogs_vector_map(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_view_tiled(lua_State *L)
|
||||
{
|
||||
view_tiled();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_view_normal(lua_State *L)
|
||||
{
|
||||
view_normal();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_view_fullscreen(lua_State *L)
|
||||
{
|
||||
view_fullscreen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_RenderText(lua_State *L)
|
||||
{
|
||||
Image *return_value;
|
||||
@ -3951,18 +3919,6 @@ static int bind_jmanager_send_message(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_jmanager_dispatch_messages(lua_State *L)
|
||||
{
|
||||
jmanager_dispatch_messages();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_jmanager_dispatch_draw_messages(lua_State *L)
|
||||
{
|
||||
jmanager_dispatch_draw_messages();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bind_jmanager_get_focus(lua_State *L)
|
||||
{
|
||||
JWidget return_value;
|
||||
@ -5763,7 +5719,6 @@ const luaL_reg bindings_routines[] = {
|
||||
{ "app_get_status_bar", bind_app_get_status_bar },
|
||||
{ "app_get_color_bar", bind_app_get_color_bar },
|
||||
{ "app_get_tool_bar", bind_app_get_tool_bar },
|
||||
{ "app_switch", bind_app_switch },
|
||||
{ "intl_load_lang", bind_intl_load_lang },
|
||||
{ "intl_get_lang", bind_intl_get_lang },
|
||||
{ "intl_set_lang", bind_intl_set_lang },
|
||||
@ -5873,7 +5828,6 @@ const luaL_reg bindings_routines[] = {
|
||||
{ "rec_screen_off", bind_rec_screen_off },
|
||||
{ "screen_shot", bind_screen_shot },
|
||||
{ "set_gfx", bind_set_gfx },
|
||||
{ "dialogs_about", bind_dialogs_about },
|
||||
{ "dialogs_color_curve", bind_dialogs_color_curve },
|
||||
{ "dialogs_convolution_matrix", bind_dialogs_convolution_matrix },
|
||||
{ "dialogs_draw_text", bind_dialogs_draw_text },
|
||||
@ -5891,9 +5845,6 @@ const luaL_reg bindings_routines[] = {
|
||||
{ "dialogs_tips", bind_dialogs_tips },
|
||||
{ "dialogs_tools_configuration", bind_dialogs_tools_configuration },
|
||||
{ "dialogs_vector_map", bind_dialogs_vector_map },
|
||||
{ "view_tiled", bind_view_tiled },
|
||||
{ "view_normal", bind_view_normal },
|
||||
{ "view_fullscreen", bind_view_fullscreen },
|
||||
{ "RenderText", bind_RenderText },
|
||||
{ "_rgba_getr", bind__rgba_getr },
|
||||
{ "_rgba_getg", bind__rgba_getg },
|
||||
@ -6116,8 +6067,6 @@ const luaL_reg bindings_routines[] = {
|
||||
{ "jmanager_run", bind_jmanager_run },
|
||||
{ "jmanager_poll", bind_jmanager_poll },
|
||||
{ "jmanager_send_message", bind_jmanager_send_message },
|
||||
{ "jmanager_dispatch_messages", bind_jmanager_dispatch_messages },
|
||||
{ "jmanager_dispatch_draw_messages", bind_jmanager_dispatch_draw_messages },
|
||||
{ "jmanager_get_focus", bind_jmanager_get_focus },
|
||||
{ "jmanager_get_mouse", bind_jmanager_get_mouse },
|
||||
{ "jmanager_get_capture", bind_jmanager_get_capture },
|
||||
@ -6464,14 +6413,6 @@ void register_bindings(lua_State *L)
|
||||
/* Lua -> C */
|
||||
/*======================================================================*/
|
||||
|
||||
void CloseSprite(void)
|
||||
{
|
||||
lua_State *L = get_lua_state();
|
||||
lua_pushstring(L, "CloseSprite");
|
||||
lua_gettable(L, LUA_GLOBALSINDEX);
|
||||
do_script_raw(L, 0, 0);
|
||||
}
|
||||
|
||||
const char *GetUniqueLayerName(void)
|
||||
{
|
||||
lua_State *L = get_lua_state();
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "raster/layer.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
/* sprite.lua */
|
||||
void CloseSprite(void);
|
||||
|
||||
/* layer.lua */
|
||||
const char *GetUniqueLayerName(void);
|
||||
|
||||
|
@ -233,24 +233,24 @@ static bool interactive_transform(JWidget widget,
|
||||
{
|
||||
/* #define UPDATE2() \ */
|
||||
/* jmanager_dispatch_messages (); \ */
|
||||
/* scare_mouse (); \ */
|
||||
/* jmouse_hide(); \ */
|
||||
/* blit (ji_screen, bmp1, vp->x, vp->y, 0, 0, vp->w, vp->h); \ */
|
||||
/* draw_box (ji_screen, vp->x, vp->y, vp->x+vp->w-1, vp->y+vp->h-1, \ */
|
||||
/* x1, y1, x2, y2, preview, mode, angle, cx-vp->x, cy-vp->y); \ */
|
||||
/* update_status_bar (widget, image, x1, y1, x2, y2, angle); \ */
|
||||
/* unscare_mouse (); */
|
||||
/* jmouse_show(); */
|
||||
|
||||
#define UPDATE() \
|
||||
scare_mouse(); \
|
||||
jmouse_hide(); \
|
||||
old_screen = ji_screen; \
|
||||
ji_screen = bmp1; \
|
||||
jmanager_dispatch_draw_messages(); \
|
||||
jmanager_dispatch_messages(); \
|
||||
ji_screen = old_screen; \
|
||||
REDRAW(); \
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
|
||||
#define REDRAW() \
|
||||
scare_mouse(); \
|
||||
jmouse_hide(); \
|
||||
blit(bmp1, bmp2, vp->x1, vp->y1, 0, 0, jrect_w(vp), jrect_h(vp)); \
|
||||
draw_box(bmp2, \
|
||||
0, 0, jrect_w(vp)-1, jrect_h(vp)-1, \
|
||||
@ -258,7 +258,7 @@ static bool interactive_transform(JWidget widget,
|
||||
preview, mode, angle, cx-vp->x1, cy-vp->y1); \
|
||||
blit(bmp2, ji_screen, 0, 0, vp->x1, vp->y1, jrect_w(vp), jrect_h(vp)); \
|
||||
update_status_bar(widget, image, x1, y1, x2, y2, angle); \
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
|
||||
int x1, y1, x2, y2;
|
||||
int u1, v1, u2, v2;
|
||||
@ -282,9 +282,9 @@ static bool interactive_transform(JWidget widget,
|
||||
bmp1 = create_bitmap(JI_SCREEN_W, JI_SCREEN_H);
|
||||
bmp2 = create_bitmap(jrect_w(vp), jrect_h(vp));
|
||||
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
blit(ji_screen, bmp1, 0, 0, 0, 0, JI_SCREEN_W, JI_SCREEN_H);
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
|
||||
/* generate the preview bitmap (for fast-blitting) */
|
||||
preview = create_bitmap(image->w, image->h);
|
||||
@ -337,7 +337,7 @@ static bool interactive_transform(JWidget widget,
|
||||
}
|
||||
|
||||
/* mouse moved */
|
||||
if (ji_mouse_poll()) {
|
||||
if (jmouse_poll()) {
|
||||
int in_left, in_center, in_right;
|
||||
int in_top, in_middle, in_bottom;
|
||||
int in_box;
|
||||
@ -348,63 +348,63 @@ static bool interactive_transform(JWidget widget,
|
||||
x1, y1, x2, y2, angle, cx, cy);
|
||||
|
||||
if (in_box) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
action = ACTION_MOVE;
|
||||
}
|
||||
else {
|
||||
/* top */
|
||||
if (in_top && in_left) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_TL);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_TL);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_TL: ACTION_ROTATE_TL;
|
||||
}
|
||||
else if (in_top && in_center) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_T);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_T);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_T: ACTION_ROTATE_T;
|
||||
}
|
||||
else if (in_top && in_right) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_TR);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_TR);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_TR: ACTION_ROTATE_TR;
|
||||
}
|
||||
/* middle */
|
||||
else if (in_middle && in_left) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_L);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_L);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_L: ACTION_ROTATE_L;
|
||||
}
|
||||
else if (in_middle && in_right) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_R);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_R);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_R: ACTION_ROTATE_R;
|
||||
}
|
||||
/* bottom */
|
||||
else if (in_bottom && in_left) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_BL);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_BL);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_BL: ACTION_ROTATE_BL;
|
||||
}
|
||||
else if (in_bottom && in_center) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_B);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_B);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_B: ACTION_ROTATE_B;
|
||||
}
|
||||
else if (in_bottom && in_right) {
|
||||
ji_mouse_set_cursor(JI_CURSOR_SIZE_BR);
|
||||
jmouse_set_cursor(JI_CURSOR_SIZE_BR);
|
||||
action = mode == SCALE_MODE ? ACTION_SCALE_BR: ACTION_ROTATE_BR;
|
||||
}
|
||||
/* normal */
|
||||
else {
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
action = ACTION_SETMODE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* button pressed */
|
||||
if (ji_mouse_b(0)) {
|
||||
if (jmouse_b(0)) {
|
||||
/* left button+shift || middle button = scroll movement */
|
||||
if ((ji_mouse_b(0) == 1 && (key_shifts & KB_SHIFT_FLAG)) ||
|
||||
(ji_mouse_b(0) == 4)) {
|
||||
if ((jmouse_b(0) == 1 && (key_shifts & KB_SHIFT_FLAG)) ||
|
||||
(jmouse_b(0) == 4)) {
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
int scroll_x, scroll_y;
|
||||
|
||||
x = ji_mouse_x(0) - ji_mouse_x(1);
|
||||
y = ji_mouse_y(0) - ji_mouse_y(1);
|
||||
x = jmouse_x(0) - jmouse_x(1);
|
||||
y = jmouse_y(0) - jmouse_y(1);
|
||||
|
||||
/* screen_to_editor (widget, x1, y1, &x1, &y1); */
|
||||
/* screen_to_editor (widget, x2, y2, &x2, &y2); */
|
||||
@ -417,7 +417,7 @@ static bool interactive_transform(JWidget widget,
|
||||
/* editor_to_screen (widget, x1, y1, &x1, &y1); */
|
||||
/* editor_to_screen (widget, x2, y2, &x2, &y2); */
|
||||
|
||||
ji_mouse_control_infinite_scroll(vp);
|
||||
jmouse_control_infinite_scroll(vp);
|
||||
|
||||
jwidget_dirty(view);
|
||||
jwidget_flush_redraw(view);
|
||||
@ -444,7 +444,7 @@ static bool interactive_transform(JWidget widget,
|
||||
/* x2 += cx - ncx; */
|
||||
/* y2 += cy - ncy; */
|
||||
|
||||
/* scare_mouse (); */
|
||||
/* jmouse_hide(); */
|
||||
/* blit (bmp1, bmp2, 0, 0, 0, 0, vp->w, vp->h); */
|
||||
/* draw_box (bmp2, */
|
||||
/* 0, 0, vp->w-1, vp->h-1, */
|
||||
@ -452,11 +452,11 @@ static bool interactive_transform(JWidget widget,
|
||||
/* preview, mode, angle, cx-vp->x, cy-vp->y); */
|
||||
/* blit (bmp2, ji_screen, 0, 0, vp->x, vp->y, vp->w, vp->h); */
|
||||
/* update_status_bar (widget, image, x1, y1, x2, y2, angle); */
|
||||
/* unscare_mouse (); */
|
||||
/* jmouse_show(); */
|
||||
/* } */
|
||||
}
|
||||
/* right button = paste */
|
||||
else if (ji_mouse_b(0) == 2) {
|
||||
else if (jmouse_b(0) == 2) {
|
||||
done = DONE_PASTE; /* paste */
|
||||
}
|
||||
/* change mode */
|
||||
@ -466,17 +466,17 @@ static bool interactive_transform(JWidget widget,
|
||||
|
||||
do {
|
||||
poll_keyboard();
|
||||
ji_mouse_poll();
|
||||
jmouse_poll();
|
||||
gui_feedback();
|
||||
} while (ji_mouse_b(0));
|
||||
} while (jmouse_b(0));
|
||||
}
|
||||
/* modify selection */
|
||||
else {
|
||||
int mx = ji_mouse_x(0);
|
||||
int my = ji_mouse_y(0);
|
||||
int mx = jmouse_x(0);
|
||||
int my = jmouse_y(0);
|
||||
fixed angle1 = angle;
|
||||
fixed angle2 = fixatan2(itofix(ji_mouse_y(0)-cy),
|
||||
itofix(ji_mouse_x(0)-cx));
|
||||
fixed angle2 = fixatan2(itofix(jmouse_y(0)-cy),
|
||||
itofix(jmouse_x(0)-cx));
|
||||
angle2 = fixsub(0, angle2);
|
||||
|
||||
u1 = x1;
|
||||
@ -486,18 +486,18 @@ static bool interactive_transform(JWidget widget,
|
||||
|
||||
do {
|
||||
poll_keyboard();
|
||||
if (ji_mouse_poll()) {
|
||||
if (jmouse_poll()) {
|
||||
|
||||
if (action == ACTION_MOVE) {
|
||||
x = ji_mouse_x(0) - mx;
|
||||
y = ji_mouse_y(0) - my;
|
||||
x = jmouse_x(0) - mx;
|
||||
y = jmouse_y(0) - my;
|
||||
}
|
||||
else if (action >= ACTION_SCALE_TL &&
|
||||
action <= ACTION_SCALE_BR) {
|
||||
x = fixtoi(fixmul(itofix(ji_mouse_x(0) - mx), fixcos(angle)))
|
||||
+ fixtoi(fixmul(itofix(ji_mouse_y(0) - my),-fixsin(angle)));
|
||||
y = fixtoi(fixmul(itofix(ji_mouse_x(0) - mx), fixsin(angle)))
|
||||
+ fixtoi(fixmul(itofix(ji_mouse_y(0) - my), fixcos(angle)));
|
||||
x = fixtoi(fixmul(itofix(jmouse_x(0) - mx), fixcos(angle)))
|
||||
+ fixtoi(fixmul(itofix(jmouse_y(0) - my),-fixsin(angle)));
|
||||
y = fixtoi(fixmul(itofix(jmouse_x(0) - mx), fixsin(angle)))
|
||||
+ fixtoi(fixmul(itofix(jmouse_y(0) - my), fixcos(angle)));
|
||||
}
|
||||
else
|
||||
x = y = 0;
|
||||
@ -552,8 +552,8 @@ static bool interactive_transform(JWidget widget,
|
||||
case ACTION_ROTATE_BL:
|
||||
case ACTION_ROTATE_B:
|
||||
case ACTION_ROTATE_BR:
|
||||
angle = fixatan2(itofix(ji_mouse_y(0)-cy),
|
||||
itofix(ji_mouse_x(0)-cx));
|
||||
angle = fixatan2(itofix(jmouse_y(0)-cy),
|
||||
itofix(jmouse_x(0)-cx));
|
||||
angle &= 255<<16;
|
||||
angle = fixsub(0, angle);
|
||||
|
||||
@ -580,7 +580,7 @@ static bool interactive_transform(JWidget widget,
|
||||
}
|
||||
|
||||
gui_feedback();
|
||||
} while (ji_mouse_b(0));
|
||||
} while (jmouse_b(0));
|
||||
|
||||
/* recenter the pivot (cx, cy) */
|
||||
{
|
||||
@ -778,8 +778,8 @@ static void fill_in_vars(int *in_box,
|
||||
int cx, int cy)
|
||||
{
|
||||
MATRIX m;
|
||||
int mx = ji_mouse_x (0);
|
||||
int my = ji_mouse_y (0);
|
||||
int mx = jmouse_x(0);
|
||||
int my = jmouse_y(0);
|
||||
fixed fx, fy, fz;
|
||||
|
||||
get_rotation_matrix (&m, 0, 0, fixsub (0, angle));
|
||||
@ -802,11 +802,11 @@ static void update_status_bar(JWidget editor, Image *image,
|
||||
int u1, v1, u2, v2;
|
||||
int iangle = 360*(fixtoi (angle & (255<<16)))/256;
|
||||
|
||||
screen_to_editor (editor, x1, y1, &u1, &v1);
|
||||
screen_to_editor (editor, x2, y2, &u2, &v2);
|
||||
screen_to_editor(editor, x1, y1, &u1, &v1);
|
||||
screen_to_editor(editor, x2, y2, &u2, &v2);
|
||||
|
||||
status_bar_set_text
|
||||
(app_get_status_bar (), 0,
|
||||
(app_get_status_bar(), 0,
|
||||
"Pos: %3d %3d Size: %3d %3d Orig: %3d %3d (%.02f%% %.02f%%) Angle: %3d",
|
||||
u1, v1, u2-u1, v2-v1,
|
||||
image->w, image->h,
|
||||
@ -814,6 +814,6 @@ static void update_status_bar(JWidget editor, Image *image,
|
||||
(double)(v2-v1)*100/image->h,
|
||||
iangle);
|
||||
|
||||
jwidget_flush_redraw (app_get_status_bar ());
|
||||
jmanager_dispatch_messages ();
|
||||
jwidget_flush_redraw(app_get_status_bar());
|
||||
jmanager_dispatch_messages();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2001-2005 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -291,10 +291,10 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
|
||||
delay = MID (0, delay, 1000);
|
||||
delay = JI_TICKS_PER_SEC * delay / 1000;
|
||||
|
||||
hide_drawing_cursor (editor);
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
hide_drawing_cursor(editor);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
|
||||
editor_click_start (editor, mode, &start_x, &start_y, &start_b);
|
||||
editor_click_start(editor, mode, &start_x, &start_y, &start_b);
|
||||
|
||||
do {
|
||||
if (update) {
|
||||
@ -302,21 +302,21 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
|
||||
frame->y = begin_y - start_y + new_y;
|
||||
|
||||
/* update layer-bounds */
|
||||
scare_mouse ();
|
||||
editor_update_layer_boundary (editor);
|
||||
editor_draw_layer_boundary_safe (editor);
|
||||
unscare_mouse ();
|
||||
jmouse_hide();
|
||||
editor_update_layer_boundary(editor);
|
||||
editor_draw_layer_boundary_safe(editor);
|
||||
jmouse_show();
|
||||
|
||||
/* update status bar */
|
||||
status_bar_set_text
|
||||
(app_get_status_bar (), 0,
|
||||
(app_get_status_bar(), 0,
|
||||
"Pos %3d %3d Offset %3d %3d",
|
||||
(int)frame->x,
|
||||
(int)frame->y,
|
||||
(int)(frame->x - begin_x),
|
||||
(int)(frame->y - begin_y));
|
||||
jwidget_flush_redraw (app_get_status_bar ());
|
||||
jmanager_dispatch_messages ();
|
||||
jwidget_flush_redraw(app_get_status_bar());
|
||||
jmanager_dispatch_messages();
|
||||
|
||||
/* update clock */
|
||||
quiet_clock = ji_clock;
|
||||
@ -325,7 +325,7 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
|
||||
|
||||
/* call the user's routine */
|
||||
if (callback) {
|
||||
if ((*callback) ())
|
||||
if ((*callback)())
|
||||
quiet_clock = delay;
|
||||
}
|
||||
|
||||
@ -333,28 +333,28 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
|
||||
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 ();
|
||||
jwidget_dirty(editor);
|
||||
jwidget_flush_redraw(editor);
|
||||
jmanager_dispatch_messages();
|
||||
}
|
||||
|
||||
gui_feedback ();
|
||||
} while (editor_click (editor, &new_x, &new_y, &update, NULL));
|
||||
gui_feedback();
|
||||
} while (editor_click(editor, &new_x, &new_y, &update, NULL));
|
||||
|
||||
/* the position was changed */
|
||||
if (!editor_click_cancel (editor)) {
|
||||
if (use_undo && undo_is_enabled (sprite->undo)) {
|
||||
if (!editor_click_cancel(editor)) {
|
||||
if (use_undo && undo_is_enabled(sprite->undo)) {
|
||||
new_x = frame->x;
|
||||
new_y = frame->y;
|
||||
|
||||
undo_open (sprite->undo);
|
||||
undo_open(sprite->undo);
|
||||
frame->x = begin_x;
|
||||
frame->y = begin_y;
|
||||
undo_int (sprite->undo, (GfxObj *)frame, &frame->x);
|
||||
undo_int (sprite->undo, (GfxObj *)frame, &frame->y);
|
||||
undo_int(sprite->undo, (GfxObj *)frame, &frame->x);
|
||||
undo_int(sprite->undo, (GfxObj *)frame, &frame->y);
|
||||
frame->x = new_x;
|
||||
frame->y = new_y;
|
||||
undo_close (sprite->undo);
|
||||
undo_close(sprite->undo);
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
@ -371,9 +371,9 @@ int interactive_move_layer (int mode, int use_undo, int (*callback) (void))
|
||||
GUI_Refresh(sprite);
|
||||
|
||||
/* restore the cursor */
|
||||
show_drawing_cursor (editor);
|
||||
show_drawing_cursor(editor);
|
||||
|
||||
editor_click_done (editor);
|
||||
editor_click_done(editor);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ void rec_screen_on(void)
|
||||
old_bmp = NULL;
|
||||
|
||||
/* set the position of the mouse in the center of the screen */
|
||||
ji_mouse_set_position (JI_SCREEN_W/2, JI_SCREEN_H/2);
|
||||
jmouse_set_position(JI_SCREEN_W/2, JI_SCREEN_H/2);
|
||||
|
||||
/* start the clock */
|
||||
rec_clock = ji_clock;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2001-2005 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -386,19 +386,19 @@ static bool color_bar_msg_proc (JWidget widget, JMessage msg)
|
||||
const char *src;
|
||||
char *dst;
|
||||
|
||||
while (ji_mouse_b (0))
|
||||
ji_mouse_poll ();
|
||||
while (jmouse_b(0))
|
||||
jmouse_poll();
|
||||
|
||||
/* get the color from the table */
|
||||
src = color_bar_get_color (widget, num);
|
||||
src = color_bar_get_color(widget, num);
|
||||
|
||||
/* change this color with the color-select dialog */
|
||||
dst = ji_color_select (app_get_current_image_type (), src);
|
||||
dst = ji_color_select(app_get_current_image_type(), src);
|
||||
|
||||
/* set the color of the table */
|
||||
if (dst) {
|
||||
color_bar_set_color (widget, num, dst, FALSE);
|
||||
jfree (dst);
|
||||
color_bar_set_color(widget, num, dst, FALSE);
|
||||
jfree(dst);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2001-2005 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -172,8 +172,8 @@ static bool curve_editor_msg_proc (JWidget widget, JMessage msg)
|
||||
switch (msg->key.scancode) {
|
||||
|
||||
case KEY_INSERT: {
|
||||
int x = SCR2EDIT_X (ji_mouse_x (0));
|
||||
int y = SCR2EDIT_Y (ji_mouse_y (0));
|
||||
int x = SCR2EDIT_X (jmouse_x(0));
|
||||
int y = SCR2EDIT_Y (jmouse_y(0));
|
||||
CurvePoint *point = curve_point_new (x, y);
|
||||
|
||||
/* XXXX undo? */
|
||||
@ -187,12 +187,12 @@ static bool curve_editor_msg_proc (JWidget widget, JMessage msg)
|
||||
case KEY_DEL: {
|
||||
CurvePoint *point = curve_editor_get_more_close_point
|
||||
(widget,
|
||||
SCR2EDIT_X (ji_mouse_x (0)),
|
||||
SCR2EDIT_Y (ji_mouse_y (0)),
|
||||
SCR2EDIT_X(jmouse_x(0)),
|
||||
SCR2EDIT_Y(jmouse_y(0)),
|
||||
NULL, NULL);
|
||||
|
||||
/* XXXX undo? */
|
||||
curve_remove_point (curve_editor->curve, point);
|
||||
curve_remove_point(curve_editor->curve, point);
|
||||
|
||||
jwidget_dirty (widget);
|
||||
jwidget_emit_signal (widget, SIGNAL_CURVE_EDITOR_CHANGE);
|
||||
@ -269,12 +269,12 @@ static bool curve_editor_msg_proc (JWidget widget, JMessage msg)
|
||||
/* change scroll */
|
||||
if (msg->any.shifts & KB_SHIFT_FLAG) {
|
||||
curve_editor->status = STATUS_SCROLLING;
|
||||
ji_mouse_set_cursor (JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
}
|
||||
/* scaling */
|
||||
/* else if (msg->shifts & KB_CTRL_FLAG) { */
|
||||
/* curve_editor->status = STATUS_SCALING; */
|
||||
/* ji_mouse_set_cursor (JI_CURSOR_MOVE); */
|
||||
/* jmouse_set_cursor(JI_CURSOR_MOVE); */
|
||||
/* } */
|
||||
/* show manual-entry dialog */
|
||||
else if (msg->mouse.right) {
|
||||
@ -306,7 +306,7 @@ static bool curve_editor_msg_proc (JWidget widget, JMessage msg)
|
||||
&curve_editor->edit_y);
|
||||
|
||||
curve_editor->status = STATUS_MOVING_POINT;
|
||||
ji_mouse_set_cursor(JI_CURSOR_HAND);
|
||||
jmouse_set_cursor(JI_CURSOR_HAND);
|
||||
}
|
||||
|
||||
jwidget_capture_mouse(widget);
|
||||
@ -321,12 +321,12 @@ static bool curve_editor_msg_proc (JWidget widget, JMessage msg)
|
||||
JRect vp = jview_get_viewport_position (view);
|
||||
int scroll_x, scroll_y;
|
||||
|
||||
jview_get_scroll (view, &scroll_x, &scroll_y);
|
||||
jview_set_scroll (view,
|
||||
scroll_x+ji_mouse_x (1)-ji_mouse_x (0),
|
||||
scroll_y+ji_mouse_y (1)-ji_mouse_y (0));
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
jview_set_scroll(view,
|
||||
scroll_x+jmouse_x(1)-jmouse_x(0),
|
||||
scroll_y+jmouse_y(1)-jmouse_y(0));
|
||||
|
||||
ji_mouse_control_infinite_scroll (vp);
|
||||
jmouse_control_infinite_scroll(vp);
|
||||
jrect_free (vp);
|
||||
break;
|
||||
}
|
||||
@ -342,7 +342,7 @@ static bool curve_editor_msg_proc (JWidget widget, JMessage msg)
|
||||
/* scroll_x-(vp.x+vp.w/2), */
|
||||
/* scroll_y-(vp.y+vp.h/2)); */
|
||||
|
||||
/* ji_mouse_control_infinite_scroll (vp.x, vp.y, vp.w, vp.h); */
|
||||
/* jmouse_control_infinite_scroll(vp.x, vp.y, vp.w, vp.h); */
|
||||
/* break; */
|
||||
/* } */
|
||||
|
||||
@ -400,19 +400,19 @@ static bool curve_editor_msg_proc (JWidget widget, JMessage msg)
|
||||
switch (curve_editor->status) {
|
||||
|
||||
case STATUS_SCROLLING:
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
break;
|
||||
|
||||
/* case STATUS_SCALING: */
|
||||
/* ji_mouse_set_cursor (JI_CURSOR_NORMAL); */
|
||||
/* jmouse_set_cursor(JI_CURSOR_NORMAL); */
|
||||
/* break; */
|
||||
|
||||
case STATUS_MOVING_POINT:
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jwidget_emit_signal (widget, SIGNAL_CURVE_EDITOR_CHANGE);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jwidget_emit_signal(widget, SIGNAL_CURVE_EDITOR_CHANGE);
|
||||
|
||||
curve_editor->edit_point = NULL;
|
||||
jwidget_dirty (widget);
|
||||
jwidget_dirty(widget);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ typedef struct Editor
|
||||
int cursor_editor_y;
|
||||
|
||||
/* for the mouse */
|
||||
unsigned retarded_mouseenter : 1;
|
||||
unsigned lagged_mouseenter : 1;
|
||||
|
||||
/* offset for the sprite */
|
||||
int offset_x;
|
||||
|
@ -56,9 +56,9 @@ void editor_click_start(JWidget widget, int mode, int *x, int *y, int *b)
|
||||
click_mode = mode;
|
||||
click_first = TRUE;
|
||||
|
||||
click_start_x = click_last_x = ji_mouse_x(0);
|
||||
click_start_y = click_last_y = ji_mouse_y(0);
|
||||
click_start_b = click_last_b = ji_mouse_b(0) ? ji_mouse_b(0): 1;
|
||||
click_start_x = click_last_x = jmouse_x(0);
|
||||
click_start_y = click_last_y = jmouse_y(0);
|
||||
click_start_b = click_last_b = jmouse_b(0) ? jmouse_b(0): 1;
|
||||
|
||||
click_prev_last_b = click_last_b;
|
||||
|
||||
@ -85,25 +85,25 @@ int editor_click(JWidget widget, int *x, int *y, int *update,
|
||||
|
||||
if (click_mode == MODE_CLICKANDCLICK) {
|
||||
do {
|
||||
ji_mouse_poll();
|
||||
jmouse_poll();
|
||||
gui_feedback();
|
||||
} while (ji_mouse_b(0));
|
||||
} while (jmouse_b(0));
|
||||
|
||||
ji_mouse_set_position(click_start_x, click_start_y);
|
||||
jmouse_set_position(click_start_x, click_start_y);
|
||||
clear_keybuf();
|
||||
}
|
||||
}
|
||||
|
||||
*update = ji_mouse_poll();
|
||||
*update = jmouse_poll();
|
||||
|
||||
if (!editor_cursor_is_subpixel(widget))
|
||||
screen_to_editor(widget, click_last_x, click_last_y, &prev_x, &prev_y);
|
||||
|
||||
click_prev_last_b = click_last_b;
|
||||
|
||||
click_last_x = ji_mouse_x(0);
|
||||
click_last_y = ji_mouse_y(0);
|
||||
click_last_b = ji_mouse_b(0);
|
||||
click_last_x = jmouse_x(0);
|
||||
click_last_y = jmouse_y(0);
|
||||
click_last_b = jmouse_b(0);
|
||||
|
||||
screen_to_editor(widget, click_last_x, click_last_y, x, y);
|
||||
|
||||
@ -113,7 +113,7 @@ int editor_click(JWidget widget, int *x, int *y, int *update,
|
||||
JRect vp = jview_get_viewport_position(view);
|
||||
|
||||
/* update scroll */
|
||||
if (ji_mouse_control_infinite_scroll(vp)) {
|
||||
if (jmouse_control_infinite_scroll(vp)) {
|
||||
int scroll_x, scroll_y;
|
||||
|
||||
if (scroll_callback)
|
||||
@ -121,27 +121,27 @@ int editor_click(JWidget widget, int *x, int *y, int *update,
|
||||
|
||||
/* smooth scroll movement */
|
||||
if (get_config_bool("Options", "MoveSmooth", TRUE)) {
|
||||
ji_mouse_set_position(MID(vp->x1+1, click_last_x, vp->x2-2),
|
||||
MID(vp->y1+1, click_last_y, vp->y2-2));
|
||||
jmouse_set_position(MID(vp->x1+1, click_last_x, vp->x2-2),
|
||||
MID(vp->y1+1, click_last_y, vp->y2-2));
|
||||
}
|
||||
/* this is better for high resolutions: scroll movement by big steps */
|
||||
else {
|
||||
ji_mouse_set_position((click_last_x != ji_mouse_x(0)) ?
|
||||
(click_last_x + (vp->x1+vp->x2)/2)/2: ji_mouse_x(0),
|
||||
jmouse_set_position((click_last_x != jmouse_x(0)) ?
|
||||
(click_last_x + (vp->x1+vp->x2)/2)/2: jmouse_x(0),
|
||||
|
||||
(click_last_y != ji_mouse_y(0)) ?
|
||||
(click_last_y + (vp->y1+vp->y2)/2)/2: ji_mouse_y(0));
|
||||
(click_last_y != jmouse_y(0)) ?
|
||||
(click_last_y + (vp->y1+vp->y2)/2)/2: jmouse_y(0));
|
||||
}
|
||||
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
editor_set_scroll(widget,
|
||||
scroll_x+click_last_x-ji_mouse_x(0),
|
||||
scroll_y+click_last_y-ji_mouse_y(0), TRUE);
|
||||
scroll_x+click_last_x-jmouse_x(0),
|
||||
scroll_y+click_last_y-jmouse_y(0), TRUE);
|
||||
|
||||
/* editor_refresh_region(widget); */
|
||||
|
||||
click_last_x = ji_mouse_x(0);
|
||||
click_last_y = ji_mouse_y(0);
|
||||
click_last_x = jmouse_x(0);
|
||||
click_last_y = jmouse_y(0);
|
||||
|
||||
if (scroll_callback)
|
||||
(*scroll_callback)(FALSE);
|
||||
@ -166,11 +166,11 @@ int editor_click(JWidget widget, int *x, int *y, int *update,
|
||||
click_prev_last_b = click_last_b;
|
||||
|
||||
do {
|
||||
ji_mouse_poll();
|
||||
jmouse_poll();
|
||||
gui_feedback();
|
||||
} while (ji_mouse_b(0));
|
||||
} while (jmouse_b(0));
|
||||
|
||||
ji_mouse_set_position(click_last_x, click_last_y);
|
||||
jmouse_set_position(click_last_x, click_last_y);
|
||||
clear_keybuf();
|
||||
|
||||
return FALSE;
|
||||
@ -185,7 +185,7 @@ int editor_click(JWidget widget, int *x, int *y, int *update,
|
||||
}
|
||||
}
|
||||
|
||||
int editor_click_cancel (JWidget widget)
|
||||
int editor_click_cancel(JWidget widget)
|
||||
{
|
||||
return (click_start_b != click_prev_last_b);
|
||||
}
|
||||
|
@ -125,12 +125,12 @@ Sprite *editor_get_sprite(JWidget widget)
|
||||
return editor_data(widget)->sprite;
|
||||
}
|
||||
|
||||
void editor_set_sprite (JWidget widget, Sprite *sprite)
|
||||
void editor_set_sprite(JWidget widget, Sprite *sprite)
|
||||
{
|
||||
Editor *editor = editor_data (widget);
|
||||
|
||||
if (jwidget_has_mouse (widget))
|
||||
jmanager_free_mouse ();
|
||||
if (jwidget_has_mouse(widget))
|
||||
jmanager_free_mouse();
|
||||
|
||||
editor->sprite = sprite;
|
||||
if (editor->sprite) {
|
||||
@ -147,7 +147,7 @@ void editor_set_sprite (JWidget widget, Sprite *sprite)
|
||||
editor_set_scroll(widget, 0, 0, FALSE);
|
||||
}
|
||||
|
||||
jwidget_dirty (widget);
|
||||
jwidget_dirty(widget);
|
||||
}
|
||||
|
||||
/* sets the scroll position of the editor */
|
||||
@ -159,8 +159,9 @@ void editor_set_scroll(JWidget widget, int x, int y, int use_refresh_region)
|
||||
JRegion region = NULL;
|
||||
int thick = editor->cursor_thick;
|
||||
|
||||
if (thick)
|
||||
if (thick) {
|
||||
editor_clean_cursor(widget);
|
||||
}
|
||||
|
||||
if (use_refresh_region) {
|
||||
region = jwidget_get_drawable_region(widget, JI_GDR_CUTTOPWINDOWS);
|
||||
@ -195,7 +196,7 @@ void editor_set_scroll(JWidget widget, int x, int y, int use_refresh_region)
|
||||
nrects = JI_REGION_NUM_RECTS(reg2);
|
||||
|
||||
if (!thick)
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
|
||||
/* blit directly screen to screen *************************************/
|
||||
if (is_linear_bitmap(ji_screen) && nrects == 1) {
|
||||
@ -231,7 +232,7 @@ void editor_set_scroll(JWidget widget, int x, int y, int use_refresh_region)
|
||||
}
|
||||
/**********************************************************************/
|
||||
if (!thick)
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
|
||||
/* if (editor->refresh_region) */
|
||||
/* jregion_free(editor->refresh_region); */
|
||||
@ -261,14 +262,11 @@ void editor_set_scroll(JWidget widget, int x, int y, int use_refresh_region)
|
||||
/* } */
|
||||
|
||||
if (thick) {
|
||||
/* int x, y; */
|
||||
/* editor_to_screen(widget, editor->cursor_x, editor->cursor_y, &x, &y); */
|
||||
/* editor_draw_cursor(widget, x, y); */
|
||||
editor_draw_cursor(widget, editor->cursor_screen_x, editor->cursor_screen_y);
|
||||
}
|
||||
}
|
||||
|
||||
void editor_update (JWidget widget)
|
||||
void editor_update(JWidget widget)
|
||||
{
|
||||
JWidget view = jwidget_get_view(widget);
|
||||
|
||||
@ -385,21 +383,21 @@ void editor_draw_sprite(JWidget widget, int x1, int y1, int x2, int y2)
|
||||
|
||||
if (rendered) {
|
||||
#ifdef DRAWSPRITE_DOUBLEBUFFERED
|
||||
BITMAP *bmp = create_bitmap (width, height);
|
||||
BITMAP *bmp = create_bitmap(width, height);
|
||||
|
||||
use_current_sprite_rgb_map ();
|
||||
image_to_allegro (rendered, bmp, 0, 0);
|
||||
blit (bmp, ji_screen, 0, 0, dest_x, dest_y, width, height);
|
||||
restore_rgb_map ();
|
||||
use_current_sprite_rgb_map();
|
||||
image_to_allegro(rendered, bmp, 0, 0);
|
||||
blit(bmp, ji_screen, 0, 0, dest_x, dest_y, width, height);
|
||||
restore_rgb_map();
|
||||
|
||||
image_free (rendered);
|
||||
destroy_bitmap (bmp);
|
||||
image_free(rendered);
|
||||
destroy_bitmap(bmp);
|
||||
#else
|
||||
use_current_sprite_rgb_map ();
|
||||
image_to_allegro (rendered, ji_screen, dest_x, dest_y);
|
||||
restore_rgb_map ();
|
||||
use_current_sprite_rgb_map();
|
||||
image_to_allegro(rendered, ji_screen, dest_x, dest_y);
|
||||
restore_rgb_map();
|
||||
|
||||
image_free (rendered);
|
||||
image_free(rendered);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -506,7 +504,7 @@ void editor_draw_mask_safe(JWidget widget)
|
||||
if (thick)
|
||||
editor_clean_cursor(widget);
|
||||
else
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
|
||||
for (c=0, rc=JI_REGION_RECTS(region);
|
||||
c<nrects;
|
||||
@ -525,13 +523,10 @@ void editor_draw_mask_safe(JWidget widget)
|
||||
|
||||
/* draw the cursor */
|
||||
if (thick) {
|
||||
/* int x, y; */
|
||||
/* editor_to_screen(widget, editor->cursor_x, editor->cursor_y, &x, &y); */
|
||||
/* editor_draw_cursor(widget, x, y); */
|
||||
editor_draw_cursor(widget, editor->cursor_screen_x, editor->cursor_screen_y);
|
||||
}
|
||||
else
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
|
||||
release_bitmap(ji_screen);
|
||||
|
||||
@ -704,17 +699,17 @@ void editor_draw_path(JWidget widget, int draw_extras)
|
||||
node = it->data;
|
||||
|
||||
if (node->p) {
|
||||
editor_to_screen (widget, node->px, node->py, &x1, &y1);
|
||||
editor_to_screen (widget, node->x, node->y, &x2, &y2);
|
||||
editor_to_screen(widget, node->px, node->py, &x1, &y1);
|
||||
editor_to_screen(widget, node->x, node->y, &x2, &y2);
|
||||
|
||||
line (ji_screen, x1, y1, x2, y2, extras_color);
|
||||
line(ji_screen, x1, y1, x2, y2, extras_color);
|
||||
}
|
||||
|
||||
if (node->n) {
|
||||
editor_to_screen (widget, node->x, node->y, &x1, &y1);
|
||||
editor_to_screen (widget, node->nx, node->ny, &x2, &y2);
|
||||
editor_to_screen(widget, node->x, node->y, &x1, &y1);
|
||||
editor_to_screen(widget, node->nx, node->ny, &x2, &y2);
|
||||
|
||||
line (ji_screen, x1, y1, x2, y2, extras_color);
|
||||
line(ji_screen, x1, y1, x2, y2, extras_color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -723,13 +718,13 @@ void editor_draw_path(JWidget widget, int draw_extras)
|
||||
node = it->data;
|
||||
|
||||
if (node->p) {
|
||||
editor_to_screen (widget, node->px, node->py, &x1, &y1);
|
||||
rectfill (ji_screen, x1-1, y1-1, x1, y1, extras_color);
|
||||
editor_to_screen(widget, node->px, node->py, &x1, &y1);
|
||||
rectfill(ji_screen, x1-1, y1-1, x1, y1, extras_color);
|
||||
}
|
||||
|
||||
if (node->n) {
|
||||
editor_to_screen (widget, node->nx, node->ny, &x1, &y1);
|
||||
rectfill (ji_screen, x1-1, y1-1, x1, y1, extras_color);
|
||||
editor_to_screen(widget, node->nx, node->ny, &x1, &y1);
|
||||
rectfill(ji_screen, x1-1, y1-1, x1, y1, extras_color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -737,8 +732,8 @@ void editor_draw_path(JWidget widget, int draw_extras)
|
||||
for (it=sprite->path->nodes; it; it=it->next) {
|
||||
node = it->data;
|
||||
|
||||
editor_to_screen (widget, node->x, node->y, &x1, &y1);
|
||||
rectfill (ji_screen, x1-1, y1-1, x1+1, y1+1, extras_color);
|
||||
editor_to_screen(widget, node->x, node->y, &x1, &y1);
|
||||
rectfill(ji_screen, x1-1, y1-1, x1+1, y1+1, extras_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -794,32 +789,32 @@ void editor_to_screen(JWidget widget, int xin, int yin, int *xout, int *yout)
|
||||
|
||||
void show_drawing_cursor(JWidget widget)
|
||||
{
|
||||
ji_mouse_set_cursor (JI_CURSOR_NULL);
|
||||
jmouse_set_cursor(JI_CURSOR_NULL);
|
||||
|
||||
if (!editor_data (widget)->cursor_thick) {
|
||||
scare_mouse();
|
||||
editor_draw_cursor(widget, ji_mouse_x(0), ji_mouse_y(0));
|
||||
unscare_mouse();
|
||||
if (!editor_data(widget)->cursor_thick) {
|
||||
jmouse_hide();
|
||||
editor_draw_cursor(widget, jmouse_x(0), jmouse_y(0));
|
||||
jmouse_show();
|
||||
}
|
||||
}
|
||||
|
||||
void hide_drawing_cursor(JWidget widget)
|
||||
{
|
||||
if (editor_data (widget)->cursor_thick) {
|
||||
scare_mouse ();
|
||||
editor_clean_cursor (widget);
|
||||
unscare_mouse ();
|
||||
if (editor_data(widget)->cursor_thick) {
|
||||
jmouse_hide();
|
||||
editor_clean_cursor(widget);
|
||||
jmouse_show();
|
||||
}
|
||||
|
||||
ji_mouse_set_cursor (JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
}
|
||||
|
||||
void editor_update_status_bar_for_standby(JWidget widget)
|
||||
{
|
||||
Editor *editor = editor_data (widget);
|
||||
Editor *editor = editor_data(widget);
|
||||
int x, y;
|
||||
|
||||
screen_to_editor (widget, ji_mouse_x (0), ji_mouse_y (0), &x, &y);
|
||||
screen_to_editor (widget, jmouse_x(0), jmouse_y(0), &x, &y);
|
||||
|
||||
status_bar_set_text (app_get_status_bar (), 0,
|
||||
"%s %3d %3d (%s %3d %3d) [%s %d]",
|
||||
@ -846,7 +841,7 @@ void editor_refresh_region(JWidget widget)
|
||||
if (thick)
|
||||
editor_clean_cursor(widget);
|
||||
else
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
|
||||
/* XXXX check if this work!!!! */
|
||||
/* jwidget_redraw_region */
|
||||
@ -862,13 +857,10 @@ void editor_refresh_region(JWidget widget)
|
||||
/* } */
|
||||
|
||||
if (thick) {
|
||||
/* int x, y; */
|
||||
/* editor_to_screen(widget, editor->cursor_x, editor->cursor_y, &x, &y); */
|
||||
/* editor_draw_cursor(widget, x, y); */
|
||||
editor_draw_cursor(widget, editor->cursor_screen_x, editor->cursor_screen_y);
|
||||
}
|
||||
else
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1013,9 +1005,6 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
editor_draw_mask(widget);
|
||||
|
||||
if (editor->cursor_thick && !msg->draw.count) {
|
||||
/* int x, y; */
|
||||
/* editor_to_screen(widget, editor->cursor_x, editor->cursor_y, &x, &y); */
|
||||
/* editor_draw_cursor(widget, x, y); */
|
||||
editor_draw_cursor(widget, editor->cursor_screen_x, editor->cursor_screen_y);
|
||||
}
|
||||
}
|
||||
@ -1029,12 +1018,12 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
/* if (current_tool == &ase_tool_path) { */
|
||||
/* if (editor->cursor_thick) { */
|
||||
/* hide_drawing_cursor (widget); */
|
||||
/* ji_mouse_set_cursor (JI_CURSOR_NORMAL); */
|
||||
/* jmouse_set_cursor(JI_CURSOR_NORMAL); */
|
||||
/* } */
|
||||
/* } */
|
||||
/* else { */
|
||||
/* if (!editor->cursor_thick) { */
|
||||
/* ji_mouse_set_cursor (JI_CURSOR_NULL); */
|
||||
/* jmouse_set_cursor(JI_CURSOR_NULL); */
|
||||
/* show_drawing_cursor (widget); */
|
||||
/* } */
|
||||
/* } */
|
||||
@ -1043,10 +1032,6 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
/* Redraw cursor when the user changes the brush size. */
|
||||
if ((editor->cursor_thick) &&
|
||||
(editor->cursor_thick != get_thickness_for_cursor())) {
|
||||
/* int x, y; */
|
||||
/* editor_to_screen(widget, editor->cursor_x, editor->cursor_y, &x, &y); */
|
||||
/* editor_clean_cursor(widget); */
|
||||
/* editor_draw_cursor(widget, x, y); */
|
||||
editor_clean_cursor(widget);
|
||||
editor_draw_cursor(widget, editor->cursor_screen_x, editor->cursor_screen_y);
|
||||
}
|
||||
@ -1058,7 +1043,7 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
case JM_MOUSEENTER:
|
||||
if (jmanager_get_capture() &&
|
||||
jmanager_get_capture() != widget) {
|
||||
editor->retarded_mouseenter = TRUE;
|
||||
editor->lagged_mouseenter = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1074,7 +1059,7 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
break;
|
||||
|
||||
case JM_MOUSELEAVE:
|
||||
editor->retarded_mouseenter = FALSE;
|
||||
editor->lagged_mouseenter = FALSE;
|
||||
|
||||
if (jmanager_get_capture() &&
|
||||
jmanager_get_capture() != widget)
|
||||
@ -1086,7 +1071,7 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
if (editor->state == EDIT_MOVING_SCROLL)
|
||||
break;
|
||||
|
||||
hide_drawing_cursor (widget);
|
||||
hide_drawing_cursor(widget);
|
||||
break;
|
||||
|
||||
case JM_BUTTONPRESSED: {
|
||||
@ -1096,9 +1081,9 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
if (!editor->sprite)
|
||||
break;
|
||||
|
||||
/* retarded MOUSEENTER event */
|
||||
if (editor->retarded_mouseenter) {
|
||||
editor->retarded_mouseenter = FALSE;
|
||||
/* lagged MOUSEENTER event */
|
||||
if (editor->lagged_mouseenter) {
|
||||
editor->lagged_mouseenter = FALSE;
|
||||
show_drawing_cursor(widget);
|
||||
}
|
||||
|
||||
@ -1108,7 +1093,7 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
editor->state = EDIT_MOVING_SCROLL;
|
||||
|
||||
hide_drawing_cursor(widget);
|
||||
ji_mouse_set_cursor(JI_CURSOR_MOVE);
|
||||
jmouse_set_cursor(JI_CURSOR_MOVE);
|
||||
}
|
||||
/* move frames position */
|
||||
else if (msg->mouse.left && has_only_shifts(msg, KB_CTRL_FLAG)) {
|
||||
@ -1129,17 +1114,17 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
}
|
||||
|
||||
/* set capture */
|
||||
jwidget_capture_mouse (widget);
|
||||
jwidget_capture_mouse(widget);
|
||||
}
|
||||
|
||||
case JM_MOTION: {
|
||||
if (!editor->sprite)
|
||||
break;
|
||||
|
||||
/* retarded MOUSEENTER event */
|
||||
if (editor->retarded_mouseenter) {
|
||||
editor->retarded_mouseenter = FALSE;
|
||||
show_drawing_cursor (widget);
|
||||
/* lagged MOUSEENTER event */
|
||||
if (editor->lagged_mouseenter) {
|
||||
editor->lagged_mouseenter = FALSE;
|
||||
show_drawing_cursor(widget);
|
||||
}
|
||||
|
||||
/* move the scroll */
|
||||
@ -1150,25 +1135,24 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
editor_set_scroll(widget,
|
||||
scroll_x+ji_mouse_x (1)-ji_mouse_x (0),
|
||||
scroll_y+ji_mouse_y (1)-ji_mouse_y (0), TRUE);
|
||||
scroll_x+jmouse_x(1)-jmouse_x(0),
|
||||
scroll_y+jmouse_y(1)-jmouse_y(0), TRUE);
|
||||
|
||||
ji_mouse_control_infinite_scroll (vp);
|
||||
jrect_free (vp);
|
||||
jmouse_control_infinite_scroll(vp);
|
||||
jrect_free(vp);
|
||||
}
|
||||
/* draw */
|
||||
else if (editor->state == EDIT_DRAWING) {
|
||||
JWidget color_bar = app_get_color_bar ();
|
||||
JWidget color_bar = app_get_color_bar();
|
||||
const char *color;
|
||||
|
||||
color = color_bar_get_color (color_bar, msg->mouse.left ? 0: 1);
|
||||
color = color_bar_get_color(color_bar, msg->mouse.left ? 0: 1);
|
||||
|
||||
/* call the tool-control routine */
|
||||
control_tool (widget, current_tool, color);
|
||||
control_tool(widget, current_tool, color);
|
||||
|
||||
editor->state = EDIT_STANDBY;
|
||||
|
||||
jwidget_release_mouse (widget);
|
||||
jwidget_release_mouse(widget);
|
||||
}
|
||||
|
||||
/* Draw cursor */
|
||||
@ -1177,18 +1161,18 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
|
||||
/* Get the pixel position corresponding to the mouse
|
||||
position. */
|
||||
/* screen_to_editor(widget, ji_mouse_x(0), ji_mouse_y(0), &x, &y); */
|
||||
x = ji_mouse_x(0);
|
||||
y = ji_mouse_y(0);
|
||||
/* screen_to_editor(widget, jmouse_x(0), jmouse_y(0), &x, &y); */
|
||||
x = jmouse_x(0);
|
||||
y = jmouse_y(0);
|
||||
|
||||
/* Redraw it only when the mouse change to other pixel (not
|
||||
when the mouse moves only). */
|
||||
/* if ((editor->cursor_x != x) || (editor->cursor_y != y)) { */
|
||||
if ((editor->cursor_screen_x != x) || (editor->cursor_screen_y != y)) {
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
editor_clean_cursor(widget);
|
||||
editor_draw_cursor(widget, ji_mouse_x(0), ji_mouse_y(0));
|
||||
unscare_mouse();
|
||||
editor_draw_cursor(widget, jmouse_x(0), jmouse_y(0));
|
||||
jmouse_show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1198,7 +1182,7 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
}
|
||||
else if (editor->state == EDIT_MOVING_SCROLL) {
|
||||
int x, y;
|
||||
screen_to_editor(widget, ji_mouse_x (0), ji_mouse_y (0), &x, &y);
|
||||
screen_to_editor(widget, jmouse_x(0), jmouse_y(0), &x, &y);
|
||||
status_bar_set_text(app_get_status_bar (), 0,
|
||||
"Pos %3d %3d (Size %3d %3d)", x, y,
|
||||
editor->sprite->w, editor->sprite->h);
|
||||
@ -1214,11 +1198,10 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
jmanager_free_mouse();
|
||||
|
||||
/* change mouse cursor */
|
||||
ji_mouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
jmouse_set_cursor(JI_CURSOR_NORMAL);
|
||||
}
|
||||
|
||||
editor->state = EDIT_STANDBY;
|
||||
|
||||
jwidget_release_mouse(widget);
|
||||
return TRUE;
|
||||
}
|
||||
@ -1233,13 +1216,11 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
return TRUE;
|
||||
|
||||
case JM_WHEEL:
|
||||
{
|
||||
Editor *editor = editor_data (widget);
|
||||
|
||||
if (editor->state == EDIT_STANDBY) {
|
||||
/* there are and sprite in the editor, there is the mouse inside*/
|
||||
if (editor->sprite &&
|
||||
jwidget_has_mouse(widget)) {
|
||||
int dz = ji_mouse_z(1) - ji_mouse_z(0);
|
||||
int dz = jmouse_z(1) - jmouse_z(0);
|
||||
|
||||
/* with the ALT */
|
||||
if (has_only_shifts(msg, KB_ALT_FLAG)) {
|
||||
@ -1256,7 +1237,7 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
/* XXXX: este pedazo de código es igual que el de la rutina:
|
||||
editor_keys_toset_zoom, tengo que intentar unir ambos, alguna
|
||||
función como: editor_set_zoom_and_center_in_mouse */
|
||||
screen_to_editor(widget, ji_mouse_x(0), ji_mouse_y(0), &x, &y);
|
||||
screen_to_editor(widget, jmouse_x(0), jmouse_y(0), &x, &y);
|
||||
|
||||
x = editor->offset_x - jrect_w(vp)/2 + ((1<<zoom)>>1) + (x << zoom);
|
||||
y = editor->offset_y - jrect_h(vp)/2 + ((1<<zoom)>>1) + (y << zoom);
|
||||
@ -1270,7 +1251,7 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
editor_update(widget);
|
||||
editor_set_scroll(widget, x, y, use_refresh_region);
|
||||
|
||||
ji_mouse_set_position((vp->x1+vp->x2)/2, (vp->y1+vp->y2)/2);
|
||||
jmouse_set_position((vp->x1+vp->x2)/2, (vp->y1+vp->y2)/2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1299,11 +1280,11 @@ static bool editor_msg_proc (JWidget widget, JMessage msg)
|
||||
|
||||
jview_get_scroll(view, &scroll_x, &scroll_y);
|
||||
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
editor_clean_cursor(widget);
|
||||
editor_set_scroll(widget, scroll_x+dx, scroll_y+dy, TRUE);
|
||||
editor_draw_cursor(widget, ji_mouse_x(0), ji_mouse_y(0));
|
||||
unscare_mouse();
|
||||
editor_draw_cursor(widget, jmouse_x(0), jmouse_y(0));
|
||||
jmouse_show();
|
||||
|
||||
jrect_free(vp);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ int editor_keys_toset_zoom(JWidget widget, int scancode)
|
||||
|
||||
/* zoom */
|
||||
if (zoom >= 0) {
|
||||
screen_to_editor(widget, ji_mouse_x(0), ji_mouse_y(0), &x, &y);
|
||||
screen_to_editor(widget, jmouse_x(0), jmouse_y(0), &x, &y);
|
||||
|
||||
x = editor->offset_x - jrect_w(vp)/2 + ((1<<zoom)>>1) + (x << zoom);
|
||||
y = editor->offset_y - jrect_h(vp)/2 + ((1<<zoom)>>1) + (y << zoom);
|
||||
@ -81,7 +81,7 @@ int editor_keys_toset_zoom(JWidget widget, int scancode)
|
||||
editor_update(widget);
|
||||
editor_set_scroll(widget, x, y, use_refresh_region);
|
||||
|
||||
ji_mouse_set_position((vp->x1+vp->x2)/2, (vp->y1+vp->y2)/2);
|
||||
jmouse_set_position((vp->x1+vp->x2)/2, (vp->y1+vp->y2)/2);
|
||||
jrect_free(vp);
|
||||
return TRUE;
|
||||
}
|
||||
@ -180,7 +180,7 @@ int editor_keys_toget_pixels(JWidget widget, int scancode)
|
||||
int x, y;
|
||||
|
||||
/* pixel position to get */
|
||||
screen_to_editor(widget, ji_mouse_x(0), ji_mouse_y(0), &x, &y);
|
||||
screen_to_editor(widget, jmouse_x(0), jmouse_y(0), &x, &y);
|
||||
|
||||
/* get the color from the image */
|
||||
color = color_from_image(editor->sprite->imgtype,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ase -- allegro-sprite-editor: the ultimate sprites factory
|
||||
* Copyright (C) 2001-2005 David A. Capello
|
||||
* Copyright (C) 2001-2005, 2007 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,32 +51,32 @@ enum {
|
||||
ACTION_LAST,
|
||||
};
|
||||
|
||||
static bool status_bar_msg_proc (JWidget widget, JMessage msg);
|
||||
static bool status_bar_msg_proc(JWidget widget, JMessage msg);
|
||||
|
||||
static int slider_change_signal (JWidget widget, int user_data);
|
||||
static void button_command (JWidget widget, void *data);
|
||||
static int slider_change_signal(JWidget widget, int user_data);
|
||||
static void button_command(JWidget widget, void *data);
|
||||
|
||||
static void update_from_layer (StatusBar *status_bar);
|
||||
static void update_from_layer(StatusBar *status_bar);
|
||||
|
||||
static void play_animation (void);
|
||||
static void play_animation(void);
|
||||
|
||||
JWidget status_bar_new (void)
|
||||
JWidget status_bar_new(void)
|
||||
{
|
||||
#define BUTTON_NEW(name, text, data) \
|
||||
(name) = jbutton_new (text); \
|
||||
(name) = jbutton_new(text); \
|
||||
(name)->user_data[0] = status_bar; \
|
||||
jbutton_add_command_data ((name), button_command, (void *)(data));
|
||||
jbutton_add_command_data((name), button_command, (void *)(data));
|
||||
|
||||
#define ICON_NEW(name, icon, action) \
|
||||
BUTTON_NEW ((name), NULL, (action)); \
|
||||
add_gfxicon_to_button ((name), (icon), JI_CENTER | JI_MIDDLE);
|
||||
BUTTON_NEW((name), NULL, (action)); \
|
||||
add_gfxicon_to_button((name), (icon), JI_CENTER | JI_MIDDLE);
|
||||
|
||||
JWidget widget = jwidget_new (status_bar_type ());
|
||||
StatusBar *status_bar = jnew (StatusBar, 1);
|
||||
JWidget widget = jwidget_new(status_bar_type());
|
||||
StatusBar *status_bar = jnew(StatusBar, 1);
|
||||
|
||||
jwidget_add_hook (widget, status_bar_type (),
|
||||
status_bar_msg_proc, status_bar);
|
||||
jwidget_focusrest (widget, TRUE);
|
||||
jwidget_add_hook(widget, status_bar_type(),
|
||||
status_bar_msg_proc, status_bar);
|
||||
jwidget_focusrest(widget, TRUE);
|
||||
|
||||
{
|
||||
JWidget box1, box2;
|
||||
@ -91,27 +91,27 @@ JWidget status_bar_new (void)
|
||||
box2 = jbox_new (JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||
BUTTON_NEW (status_bar->b_layer, "*Current Layer*", ACTION_LAYER);
|
||||
status_bar->slider = jslider_new (0, 255, 255);
|
||||
ICON_NEW (status_bar->b_first, GFX_ANI_FIRST, ACTION_FIRST);
|
||||
ICON_NEW (status_bar->b_prev, GFX_ANI_PREV, ACTION_PREV);
|
||||
ICON_NEW (status_bar->b_play, GFX_ANI_PLAY, ACTION_PLAY);
|
||||
ICON_NEW (status_bar->b_next, GFX_ANI_NEXT, ACTION_NEXT);
|
||||
ICON_NEW (status_bar->b_last, GFX_ANI_LAST, ACTION_LAST);
|
||||
ICON_NEW(status_bar->b_first, GFX_ANI_FIRST, ACTION_FIRST);
|
||||
ICON_NEW(status_bar->b_prev, GFX_ANI_PREV, ACTION_PREV);
|
||||
ICON_NEW(status_bar->b_play, GFX_ANI_PLAY, ACTION_PLAY);
|
||||
ICON_NEW(status_bar->b_next, GFX_ANI_NEXT, ACTION_NEXT);
|
||||
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);
|
||||
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_noborders (box1);
|
||||
jwidget_noborders (box2);
|
||||
jwidget_noborders(box1);
|
||||
jwidget_noborders(box2);
|
||||
|
||||
jwidget_expansive (status_bar->b_layer, TRUE);
|
||||
jwidget_add_child (box1, status_bar->b_layer);
|
||||
jwidget_add_child (box1, status_bar->slider);
|
||||
jwidget_add_child (box2, status_bar->b_first);
|
||||
jwidget_add_child (box2, status_bar->b_prev);
|
||||
jwidget_add_child (box2, status_bar->b_play);
|
||||
jwidget_add_child (box2, status_bar->b_next);
|
||||
jwidget_add_child (box2, status_bar->b_last);
|
||||
jwidget_add_child (box1, box2);
|
||||
jwidget_expansive(status_bar->b_layer, TRUE);
|
||||
jwidget_add_child(box1, status_bar->b_layer);
|
||||
jwidget_add_child(box1, status_bar->slider);
|
||||
jwidget_add_child(box2, status_bar->b_first);
|
||||
jwidget_add_child(box2, status_bar->b_prev);
|
||||
jwidget_add_child(box2, status_bar->b_play);
|
||||
jwidget_add_child(box2, status_bar->b_next);
|
||||
jwidget_add_child(box2, status_bar->b_last);
|
||||
jwidget_add_child(box1, box2);
|
||||
|
||||
status_bar->commands_box = box1;
|
||||
}
|
||||
@ -119,20 +119,20 @@ JWidget status_bar_new (void)
|
||||
return widget;
|
||||
}
|
||||
|
||||
int status_bar_type (void)
|
||||
int status_bar_type(void)
|
||||
{
|
||||
static int type = 0;
|
||||
if (!type)
|
||||
type = ji_register_widget_type ();
|
||||
type = ji_register_widget_type();
|
||||
return type;
|
||||
}
|
||||
|
||||
StatusBar *status_bar_data (JWidget widget)
|
||||
StatusBar *status_bar_data(JWidget widget)
|
||||
{
|
||||
return jwidget_get_data (widget, status_bar_type ());
|
||||
return jwidget_get_data(widget, status_bar_type());
|
||||
}
|
||||
|
||||
void status_bar_set_text (JWidget widget, int msecs, const char *format, ...)
|
||||
void status_bar_set_text(JWidget widget, int msecs, const char *format, ...)
|
||||
{
|
||||
StatusBar *status_bar = status_bar_data (widget);
|
||||
|
||||
@ -153,7 +153,7 @@ void status_bar_set_text (JWidget widget, int msecs, const char *format, ...)
|
||||
}
|
||||
}
|
||||
|
||||
void status_bar_do_progress (JWidget widget, int progress)
|
||||
void status_bar_do_progress(JWidget widget, int progress)
|
||||
{
|
||||
StatusBar *status_bar = status_bar_data(widget);
|
||||
int n = status_bar->nprogress-1;
|
||||
@ -168,7 +168,7 @@ void status_bar_do_progress (JWidget widget, int progress)
|
||||
}
|
||||
}
|
||||
|
||||
void status_bar_add_progress (JWidget widget, int max)
|
||||
void status_bar_add_progress(JWidget widget, int max)
|
||||
{
|
||||
StatusBar *status_bar = status_bar_data(widget);
|
||||
int n = status_bar->nprogress++;
|
||||
@ -179,7 +179,7 @@ void status_bar_add_progress (JWidget widget, int max)
|
||||
jwidget_dirty(widget);
|
||||
}
|
||||
|
||||
void status_bar_del_progress (JWidget widget)
|
||||
void status_bar_del_progress(JWidget widget)
|
||||
{
|
||||
StatusBar *status_bar = status_bar_data (widget);
|
||||
|
||||
@ -197,37 +197,37 @@ void status_bar_del_progress (JWidget widget)
|
||||
status_bar->nprogress--;
|
||||
}
|
||||
|
||||
void status_bar_update (JWidget widget)
|
||||
void status_bar_update(JWidget widget)
|
||||
{
|
||||
StatusBar *status_bar = status_bar_data (widget);
|
||||
|
||||
update_from_layer (status_bar);
|
||||
}
|
||||
|
||||
static bool status_bar_msg_proc (JWidget widget, JMessage msg)
|
||||
static bool status_bar_msg_proc(JWidget widget, JMessage msg)
|
||||
{
|
||||
StatusBar *status_bar = status_bar_data (widget);
|
||||
StatusBar *status_bar = status_bar_data(widget);
|
||||
|
||||
switch (msg->type) {
|
||||
|
||||
case JM_DESTROY:
|
||||
jfree (status_bar);
|
||||
jfree(status_bar);
|
||||
break;
|
||||
|
||||
case JM_REQSIZE:
|
||||
msg->reqsize.w = msg->reqsize.h =
|
||||
2 + jwidget_get_text_height (widget) + 2;
|
||||
2 + jwidget_get_text_height(widget) + 2;
|
||||
return TRUE;
|
||||
|
||||
case JM_SETPOS:
|
||||
jrect_copy (widget->rc, &msg->setpos.rect);
|
||||
jwidget_set_rect (status_bar->commands_box, widget->rc);
|
||||
jrect_copy(widget->rc, &msg->setpos.rect);
|
||||
jwidget_set_rect(status_bar->commands_box, widget->rc);
|
||||
return TRUE;
|
||||
|
||||
case JM_CLOSE:
|
||||
if (!jwidget_has_child (widget, status_bar->commands_box)) {
|
||||
if (!jwidget_has_child(widget, status_bar->commands_box)) {
|
||||
/* append the "commands_box" to destroy it in the jwidget_free */
|
||||
jwidget_add_child (widget, status_bar->commands_box);
|
||||
jwidget_add_child(widget, status_bar->commands_box);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -341,7 +341,7 @@ static bool status_bar_msg_proc (JWidget widget, JMessage msg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int slider_change_signal (JWidget widget, int user_data)
|
||||
static int slider_change_signal(JWidget widget, int user_data)
|
||||
{
|
||||
Sprite *sprite = current_sprite;
|
||||
|
||||
@ -363,7 +363,7 @@ static int slider_change_signal (JWidget widget, int user_data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void button_command (JWidget widget, void *data)
|
||||
static void button_command(JWidget widget, void *data)
|
||||
{
|
||||
Sprite *sprite = current_sprite;
|
||||
|
||||
@ -373,7 +373,7 @@ static void button_command (JWidget widget, void *data)
|
||||
switch ((int)data) {
|
||||
|
||||
case ACTION_LAYER:
|
||||
do_script_expr ("GUI_LayerProperties ()");
|
||||
do_script_expr("GUI_LayerProperties()");
|
||||
break;
|
||||
|
||||
case ACTION_FIRST:
|
||||
@ -406,7 +406,7 @@ static void button_command (JWidget widget, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void update_from_layer (StatusBar *status_bar)
|
||||
static void update_from_layer(StatusBar *status_bar)
|
||||
{
|
||||
Sprite *sprite = current_sprite;
|
||||
Frame *frame;
|
||||
@ -458,7 +458,7 @@ static void play_animation(void)
|
||||
if (sprite->frames < 2)
|
||||
return;
|
||||
|
||||
scare_mouse();
|
||||
jmouse_hide();
|
||||
|
||||
old_frpos = sprite->frpos;
|
||||
|
||||
@ -510,5 +510,5 @@ static void play_animation(void)
|
||||
clear_keybuf();
|
||||
remove_int(speed_timer_callback);
|
||||
|
||||
unscare_mouse();
|
||||
jmouse_show();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user