Subversion Repositories Scribus

Rev

Rev 22601 | Rev 22724 | 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.,                                       *
18122 mrdocs 24
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
1111 tsoots 25
 ***************************************************************************/
26
 
27
#include "undomanager.h"
11576 avox 28
 
29
#include <QDebug>
30
#include <QList>
31
#include <QPixmap>
32
 
1197 tsoots 33
#include "prefscontext.h"
34
#include "prefsfile.h"
11576 avox 35
#include "prefsmanager.h"
36
#include "scconfig.h"
37
#include "scpaths.h"
5116 tsoots 38
#include "scraction.h"
5781 cbradney 39
#include "scribuscore.h"
11576 avox 40
#include "undogui.h"
5116 tsoots 41
#include "undostack.h"
19416 jghali 42
#include "undotransaction.h"
1693 craig 43
 
22521 craig 44
UndoManager* UndoManager::instance_          = nullptr;
5116 tsoots 45
bool         UndoManager::undoEnabled_       = true;
46
int          UndoManager::undoEnabledCounter_ = 0;
1111 tsoots 47
 
48
UndoManager* UndoManager::instance()
49
{
22521 craig 50
        if (instance_ == nullptr)
5116 tsoots 51
                instance_ = new UndoManager();
1111 tsoots 52
 
5116 tsoots 53
        return instance_;
1111 tsoots 54
}
55
 
56
void UndoManager::setUndoEnabled(bool isEnabled)
57
{
5116 tsoots 58
        if (isEnabled && undoEnabledCounter_ == 0)
1430 tsoots 59
                return; // nothing to do undo is already enabled.
22601 craig 60
        if (isEnabled && undoEnabledCounter_ > 0)
5116 tsoots 61
                --undoEnabledCounter_;
1430 tsoots 62
        else if (!isEnabled)
5116 tsoots 63
                ++undoEnabledCounter_;
1430 tsoots 64
 
5116 tsoots 65
        undoEnabled_ = undoEnabledCounter_ == 0;
66
        if (undoEnabled_)
1111 tsoots 67
                connectGuis();
5116 tsoots 68
        else if (undoEnabledCounter_ == 1)
1430 tsoots 69
                disconnectGuis(); // disconnect only once when setUndoEnabled(false) has been called
22601 craig 70
        // no need to call again if next setUndoEnabled() call will also be false.
1111 tsoots 71
}
72
 
73
bool UndoManager::undoEnabled()
74
{
5116 tsoots 75
        return undoEnabled_;
1111 tsoots 76
}
77
 
78
UndoManager::UndoManager()
79
{
5116 tsoots 80
        currentUndoObjectId_ = -1;
1190 tsoots 81
        if (!UndoManager::IGuides)
82
                initIcons();
5116 tsoots 83
        prefs_ = PrefsManager::instance()->prefsFile->getContext("undo");
2198 cbradney 84
        languageChange();
5938 tsoots 85
        setUndoEnabled(prefs_->getBool("enabled", true));
1111 tsoots 86
}
87
 
13371 jghali 88
UndoTransaction UndoManager::beginTransaction(const TransactionSettings& settings)
89
{
90
        return UndoManager::beginTransaction(settings.targetName, settings.targetPixmap, settings.actionName,
91
                                             settings.description, settings.actionPixmap);
92
}
11576 avox 93
 
94
UndoTransaction UndoManager::beginTransaction(const QString &targetName,
95
                                                                                          QPixmap *targetPixmap,
96
                                                                                          const QString &name,
97
                                                                                          const QString &description,
98
                                                                                          QPixmap *actionPixmap)
1213 tsoots 99
{
5116 tsoots 100
        if (!undoEnabled_)
22521 craig 101
                return UndoTransaction(nullptr);
11576 avox 102
 
103
        /** @brief Dummy object for storing transaction target's name */
104
        UndoObject* transactionTarget_ = new DummyUndoObject();
105
        TransactionState* transactionState_ = new TransactionState();
5116 tsoots 106
        transactionTarget_->setUName(targetName); // Name which will be in action history
1250 tsoots 107
        if (targetPixmap)
5116 tsoots 108
                transactionTarget_->setUPixmap(targetPixmap);
1228 tsoots 109
        if (name.length() > 0)          // if left to 0 length action will be fetched from the
11576 avox 110
                transactionState_->setName(name); // last added UndoState in this transaction
1238 tsoots 111
        if (description.length() > 0)
11576 avox 112
                transactionState_->setDescription(description); // tool tip for action history
1250 tsoots 113
        if (actionPixmap)
11576 avox 114
                transactionState_->setPixmap(actionPixmap); // for action history
115
 
116
        // Holds the state and data of this transaction:
117
        TransactionData *transaction = new TransactionData();
118
        transaction->transactionObject = transactionTarget_;
119
        transaction->transactionState = transactionState_;
120
        transaction->stackLevel = transactions_.size();
121
        transaction->UM = this;
122
 
123
        transactions_.push_back(transaction);
124
 
125
//      qDebug() << "UndoManager::beginTransaction" << targetName << name << transaction;
126
        return UndoTransaction(transaction);
1213 tsoots 127
}
128
 
129
bool UndoManager::isTransactionMode()
130
{
22601 craig 131
        return !transactions_.empty();
1213 tsoots 132
}
133
 
1111 tsoots 134
void UndoManager::registerGui(UndoGui* gui)
135
{
22601 craig 136
        if (gui == nullptr)
1111 tsoots 137
                return;
138
 
139
        setUndoEnabled(false);
140
        setState(gui);
5116 tsoots 141
        undoGuis_.push_back(gui);
1431 tsoots 142
        setUndoEnabled(true);
1111 tsoots 143
}
144
 
145
void UndoManager::setState(UndoGui* gui, int uid)
146
{
147
        gui->clear();
1443 tsoots 148
 
5116 tsoots 149
        if ( stacks_[currentDoc_].size() == 0 )
4293 mrdocs 150
                return;
151
 
19245 jghali 152
        UndoStack& currentStack = stacks_[currentDoc_];
5116 tsoots 153
 
20691 craig 154
        StateList::iterator itstartU = currentStack.m_undoActions_.begin(); // undo actions
155
        StateList::iterator itendU   = currentStack.m_undoActions_.end();
5116 tsoots 156
 
20691 craig 157
        StateList::iterator itstartR = currentStack.m_redoActions_.begin(); // redo actions
158
        StateList::iterator itendR   = currentStack.m_redoActions_.end();
19245 jghali 159
 
1443 tsoots 160
        if (uid > -1)
1477 tsoots 161
        { // find the range from where actions are added when in obj. spec. mode
5116 tsoots 162
                StateList::iterator it2;
20691 craig 163
                for (it2  = currentStack.m_undoActions_.begin();
164
                         it2 != currentStack.m_undoActions_.end(); ++it2)
1443 tsoots 165
                {
5116 tsoots 166
                        UndoState*  tmp  = *it2;
1443 tsoots 167
                        TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
5116 tsoots 168
                        if (ts && !ts->containsOnly(uid))
1443 tsoots 169
                        {
20691 craig 170
                                if (it2 != currentStack.m_undoActions_.begin())
5116 tsoots 171
                                        itendU = --it2;
1443 tsoots 172
                                break;
173
                        }
174
                }
5116 tsoots 175
                StateList::iterator it3;
20691 craig 176
                for (it3  = currentStack.m_redoActions_.begin();
177
                         it3 != currentStack.m_redoActions_.end(); ++it3)
1477 tsoots 178
                {
5116 tsoots 179
                        UndoState*  tmp  = *it3;
1477 tsoots 180
                        TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
5116 tsoots 181
                        if (ts && !ts->containsOnly(uid))
1477 tsoots 182
                        {
5116 tsoots 183
                                itendR = it3;
1477 tsoots 184
                                break;
185
                        }
186
                }
1443 tsoots 187
        }
1477 tsoots 188
 
19245 jghali 189
        if (currentStack.undoItems() > 0)
1443 tsoots 190
        {
20691 craig 191
                if (itendU == currentStack.m_undoActions_.end())
5116 tsoots 192
                        --itendU;
193
                for (; itendU >= itstartU; --itendU) // insert undo actions
194
                {
195
                        UndoState*  state  = *itendU;
196
                        UndoObject* target = state->undoObject();
1443 tsoots 197
 
5116 tsoots 198
                        if (target && (uid == -1 || target->getUId() == static_cast<uint>(uid)))
199
                                gui->insertUndoItem(target, state);
200
                        if (itendU == itstartU)
201
                                break;
202
                }
203
        }
204
 
19245 jghali 205
        if (currentStack.redoItems() > 0)
5116 tsoots 206
        {
12140 jghali 207
                if (itendR > itstartR)
208
                        --itendR;
5116 tsoots 209
                for (; itstartR <= itendR; ++itstartR) // insert redo actions
1443 tsoots 210
                {
5116 tsoots 211
                        UndoState*  state  = *itstartR;
212
                        UndoObject* target = state->undoObject();
213
 
214
                        if (target && (uid == -1 || target->getUId() == static_cast<uint>(uid)))
1443 tsoots 215
                                gui->insertRedoItem(target, state);
5116 tsoots 216
                        if (itendR == itstartR)
217
                                break;
1443 tsoots 218
                }
1111 tsoots 219
        }
220
}
221
 
