Subversion Repositories Scribus

Rev

Rev 23166 | Rev 23268 | 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
*/
1993 cbradney 7
/***************************************************************************
8
        begin                : Apr 2005
9
        copyright            : (C) 2005 by Craig Bradney
10
        email                : cbradney@zip.com.au
11
***************************************************************************/
12
 
13
/***************************************************************************
14
*                                                                         *
5243 cbradney 15
*   mainWindow program is free software; you can redistribute it and/or modify  *
1993 cbradney 16
*   it under the terms of the GNU General Public License as published by  *
17
*   the Free Software Foundation; either version 2 of the License, or     *
18
*   (at your option) any later version.                                   *
19
*                                                                         *
20
***************************************************************************/
21
 
22
#include "actionmanager.h"
19067 craig 23
#include "appmodes.h"
19080 craig 24
 
10328 cbradney 25
#include "scribuscore.h"
4688 cbradney 26
#include "scribusdoc.h"
2026 cbradney 27
#include "scribusview.h"
3934 cbradney 28
#include "selection.h"
10181 cbradney 29
#include "text/storytext.h"
1993 cbradney 30
#include "undomanager.h"
10311 cbradney 31
#include "urllauncher.h"
20185 craig 32
#include "iconmanager.h"
1993 cbradney 33
 
5243 cbradney 34
QMap<QString, QKeySequence> ActionManager::defKeys;
12940 cbradney 35
QVector< QPair<QString, QStringList> > ActionManager::defMenuNames;
9857 cbradney 36
QVector< QPair<QString, QStringList> > ActionManager::defMenus;
12940 cbradney 37
QVector< QPair<QString, QStringList> > ActionManager::defNonMenuNames;
9857 cbradney 38
QVector< QPair<QString, QStringList> > ActionManager::defNonMenuActions;
5243 cbradney 39
 
10427 cbradney 40
ActionManager::ActionManager ( QObject * parent ) :
23054 craig 41
        QObject ( parent),
42
        im (IconManager::instance())
1993 cbradney 43
{
5257 cbradney 44
}
45
 
8246 cbradney 46
ActionManager::~ActionManager()
47
{
9911 cbradney 48
        while (!scrActions->isEmpty())
49
        {
50
                ScrAction *value = (*scrActions->begin());
51
                scrActions->erase(scrActions->begin());
52
                delete value;
53
        }
54
        scrActions->clear();
8246 cbradney 55
        delete modeActionNames;
56
        delete nonEditActionNames;
57
        delete unicodeCharActionNames;
58
}
59
 
5257 cbradney 60
void ActionManager::init(ScribusMainWindow *mw)
61
{
62
        mainWindow=mw;
5243 cbradney 63
        scrActions=&(mainWindow->scrActions);
64
        scrActionGroups=&(mainWindow->scrActionGroups);
1995 cbradney 65
        modeActionNames=new QStringList();
66
        nonEditActionNames=new QStringList();
67
        unicodeCharActionNames=new QStringList();
1993 cbradney 68
        undoManager = UndoManager::instance();
2246 subik 69
 
18204 fschmid 70
#ifdef Q_OS_MAC
23054 craig 71
        noIcon = im.loadPixmap("noicon.png");
3580 avox 72
#endif
7087 subik 73
 
1993 cbradney 74
        createActions();
12940 cbradney 75
        createDefaultMenus();
76
        createDefaultNonMenuActions();
2161 cbradney 77
        languageChange();
17723 craig 78
        setActionTooltips(scrActions);
1993 cbradney 79
}
80
 
22553 craig 81
bool ActionManager::compareKeySeqToShortcut(const QKeySequence& ks, const QString& actionName)
19304 craig 82
{
83
        if (!scrActions->contains(actionName))
84
                return false;
22639 craig 85
        return ks.matches((*scrActions)[actionName]->shortcut())==QKeySequence::ExactMatch;
19304 craig 86
}
87
 
22553 craig 88
bool ActionManager::compareKeySeqToShortcut(int k, Qt::KeyboardModifiers km, const QString& actionName)
19304 craig 89
{
90
        return compareKeySeqToShortcut(QKeySequence(k | km), actionName);
91
}
92
 
1993 cbradney 93
void ActionManager::createActions()
94
{
95
        initFileMenuActions();
96
        initEditMenuActions();
97
        initStyleMenuActions();
98
        initItemMenuActions();
99
        initInsertMenuActions();
100
        initPageMenuActions();
22813 jghali 101
        initTableMenuActions();
1993 cbradney 102
        initViewMenuActions();
103
        initToolsMenuActions();
104
        initExtrasMenuActions();
105
        initWindowsMenuActions();
106
        initScriptMenuActions();
107
        initHelpMenuActions();
5243 cbradney 108
        initUnicodeActions(scrActions, mainWindow, unicodeCharActionNames);
4881 cbradney 109
        enableUnicodeActions(scrActions, false);
1993 cbradney 110
        initSpecialActions();
111
}
112
 
113
void ActionManager::initFileMenuActions()
114
{
5243 cbradney 115
        QString name;
1993 cbradney 116
        //File Menu
23167 jghali 117
        name = "fileNew";
23054 craig 118
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-new.png"), im.loadPixmap("22/document-new.png"), "", defaultKey(name), mainWindow));
23167 jghali 119
        name = "fileNewFromTemplate";
13188 fschmid 120
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 121
        name = "fileOpen";
23054 craig 122
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-open.png"), im.loadPixmap("22/document-open.png"), "", defaultKey(name), mainWindow));
23167 jghali 123
        name = "fileClose";
23054 craig 124
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/close.png"), im.loadPixmap("22/close.png"), "", defaultKey(name), mainWindow));
23167 jghali 125
        name = "fileSave";
23054 craig 126
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-save.png"), im.loadPixmap("22/document-save.png"), "", defaultKey(name), mainWindow));
23167 jghali 127
        name = "fileSaveAs";
23054 craig 128
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-save-as.png"), im.loadPixmap("22/document-save-as.png"), "", defaultKey(name), mainWindow));
23167 jghali 129
        name = "fileRevert";
23054 craig 130
        scrActions->insert(name, new ScrAction(im.loadPixmap("revert.png"), QPixmap(), "", defaultKey(name), mainWindow));
23167 jghali 131
        name = "fileCollect";
11765 cbradney 132
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 133
        //File Import Menu
23167 jghali 134
        name = "fileImportText";
11765 cbradney 135
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 136
        name = "fileImportText2";
11765 cbradney 137
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 138
        name = "fileImportAppendText";
11765 cbradney 139
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 140
        name = "fileImportImage";
11765 cbradney 141
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 142
        name = "fileImportVector";
12110 fschmid 143
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 144
 
145
        //File Export Menu
23167 jghali 146
        name = "fileExportText";
11765 cbradney 147
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 148
        name = "fileExportAsEPS";
11765 cbradney 149
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 150
        name = "fileExportAsPDF";
23054 craig 151
        scrActions->insert(name, new ScrAction(im.loadPixmap("acroread16.png"), im.loadPixmap("acroread22.png"), "", defaultKey(name), mainWindow));
1993 cbradney 152
        //Rest of File Menu
23167 jghali 153
//      name = "fileDocSetup";
23054 craig 154
//      scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-properties.png"), im.loadPixmap("22/document-properties.png"), "", defaultKey(name), mainWindow));
23167 jghali 155
        name = "fileDocSetup150";
23054 craig 156
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-properties.png"), im.loadPixmap("22/document-properties.png"), "", defaultKey(name), mainWindow));
23167 jghali 157
//      name = "filePreferences";
15834 fschmid 158
//      scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
159
//      (*scrActions)[name]->setMenuRole(QAction::NoRole);
23167 jghali 160
        name = "filePreferences150";
13761 cbradney 161
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
15106 cbradney 162
        (*scrActions)[name]->setMenuRole(QAction::PreferencesRole);
23167 jghali 163
        name = "filePrint";
23054 craig 164
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-print.png"), im.loadPixmap("22/document-print.png"), "", defaultKey(name), mainWindow));
23167 jghali 165
        name = "PrintPreview";
23054 craig 166
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/document-print-preview.png"), im.loadPixmap("22/document-print-preview.png"), "", defaultKey(name), mainWindow));
23167 jghali 167
        name = "fileQuit";
23054 craig 168
        scrActions->insert(name, new ScrAction(im.loadPixmap("exit.png"), QPixmap(), "", defaultKey(name), mainWindow));
11158 avox 169
        (*scrActions)[name]->setMenuRole(QAction::QuitRole);
1993 cbradney 170
 
171
        //Connect our signals and slots
172
        //File Menu
10725 jghali 173
        connect( (*scrActions)["fileNew"], SIGNAL(triggered()), mainWindow, SLOT(slotFileNew()) );
13188 fschmid 174
        connect( (*scrActions)["fileNewFromTemplate"], SIGNAL(triggered()), mainWindow, SLOT(newFileFromTemplate()) );
19080 craig 175
        connect( (*scrActions)["fileOpen"], SIGNAL(triggered()), mainWindow, SLOT(slotFileOpen()) );
10725 jghali 176
        connect( (*scrActions)["fileClose"], SIGNAL(triggered()), mainWindow, SLOT(slotFileClose()) );
177
        connect( (*scrActions)["filePrint"], SIGNAL(triggered()), mainWindow, SLOT(slotFilePrint()) );
178
        connect( (*scrActions)["PrintPreview"], SIGNAL(triggered()), mainWindow, SLOT(printPreview()) );
179
        connect( (*scrActions)["fileSave"], SIGNAL(triggered()), mainWindow, SLOT(slotFileSave()) );
180
        connect( (*scrActions)["fileSaveAs"], SIGNAL(triggered()), mainWindow, SLOT(slotFileSaveAs()) );
17000 fschmid 181
        connect( (*scrActions)["fileDocSetup150"], SIGNAL(triggered()), mainWindow, SLOT(slotDocSetup()) );
182
        connect( (*scrActions)["filePreferences150"], SIGNAL(triggered()), mainWindow, SLOT(slotPrefsOrg()) );
10725 jghali 183
        connect( (*scrActions)["fileRevert"], SIGNAL(triggered()), mainWindow, SLOT(slotFileRevert()) );
15207 cbradney 184
        connect( (*scrActions)["fileCollect"], SIGNAL(triggered()), mainWindow, SLOT(fileCollect()) );
10725 jghali 185
        connect( (*scrActions)["fileQuit"], SIGNAL(triggered()), mainWindow, SLOT(slotFileQuit()) );
1993 cbradney 186
        //File Import Menu
10725 jghali 187
        connect( (*scrActions)["fileImportText"], SIGNAL(triggered()), mainWindow, SLOT(slotGetContent()) );
188
        connect( (*scrActions)["fileImportText2"], SIGNAL(triggered()), mainWindow, SLOT(slotGetContent2()) );
189
        connect( (*scrActions)["fileImportAppendText"], SIGNAL(triggered()), mainWindow, SLOT(slotFileAppend()) );
190
        connect( (*scrActions)["fileImportImage"], SIGNAL(triggered()), mainWindow, SLOT(slotGetContent()) );
12110 fschmid 191
        connect( (*scrActions)["fileImportVector"], SIGNAL(triggered()), mainWindow, SLOT(importVectorFile()) );
1993 cbradney 192
        //File Export Menu
10725 jghali 193
        connect( (*scrActions)["fileExportText"], SIGNAL(triggered()), mainWindow, SLOT(SaveText()) );
194
        connect( (*scrActions)["fileExportAsEPS"], SIGNAL(triggered()), mainWindow, SLOT(SaveAsEps()) );
195
        connect( (*scrActions)["fileExportAsPDF"], SIGNAL(triggered()), mainWindow, SLOT(SaveAsPDF()) );
1993 cbradney 196
        //The rest are plugins
12320 cbradney 197
 
198
 
199
        (*scrActions)["fileClose"]->setShortcutContext(Qt::WidgetShortcut);
1993 cbradney 200
}
201
 
