Subversion Repositories Scribus

Rev

Rev 6266 | Rev 6820 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
2218 cbradney 7
/***************************************************************************
1111 tsoots 8
 *   Copyright (C) 2005 by Riku Leino                                      *
5116 tsoots 9
 *   riku@scribus.info                                                     *
1111 tsoots 10
 *                                                                         *
11
 *   This program is free software; you can redistribute it and/or modify  *
12
 *   it under the terms of the GNU General Public License as published by  *
13
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 *   (at your option) any later version.                                   *
15
 *                                                                         *
16
 *   This program is distributed in the hope that it will be useful,       *
17
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
 *   GNU General Public License for more details.                          *
20
 *                                                                         *
21
 *   You should have received a copy of the GNU General Public License     *
22
 *   along with this program; if not, write to the                         *
23
 *   Free Software Foundation, Inc.,                                       *
24
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
25
 ***************************************************************************/
26
 
27
#include "undomanager.h"
1119 fschmid 28
#include "undomanager.moc"
1142 tsoots 29
#include "undogui.h"
2688 craig 30
#include "scconfig.h"
2856 cbradney 31
#include "prefsmanager.h"
1197 tsoots 32
#include "prefscontext.h"
33
#include "prefsfile.h"
5116 tsoots 34
#include "scraction.h"
5781 cbradney 35
#include "scribuscore.h"
5116 tsoots 36
#include "undostack.h"
1111 tsoots 37
#include <qvaluelist.h>
38
 
1693 craig 39
#include "scpaths.h"
40
 
1190 tsoots 41
extern QPixmap loadIcon(QString nam);
42
 
5116 tsoots 43
UndoManager* UndoManager::instance_          = 0;
44
bool         UndoManager::undoEnabled_       = true;
45
int          UndoManager::undoEnabledCounter_ = 0;
1111 tsoots 46
 
47
UndoManager* UndoManager::instance()
48
{
5116 tsoots 49
        if (instance_ == 0)
50
                instance_ = new UndoManager();
1111 tsoots 51
 
5116 tsoots 52
        return instance_;
1111 tsoots 53
}
54
 
55
void UndoManager::setUndoEnabled(bool isEnabled)
56
{
5116 tsoots 57
        if (isEnabled && undoEnabledCounter_ == 0)
1430 tsoots 58
                return; // nothing to do undo is already enabled.
5116 tsoots 59
        else if (isEnabled && undoEnabledCounter_ > 0)
60
                --undoEnabledCounter_;
1430 tsoots 61
        else if (!isEnabled)
5116 tsoots 62
                ++undoEnabledCounter_;
1430 tsoots 63
 
5116 tsoots 64
        undoEnabled_ = undoEnabledCounter_ == 0;
65
        if (undoEnabled_)
1111 tsoots 66
                connectGuis();
5116 tsoots 67
        else if (undoEnabledCounter_ == 1)
1430 tsoots 68
                disconnectGuis(); // disconnect only once when setUndoEnabled(false) has been called
69
                                  // no need to call again if next setUndoEnabled() call will also be false.
1111 tsoots 70
}
71
 
72
bool UndoManager::undoEnabled()
73
{
5116 tsoots 74
        return undoEnabled_;
1111 tsoots 75
}
76
 
77
UndoManager::UndoManager()
78
{
5116 tsoots 79
        currentUndoObjectId_ = -1;
1190 tsoots 80
        if (!UndoManager::IGuides)
81
                initIcons();
5116 tsoots 82
        prefs_ = PrefsManager::instance()->prefsFile->getContext("undo");
83
        transaction_= 0;
84
        transactionTarget_ = 0;
2198 cbradney 85
        languageChange();
5938 tsoots 86
        setUndoEnabled(prefs_->getBool("enabled", true));
1111 tsoots 87
}
88
 
1213 tsoots 89
void UndoManager::beginTransaction(const QString &targetName,
1250 tsoots 90
                                   QPixmap *targetPixmap,
1213 tsoots 91
                                   const QString &name,
92
                                   const QString &description,
1250 tsoots 93
                                   QPixmap *actionPixmap)
1213 tsoots 94
{
5116 tsoots 95
        if (!undoEnabled_)
1340 tsoots 96
                return;
5116 tsoots 97
        if (transaction_) // begin a transaction_inside transaction
98
                transactions_.push_back(
99
                        std::pair<TransactionObject*, TransactionState*>(transactionTarget_, transaction_));
100
        transaction_= new TransactionState();
101
        transactionTarget_ = new TransactionObject();
102
        transactionTarget_->setUName(targetName); // Name which will be in action history
1250 tsoots 103
        if (targetPixmap)
5116 tsoots 104
                transactionTarget_->setUPixmap(targetPixmap);
1228 tsoots 105
        if (name.length() > 0)          // if left to 0 length action will be fetched from the
5116 tsoots 106
                transaction_->setName(name); // last added UndoState in this transaction
1238 tsoots 107
        if (description.length() > 0)
5116 tsoots 108
                transaction_->setDescription(description); // tool tip for action history
1250 tsoots 109
        if (actionPixmap)
5116 tsoots 110
                transaction_->setPixmap(actionPixmap); // for action history
1213 tsoots 111
}
112
 
113
void UndoManager::cancelTransaction()
114
{
5116 tsoots 115
        delete transaction_;
116
        transaction_= 0;
117
        delete transactionTarget_;
118
        transactionTarget_ = 0;
119
        if (!transactions_.empty())
1238 tsoots 120
        {
5116 tsoots 121
                // fetch the next transaction_from the vector
122
                transactionTarget_ = transactions_[transactions_.size() - 1].first;
123
                transaction_= transactions_[transactions_.size() - 1].second;
124
//              delete transactions_[transactions_.size() - 1];
125
                transactions_.erase(transactions_.end() - 1);
1238 tsoots 126
        }
1213 tsoots 127
}
128
 
129
void UndoManager::commit(const QString &targetName,
1250 tsoots 130
                         QPixmap *targetPixmap,
1213 tsoots 131
                         const QString &name,
132
                         const QString &description,
1250 tsoots 133
                         QPixmap *actionPixmap)
