Subversion Repositories Scribus

Rev

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