222
void UndoManager::connectGuis()
223
{
5116 tsoots 224
        for (uint i = 0; i < undoGuis_.size(); ++i)
1111 tsoots 225
        {
5116 tsoots 226
                UndoGui *gui = undoGuis_[i];
1111 tsoots 227
 
5116 tsoots 228
                connect(gui, SIGNAL(undo(int)), this, SLOT(undo(int)));
229
                connect(gui, SIGNAL(redo(int)), this, SLOT(redo(int)));
22601 craig 230
                connect(this, SIGNAL(newAction(UndoObject*,UndoState*)), gui, SLOT(insertUndoItem(UndoObject*,UndoState*)));
1111 tsoots 231
                connect(this, SIGNAL(popBack()), gui, SLOT(popBack()));
232
                connect(this, SIGNAL(undoSignal(int)), gui, SLOT(updateUndo(int)));
233
                connect(this, SIGNAL(redoSignal(int)), gui, SLOT(updateRedo(int)));
1457 tsoots 234
                connect(this, SIGNAL(clearRedo()), gui, SLOT(clearRedo()));
4985 cbradney 235
                gui->setEnabled(true);
236
                gui->updateUndoActions();
1111 tsoots 237
        }
238
}
239
 
240
void UndoManager::disconnectGuis()
241
{
5116 tsoots 242
        for (uint i = 0; i < undoGuis_.size(); ++i)
1111 tsoots 243
        {
5116 tsoots 244
                UndoGui *gui = undoGuis_[i];
1111 tsoots 245
 
5116 tsoots 246
                disconnect(gui, SIGNAL(undo(int)), this, SLOT(undo(int)));
247
                disconnect(gui, SIGNAL(redo(int)), this, SLOT(redo(int)));
1111 tsoots 248
                disconnect(this, SIGNAL(newAction(UndoObject*, UndoState*)),
249
                   gui, SLOT(insertUndoItem(UndoObject*, UndoState*)));
250
                disconnect(this, SIGNAL(popBack()), gui, SLOT(popBack()));
251
                disconnect(this, SIGNAL(undoSignal(int)), gui, SLOT(updateUndo(int)));
252
                disconnect(this, SIGNAL(redoSignal(int)), gui, SLOT(updateRedo(int)));
1457 tsoots 253
                disconnect(this, SIGNAL(clearRedo()), gui, SLOT(clearRedo()));
4985 cbradney 254
                gui->setEnabled(false);
1111 tsoots 255
        }
256
}
257
 
258
void UndoManager::removeGui(UndoGui* gui)
259
{
9783 avox 260
        std::vector<UndoGui*>::iterator it = undoGuis_.begin();
261
        while(it != undoGuis_.end())
262
        {
1111 tsoots 263
                if (*it == gui)
9783 avox 264
                        it = undoGuis_.erase(it);
265
                else  
266
                        ++it;
267
        }
1111 tsoots 268
}
269
 
9783 avox 270
 
1111 tsoots 271
void UndoManager::switchStack(const QString& stackName)
272
{
6725 tsoots 273
        if (stackName == currentDoc_)
274
                return; // already current stack
5116 tsoots 275
        currentDoc_ = stackName;
276
        if (!stacks_.contains(currentDoc_))
277
                stacks_[currentDoc_] = UndoStack();
1111 tsoots 278
 
17744 craig 279
        stacks_[currentDoc_].setMaxSize(prefs_->getInt("historylength", 100));
22694 jghali 280
        for (size_t i = 0; i < undoGuis_.size(); ++i)
5116 tsoots 281
                setState(undoGuis_[i]);
282
 
10427 cbradney 283
        setTexts();
1111 tsoots 284
}
285
 
1252 tsoots 286
void UndoManager::renameStack(const QString& newName)
1111 tsoots 287
{
5116 tsoots 288
        if (currentDoc_ == newName)
1190 tsoots 289
                return;
1829 tsoots 290
 
5116 tsoots 291
        if (stacks_[currentDoc_].size() == 0) {
292
                currentDoc_ = newName;
1880 tsoots 293
                return;
294
        }
295
 
5116 tsoots 296
        UndoStack tmp(stacks_[currentDoc_]);
10469 cbradney 297
        stacks_.remove(currentDoc_);
5116 tsoots 298
        stacks_[newName] = tmp;
299
        currentDoc_ = newName;
1111 tsoots 300
}
301
 
1252 tsoots 302
void UndoManager::removeStack(const QString& stackName)
1111 tsoots 303
{
5116 tsoots 304
        if (stacks_.contains(stackName))
1111 tsoots 305
        {
5116 tsoots 306
                stacks_[stackName].clear();
10469 cbradney 307
                stacks_.remove(stackName);
5116 tsoots 308
                if (currentDoc_ == stackName)
1111 tsoots 309
                {
22694 jghali 310
                        for (size_t i = 0; i < undoGuis_.size(); ++i)
5116 tsoots 311
                                undoGuis_[i]->clear();
312
                        currentDoc_ = "__no_name__";
1111 tsoots 313
                }
314
        }
315
}
316
 
5938 tsoots 317
void UndoManager::clearStack()
318
{
319
        stacks_[currentDoc_].clear();
22694 jghali 320
        for (size_t i = 0; i < undoGuis_.size(); ++i)
5938 tsoots 321
        {
322
                undoGuis_[i]->clear();
323
                setState(undoGuis_[i]);
324
        }
325
}
326
 
1340 tsoots 327
void UndoManager::action(UndoObject* target, UndoState* state, QPixmap *targetPixmap)
1111 tsoots 328
{
22601 craig 329
        QPixmap *oldIcon = nullptr;
1340 tsoots 330
        if (targetPixmap)
331
        {
332
                oldIcon = target->getUPixmap();
333
                target->setUPixmap(targetPixmap);
334
        }
1485 tsoots 335
 
5116 tsoots 336
        if (!undoEnabled_) // if so flush down the state
1228 tsoots 337
        {
338
                TransactionState *ts = dynamic_cast<TransactionState*>(state);
339
                if (ts) // flush the TransactionObject too
340
                        delete target;
341
                delete state;
342
                return;
343
        }
344
 
11576 avox 345
        if (!isTransactionMode() &&
5116 tsoots 346
        (currentUndoObjectId_ == -1 || currentUndoObjectId_ == static_cast<long>(target->getUId())))
11576 avox 347
        {
348
//              qDebug() << "UndoManager: new Action" << state->getName() << "for" << currentUndoObjectId_;
1226 tsoots 349
                emit newAction(target, state); // send action to the guis
11576 avox 350
        }
1457 tsoots 351
        else
11576 avox 352
        {
1457 tsoots 353
                emit clearRedo();
11576 avox 354
        }
355
        if (isTransactionMode())
356
        {
357
//              qDebug() << "UndoManager: Action stored for transaction:" << transactions_.back() << target->getUName() << state->getName();
358
                transactions_.back()->transactionState->pushBack(target, state);
359
        }
1213 tsoots 360
        else
361
        {
11576 avox 362
//              qDebug() << "UndoManager: Action executed:" << target->getUName() << state->getName();
5116 tsoots 363
                state->setUndoObject(target);
16399 jghali 364
                if (stacks_[currentDoc_].action(state))
365
                        emit popBack();
1213 tsoots 366
        }
1340 tsoots 367
        if (targetPixmap)
368
                target->setUPixmap(oldIcon);
5116 tsoots 369
 
10427 cbradney 370
        setTexts();
1111 tsoots 371
}
1477 tsoots 372
 