1213 tsoots 134
{
5116 tsoots 135
        if (!transaction_ || !transactionTarget_ || !undoEnabled_)
1213 tsoots 136
        {
137
                cancelTransaction();
138
                return;
139
        }
140
        if (targetName.length() > 0)
5116 tsoots 141
                transactionTarget_->setUName(targetName);
1250 tsoots 142
        if (targetPixmap)
5116 tsoots 143
                transactionTarget_->setUPixmap(targetPixmap);
1213 tsoots 144
        if (name.length() > 0)
5116 tsoots 145
                transaction_->setName(name);
1213 tsoots 146
        if (description.length() > 0)
5116 tsoots 147
                transaction_->setDescription(description);
1250 tsoots 148
        if (actionPixmap)
5116 tsoots 149
                transaction_->setPixmap(actionPixmap);
1213 tsoots 150
 
5116 tsoots 151
        UndoObject *tmpu = transactionTarget_;
152
        TransactionState *tmps = transaction_;
1238 tsoots 153
 
5116 tsoots 154
        if (!transactions_.empty())
1226 tsoots 155
        {
5116 tsoots 156
                // fetch the next transaction_to be an active transaction
157
                transactionTarget_ = transactions_[transactions_.size() - 1].first;
158
                transaction_= transactions_[transactions_.size() - 1].second;
159
//              delete transactions_[transactions_.size() - 1]
160
                transactions_.erase(transactions_.end() - 1);
1238 tsoots 161
        }
162
        else
163
        {
5116 tsoots 164
                transaction_ = 0;
165
                transactionTarget_ = 0;
1238 tsoots 166
        }
167
 
168
        if (tmps->sizet() > 0) // are there any actions inside the commited transaction
169
        {
2877 cbradney 170
                if (tmps->getName().isEmpty())
1226 tsoots 171
                        tmps->useActionName();
1213 tsoots 172
                action(tmpu, tmps);
1238 tsoots 173
        } // if not just delete objects
1226 tsoots 174
        else
175
        {
176
                delete tmpu;
2604 tsoots 177
                tmpu = 0;
1226 tsoots 178
                delete tmps;
2604 tsoots 179
                tmps = 0;
1226 tsoots 180
        }
1213 tsoots 181
}
182
 
183
bool UndoManager::isTransactionMode()
184
{
5116 tsoots 185
        return transaction_ ? true : false;
1213 tsoots 186
}
187
 
1111 tsoots 188
void UndoManager::registerGui(UndoGui* gui)
189
{
2604 tsoots 190
        if (gui == 0)
1111 tsoots 191
                return;
192
 
193
        setUndoEnabled(false);
194
        setState(gui);
5116 tsoots 195
        undoGuis_.push_back(gui);
1431 tsoots 196
        setUndoEnabled(true);
1111 tsoots 197
}
198
 
199
void UndoManager::setState(UndoGui* gui, int uid)
200
{
201
        gui->clear();
1443 tsoots 202
 
5116 tsoots 203
        if ( stacks_[currentDoc_].size() == 0 )
4293 mrdocs 204
                return;
205
 
5116 tsoots 206
        StateList::iterator itstartU = stacks_[currentDoc_].undoActions_.begin(); // undo actions
207
        StateList::iterator itendU   = stacks_[currentDoc_].undoActions_.end();
208
 
209
        StateList::iterator itstartR = stacks_[currentDoc_].redoActions_.begin(); // redo actions
210
        StateList::iterator itendR   = stacks_[currentDoc_].redoActions_.end();
211
 
1443 tsoots 212
        if (uid > -1)
1477 tsoots 213
        { // find the range from where actions are added when in obj. spec. mode
5116 tsoots 214
                StateList::iterator it2;
215
                for (it2 = stacks_[currentDoc_].undoActions_.begin();
216
                     it2 != stacks_[currentDoc_].undoActions_.end(); ++it2)
1443 tsoots 217
                {
5116 tsoots 218
                        UndoState*  tmp  = *it2;
1443 tsoots 219
                        TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
5116 tsoots 220
                        if (ts && !ts->containsOnly(uid))
1443 tsoots 221
                        {
5116 tsoots 222
                                if (it2 != stacks_[currentDoc_].undoActions_.begin())
223
                                        itendU = --it2;
1443 tsoots 224
                                break;
225
                        }
226
                }
5116 tsoots 227
                StateList::iterator it3;
228
                for (it3 = stacks_[currentDoc_].redoActions_.begin();
229
                     it3 != stacks_[currentDoc_].redoActions_.end(); ++it3)
1477 tsoots 230
                {
5116 tsoots 231
                        UndoState*  tmp  = *it3;
1477 tsoots 232
                        TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
5116 tsoots 233
                        if (ts && !ts->containsOnly(uid))
1477 tsoots 234
                        {
5116 tsoots 235
                                itendR = it3;
1477 tsoots 236
                                break;
237
                        }
238
                }
1443 tsoots 239
        }
1477 tsoots 240
 
5116 tsoots 241
        if (stacks_[currentDoc_].undoItems() > 0)
1443 tsoots 242
        {
5116 tsoots 243
                if (itendU == stacks_[currentDoc_].undoActions_.end())
244
                        --itendU;
245
                for (; itendU >= itstartU; --itendU) // insert undo actions
246
                {
247
                        UndoState*  state  = *itendU;
248
                        UndoObject* target = state->undoObject();
1443 tsoots 249
 
5116 tsoots 250
                        if (target && (uid == -1 || target->getUId() == static_cast<uint>(uid)))
251
                                gui->insertUndoItem(target, state);
252
                        if (itendU == itstartU)
253
                                break;
254
                }
255
        }
256
 
257
        if (stacks_[currentDoc_].redoItems() > 0)
258
        {
259
                --itendR;
260
                for (; itstartR <= itendR; ++itstartR) // insert redo actions
1443 tsoots 261
                {
5116 tsoots 262
                        UndoState*  state  = *itstartR;
263
                        UndoObject* target = state->undoObject();
264
 
265
                        if (target && (uid == -1 || target->getUId() == static_cast<uint>(uid)))
1443 tsoots 266
                                gui->insertRedoItem(target, state);
5116 tsoots 267
                        if (itendR == itstartR)
268
                                break;
1443 tsoots 269
                }
1111 tsoots 270
        }
271
}
272
 
273
void UndoManager::connectGuis()
274
{
5116 tsoots 275
        for (uint i = 0; i < undoGuis_.size(); ++i)
1111 tsoots 276
        {
5116 tsoots 277
                UndoGui *gui = undoGuis_[i];
1111 tsoots 278
 
5116 tsoots 279
                connect(gui, SIGNAL(undo(int)), this, SLOT(undo(int)));
280
                connect(gui, SIGNAL(redo(int)), this, SLOT(redo(int)));
1111 tsoots 281
                connect(this, SIGNAL(newAction(UndoObject*, UndoState*)),
282
                gui, SLOT(insertUndoItem(UndoObject*, UndoState*)));
283
                connect(this, SIGNAL(popBack()), gui, SLOT(popBack()));
284
                connect(this, SIGNAL(undoSignal(int)), gui, SLOT(updateUndo(int)));
285
                connect(this, SIGNAL(redoSignal(int)), gui, SLOT(updateRedo(int)));
1457 tsoots 286
                connect(this, SIGNAL(clearRedo()), gui, SLOT(clearRedo()));
4985 cbradney 287
                gui->setEnabled(true);
288
                gui->updateUndoActions();
1111 tsoots 289
        }
290
}
291
 
