Lines Matching refs:doc

63 void Inkscape::DocumentUndo::setUndoSensitive(SPDocument *doc, bool sensitive)
65 g_assert (doc != NULL);
66 g_assert (doc->priv != NULL);
68 if ( sensitive == doc->priv->sensitive )
72 sp_repr_begin_transaction (doc->rdoc);
74 doc->priv->partial = sp_repr_coalesce_log (
75 doc->priv->partial,
76 sp_repr_commit_undoable (doc->rdoc)
80 doc->priv->sensitive = sensitive;
97 void Inkscape::DocumentUndo::done(SPDocument *doc, const unsigned int event_type, Glib::ustring const &event_description)
99 maybeDone(doc, NULL, event_type, event_description);
102 void Inkscape::DocumentUndo::resetKey( SPDocument *doc )
104 doc->actionkey.clear();
120 CommitEvent(SPDocument *doc, const gchar *key, const unsigned int type)
124 gchar *serial = g_strdup_printf("%lu", doc->serial());
139 void Inkscape::DocumentUndo::maybeDone(SPDocument *doc, const gchar *key, const unsigned int event_type,
142 g_assert (doc != NULL);
143 g_assert (doc->priv != NULL);
144 g_assert (doc->priv->sensitive);
149 Inkscape::Debug::EventTracker<CommitEvent> tracker(doc, key, event_type);
151 doc->collectOrphans();
153 doc->ensureUpToDate();
155 DocumentUndo::clearRedo(doc);
157 Inkscape::XML::Event *log = sp_repr_coalesce_log (doc->priv->partial, sp_repr_commit_undoable (doc->rdoc));
158 doc->priv->partial = NULL;
161 sp_repr_begin_transaction (doc->rdoc);
165 if (key && !doc->actionkey.empty() && (doc->actionkey == key) && !doc->priv->undo.empty()) {
166 (doc->priv->undo.back())->event =
167 sp_repr_coalesce_log ((doc->priv->undo.back())->event, log);
170 doc->priv->undo.push_back(event);
171 doc->priv->history_size++;
172 doc->priv->undoStackObservers.notifyUndoCommitEvent(event);
176 doc->actionkey = key;
178 doc->actionkey.clear();
181 doc->virgin = FALSE;
182 doc->setModifiedSinceSave();
184 sp_repr_begin_transaction (doc->rdoc);
186 doc->priv->commit_signal.emit();
189 void Inkscape::DocumentUndo::cancel(SPDocument *doc)
191 g_assert (doc != NULL);
192 g_assert (doc->priv != NULL);
193 g_assert (doc->priv->sensitive);
195 sp_repr_rollback (doc->rdoc);
197 if (doc->priv->partial) {
198 sp_repr_undo_log (doc->priv->partial);
199 sp_repr_free_log (doc->priv->partial);
200 doc->priv->partial = NULL;
203 sp_repr_begin_transaction (doc->rdoc);
206 static void finish_incomplete_transaction(SPDocument &doc) {
207 SPDocumentPrivate &priv=*doc.priv;
208 Inkscape::XML::Event *log=sp_repr_commit_undoable(doc.rdoc);
220 static void perform_document_update(SPDocument &doc) {
221 sp_repr_begin_transaction(doc.rdoc);
222 doc.ensureUpToDate();
224 Inkscape::XML::Event *update_log=sp_repr_commit_undoable(doc.rdoc);
230 if (!doc.priv->undo.empty()) {
231 Inkscape::Event* undo_stack_top = doc.priv->undo.back();
239 gboolean Inkscape::DocumentUndo::undo(SPDocument *doc)
248 g_assert (doc != NULL);
249 g_assert (doc->priv != NULL);
250 g_assert (doc->priv->sensitive);
252 doc->priv->sensitive = FALSE;
253 doc->priv->seeking = true;
255 doc->actionkey.clear();
257 finish_incomplete_transaction(*doc);
259 if (! doc->priv->undo.empty()) {
260 Inkscape::Event *log = doc->priv->undo.back();
261 doc->priv->undo.pop_back();
263 perform_document_update(*doc);
265 doc->priv->redo.push_back(log);
267 doc->setModifiedSinceSave();
268 doc->priv->undoStackObservers.notifyUndoEvent(log);
275 sp_repr_begin_transaction (doc->rdoc);
277 doc->priv->sensitive = TRUE;
278 doc->priv->seeking = false;
286 gboolean Inkscape::DocumentUndo::redo(SPDocument *doc)
295 g_assert (doc != NULL);
296 g_assert (doc->priv != NULL);
297 g_assert (doc->priv->sensitive);
299 doc->priv->sensitive = FALSE;
300 doc->priv->seeking = true;
302 doc->actionkey.clear();
304 finish_incomplete_transaction(*doc);
306 if (! doc->priv->redo.empty()) {
307 Inkscape::Event *log = doc->priv->redo.back();
308 doc->priv->redo.pop_back();
310 doc->priv->undo.push_back(log);
312 doc->setModifiedSinceSave();
313 doc->priv->undoStackObservers.notifyRedoEvent(log);
320 sp_repr_begin_transaction (doc->rdoc);
322 doc->priv->sensitive = TRUE;
323 doc->priv->seeking = false;
331 void Inkscape::DocumentUndo::clearUndo(SPDocument *doc)
333 if (! doc->priv->undo.empty())
334 doc->priv->undoStackObservers.notifyClearUndoEvent();
335 while (! doc->priv->undo.empty()) {
336 Inkscape::Event *e = doc->priv->undo.back();
337 doc->priv->undo.pop_back();
339 doc->priv->history_size--;
343 void Inkscape::DocumentUndo::clearRedo(SPDocument *doc)
345 if (!doc->priv->redo.empty())
346 doc->priv->undoStackObservers.notifyClearRedoEvent();
348 while (! doc->priv->redo.empty()) {
349 Inkscape::Event *e = doc->priv->redo.back();
350 doc->priv->redo.pop_back();
352 doc->priv->history_size--;