1356 tsoots 373
void UndoManager::action(UndoObject* target, UndoState* state,
374
                         const QString &targetName, QPixmap *targetPixmap)
375
{
376
        QString oldName = target->getUName();
2877 cbradney 377
        if (!targetName.isEmpty())
1356 tsoots 378
                target->setUName(targetName);
379
        action(target, state, targetPixmap);
380
        target->setUName(oldName);
381
}
1111 tsoots 382
 
17641 craig 383
UndoState* UndoManager::getLastUndo(){
17719 craig 384
        UndoState* state = stacks_[currentDoc_].getNextUndo(Um::GLOBAL_UNDO_MODE);
17646 craig 385
        return state;
17641 craig 386
}
387
 
1111 tsoots 388
void UndoManager::undo(int steps)
389
{
5116 tsoots 390
        if (!undoEnabled_)
391
                return;
392
 
13349 jghali 393
        emit undoRedoBegin();
5116 tsoots 394
        setUndoEnabled(false);
395
        stacks_[currentDoc_].undo(steps, currentUndoObjectId_);
396
        setUndoEnabled(true);
397
        emit undoSignal(steps);
398
        emit undoRedoDone();
10427 cbradney 399
        setTexts();
1111 tsoots 400
}
401
 
402
void UndoManager::redo(int steps)
403
{
5116 tsoots 404
        if (!undoEnabled_)
405
                return;
406
 
13349 jghali 407
        emit undoRedoBegin();
5116 tsoots 408
        setUndoEnabled(false);
409
        stacks_[currentDoc_].redo(steps, currentUndoObjectId_);
410
        setUndoEnabled(true);
411
        emit redoSignal(steps);
412
        emit undoRedoDone();
10427 cbradney 413
        setTexts();
1111 tsoots 414
}
415
 
5116 tsoots 416
bool UndoManager::hasUndoActions(int )
1111 tsoots 417
{
5116 tsoots 418
        // TODO Needs to fixed for object specific mode
419
        return stacks_[currentDoc_].undoItems() > 0;
420
}
1477 tsoots 421
 
5116 tsoots 422
bool UndoManager::hasRedoActions(int )
423
{
424
        // TODO Needs to be fixed for object specific mode
425
        return stacks_[currentDoc_].redoItems() > 0;
1111 tsoots 426
}
427
 
5116 tsoots 428
void UndoManager::showObject(int uid)
1477 tsoots 429
{
5116 tsoots 430
        if (currentUndoObjectId_ == uid)
431
                return;
432
        setUndoEnabled(false);
433
        currentUndoObjectId_ = uid;
434
        for (uint i = 0; i < undoGuis_.size(); ++i)
435
        {
436
                if (uid == -2)
437
                        undoGuis_[i]->clear();
438
                else
439
                        setState(undoGuis_[i], currentUndoObjectId_);
440
        }
441
        setUndoEnabled(true);
10427 cbradney 442
        setTexts();
1477 tsoots 443
}
444
 
5116 tsoots 445
UndoObject* UndoManager::replaceObject(ulong uid, UndoObject *newUndoObject)
1477 tsoots 446
{
22521 craig 447
        UndoObject *tmp = nullptr;
448
        TransactionState* transaction_ = nullptr;
22601 craig 449
        if (!transactions_.empty())
11576 avox 450
                transaction_ = transactions_.at(transactions_.size()-1)->transactionState;
20691 craig 451
        for (uint i = 0; i < stacks_[currentDoc_].m_undoActions_.size(); ++i)
1477 tsoots 452
        {
20691 craig 453
                UndoState *tmpState = stacks_[currentDoc_].m_undoActions_[i];
5116 tsoots 454
                TransactionState *ts = dynamic_cast<TransactionState*>(tmpState);
455
                if (ts)
456
                        tmp = ts->replace(uid, newUndoObject);
457
                else if (tmpState->undoObject() && tmpState->undoObject()->getUId() == uid)
1477 tsoots 458
                {
5116 tsoots 459
                        tmp = tmpState->undoObject();
460
                        tmpState->setUndoObject(newUndoObject);
1477 tsoots 461
                }
462
        }
20691 craig 463
        for (uint i = 0; i < stacks_[currentDoc_].m_redoActions_.size(); ++i)
17640 craig 464
        {
20691 craig 465
                UndoState *tmpState = stacks_[currentDoc_].m_redoActions_[i];
17640 craig 466
                TransactionState *ts = dynamic_cast<TransactionState*>(tmpState);
467
                if (ts)
468
                        tmp = ts->replace(uid, newUndoObject);
469
                else if (tmpState->undoObject() && tmpState->undoObject()->getUId() == uid)
470
                {
471
                        tmp = tmpState->undoObject();
472
                        tmpState->setUndoObject(newUndoObject);
473
                }
474
        }
5116 tsoots 475
        if (transaction_) // replace also in the currently open transaction
476
                tmp = transaction_->replace(uid, newUndoObject);
477
        return tmp;
1477 tsoots 478
}
479
 
5116 tsoots 480
void UndoManager::setHistoryLength(int steps)
1213 tsoots 481
{
5116 tsoots 482
        if (steps >= 0)
1213 tsoots 483
        {
5116 tsoots 484
                stacks_[currentDoc_].setMaxSize(static_cast<uint>(steps));
7880 fschmid 485
                prefs_->set("historylength", stacks_[currentDoc_].maxSize());
1213 tsoots 486
        }
487
}
488
 
7880 fschmid 489
void UndoManager::setAllHistoryLengths(int steps)
490
{
491
        if (steps >= 0)
492
        {
493
                for (StackMap::Iterator it = stacks_.begin(); it != stacks_.end(); ++it )
494
                {
10469 cbradney 495
                        it.value().setMaxSize(static_cast<uint>(steps));
7880 fschmid 496
                }
497
                prefs_->set("historylength", steps);
498
        }
499
}
500
 
5116 tsoots 501
int UndoManager::getHistoryLength()
1111 tsoots 502
{
22601 craig 503
        if (!stacks_.empty() && stacks_[currentDoc_].redoItems() > 0)
5116 tsoots 504
                return -1;
505
        return static_cast<int>(stacks_[currentDoc_].maxSize());
506
}
1477 tsoots 507
 
5116 tsoots 508
bool UndoManager::isGlobalMode()
509
{
510
        return currentUndoObjectId_ == -1;
511
}
1228 tsoots 512
 
10427 cbradney 513
void UndoManager::setTexts()
5116 tsoots 514
{
19245 jghali 515
        ScribusMainWindow* scMW = ScCore->primaryMainWindow();
516
        UndoStack& currentStack = stacks_[currentDoc_];
517
 
518
        if (currentStack.undoItems() > 0)
5116 tsoots 519
        {
19245 jghali 520
                UndoState *state = currentStack.getNextUndo(currentUndoObjectId_);
5116 tsoots 521
                if (state)
19245 jghali 522
                        scMW->scrActions["editUndoAction"]->setTexts(QString(Um::MenuUndo).arg(state->getName()));
5116 tsoots 523
                else
19245 jghali 524
                        scMW->scrActions["editUndoAction"]->setTexts(Um::MenuUndoEmpty);
5116 tsoots 525
        }
526
        else
19245 jghali 527
                scMW->scrActions["editUndoAction"]->setTexts(Um::MenuUndoEmpty);
1228 tsoots 528
 
19245 jghali 529
        if (currentStack.redoItems() > 0)
5116 tsoots 530
        {
19245 jghali 531
                UndoState *state = currentStack.getNextRedo(currentUndoObjectId_);
5116 tsoots 532
                if (state)
19245 jghali 533
                        scMW->scrActions["editRedoAction"]->setTexts(QString(Um::MenuRedo).arg(state->getName()));
5116 tsoots 534
                else
19245 jghali 535
                        scMW->scrActions["editRedoAction"]->setTexts(Um::MenuRedoEmpty);
1111 tsoots 536
        }
5116 tsoots 537
        else
19245 jghali 538
                scMW->scrActions["editRedoAction"]->setTexts(Um::MenuRedoEmpty);
1111 tsoots 539
}
540
 
5116 tsoots 541
void UndoManager::deleteInstance()
1477 tsoots 542
{
22601 craig 543
        delete instance_;
22521 craig 544
        instance_ = nullptr;
1477 tsoots 545
}
546
 