292
void UndoManager::disconnectGuis()
293
{
5116 tsoots 294
        for (uint i = 0; i < undoGuis_.size(); ++i)
1111 tsoots 295
        {
5116 tsoots 296
                UndoGui *gui = undoGuis_[i];
1111 tsoots 297
 
5116 tsoots 298
                disconnect(gui, SIGNAL(undo(int)), this, SLOT(undo(int)));
299
                disconnect(gui, SIGNAL(redo(int)), this, SLOT(redo(int)));
1111 tsoots 300
                disconnect(this, SIGNAL(newAction(UndoObject*, UndoState*)),
301
                   gui, SLOT(insertUndoItem(UndoObject*, UndoState*)));
302
                disconnect(this, SIGNAL(popBack()), gui, SLOT(popBack()));
303
                disconnect(this, SIGNAL(undoSignal(int)), gui, SLOT(updateUndo(int)));
304
                disconnect(this, SIGNAL(redoSignal(int)), gui, SLOT(updateRedo(int)));
1457 tsoots 305
                disconnect(this, SIGNAL(clearRedo()), gui, SLOT(clearRedo()));
4985 cbradney 306
                gui->setEnabled(false);
1111 tsoots 307
        }
308
}
309
 
310
void UndoManager::removeGui(UndoGui* gui)
311
{
312
        std::vector<UndoGui*>::iterator it;
5116 tsoots 313
        for (it = undoGuis_.begin(); it != undoGuis_.end(); ++it)
1111 tsoots 314
                if (*it == gui)
5116 tsoots 315
                        undoGuis_.erase(it);
1111 tsoots 316
}
317
 
318
void UndoManager::switchStack(const QString& stackName)
319
{
6725 tsoots 320
        if (stackName == currentDoc_)
321
                return; // already current stack
5116 tsoots 322
        currentDoc_ = stackName;
323
        if (!stacks_.contains(currentDoc_))
324
                stacks_[currentDoc_] = UndoStack();
1111 tsoots 325
 
5116 tsoots 326
        stacks_[currentDoc_].setMaxSize(prefs_->getInt("historylength", 20));
327
        for (uint i = 0; i < undoGuis_.size(); ++i)
328
                setState(undoGuis_[i]);
329
 
330
        setMenuTexts();
1111 tsoots 331
}
332
 
1252 tsoots 333
void UndoManager::renameStack(const QString& newName)
1111 tsoots 334
{
5116 tsoots 335
        if (currentDoc_ == newName)
1190 tsoots 336
                return;
1829 tsoots 337
 
5116 tsoots 338
        if (stacks_[currentDoc_].size() == 0) {
339
                currentDoc_ = newName;
1880 tsoots 340
                return;
341
        }
342
 
5116 tsoots 343
        UndoStack tmp(stacks_[currentDoc_]);
344
        stacks_.erase(currentDoc_);
345
        stacks_[newName] = tmp;
346
        currentDoc_ = newName;
1111 tsoots 347
}
348
 
1252 tsoots 349
void UndoManager::removeStack(const QString& stackName)
1111 tsoots 350
{
5116 tsoots 351
        if (stacks_.contains(stackName))
1111 tsoots 352
        {
5116 tsoots 353
                stacks_[stackName].clear();
354
                stacks_.erase(stackName);
355
                if (currentDoc_ == stackName)
1111 tsoots 356
                {
5116 tsoots 357
                        for (uint i = 0; i < undoGuis_.size(); ++i)
358
                                undoGuis_[i]->clear();
359
                        currentDoc_ = "__no_name__";
1111 tsoots 360
                }
361
        }
362
}
363
 
5938 tsoots 364
void UndoManager::clearStack()
365
{
366
        stacks_[currentDoc_].clear();
367
        for (uint i = 0; i < undoGuis_.size(); ++i)
368
        {
369
                undoGuis_[i]->clear();
370
                setState(undoGuis_[i]);
371
        }
372
}
373
 
1340 tsoots 374
void UndoManager::action(UndoObject* target, UndoState* state, QPixmap *targetPixmap)
1111 tsoots 375
{
2604 tsoots 376
        QPixmap *oldIcon = 0;
1340 tsoots 377
        if (targetPixmap)
378
        {
379
                oldIcon = target->getUPixmap();
380
                target->setUPixmap(targetPixmap);
381
        }
1485 tsoots 382
 
5116 tsoots 383
        if (!undoEnabled_) // if so flush down the state
1228 tsoots 384
        {
385
                TransactionState *ts = dynamic_cast<TransactionState*>(state);
386
                if (ts) // flush the TransactionObject too
387
                        delete target;
388
                delete state;
389
                return;
390
        }
391
 
5116 tsoots 392
        if ((!transaction_) &&
393
        (currentUndoObjectId_ == -1 || currentUndoObjectId_ == static_cast<long>(target->getUId())))
1226 tsoots 394
                emit newAction(target, state); // send action to the guis
1457 tsoots 395
        else
396
                emit clearRedo();
1111 tsoots 397
 
5116 tsoots 398
        if (transaction_)
399
                transaction_->pushBack(target, state);
1213 tsoots 400
        else
401
        {
5116 tsoots 402
                state->setUndoObject(target);
403
                stacks_[currentDoc_].action(state);
1213 tsoots 404
        }
1340 tsoots 405
        if (targetPixmap)
406
                target->setUPixmap(oldIcon);
5116 tsoots 407
 
408
        setMenuTexts();
1111 tsoots 409
}
1477 tsoots 410
 
1356 tsoots 411
void UndoManager::action(UndoObject* target, UndoState* state,
412
                         const QString &targetName, QPixmap *targetPixmap)
413
{
414
        QString oldName = target->getUName();
2877 cbradney 415
        if (!targetName.isEmpty())
1356 tsoots 416
                target->setUName(targetName);
417
        action(target, state, targetPixmap);
418
        target->setUName(oldName);
419
}
1111 tsoots 420
 
421
void UndoManager::undo(int steps)
422
{
5116 tsoots 423
        if (!undoEnabled_)
424
                return;
425
 
426
        setUndoEnabled(false);
427
        stacks_[currentDoc_].undo(steps, currentUndoObjectId_);
428
        setUndoEnabled(true);
429
        emit undoSignal(steps);
430
        emit undoRedoDone();
431
        setMenuTexts();
1111 tsoots 432
}
433
 
434
void UndoManager::redo(int steps)
435
{
5116 tsoots 436
        if (!undoEnabled_)
437
                return;
438
 
439
        setUndoEnabled(false);
440
        stacks_[currentDoc_].redo(steps, currentUndoObjectId_);
441
        setUndoEnabled(true);
442
        emit redoSignal(steps);
443
        emit undoRedoDone();
444
        setMenuTexts();
1111 tsoots 445
}
446
 
