Fixed a bug with multiple editors, paste command, and cleaning the editor's cursor.

This commit is contained in:
David Capello 2009-03-02 01:22:52 +00:00
parent 3d6af97999
commit 0adb37f2bb
3 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2009-03-01 David A. Capello <davidcapello@gmail.com>
* src/widgets/editor/cursor.cpp (editor_clean_cursor): Fixed a
problem where old_clipping_region can be NULL if multiple editors
are in use and PASTE command is executed.
2009-02-25 David A. Capello <davidcapello@gmail.com>
* src/commands/cmd_save_file.cpp (cmd_save_file_copy_as_execute):

View File

@ -7,6 +7,7 @@ NEWS
+ Added "Save Copy As" command (feature #2636076).
+ Fixed compilation support for gcc 64 bits.
+ Fixed a bug with multiple editors and paste command.
0.6.1
-----

View File

@ -65,6 +65,9 @@ static int cursor_negative;
static int saved_pixel[MAX_SAVED];
static int saved_pixel_n;
// These clipping regions are shared between all editors, so we cannot
// make assumptions about their old state
static JRegion clipping_region;
static JRegion old_clipping_region;
@ -156,6 +159,8 @@ void editor_draw_cursor(JWidget widget, int x, int y)
editor->cursor_editor_y = y;
/* save the clipping-region to know where to clean the pixels */
if (old_clipping_region)
jregion_free(old_clipping_region);
old_clipping_region = clipping_region;
}
@ -194,7 +199,9 @@ void editor_clean_cursor(JWidget widget)
editor->cursor_thick = 0;
jregion_free(clipping_region);
jregion_free(old_clipping_region);
if (old_clipping_region)
jregion_free(old_clipping_region);
clipping_region = NULL;
old_clipping_region = NULL;
}
@ -361,7 +368,8 @@ static void cleanpixel(BITMAP *bmp, int x, int y, int color)
if (saved_pixel_n < MAX_SAVED) {
if (point_inside_region(x, y, clipping_region))
putpixel(bmp, x, y, saved_pixel[saved_pixel_n++]);
else if (point_inside_region(x, y, old_clipping_region))
else if (old_clipping_region &&
point_inside_region(x, y, old_clipping_region))
saved_pixel_n++;
}
}