Subversion Repositories Scribus

Rev

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