5116 tsoots 447
bool UndoManager::hasUndoActions(int )
1111 tsoots 448
{
5116 tsoots 449
        // TODO Needs to fixed for object specific mode
450
        return stacks_[currentDoc_].undoItems() > 0;
451
}
1477 tsoots 452
 
5116 tsoots 453
bool UndoManager::hasRedoActions(int )
454
{
455
        // TODO Needs to be fixed for object specific mode
456
        return stacks_[currentDoc_].redoItems() > 0;
1111 tsoots 457
}
458
 
5116 tsoots 459
void UndoManager::showObject(int uid)
1477 tsoots 460
{
5116 tsoots 461
        if (currentUndoObjectId_ == uid)
462
                return;
463
        setUndoEnabled(false);
464
        currentUndoObjectId_ = uid;
465
        for (uint i = 0; i < undoGuis_.size(); ++i)
466
        {
467
                if (uid == -2)
468
                        undoGuis_[i]->clear();
469
                else
470
                        setState(undoGuis_[i], currentUndoObjectId_);
471
        }
472
        setUndoEnabled(true);
473
        setMenuTexts();
1477 tsoots 474
}
475
 
5116 tsoots 476
UndoObject* UndoManager::replaceObject(ulong uid, UndoObject *newUndoObject)
1477 tsoots 477
{
5116 tsoots 478
        UndoObject *tmp = 0;
479
        for (uint i = 0; i < stacks_[currentDoc_].undoActions_.size(); ++i)
1477 tsoots 480
        {
5116 tsoots 481
                UndoState *tmpState = stacks_[currentDoc_].undoActions_[i];
482
                TransactionState *ts = dynamic_cast<TransactionState*>(tmpState);
483
                if (ts)
484
                        tmp = ts->replace(uid, newUndoObject);
485
                else if (tmpState->undoObject() && tmpState->undoObject()->getUId() == uid)
1477 tsoots 486
                {
5116 tsoots 487
                        tmp = tmpState->undoObject();
488
                        tmpState->setUndoObject(newUndoObject);
1477 tsoots 489
                }
490
        }
5116 tsoots 491
        if (transaction_) // replace also in the currently open transaction
492
                tmp = transaction_->replace(uid, newUndoObject);
493
        return tmp;
1477 tsoots 494
}
495
 
5116 tsoots 496
void UndoManager::setHistoryLength(int steps)
1213 tsoots 497
{
5116 tsoots 498
        if (steps >= 0)
1213 tsoots 499
        {
5116 tsoots 500
                prefs_->set("historyLength", stacks_[currentDoc_].maxSize());
501
                stacks_[currentDoc_].setMaxSize(static_cast<uint>(steps));
1213 tsoots 502
        }
503
}
504
 
5116 tsoots 505
int UndoManager::getHistoryLength()
1111 tsoots 506
{
5116 tsoots 507
        if (stacks_.size() > 0 && stacks_[currentDoc_].redoItems() > 0)
508
                return -1;
509
        return static_cast<int>(stacks_[currentDoc_].maxSize());
510
}
1477 tsoots 511
 
5116 tsoots 512
bool UndoManager::isGlobalMode()
513
{
514
        return currentUndoObjectId_ == -1;
515
}
1228 tsoots 516
 
5116 tsoots 517
void UndoManager::setMenuTexts()
518
{
519
        if (stacks_[currentDoc_].undoItems() > 0)
520
        {
521
                UndoState *state = stacks_[currentDoc_].getNextUndo(currentUndoObjectId_);
522
                if (state)
5781 cbradney 523
                        ScCore->primaryMainWindow()->scrActions["editUndoAction"]->setTexts(QString(Um::MenuUndo).arg(state->getName()));
5116 tsoots 524
                else
5781 cbradney 525
                        ScCore->primaryMainWindow()->scrActions["editUndoAction"]->setTexts(Um::MenuUndoEmpty);
5116 tsoots 526
        }
527
        else
5781 cbradney 528
                ScCore->primaryMainWindow()->scrActions["editUndoAction"]->setTexts(Um::MenuUndoEmpty);
1228 tsoots 529
 
5116 tsoots 530
        if (stacks_[currentDoc_].redoItems() > 0)
531
        {
532
                UndoState *state = stacks_[currentDoc_].getNextRedo(currentUndoObjectId_);
533
                if (state)
5781 cbradney 534
                        ScCore->primaryMainWindow()->scrActions["editRedoAction"]->setTexts(QString(Um::MenuRedo).arg(state->getName()));
5116 tsoots 535
                else
5781 cbradney 536
                        ScCore->primaryMainWindow()->scrActions["editRedoAction"]->setTexts(Um::MenuRedoEmpty);
1111 tsoots 537
        }
5116 tsoots 538
        else
5781 cbradney 539
                ScCore->primaryMainWindow()->scrActions["editRedoAction"]->setTexts(Um::MenuRedoEmpty);
1111 tsoots 540
}
541
 
5116 tsoots 542
void UndoManager::deleteInstance()
1477 tsoots 543
{
5116 tsoots 544
        if (instance_)
545
                delete instance_;
546
        instance_ = 0;
1477 tsoots 547
}
548
 
5116 tsoots 549
UndoManager::~UndoManager()
1477 tsoots 550
{
5116 tsoots 551
        StackMap::iterator it;
552
        for (it = stacks_.begin(); it != stacks_.end(); ++it)
1477 tsoots 553
        {
5116 tsoots 554
                for (uint i = 0; i < (*it).size(); ++i)
1477 tsoots 555
                {
5116 tsoots 556
                        (*it).clear();
1477 tsoots 557
                }
558
        }
5116 tsoots 559
        stacks_.clear();
1477 tsoots 560
}
561
 
5116 tsoots 562
/*** TransactionState *****************************************************/
1213 tsoots 563
 
5116 tsoots 564
TransactionState::TransactionState() : UndoState("")
1111 tsoots 565
{
5116 tsoots 566
        size_ = 0;
1111 tsoots 567
}
568
 
5116 tsoots 569
UndoState* TransactionState::at(int index)
1111 tsoots 570
{
5116 tsoots 571
        if (index >= 0 && static_cast<uint>(index) < sizet())
572
                return states_[index];
573
        else
574
                return 0;
1111 tsoots 575
}
576
 
5116 tsoots 577
bool TransactionState::contains(int uid) const
1111 tsoots 578
{
5116 tsoots 579
        for (uint i = 0; i < states_.size(); ++i)
1443 tsoots 580
        {
5116 tsoots 581
                if (states_[i]->undoObject()->getUId() == static_cast<uint>(uid))
582
                        return true;
1443 tsoots 583
        }
5116 tsoots 584
        return false;
1111 tsoots 585
}
586
 