5116 tsoots 547
UndoManager::~UndoManager()
1477 tsoots 548
{
5116 tsoots 549
        StackMap::iterator it;
550
        for (it = stacks_.begin(); it != stacks_.end(); ++it)
1477 tsoots 551
        {
5116 tsoots 552
                for (uint i = 0; i < (*it).size(); ++i)
1477 tsoots 553
                {
5116 tsoots 554
                        (*it).clear();
1477 tsoots 555
                }
556
        }
5116 tsoots 557
        stacks_.clear();
1477 tsoots 558
}
559
 
5116 tsoots 560
/*************************************************************************************/
2199 cbradney 561
 
2198 cbradney 562
void UndoManager::languageChange()
563
{
17735 craig 564
        UndoManager::ConnectPath        = tr("Connect path");
2199 cbradney 565
        UndoManager::AddVGuide          = tr("Add vertical guide");
566
        UndoManager::AddHGuide          = tr("Add horizontal guide");
567
        UndoManager::DelVGuide          = tr("Remove vertical guide");
568
        UndoManager::DelHGuide          = tr("Remove horizontal guide");
9069 subik 569
        UndoManager::DelVAGuide         = tr("Remove vertical auto guide");
570
        UndoManager::DelHAGuide         = tr("Remove horizontal auto guide");
2199 cbradney 571
        UndoManager::MoveVGuide         = tr("Move vertical guide");
572
        UndoManager::MoveHGuide         = tr("Move horizontal guide");
573
        UndoManager::LockGuides         = tr("Lock guides");
574
        UndoManager::UnlockGuides       = tr("Unlock guides");
17644 craig 575
        UndoManager::Overprint          = tr("Change overprint");
576
        UndoManager::BlendMode          = tr("Change blend mode");
577
        UndoManager::ActionPDF          = tr("Change action PDF");
2199 cbradney 578
        UndoManager::Move               = tr("Move");
17640 craig 579
        UndoManager::NewMasterPage      = tr("Add master page");
580
        UndoManager::DelMasterPage      = tr("Del master page");
581
        UndoManager::ImportMasterPage   = tr("Import master page");
582
        UndoManager::DuplicateMasterPage= tr("Duplicate master page");
19356 jghali 583
        UndoManager::ApplyMasterPage    = tr("Apply Master Page");
584
        UndoManager::RenameMasterPage   = tr("Rename Master Page");
17640 craig 585
        UndoManager::UniteItem          = tr("Combine Polygons");
586
        UndoManager::SplitItem          = tr("Split Polygons");
2199 cbradney 587
        UndoManager::Resize             = tr("Resize");
588
        UndoManager::Rotate             = tr("Rotate");
589
        UndoManager::MoveFromTo         = tr("X1: %1, Y1: %2, %3\nX2: %4, Y2: %5, %6");
590
        UndoManager::ResizeFromTo       = tr("W1: %1, H1: %2\nW2: %3, H2: %4");
4821 cbradney 591
        UndoManager::ImageOffset        = tr("Change Image Offset");
592
        UndoManager::ImageScale         = tr("Change Image Scale");
593
        UndoManager::ImageOffsetFromTo  = tr("X1: %1, Y1: %2\nX2: %4, Y2: %5");
594
        UndoManager::ImageScaleFromTo   = tr("X: %1, Y: %2\nX: %4, Y: %5");
2199 cbradney 595
        UndoManager::Selection          = tr("Selection");
596
        UndoManager::Group              = tr("Group");
597
        UndoManager::SelectionGroup     = tr("Selection/Group");
598
        UndoManager::Create             = tr("Create");
17640 craig 599
        UndoManager::LevelUp            = tr("Level up");
17932 jghali 600
        UndoManager::LevelDown          = tr("Level down");
601
        UndoManager::LevelTop           = tr("Send to front");
602
        UndoManager::LevelBottom        = tr("Send to bottom");
2199 cbradney 603
        UndoManager::CreateTo           = tr("X: %1, Y: %2\nW: %3, H: %4");
604
        UndoManager::AlignDistribute    = tr("Align/Distribute");
605
        UndoManager::ItemsInvolved      = tr("Items involved");
13395 jghali 606
        UndoManager::ItemsInvolved2     = tr("More than 20 items involved");
2199 cbradney 607
        UndoManager::Cancel             = tr("Cancel");
608
        UndoManager::SetFill            = tr("Set fill color");
609
        UndoManager::ColorFromTo        = tr("Color1: %1, Color2: %2");
610
        UndoManager::SetShade           = tr("Set fill color shade");
611
        UndoManager::SetLineColor       = tr("Set line color");
612
        UndoManager::SetLineShade       = tr("Set line color shade");
613
        UndoManager::FlipH              = tr("Flip horizontally");
614
        UndoManager::FlipV              = tr("Flip vertically");
615
        UndoManager::Lock               = tr("Lock");
17644 craig 616
        UndoManager::ResTyp             = tr("Change image resolution");
2199 cbradney 617
        UndoManager::UnLock             = tr("Unlock");
618
        UndoManager::SizeLock           = tr("Lock size");
17709 craig 619
        UndoManager::GradTypeMask       = tr("Set mask gradient type");
2199 cbradney 620
        UndoManager::SizeUnLock         = tr("Unlock size");
4698 cbradney 621
        UndoManager::EnablePrint        = tr("Enable Item Printing");
622
        UndoManager::DisablePrint       = tr("Disable Item Printing");
2199 cbradney 623
        UndoManager::Ungroup            = tr("Ungroup");
624
        UndoManager::Delete             = tr("Delete");
625
        UndoManager::Rename             = tr("Rename");
626
        UndoManager::FromTo             = tr("From %1\nto %2");
627
        UndoManager::Paste              = tr("Paste");
628
        UndoManager::Cut                = tr("Cut");
17644 craig 629
        UndoManager::RoundCorner        = tr("Change round corner");
2199 cbradney 630
        UndoManager::Transparency       = tr("Set fill color transparency");
631
        UndoManager::LineTransparency   = tr("Set line color transparency");
632
        UndoManager::LineStyle          = tr("Set line style");
633
        UndoManager::LineEnd            = tr("Set the style of line end");
634
        UndoManager::LineJoin           = tr("Set the style of line join");
635
        UndoManager::LineWidth          = tr("Set line width");
636
        UndoManager::NoStyle            = tr("No style");
637
        UndoManager::CustomLineStyle    = tr("Set custom line style");
638
        UndoManager::NoLineStyle        = tr("Do not use custom line style");
639
        UndoManager::StartArrow         = tr("Set start arrow");
640
        UndoManager::EndArrow           = tr("Set end arrow");
7676 cbradney 641
        UndoManager::StartAndEndArrow   = tr("Set start and end arrows");
2199 cbradney 642
        UndoManager::CreateTable        = tr("Create table");
643
        UndoManager::RowsCols           = tr("Rows: %1, Cols: %2");
644
        UndoManager::SetFont            = tr("Set font");
645
        UndoManager::SetFontSize        = tr("Set font size");
17709 craig 646
        UndoManager::StartArrowScale    = tr("Set start arrow scale");
647
        UndoManager::EndArrowScale      = tr("Set end arrow scale");
648
        UndoManager::SetFontSize        = tr("Set font size");
2199 cbradney 649
        UndoManager::SetFontWidth       = tr("Set font width");
17709 craig 650
        UndoManager::SetFontHeight      = tr("Set font height");
651
        UndoManager::GradType           = tr("Change fill gradient type");
652
        UndoManager::GradVal            = tr("Change fill gradient values");
653
        UndoManager::GradValStroke      = tr("Change stroke gradient values");
654
        UndoManager::GradCol            = tr("Change gradient color");
655
        UndoManager::GradTypeStroke     = tr("Change stroke gradient type");
2199 cbradney 656
        UndoManager::SetFontFill        = tr("Set font fill color");
657
        UndoManager::SetFontStroke      = tr("Set font stroke color");
658
        UndoManager::SetFontFillShade   = tr("Set font fill color shade");
659
        UndoManager::SetFontStrokeShade = tr("Set font stroke color shade");
660
        UndoManager::SetKerning         = tr("Set kerning");
661
        UndoManager::SetLineSpacing     = tr("Set line spacing");
662
        UndoManager::SetStyle           = tr("Set paragraph style");
663
        UndoManager::SetLanguage        = tr("Set language");
664
        UndoManager::AlignText          = tr("Align text");
665
        UndoManager::SetFontEffect      = tr("Set font effect");
666
        UndoManager::ImageFrame         = tr("Image frame");
667
        UndoManager::TextFrame          = tr("Text frame");
17744 craig 668
        UndoManager::Layer              = tr("Layer");
11850 herm 669
        UndoManager::LatexFrame         = tr("Render frame");
2199 cbradney 670
        UndoManager::Polygon            = tr("Polygon");
17709 craig 671
        UndoManager::EditPolygon        = tr("Edit polygon");
17735 craig 672
        UndoManager::EditArc            = tr("Edit arc");
673
        UndoManager::EditSpiral         = tr("Edit spiral");
2199 cbradney 674
        UndoManager::BezierCurve        = tr("Bezier curve");
675
        UndoManager::Polyline           = tr("Polyline");
3676 cbradney 676
        UndoManager::PathText           = tr("Text on a Path");
2199 cbradney 677
        UndoManager::ConvertTo          = tr("Convert to");
678
        UndoManager::ImportSVG          = tr("Import SVG image");
13957 herm 679
        UndoManager::ImportUniconv      = tr("Import Uniconvertor image");
2199 cbradney 680
        UndoManager::ImportEPS          = tr("Import EPS image");
12042 subik 681
        UndoManager::ImportBarcode      = tr("Import Barcode");
2217 cbradney 682
        UndoManager::ImportOOoDraw      = tr("Import OpenOffice.org Draw image");
11615 fschmid 683
        UndoManager::ImportAI           = tr("Import AI drawing");
684
        UndoManager::ImportXfig         = tr("Import XFig drawing");
17641 craig 685
        UndoManager::Columns            = tr("Change columns");
686
        UndoManager::ColumnsGap         = tr("Change columns gap");
13349 jghali 687
        UndoManager::ImportWMF          = tr("Import WMF drawing");
17641 craig 688
        UndoManager::TextFrameDist      = tr("Change text to frame distance");
2199 cbradney 689
        UndoManager::ScratchSpace       = tr("Scratch space");
5620 jghali 690
        //UndoManager::TextFlow           = tr("Text flows around the frame");
691
        UndoManager::ObjectFrame        = tr("Text flows around the frame");
2199 cbradney 692
        UndoManager::BoundingBox        = tr("Text flows around bounding box");
693
        UndoManager::ContourLine        = tr("Text flows around contour line");
17709 craig 694
        UndoManager::ImageClip          = tr("Text flows around image clipping path");
2199 cbradney 695
        UndoManager::NoTextFlow         = tr("No text flow");
5620 jghali 696
        UndoManager::NoObjectFrame      = tr("No object frame");
2199 cbradney 697
        UndoManager::NoBoundingBox      = tr("No bounding box");
698
        UndoManager::NoContourLine      = tr("No contour line");
17644 craig 699
        UndoManager::ShowImage          = tr("Show image");
2199 cbradney 700
        UndoManager::PageNmbr           = tr("Page %1");
701
        UndoManager::ImageScaling       = tr("Set image scaling");
702
        UndoManager::FrameSize          = tr("Frame size");
17709 craig 703
        UndoManager::MeshGradient       = tr("Create mesh gradient");
704
        UndoManager::ChangeMeshGradient = tr("Change mesh gradient");
705
        UndoManager::Mode               = tr("Change Mode");
2199 cbradney 706
        UndoManager::FreeScaling        = tr("Free scaling");
707
        UndoManager::KeepRatio          = tr("Keep aspect ratio");
708
        UndoManager::BreakRatio         = tr("Break aspect ratio");
709
        UndoManager::EditContourLine    = tr("Edit contour line");
710
        UndoManager::EditShape          = tr("Edit shape");
13346 subik 711
        UndoManager::ChangeShapeType    = tr("Change shape type");
2199 cbradney 712
        UndoManager::ResetContourLine   = tr("Reset contour line");
713
        UndoManager::AddPage            = tr("Add page");
714
        UndoManager::AddPages           = tr("Add pages");
17641 craig 715
        UndoManager::ReplaceText        = tr("Replace text");
716
        UndoManager::FirstLineOffset    = tr("Change First Line Offset");
717
        UndoManager::DeleteText         = tr("Delete text");
718
        UndoManager::InsertText         = tr("Insert text");
719
        UndoManager::AppendText         = tr("Append text");
720
        UndoManager::ImportText         = tr("Import text");
721
        UndoManager::ClearText          = tr("Clear text");
19188 craig 722
        UndoManager::TruncateText       = tr("Truncate text");
17641 craig 723
        UndoManager::AddLoremIpsum      = tr("Add Lorem Ipsum");
17826 craig 724
        UndoManager::InsertMark         = tr("Insert mark");
725
        UndoManager::InsertNote         = tr("Insert note");
726
        UndoManager::EditMark           = tr("Edit mark");
727
        UndoManager::DeleteMark         = tr("Delete mark");
728
        UndoManager::DeleteNote         = tr("Delete note");
729
        UndoManager::NewNotesStyle      = tr("Add note style");
730
        UndoManager::EditNotesStyle     = tr("Edit note style");
731
        UndoManager::DeleteNotesStyle   = tr("Delete note style");
732
        UndoManager::DeleteNotesStyle   = tr("Delete note style");
2199 cbradney 733
        UndoManager::DeletePage         = tr("Delete page");
734
        UndoManager::DeletePages        = tr("Delete pages");
16509 craig 735
        UndoManager::ChangePageProps    = tr("Change page properties");
2199 cbradney 736
        UndoManager::AddLayer           = tr("Add layer");
17932 jghali 737
        UndoManager::DuplicateLayer     = tr("Duplicate layer %1");
2199 cbradney 738
        UndoManager::DeleteLayer        = tr("Delete layer");
739
        UndoManager::RenameLayer        = tr("Rename layer");
740
        UndoManager::RaiseLayer         = tr("Raise layer");
17709 craig 741
        UndoManager::GradPos            = tr("Change gradient position");
2199 cbradney 742
        UndoManager::LowerLayer         = tr("Lower layer");
743
        UndoManager::SendToLayer        = tr("Send to layer");
744
        UndoManager::PrintLayer         = tr("Enable printing of layer");
745
        UndoManager::DoNotPrintLayer    = tr("Disable printing of layer");
746
        UndoManager::SetLayerName       = tr("Change name of the layer");
17932 jghali 747
        UndoManager::FlowLayer          = tr("Enable text flow around for lower layers");
748
        UndoManager::DisableFlowLayer   = tr("Disable text flow around for lower layers");
749
        UndoManager::SetLayerBlendMode  = tr("Set layer blend mode");
16497 craig 750
        UndoManager::SetLayerTransparency=tr("Set layer opacity");
17932 jghali 751
        UndoManager::SetLayerLocked     = tr("Lock layer");
752
        UndoManager::SetLayerUnlocked   = tr("Unlock layer");
2199 cbradney 753
        UndoManager::GetImage           = tr("Get image");
10321 mrdocs 754
        UndoManager::ChangeFormula      = tr("Change formula");
17709 craig 755
        UndoManager::Duplicate          = tr("Duplicate");
4739 tsoots 756
        UndoManager::MultipleDuplicate  = tr("Multiple duplicate");
17709 craig 757
        UndoManager::RemoveMeshPatch    = tr("Remove mesh patch");
5184 avox 758
        UndoManager::ApplyTextStyle     = tr("Apply text style");
17641 craig 759
        UndoManager::RemoveTextStyle    = tr("Remove text style");
5184 avox 760
        UndoManager::MenuUndo           = tr("&Undo: %1", "f.e. Undo: Move");
5116 tsoots 761
        UndoManager::MenuUndoEmpty      = tr("&Undo");
5184 avox 762
        UndoManager::MenuRedo           = tr("&Redo: %1", "f.e. Redo: Move");
5116 tsoots 763
        UndoManager::MenuRedoEmpty      = tr("&Redo");
6139 tsoots 764
        UndoManager::EditContour        = tr("Edit contour line");
6263 tsoots 765
        UndoManager::ResetControlPoint  = tr("Reset control point");
766
        UndoManager::ResetControlPoints = tr("Reset control points");
6266 tsoots 767
        UndoManager::ImageEffects       = tr("Apply image effects");
6820 tsoots 768
        UndoManager::InsertFrame        = tr("Insert frame");
7100 tsoots 769
        UndoManager::AdjustFrameToImage = tr("Adjust frame to the image size");
7896 tsoots 770
        UndoManager::RemoveAllGuides    = tr("Remove all guides");
17709 craig 771
        UndoManager::RemoveAllPageGuides= tr("Remove page guides");
7897 tsoots 772
        UndoManager::Copy               = tr("Copy");
773
        UndoManager::CopyPage           = tr("Copy page");
17213 craig 774
        UndoManager::MovePage           = tr("Move page");
19889 craig 775
        UndoManager::SwapPage           = tr("Swap page");
17640 craig 776
        UndoManager::ImportPage         = tr("Import page");
8952 tsoots 777
        UndoManager::ToOutlines         = tr("Convert to outlines");
17932 jghali 778
        UndoManager::LinkTextFrame      = tr("Link text frame");
779
        UndoManager::UnlinkTextFrame    = tr("Unlink text frame");
17224 craig 780
        UndoManager::ClearImage         = tr("Clear image frame content");
17932 jghali 781
        UndoManager::PathOperation      = tr("Path Operation");
17640 craig 782
        UndoManager::ChangePageAttrs    = tr("Change Page Attributes");
17709 craig 783
        UndoManager::Transform          = tr("Transform");
17791 jghali 784
        UndoManager::WeldItems          = tr("Weld Items");
19863 craig 785
        UndoManager::UnweldItems        = tr("Unweld Items");
19324 jghali 786
        UndoManager::SoftShadow         = tr("Drop Shadow");
787
        UndoManager::SoftShadowColor    = tr("Drop Shadow Color");
788
        UndoManager::SoftShadowShade    = tr("Drop Shadow Shade");
789
        UndoManager::SoftShadowBlurRadius= tr("Drop Shadow Blur Radius");
790
        UndoManager::SoftShadowXOffset  = tr("Drop Shadow X Offset");
791
        UndoManager::SoftShadowYOffset  = tr("Drop Shadow Y Offset");
792
        UndoManager::SoftShadowOpacity  = tr("Drop Shadow Opacity");
793
        UndoManager::SoftShadowBlendMode= tr("Drop Shadow Blend Mode");
2198 cbradney 794
}
795
 