202
void ActionManager::initEditMenuActions()
203
{
5243 cbradney 204
        QString name;
1993 cbradney 205
        //Edit Menu
23167 jghali 206
        name = "editUndoAction";
23054 craig 207
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/edit-undo.png"), im.loadPixmap("22/edit-undo.png"), "", defaultKey(name), mainWindow, 1));
23167 jghali 208
        name = "editRedoAction";
23054 craig 209
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/edit-redo.png"), im.loadPixmap("22/edit-redo.png"), "", defaultKey(name), mainWindow, 1));
23167 jghali 210
        name = "editActionMode";
11765 cbradney 211
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 212
        (*scrActions)["editActionMode"]->setToggleAction(true);
7087 subik 213
 
23167 jghali 214
        name = "editCut";
23054 craig 215
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/edit-cut.png"), im.loadPixmap("22/edit-cut.png"), "", defaultKey(name), mainWindow));
23167 jghali 216
        name = "editCopy";
23054 craig 217
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/edit-copy.png"), im.loadPixmap("22/edit-copy.png"), "", defaultKey(name), mainWindow));
23167 jghali 218
        name = "editPaste";
23054 craig 219
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/edit-paste.png"), im.loadPixmap("22/edit-paste.png"), "", defaultKey(name), mainWindow));
23167 jghali 220
        name = "editCopyContents";
23054 craig 221
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/edit-copy.png"), im.loadPixmap("22/edit-copy.png"), "", defaultKey(name), mainWindow));
23167 jghali 222
        name = "editPasteContents";
23054 craig 223
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/edit-paste.png"), QPixmap(), "", defaultKey(name), mainWindow, 0));
23167 jghali 224
        name = "editPasteContentsAbs";
23054 craig 225
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/edit-paste.png"), QPixmap(), "", defaultKey(name), mainWindow, 1));
23167 jghali 226
        name = "editPasteImageFromClipboard";
23054 craig 227
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/edit-paste.png"), im.loadPixmap("22/edit-paste.png"), "", defaultKey(name), mainWindow));
23167 jghali 228
        name = "editClearContents";
23054 craig 229
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/edit-delete.png"), im.loadPixmap("22/edit-delete.png"), "", defaultKey(name), mainWindow));
23167 jghali 230
        name = "editTruncateContents";
19188 craig 231
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 232
        name = "editSelectAll";
11765 cbradney 233
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 234
        name = "editSelectAllOnLayer";
11893 cbradney 235
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 236
        name = "editDeselectAll";
11765 cbradney 237
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 238
        name = "editSearchReplace";
23054 craig 239
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/edit-find-replace.png"), im.loadPixmap("22/edit-find-replace.png"), "", defaultKey(name), mainWindow));
23167 jghali 240
        name = "editEditWithImageEditor";
11765 cbradney 241
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 242
        name = "editEditRenderSource";
11765 cbradney 243
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 244
        name = "editColorsAndFills";
11765 cbradney 245
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 246
        name = "editReplaceColors";
11895 fschmid 247
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 248
        name = "editStyles";
11765 cbradney 249
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 250
        name = "editMasterPages";
11765 cbradney 251
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 252
        name = "editJavascripts";
11765 cbradney 253
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 254
        name = "editMarks";
17826 craig 255
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 256
        name = "editNotesStyles";
17826 craig 257
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
2264 subik 258
 
4829 tsoots 259
        (*scrActions)["editStyles"]->setToggleAction(true);
17826 craig 260
        (*scrActions)["editMarks"]->setToggleAction(true);
261
        (*scrActions)["editNotesStyles"]->setToggleAction(true);
4829 tsoots 262
 
10728 cbradney 263
        connect( (*scrActions)["editUndoAction"], SIGNAL(triggeredData(int)) , undoManager, SLOT(undo(int)) );
264
        connect( (*scrActions)["editRedoAction"], SIGNAL(triggeredData(int)) , undoManager, SLOT(redo(int)) );
5243 cbradney 265
        connect( (*scrActions)["editActionMode"], SIGNAL(toggled(bool)), mainWindow, SLOT(setUndoMode(bool)) );
10725 jghali 266
        connect( (*scrActions)["editCut"], SIGNAL(triggered()), mainWindow, SLOT(slotEditCut()) );
267
        connect( (*scrActions)["editCopy"], SIGNAL(triggered()), mainWindow, SLOT(slotEditCopy()) );
268
        connect( (*scrActions)["editPaste"], SIGNAL(triggered()), mainWindow, SLOT(slotEditPaste()) );
269
        connect( (*scrActions)["editCopyContents"], SIGNAL(triggered()), mainWindow, SLOT(slotEditCopyContents()) );
10728 cbradney 270
        connect( (*scrActions)["editPasteContents"], SIGNAL(triggeredData(int)), mainWindow, SLOT(slotEditPasteContents(int)) );
271
        connect( (*scrActions)["editPasteContentsAbs"], SIGNAL(triggeredData(int)), mainWindow, SLOT(slotEditPasteContents(int)) );
16559 craig 272
        connect( (*scrActions)["editPasteImageFromClipboard"], SIGNAL(triggered()), mainWindow, SLOT(slotGetClipboardImage()) );
10725 jghali 273
        connect( (*scrActions)["editSelectAll"], SIGNAL(triggered()), mainWindow, SLOT(SelectAll()) );
11893 cbradney 274
        connect( (*scrActions)["editSelectAllOnLayer"], SIGNAL(triggered()), mainWindow, SLOT(SelectAllOnLayer()) );
10725 jghali 275
        connect( (*scrActions)["editDeselectAll"], SIGNAL(triggered()), mainWindow, SLOT(deselectAll()) );
276
        connect( (*scrActions)["editSearchReplace"], SIGNAL(triggered()), mainWindow, SLOT(SearchText()) );
277
        connect( (*scrActions)["editEditWithImageEditor"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
12400 cbradney 278
        connect( (*scrActions)["editEditRenderSource"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
21926 craig 279
        connect( (*scrActions)["editColorsAndFills"], SIGNAL(triggered()), mainWindow, SLOT(manageColorsAndFills()) );
11895 fschmid 280
        connect( (*scrActions)["editReplaceColors"], SIGNAL(triggered()), mainWindow, SLOT(slotReplaceColors()) );
18893 craig 281
        connect( (*scrActions)["editMasterPages"], SIGNAL(triggered()), mainWindow, SLOT(editMasterPagesStart()) );
10725 jghali 282
        connect( (*scrActions)["editJavascripts"], SIGNAL(triggered()), mainWindow, SLOT(ManageJava()) );
1993 cbradney 283
}
284
 
285
void ActionManager::initStyleMenuActions()
286
{
287
        //Text Size actions
23166 jghali 288
        scrActionGroups->insert("fontSize", new QActionGroup(mainWindow));
22832 craig 289
        QString name("fontSizeOther");
23166 jghali 290
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("fontSize"), -1));
19912 craig 291
        connect( (*scrActions)["fontSizeOther"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFontSize(int)));
1993 cbradney 292
 
293
        int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
294
        size_t f_size = sizeof(font_sizes) / sizeof(*font_sizes);
295
        for (uint s = 0; s < f_size; ++s)
296
        {
297
                QString fontSizeName=QString("fontSize%1").arg(font_sizes[s]);
23166 jghali 298
                scrActions->insert(fontSizeName, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("fontSize"), font_sizes[s]));
1993 cbradney 299
                (*scrActions)[fontSizeName]->setToggleAction(true);
19912 craig 300
                connect( (*scrActions)[fontSizeName], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFontSize(int)));
1993 cbradney 301
        }
302
 
303
        //Alignment actions
23167 jghali 304
        name = "alignLeft";
11765 cbradney 305
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 0));
23167 jghali 306
        name = "alignCenter";
11765 cbradney 307
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 1));
23167 jghali 308
        name = "alignRight";
11765 cbradney 309
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 2));
23167 jghali 310
        name = "alignBlock";
11765 cbradney 311
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 3));
23167 jghali 312
        name = "alignForced";
11765 cbradney 313
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 4));
1993 cbradney 314
 
315
        (*scrActions)["alignLeft"]->setToggleAction(true);
316
        (*scrActions)["alignCenter"]->setToggleAction(true);
317
        (*scrActions)["alignRight"]->setToggleAction(true);
318
        (*scrActions)["alignBlock"]->setToggleAction(true);
319
        (*scrActions)["alignForced"]->setToggleAction(true);
320
 
10728 cbradney 321
        connect( (*scrActions)["alignLeft"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
322
        connect( (*scrActions)["alignCenter"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
323
        connect( (*scrActions)["alignRight"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
324
        connect( (*scrActions)["alignBlock"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
325
        connect( (*scrActions)["alignForced"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
1993 cbradney 326
 
327
        //Shade actions
12471 cbradney 328
/*
9857 cbradney 329
        scrActionGroups->insert("shade", new QActionGroup(mainWindow));
23167 jghali 330
        name = "shadeOther";
23166 jghali 331
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("shade"), -1));
10728 cbradney 332
        connect( (*scrActions)["shadeOther"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemShade(int)));
1993 cbradney 333
        for (uint i=0; i<=100 ; i+=10)
334
        {
335
                QString shadeName=QString("shade%1").arg(i);
23166 jghali 336
                scrActions->insert(shadeName, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("shade"), i));
1993 cbradney 337
                (*scrActions)[shadeName]->setToggleAction(true);
10728 cbradney 338
                connect( (*scrActions)[shadeName], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemShade(int)));
1993 cbradney 339
        }
12471 cbradney 340
*/
1993 cbradney 341
 
342
        //Type Effects actions
9857 cbradney 343
        scrActionGroups->insert("typeEffects", new QActionGroup(mainWindow));
23167 jghali 344
        name = "typeEffectNormal";
23166 jghali 345
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 0));
23167 jghali 346
        name = "typeEffectUnderline";
23166 jghali 347
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 1));
23167 jghali 348
        name = "typeEffectUnderlineWords";
23166 jghali 349
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 8));
23167 jghali 350
        name = "typeEffectStrikeThrough";
23166 jghali 351
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 2));
23167 jghali 352
        name = "typeEffectAllCaps";
23166 jghali 353
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 7));
23167 jghali 354
        name = "typeEffectSmallCaps";
23166 jghali 355
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 3));
23167 jghali 356
        name = "typeEffectSuperscript";
23166 jghali 357
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 4));
23167 jghali 358
        name = "typeEffectSubscript";
23166 jghali 359
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 5));
23167 jghali 360
        name = "typeEffectOutline";
23166 jghali 361
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 6));
23167 jghali 362
        name = "typeEffectShadow";
23166 jghali 363
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 9));
1993 cbradney 364
        (*scrActions)["typeEffectNormal"]->setToggleAction(true);
365
        (*scrActions)["typeEffectUnderline"]->setToggleAction(true);
2188 fschmid 366
        (*scrActions)["typeEffectUnderlineWords"]->setToggleAction(true);
1993 cbradney 367
        (*scrActions)["typeEffectStrikeThrough"]->setToggleAction(true);
2185 fschmid 368
        (*scrActions)["typeEffectAllCaps"]->setToggleAction(true);
1993 cbradney 369
        (*scrActions)["typeEffectSmallCaps"]->setToggleAction(true);
370
        (*scrActions)["typeEffectSuperscript"]->setToggleAction(true);
371
        (*scrActions)["typeEffectSubscript"]->setToggleAction(true);
372
        (*scrActions)["typeEffectOutline"]->setToggleAction(true);
2229 fschmid 373
        (*scrActions)["typeEffectShadow"]->setToggleAction(true);