5116 tsoots 587
bool TransactionState::containsOnly(int uid) const
1238 tsoots 588
{
5116 tsoots 589
        for (uint i = 0; i < states_.size(); ++i)
1238 tsoots 590
        {
5116 tsoots 591
                if (states_[i]->undoObject()->getUId() != static_cast<uint>(uid))
592
                        return false;
1238 tsoots 593
        }
5116 tsoots 594
        return true;
1238 tsoots 595
}
596
 
5116 tsoots 597
void TransactionState::pushBack(UndoObject *target, UndoState *state)
1111 tsoots 598
{
5116 tsoots 599
        if (target && state)
1197 tsoots 600
        {
5116 tsoots 601
                state->setUndoObject(target);
602
                states_.push_back(state);
603
                ++size_;
1197 tsoots 604
        }
1111 tsoots 605
}
606
 
5116 tsoots 607
uint TransactionState::sizet()
1111 tsoots 608
{
5116 tsoots 609
        return size_;
1111 tsoots 610
}
611
 
5116 tsoots 612
void TransactionState::useActionName()
1461 tsoots 613
{
5116 tsoots 614
        if (size_ > 0)
615
                setName(states_[size_ - 1]->getName());
1461 tsoots 616
}
617
 
5116 tsoots 618
UndoObject* TransactionState::replace(ulong uid, UndoObject *newUndoObject)
1197 tsoots 619
{
5116 tsoots 620
        UndoObject *tmp = 0;
621
        for (uint i = 0; i < states_.size(); ++i)
1197 tsoots 622
        {
5116 tsoots 623
                TransactionState *ts = dynamic_cast<TransactionState*>(states_[i]);
624
                if (ts) // are we having a transaction_inside a transaction
625
                        ts->replace(uid, newUndoObject);
626
                else if (states_[i]->undoObject() && states_[i]->undoObject()->getUId() == uid)
1197 tsoots 627
                {
5116 tsoots 628
                        tmp = states_[i]->undoObject();
629
                        states_[i]->setUndoObject(newUndoObject);
1197 tsoots 630
                }
631
        }
5116 tsoots 632
        return tmp;
1197 tsoots 633
}
634
 
5116 tsoots 635
void TransactionState::undo() // undo all attached states
1111 tsoots 636
{
5116 tsoots 637
        for (int i = sizet() - 1; i > -1; --i)
638
                at(i)->undo();
1111 tsoots 639
}
640
 
5116 tsoots 641
void TransactionState::redo() // redo all attached states
1111 tsoots 642
{
5116 tsoots 643
        for (uint i = 0; i < sizet(); ++i)
644
                at(i)->redo();
645
}
646
 
647
TransactionState::~TransactionState()
648
{
649
        for (uint i = 0; i < states_.size(); ++i)
1111 tsoots 650
        {
5116 tsoots 651
                if (states_[i])
1111 tsoots 652
                {
5116 tsoots 653
                        delete states_[i];
654
                        states_[i] = 0;
1111 tsoots 655
                }
656
        }
657
}
1190 tsoots 658
 
5116 tsoots 659
/*************************************************************************************/
2199 cbradney 660
 
