Statistics
| Revision:

root / src / undo.h @ 491

History | View | Annotate | Download (2 kB)

1 1 hiro
/*
2 1 hiro
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 1 hiro
 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
4 1 hiro
 *
5 1 hiro
 * This program is free software; you can redistribute it and/or modify
6 1 hiro
 * it under the terms of the GNU General Public License as published by
7 1 hiro
 * the Free Software Foundation; either version 2 of the License, or
8 1 hiro
 * (at your option) any later version.
9 1 hiro
 *
10 1 hiro
 * This program is distributed in the hope that it will be useful,
11 1 hiro
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1 hiro
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 1 hiro
 * GNU General Public License for more details.
14 1 hiro
 *
15 1 hiro
 * You should have received a copy of the GNU General Public License
16 1 hiro
 * along with this program; if not, write to the Free Software
17 1 hiro
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 1 hiro
 */
19 1 hiro
20 1 hiro
/* code ported from gedit */
21 1 hiro
22 1 hiro
#ifndef __UNDO_H__
23 1 hiro
#define __UNDO_H__
24 1 hiro
25 1 hiro
#include <glib.h>
26 1 hiro
#include <gtk/gtktextview.h>
27 1 hiro
#include <gtk/gtkitemfactory.h>
28 1 hiro
29 1 hiro
typedef enum
30 1 hiro
{
31 1 hiro
        UNDO_ACTION_INSERT,
32 1 hiro
        UNDO_ACTION_DELETE,
33 1 hiro
        UNDO_ACTION_REPLACE_INSERT,
34 1 hiro
        UNDO_ACTION_REPLACE_DELETE,
35 1 hiro
} UndoAction;
36 1 hiro
37 1 hiro
typedef enum
38 1 hiro
{
39 1 hiro
        UNDO_STATE_TRUE,
40 1 hiro
        UNDO_STATE_FALSE,
41 1 hiro
        UNDO_STATE_UNCHANGED,
42 1 hiro
        UNDO_STATE_REFRESH,
43 1 hiro
} UndoState;
44 1 hiro
45 1 hiro
typedef struct _UndoMain UndoMain;
46 1 hiro
47 1 hiro
typedef void (*UndoChangeStateFunc)        (UndoMain        *undostruct,
48 1 hiro
                                         gint                 undo_state,
49 1 hiro
                                         gint                 redo_state,
50 1 hiro
                                         gpointer         data);
51 1 hiro
52 1 hiro
struct _UndoMain
53 1 hiro
{
54 1 hiro
        GtkTextView *textview;
55 1 hiro
56 1 hiro
        GList *undo;
57 1 hiro
        GList *redo;
58 1 hiro
59 1 hiro
        UndoChangeStateFunc change_state_func;
60 1 hiro
        gpointer change_state_data;
61 1 hiro
62 1 hiro
        gboolean undo_state : 1;
63 1 hiro
        gboolean redo_state : 1;
64 1 hiro
65 1 hiro
        gint paste;
66 1 hiro
};
67 1 hiro
68 1 hiro
UndoMain *undo_init                (GtkWidget                *text);
69 1 hiro
void undo_destroy                (UndoMain                *undostruct);
70 1 hiro
71 1 hiro
void undo_set_change_state_func        (UndoMain                *undostruct,
72 1 hiro
                                 UndoChangeStateFunc         func,
73 1 hiro
                                 gpointer                 data);
74 1 hiro
75 1 hiro
void undo_undo                        (UndoMain                *undostruct);
76 1 hiro
void undo_redo                        (UndoMain                *undostruct);
77 1 hiro
void undo_block                        (UndoMain                *undostruct);
78 1 hiro
void undo_unblock                (UndoMain                *undostruct);
79 1 hiro
80 1 hiro
#endif /* __UNDO_H__ */