mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 21:33:12 +00:00
This commit is contained in:
parent
833c52508c
commit
dc6d0467ac
@ -1,3 +1,11 @@
|
||||
2008-01-21 David A. Capello <dacap@users.sourceforge.net>
|
||||
|
||||
* src/jinete/jmanager.c (jmanager_generate_messages): Focus magnet
|
||||
works again.
|
||||
|
||||
* src/util/clipbrd.c (paste_from_clipboard): Fixed some problems
|
||||
when Paste.
|
||||
|
||||
2008-01-20 David A. Capello <dacap@users.sourceforge.net>
|
||||
|
||||
* src/commands/cmd_configure_tools.c (cmd_configure_tools_execute):
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- ASE - Allegro Sprite Editor -->
|
||||
<!-- Copyright (C) 2001-2005, 2007 by David A. Capello -->
|
||||
<!-- Copyright (C) 2001-2005, 2007, 2008 by David A. Capello -->
|
||||
|
||||
<!-- Read "LEGAL.txt" for more information. -->
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<label text="Height:" />
|
||||
</box>
|
||||
<box vertical homogeneous expansive>
|
||||
<entry expansive name="width" maxsize=8 />
|
||||
<entry expansive name="width" maxsize=8 magnetic />
|
||||
<entry expansive name="height" maxsize=8 />
|
||||
</box>
|
||||
</box>
|
||||
|
@ -304,6 +304,8 @@ bool jmanager_generate_messages(JWidget manager)
|
||||
|
||||
/* new windows to show? */
|
||||
if (!jlist_empty(new_windows)) {
|
||||
JWidget magnet;
|
||||
|
||||
JI_LIST_FOR_EACH(new_windows, link) {
|
||||
window = link->data;
|
||||
|
||||
@ -311,12 +313,15 @@ bool jmanager_generate_messages(JWidget manager)
|
||||
jwidget_dirty(window);
|
||||
jwidget_show(window);
|
||||
|
||||
/* attract the focus to the magnetic widget */
|
||||
/* jmanager_attract_focus(window); */
|
||||
jmanager_focus_first_child(window);
|
||||
|
||||
/* redraw all */
|
||||
/* jwidget_flush_redraw(window); */
|
||||
/* attract the focus to the magnetic widget... */
|
||||
/* 1) get the magnetic widget */
|
||||
magnet = find_magnetic_widget(jwidget_get_window(window));
|
||||
/* 2) if magnetic widget exists and it doesn't have the focus */
|
||||
if (magnet && !jwidget_has_focus(magnet))
|
||||
jmanager_set_focus(magnet);
|
||||
/* 3) if not, put the focus in the first child */
|
||||
else
|
||||
jmanager_focus_first_child(window);
|
||||
}
|
||||
|
||||
jlist_clear(new_windows);
|
||||
|
@ -139,10 +139,10 @@ void cut_to_clipboard(void)
|
||||
return;
|
||||
|
||||
if (!low_copy())
|
||||
console_printf ("Can't copying an image portion from the current layer\n");
|
||||
console_printf("Can't copying an image portion from the current layer\n");
|
||||
else {
|
||||
ClearMask ();
|
||||
update_screen_for_sprite (current_sprite);
|
||||
ClearMask();
|
||||
update_screen_for_sprite(current_sprite);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,8 +151,8 @@ void copy_to_clipboard(void)
|
||||
if (!current_sprite)
|
||||
return;
|
||||
|
||||
if (!low_copy ())
|
||||
console_printf (_("Can't copying an image portion from the current layer\n"));
|
||||
if (!low_copy())
|
||||
console_printf(_("Can't copying an image portion from the current layer\n"));
|
||||
}
|
||||
|
||||
void paste_from_clipboard(void)
|
||||
@ -162,6 +162,7 @@ void paste_from_clipboard(void)
|
||||
Image *image;
|
||||
Image *dest_image;
|
||||
int xout[4], yout[4];
|
||||
int dest_x, dest_y;
|
||||
bool paste;
|
||||
|
||||
if (!current_sprite ||
|
||||
@ -171,21 +172,28 @@ void paste_from_clipboard(void)
|
||||
return;
|
||||
|
||||
if (clipboard->imgtype != current_sprite->imgtype) {
|
||||
/* TODO now the user can't select the clipboard sprite */
|
||||
console_printf(_("You can't copy sprites of different image types.\nYou should select the clipboard sprite, and change the image type of it.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
cel = layer_get_cel(clipboard->layer, clipboard->frame);
|
||||
if (!cel)
|
||||
if (!cel) {
|
||||
console_printf(_("Error: No cel in the clipboard\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
image = stock_get_image(clipboard->stock, cel->image);
|
||||
if (!image)
|
||||
if (!image) {
|
||||
console_printf(_("Error: No image in the clipboard\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
dest_image = GetImage();
|
||||
if (!dest_image)
|
||||
dest_image = GetImage2(current_sprite, &dest_x, &dest_y, NULL);
|
||||
if (!dest_image) {
|
||||
console_printf(_("Error: no destination image\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
JWidget view = jwidget_get_view(current_editor);
|
||||
@ -204,8 +212,15 @@ void paste_from_clipboard(void)
|
||||
}
|
||||
|
||||
if (paste) {
|
||||
int u1, v1, u2, v2;
|
||||
int c, u1, v1, u2, v2;
|
||||
|
||||
/* align to the destination cel-position */
|
||||
for (c=0; c<4; ++c) {
|
||||
xout[c] -= dest_x;
|
||||
yout[c] -= dest_y;
|
||||
}
|
||||
|
||||
/* clip the box for the undo */
|
||||
u1 = MAX(0, MIN(xout[0], MIN(xout[1], MIN(xout[2], xout[3]))));
|
||||
v1 = MAX(0, MIN(yout[0], MIN(yout[1], MIN(yout[2], yout[3]))));
|
||||
u2 = MIN(dest_image->w-1, MAX(xout[0], MAX(xout[1], MAX(xout[2], xout[3]))));
|
||||
@ -214,7 +229,7 @@ void paste_from_clipboard(void)
|
||||
/* undo region */
|
||||
undo_image(current_sprite->undo, dest_image, u1, v1, u2-u1+1, v2-v1+1);
|
||||
|
||||
/* draw the image */
|
||||
/* draw the transformed image */
|
||||
image_parallelogram(dest_image, image,
|
||||
xout[0], yout[0], xout[1], yout[1],
|
||||
xout[2], yout[2], xout[3], yout[3]);
|
||||
@ -222,7 +237,7 @@ void paste_from_clipboard(void)
|
||||
|
||||
update_screen_for_sprite(current_sprite);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* interactive transform */
|
||||
|
||||
@ -233,15 +248,6 @@ static bool interactive_transform(JWidget widget,
|
||||
int x, int y,
|
||||
int xout[4], int yout[4])
|
||||
{
|
||||
/* #define UPDATE2() \ */
|
||||
/* jmanager_dispatch_messages(); \ */
|
||||
/* 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); \ */
|
||||
/* jmouse_show(); */
|
||||
|
||||
#define UPDATE() \
|
||||
jmouse_hide(); \
|
||||
old_screen = ji_screen; \
|
||||
@ -644,6 +650,11 @@ static int low_copy(void)
|
||||
if (!sprite)
|
||||
return FALSE;
|
||||
|
||||
/* set the current frame */
|
||||
sprite_set_frame(sprite, current_sprite->frame);
|
||||
|
||||
/* create a new layer from the current mask (in the current
|
||||
frame) */
|
||||
layer = NewLayerFromMask(current_sprite, sprite);
|
||||
if (!layer) {
|
||||
sprite_free(sprite);
|
||||
@ -652,7 +663,6 @@ static int low_copy(void)
|
||||
|
||||
layer_add_layer(sprite->set, layer);
|
||||
sprite_set_layer(sprite, layer);
|
||||
sprite_set_frame(sprite, current_sprite->frame);
|
||||
|
||||
sprite_set_palette(sprite,
|
||||
sprite_get_palette(current_sprite,
|
||||
|
Loading…
x
Reference in New Issue
Block a user