10728 cbradney 374
        connect( (*scrActions)["typeEffectNormal"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
375
        connect( (*scrActions)["typeEffectUnderline"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
376
        connect( (*scrActions)["typeEffectUnderlineWords"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
377
        connect( (*scrActions)["typeEffectStrikeThrough"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
378
        connect( (*scrActions)["typeEffectSmallCaps"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
379
        connect( (*scrActions)["typeEffectAllCaps"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
380
        connect( (*scrActions)["typeEffectSuperscript"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
381
        connect( (*scrActions)["typeEffectSubscript"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
382
        connect( (*scrActions)["typeEffectOutline"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
383
        connect( (*scrActions)["typeEffectShadow"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
1993 cbradney 384
 
385
        //Other Style menu items that get added in various places
23167 jghali 386
        name = "styleImageEffects";
11765 cbradney 387
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 388
        name = "styleTabulators";
11765 cbradney 389
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
10725 jghali 390
        connect( (*scrActions)["styleImageEffects"], SIGNAL(triggered()), mainWindow, SLOT(ImageEffects()));
391
        connect( (*scrActions)["styleTabulators"], SIGNAL(triggered()), mainWindow, SLOT(EditTabs()));
1993 cbradney 392
}
393
 
394
void ActionManager::initItemMenuActions()
395
{
5243 cbradney 396
        QString name;
1993 cbradney 397
        //Item Menu
23167 jghali 398
        name = "itemDuplicate";
11765 cbradney 399
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 400
        name = "itemMulDuplicate";
11765 cbradney 401
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 402
        name = "itemTransform";
15309 cbradney 403
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 404
        name = "itemDelete";
11765 cbradney 405
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 406
        name = "itemGroup";
11765 cbradney 407
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 408
        name = "itemUngroup";
11765 cbradney 409
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 410
        name = "itemGroupAdjust";
17905 fschmid 411
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 412
        name = "itemLock";
11765 cbradney 413
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 414
        name = "itemLockSize";
11765 cbradney 415
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 416
        name = "itemPrintingEnabled";
11765 cbradney 417
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 418
        name = "itemFlipH";
11765 cbradney 419
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 420
        name = "itemFlipV";
11765 cbradney 421
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
4695 cbradney 422
        (*scrActions)["itemLock"]->setToggleAction(true, true);
423
        (*scrActions)["itemLockSize"]->setToggleAction(true, true);
4698 cbradney 424
        (*scrActions)["itemPrintingEnabled"]->setToggleAction(true, true);
4699 cbradney 425
        (*scrActions)["itemFlipH"]->setToggleAction(true, true);
426
        (*scrActions)["itemFlipV"]->setToggleAction(true, true);
23167 jghali 427
        name = "itemLowerToBottom";
23054 craig 428
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/go-bottom.png"), im.loadPixmap("22/go-bottom.png"), "", defaultKey(name), mainWindow));
23167 jghali 429
        name = "itemRaiseToTop";
23054 craig 430
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/go-top.png"), im.loadPixmap("22/go-top.png"), "", defaultKey(name), mainWindow));
23167 jghali 431
        name = "itemLower";
23054 craig 432
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/go-down.png"), im.loadPixmap("22/go-down.png"), "", defaultKey(name), mainWindow));
23167 jghali 433
        name = "itemRaise";
23054 craig 434
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/go-up.png"), im.loadPixmap("22/go-up.png"), "", defaultKey(name), mainWindow));
23167 jghali 435
        name = "itemSendToPattern";
11765 cbradney 436
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 437
        name = "itemSendToInline";
18068 fschmid 438
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 439
        name = "itemImageInfo";
11765 cbradney 440
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 441
        name = "itemAttributes";
11765 cbradney 442
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 443
        name = "itemImageIsVisible";
11765 cbradney 444
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 445
        name = "itemUpdateImage";
11765 cbradney 446
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 447
        name = "itemAdjustFrameHeightToText";
17595 craig 448
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 449
        name = "itemAdjustFrameToImage";
11765 cbradney 450
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
12591 fschmid 451
        name = "itemAdjustImageToFrame";
452
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 453
        name = "itemExtendedImageProperties";
11765 cbradney 454
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 455
        name = "itemToggleInlineImage";
14796 fschmid 456
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23166 jghali 457
 
458
        QActionGroup* itemPreviewGroup = new QActionGroup(mainWindow);
459
        scrActionGroups->insert("itemPreview", itemPreviewGroup);
460
        itemPreviewGroup->setExclusive(true);
461
        name = "itemPreviewFull";
462
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), itemPreviewGroup, 0));
463
        name = "itemPreviewNormal";
464
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), itemPreviewGroup, 1));
465
        name = "itemPreviewLow";
466
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), itemPreviewGroup, 2));
467
 
468
        (*scrActions)["itemImageIsVisible"]->setToggleAction(true);
469
        (*scrActions)["itemPreviewFull"]->setToggleAction(true);
470
        (*scrActions)["itemPreviewNormal"]->setToggleAction(true);
471
        (*scrActions)["itemPreviewLow"]->setToggleAction(true);
472
        (*scrActions)["itemToggleInlineImage"]->setToggleAction(true);
473
 
23167 jghali 474
        name = "itemPDFIsBookmark";
11765 cbradney 475
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 476
        (*scrActions)["itemPDFIsBookmark"]->setToggleAction(true);
23167 jghali 477
        name = "itemPDFIsAnnotation";
11765 cbradney 478
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 479
        (*scrActions)["itemPDFIsAnnotation"]->setToggleAction(true);
23167 jghali 480
        name = "itemPDFAnnotationProps";
11765 cbradney 481
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 482
        name = "itemPDFFieldProps";
11765 cbradney 483
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
2246 subik 484
 
23167 jghali 485
        name = "itemShapeEdit";
11765 cbradney 486
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 487
        (*scrActions)["itemShapeEdit"]->setToggleAction(true);
23167 jghali 488
        name = "itemAttachTextToPath";
11765 cbradney 489
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 490
        name = "itemDetachTextFromPath";
11765 cbradney 491
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 492
        name = "itemCombinePolygons";
11765 cbradney 493
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 494
        name = "itemSplitPolygons";
11765 cbradney 495
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 496
        name = "itemConvertToBezierCurve";
11765 cbradney 497
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 498
        name = "itemConvertToImageFrame";
11765 cbradney 499
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 500
        name = "itemConvertToOutlines";
11765 cbradney 501
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 502
        name = "itemConvertToPolygon";
11765 cbradney 503
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 504
        name = "itemConvertToTextFrame";
11765 cbradney 505
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 506
        name = "itemConvertToSymbolFrame";
18068 fschmid 507
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 508
 
23167 jghali 509
        name = "itemsUnWeld";
16926 fschmid 510
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 511
        name = "itemWeld";
16926 fschmid 512
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 513
        name = "itemEditWeld";
16944 fschmid 514
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
16926 fschmid 515
 
10953 subik 516
        connect( (*scrActions)["itemDuplicate"], SIGNAL(triggered()), mainWindow, SLOT(duplicateItem()) );
517
        connect( (*scrActions)["itemMulDuplicate"], SIGNAL(triggered()), mainWindow, SLOT(duplicateItemMulti()) );
15309 cbradney 518
        connect( (*scrActions)["itemTransform"], SIGNAL(triggered()), mainWindow, SLOT(slotItemTransform()) );
10725 jghali 519
        connect( (*scrActions)["itemGroup"], SIGNAL(triggered()), mainWindow, SLOT(GroupObj()) );
520
        connect( (*scrActions)["itemUngroup"], SIGNAL(triggered()), mainWindow, SLOT(UnGroupObj()) );
17905 fschmid 521
        connect( (*scrActions)["itemGroupAdjust"], SIGNAL(triggered()), mainWindow, SLOT(AdjustGroupObj()) );
10725 jghali 522
        connect( (*scrActions)["itemPDFAnnotationProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
523
        connect( (*scrActions)["itemPDFFieldProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
524
        connect( (*scrActions)["itemSendToPattern"], SIGNAL(triggered()), mainWindow, SLOT(PutToPatterns()) );
18068 fschmid 525
        connect( (*scrActions)["itemSendToInline"], SIGNAL(triggered()), mainWindow, SLOT(PutToInline()) );
526
        connect( (*scrActions)["itemConvertToSymbolFrame"], SIGNAL(triggered()), mainWindow, SLOT(ConvertToSymbol()) );
10725 jghali 527
        connect( (*scrActions)["itemAttributes"], SIGNAL(triggered()), mainWindow, SLOT(objectAttributes()) );
528
        connect( (*scrActions)["itemShapeEdit"], SIGNAL(triggered()), mainWindow, SLOT(toggleNodeEdit()) );
529
        connect( (*scrActions)["itemImageInfo"], SIGNAL(triggered()), mainWindow, SLOT(getImageInfo()) );
14796 fschmid 530
        connect( (*scrActions)["itemToggleInlineImage"], SIGNAL(triggered()), mainWindow, SLOT(toogleInlineState()) );
1993 cbradney 531
}
532
 
533
void ActionManager::initInsertMenuActions()
534
{
5243 cbradney 535
        QString name;
1993 cbradney 536
        //Insert Menu
23167 jghali 537
        name = "insertFrame";
11765 cbradney 538
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 539
        name = "insertGlyph";
11765 cbradney 540
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
7087 subik 541
        (*scrActions)["insertGlyph"]->setToggleAction(true);
23167 jghali 542
        name = "insertSampleText";
11765 cbradney 543
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 544
        name = "stickyTools";
11765 cbradney 545
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
7350 fschmid 546
        (*scrActions)["stickyTools"]->setToggleAction(true);
2246 subik 547
 
17826 craig 548
        //Marks
23167 jghali 549
        name = "insertMarkAnchor";
17826 craig 550
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
551
        (*scrActions)[name]->setEnabled(true);
23167 jghali 552
        name = "insertMarkVariableText";
17826 craig 553
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
554
        (*scrActions)[name]->setEnabled(true);
23167 jghali 555
        name = "insertMarkItem";
17826 craig 556
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
557
        (*scrActions)[name]->setEnabled(true);
23167 jghali 558
        name = "insertMark2Mark";
17826 craig 559
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
560
        (*scrActions)[name]->setEnabled(true);
23167 jghali 561
        name = "insertMarkNote";
17826 craig 562
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
563
        (*scrActions)[name]->setEnabled(true);
23167 jghali 564
//      name = "insertMarkIndex";
17826 craig 565
//      scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
566
//      (*scrActions)[name]->setEnabled(true);
23167 jghali 567
        name = "editMark";
17826 craig 568
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
569
        (*scrActions)[name]->setEnabled(false);
23167 jghali 570
        name = "itemUpdateMarks";
17826 craig 571
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
572
        (*scrActions)[name]->setEnabled(false);
573
 
10725 jghali 574
        connect( (*scrActions)["insertFrame"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertFrame()) );
575
        connect( (*scrActions)["insertGlyph"], SIGNAL(triggered()), mainWindow, SLOT(slotCharSelect()) );
576
        connect( (*scrActions)["insertSampleText"], SIGNAL(triggered()), mainWindow, SLOT(insertSampleText()) );
577
        connect( (*scrActions)["stickyTools"], SIGNAL(triggered()), mainWindow, SLOT(ToggleStickyTools()) );
17826 craig 578
 
579
        connect( (*scrActions)["insertMarkAnchor"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkAnchor()) );
580
        connect( (*scrActions)["insertMarkVariableText"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkVariableText()) );
581
        connect( (*scrActions)["insertMarkItem"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkItem()) );
582
        connect( (*scrActions)["insertMark2Mark"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMark2Mark()) );
583
        connect( (*scrActions)["insertMarkNote"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkNote()) );
584
//      connect( (*scrActions)["insertMarkIndex"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkIndex()) );
585
        connect( (*scrActions)["editMark"], SIGNAL(triggered()), mainWindow, SLOT(slotEditMark()) );
586
        connect( (*scrActions)["itemUpdateMarks"], SIGNAL(triggered()), mainWindow, SLOT(slotUpdateMarks()) );
1993 cbradney 587
}
588
 
589
void ActionManager::initPageMenuActions()
590
{
5243 cbradney 591
        QString name;
1993 cbradney 592
        //Page menu
23167 jghali 593
        name = "pageInsert";
11765 cbradney 594
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 595
        name = "pageImport";
11765 cbradney 596
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 597
        name = "pageDelete";
11765 cbradney 598
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 599
        name = "pageCopy";
11765 cbradney 600
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 601
        name = "pageMove";
11765 cbradney 602
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 603
        name = "pageApplyMasterPage";
11765 cbradney 604
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 605
        name = "pageCopyToMasterPage";
11765 cbradney 606
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 607
        name = "pageManageGuides";
11765 cbradney 608
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
5087 subik 609
        (*scrActions)["pageManageGuides"]->setToggleAction(true);
23167 jghali 610
        name = "pageManageProperties";
11765 cbradney 611
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 612
 
10725 jghali 613
        connect( (*scrActions)["pageInsert"], SIGNAL(triggered()), mainWindow, SLOT(slotNewPageM()) );
614
        connect( (*scrActions)["pageImport"], SIGNAL(triggered()), mainWindow, SLOT(slotPageImport()) );
17213 craig 615
        connect( (*scrActions)["pageDelete"], SIGNAL(triggered()), mainWindow, SLOT(deletePage()) );
616
        connect( (*scrActions)["pageCopy"], SIGNAL(triggered()), mainWindow, SLOT(copyPage()) );
617
        connect( (*scrActions)["pageMove"], SIGNAL(triggered()), mainWindow, SLOT(movePage()) );
10725 jghali 618
        connect( (*scrActions)["pageApplyMasterPage"], SIGNAL(triggered()), mainWindow, SLOT(ApplyMasterPage()) );
619
        connect( (*scrActions)["pageCopyToMasterPage"], SIGNAL(triggered()), mainWindow, SLOT(duplicateToMasterPage()) );
19907 craig 620
        connect( (*scrActions)["pageManageProperties"], SIGNAL(triggered()), mainWindow, SLOT(changePageProperties()) );
1993 cbradney 621
}
622
 
22813 jghali 623
void ActionManager::initTableMenuActions()
624
{
625
        QString name;
626
 
627
        name = "tableInsertRows";
23054 craig 628
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/insert-table-rows.png"), im.loadPixmap("22/insert-table-rows.png"), "", defaultKey(name), mainWindow));
22813 jghali 629
        name = "tableInsertColumns";
23054 craig 630
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/insert-table-columns.png"), im.loadPixmap("22/insert-table-columns.png"), "", defaultKey(name), mainWindow));
22813 jghali 631
        name = "tableDeleteRows";
23054 craig 632
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/delete-table-rows.png"), im.loadPixmap("22/delete-table-rows.png"), "", defaultKey(name), mainWindow));
22813 jghali 633
        name = "tableDeleteColumns";
23054 craig 634
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/delete-table-columns.png"), im.loadPixmap("22/delete-table-columns.png"), "", defaultKey(name), mainWindow));
22813 jghali 635
        name = "tableMergeCells";
23054 craig 636
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/merge-table-cells.png"), im.loadPixmap("22/merge-table-cells.png"), "", defaultKey(name), mainWindow));
22813 jghali 637
        name = "tableSplitCells";
23054 craig 638
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/split-table-cells.png"), im.loadPixmap("22/split-table-cells.png"), "", defaultKey(name), mainWindow));
22813 jghali 639
        name = "tableSetRowHeights";
640
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
641
        name = "tableSetColumnWidths";
642
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
643
        name = "tableDistributeRowsEvenly";
644
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
645
        name = "tableDistributeColumnsEvenly";
646
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
647
        name = "tableAdjustFrameToTable";
648
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
649
        name = "tableAdjustTableToFrame";
650
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
651
}
652
 
1993 cbradney 653
void ActionManager::initViewMenuActions()
654
{
5243 cbradney 655
        QString name;
23167 jghali 656
        name = "viewFitInWindow";
19100 craig 657
        scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, -100.0));
23167 jghali 658
        name = "viewFitWidth";
19100 craig 659
        scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, -200.0));
23167 jghali 660
        name = "viewFit50";
19100 craig 661
        scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 50.0));
23167 jghali 662
        name = "viewFit75";
19100 craig 663
        scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 75.0));
23167 jghali 664
        name = "viewFit100";
23054 craig 665
        scrActions->insert(name, new ScrAction(ScrAction::DataDouble, im.loadPixmap("16/zoom-original.png"), im.loadPixmap("22/zoom-original.png"), "", defaultKey(name), mainWindow, 100.0));
23167 jghali 666
        name = "viewFit200";
19100 craig 667
        scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 200.0));
23167 jghali 668
        name = "viewFit400";
19100 craig 669
        scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, 400.0));
23167 jghali 670
        name = "viewPreviewMode";
23054 craig 671
        scrActions->insert(name, new ScrAction(im.loadPixmap("previewOn.png"), im.loadPixmap("previewOn.png"), "", defaultKey(name), mainWindow));
23167 jghali 672
        name = "viewEditInPreview";
23054 craig 673
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/editdoc.png"), im.loadPixmap("16/editdoc.png"), "", defaultKey(name), mainWindow));
23167 jghali 674
        name = "viewToggleCMS";
23054 craig 675
        scrActions->insert(name, new ScrAction(im.loadPixmap("cmsOn.png"), im.loadPixmap("cmsOn.png"), "", defaultKey(name), mainWindow));
23167 jghali 676
        name = "viewShowMargins";
11765 cbradney 677
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 678
        name = "viewShowBleeds";
11765 cbradney 679
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 680
        name = "viewShowFrames";
11765 cbradney 681
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 682
        name = "viewShowLayerMarkers";
11765 cbradney 683
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 684
        name = "viewShowImages";
11765 cbradney 685
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 686
        name = "viewShowGrid";
11765 cbradney 687
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 688
        name = "viewShowGuides";
11765 cbradney 689
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 690
        name = "viewShowColumnBorders";
11765 cbradney 691
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 692
        name = "viewShowBaseline";
11765 cbradney 693
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 694
        name = "viewShowTextChain";
11765 cbradney 695
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 696
        name = "viewShowTextControls";
11765 cbradney 697
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 698
        name = "viewShowRulers";
11765 cbradney 699
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 700
        name = "viewRulerMode";
11765 cbradney 701
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 702
        name = "viewSnapToGrid";
11765 cbradney 703
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 704
        name = "viewSnapToGuides";
11765 cbradney 705
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 706
        name = "viewSnapToElements";
17744 craig 707
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 708
        name = "viewShowContextMenu";
11765 cbradney 709
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 710
        name = "showMouseCoordinates";
12754 fschmid 711
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
19009 craig 712
 
23167 jghali 713
        name = "viewToggleCM";
19009 craig 714
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 715
//      name = "viewVisionNormal";
716
//      name = "viewVisionProtanopia";
717
//      name = "viewVisionDeuteranopia";
718
//      name = "viewVisionTritanopia";
719
//      name = "viewVisionFullColorBlind";
19009 craig 720
 
11765 cbradney 721
//      scrActions->insert("viewNewView", new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 722
 
17665 craig 723
        (*scrActions)["viewPreviewMode"]->setToggleAction(true);
19009 craig 724
        (*scrActions)["viewEditInPreview"]->setToggleAction(true);
725
        (*scrActions)["viewToggleCMS"]->setToggleAction(true);
1993 cbradney 726
        (*scrActions)["viewShowMargins"]->setToggleAction(true);
7051 fschmid 727
        (*scrActions)["viewShowBleeds"]->setToggleAction(true);
1993 cbradney 728
        (*scrActions)["viewShowFrames"]->setToggleAction(true);
5584 fschmid 729
        (*scrActions)["viewShowLayerMarkers"]->setToggleAction(true);
1993 cbradney 730
        (*scrActions)["viewShowImages"]->setToggleAction(true);
731
        (*scrActions)["viewShowGrid"]->setToggleAction(true);
732
        (*scrActions)["viewShowGuides"]->setToggleAction(true);
5384 cbradney 733
        (*scrActions)["viewShowColumnBorders"]->setToggleAction(true);
1993 cbradney 734
        (*scrActions)["viewShowBaseline"]->setToggleAction(true);
735
        (*scrActions)["viewShowTextChain"]->setToggleAction(true);
2353 fschmid 736
        (*scrActions)["viewShowTextControls"]->setToggleAction(true);
4651 cbradney 737
        (*scrActions)["viewShowRulers"]->setToggleAction(true);
2863 fschmid 738
        (*scrActions)["viewRulerMode"]->setToggleAction(true);
1993 cbradney 739
        (*scrActions)["viewSnapToGrid"]->setToggleAction(true);
740
        (*scrActions)["viewSnapToGuides"]->setToggleAction(true);
17744 craig 741
        (*scrActions)["viewSnapToElements"]->setToggleAction(true);
12754 fschmid 742
        (*scrActions)["showMouseCoordinates"]->setToggleAction(true);
1993 cbradney 743
 
17665 craig 744
        (*scrActions)["viewPreviewMode"]->setChecked(false);
19009 craig 745
        (*scrActions)["viewEditInPreview"]->setChecked(false);
746
        (*scrActions)["viewToggleCMS"]->setChecked(false);
10427 cbradney 747
        (*scrActions)["viewShowMargins"]->setChecked(true);
748
        (*scrActions)["viewShowBleeds"]->setChecked(true);
749
        (*scrActions)["viewShowFrames"]->setChecked(true);
750
        (*scrActions)["viewShowLayerMarkers"]->setChecked(false);
751
        (*scrActions)["viewShowImages"]->setChecked(true);
752
        (*scrActions)["viewShowGuides"]->setChecked(true);
753
        (*scrActions)["viewShowColumnBorders"]->setChecked(false);
754
        (*scrActions)["viewShowRulers"]->setChecked(true);
755
        (*scrActions)["viewRulerMode"]->setChecked(true);
12754 fschmid 756
        (*scrActions)["showMouseCoordinates"]->setChecked(true);
1993 cbradney 757
 
10728 cbradney 758
        connect( (*scrActions)["viewFitInWindow"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
759
        connect( (*scrActions)["viewFitWidth"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
760
        connect( (*scrActions)["viewFit50"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
761
        connect( (*scrActions)["viewFit75"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
762
        connect( (*scrActions)["viewFit100"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
763
        connect( (*scrActions)["viewFit200"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
764
        connect( (*scrActions)["viewFit400"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
19853 craig 765
        connect( (*scrActions)["viewShowMargins"], SIGNAL(triggered()), mainWindow, SLOT(toggleMarks()) );
766
        connect( (*scrActions)["viewShowBleeds"], SIGNAL(triggered()), mainWindow, SLOT(toggleBleeds()) );
767
        connect( (*scrActions)["viewShowFrames"], SIGNAL(triggered()), mainWindow, SLOT(toggleFrames()) );
768
        connect( (*scrActions)["viewShowLayerMarkers"], SIGNAL(triggered()), mainWindow, SLOT(toggleLayerMarkers()) );
19834 craig 769
        connect( (*scrActions)["viewShowImages"], SIGNAL(triggered()), mainWindow, SLOT(toggleImageVisibility()) );
19853 craig 770
        connect( (*scrActions)["viewShowGrid"], SIGNAL(triggered()), mainWindow, SLOT(toggleGrid()) );
771
        connect( (*scrActions)["viewShowGuides"], SIGNAL(triggered()), mainWindow, SLOT(toggleGuides()) );
772
        connect( (*scrActions)["viewShowColumnBorders"], SIGNAL(triggered()), mainWindow, SLOT(toggleColumnBorders()) );
773
        connect( (*scrActions)["viewShowBaseline"], SIGNAL(triggered()), mainWindow, SLOT(toggleBase()) );
774
        connect( (*scrActions)["viewShowTextChain"], SIGNAL(triggered()), mainWindow, SLOT(toggleTextLinks()) );
775
        connect( (*scrActions)["viewShowTextControls"], SIGNAL(triggered()), mainWindow, SLOT(toggleTextControls()) );
776
        connect( (*scrActions)["viewShowRulers"], SIGNAL(triggered()), mainWindow, SLOT(toggleRulers()) );
777
        connect( (*scrActions)["viewRulerMode"], SIGNAL(triggered()), mainWindow, SLOT(toggleRulerMode()) );
778
        connect( (*scrActions)["viewSnapToGrid"], SIGNAL(triggered()), mainWindow, SLOT(toggleSnapGrid()) );
779
        connect( (*scrActions)["viewSnapToGuides"], SIGNAL(triggered()), mainWindow, SLOT(toggleSnapGuides()) );
780
        connect( (*scrActions)["viewSnapToElements"], SIGNAL(triggered()), mainWindow, SLOT(toggleSnapElements()) );
12754 fschmid 781
        connect( (*scrActions)["showMouseCoordinates"], SIGNAL(triggered()), mainWindow, SLOT(ToggleMouseTips()) );
10725 jghali 782
//      connect( (*scrActions)["viewNewView"], SIGNAL(triggered()), mainWindow, SLOT(newView()) );
1993 cbradney 783
 
784
}
785
 
786
void ActionManager::initToolsMenuActions()
787
{
5243 cbradney 788
        QString name;
1993 cbradney 789
        //Tool menu
23167 jghali 790
        name = "toolsProperties";
11765 cbradney 791
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 792
        name = "toolsText";
21575 craig 793
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 794
        name = "toolsOutline";
11765 cbradney 795
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 796
        name = "toolsScrapbook";
11765 cbradney 797
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 798
        name = "toolsLayers";
11765 cbradney 799
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 800
        name = "toolsPages";
11765 cbradney 801
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 802
        name = "toolsBookmarks";
11765 cbradney 803
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 804
        name = "toolsDownloads";
19783 craig 805
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 806
        name = "toolsResources";
19821 craig 807
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 808
        name = "toolsMeasurements";
23054 craig 809
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/measure.png"), im.loadPixmap("22/measure.png"), "", defaultKey(name), mainWindow, modeMeasurementTool));
23167 jghali 810
        name = "toolsActionHistory";
11765 cbradney 811
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 812
        name = "toolsPreflightVerifier";
23054 craig 813
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/preflight-verifier.png"), im.loadPixmap("22/preflight-verifier.png"),"", defaultKey(name), mainWindow));
23167 jghali 814
        name = "toolsAlignDistribute";
11765 cbradney 815
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 816
        name = "toolsSymbols";
15060 fschmid 817
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 818
        name = "toolsInline";
17405 fschmid 819
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 820
        name = "toolsToolbarTools";
11765 cbradney 821
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 822
        name = "toolsToolbarPDF";
11765 cbradney 823
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 824
        name = "toolsToolbarView";
19009 craig 825
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
2246 subik 826
 
1993 cbradney 827
        //toolbar only items
23167 jghali 828
        name = "toolsSelect";
23054 craig 829
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/pointer.png"), im.loadPixmap("22/pointer.png"), "", defaultKey(name), mainWindow, modeNormal));
23167 jghali 830
        name = "toolsInsertTextFrame";
23054 craig 831
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/insert-text-frame.png"), im.loadPixmap("22/insert-text-frame.png"), "", defaultKey(name), mainWindow, modeDrawText));
23167 jghali 832
        name = "toolsInsertImageFrame";
23054 craig 833
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/insert-image.png"), im.loadPixmap("22/insert-image.png"), "", defaultKey(name), mainWindow, modeDrawImage));
23167 jghali 834
        name = "toolsInsertRenderFrame";
23054 craig 835
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/insert-renderframe.png"), im.loadPixmap("22/insert-renderframe.png"), "", defaultKey(name), mainWindow, modeDrawLatex));
23167 jghali 836
        name = "toolsInsertTable";
23054 craig 837
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/insert-table.png"), im.loadPixmap("22/insert-table.png"), "", defaultKey(name), mainWindow, modeDrawTable2));
23167 jghali 838
        name = "toolsInsertShape";
11765 cbradney 839
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, modeDrawShapes));
23167 jghali 840
        name = "toolsInsertPolygon";
23054 craig 841
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/draw-polygon.png"), im.loadPixmap("22/draw-polygon.png"), "", defaultKey(name), mainWindow, modeDrawRegularPolygon));
23167 jghali 842
        name = "toolsInsertArc";
23054 craig 843
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/draw-arc.png"), im.loadPixmap("22/draw-arc.png"), "", defaultKey(name), mainWindow, modeDrawArc));
23167 jghali 844
        name = "toolsInsertSpiral";
23054 craig 845
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/draw-spiral.png"), im.loadPixmap("22/draw-spiral.png"), "", defaultKey(name), mainWindow, modeDrawSpiral));
23167 jghali 846
        name = "toolsInsertLine";
23054 craig 847
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("Stift16.png"), im.loadPixmap("stift.png"), "", defaultKey(name), mainWindow, modeDrawLine));
23167 jghali 848
        name = "toolsInsertBezier";
23054 craig 849
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/draw-path.png"), im.loadPixmap("22/draw-path.png"), "", defaultKey(name), mainWindow, modeDrawBezierLine));
23167 jghali 850
        name = "toolsInsertFreehandLine";
23054 craig 851
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/draw-freehand.png"), im.loadPixmap("22/draw-freehand.png"), "", defaultKey(name), mainWindow, modeDrawFreehandLine));
23167 jghali 852
        name = "toolsInsertCalligraphicLine";
23054 craig 853
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/draw-calligraphic.png"), im.loadPixmap("22/draw-calligraphic.png"), "", defaultKey(name), mainWindow, modeDrawCalligraphicLine));
23167 jghali 854
        name = "toolsRotate";
23054 craig 855
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/transform-rotate.png"), im.loadPixmap("22/transform-rotate.png"), "", defaultKey(name), mainWindow, modeRotation));
23167 jghali 856
        name = "toolsZoom";
23054 craig 857
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/zoom.png"), im.loadPixmap("22/zoom.png"), "", defaultKey(name), mainWindow, modeMagnifier));
23167 jghali 858
        name = "toolsZoomIn";
23054 craig 859
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/zoom-in.png"), im.loadPixmap("22/zoom-in.png"), "", defaultKey(name), mainWindow));
23167 jghali 860
        name = "toolsZoomOut";
23054 craig 861
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/zoom-out.png"), im.loadPixmap("22/zoom-out.png"), "", defaultKey(name), mainWindow));
23167 jghali 862
        name = "toolsEditContents";
23054 craig 863
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("Editm16.png"), im.loadPixmap("editm.png"), "", defaultKey(name), mainWindow, modeEdit));
23167 jghali 864
        name = "toolsEditWithStoryEditor";
23054 craig 865
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/story-editor.png"), im.loadPixmap("22/story-editor.png"), "", defaultKey(name), mainWindow, modeStoryEditor));
23167 jghali 866
        name = "toolsLinkTextFrame";
23054 craig 867
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/text-frame-link.png"), im.loadPixmap("22/text-frame-link.png"), "", defaultKey(name), mainWindow, modeLinkFrames));
23167 jghali 868
        name = "toolsUnlinkTextFrame";
23054 craig 869
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/text-frame-unlink.png"), im.loadPixmap("22/text-frame-unlink.png"), "", defaultKey(name), mainWindow, modeUnlinkFrames));
23167 jghali 870
        name = "toolsEyeDropper";
23054 craig 871
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/color-picker.png"), im.loadPixmap("22/color-picker.png"), "", defaultKey(name), mainWindow, modeEyeDropper));
23167 jghali 872
        name = "toolsCopyProperties";
23054 craig 873
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("wizard16.png"), im.loadPixmap("wizard.png"), "", defaultKey(name), mainWindow, modeCopyProperties));
23167 jghali 874
        name = "toolsUnlinkTextFrameAndCutText";
17565 craig 875
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, modeUnlinkFrames));
7087 subik 876
 
5277 cbradney 877
        //PDF toolbar
23167 jghali 878
        name = "toolsPDFPushButton";
23054 craig 879
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/insert-button.png"), im.loadPixmap("22/insert-button.png"), "", defaultKey(name), mainWindow, modeInsertPDFButton));
23167 jghali 880
        name = "toolsPDFRadioButton";
23054 craig 881
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/radiobutton.png"), im.loadPixmap("22/radiobutton.png"), "", defaultKey(name), mainWindow, modeInsertPDFRadioButton));
23167 jghali 882
        name = "toolsPDFTextField";
23054 craig 883
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/text-field.png"), im.loadPixmap("22/text-field.png"), "", defaultKey(name), mainWindow, modeInsertPDFTextfield));
23167 jghali 884
        name = "toolsPDFCheckBox";
23054 craig 885
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/checkbox.png"), im.loadPixmap("22/checkbox.png"), "", defaultKey(name), mainWindow, modeInsertPDFCheckbox));
23167 jghali 886
        name = "toolsPDFComboBox";
23054 craig 887
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/combobox.png"), im.loadPixmap("22/combobox.png"), "", defaultKey(name), mainWindow, modeInsertPDFCombobox));
23167 jghali 888
        name = "toolsPDFListBox";
23054 craig 889
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/list-box.png"), im.loadPixmap("22/list-box.png"), "", defaultKey(name), mainWindow, modeInsertPDFListbox));
23167 jghali 890
        name = "toolsPDFAnnotText";
23054 craig 891
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/pdf-annotations.png"), im.loadPixmap("22/pdf-annotations.png"), "", defaultKey(name), mainWindow, modeInsertPDFTextAnnotation));
23167 jghali 892
        name = "toolsPDFAnnotLink";
23054 craig 893
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("goto16.png"), im.loadPixmap("goto.png"), "", defaultKey(name), mainWindow, modeInsertPDFLinkAnnotation));
13839 fschmid 894
#ifdef HAVE_OSG
23167 jghali 895
        name = "toolsPDFAnnot3D";
23054 craig 896
        scrActions->insert(name, new ScrAction(ScrAction::DataInt, im.loadPixmap("16/annot3d.png"), im.loadPixmap("22/annot3d.png"), "", defaultKey(name), mainWindow, modeInsertPDF3DAnnotation));
13839 fschmid 897
#endif
10181 cbradney 898
        //Set the applicaton wide palette shortcuts
899
        (*scrActions)["toolsProperties"]->setShortcutContext(Qt::ApplicationShortcut);
21575 craig 900
        (*scrActions)["toolsText"]->setShortcutContext(Qt::ApplicationShortcut);
10181 cbradney 901
        (*scrActions)["toolsScrapbook"]->setShortcutContext(Qt::ApplicationShortcut);
902
        (*scrActions)["toolsLayers"]->setShortcutContext(Qt::ApplicationShortcut);
903
        (*scrActions)["toolsPages"]->setShortcutContext(Qt::ApplicationShortcut);
904
        (*scrActions)["toolsBookmarks"]->setShortcutContext(Qt::ApplicationShortcut);
19783 craig 905
        (*scrActions)["toolsDownloads"]->setShortcutContext(Qt::ApplicationShortcut);
10181 cbradney 906
        (*scrActions)["toolsActionHistory"]->setShortcutContext(Qt::ApplicationShortcut);
907
        (*scrActions)["toolsPreflightVerifier"]->setShortcutContext(Qt::ApplicationShortcut);
908
        (*scrActions)["toolsAlignDistribute"]->setShortcutContext(Qt::ApplicationShortcut);
15060 fschmid 909
        (*scrActions)["toolsSymbols"]->setShortcutContext(Qt::ApplicationShortcut);
17405 fschmid 910
        (*scrActions)["toolsInline"]->setShortcutContext(Qt::ApplicationShortcut);
10953 subik 911
 
22282 jghali 912
 
1993 cbradney 913
        (*scrActions)["toolsProperties"]->setToggleAction(true);
21575 craig 914
        (*scrActions)["toolsText"]->setToggleAction(true);
1993 cbradney 915
        (*scrActions)["toolsOutline"]->setToggleAction(true);
916
        (*scrActions)["toolsScrapbook"]->setToggleAction(true);
917
        (*scrActions)["toolsLayers"]->setToggleAction(true);
918
        (*scrActions)["toolsPages"]->setToggleAction(true);
919
        (*scrActions)["toolsBookmarks"]->setToggleAction(true);
19783 craig 920
        (*scrActions)["toolsDownloads"]->setToggleAction(true);
1993 cbradney 921
        (*scrActions)["toolsMeasurements"]->setToggleAction(true);
922
        (*scrActions)["toolsActionHistory"]->setToggleAction(true);
923
        (*scrActions)["toolsPreflightVerifier"]->setToggleAction(true);
2355 cbradney 924
        (*scrActions)["toolsAlignDistribute"]->setToggleAction(true);
15060 fschmid 925
        (*scrActions)["toolsSymbols"]->setToggleAction(true);
17405 fschmid 926
        (*scrActions)["toolsInline"]->setToggleAction(true);
1993 cbradney 927
        (*scrActions)["toolsToolbarTools"]->setToggleAction(true);
928
        (*scrActions)["toolsToolbarPDF"]->setToggleAction(true);
19009 craig 929
        (*scrActions)["toolsToolbarView"]->setToggleAction(true);
2246 subik 930
 
17317 fschmid 931
        *modeActionNames << "toolsSelect" << "toolsInsertTextFrame" << "toolsInsertImageFrame" << "toolsInsertTable";
16311 fschmid 932
        *modeActionNames << "toolsInsertShape" << "toolsInsertPolygon" << "toolsInsertArc" << "toolsInsertSpiral" << "toolsInsertLine" << "toolsInsertBezier";
15847 fschmid 933
        *modeActionNames << "toolsInsertFreehandLine" << "toolsInsertCalligraphicLine" << "toolsInsertRenderFrame" << "toolsRotate" << "toolsZoom" << "toolsEditContents";
21468 jghali 934
        *modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame"; //<< "toolsUnlinkTextFrameAndCutText";
1993 cbradney 935
        *modeActionNames << "toolsEyeDropper" << "toolsCopyProperties";
17952 fschmid 936
        *modeActionNames << "toolsPDFPushButton" << "toolsPDFRadioButton" << "toolsPDFTextField" << "toolsPDFCheckBox" << "toolsPDFComboBox" << "toolsPDFListBox" << "toolsPDFAnnotText" << "toolsPDFAnnotLink";
13839 fschmid 937
#ifdef HAVE_OSG
938
        *modeActionNames << "toolsPDFAnnot3D";
939
#endif
22553 craig 940
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
11791 cbradney 941
        {
5357 cbradney 942
                (*scrActions)[*it]->setEnabled(false);
11791 cbradney 943
                (*scrActions)[*it]->setToggleAction(true);
944
        }
5357 cbradney 945
 
946
 
2104 cbradney 947
        *nonEditActionNames << "itemLowerToBottom" << "itemRaiseToTop" << "itemRaise" << "itemLower";
2246 subik 948
 
5243 cbradney 949
        connect( (*scrActions)["toolsActionHistory"], SIGNAL(toggled(bool)), mainWindow, SLOT(setUndoPalette(bool)) );
19821 craig 950
        connect( (*scrActions)["toolsResources"], SIGNAL(triggered()), mainWindow, SLOT(slotResourceManager()) );
1993 cbradney 951
        connectModeActions();
952
}
953
 
954
void ActionManager::initExtrasMenuActions()
955
{
5243 cbradney 956
        QString name;
23167 jghali 957
        name = "extrasManageImages";
11765 cbradney 958
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 959
        name = "extrasHyphenateText";
11765 cbradney 960
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 961
        name = "extrasDeHyphenateText";
11765 cbradney 962
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 963
        name = "extrasGenerateTableOfContents";
11765 cbradney 964
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 965
        name = "extrasUpdateDocument";
18047 craig 966
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
11439 cbradney 967
        connect( (*scrActions)["extrasManageImages"], SIGNAL(triggered()), mainWindow, SLOT(StatusPic()) );
10725 jghali 968
        connect( (*scrActions)["extrasGenerateTableOfContents"], SIGNAL(triggered()), mainWindow, SLOT(generateTableOfContents()) );
18047 craig 969
        connect( (*scrActions)["extrasUpdateDocument"], SIGNAL(triggered()), mainWindow, SLOT(updateDocument()) );
1993 cbradney 970
}
971
 
972
 
973
void ActionManager::initWindowsMenuActions()
974
{
5243 cbradney 975
        QString name;
23167 jghali 976
        name = "windowsCascade";
11765 cbradney 977
        scrActions->insert(name, new ScrAction( "", defaultKey(name), mainWindow));
23167 jghali 978
        name = "windowsTile";
11765 cbradney 979
        scrActions->insert(name, new ScrAction( "", defaultKey(name), mainWindow));
1993 cbradney 980
}
981
 
982
void ActionManager::initScriptMenuActions()
983
{
984
}
985
 
986
void ActionManager::initHelpMenuActions()
987
{
5243 cbradney 988
        QString name;
23167 jghali 989
        name = "helpAboutScribus";
11765 cbradney 990
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
11165 avox 991
        (*scrActions)[name]->setMenuRole(QAction::AboutRole);
23167 jghali 992
        name = "helpAboutPlugins";
11765 cbradney 993
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
11158 avox 994
        (*scrActions)[name]->setMenuRole(QAction::ApplicationSpecificRole);
23167 jghali 995
        name = "helpAboutQt";
11765 cbradney 996
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
11158 avox 997
        (*scrActions)[name]->setMenuRole(QAction::AboutQtRole);
23167 jghali 998
        name = "helpActionSearch";
23088 jghali 999
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 1000
        name = "helpTooltips";
11765 cbradney 1001
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 1002
        name = "helpManual";
23054 craig 1003
        scrActions->insert(name, new ScrAction(im.loadPixmap("16/help-browser.png"), QPixmap(), "", defaultKey(name), mainWindow));
23167 jghali 1004
        name = "helpOnlineWWW";
19100 craig 1005
        scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, "http://www.scribus.net"));
23167 jghali 1006
        name = "helpOnlineDocs";
19100 craig 1007
        scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, "http://docs.scribus.net"));
23167 jghali 1008
        name = "helpOnlineWiki";
19100 craig 1009
        scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, "http://wiki.scribus.net"));
23167 jghali 1010
        name = "helpOnlineTutorial1";
19100 craig 1011
        scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, ""));
23167 jghali 1012
        name = "helpChat";
20510 craig 1013
        scrActions->insert(name, new ScrAction(ScrAction::DataQString, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, "http://webchat.freenode.net/?channels=scribus"));
23167 jghali 1014
        name = "helpCheckUpdates";
11765 cbradney 1015
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1993 cbradney 1016
 
1017
        (*scrActions)["helpTooltips"]->setToggleAction(true);
10427 cbradney 1018
        (*scrActions)["helpTooltips"]->setChecked(true);
1993 cbradney 1019
 
10725 jghali 1020
        connect( (*scrActions)["helpAboutScribus"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpAbout()) );
1021
        connect( (*scrActions)["helpAboutPlugins"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpAboutPlugins()) );
1022
        connect( (*scrActions)["helpAboutQt"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpAboutQt()) );
23088 jghali 1023
        connect( (*scrActions)["helpActionSearch"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpActionSearch()) );
10725 jghali 1024
        connect( (*scrActions)["helpTooltips"], SIGNAL(triggered()), mainWindow, SLOT(ToggleTips()) );
1025
        connect( (*scrActions)["helpManual"], SIGNAL(triggered()), mainWindow, SLOT(slotOnlineHelp()) );
10913 jghali 1026
        connect( (*scrActions)["helpCheckUpdates"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpCheckUpdates()) );
23051 craig 1027
        UrlLauncher& ul=UrlLauncher::instance();
1028
        connect( (*scrActions)["helpOnlineWWW"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1029
        connect( (*scrActions)["helpOnlineDocs"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1030
        connect( (*scrActions)["helpOnlineWiki"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1031
        connect( (*scrActions)["helpOnlineTutorial1"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1032
        connect( (*scrActions)["helpChat"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1993 cbradney 1033
}
1034
 
8501 cbradney 1035
void ActionManager::initUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap, QWidget *actionParent, QStringList *actionNamesList)
1993 cbradney 1036
{
5243 cbradney 1037
        QString name;
1993 cbradney 1038
        //typography
23167 jghali 1039
        name = "unicodeZWNJ";
21563 jghali 1040
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWNJ.unicode()));
23167 jghali 1041
        name = "unicodeZWJ";
21563 jghali 1042
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWJ.unicode()));
23167 jghali 1043
        name = "unicodeSoftHyphen";
19100 craig 1044
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::SHYPHEN.unicode()));
23167 jghali 1045
        name = "unicodeNonBreakingHyphen";
19100 craig 1046
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBHYPHEN.unicode()));
23167 jghali 1047
        name = "unicodeNonBreakingSpace";
19100 craig 1048
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBSPACE.unicode()));
23167 jghali 1049
        name = "unicodePageNumber";
19100 craig 1050
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGENUMBER.unicode()));
23167 jghali 1051
        name = "unicodePageCount";
19100 craig 1052
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGECOUNT.unicode()));
4720 cbradney 1053
        //Spaces
23167 jghali 1054
        name = "unicodeSpaceEN";
19100 craig 1055
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2002));
23167 jghali 1056
        name = "unicodeSpaceEM";
19100 craig 1057
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2003));
23167 jghali 1058
        name = "unicodeSpaceThin";
19100 craig 1059
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2009));
23167 jghali 1060
        name = "unicodeSpaceThick";
19100 craig 1061
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2004));
23167 jghali 1062
        name = "unicodeSpaceMid";
19100 craig 1063
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2005));
23167 jghali 1064
        name = "unicodeSpaceHair";
19100 craig 1065
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x200A));
4564 cbradney 1066
        //Breaks
23167 jghali 1067
        name = "unicodeNewLine";
19100 craig 1068
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::LINEBREAK.unicode()));
23167 jghali 1069
        name = "unicodeFrameBreak";
19100 craig 1070
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::FRAMEBREAK.unicode()));
23167 jghali 1071
        name = "unicodeColumnBreak";
19100 craig 1072
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::COLBREAK.unicode()));
23167 jghali 1073
        name = "unicodeZerowidthSpace";
19100 craig 1074
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWSPACE.unicode()));
23167 jghali 1075
        name = "unicodeZerowidthNonBreakingSpace";
19100 craig 1076
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWNBSPACE.unicode()));
4564 cbradney 1077
        //Special
23167 jghali 1078
        name = "unicodeCopyRight";
19100 craig 1079
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0A9));
23167 jghali 1080
        name = "unicodeRegdTM";
19100 craig 1081
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AE));
23167 jghali 1082
        name = "unicodeTM";
19100 craig 1083
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2122));
23167 jghali 1084
        name = "unicodeBullet";
19100 craig 1085
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2022));
23167 jghali 1086
        name = "unicodeMidpoint";
19100 craig 1087
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00B7));
23167 jghali 1088
        name = "unicodeSolidus";
19100 craig 1089
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2044));
4564 cbradney 1090
        //Dashes
23167 jghali 1091
        name = "unicodeDashEm";
19100 craig 1092
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2014));
23167 jghali 1093
        name = "unicodeDashEn";
19100 craig 1094
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2013));
23167 jghali 1095
        name = "unicodeDashFigure";
19100 craig 1096
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2012));
23167 jghali 1097
        name = "unicodeDashQuotation";
19100 craig 1098
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2015));
4564 cbradney 1099
        //Quotes
23167 jghali 1100
        name = "unicodeQuoteApostrophe";
19100 craig 1101
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0027));
23167 jghali 1102
        name = "unicodeQuoteStraight";
19100 craig 1103
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0022));
23167 jghali 1104
        name = "unicodeQuoteSingleLeft";
19100 craig 1105
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2018));
23167 jghali 1106
        name = "unicodeQuoteSingleRight";
19100 craig 1107
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2019));
23167 jghali 1108
        name = "unicodeQuoteDoubleLeft";
19100 craig 1109
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201C));
23167 jghali 1110
        name = "unicodeQuoteDoubleRight";
19100 craig 1111
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201D));
23167 jghali 1112
        name = "unicodeQuoteSingleReversed";
19100 craig 1113
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201B));
23167 jghali 1114
        name = "unicodeQuoteDoubleReversed";
19100 craig 1115
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201F));
23167 jghali 1116
        name = "unicodeQuoteSingleLeftGuillemet";
19100 craig 1117
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2039));
23167 jghali 1118
        name = "unicodeQuoteSingleRightGuillemet";
19100 craig 1119
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x203A));
23167 jghali 1120
        name = "unicodeQuoteDoubleLeftGuillemet";
19100 craig 1121
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AB));
23167 jghali 1122
        name = "unicodeQuoteDoubleRightGuillemet";
19100 craig 1123
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00BB));
23167 jghali 1124
        name = "unicodeQuoteLowSingleComma";
19100 craig 1125
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201A));
23167 jghali 1126
        name = "unicodeQuoteLowDoubleComma";
19100 craig 1127
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201E));
23167 jghali 1128
        name = "unicodeQuoteCJKSingleLeft";
19100 craig 1129
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300C));
23167 jghali 1130
        name = "unicodeQuoteCJKSingleRight";
19100 craig 1131
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300D));
23167 jghali 1132
        name = "unicodeQuoteCJKDoubleLeft";
19100 craig 1133
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300E));
23167 jghali 1134
        name = "unicodeQuoteCJKDoubleRight";
19100 craig 1135
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300F));
4564 cbradney 1136
        //Ligatures
23167 jghali 1137
        name = "unicodeLigature_ff";
19100 craig 1138
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB00));
23167 jghali 1139
        name = "unicodeLigature_fi";
19100 craig 1140
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB01));
23167 jghali 1141
        name = "unicodeLigature_fl";
19100 craig 1142
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB02));
23167 jghali 1143
        name = "unicodeLigature_ffi";
19100 craig 1144
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB03));
23167 jghali 1145
        name = "unicodeLigature_ffl";
19100 craig 1146
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB04));
23167 jghali 1147
        name = "unicodeLigature_ft";
19100 craig 1148
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB05));
23167 jghali 1149
        name = "unicodeLigature_st";
19100 craig 1150
        actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB06));
7087 subik 1151
 
2391 cbradney 1152
        //Spaces and special characters
7087 subik 1153
 
21563 jghali 1154
        *actionNamesList << "unicodeZWNJ" << "unicodeZWJ";
15009 jghali 1155
        *actionNamesList << "unicodeSoftHyphen" << "unicodeNonBreakingHyphen" << "unicodeNonBreakingSpace" << "unicodePageNumber" << "unicodePageCount";
4720 cbradney 1156
        *actionNamesList << "unicodeSpaceEN" << "unicodeSpaceEM" << "unicodeSpaceThin" << "unicodeSpaceThick" << "unicodeSpaceMid" << "unicodeSpaceHair";
2391 cbradney 1157
        //Breaks
7038 avox 1158
        *actionNamesList << "unicodeNewLine" << "unicodeFrameBreak" << "unicodeColumnBreak" << "unicodeZerowidthSpace";
2391 cbradney 1159
        //Copyrights and TMs
4564 cbradney 1160
        *actionNamesList << "unicodeCopyRight" << "unicodeRegdTM" << "unicodeTM";
4720 cbradney 1161
        //Slashes
1162
        *actionNamesList << "unicodeSolidus";
2391 cbradney 1163
        //Bullets
4720 cbradney 1164
        *actionNamesList << "unicodeBullet" << "unicodeMidpoint";
2391 cbradney 1165
        //Dashes
4564 cbradney 1166
        *actionNamesList << "unicodeDashEm" << "unicodeDashEn" << "unicodeDashFigure" << "unicodeDashQuotation";
2391 cbradney 1167
        //Straight quotes
4564 cbradney 1168
        *actionNamesList << "unicodeQuoteApostrophe" << "unicodeQuoteStraight";
2391 cbradney 1169
        //Double quotes
4564 cbradney 1170
        *actionNamesList << "unicodeQuoteDoubleLeft" << "unicodeQuoteDoubleRight" << "unicodeQuoteSingleLeft" << "unicodeQuoteSingleRight";
5261 cbradney 1171
        //Alternative single quotes
4564 cbradney 1172
        *actionNamesList << "unicodeQuoteSingleReversed" << "unicodeQuoteDoubleReversed";
2391 cbradney 1173
        //French quotes
4564 cbradney 1174
        *actionNamesList << "unicodeQuoteSingleLeftGuillemet" << "unicodeQuoteSingleRightGuillemet" << "unicodeQuoteDoubleLeftGuillemet" << "unicodeQuoteDoubleRightGuillemet";
2391 cbradney 1175
        //German quotes
4564 cbradney 1176
        *actionNamesList << "unicodeQuoteLowSingleComma" << "unicodeQuoteLowDoubleComma";
2391 cbradney 1177
        //CJK Quotes
4564 cbradney 1178
        *actionNamesList << "unicodeQuoteCJKSingleLeft" << "unicodeQuoteCJKSingleRight" << "unicodeQuoteCJKDoubleLeft" << "unicodeQuoteCJKDoubleRight";
1179
        //Ligatures
1180
        *actionNamesList << "unicodeLigature_ff" << "unicodeLigature_fi" << "unicodeLigature_fl" << "unicodeLigature_ffi" << "unicodeLigature_ffl" << "unicodeLigature_ft" << "unicodeLigature_st";
4557 cbradney 1181
        for ( QStringList::Iterator it = actionNamesList->begin(); it != actionNamesList->end(); ++it )
19100 craig 1182
                connect( (*actionMap)[*it], SIGNAL(triggeredUnicodeShortcut(int)), actionParent, SLOT(specialActionKeyEvent(int)) );
4557 cbradney 1183
}
1993 cbradney 1184
 
4557 cbradney 1185
void ActionManager::initSpecialActions()
1186
{
5243 cbradney 1187
        QString name;
1993 cbradney 1188
        //GUI
23167 jghali 1189
        name = "specialToggleAllPalettes";
15302 cbradney 1190
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 1191
        name = "specialToggleAllGuides";
15302 cbradney 1192
        scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
23167 jghali 1193
        name = "specialUnicodeSequenceBegin";
11765 cbradney 1194
        scrActions->insert(name, new ScrAction( "", defaultKey(name), mainWindow));
10725 jghali 1195
        connect( (*scrActions)["specialToggleAllPalettes"], SIGNAL(triggered()), mainWindow, SLOT(ToggleAllPalettes()) );
1196
        connect( (*scrActions)["specialToggleAllGuides"], SIGNAL(triggered()), mainWindow, SLOT(ToggleAllGuides()) );
1993 cbradney 1197
}
1198
 
17723 craig 1199
void ActionManager::setActionTooltips(QMap<QString, QPointer<ScrAction> > *actionMap)
1200
{
1201
        for( QMap<QString, QPointer<ScrAction> >::Iterator it = actionMap->begin(); it!=actionMap->end(); ++it )
1202
                it.value()->setToolTipFromTextAndShortcut();
1203
}
1204
 
1993 cbradney 1205
void ActionManager::disconnectModeActions()
1206
{
1207
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
22289 craig 1208
                disconnect( (*scrActions)[*it], SIGNAL(toggledData(bool,int)) , mainWindow, SLOT(setAppModeByToggle(bool,int)) );
1993 cbradney 1209
}
2246 subik 1210
 
1993 cbradney 1211
void ActionManager::connectModeActions()
1212
{
1213
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
22289 craig 1214
                connect( (*scrActions)[*it], SIGNAL(toggledData(bool,int)) , mainWindow, SLOT(setAppModeByToggle(bool,int)) );
1993 cbradney 1215
}
1216
 
4688 cbradney 1217
void ActionManager::disconnectNewDocActions()
1218
{
22553 craig 1219
        (*scrActions)["tableInsertRows"]->disconnect();
1220
        (*scrActions)["tableInsertColumns"]->disconnect();
1221
        (*scrActions)["tableDeleteRows"]->disconnect();
1222
        (*scrActions)["tableDeleteColumns"]->disconnect();
1223
        (*scrActions)["tableMergeCells"]->disconnect();
1224
        (*scrActions)["tableSplitCells"]->disconnect();
1225
        (*scrActions)["tableSetRowHeights"]->disconnect();
1226
        (*scrActions)["tableSetColumnWidths"]->disconnect();
1227
        (*scrActions)["tableDistributeRowsEvenly"]->disconnect();
1228
        (*scrActions)["tableDistributeColumnsEvenly"]->disconnect();
1229
        (*scrActions)["tableAdjustFrameToTable"]->disconnect();
1230
        (*scrActions)["tableAdjustTableToFrame"]->disconnect();
1231
        (*scrActions)["itemAdjustFrameHeightToText"]->disconnect();
1232
        (*scrActions)["itemAdjustFrameToImage"]->disconnect();
1233
        (*scrActions)["itemAdjustImageToFrame"]->disconnect();
1234
        (*scrActions)["itemLock"]->disconnect();
1235
        (*scrActions)["itemLockSize"]->disconnect();
1236
        (*scrActions)["itemPrintingEnabled"]->disconnect();
1237
        (*scrActions)["itemFlipH"]->disconnect();
1238
        (*scrActions)["itemFlipV"]->disconnect();
1239
        (*scrActions)["itemCombinePolygons"]->disconnect();
1240
        (*scrActions)["itemSplitPolygons"]->disconnect();
1241
        (*scrActions)["itemUpdateImage"]->disconnect();
1242
        (*scrActions)["itemDelete"]->disconnect();
1243
        (*scrActions)["extrasHyphenateText"]->disconnect();
1244
        (*scrActions)["extrasDeHyphenateText"]->disconnect();
1245
        (*scrActions)["itemsUnWeld"]->disconnect();
1246
        (*scrActions)["itemWeld"]->disconnect();
1247
        (*scrActions)["itemEditWeld"]->disconnect();
1248
        (*scrActions)["itemLowerToBottom"]->disconnect();
1249
        (*scrActions)["itemRaiseToTop"]->disconnect();
1250
        (*scrActions)["itemLower"]->disconnect();
1251
        (*scrActions)["itemRaise"]->disconnect();
1252
        (*scrActions)["toolsUnlinkTextFrameAndCutText"]->disconnect();
4688 cbradney 1253
}
1254
 