2198 cbradney 661
void UndoManager::languageChange()
662
{
2199 cbradney 663
        UndoManager::AddVGuide          = tr("Add vertical guide");
664
        UndoManager::AddHGuide          = tr("Add horizontal guide");
665
        UndoManager::DelVGuide          = tr("Remove vertical guide");
666
        UndoManager::DelHGuide          = tr("Remove horizontal guide");
667
        UndoManager::MoveVGuide         = tr("Move vertical guide");
668
        UndoManager::MoveHGuide         = tr("Move horizontal guide");
669
        UndoManager::LockGuides         = tr("Lock guides");
670
        UndoManager::UnlockGuides       = tr("Unlock guides");
671
        UndoManager::Move               = tr("Move");
672
        UndoManager::Resize             = tr("Resize");
673
        UndoManager::Rotate             = tr("Rotate");
674
        UndoManager::MoveFromTo         = tr("X1: %1, Y1: %2, %3\nX2: %4, Y2: %5, %6");
675
        UndoManager::ResizeFromTo       = tr("W1: %1, H1: %2\nW2: %3, H2: %4");
4821 cbradney 676
        UndoManager::ImageOffset        = tr("Change Image Offset");
677
        UndoManager::ImageScale         = tr("Change Image Scale");
678
        UndoManager::ImageOffsetFromTo  = tr("X1: %1, Y1: %2\nX2: %4, Y2: %5");
679
        UndoManager::ImageScaleFromTo   = tr("X: %1, Y: %2\nX: %4, Y: %5");
2199 cbradney 680
        UndoManager::Selection          = tr("Selection");
681
        UndoManager::Group              = tr("Group");
682
        UndoManager::SelectionGroup     = tr("Selection/Group");
683
        UndoManager::Create             = tr("Create");
684
        UndoManager::CreateTo           = tr("X: %1, Y: %2\nW: %3, H: %4");
685
        UndoManager::AlignDistribute    = tr("Align/Distribute");
686
        UndoManager::ItemsInvolved      = tr("Items involved");
687
        UndoManager::Cancel             = tr("Cancel");
688
        UndoManager::SetFill            = tr("Set fill color");
689
        UndoManager::ColorFromTo        = tr("Color1: %1, Color2: %2");
690
        UndoManager::SetShade           = tr("Set fill color shade");
691
        UndoManager::SetLineColor       = tr("Set line color");
692
        UndoManager::SetLineShade       = tr("Set line color shade");
693
        UndoManager::FlipH              = tr("Flip horizontally");
694
        UndoManager::FlipV              = tr("Flip vertically");
695
        UndoManager::Lock               = tr("Lock");
696
        UndoManager::UnLock             = tr("Unlock");
697
        UndoManager::SizeLock           = tr("Lock size");
698
        UndoManager::SizeUnLock         = tr("Unlock size");
4698 cbradney 699
        UndoManager::EnablePrint        = tr("Enable Item Printing");
700
        UndoManager::DisablePrint       = tr("Disable Item Printing");
2199 cbradney 701
        UndoManager::Ungroup            = tr("Ungroup");
702
        UndoManager::Delete             = tr("Delete");
703
        UndoManager::Rename             = tr("Rename");
704
        UndoManager::FromTo             = tr("From %1\nto %2");
705
        UndoManager::ApplyMasterPage    = tr("Apply Master Page");
706
        UndoManager::Paste              = tr("Paste");
707
        UndoManager::Cut                = tr("Cut");
708
        UndoManager::Transparency       = tr("Set fill color transparency");
709
        UndoManager::LineTransparency   = tr("Set line color transparency");
710
        UndoManager::LineStyle          = tr("Set line style");
711
        UndoManager::LineEnd            = tr("Set the style of line end");
712
        UndoManager::LineJoin           = tr("Set the style of line join");
713
        UndoManager::LineWidth          = tr("Set line width");
714
        UndoManager::NoStyle            = tr("No style");
715
        UndoManager::CustomLineStyle    = tr("Set custom line style");
716
        UndoManager::NoLineStyle        = tr("Do not use custom line style");
717
        UndoManager::StartArrow         = tr("Set start arrow");
718
        UndoManager::EndArrow           = tr("Set end arrow");
719
        UndoManager::CreateTable        = tr("Create table");
720
        UndoManager::RowsCols           = tr("Rows: %1, Cols: %2");
721
        UndoManager::SetFont            = tr("Set font");
722
        UndoManager::SetFontSize        = tr("Set font size");
723
        UndoManager::SetFontWidth       = tr("Set font width");
2230 fschmid 724
        UndoManager::SetFontHeight       = tr("Set font height");
2199 cbradney 725
        UndoManager::SetFontFill        = tr("Set font fill color");
726
        UndoManager::SetFontStroke      = tr("Set font stroke color");
727
        UndoManager::SetFontFillShade   = tr("Set font fill color shade");
728
        UndoManager::SetFontStrokeShade = tr("Set font stroke color shade");
729
        UndoManager::SetKerning         = tr("Set kerning");
730
        UndoManager::SetLineSpacing     = tr("Set line spacing");
731
        UndoManager::SetStyle           = tr("Set paragraph style");
732
        UndoManager::SetLanguage        = tr("Set language");
733
        UndoManager::AlignText          = tr("Align text");
734
        UndoManager::SetFontEffect      = tr("Set font effect");
735
        UndoManager::ImageFrame         = tr("Image frame");
736
        UndoManager::TextFrame          = tr("Text frame");
737
        UndoManager::Polygon            = tr("Polygon");
738
        UndoManager::BezierCurve        = tr("Bezier curve");
739
        UndoManager::Polyline           = tr("Polyline");
3676 cbradney 740
        UndoManager::PathText           = tr("Text on a Path");
2199 cbradney 741
        UndoManager::ConvertTo          = tr("Convert to");
742
        UndoManager::ImportSVG          = tr("Import SVG image");
743
        UndoManager::ImportEPS          = tr("Import EPS image");
2217 cbradney 744
        UndoManager::ImportOOoDraw      = tr("Import OpenOffice.org Draw image");
2199 cbradney 745
        UndoManager::ScratchSpace       = tr("Scratch space");
5620 jghali 746
        //UndoManager::TextFlow           = tr("Text flows around the frame");
747
        UndoManager::ObjectFrame        = tr("Text flows around the frame");
2199 cbradney 748
        UndoManager::BoundingBox        = tr("Text flows around bounding box");
749
        UndoManager::ContourLine        = tr("Text flows around contour line");
750
        UndoManager::NoTextFlow         = tr("No text flow");
5620 jghali 751
        UndoManager::NoObjectFrame      = tr("No object frame");
2199 cbradney 752
        UndoManager::NoBoundingBox      = tr("No bounding box");
753
        UndoManager::NoContourLine      = tr("No contour line");
754
        UndoManager::PageNmbr           = tr("Page %1");
755
        UndoManager::ImageScaling       = tr("Set image scaling");
756
        UndoManager::FrameSize          = tr("Frame size");
757
        UndoManager::FreeScaling        = tr("Free scaling");
758
        UndoManager::KeepRatio          = tr("Keep aspect ratio");
759
        UndoManager::BreakRatio         = tr("Break aspect ratio");
760
        UndoManager::EditContourLine    = tr("Edit contour line");
761
        UndoManager::EditShape          = tr("Edit shape");
762
        UndoManager::ResetContourLine   = tr("Reset contour line");
763
        UndoManager::AddPage            = tr("Add page");
764
        UndoManager::AddPages           = tr("Add pages");
765
        UndoManager::DeletePage         = tr("Delete page");
766
        UndoManager::DeletePages        = tr("Delete pages");
767
        UndoManager::AddLayer           = tr("Add layer");
768
        UndoManager::DeleteLayer        = tr("Delete layer");
769
        UndoManager::RenameLayer        = tr("Rename layer");
770
        UndoManager::RaiseLayer         = tr("Raise layer");
771
        UndoManager::LowerLayer         = tr("Lower layer");
772
        UndoManager::SendToLayer        = tr("Send to layer");
773
        UndoManager::PrintLayer         = tr("Enable printing of layer");
774
        UndoManager::DoNotPrintLayer    = tr("Disable printing of layer");
775
        UndoManager::SetLayerName       = tr("Change name of the layer");
776
        UndoManager::GetImage           = tr("Get image");
4739 tsoots 777
        UndoManager::MultipleDuplicate  = tr("Multiple duplicate");
5184 avox 778
        UndoManager::ApplyTextStyle     = tr("Apply text style");
779
        UndoManager::MenuUndo           = tr("&Undo: %1", "f.e. Undo: Move");
5116 tsoots 780
        UndoManager::MenuUndoEmpty      = tr("&Undo");
5184 avox 781
        UndoManager::MenuRedo           = tr("&Redo: %1", "f.e. Redo: Move");
5116 tsoots 782
        UndoManager::MenuRedoEmpty      = tr("&Redo");
6139 tsoots 783
        UndoManager::EditContour        = tr("Edit contour line");
6263 tsoots 784
        UndoManager::ResetControlPoint  = tr("Reset control point");
785
        UndoManager::ResetControlPoints = tr("Reset control points");
6266 tsoots 786
        UndoManager::ImageEffects       = tr("Apply image effects");
2198 cbradney 787
}
788
 
1190 tsoots 789
void UndoManager::initIcons()
790
{
1693 craig 791
        QString iconDir = ScPaths::instance().iconDir();
1247 tsoots 792
 
1250 tsoots 793
/*** Icons for UndoObjects *******************************************/
794
        UndoManager::IImageFrame      = new QPixmap(iconDir + "Bild.xpm");
795
        UndoManager::ITextFrame       = new QPixmap(iconDir + "Text.xpm");
796
        UndoManager::ILine            = new QPixmap(iconDir + "Stift.xpm");
797
        UndoManager::IPolygon         = new QPixmap(iconDir + "spline.png");
798
        UndoManager::IPolyline        = new QPixmap(iconDir + "beziertool.png");
799
//      UndoManager::IPathText        = new QPixmap(iconDir + "?";
1254 tsoots 800
        UndoManager::IGroup           = new QPixmap(iconDir + "u_group.png");
1250 tsoots 801
/*** Icons for actions ***********************************************/
802
        UndoManager::IMove            = new QPixmap(iconDir + "u_move.png");
803
        UndoManager::IResize          = new QPixmap(iconDir + "u_resize.png");
804
        UndoManager::IRotate          = new QPixmap(iconDir + "u_rotate.png");
1247 tsoots 805
        UndoManager::IAlignDistribute = new QPixmap(iconDir + "u_align.png");
1250 tsoots 806
        UndoManager::IGuides          = new QPixmap(iconDir + "u_margins.png");
807
        UndoManager::ILockGuides      = new QPixmap(iconDir + "u_margins_locked.png");
1286 tsoots 808
        UndoManager::IFill            = new QPixmap(iconDir + "u_fill.png");
809
        UndoManager::IShade           = new QPixmap(iconDir + "u_shade.png");
1340 tsoots 810
        UndoManager::IFlipH           = new QPixmap(iconDir + "u_fliph.png");
811
        UndoManager::IFlipV           = new QPixmap(iconDir + "u_flipv.png");
1290 tsoots 812
        UndoManager::ILock            = new QPixmap(iconDir + "u_lock.png");
813
        UndoManager::IUnLock          = new QPixmap(iconDir + "u_unlock.png");
4698 cbradney 814
        UndoManager::IEnablePrint     = new QPixmap(iconDir + "u_enableprint.png");
815
        UndoManager::IDisablePrint    = new QPixmap(iconDir + "u_disableprint.png");
1340 tsoots 816
        UndoManager::IDelete          = new QPixmap(iconDir + "u_delete.png");
817
        UndoManager::ICreate          = new QPixmap(iconDir + "u_create.png");
1369 tsoots 818
        UndoManager::IPaste           = new QPixmap(iconDir + "editpaste.png");
819
        UndoManager::ICut             = new QPixmap(iconDir + "u_cut.png");
1371 tsoots 820
        UndoManager::ITransparency    = new QPixmap(iconDir + "u_transp.png");
1383 tsoots 821
        UndoManager::ILineStyle       = new QPixmap(iconDir + "u_line.png");
1391 tsoots 822
        UndoManager::IArrow           = new QPixmap(iconDir + "u_arrow.png");
1396 tsoots 823
        UndoManager::ITable           = new QPixmap(iconDir + "frame_table.png");
1399 tsoots 824
        UndoManager::IFont            = new QPixmap(iconDir + "u_font.png");
1440 tsoots 825
        UndoManager::IImportOOoDraw   = new QPixmap(iconDir + "ooo_draw.png");
826
        UndoManager::ISVG             = new QPixmap(iconDir + "u_svg.png");
827
        UndoManager::IEPS             = new QPixmap(iconDir + "u_eps.png");
1495 tsoots 828
        UndoManager::IImageScaling    = new QPixmap(iconDir + "u_scale_image.png");
1509 tsoots 829
        UndoManager::IBorder          = new QPixmap(iconDir + "u_shape.png");
1664 tsoots 830
        UndoManager::IDocument        = new QPixmap(iconDir + "DateiNeu.xpm");
1688 tsoots 831
//      UndoManager::ILayer           = new QPixmap(iconDir + "u_layer.png");
832
//      UndoManager::ILayerAction     = new QPixmap(iconDir + "u_layer_action.png");
1697 tsoots 833
//      UndoManager::IUp              = new QPixmap(iconDir + "u_up.png");
834
//      UndoManager::IDown            = new QPixmap(iconDir + "u_down.png");
1832 tsoots 835
//      UndoManager::IGetImage        = new QPixmap(iconDir + "u_get_image.png");
4739 tsoots 836
        UndoManager::IMultipleDuplicate = new QPixmap(iconDir + "u_multiple.png");
1190 tsoots 837
}
2199 cbradney 838
QString UndoManager::AddVGuide          = "";
839
QString UndoManager::AddHGuide          = "";
840
QString UndoManager::DelVGuide          = "";
841
QString UndoManager::DelHGuide          = "";
842
QString UndoManager::MoveVGuide         = "";
843
QString UndoManager::MoveHGuide         = "";
844
QString UndoManager::LockGuides         = "";
845
QString UndoManager::UnlockGuides       = "";
846
QString UndoManager::Move               = "";
847
QString UndoManager::Resize             = "";
848
QString UndoManager::Rotate             = "";
849
QString UndoManager::MoveFromTo         = "";
4821 cbradney 850
QString UndoManager::ImageOffset        = "";
851
QString UndoManager::ImageScale         = "";
852
QString UndoManager::ImageOffsetFromTo  = "";
853
QString UndoManager::ImageScaleFromTo   = "";
2199 cbradney 854
QString UndoManager::ResizeFromTo       = "";
855
QString UndoManager::Selection          = "";
856
QString UndoManager::Group              = "";
857
QString UndoManager::SelectionGroup     = "";
858
QString UndoManager::Create             = "";
859
QString UndoManager::CreateTo           = "";
860
QString UndoManager::AlignDistribute    = "";
861
QString UndoManager::ItemsInvolved      = "";
862
QString UndoManager::Cancel             = "";
863
QString UndoManager::SetFill            = "";
864
QString UndoManager::ColorFromTo        = "";
865
QString UndoManager::SetShade           = "";
866
QString UndoManager::SetLineColor       = "";
867
QString UndoManager::SetLineShade       = "";
868
QString UndoManager::FlipH              = "";
869
QString UndoManager::FlipV              = "";
870
QString UndoManager::Lock               = "";
871
QString UndoManager::UnLock             = "";
872
QString UndoManager::SizeLock           = "";
873
QString UndoManager::SizeUnLock         = "";
4698 cbradney 874
QString UndoManager::EnablePrint        = "";
875
QString UndoManager::DisablePrint       = "";
2199 cbradney 876
QString UndoManager::Ungroup            = "";
877
QString UndoManager::Delete             = "";
878
QString UndoManager::Rename             = "";
879
QString UndoManager::FromTo             = "";
880
QString UndoManager::ApplyMasterPage    = "";
881
QString UndoManager::Paste              = "";
882
QString UndoManager::Cut                = "";
883
QString UndoManager::Transparency       = "";
884
QString UndoManager::LineTransparency   = "";
885
QString UndoManager::LineStyle          = "";
886
QString UndoManager::LineEnd            = "";
887
QString UndoManager::LineJoin           = "";
888
QString UndoManager::LineWidth          = "";
889
QString UndoManager::NoStyle            = "";
890
QString UndoManager::CustomLineStyle    = "";
891
QString UndoManager::NoLineStyle        = "";
892
QString UndoManager::StartArrow         = "";
893
QString UndoManager::EndArrow           = "";
894
QString UndoManager::CreateTable        = "";
895
QString UndoManager::RowsCols           = "";
896
QString UndoManager::SetFont            = "";
897
QString UndoManager::SetFontSize        = "";
898
QString UndoManager::SetFontWidth       = "";
3676 cbradney 899
QString UndoManager::SetFontHeight      = "";
2199 cbradney 900
QString UndoManager::SetFontFill        = "";
901
QString UndoManager::SetFontStroke      = "";
902
QString UndoManager::SetFontFillShade   = "";
903
QString UndoManager::SetFontStrokeShade = "";
904
QString UndoManager::SetKerning         = "";
905
QString UndoManager::SetLineSpacing     = "";
906
QString UndoManager::SetStyle           = "";
907
QString UndoManager::SetLanguage        = "";
908
QString UndoManager::AlignText          = "";
909
QString UndoManager::SetFontEffect      = "";
910
QString UndoManager::ImageFrame         = "";
911
QString UndoManager::TextFrame          = "";
912
QString UndoManager::Polygon            = "";
913
QString UndoManager::BezierCurve        = "";
914
QString UndoManager::Polyline           = "";
3676 cbradney 915
QString UndoManager::PathText           = "";
2199 cbradney 916
QString UndoManager::ConvertTo          = "";
917
QString UndoManager::ImportSVG          = "";
918
QString UndoManager::ImportEPS          = "";
919
QString UndoManager::ImportOOoDraw      = "";
920
QString UndoManager::ScratchSpace       = "";
5620 jghali 921
//QString UndoManager::TextFlow           = "";
922
QString UndoManager::ObjectFrame        = "";
2199 cbradney 923
QString UndoManager::BoundingBox        = "";
924
QString UndoManager::ContourLine        = "";
925
QString UndoManager::NoTextFlow         = "";
5620 jghali 926
QString UndoManager::NoObjectFrame      = "";
2199 cbradney 927
QString UndoManager::NoBoundingBox      = "";
928
QString UndoManager::NoContourLine      = "";
929
QString UndoManager::PageNmbr           = "";
930
QString UndoManager::ImageScaling       = "";
931
QString UndoManager::FrameSize          = "";
932
QString UndoManager::FreeScaling        = "";
933
QString UndoManager::KeepRatio          = "";
934
QString UndoManager::BreakRatio         = "";
935
QString UndoManager::EditContourLine    = "";
936
QString UndoManager::EditShape          = "";
937
QString UndoManager::ResetContourLine   = "";
938
QString UndoManager::AddPage            = "";
939
QString UndoManager::AddPages           = "";
940
QString UndoManager::DeletePage         = "";
941
QString UndoManager::DeletePages        = "";
942
QString UndoManager::AddLayer           = "";
943
QString UndoManager::DeleteLayer        = "";
944
QString UndoManager::RenameLayer        = "";
945
QString UndoManager::RaiseLayer         = "";
946
QString UndoManager::LowerLayer         = "";
947
QString UndoManager::SendToLayer        = "";
948
QString UndoManager::PrintLayer         = "";
949
QString UndoManager::DoNotPrintLayer    = "";
950
QString UndoManager::SetLayerName       = "";
951
QString UndoManager::GetImage           = "";
4739 tsoots 952
QString UndoManager::MultipleDuplicate  = "";
5184 avox 953
QString UndoManager::ApplyTextStyle     = "";
5116 tsoots 954
QString UndoManager::MenuUndo           = "";
955
QString UndoManager::MenuUndoEmpty      = "";
956
QString UndoManager::MenuRedo           = "";
957
QString UndoManager::MenuRedoEmpty      = "";
6139 tsoots 958
QString UndoManager::EditContour        = "";
6263 tsoots 959
QString UndoManager::ResetControlPoint  = "";
960
QString UndoManager::ResetControlPoints = "";
6266 tsoots 961
QString UndoManager::ImageEffects       = "";
5116 tsoots 962
 
