Commit a81e9645 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

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.
parent da74f126
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]
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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);
......
......@@ -40,7 +40,6 @@ struct _GimpTextUndo
GimpText *text;
const GParamSpec *pspec;
GValue *value;
guint time;
};
struct _GimpTextUndoClass
......
......@@ -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);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment