~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/event-log.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Author:
3
3
 *   Gustav Broberg <broberg@kth.se>
4
4
 *
5
 
 * Copyright (c) 2006 Authors
 
5
 * Copyright (c) 2006, 2007 Authors
6
6
 *
7
7
 * Released under GNU GPL, read the file 'COPYING' for more information
8
8
 */
13
13
#include "event-log.h"
14
14
#include "inkscape.h"
15
15
#include "util/ucompose.hpp"
 
16
#include "document.h"
 
17
#include "xml/repr.h"
 
18
#include "sp-object.h"
16
19
 
17
20
namespace Inkscape {
18
21
 
29
32
{
30
33
    // add initial pseudo event
31
34
    Gtk::TreeRow curr_row = *(_event_list_store->append());
32
 
    _curr_event = _last_event = curr_row;
 
35
    _curr_event = _last_saved = _last_event = curr_row;
33
36
    
34
37
    curr_row[_columns.description] = _("[Unchanged]");
35
38
    curr_row[_columns.type] = SP_VERB_FILE_NEW;
42
45
{
43
46
    if ( !_notifications_blocked ) {
44
47
    
 
48
        // make sure the supplied event matches the next undoable event
 
49
        g_return_if_fail ( _getUndoEvent() && (*(_getUndoEvent()))[_columns.event] == log );
 
50
 
45
51
        // if we're on the first child event...
46
52
        if ( _curr_event->parent() &&
47
53
             _curr_event == _curr_event->parent()->children().begin() )
69
75
            }
70
76
        }
71
77
 
 
78
        checkForVirginity();
 
79
 
72
80
        // update the view
73
81
        if (_connected) {
74
82
            (*_callback_connections)[CALLB_SELECTION_CHANGE].block();
93
101
{
94
102
    if ( !_notifications_blocked ) {
95
103
 
 
104
        // make sure the supplied event matches the next redoable event
 
105
        g_return_if_fail ( _getRedoEvent() && (*(_getRedoEvent()))[_columns.event] == log );
 
106
 
96
107
        // if we're on a parent event...
97
108
        if ( !_curr_event->children().empty() ) {
98
109
 
126
137
            }
127
138
        }
128
139
 
 
140
        checkForVirginity();
 
141
 
129
142
        // update the view
130
143
        if (_connected) {
131
144
            Gtk::TreePath curr_path = _event_list_store->get_path(_curr_event);
149
162
void 
150
163
EventLog::notifyUndoCommitEvent(Event* log)
151
164
{
152
 
    // If we're not at the last event in list then erase the previously undone events 
153
 
    if ( _last_event != _curr_event ) {
154
 
 
155
 
        _last_event = _curr_event;
156
 
 
157
 
        if ( !_last_event->children().empty() ) {
158
 
            _last_event = _last_event->children().begin();
159
 
        } else {
160
 
            ++_last_event;
161
 
        }
162
 
 
163
 
        while ( _last_event != _event_list_store->children().end() ) {
164
 
 
165
 
            if (_last_event->parent()) {
166
 
                while ( _last_event != _last_event->parent()->children().end() ) {
167
 
                    _last_event = _event_list_store->erase(_last_event);
168
 
                }
169
 
                _last_event = _last_event->parent();
170
 
 
171
 
                (*_last_event)[_columns.child_count] = _last_event->children().size() + 1;
172
 
 
173
 
                ++_last_event;
174
 
            } else {
175
 
                _last_event = _event_list_store->erase(_last_event);
176
 
            }
177
 
 
178
 
        }
179
 
    }
 
165
    _clearRedo();
180
166
 
181
167
    const unsigned int event_type = log->type;
182
168
 
207
193
 
208
194
    _curr_event = _last_event = curr_row;
209
195
 
 
196
    curr_row[_columns.event] = log;
210
197
    curr_row[_columns.type] = event_type;
211
198
    curr_row[_columns.description] = log->description;
212
199
 
 
200
    checkForVirginity();
 
201
 
213
202
    // update the view
214
203
    if (_connected) {
215
204
        Gtk::TreePath curr_path = _event_list_store->get_path(_curr_event);
228
217
    updateUndoVerbs();
229
218
}
230
219
 
 
220
void
 
221
EventLog::notifyClearUndoEvent()
 
222
{
 
223
    _clearUndo();    
 
224
    updateUndoVerbs();
 
225
}
 
226
 
 
227
void
 
228
EventLog::notifyClearRedoEvent()
 
229
{
 
230
    _clearRedo();
 
231
    updateUndoVerbs();
 
232
}
 
233
 
231
234
void 
232
235
EventLog::connectWithDialog(Gtk::TreeView *event_list_view, CallbackMap *callback_connections)
233
236
{
317
320
    return redo_event;
318
321
}
319
322
 
320
 
}
 
323
void
 
324
EventLog::_clearUndo()
 
325
{
 
326
    // TODO: Implement when needed
 
327
}
 
328
 
 
329
void
 
330
EventLog::_clearRedo()
 
331
{
 
332
    if ( _last_event != _curr_event ) {
 
333
 
 
334
        _last_event = _curr_event;
 
335
 
 
336
        if ( !_last_event->children().empty() ) {
 
337
            _last_event = _last_event->children().begin();
 
338
        } else {
 
339
            ++_last_event;
 
340
        }
 
341
 
 
342
        while ( _last_event != _event_list_store->children().end() ) {
 
343
 
 
344
            if (_last_event->parent()) {
 
345
                while ( _last_event != _last_event->parent()->children().end() ) {
 
346
                    _last_event = _event_list_store->erase(_last_event);
 
347
                }
 
348
                _last_event = _last_event->parent();
 
349
 
 
350
                (*_last_event)[_columns.child_count] = _last_event->children().size() + 1;
 
351
 
 
352
                ++_last_event;
 
353
            } else {
 
354
                _last_event = _event_list_store->erase(_last_event);
 
355
            }
 
356
 
 
357
        }
 
358
 
 
359
    }
 
360
}
 
361
 
 
362
/* mark document as untouched if we reach a state where the document was previously saved */
 
363
void
 
364
EventLog::checkForVirginity() {
 
365
    g_return_if_fail (_document);
 
366
    if (_curr_event == _last_saved) {
 
367
        _document->setModifiedSinceSave(false);
 
368
    }
 
369
}
 
370
 
 
371
} // namespace Inkscape
 
372
 
321
373
 
322
374
/*
323
375
  Local Variables: