Subversion Repositories Scribus

Rev

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