1190 tsoots 796
void UndoManager::initIcons()
797
{
1693 craig 798
        QString iconDir = ScPaths::instance().iconDir();
1247 tsoots 799
 
1250 tsoots 800
/*** Icons for UndoObjects *******************************************/
9142 cbradney 801
        UndoManager::IImageFrame      = new QPixmap(iconDir + "16/insert-image.png");
802
        UndoManager::ITextFrame       = new QPixmap(iconDir + "16/insert-text-frame.png");
10321 mrdocs 803
        UndoManager::ILatexFrame      = new QPixmap(iconDir + "16/insert-latex.png");
21740 craig 804
        UndoManager::ILine            = new QPixmap(iconDir + "stift.png");
9162 cbradney 805
        UndoManager::IPolygon         = new QPixmap(iconDir + "16/draw-polygon.png");
806
        UndoManager::IPolyline        = new QPixmap(iconDir + "16/draw-bezier-curves.png");
1250 tsoots 807
//      UndoManager::IPathText        = new QPixmap(iconDir + "?";
1254 tsoots 808
        UndoManager::IGroup           = new QPixmap(iconDir + "u_group.png");
1250 tsoots 809
/*** Icons for actions ***********************************************/
810
        UndoManager::IMove            = new QPixmap(iconDir + "u_move.png");
811
        UndoManager::IResize          = new QPixmap(iconDir + "u_resize.png");
812
        UndoManager::IRotate          = new QPixmap(iconDir + "u_rotate.png");
1247 tsoots 813
        UndoManager::IAlignDistribute = new QPixmap(iconDir + "u_align.png");
1250 tsoots 814
        UndoManager::IGuides          = new QPixmap(iconDir + "u_margins.png");
815
        UndoManager::ILockGuides      = new QPixmap(iconDir + "u_margins_locked.png");
1286 tsoots 816
        UndoManager::IFill            = new QPixmap(iconDir + "u_fill.png");
817
        UndoManager::IShade           = new QPixmap(iconDir + "u_shade.png");
1340 tsoots 818
        UndoManager::IFlipH           = new QPixmap(iconDir + "u_fliph.png");
819
        UndoManager::IFlipV           = new QPixmap(iconDir + "u_flipv.png");
1290 tsoots 820
        UndoManager::ILock            = new QPixmap(iconDir + "u_lock.png");
821
        UndoManager::IUnLock          = new QPixmap(iconDir + "u_unlock.png");
4698 cbradney 822
        UndoManager::IEnablePrint     = new QPixmap(iconDir + "u_enableprint.png");
823
        UndoManager::IDisablePrint    = new QPixmap(iconDir + "u_disableprint.png");
1340 tsoots 824
        UndoManager::IDelete          = new QPixmap(iconDir + "u_delete.png");
825
        UndoManager::ICreate          = new QPixmap(iconDir + "u_create.png");
9142 cbradney 826
        UndoManager::IPaste           = new QPixmap(iconDir + "16/edit-paste.png");
1369 tsoots 827
        UndoManager::ICut             = new QPixmap(iconDir + "u_cut.png");
1371 tsoots 828
        UndoManager::ITransparency    = new QPixmap(iconDir + "u_transp.png");
1383 tsoots 829
        UndoManager::ILineStyle       = new QPixmap(iconDir + "u_line.png");
1391 tsoots 830
        UndoManager::IArrow           = new QPixmap(iconDir + "u_arrow.png");
1396 tsoots 831
        UndoManager::ITable           = new QPixmap(iconDir + "frame_table.png");
1399 tsoots 832
        UndoManager::IFont            = new QPixmap(iconDir + "u_font.png");
1440 tsoots 833
        UndoManager::IImportOOoDraw   = new QPixmap(iconDir + "ooo_draw.png");
834
        UndoManager::ISVG             = new QPixmap(iconDir + "u_svg.png");
13957 herm 835
        UndoManager::IUniconv         = new QPixmap(iconDir + "u_svg.png"); // using the icon for SVG for now
1440 tsoots 836
        UndoManager::IEPS             = new QPixmap(iconDir + "u_eps.png");
11615 fschmid 837
        UndoManager::IAI              = new QPixmap(iconDir + "u_eps.png"); // using the icon for EPS for now
838
        UndoManager::IXFIG            = new QPixmap(iconDir + "u_eps.png"); // using the icon for EPS for now
13349 jghali 839
        UndoManager::IWMF             = new QPixmap(iconDir + "u_eps.png"); // using the icon for EPS for now
1495 tsoots 840
        UndoManager::IImageScaling    = new QPixmap(iconDir + "u_scale_image.png");
1509 tsoots 841
        UndoManager::IBorder          = new QPixmap(iconDir + "u_shape.png");
9162 cbradney 842
        UndoManager::IDocument        = new QPixmap(iconDir + "16/document-new.png");
1688 tsoots 843
//      UndoManager::ILayer           = new QPixmap(iconDir + "u_layer.png");
844
//      UndoManager::ILayerAction     = new QPixmap(iconDir + "u_layer_action.png");
1697 tsoots 845
//      UndoManager::IUp              = new QPixmap(iconDir + "u_up.png");
846
//      UndoManager::IDown            = new QPixmap(iconDir + "u_down.png");
1832 tsoots 847
//      UndoManager::IGetImage        = new QPixmap(iconDir + "u_get_image.png");
4739 tsoots 848
        UndoManager::IMultipleDuplicate = new QPixmap(iconDir + "u_multiple.png");
1190 tsoots 849
}
17735 craig 850
QString UndoManager::ConnectPath        = "";
2199 cbradney 851
QString UndoManager::AddVGuide          = "";
852
QString UndoManager::AddHGuide          = "";
853
QString UndoManager::DelVGuide          = "";
854
QString UndoManager::DelHGuide          = "";
9069 subik 855
QString UndoManager::DelVAGuide         = "";
856
QString UndoManager::DelHAGuide         = "";
17709 craig 857
QString UndoManager::Mode               = "";
2199 cbradney 858
QString UndoManager::MoveVGuide         = "";
859
QString UndoManager::MoveHGuide         = "";
17640 craig 860
QString UndoManager::UniteItem          = "";
861
QString UndoManager::SplitItem          = "";
2199 cbradney 862
QString UndoManager::LockGuides         = "";
863
QString UndoManager::UnlockGuides       = "";
17644 craig 864
QString UndoManager::Overprint          = "";
865
QString UndoManager::BlendMode          = "";
866
QString UndoManager::ActionPDF          = "";
2199 cbradney 867
QString UndoManager::Move               = "";
17640 craig 868
QString UndoManager::NewMasterPage      = "";
17709 craig 869
QString UndoManager::GradType           = "";
870
QString UndoManager::GradPos            = "";
871
QString UndoManager::GradVal            = "";
872
QString UndoManager::GradValStroke      = "";
873
QString UndoManager::GradCol            = "";
874
QString UndoManager::GradTypeStroke     = "";
17640 craig 875
QString UndoManager::ImportMasterPage   = "";
876
QString UndoManager::DuplicateMasterPage= "";
877
QString UndoManager::DelMasterPage      = "";
19356 jghali 878
QString UndoManager::ApplyMasterPage    = "";
879
QString UndoManager::RenameMasterPage   = "";
2199 cbradney 880
QString UndoManager::Resize             = "";
881
QString UndoManager::Rotate             = "";
882
QString UndoManager::MoveFromTo         = "";
4821 cbradney 883
QString UndoManager::ImageOffset        = "";
884
QString UndoManager::ImageScale         = "";
17644 craig 885
QString UndoManager::ResTyp             = "";
886
QString UndoManager::ShowImage          = "";
17709 craig 887
QString UndoManager::RemoveMeshPatch    = "";
888
QString UndoManager::StartArrowScale    = "";
889
QString UndoManager::EndArrowScale      = "";
4821 cbradney 890
QString UndoManager::ImageOffsetFromTo  = "";
891
QString UndoManager::ImageScaleFromTo   = "";
2199 cbradney 892
QString UndoManager::ResizeFromTo       = "";
893
QString UndoManager::Selection          = "";
894
QString UndoManager::Group              = "";
895
QString UndoManager::SelectionGroup     = "";
896
QString UndoManager::Create             = "";
17644 craig 897
QString UndoManager::RoundCorner        = "";
2199 cbradney 898
QString UndoManager::CreateTo           = "";
899
QString UndoManager::AlignDistribute    = "";
900
QString UndoManager::ItemsInvolved      = "";
13395 jghali 901
QString UndoManager::ItemsInvolved2     = "";
22371 jghali 902
int     UndoManager::ItemsInvolvedLimit = 20;
2199 cbradney 903
QString UndoManager::Cancel             = "";
17641 craig 904
QString UndoManager::TextFrameDist      = "";
2199 cbradney 905
QString UndoManager::SetFill            = "";
906
QString UndoManager::ColorFromTo        = "";
907
QString UndoManager::SetShade           = "";
908
QString UndoManager::SetLineColor       = "";
909
QString UndoManager::SetLineShade       = "";
910
QString UndoManager::FlipH              = "";
911
QString UndoManager::FlipV              = "";
912
QString UndoManager::Lock               = "";
17640 craig 913
QString UndoManager::LevelUp            = "";
914
QString UndoManager::LevelTop           = "";
915
QString UndoManager::LevelBottom        = "";
916
QString UndoManager::LevelDown          = "";
2199 cbradney 917
QString UndoManager::UnLock             = "";
918
QString UndoManager::SizeLock           = "";
919
QString UndoManager::SizeUnLock         = "";
4698 cbradney 920
QString UndoManager::EnablePrint        = "";
921
QString UndoManager::DisablePrint       = "";
2199 cbradney 922
QString UndoManager::Ungroup            = "";
923
QString UndoManager::Delete             = "";
924
QString UndoManager::Rename             = "";
925
QString UndoManager::FromTo             = "";
926
QString UndoManager::Paste              = "";
927
QString UndoManager::Cut                = "";
928
QString UndoManager::Transparency       = "";
929
QString UndoManager::LineTransparency   = "";
930
QString UndoManager::LineStyle          = "";
17641 craig 931
QString UndoManager::FirstLineOffset    = "";
2199 cbradney 932
QString UndoManager::LineEnd            = "";
933
QString UndoManager::LineJoin           = "";
934
QString UndoManager::LineWidth          = "";
935
QString UndoManager::NoStyle            = "";
936
QString UndoManager::CustomLineStyle    = "";
937
QString UndoManager::NoLineStyle        = "";
938
QString UndoManager::StartArrow         = "";
939
QString UndoManager::EndArrow           = "";
7676 cbradney 940
QString UndoManager::StartAndEndArrow   = "";
2199 cbradney 941
QString UndoManager::CreateTable        = "";
942
QString UndoManager::RowsCols           = "";
943
QString UndoManager::SetFont            = "";
944
QString UndoManager::SetFontSize        = "";
945
QString UndoManager::SetFontWidth       = "";
3676 cbradney 946
QString UndoManager::SetFontHeight      = "";
2199 cbradney 947
QString UndoManager::SetFontFill        = "";
948
QString UndoManager::SetFontStroke      = "";
949
QString UndoManager::SetFontFillShade   = "";
950
QString UndoManager::SetFontStrokeShade = "";
951
QString UndoManager::SetKerning         = "";
952
QString UndoManager::SetLineSpacing     = "";
953
QString UndoManager::SetStyle           = "";
954
QString UndoManager::SetLanguage        = "";
955
QString UndoManager::AlignText          = "";
956
QString UndoManager::SetFontEffect      = "";
957
QString UndoManager::ImageFrame         = "";
958
QString UndoManager::TextFrame          = "";
17744 craig 959
QString UndoManager::Layer              = "";
10321 mrdocs 960
QString UndoManager::LatexFrame         = "";
2199 cbradney 961
QString UndoManager::Polygon            = "";
17709 craig 962
QString UndoManager::EditPolygon        = "";
17735 craig 963
QString UndoManager::EditArc            = "";
964
QString UndoManager::EditSpiral         = "";
2199 cbradney 965
QString UndoManager::BezierCurve        = "";
966
QString UndoManager::Polyline           = "";
3676 cbradney 967
QString UndoManager::PathText           = "";
2199 cbradney 968
QString UndoManager::ConvertTo          = "";
969
QString UndoManager::ImportSVG          = "";
13957 herm 970
QString UndoManager::ImportUniconv      = "";
2199 cbradney 971
QString UndoManager::ImportEPS          = "";
12042 subik 972
QString UndoManager::ImportBarcode      = "";
2199 cbradney 973
QString UndoManager::ImportOOoDraw      = "";
11615 fschmid 974
QString UndoManager::ImportAI           = "";
975
QString UndoManager::ImportXfig         = "";
13349 jghali 976
QString UndoManager::ImportWMF          = "";
2199 cbradney 977
QString UndoManager::ScratchSpace       = "";
5620 jghali 978
QString UndoManager::ObjectFrame        = "";
2199 cbradney 979
QString UndoManager::BoundingBox        = "";
17709 craig 980
QString UndoManager::MeshGradient       = "";
981
QString UndoManager::ChangeMeshGradient = "";
2199 cbradney 982
QString UndoManager::ContourLine        = "";
16497 craig 983
QString UndoManager::ImageClip          = "";
2199 cbradney 984
QString UndoManager::NoTextFlow         = "";
5620 jghali 985
QString UndoManager::NoObjectFrame      = "";
2199 cbradney 986
QString UndoManager::NoBoundingBox      = "";
987
QString UndoManager::NoContourLine      = "";
988
QString UndoManager::PageNmbr           = "";
989
QString UndoManager::ImageScaling       = "";
990
QString UndoManager::FrameSize          = "";
991
QString UndoManager::FreeScaling        = "";
992
QString UndoManager::KeepRatio          = "";
993
QString UndoManager::BreakRatio         = "";
994
QString UndoManager::EditContourLine    = "";
995
QString UndoManager::EditShape          = "";
13346 subik 996
QString UndoManager::ChangeShapeType    = "";
2199 cbradney 997
QString UndoManager::ResetContourLine   = "";
17709 craig 998
QString UndoManager::GradTypeMask       = "";
2199 cbradney 999
QString UndoManager::AddPage            = "";
1000
QString UndoManager::AddPages           = "";
17641 craig 1001
QString UndoManager::DeleteText         = "";
1002
QString UndoManager::AppendText         = "";
1003
QString UndoManager::ImportText         = "";
1004
QString UndoManager::ClearText          = "";
19188 craig 1005
QString UndoManager::TruncateText       = "";
17641 craig 1006
QString UndoManager::ReplaceText        = "";
1007
QString UndoManager::InsertText         = "";
1008
QString UndoManager::AddLoremIpsum      = "";
17826 craig 1009
QString UndoManager::EditMark           = "";
1010
QString UndoManager::InsertMark         = "";
1011
QString UndoManager::DeleteMark         = "";
1012
QString UndoManager::InsertNote         = "";
1013
QString UndoManager::DeleteNote         = "";
1014
QString UndoManager::NewNotesStyle      = "";
1015
QString UndoManager::EditNotesStyle      = "";
1016
QString UndoManager::DeleteNotesStyle   = "";
2199 cbradney 1017
QString UndoManager::DeletePage         = "";
1018
QString UndoManager::DeletePages        = "";
16509 craig 1019
QString UndoManager::ChangePageProps    = "";
2199 cbradney 1020
QString UndoManager::AddLayer           = "";
16495 craig 1021
QString UndoManager::DuplicateLayer     = "";
2199 cbradney 1022
QString UndoManager::DeleteLayer        = "";
1023
QString UndoManager::RenameLayer        = "";
1024
QString UndoManager::RaiseLayer         = "";
1025
QString UndoManager::LowerLayer         = "";
1026
QString UndoManager::SendToLayer        = "";
1027
QString UndoManager::PrintLayer         = "";
1028
QString UndoManager::DoNotPrintLayer    = "";
1029
QString UndoManager::SetLayerName       = "";
16492 craig 1030
QString UndoManager::FlowLayer          = "";
1031
QString UndoManager::DisableFlowLayer   = "";
16497 craig 1032
QString UndoManager::SetLayerBlendMode  = "";
1033
QString UndoManager::SetLayerTransparency="";
16499 craig 1034
QString UndoManager::SetLayerLocked     = "";
1035
QString UndoManager::SetLayerUnlocked   = "";
2199 cbradney 1036
QString UndoManager::GetImage           = "";
10321 mrdocs 1037
QString UndoManager::ChangeFormula      = "";
17709 craig 1038
QString UndoManager::Duplicate          = "";
4739 tsoots 1039
QString UndoManager::MultipleDuplicate  = "";
5184 avox 1040
QString UndoManager::ApplyTextStyle     = "";
17641 craig 1041
QString UndoManager::RemoveTextStyle    = "";
5116 tsoots 1042
QString UndoManager::MenuUndo           = "";
1043
QString UndoManager::MenuUndoEmpty      = "";
1044
QString UndoManager::MenuRedo           = "";
1045
QString UndoManager::MenuRedoEmpty      = "";
6139 tsoots 1046
QString UndoManager::EditContour        = "";
17641 craig 1047
QString UndoManager::Columns            = "";
1048
QString UndoManager::ColumnsGap         = "";
6263 tsoots 1049
QString UndoManager::ResetControlPoint  = "";
1050
QString UndoManager::ResetControlPoints = "";
6266 tsoots 1051
QString UndoManager::ImageEffects       = "";
6820 tsoots 1052
QString UndoManager::InsertFrame        = "";
7100 tsoots 1053
QString UndoManager::AdjustFrameToImage = "";
7896 tsoots 1054
QString UndoManager::RemoveAllGuides    = "";
19142 craig 1055
QString UndoManager::RemoveAllPageGuides= "";
7897 tsoots 1056
QString UndoManager::Copy               = "";
1057
QString UndoManager::CopyPage           = "";
17640 craig 1058
QString UndoManager::ImportPage         = "";
17213 craig 1059
QString UndoManager::MovePage           = "";
19889 craig 1060
QString UndoManager::SwapPage           = "";
8952 tsoots 1061
QString UndoManager::ToOutlines         = "";
16495 craig 1062
QString UndoManager::LinkTextFrame      = "";
1063
QString UndoManager::UnlinkTextFrame    = "";
17224 craig 1064
QString UndoManager::ClearImage         = "";
17424 craig 1065
QString UndoManager::PathOperation      = "";
17640 craig 1066
QString UndoManager::ChangePageAttrs    = "";
17709 craig 1067
QString UndoManager::Transform          = "";
17791 jghali 1068
QString UndoManager::WeldItems          = "";
19863 craig 1069
QString UndoManager::UnweldItems        = "";
19142 craig 1070
QString UndoManager::SoftShadow         = "";
1071
QString UndoManager::SoftShadowColor    = "";
1072
QString UndoManager::SoftShadowShade    = "";
1073
QString UndoManager::SoftShadowBlurRadius="";
1074
QString UndoManager::SoftShadowXOffset  = "";
19323 jghali 1075
QString UndoManager::SoftShadowYOffset  = "";
19142 craig 1076
QString UndoManager::SoftShadowOpacity  = "";
1077
QString UndoManager::SoftShadowBlendMode= "";
20111 fschmid 1078
QString UndoManager::SoftShadowErase    = "";
1079
QString UndoManager::SoftShadowObjectTrans = "";
5116 tsoots 1080
 
