Mercurial > pidgin.yaz
annotate pidgin/gtksourceundomanager.c @ 22928:4fa01df51fec
merge of '657be692e8fe314ef25624dc2b70d25e1cf8085b'
and 'f34420097faff83cee26133ba8bd05198e56db0a'
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 13 May 2008 18:56:11 +0000 |
parents | 27c9c55499f8 |
children | 7fc110f70662 |
rev | line source |
---|---|
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 /* |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * gtksourceundomanager.c |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * This file is part of GtkSourceView |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * Copyright (C) 2002-2005 Paolo Maggi |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19548
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19548
diff
changeset
|
23 * Boston, MA 02111-1301, USA. |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #ifdef HAVE_CONFIG_H |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include <config.h> |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #endif |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include <glib.h> |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include <stdlib.h> |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include <string.h> |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "gtksourceundomanager.h" |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "gtksourceview-marshal.h" |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #define DEFAULT_MAX_UNDO_LEVELS 25 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 typedef struct _GtkSourceUndoAction GtkSourceUndoAction; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 typedef struct _GtkSourceUndoInsertAction GtkSourceUndoInsertAction; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 typedef struct _GtkSourceUndoDeleteAction GtkSourceUndoDeleteAction; |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
44 typedef struct _GtkSourceUndoInsertAnchorAction GtkSourceUndoInsertAnchorAction; |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 typedef enum { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 GTK_SOURCE_UNDO_ACTION_INSERT, |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
48 GTK_SOURCE_UNDO_ACTION_DELETE, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
49 GTK_SOURCE_UNDO_ACTION_INSERT_ANCHOR, |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 } GtkSourceUndoActionType; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 /* |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 * We use offsets instead of GtkTextIters because the last ones |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 * require to much memory in this context without giving us any advantage. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 struct _GtkSourceUndoInsertAction |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 gint pos; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 gchar *text; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 gint length; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 gint chars; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 }; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 struct _GtkSourceUndoDeleteAction |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 gint start; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 gint end; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 gchar *text; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 gboolean forward; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 }; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
73 struct _GtkSourceUndoInsertAnchorAction |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
74 { |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
75 gint pos; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
76 GtkTextChildAnchor *anchor; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
77 }; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
78 |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 struct _GtkSourceUndoAction |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 GtkSourceUndoActionType action_type; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 union { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 GtkSourceUndoInsertAction insert; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 GtkSourceUndoDeleteAction delete; |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
86 GtkSourceUndoInsertAnchorAction insert_anchor; |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 } action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 gint order_in_group; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 /* It is TRUE whether the action can be merged with the following action. */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 guint mergeable : 1; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 /* It is TRUE whether the action is marked as "modified". |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 * An action is marked as "modified" if it changed the |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 * state of the buffer from "not modified" to "modified". Only the first |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 * action of a group can be marked as modified. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 * There can be a single action marked as "modified" in the actions list. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 guint modified : 1; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 }; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 /* INVALID is a pointer to an invalid action */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 #define INVALID ((void *) "IA") |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 struct _GtkSourceUndoManagerPrivate |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 GtkTextBuffer *document; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 GList* actions; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 gint next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 gint actions_in_current_group; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 gint running_not_undoable_actions; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 gint num_of_groups; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 gint max_undo_levels; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 guint can_undo : 1; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 guint can_redo : 1; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 /* It is TRUE whether, while undoing an action of the current group (with order_in_group > 1), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 * the state of the buffer changed from "not modified" to "modified". |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 guint modified_undoing_group : 1; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 /* Pointer to the action (in the action list) marked as "modified". |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 * It is NULL when no action is marked as "modified". |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 * It is INVALID when the action marked as "modified" has been removed |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 * from the action list (freeing the list or resizing it) */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 GtkSourceUndoAction *modified_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 }; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 enum { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 CAN_UNDO, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 CAN_REDO, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 LAST_SIGNAL |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 }; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 static void gtk_source_undo_manager_class_init (GtkSourceUndoManagerClass *klass); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 static void gtk_source_undo_manager_init (GtkSourceUndoManager *um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 static void gtk_source_undo_manager_finalize (GObject *object); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 static void gtk_source_undo_manager_insert_text_handler (GtkTextBuffer *buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 GtkTextIter *pos, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 const gchar *text, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 gint length, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 GtkSourceUndoManager *um); |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
151 static void gtk_source_undo_manager_insert_anchor_handler (GtkTextBuffer *buffer, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
152 GtkTextIter *pos, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
153 GtkTextChildAnchor *anchor, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
154 GtkSourceUndoManager *um); |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 static void gtk_source_undo_manager_delete_range_handler (GtkTextBuffer *buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 GtkTextIter *start, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 GtkTextIter *end, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 GtkSourceUndoManager *um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 static void gtk_source_undo_manager_begin_user_action_handler (GtkTextBuffer *buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 GtkSourceUndoManager *um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 static void gtk_source_undo_manager_modified_changed_handler (GtkTextBuffer *buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 GtkSourceUndoManager *um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 static void gtk_source_undo_manager_free_action_list (GtkSourceUndoManager *um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 static void gtk_source_undo_manager_add_action (GtkSourceUndoManager *um, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 const GtkSourceUndoAction *undo_action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 static void gtk_source_undo_manager_free_first_n_actions (GtkSourceUndoManager *um, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 gint n); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 static void gtk_source_undo_manager_check_list_size (GtkSourceUndoManager *um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 static gboolean gtk_source_undo_manager_merge_action (GtkSourceUndoManager *um, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 const GtkSourceUndoAction *undo_action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 static GObjectClass *parent_class = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 static guint undo_manager_signals [LAST_SIGNAL] = { 0 }; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 GType |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 gtk_source_undo_manager_get_type (void) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 static GType undo_manager_type = 0; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 if (undo_manager_type == 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 static const GTypeInfo our_info = |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 sizeof (GtkSourceUndoManagerClass), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 NULL, /* base_init */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 NULL, /* base_finalize */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 (GClassInitFunc) gtk_source_undo_manager_class_init, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 NULL, /* class_finalize */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 NULL, /* class_data */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 sizeof (GtkSourceUndoManager), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 0, /* n_preallocs */ |
18086
a92cadf6a978
Get rid of a compile warning
Mark Doliner <mark@kingant.net>
parents:
17411
diff
changeset
|
195 (GInstanceInitFunc) gtk_source_undo_manager_init, |
a92cadf6a978
Get rid of a compile warning
Mark Doliner <mark@kingant.net>
parents:
17411
diff
changeset
|
196 NULL /* value_table */ |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 }; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 undo_manager_type = g_type_register_static (G_TYPE_OBJECT, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 "GtkSourceUndoManager", |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 &our_info, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 0); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 return undo_manager_type; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 gtk_source_undo_manager_class_init (GtkSourceUndoManagerClass *klass) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 GObjectClass *object_class = G_OBJECT_CLASS (klass); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 parent_class = g_type_class_peek_parent (klass); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 object_class->finalize = gtk_source_undo_manager_finalize; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 klass->can_undo = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 klass->can_redo = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 undo_manager_signals[CAN_UNDO] = |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 g_signal_new ("can_undo", |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 G_OBJECT_CLASS_TYPE (object_class), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 G_SIGNAL_RUN_LAST, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 G_STRUCT_OFFSET (GtkSourceUndoManagerClass, can_undo), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 NULL, NULL, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 gtksourceview_marshal_VOID__BOOLEAN, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 G_TYPE_NONE, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 1, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 G_TYPE_BOOLEAN); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 undo_manager_signals[CAN_REDO] = |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 g_signal_new ("can_redo", |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 G_OBJECT_CLASS_TYPE (object_class), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 G_SIGNAL_RUN_LAST, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 G_STRUCT_OFFSET (GtkSourceUndoManagerClass, can_redo), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 NULL, NULL, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 gtksourceview_marshal_VOID__BOOLEAN, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 G_TYPE_NONE, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 1, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 G_TYPE_BOOLEAN); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 gtk_source_undo_manager_init (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 um->priv = g_new0 (GtkSourceUndoManagerPrivate, 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 um->priv->actions = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 um->priv->next_redo = 0; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 um->priv->can_undo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 um->priv->can_redo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 um->priv->running_not_undoable_actions = 0; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 um->priv->num_of_groups = 0; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 um->priv->max_undo_levels = DEFAULT_MAX_UNDO_LEVELS; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 um->priv->modified_action = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 um->priv->modified_undoing_group = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 gtk_source_undo_manager_finalize (GObject *object) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 GtkSourceUndoManager *um; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 g_return_if_fail (object != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (object)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 um = GTK_SOURCE_UNDO_MANAGER (object); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 if (um->priv->actions != NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 gtk_source_undo_manager_free_action_list (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 g_signal_handlers_disconnect_by_func (G_OBJECT (um->priv->document), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 G_CALLBACK (gtk_source_undo_manager_delete_range_handler), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 g_signal_handlers_disconnect_by_func (G_OBJECT (um->priv->document), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 G_CALLBACK (gtk_source_undo_manager_insert_text_handler), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 g_signal_handlers_disconnect_by_func (G_OBJECT (um->priv->document), |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
291 G_CALLBACK (gtk_source_undo_manager_insert_anchor_handler), |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
292 um); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
293 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
294 g_signal_handlers_disconnect_by_func (G_OBJECT (um->priv->document), |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 G_CALLBACK (gtk_source_undo_manager_begin_user_action_handler), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 g_free (um->priv); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 G_OBJECT_CLASS (parent_class)->finalize (object); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 GtkSourceUndoManager* |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 gtk_source_undo_manager_new (GtkTextBuffer* buffer) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 GtkSourceUndoManager *um; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 um = GTK_SOURCE_UNDO_MANAGER (g_object_new (GTK_SOURCE_TYPE_UNDO_MANAGER, NULL)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 g_return_val_if_fail (um->priv != NULL, NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 um->priv->document = buffer; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 g_signal_connect (G_OBJECT (buffer), "insert_text", |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 G_CALLBACK (gtk_source_undo_manager_insert_text_handler), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
317 g_signal_connect (G_OBJECT (buffer), "insert_child_anchor", |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
318 G_CALLBACK (gtk_source_undo_manager_insert_anchor_handler), |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
319 um); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
320 |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 g_signal_connect (G_OBJECT (buffer), "delete_range", |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 G_CALLBACK (gtk_source_undo_manager_delete_range_handler), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 g_signal_connect (G_OBJECT (buffer), "begin_user_action", |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 G_CALLBACK (gtk_source_undo_manager_begin_user_action_handler), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 g_signal_connect (G_OBJECT (buffer), "modified_changed", |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 G_CALLBACK (gtk_source_undo_manager_modified_changed_handler), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 return um; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 gtk_source_undo_manager_begin_not_undoable_action (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 ++um->priv->running_not_undoable_actions; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 gtk_source_undo_manager_end_not_undoable_action_internal (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 g_return_if_fail (um->priv->running_not_undoable_actions > 0); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 --um->priv->running_not_undoable_actions; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 gtk_source_undo_manager_end_not_undoable_action (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 gtk_source_undo_manager_end_not_undoable_action_internal (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 if (um->priv->running_not_undoable_actions == 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 gtk_source_undo_manager_free_action_list (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 um->priv->next_redo = -1; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 if (um->priv->can_undo) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 um->priv->can_undo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 g_signal_emit (G_OBJECT (um), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 undo_manager_signals [CAN_UNDO], |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 0, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 if (um->priv->can_redo) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 um->priv->can_redo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 g_signal_emit (G_OBJECT (um), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 undo_manager_signals [CAN_REDO], |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 0, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 gboolean |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 gtk_source_undo_manager_can_undo (const GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 g_return_val_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um), FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 g_return_val_if_fail (um->priv != NULL, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 return um->priv->can_undo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 gboolean |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 gtk_source_undo_manager_can_redo (const GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 g_return_val_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um), FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 g_return_val_if_fail (um->priv != NULL, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 return um->priv->can_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 set_cursor (GtkTextBuffer *buffer, gint cursor) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 GtkTextIter iter; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 /* Place the cursor at the requested position */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 gtk_text_buffer_get_iter_at_offset (buffer, &iter, cursor); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 gtk_text_buffer_place_cursor (buffer, &iter); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 insert_text (GtkTextBuffer *buffer, gint pos, const gchar *text, gint len) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 GtkTextIter iter; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 gtk_text_buffer_get_iter_at_offset (buffer, &iter, pos); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 gtk_text_buffer_insert (buffer, &iter, text, len); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 static void |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
427 insert_anchor (GtkTextBuffer *buffer, gint pos, GtkTextChildAnchor *anchor) |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
428 { |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
429 GtkTextIter iter; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
430 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
431 gtk_text_buffer_get_iter_at_offset (buffer, &iter, pos); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
432 gtk_text_buffer_insert_child_anchor (buffer, &iter, anchor); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
433 } |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
434 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
435 static void |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 delete_text (GtkTextBuffer *buffer, gint start, gint end) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 GtkTextIter start_iter; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 GtkTextIter end_iter; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 gtk_text_buffer_get_iter_at_offset (buffer, &start_iter, start); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 if (end < 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 gtk_text_buffer_get_end_iter (buffer, &end_iter); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 gtk_text_buffer_get_iter_at_offset (buffer, &end_iter, end); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 gtk_text_buffer_delete (buffer, &start_iter, &end_iter); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 static gchar* |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 get_chars (GtkTextBuffer *buffer, gint start, gint end) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 GtkTextIter start_iter; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 GtkTextIter end_iter; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 gtk_text_buffer_get_iter_at_offset (buffer, &start_iter, start); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 if (end < 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 gtk_text_buffer_get_end_iter (buffer, &end_iter); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 gtk_text_buffer_get_iter_at_offset (buffer, &end_iter, end); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 return gtk_text_buffer_get_slice (buffer, &start_iter, &end_iter, TRUE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 gtk_source_undo_manager_undo (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 GtkSourceUndoAction *undo_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 gboolean modified = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 g_return_if_fail (um->priv->can_undo); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 um->priv->modified_undoing_group = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 gtk_source_undo_manager_begin_not_undoable_action (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 do |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 undo_action = g_list_nth_data (um->priv->actions, um->priv->next_redo + 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 g_return_if_fail (undo_action != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 /* undo_action->modified can be TRUE only if undo_action->order_in_group <= 1 */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 g_return_if_fail ((undo_action->order_in_group <= 1) || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 ((undo_action->order_in_group > 1) && !undo_action->modified)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 if (undo_action->order_in_group <= 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 /* Set modified to TRUE only if the buffer did not change its state from |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 * "not modified" to "modified" undoing an action (with order_in_group > 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 * in current group. */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 modified = (undo_action->modified && !um->priv->modified_undoing_group); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
496 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 switch (undo_action->action_type) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 case GTK_SOURCE_UNDO_ACTION_DELETE: |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 insert_text ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
502 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 undo_action->action.delete.start, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 undo_action->action.delete.text, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 strlen (undo_action->action.delete.text)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
506 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
507 if (undo_action->action.delete.forward) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 set_cursor ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
509 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 undo_action->action.delete.start); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 set_cursor ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
513 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 undo_action->action.delete.end); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 break; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 case GTK_SOURCE_UNDO_ACTION_INSERT: |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 delete_text ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 undo_action->action.insert.pos, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 undo_action->action.insert.pos + |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 undo_action->action.insert.chars); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
524 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
525 set_cursor ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 undo_action->action.insert.pos); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 break; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
530 case GTK_SOURCE_UNDO_ACTION_INSERT_ANCHOR: |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
531 delete_text ( |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
532 um->priv->document, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
533 undo_action->action.insert_anchor.pos, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
534 undo_action->action.insert_anchor.pos + 1); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
535 undo_action->action.insert_anchor.anchor->segment = NULL; /* XXX: This may be a bug in GTK+ */ |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
536 break; |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 default: |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 /* Unknown action type. */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 g_return_if_reached (); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 ++um->priv->next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 } while (undo_action->order_in_group > 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
546 if (modified) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 --um->priv->next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 gtk_text_buffer_set_modified (um->priv->document, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 ++um->priv->next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 gtk_source_undo_manager_end_not_undoable_action_internal (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 um->priv->modified_undoing_group = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 if (!um->priv->can_redo) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 um->priv->can_redo = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 g_signal_emit (G_OBJECT (um), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 undo_manager_signals [CAN_REDO], |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 0, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 TRUE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 if (um->priv->next_redo >= (gint)(g_list_length (um->priv->actions) - 1)) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 um->priv->can_undo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 g_signal_emit (G_OBJECT (um), |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 undo_manager_signals [CAN_UNDO], |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 0, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 gtk_source_undo_manager_redo (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 GtkSourceUndoAction *undo_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 gboolean modified = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 g_return_if_fail (um->priv->can_redo); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 undo_action = g_list_nth_data (um->priv->actions, um->priv->next_redo); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 g_return_if_fail (undo_action != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 gtk_source_undo_manager_begin_not_undoable_action (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 do |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 if (undo_action->modified) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 g_return_if_fail (undo_action->order_in_group <= 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 modified = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 --um->priv->next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 switch (undo_action->action_type) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 case GTK_SOURCE_UNDO_ACTION_DELETE: |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 delete_text ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 undo_action->action.delete.start, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 undo_action->action.delete.end); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 set_cursor ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 undo_action->action.delete.start); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 break; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 case GTK_SOURCE_UNDO_ACTION_INSERT: |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 set_cursor ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 undo_action->action.insert.pos); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 insert_text ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 um->priv->document, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 undo_action->action.insert.pos, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 undo_action->action.insert.text, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 undo_action->action.insert.length); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 break; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
628 case GTK_SOURCE_UNDO_ACTION_INSERT_ANCHOR: |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
629 set_cursor ( |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
630 um->priv->document, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
631 undo_action->action.insert_anchor.pos); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
632 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
633 insert_anchor ( |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
634 um->priv->document, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
635 undo_action->action.insert_anchor.pos, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
636 undo_action->action.insert_anchor.anchor); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
637 break; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
638 |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 default: |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 /* Unknown action type */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 ++um->priv->next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 g_return_if_reached (); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 if (um->priv->next_redo < 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 undo_action = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 undo_action = g_list_nth_data (um->priv->actions, um->priv->next_redo); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 } while ((undo_action != NULL) && (undo_action->order_in_group > 1)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 if (modified) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 ++um->priv->next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 gtk_text_buffer_set_modified (um->priv->document, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 --um->priv->next_redo; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 gtk_source_undo_manager_end_not_undoable_action_internal (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 if (um->priv->next_redo < 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 um->priv->can_redo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 if (!um->priv->can_undo) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 um->priv->can_undo = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, TRUE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 gtk_source_undo_action_free (GtkSourceUndoAction *action) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 if (action == NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 if (action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 g_free (action->action.insert.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 else if (action->action_type == GTK_SOURCE_UNDO_ACTION_DELETE) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 g_free (action->action.delete.text); |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
684 else if (action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT_ANCHOR) |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
685 g_object_unref(action->action.insert_anchor.anchor); |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 g_return_if_reached (); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 g_free (action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 gtk_source_undo_manager_free_action_list (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 GList *l; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 l = um->priv->actions; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 while (l != NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 GtkSourceUndoAction *action = l->data; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 if (action->order_in_group == 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 --um->priv->num_of_groups; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 if (action->modified) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 um->priv->modified_action = INVALID; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 gtk_source_undo_action_free (action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 l = g_list_next (l); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 g_list_free (um->priv->actions); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 um->priv->actions = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 gtk_source_undo_manager_insert_text_handler (GtkTextBuffer *buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 GtkTextIter *pos, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 const gchar *text, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 gint length, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 GtkSourceUndoAction undo_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 if (um->priv->running_not_undoable_actions > 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 undo_action.action_type = GTK_SOURCE_UNDO_ACTION_INSERT; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 undo_action.action.insert.pos = gtk_text_iter_get_offset (pos); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 undo_action.action.insert.text = (gchar*) text; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 undo_action.action.insert.length = length; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 undo_action.action.insert.chars = g_utf8_strlen (text, length); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 if ((undo_action.action.insert.chars > 1) || (g_utf8_get_char (text) == '\n')) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 undo_action.mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 undo_action.mergeable = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 undo_action.modified = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 gtk_source_undo_manager_add_action (um, &undo_action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
748 static void gtk_source_undo_manager_insert_anchor_handler (GtkTextBuffer *buffer, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
749 GtkTextIter *pos, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
750 GtkTextChildAnchor *anchor, |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
751 GtkSourceUndoManager *um) |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
752 { |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
753 GtkSourceUndoAction undo_action; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
754 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
755 if (um->priv->running_not_undoable_actions > 0) |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
756 return; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
757 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
758 undo_action.action_type = GTK_SOURCE_UNDO_ACTION_INSERT_ANCHOR; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
759 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
760 undo_action.action.insert_anchor.pos = gtk_text_iter_get_offset (pos); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
761 undo_action.action.insert_anchor.anchor = g_object_ref (anchor); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
762 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
763 undo_action.mergeable = FALSE; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
764 undo_action.modified = FALSE; |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
765 |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
766 gtk_source_undo_manager_add_action (um, &undo_action); |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
767 } |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
768 |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
769 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 gtk_source_undo_manager_delete_range_handler (GtkTextBuffer *buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
771 GtkTextIter *start, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 GtkTextIter *end, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
773 GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 GtkSourceUndoAction undo_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
776 GtkTextIter insert_iter; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 if (um->priv->running_not_undoable_actions > 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 undo_action.action_type = GTK_SOURCE_UNDO_ACTION_DELETE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 gtk_text_iter_order (start, end); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 undo_action.action.delete.start = gtk_text_iter_get_offset (start); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 undo_action.action.delete.end = gtk_text_iter_get_offset (end); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 undo_action.action.delete.text = get_chars ( |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 undo_action.action.delete.start, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 undo_action.action.delete.end); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
792 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 /* figure out if the user used the Delete or the Backspace key */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 gtk_text_buffer_get_iter_at_mark (buffer, &insert_iter, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
795 gtk_text_buffer_get_insert (buffer)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
796 if (gtk_text_iter_get_offset (&insert_iter) <= undo_action.action.delete.start) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 undo_action.action.delete.forward = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
798 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 undo_action.action.delete.forward = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 if (((undo_action.action.delete.end - undo_action.action.delete.start) > 1) || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
802 (g_utf8_get_char (undo_action.action.delete.text ) == '\n')) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 undo_action.mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
805 undo_action.mergeable = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
807 undo_action.modified = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
808 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 gtk_source_undo_manager_add_action (um, &undo_action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 g_free (undo_action.action.delete.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 gtk_source_undo_manager_begin_user_action_handler (GtkTextBuffer *buffer, GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 if (um->priv->running_not_undoable_actions > 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 um->priv->actions_in_current_group = 0; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
825 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
826 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
827 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 gtk_source_undo_manager_add_action (GtkSourceUndoManager *um, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 const GtkSourceUndoAction *undo_action) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 GtkSourceUndoAction* action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 if (um->priv->next_redo >= 0) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 gtk_source_undo_manager_free_first_n_actions (um, um->priv->next_redo + 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
836 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 um->priv->next_redo = -1; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 if (!gtk_source_undo_manager_merge_action (um, undo_action)) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 action = g_new (GtkSourceUndoAction, 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 *action = *undo_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 if (action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT) |
19548
e2135da444a5
"text" isn't guarranteed to be null terminated, so make sure we use
Mark Doliner <mark@kingant.net>
parents:
18086
diff
changeset
|
846 action->action.insert.text = g_strndup (undo_action->action.insert.text, undo_action->action.insert.length); |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 else if (action->action_type == GTK_SOURCE_UNDO_ACTION_DELETE) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 action->action.delete.text = g_strdup (undo_action->action.delete.text); |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
849 else if (action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT_ANCHOR) |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
850 { |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
851 /* Nothing needs to be done */ |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
852 } |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 g_free (action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 g_return_if_reached (); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
858 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
859 ++um->priv->actions_in_current_group; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 action->order_in_group = um->priv->actions_in_current_group; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 if (action->order_in_group == 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 ++um->priv->num_of_groups; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 um->priv->actions = g_list_prepend (um->priv->actions, action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
867 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 gtk_source_undo_manager_check_list_size (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
869 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
870 if (!um->priv->can_undo) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
871 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 um->priv->can_undo = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, TRUE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
876 if (um->priv->can_redo) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 um->priv->can_redo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
883 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
884 gtk_source_undo_manager_free_first_n_actions (GtkSourceUndoManager *um, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 gint n) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
886 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 gint i; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
889 if (um->priv->actions == NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 for (i = 0; i < n; i++) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 GtkSourceUndoAction *action = g_list_first (um->priv->actions)->data; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
896 if (action->order_in_group == 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
897 --um->priv->num_of_groups; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
898 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 if (action->modified) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 um->priv->modified_action = INVALID; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
902 gtk_source_undo_action_free (action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 um->priv->actions = g_list_delete_link (um->priv->actions, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 um->priv->actions); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
907 if (um->priv->actions == NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
908 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
909 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
912 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
913 gtk_source_undo_manager_check_list_size (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
914 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
915 gint undo_levels; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
916 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
917 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
918 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
919 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
920 undo_levels = gtk_source_undo_manager_get_max_undo_levels (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
921 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
922 if (undo_levels < 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
923 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
924 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
925 if (um->priv->num_of_groups > undo_levels) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
926 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
927 GtkSourceUndoAction *undo_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 GList *last; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 last = g_list_last (um->priv->actions); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 undo_action = (GtkSourceUndoAction*) last->data; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 do |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 GList *tmp; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
936 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
937 if (undo_action->order_in_group == 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
938 --um->priv->num_of_groups; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
939 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
940 if (undo_action->modified) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
941 um->priv->modified_action = INVALID; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
942 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
943 gtk_source_undo_action_free (undo_action); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
944 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
945 tmp = g_list_previous (last); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
946 um->priv->actions = g_list_delete_link (um->priv->actions, last); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
947 last = tmp; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
948 g_return_if_fail (last != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
949 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
950 undo_action = (GtkSourceUndoAction*) last->data; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
951 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 } while ((undo_action->order_in_group > 1) || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 (um->priv->num_of_groups > undo_levels)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
954 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
955 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
956 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
957 /** |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
958 * gtk_source_undo_manager_merge_action: |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 * @um: a #GtkSourceUndoManager. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 * @undo_action: a #GtkSourceUndoAction. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 * |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 * This function tries to merge the undo action at the top of |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 * the stack with a new undo action. So when we undo for example |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 * typing, we can undo the whole word and not each letter by itself. |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 * |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 * Return Value: %TRUE is merge was sucessful, %FALSE otherwise.² |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 **/ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
968 static gboolean |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 gtk_source_undo_manager_merge_action (GtkSourceUndoManager *um, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 const GtkSourceUndoAction *undo_action) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 GtkSourceUndoAction *last_action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 g_return_val_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um), FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 g_return_val_if_fail (um->priv != NULL, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 if (um->priv->actions == NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 return FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 last_action = (GtkSourceUndoAction*) g_list_nth_data (um->priv->actions, 0); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 if (!last_action->mergeable) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 return FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 if ((!undo_action->mergeable) || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
986 (undo_action->action_type != last_action->action_type)) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 last_action->mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 return FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 if (undo_action->action_type == GTK_SOURCE_UNDO_ACTION_DELETE) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 if ((last_action->action.delete.forward != undo_action->action.delete.forward) || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 ((last_action->action.delete.start != undo_action->action.delete.start) && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 (last_action->action.delete.start != undo_action->action.delete.end))) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
997 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
998 last_action->mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 return FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1001 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 if (last_action->action.delete.start == undo_action->action.delete.start) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1004 gchar *str; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 #define L (last_action->action.delete.end - last_action->action.delete.start - 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 #define g_utf8_get_char_at(p,i) g_utf8_get_char(g_utf8_offset_to_pointer((p),(i))) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1009 /* Deleted with the delete key */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1010 if ((g_utf8_get_char (undo_action->action.delete.text) != ' ') && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 (g_utf8_get_char (undo_action->action.delete.text) != '\t') && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 ((g_utf8_get_char_at (last_action->action.delete.text, L) == ' ') || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 (g_utf8_get_char_at (last_action->action.delete.text, L) == '\t'))) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1014 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 last_action->mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 return FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 str = g_strdup_printf ("%s%s", last_action->action.delete.text, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 undo_action->action.delete.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1021 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 g_free (last_action->action.delete.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1023 last_action->action.delete.end += (undo_action->action.delete.end - |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 undo_action->action.delete.start); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 last_action->action.delete.text = str; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1028 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 gchar *str; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1030 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 /* Deleted with the backspace key */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 if ((g_utf8_get_char (undo_action->action.delete.text) != ' ') && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 (g_utf8_get_char (undo_action->action.delete.text) != '\t') && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 ((g_utf8_get_char (last_action->action.delete.text) == ' ') || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 (g_utf8_get_char (last_action->action.delete.text) == '\t'))) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 last_action->mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 return FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1041 str = g_strdup_printf ("%s%s", undo_action->action.delete.text, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 last_action->action.delete.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 g_free (last_action->action.delete.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 last_action->action.delete.start = undo_action->action.delete.start; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 last_action->action.delete.text = str; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 else if (undo_action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 gchar* str; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 #define I (last_action->action.insert.chars - 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 if ((undo_action->action.insert.pos != |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 (last_action->action.insert.pos + last_action->action.insert.chars)) || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 ((g_utf8_get_char (undo_action->action.insert.text) != ' ') && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1058 (g_utf8_get_char (undo_action->action.insert.text) != '\t') && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1059 ((g_utf8_get_char_at (last_action->action.insert.text, I) == ' ') || |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 (g_utf8_get_char_at (last_action->action.insert.text, I) == '\t'))) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1061 ) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 last_action->mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 return FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 str = g_strdup_printf ("%s%s", last_action->action.insert.text, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 undo_action->action.insert.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1069 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 g_free (last_action->action.insert.text); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1071 last_action->action.insert.length += undo_action->action.insert.length; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 last_action->action.insert.text = str; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 last_action->action.insert.chars += undo_action->action.insert.chars; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1074 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 } |
22674
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
1076 else if (undo_action->action_type == GTK_SOURCE_UNDO_ACTION_INSERT_ANCHOR) |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
1077 { |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
1078 /* Nothing needs to be done */ |
27c9c55499f8
Smiley insertions can be undone with this fix. References #5577. But redo
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
1079 } |
17411
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1080 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1081 /* Unknown action inside undo merge encountered */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 g_return_val_if_reached (TRUE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 return TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 gint |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1088 gtk_source_undo_manager_get_max_undo_levels (GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 g_return_val_if_fail (um != NULL, 0); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 g_return_val_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um), 0); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1092 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 return um->priv->max_undo_levels; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1094 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 gtk_source_undo_manager_set_max_undo_levels (GtkSourceUndoManager *um, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1098 gint max_undo_levels) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 gint old_levels; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 g_return_if_fail (um != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 old_levels = um->priv->max_undo_levels; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 um->priv->max_undo_levels = max_undo_levels; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 if (max_undo_levels < 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 if (old_levels > max_undo_levels) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1112 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1113 /* strip redo actions first */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 while (um->priv->next_redo >= 0 && (um->priv->num_of_groups > max_undo_levels)) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1116 gtk_source_undo_manager_free_first_n_actions (um, 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1117 um->priv->next_redo--; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1119 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1120 /* now remove undo actions if necessary */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1121 gtk_source_undo_manager_check_list_size (um); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1122 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 /* emit "can_undo" and/or "can_redo" if appropiate */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1124 if (um->priv->next_redo < 0 && um->priv->can_redo) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1126 um->priv->can_redo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_REDO], 0, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1129 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 if (um->priv->can_undo && |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1131 um->priv->next_redo >= (gint)(g_list_length (um->priv->actions) - 1)) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1132 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 um->priv->can_undo = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 g_signal_emit (G_OBJECT (um), undo_manager_signals [CAN_UNDO], 0, FALSE); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1137 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 static void |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 gtk_source_undo_manager_modified_changed_handler (GtkTextBuffer *buffer, |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 GtkSourceUndoManager *um) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 GtkSourceUndoAction *action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 GList *list; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1145 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 g_return_if_fail (GTK_SOURCE_IS_UNDO_MANAGER (um)); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 g_return_if_fail (um->priv != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 if (um->priv->actions == NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1152 list = g_list_nth (um->priv->actions, um->priv->next_redo + 1); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 if (list != NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 action = (GtkSourceUndoAction*) list->data; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 else |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 action = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1158 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 if (gtk_text_buffer_get_modified (buffer) == FALSE) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1161 if (action != NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 action->mergeable = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1163 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 if (um->priv->modified_action != NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1166 if (um->priv->modified_action != INVALID) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 um->priv->modified_action->modified = FALSE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 um->priv->modified_action = NULL; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1170 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1171 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1172 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1173 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1174 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 if (action == NULL) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 g_return_if_fail (um->priv->running_not_undoable_actions > 0); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 return; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 /* gtk_text_buffer_get_modified (buffer) == TRUE */ |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 g_return_if_fail (um->priv->modified_action == NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1185 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1186 if (action->order_in_group > 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1187 um->priv->modified_undoing_group = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1188 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1189 while (action->order_in_group > 1) |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1190 { |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 list = g_list_next (list); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 g_return_if_fail (list != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 action = (GtkSourceUndoAction*) list->data; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 g_return_if_fail (action != NULL); |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 } |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 action->modified = TRUE; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 um->priv->modified_action = action; |
674d8bc2b980
Undo/Redo in GtkImHtml from GtkSourceView. This may not be adaquate enough for us.
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 } |