1255
void ActionManager::connectNewDocActions(ScribusDoc *currDoc)
1256
{
22518 craig 1257
        if (currDoc==nullptr)
4688 cbradney 1258
                return;
10725 jghali 1259
        connect( (*scrActions)["itemLock"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_ToggleLock()) );
1260
        connect( (*scrActions)["itemLockSize"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_ToggleSizeLock()));
1261
        connect( (*scrActions)["itemPrintingEnabled"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_TogglePrintEnabled()));
1262
        connect( (*scrActions)["itemFlipH"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_FlipH()));
1263
        connect( (*scrActions)["itemFlipV"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_FlipV()));
1264
        connect( (*scrActions)["itemCombinePolygons"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UniteItems()) );
1265
        connect( (*scrActions)["itemSplitPolygons"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SplitItems()) );
1266
        connect( (*scrActions)["itemUpdateImage"], SIGNAL(triggered()), currDoc, SLOT(updatePic()) );
1267
        connect( (*scrActions)["extrasHyphenateText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DoHyphenate()) );
1268
        connect( (*scrActions)["extrasDeHyphenateText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DoDeHyphenate()) );
1269
        connect( (*scrActions)["itemDelete"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DeleteItem()) );
16856 craig 1270
        connect( (*scrActions)["tableInsertRows"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_InsertTableRows()));
1271
        connect( (*scrActions)["tableInsertColumns"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_InsertTableColumns()));
1272
        connect( (*scrActions)["tableDeleteRows"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DeleteTableRows()));
1273
        connect( (*scrActions)["tableDeleteColumns"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DeleteTableColumns()));
1274
        connect( (*scrActions)["tableMergeCells"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_MergeTableCells()));
1275
        connect( (*scrActions)["tableSplitCells"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SplitTableCells()));
1276
        connect( (*scrActions)["tableSetRowHeights"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SetTableRowHeights()));
1277
        connect( (*scrActions)["tableSetColumnWidths"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SetTableColumnWidths()));
1278
        connect( (*scrActions)["tableDistributeRowsEvenly"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DistributeTableRowsEvenly()));
1279
        connect( (*scrActions)["tableDistributeColumnsEvenly"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DistributeTableColumnsEvenly()));
1280
        connect( (*scrActions)["tableAdjustFrameToTable"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustFrameToTable()));
1281
        connect( (*scrActions)["tableAdjustTableToFrame"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustTableToFrame()));
17595 craig 1282
        connect( (*scrActions)["itemAdjustFrameHeightToText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustFrameHeightToText()) );
12420 cbradney 1283
        connect( (*scrActions)["itemAdjustFrameToImage"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustFrametoImageSize()) );
12591 fschmid 1284
        connect( (*scrActions)["itemAdjustImageToFrame"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustImagetoFrameSize()) );
16926 fschmid 1285
        connect( (*scrActions)["itemsUnWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnWeld()) );
1286
        connect( (*scrActions)["itemWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_Weld()) );
16944 fschmid 1287
        connect( (*scrActions)["itemEditWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_EditWeld()) );
17062 fschmid 1288
        connect( (*scrActions)["itemLowerToBottom"], SIGNAL(triggered()), currDoc, SLOT(sendItemSelectionToBack()) );
1289
        connect( (*scrActions)["itemRaiseToTop"], SIGNAL(triggered()), currDoc, SLOT(bringItemSelectionToFront()) );
1290
        connect( (*scrActions)["itemLower"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_LowerItem()) );
1291
        connect( (*scrActions)["itemRaise"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_RaiseItem()) );
21468 jghali 1292
        connect( (*scrActions)["toolsUnlinkTextFrameAndCutText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnlinkTextFrameAndCutText()) );
4688 cbradney 1293
}
1294
 
2026 cbradney 1295
void ActionManager::disconnectNewViewActions()
1296
{
19009 craig 1297
        //qDebug()<<"disconnectNewViewActions"<<mainWindow->doc->DocName;
22553 craig 1298
        (*scrActions)["viewPreviewMode"]->disconnect();
1299
        (*scrActions)["viewEditInPreview"]->disconnect();
1300
        (*scrActions)["viewToggleCMS"]->disconnect();
1301
        (*scrActions)["toolsZoomIn"]->disconnect();
1302
        (*scrActions)["toolsZoomOut"]->disconnect();
1303
        (*scrActions)["itemImageIsVisible"]->disconnect();
1304
        (*scrActions)["itemPreviewFull"]->disconnect(SIGNAL(triggeredData(int)));
1305
        (*scrActions)["itemPreviewNormal"]->disconnect(SIGNAL(triggeredData(int)));
1306
        (*scrActions)["itemPreviewLow"]->disconnect(SIGNAL(triggeredData(int)));
1307
        (*scrActions)["itemConvertToBezierCurve"]->disconnect();
1308
        (*scrActions)["itemConvertToImageFrame"]->disconnect();
1309
        (*scrActions)["itemConvertToOutlines"]->disconnect();
1310
        (*scrActions)["itemConvertToPolygon"]->disconnect();
1311
        (*scrActions)["itemConvertToTextFrame"]->disconnect();
1312
        (*scrActions)["itemAttachTextToPath"]->disconnect();
1313
        (*scrActions)["itemDetachTextFromPath"]->disconnect();
1314
        (*scrActions)["itemExtendedImageProperties"]->disconnect();
2026 cbradney 1315
}
2246 subik 1316
 
2026 cbradney 1317
void ActionManager::connectNewViewActions(ScribusView *currView)
1318
{
22518 craig 1319
        if (currView==nullptr)
2026 cbradney 1320
                return;
19009 craig 1321
        //qDebug()<<"connectNewViewActions"<<currView->Doc->DocName;
1322
        connect( (*scrActions)["viewPreviewMode"], SIGNAL(toggled(bool)), currView, SLOT(togglePreview(bool)) );
1323
        connect( (*scrActions)["viewEditInPreview"], SIGNAL(toggled(bool)), currView, SLOT(togglePreviewEdit(bool)) );
1324
        connect( (*scrActions)["viewToggleCMS"], SIGNAL(toggled(bool)), currView, SLOT(toggleCMS(bool)));
10725 jghali 1325
        connect( (*scrActions)["toolsZoomIn"], SIGNAL(triggered()) , currView, SLOT(slotZoomIn()) );
1326
        connect( (*scrActions)["toolsZoomOut"], SIGNAL(triggered()) , currView, SLOT(slotZoomOut()) );
1327
        connect( (*scrActions)["itemConvertToBezierCurve"], SIGNAL(triggered()), currView, SLOT(ToBezierFrame()) );
1328
        connect( (*scrActions)["itemConvertToImageFrame"], SIGNAL(triggered()), currView, SLOT(ToPicFrame()) );
1329
        connect( (*scrActions)["itemConvertToOutlines"], SIGNAL(triggered()), currView, SLOT(TextToPath()) );
1330
        connect( (*scrActions)["itemConvertToPolygon"], SIGNAL(triggered()), currView, SLOT(ToPolyFrame()) );
1331
        connect( (*scrActions)["itemConvertToTextFrame"], SIGNAL(triggered()), currView, SLOT(ToTextFrame()) );
1332
        connect( (*scrActions)["itemAttachTextToPath"], SIGNAL(triggered()), currView, SLOT(ToPathText()) );
1333
        connect( (*scrActions)["itemDetachTextFromPath"], SIGNAL(triggered()), currView, SLOT(FromPathText()) );
1334
        connect( (*scrActions)["itemExtendedImageProperties"], SIGNAL(triggered()), currView, SLOT(editExtendedImageProperties()) );
2026 cbradney 1335
}
1336
 
1337
void ActionManager::disconnectNewSelectionActions()
1338
{
22553 craig 1339
        (*scrActions)["itemImageIsVisible"]->disconnect();
10728 cbradney 1340
        //Only disconnect triggeredData for data based actions or you will disconnect the internal signal
22553 craig 1341
        (*scrActions)["itemPreviewFull"]->disconnect(SIGNAL(triggeredData(int)));
1342
        (*scrActions)["itemPreviewNormal"]->disconnect(SIGNAL(triggeredData(int)));
1343
        (*scrActions)["itemPreviewLow"]->disconnect(SIGNAL(triggeredData(int)));
1344
        (*scrActions)["editClearContents"]->disconnect();
1345
        (*scrActions)["editTruncateContents"]->disconnect();
2026 cbradney 1346
}
1347
 
5784 jghali 1348
void ActionManager::connectNewSelectionActions(ScribusView* /*currView*/, ScribusDoc* currDoc)
2026 cbradney 1349
{
4705 cbradney 1350
        connect( (*scrActions)["itemImageIsVisible"], SIGNAL(toggled(bool)), currDoc, SLOT(itemSelection_ToggleImageShown()) );
19465 jghali 1351
        connect( (*scrActions)["itemPreviewFull"], SIGNAL(triggeredData(int)), currDoc, SLOT(itemSelection_ChangePreviewResolution(int)) );
1352
        connect( (*scrActions)["itemPreviewNormal"], SIGNAL(triggeredData(int)), currDoc, SLOT(itemSelection_ChangePreviewResolution(int)) );
10728 cbradney 1353
        connect( (*scrActions)["itemPreviewLow"], SIGNAL(triggeredData(int)), currDoc, SLOT(itemSelection_ChangePreviewResolution(int)) );
10725 jghali 1354
        connect( (*scrActions)["editClearContents"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_ClearItem()) );
19188 craig 1355
        connect( (*scrActions)["editTruncateContents"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_TruncateItem()) );
2026 cbradney 1356
}
2246 subik 1357
 
1993 cbradney 1358
void ActionManager::saveActionShortcutsPreEditMode()
1359
{
1360
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
11158 avox 1361
        {
1362
                (*scrActions)[*it]->setShortcutContext(Qt::WidgetShortcut);  // in theory, this should be enough, but...
1993 cbradney 1363
                (*scrActions)[*it]->saveShortcut();
18204 fschmid 1364
#ifdef Q_OS_MAC
22518 craig 1365
                if ((*scrActions)[*it]->menu() != nullptr)
11158 avox 1366
                        (*scrActions)[*it]->setEnabled(false);
1367
#endif          
1368
        }
1993 cbradney 1369
        for ( QStringList::Iterator it = nonEditActionNames->begin(); it != nonEditActionNames->end(); ++it )
11158 avox 1370
        {
1371
                (*scrActions)[*it]->setShortcutContext(Qt::WidgetShortcut);  // in theory, this should be enough, but...
2246 subik 1372
                (*scrActions)[*it]->saveShortcut();
11158 avox 1373
        }
1993 cbradney 1374
}
1375
 
1376
void ActionManager::restoreActionShortcutsPostEditMode()
1377
{
1378
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
11158 avox 1379
        {
1380
                (*scrActions)[*it]->setShortcutContext(Qt::WindowShortcut);  // see above
1993 cbradney 1381
                (*scrActions)[*it]->restoreShortcut();
18204 fschmid 1382
#ifdef Q_OS_MAC
11158 avox 1383
                (*scrActions)[*it]->setEnabled(true);
1384
#endif          
1385
        }
1993 cbradney 1386
        for ( QStringList::Iterator it = nonEditActionNames->begin(); it != nonEditActionNames->end(); ++it )
11158 avox 1387
        {
1388
                (*scrActions)[*it]->setShortcutContext(Qt::WindowShortcut);  // see above
2246 subik 1389
                (*scrActions)[*it]->restoreShortcut();
11158 avox 1390
        }
1993 cbradney 1391
}
1392
 
8501 cbradney 1393
void ActionManager::enableActionStringList(QMap<QString, QPointer<ScrAction> > *actionMap, QStringList *list, bool enabled, bool checkingUnicode, const QString& fontName)
1993 cbradney 1394
{
22721 jghali 1395
        for (QStringList::Iterator it = list->begin(); it != list->end(); ++it)
1993 cbradney 1396
        {
22721 jghali 1397
                if (!checkingUnicode)
4881 cbradney 1398
                        (*actionMap)[*it]->setEnabled(enabled);
1993 cbradney 1399
                else
1400
                {
1401
                        //For UnicodeChar actions, only enable when the current font has that character.
5243 cbradney 1402
                        if (mainWindow->HaveDoc && (*actionMap)[*it]->actionType()==ScrAction::UnicodeChar)
1993 cbradney 1403
                        {
4881 cbradney 1404
                                int charCode=(*actionMap)[*it]->actionInt();
22721 jghali 1405
                                if (charCode==-1 ||
11713 fschmid 1406
                                        charCode==23 ||
4881 cbradney 1407
                                        charCode==24 ||
1408
                                        charCode==26 ||
1409
                                        charCode==27 ||
1410
                                        charCode==28 ||
1411
                                        charCode==29 ||
1412
                                        charCode==30 ||
7087 subik 1413
                                        ((*mainWindow->doc->AllFonts)[fontName].usable() &&
5980 avox 1414
                                        (*mainWindow->doc->AllFonts)[fontName].canRender(charCode)) )
4881 cbradney 1415
                                                (*actionMap)[*it]->setEnabled(true);
1416
                                else
1417
                                        (*actionMap)[*it]->setEnabled(false);
1993 cbradney 1418
                        }
1419
                }
1420
        }
1421
}
1995 cbradney 1422
 
8501 cbradney 1423
void ActionManager::enableUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap, bool enabled, const QString& fontName)
1995 cbradney 1424
{
4881 cbradney 1425
        enableActionStringList(actionMap, unicodeCharActionNames, enabled, enabled, fontName);
7201 cbradney 1426
        (*actionMap)["insertGlyph"]->setEnabled(enabled);
1995 cbradney 1427
}
2103 cbradney 1428
 
2108 cbradney 1429
void ActionManager::setPDFActions(ScribusView *currView)
2103 cbradney 1430
{
22518 craig 1431
        if (currView==nullptr)
2103 cbradney 1432
                return;
5243 cbradney 1433
        PageItem* currItem = mainWindow->doc->m_Selection->itemAt(0);
22518 craig 1434
        if (currItem==nullptr)
2103 cbradney 1435
                return;
1436
 
22553 craig 1437
        (*scrActions)["itemPDFIsBookmark"]->disconnect();
1438
        (*scrActions)["itemPDFIsAnnotation"]->disconnect();
2246 subik 1439
 
3625 avox 1440
        if (!currItem->asTextFrame())
2103 cbradney 1441
        {
1442
                (*scrActions)["itemPDFIsAnnotation"]->setEnabled(false);
1443
                (*scrActions)["itemPDFIsBookmark"]->setEnabled(false);
10427 cbradney 1444
                (*scrActions)["itemPDFIsAnnotation"]->setChecked(false);
1445
                (*scrActions)["itemPDFIsBookmark"]->setChecked(false);
2103 cbradney 1446
                (*scrActions)["itemPDFAnnotationProps"]->setEnabled(false);
1447
                (*scrActions)["itemPDFFieldProps"]->setEnabled(false);
1448
                return;
1449
        }
1450
 
1451
        (*scrActions)["itemPDFIsAnnotation"]->setEnabled(true);