File: event.hh

package info (click to toggle)
abacus 0.9.13-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 6,308 kB
  • ctags: 5,121
  • sloc: ansic: 27,541; cpp: 11,425; tcl: 7,564; makefile: 386; yacc: 327; lex: 265; sh: 221
file content (170 lines) | stat: -rw-r--r-- 3,215 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* $Id: event.hh,v 1.1 1998/08/17 20:23:26 cthulhu Exp $ */

#ifndef _EVENT_DOT_HH_
#define _EVENT_DOT_HH_

#include "cell.hh"
#include "list.hh"

#define UNDO_DEPTH 20

class Event{
public:
  virtual void UndoEvent()=0;
  virtual void RedoEvent()=0;
};

/********************* Cell Events ********************/

class CellSetEvent: public Event {
  short col,row;
  Sheet *sheet;
  Cell cell_sav;
public:
  CellSetEvent(Sheet *, Cell *);
  void UndoEvent();
  void RedoEvent();
};

/***********Col/Row Insert and Delete Events***********/

class ColRowInsertEvent: public Event {
  char col_or_row;
  short cr_ind,cr_num;
  Sheet *sheet;
  Lista<Event> event_l;
  Node<Event> *event_it;

public:
  ColRowInsertEvent(Sheet *,char,short,short);
  void UndoEvent();
  void RedoEvent();

  void RegisterGraphEvent(Event *);
  void UndoGraph();
  void RedoGraph();

};

class ColRowDeleteEvent: public Event {
  char col_or_row;
  short cr_ind,cr_num;
  Sheet *sheet;
  array<Cell> lastcells;
  Lista<Event> event_l;
  Node<Event> *event_it;

public:
  ColRowDeleteEvent(Sheet *,char,short,short);
  void UndoEvent();
  void RedoEvent();

  void RegisterGraphEvent(Event *);
  void UndoGraph();
  void RedoGraph();
};

/******************** Range Events ********************/

class RangeEvent: public Event {
  Sheet *sheet;
  short x_start,y_start,x_end,y_end;
  Cell *cell_sav;
  array<Cell *> cells_sav;
public:
  RangeEvent(Sheet *,short,short,short=-1,short=-1);
  ~RangeEvent();
  void UndoEvent();
  void RedoEvent();
  short GetXStart();
  short GetYStart();
  short GetXEnd();
  short GetYEnd();
  Sheet *GetSheet();
};

class RangeMoveEvent: public Event {
  RangeEvent *from,*to;
public:
  RangeMoveEvent(RangeEvent *,RangeEvent *);
  ~RangeMoveEvent();
  void UndoEvent();
  void RedoEvent();
};

/******************* Format Events ********************/

class SetFormatEvent: public Event {
  Sheet *sheet;
  short startcol,startrow,endcol,endrow;
  Format lastformat;
  array<Format> lastformats;
public:
  SetFormatEvent(Sheet *,short,short,short =-1,short =-1);
  ~SetFormatEvent();
  void UndoEvent();
  void RedoEvent();
};

/***************** Geometry Events ********************/

class SetColWidthEvent: public Event {
  Sheet *sheet;
  short col;
  int width;
public:
  SetColWidthEvent(Sheet *,short);
  void UndoEvent();
  void RedoEvent();
};

class SetRowHeightEvent: public Event {
  Sheet *sheet;
  short row;
  int height;
public:
  SetRowHeightEvent(Sheet *,short);
  void UndoEvent();
  void RedoEvent();
};

/***************** Graphics Events ********************/

class SetGraphEvent: public Event {
  Sheet *sheet;
  Graph *gr;
public:
  SetGraphEvent(Sheet *,Graph);
  ~SetGraphEvent();
  void UndoEvent();
  void RedoEvent();
};

class DelGraphEvent: public Event {
  Sheet *sheet;
  Graph *gr;
public:
  DelGraphEvent(Sheet *,Graph);
  ~DelGraphEvent();
  void UndoEvent();
  void RedoEvent();
};

class ChangeGraphEvent: public Event {
  Sheet *sheet;
  Graph *gr;

public:
  ChangeGraphEvent(Sheet *,Graph);
  ~ChangeGraphEvent();
  void UndoEvent();
  void RedoEvent();
};

#endif

/* $Log: event.hh,v $
 * Revision 1.1  1998/08/17 20:23:26  cthulhu
 * Initial revision
 * */