1250 tsoots 1081
/*** Icons for UndoObjects *******************************************/
22601 craig 1082
QPixmap *UndoManager::IImageFrame      = nullptr;
1083
QPixmap *UndoManager::ITextFrame       = nullptr;
1084
QPixmap *UndoManager::ILatexFrame      = nullptr;
1085
QPixmap *UndoManager::ILine            = nullptr;
1086
QPixmap *UndoManager::IPolygon         = nullptr;
1087
QPixmap *UndoManager::IPolyline        = nullptr;
1088
QPixmap *UndoManager::IPathText        = nullptr;
1089
QPixmap *UndoManager::IGroup           = nullptr;
1090
QPixmap *UndoManager::ITable           = nullptr;
1250 tsoots 1091
/*** Icons for actions ***********************************************/
22601 craig 1092
QPixmap *UndoManager::IMove            = nullptr;
1093
QPixmap *UndoManager::IResize          = nullptr;
1094
QPixmap *UndoManager::IRotate          = nullptr;
1095
QPixmap *UndoManager::IGuides          = nullptr;
1096
QPixmap *UndoManager::ILockGuides      = nullptr;
1097
QPixmap *UndoManager::IAlignDistribute = nullptr;
1098
QPixmap *UndoManager::IFill            = nullptr;
1099
QPixmap *UndoManager::IShade           = nullptr;
1100
QPixmap *UndoManager::IFlipH           = nullptr;
1101
QPixmap *UndoManager::IFlipV           = nullptr;
1102
QPixmap *UndoManager::ILock            = nullptr;
1103
QPixmap *UndoManager::IUnLock          = nullptr;
1104
QPixmap *UndoManager::IEnablePrint     = nullptr;
1105
QPixmap *UndoManager::IDisablePrint    = nullptr;
1106
QPixmap *UndoManager::IDelete          = nullptr;
1107
QPixmap *UndoManager::ICreate          = nullptr;
1108
QPixmap *UndoManager::IPaste           = nullptr;
1109
QPixmap *UndoManager::ICut             = nullptr;
1110
QPixmap *UndoManager::ITransparency    = nullptr;
1111
QPixmap *UndoManager::ILineStyle       = nullptr;
1112
QPixmap *UndoManager::IArrow           = nullptr;
1113
QPixmap *UndoManager::IFont            = nullptr;
1114
QPixmap *UndoManager::ISVG             = nullptr;
1115
QPixmap *UndoManager::IUniconv         = nullptr;
1116
QPixmap *UndoManager::IEPS             = nullptr;
1117
QPixmap *UndoManager::IAI              = nullptr;
1118
QPixmap *UndoManager::IXFIG            = nullptr;
1119
QPixmap *UndoManager::IWMF             = nullptr;
1120
QPixmap *UndoManager::IImportOOoDraw   = nullptr;
1121
QPixmap *UndoManager::IImageScaling    = nullptr;
1122
QPixmap *UndoManager::IBorder          = nullptr;
1123
QPixmap *UndoManager::IDocument        = nullptr;
1124
QPixmap *UndoManager::ILayer           = nullptr;
1125
QPixmap *UndoManager::ILayerAction     = nullptr;
1126
QPixmap *UndoManager::IUp              = nullptr;
1127
QPixmap *UndoManager::IDown            = nullptr;
1128
QPixmap *UndoManager::IPrint           = nullptr;
1129
QPixmap *UndoManager::IGetImage        = nullptr;
1130
QPixmap *UndoManager::IChangeFormula   = nullptr;
1131
QPixmap *UndoManager::IMultipleDuplicate = nullptr;
1658 tsoots 1132
 
13371 jghali 1133
 
1134