1250 tsoots 963
/*** Icons for UndoObjects *******************************************/
2604 tsoots 964
QPixmap *UndoManager::IImageFrame      = 0;
965
QPixmap *UndoManager::ITextFrame       = 0;
966
QPixmap *UndoManager::ILine            = 0;
967
QPixmap *UndoManager::IPolygon         = 0;
968
QPixmap *UndoManager::IPolyline        = 0;
969
QPixmap *UndoManager::IPathText        = 0;
970
QPixmap *UndoManager::IGroup           = 0;
971
QPixmap *UndoManager::ITable           = 0;
1250 tsoots 972
/*** Icons for actions ***********************************************/
2604 tsoots 973
QPixmap *UndoManager::IMove            = 0;
974
QPixmap *UndoManager::IResize          = 0;
975
QPixmap *UndoManager::IRotate          = 0;
976
QPixmap *UndoManager::IGuides          = 0;
977
QPixmap *UndoManager::ILockGuides      = 0;
978
QPixmap *UndoManager::IAlignDistribute = 0;
979
QPixmap *UndoManager::IFill            = 0;
980
QPixmap *UndoManager::IShade           = 0;
981
QPixmap *UndoManager::IFlipH           = 0;
982
QPixmap *UndoManager::IFlipV           = 0;
983
QPixmap *UndoManager::ILock            = 0;
984
QPixmap *UndoManager::IUnLock          = 0;
4698 cbradney 985
QPixmap *UndoManager::IEnablePrint     = 0;
986
QPixmap *UndoManager::IDisablePrint    = 0;
2604 tsoots 987
QPixmap *UndoManager::IDelete          = 0;
988
QPixmap *UndoManager::ICreate          = 0;
989
QPixmap *UndoManager::IPaste           = 0;
990
QPixmap *UndoManager::ICut             = 0;
991
QPixmap *UndoManager::ITransparency    = 0;
992
QPixmap *UndoManager::ILineStyle       = 0;
993
QPixmap *UndoManager::IArrow           = 0;
994
QPixmap *UndoManager::IFont            = 0;
995
QPixmap *UndoManager::ISVG             = 0;
996
QPixmap *UndoManager::IEPS             = 0;
997
QPixmap *UndoManager::IImportOOoDraw   = 0;
998
QPixmap *UndoManager::IImageScaling    = 0;
999
QPixmap *UndoManager::IBorder          = 0;
1000
QPixmap *UndoManager::IDocument        = 0;
1001
QPixmap *UndoManager::ILayer           = 0;
1002
QPixmap *UndoManager::ILayerAction     = 0;
1003
QPixmap *UndoManager::IUp              = 0;
1004
QPixmap *UndoManager::IDown            = 0;
1005
QPixmap *UndoManager::IPrint           = 0;
1006
QPixmap *UndoManager::IGetImage        = 0;
4739 tsoots 1007
QPixmap *UndoManager::IMultipleDuplicate = 0;
1658 tsoots 1008