removed member "guint time"...

2004-07-12  Michael Natterer  <mitch@gimp.org>

	* app/text/gimptextundo.[ch]: removed member "guint time"...

	* app/core/gimpundo.[ch]: ...and added it here.

	* app/tools/gimptexttool.c (gimp_text_tool_apply): changed
	accordingly. Reordered undo compression code to look like other
	pieces of code which do undo compression.
This commit is contained in:
Michael Natterer 2004-07-12 17:10:34 +00:00 committed by Michael Natterer
parent da74f1269e
commit a81e96450a
6 changed files with 27 additions and 19 deletions

View File

@ -1,3 +1,13 @@
2004-07-12 Michael Natterer <mitch@gimp.org>
* app/text/gimptextundo.[ch]: removed member "guint time"...
* app/core/gimpundo.[ch]: ...and added it here.
* app/tools/gimptexttool.c (gimp_text_tool_apply): changed
accordingly. Reordered undo compression code to look like other
pieces of code which do undo compression.
2004-07-12 Michael Natterer <mitch@gimp.org>
* app/core/gimpundo.[ch]

View File

@ -18,6 +18,8 @@
#include "config.h"
#include <time.h>
#include <glib-object.h>
#include "core-types.h"
@ -226,6 +228,8 @@ gimp_undo_constructor (GType type,
g_assert (GIMP_IS_IMAGE (undo->gimage));
undo->time = time (NULL);
return object;
}

View File

@ -49,6 +49,7 @@ struct _GimpUndo
GimpViewable parent_instance;
GimpImage *gimage; /* the image this undo is part of */
guint time; /* time of undo step construction */
GimpUndoType undo_type; /* undo type */
gpointer data; /* data to implement the undo */

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <time.h>
#include <glib-object.h>
#include "text-types.h"
@ -138,8 +136,6 @@ gimp_text_undo_constructor (GType type,
layer = GIMP_TEXT_LAYER (GIMP_ITEM_UNDO (text_undo)->item);
text_undo->time = time (NULL);
if (text_undo->pspec)
{
g_assert (text_undo->pspec->owner_type == GIMP_TYPE_TEXT);

View File

@ -40,7 +40,6 @@ struct _GimpTextUndo
GimpText *text;
const GParamSpec *pspec;
GValue *value;
guint time;
};
struct _GimpTextUndoClass

View File

@ -543,20 +543,18 @@ gimp_text_tool_apply (GimpTextTool *text_tool)
if (g_list_length (list) == 1)
pspec = list->data;
if (pspec)
/* If we are changing a single property, we don't need to push
* an undo if all of the following is true:
* - the redo stack is empty
* - the last item on the undo stack is a text undo
* - the last undo changed the same text property on the same layer
* - the last undo happened less than TEXT_UNDO_TIMEOUT seconds ago
*/
if (pspec && ! gimp_undo_stack_peek (image->redo_stack))
{
GimpUndo *undo = gimp_undo_stack_peek (image->undo_stack);
/* If we are changing a single property, we don't need to push
* an undo if all of the following is true:
* - the last item on the undo stack is a text undo
* - the redo stack is empty
* - the last undo changed the same text property on the same layer
* - the last undo happened less than TEXT_UNDO_TIMEOUT seconds ago
*/
if (undo && GIMP_IS_TEXT_UNDO (undo) &&
! gimp_undo_stack_peek (image->redo_stack))
if (GIMP_IS_TEXT_UNDO (undo))
{
GimpTextUndo *text_undo = GIMP_TEXT_UNDO (undo);
@ -565,11 +563,11 @@ gimp_text_tool_apply (GimpTextTool *text_tool)
{
guint now = time (NULL);
if (now >= text_undo->time &&
now - text_undo->time < TEXT_UNDO_TIMEOUT)
if (now >= undo->time &&
now - undo->time < TEXT_UNDO_TIMEOUT)
{
push_undo = FALSE;
text_undo->time = now;
undo->time = now;
gimp_undo_refresh_preview (undo);
}
}