Subversion Repositories Scribus

Rev

Rev 1995 | Rev 2039 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1993 cbradney 1
/***************************************************************************
2
        begin                : Apr 2005
3
        copyright            : (C) 2005 by Craig Bradney
4
        email                : cbradney@zip.com.au
5
***************************************************************************/
6
 
7
/***************************************************************************
8
*                                                                         *
9
*   ScApp program is free software; you can redistribute it and/or modify  *
10
*   it under the terms of the GNU General Public License as published by  *
11
*   the Free Software Foundation; either version 2 of the License, or     *
12
*   (at your option) any later version.                                   *
13
*                                                                         *
14
***************************************************************************/
15
 
16
#include "actionmanager.h"
17
#include "actionmanager.moc"
18
 
19
#include "scribus.h"
2026 cbradney 20
#include "scribusview.h"
1993 cbradney 21
#include "undomanager.h"
22
 
23
ActionManager::ActionManager ( QObject * parent, const char * name ) : QObject ( parent, name )
24
{
25
        ScApp=(ScribusApp *)parent;
26
        scrActions=&(ScApp->scrActions);
27
        scrActionGroups=&(ScApp->scrActionGroups);
1995 cbradney 28
        modeActionNames=new QStringList();
29
        nonEditActionNames=new QStringList();
30
        unicodeCharActionNames=new QStringList();
1993 cbradney 31
        undoManager = UndoManager::instance();
32
 
33
        createActions();
34
}
35
 
36
void ActionManager::createActions()
37
{
38
        initFileMenuActions();
39
        initEditMenuActions();
40
        initStyleMenuActions();
41
        initItemMenuActions();
42
        initInsertMenuActions();
43
        initPageMenuActions();
44
        initViewMenuActions();
45
        initToolsMenuActions();
46
        initExtrasMenuActions();
47
        initWindowsMenuActions();
48
        initScriptMenuActions();
49
        initHelpMenuActions();
50
        initSpecialActions();
51
}
52
 
53
void ActionManager::initFileMenuActions()
54
{
55
        //File Menu
56
        scrActions->insert("fileNew", new ScrAction(QIconSet(loadIcon("DateiNeu16.png"), loadIcon("DateiNeu.xpm")), tr("&New"), CTRL+Key_N, ScApp, "fileNew"));
57
        scrActions->insert("fileOpen", new ScrAction(QIconSet(loadIcon("DateiOpen16.png"), loadIcon("DateiOpen.xpm")), tr("&Open..."), CTRL+Key_O, ScApp, "fileOpen"));
58
        scrActions->insert("fileClose", new ScrAction(QIconSet(loadIcon("DateiClos16.png"), loadIcon("DateiClose.png")), tr("&Close"), CTRL+Key_W, ScApp, "fileClose"));
59
        scrActions->insert("fileSave", new ScrAction(QIconSet(loadIcon("DateiSave16.png"), loadIcon("DateiSave2.png")), tr("&Save"), CTRL+Key_S, ScApp, "fileSave"));
60
        scrActions->insert("fileSaveAs", new ScrAction(QPixmap(loadIcon("filesaveas.png")), tr("Save &As..."), CTRL+SHIFT+Key_S, ScApp, "fileSaveAs"));
61
        scrActions->insert("fileRevert", new ScrAction(QPixmap(loadIcon("revert.png")), tr("Re&vert to Saved"), QKeySequence(), ScApp, "fileRevert"));
62
        scrActions->insert("fileCollect", new ScrAction(tr("Collect for O&utput..."), QKeySequence(), ScApp, "fileCollect"));
63
        //File Import Menu
64
        scrActions->insert("fileImportText", new ScrAction(tr("Get Text..."), QKeySequence(), ScApp, "fileImportText"));
65
        scrActions->insert("fileImportAppendText", new ScrAction(tr("Append &Text..."), QKeySequence(), ScApp, "fileImportAppendText"));
66
        scrActions->insert("fileImportImage", new ScrAction(tr("Get Image..."), QKeySequence(), ScApp, "fileImportImage"));
67
        scrActions->insert("fileImportPage", new ScrAction(tr("Import Page(s)..."), QKeySequence(), ScApp, "fileImportPage"));
68
 
69
        //File Export Menu
70
        scrActions->insert("fileExportText", new ScrAction(tr("Save &Text..."), QKeySequence(), ScApp, "fileExportText"));
71
        scrActions->insert("fileExportAsEPS", new ScrAction(tr("Save Page as &EPS..."), QKeySequence(), ScApp, "fileExportAsEPS"));
72
        scrActions->insert("fileExportAsPDF", new ScrAction(loadIcon("acrobat.png"), tr("Save as P&DF..."), QKeySequence(), ScApp, "fileExportAsPDF"));
73
        //Rest of File Menu
74
        scrActions->insert("fileDocInfo", new ScrAction(loadIcon("documentinfo.png"), tr("Document &Information..."), CTRL+Key_I, ScApp, "fileDocInfo"));
75
        scrActions->insert("fileDocSetup", new ScrAction(tr("Document &Setup..."), QKeySequence(), ScApp, "fileDocSetup"));
76
        scrActions->insert("filePrint", new ScrAction(QIconSet(loadIcon("DateiPrint16.png"), loadIcon("DateiPrint.xpm")), tr("&Print..."), CTRL+Key_P, ScApp, "filePrint"));
77
        scrActions->insert("fileQuit", new ScrAction(QPixmap(loadIcon("exit.png")), tr("&Quit"), CTRL+Key_Q, ScApp, "fileQuit"));
78
 
79
        //Connect our signals and slots
80
        //File Menu
81
        connect( (*scrActions)["fileNew"], SIGNAL(activated()), ScApp, SLOT(slotFileNew()) );
82
        connect( (*scrActions)["fileOpen"], SIGNAL(activated()), ScApp, SLOT(slotDocOpen()) );
83
        connect( (*scrActions)["fileClose"], SIGNAL(activated()), ScApp, SLOT(slotFileClose()) );
84
        connect( (*scrActions)["filePrint"], SIGNAL(activated()), ScApp, SLOT(slotFilePrint()) );
85
        connect( (*scrActions)["fileSave"], SIGNAL(activated()), ScApp, SLOT(slotFileSave()) );
86
        connect( (*scrActions)["fileSaveAs"], SIGNAL(activated()), ScApp, SLOT(slotFileSaveAs()) );
87
        connect( (*scrActions)["fileDocInfo"], SIGNAL(activated()), ScApp, SLOT(InfoDoc()) );
88
        connect( (*scrActions)["fileDocSetup"], SIGNAL(activated()), ScApp, SLOT(SetupDoc()) );
89
        connect( (*scrActions)["fileRevert"], SIGNAL(activated()), ScApp, SLOT(slotFileRevert()) );
90
        connect( (*scrActions)["fileCollect"], SIGNAL(activated()), ScApp, SLOT(Collect()) );
91
        connect( (*scrActions)["fileQuit"], SIGNAL(activated()), ScApp, SLOT(slotFileQuit()) );
92
        //File Import Menu
93
        connect( (*scrActions)["fileImportText"], SIGNAL(activated()), ScApp, SLOT(slotFileOpen()) );
94
        connect( (*scrActions)["fileImportAppendText"], SIGNAL(activated()), ScApp, SLOT(slotFileAppend()) );
95
        connect( (*scrActions)["fileImportImage"], SIGNAL(activated()), ScApp, SLOT(slotFileOpen()) );
96
        connect( (*scrActions)["fileImportPage"], SIGNAL(activated()), ScApp, SLOT(slotDocMerge()) );
97
        //File Export Menu
98
        connect( (*scrActions)["fileExportText"], SIGNAL(activated()), ScApp, SLOT(SaveText()) );
99
        connect( (*scrActions)["fileExportAsEPS"], SIGNAL(activated()), ScApp, SLOT(SaveAsEps()) );
100
        connect( (*scrActions)["fileExportAsPDF"], SIGNAL(activated()), ScApp, SLOT(SaveAsPDF()) );
101
        //The rest are plugins
102
}
103
 
104
void ActionManager::initEditMenuActions()
105
{
106
        //Edit Menu
107
        scrActions->insert("editUndoAction", new ScrAction(ScrAction::DataInt, QIconSet(loadIcon("u_undo16.png"), loadIcon("u_undo.png")), tr("&Undo"), CTRL+Key_Z, ScApp, "editUndoAction",1));
108
        scrActions->insert("editRedoAction", new ScrAction(ScrAction::DataInt, QIconSet(loadIcon("u_redo16.png"), loadIcon("u_redo.png")), tr("&Redo"), CTRL+SHIFT+Key_Z, ScApp, "editRedoAction", 1));
109
        scrActions->insert("editActionMode", new ScrAction(tr("&Item Action Mode"), QKeySequence(), ScApp, "editActionMode"));
110
        (*scrActions)["editActionMode"]->setToggleAction(true);
111
        scrActions->insert("editCut", new ScrAction(QIconSet(loadIcon("editcut.png"), loadIcon("editcut.png")), tr("Cu&t"), CTRL+Key_X, ScApp, "editCut"));
112
        scrActions->insert("editCopy", new ScrAction(QIconSet(loadIcon("editcopy.png"), loadIcon("editcopy.png")), tr("&Copy"), CTRL+Key_C, ScApp, "editCopy"));
113
        scrActions->insert("editPaste", new ScrAction(QIconSet(loadIcon("editpaste.png"), loadIcon("editpaste.png")), tr("&Paste"), CTRL+Key_V, ScApp, "editPaste"));
114
        scrActions->insert("editClearContents", new ScrAction(QIconSet(loadIcon("editdelete.png"), loadIcon("editdelete.png")), tr("C&lear Contents"), QKeySequence(), ScApp, "editClearContents"));
115
        scrActions->insert("editSelectAll", new ScrAction(tr("Select &All"), CTRL+Key_A, ScApp, "editSelectAll"));
116
        scrActions->insert("editDeselectAll", new ScrAction(tr("&Deselect All"), CTRL+SHIFT+Key_A, ScApp, "editDeselectAll"));
117
        scrActions->insert("editSearchReplace", new ScrAction(QIconSet(loadIcon("find16.png"), loadIcon("find16.png")),  tr("&Search/Replace..."), QKeySequence(CTRL+Key_F), ScApp, "editSearchReplace"));
118
 
119
        scrActions->insert("editColors", new ScrAction(tr("C&olors..."), QKeySequence(), ScApp, "editColors"));
120
        scrActions->insert("editParaStyles", new ScrAction(tr("&Paragraph Styles..."), QKeySequence(), ScApp, "editParaStyles"));
121
        scrActions->insert("editLineStyles", new ScrAction(tr("&Line Styles..."), QKeySequence(), ScApp, "editLineStyles"));
122
        scrActions->insert("editTemplates", new ScrAction(tr("&Templates..."), QKeySequence(), ScApp, "editTemplates"));
123
        scrActions->insert("editJavascripts", new ScrAction(tr("&Javascripts..."), QKeySequence(), ScApp, "editJavascripts"));
124
        scrActions->insert("editPreferences", new ScrAction(tr("P&references..."), QKeySequence(), ScApp, "editPreferences"));
125
 
126
        connect( (*scrActions)["editUndoAction"], SIGNAL(activatedData(int)) , undoManager, SLOT(undo(int)) );
127
        connect( (*scrActions)["editRedoAction"], SIGNAL(activatedData(int)) , undoManager, SLOT(redo(int)) );
128
        connect( (*scrActions)["editActionMode"], SIGNAL(toggled(bool)), ScApp, SLOT(setUndoMode(bool)) );
129
        connect( (*scrActions)["editCut"], SIGNAL(activated()), ScApp, SLOT(slotEditCut()) );
130
        connect( (*scrActions)["editCopy"], SIGNAL(activated()), ScApp, SLOT(slotEditCopy()) );
131
        connect( (*scrActions)["editPaste"], SIGNAL(activated()), ScApp, SLOT(slotEditPaste()) );
132
        connect( (*scrActions)["editClearContents"], SIGNAL(activated()), ScApp, SLOT(clearContents()) );
133
        connect( (*scrActions)["editSelectAll"], SIGNAL(activated()), ScApp, SLOT(SelectAll()) );
134
        connect( (*scrActions)["editDeselectAll"], SIGNAL(activated()), ScApp, SLOT(deselectAll()) );
135
        connect( (*scrActions)["editSearchReplace"], SIGNAL(activated()), ScApp, SLOT(SearchText()) );
136
        connect( (*scrActions)["editColors"], SIGNAL(activated()), ScApp, SLOT(slotEditColors()) );
137
        connect( (*scrActions)["editParaStyles"], SIGNAL(activated()), ScApp, SLOT(slotEditStyles()) );
138
        connect( (*scrActions)["editLineStyles"], SIGNAL(activated()), ScApp, SLOT(slotEditLineStyles()) );
139
        connect( (*scrActions)["editTemplates"], SIGNAL(activated()), ScApp, SLOT(ManageTemp()) );
140
        connect( (*scrActions)["editJavascripts"], SIGNAL(activated()), ScApp, SLOT(ManageJava()) );
141
        connect( (*scrActions)["editPreferences"], SIGNAL(activated()), ScApp, SLOT(slotPrefsOrg()) );
142
}
143
 
144
void ActionManager::initStyleMenuActions()
145
{
146
        //Text Size actions
147
        (*scrActionGroups).insert("fontSize", new QActionGroup(ScApp, "fontSize", true));
148
        scrActions->insert("fontSizeOther", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Other..."), QKeySequence(), (*scrActionGroups)["fontSize"], "fontSizeOther", -1));
149
        connect( (*scrActions)["fontSizeOther"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemFSize(int)));
150
 
151
        int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
152
        size_t f_size = sizeof(font_sizes) / sizeof(*font_sizes);
153
        for (uint s = 0; s < f_size; ++s)
154
        {
155
                QString fontSizeName=QString("fontSize%1").arg(font_sizes[s]);
156
                scrActions->insert(fontSizeName, new ScrAction(ScrAction::DataInt, QIconSet(), tr("%1 pt").arg(font_sizes[s]), QKeySequence(), (*scrActionGroups)["fontSize"], fontSizeName, font_sizes[s]));
157
                (*scrActions)[fontSizeName]->setToggleAction(true);
158
                connect( (*scrActions)[fontSizeName], SIGNAL(activatedData(int)), ScApp, SLOT(setItemFSize(int)));
159
        }
160
 
161
        //Alignment actions
162
        scrActions->insert("alignLeft", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Left"), QKeySequence(), ScApp, "alignLeft", 0));
163
        scrActions->insert("alignCenter", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Center"), QKeySequence(), ScApp, "alignCenter", 1));
164
        scrActions->insert("alignRight", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Right"), QKeySequence(), ScApp, "alignRight", 2));
165
        scrActions->insert("alignBlock", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Block"), QKeySequence(), ScApp, "alignBlock", 3));
166
        scrActions->insert("alignForced", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Forced"), QKeySequence(), ScApp, "alignForced", 4));
167
 
168
        (*scrActions)["alignLeft"]->setToggleAction(true);
169
        (*scrActions)["alignCenter"]->setToggleAction(true);
170
        (*scrActions)["alignRight"]->setToggleAction(true);
171
        (*scrActions)["alignBlock"]->setToggleAction(true);
172
        (*scrActions)["alignForced"]->setToggleAction(true);
173
 
174
        connect( (*scrActions)["alignLeft"], SIGNAL(activatedData(int)), ScApp, SLOT(setNewAbStyle(int)));
175
        connect( (*scrActions)["alignCenter"], SIGNAL(activatedData(int)), ScApp, SLOT(setNewAbStyle(int)));
176
        connect( (*scrActions)["alignRight"], SIGNAL(activatedData(int)), ScApp, SLOT(setNewAbStyle(int)));
177
        connect( (*scrActions)["alignBlock"], SIGNAL(activatedData(int)), ScApp, SLOT(setNewAbStyle(int)));
178
        connect( (*scrActions)["alignForced"], SIGNAL(activatedData(int)), ScApp, SLOT(setNewAbStyle(int)));
179
 
180
        //Shade actions
181
        scrActionGroups->insert("shade", new QActionGroup(ScApp, "shade", true));
182
        scrActions->insert("shadeOther", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Other..."), QKeySequence(), (*scrActionGroups)["shade"], "shadeOther", -1));
183
        connect( (*scrActions)["shadeOther"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemShade(int)));
184
        for (uint i=0; i<=100 ; i+=10)
185
        {
186
                QString shadeName=QString("shade%1").arg(i);
187
                scrActions->insert(shadeName, new ScrAction(ScrAction::DataInt, QIconSet(), tr("&%1 %").arg(i), QKeySequence(), (*scrActionGroups)["shade"], shadeName, i));
188
                (*scrActions)[shadeName]->setToggleAction(true);
189
                connect( (*scrActions)[shadeName], SIGNAL(activatedData(int)), ScApp, SLOT(setItemShade(int)));
190
        }
191
 
192
        //Type Effects actions
193
        scrActionGroups->insert("typeEffects", new QActionGroup(ScApp, "typeEffects", false));
194
        scrActions->insert("typeEffectNormal", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Normal"), QKeySequence(), (*scrActionGroups)["typeEffects"], "typeEffectNormal", 0));
195
        scrActions->insert("typeEffectUnderline", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Underline"), QKeySequence(), (*scrActionGroups)["typeEffects"], "typeEffectUnderline", 1));
196
        scrActions->insert("typeEffectStrikeThrough", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Strike Through"), QKeySequence(), (*scrActionGroups)["typeEffects"], "typeEffectStrikeThrough", 2));
197
        scrActions->insert("typeEffectSmallCaps", new ScrAction(ScrAction::DataInt, QIconSet(), tr("Small &Caps"), QKeySequence(), (*scrActionGroups)["typeEffects"], "typeEffectSmallCaps", 3));
198
        scrActions->insert("typeEffectSuperscript", new ScrAction(ScrAction::DataInt, QIconSet(), tr("Su&perscript"), QKeySequence(), (*scrActionGroups)["typeEffects"], "typeEffectSuperscript", 4));
199
        scrActions->insert("typeEffectSubscript", new ScrAction(ScrAction::DataInt, QIconSet(), tr("Su&bscript"), QKeySequence(), (*scrActionGroups)["typeEffects"], "typeEffectSubscript", 5));
200
        scrActions->insert("typeEffectOutline", new ScrAction(ScrAction::DataInt, QIconSet(), tr("&Outline"), QKeySequence(), (*scrActionGroups)["typeEffects"], "typeEffectOutline", 6));
201
        (*scrActions)["typeEffectNormal"]->setToggleAction(true);
202
        (*scrActions)["typeEffectUnderline"]->setToggleAction(true);
203
        (*scrActions)["typeEffectStrikeThrough"]->setToggleAction(true);
204
        (*scrActions)["typeEffectSmallCaps"]->setToggleAction(true);
205
        (*scrActions)["typeEffectSuperscript"]->setToggleAction(true);
206
        (*scrActions)["typeEffectSubscript"]->setToggleAction(true);
207
        (*scrActions)["typeEffectOutline"]->setToggleAction(true);
208
        connect( (*scrActions)["typeEffectNormal"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemTypeStyle(int)));
209
        connect( (*scrActions)["typeEffectUnderline"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemTypeStyle(int)));
210
        connect( (*scrActions)["typeEffectStrikeThrough"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemTypeStyle(int)));
211
        connect( (*scrActions)["typeEffectSmallCaps"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemTypeStyle(int)));
212
        connect( (*scrActions)["typeEffectSuperscript"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemTypeStyle(int)));
213
        connect( (*scrActions)["typeEffectSubscript"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemTypeStyle(int)));
214
        connect( (*scrActions)["typeEffectOutline"], SIGNAL(activatedData(int)), ScApp, SLOT(setItemTypeStyle(int)));
215
 
216
        //Other Style menu items that get added in various places
217
        scrActions->insert("styleInvertPict", new ScrAction(tr("&Invert"), QKeySequence(), ScApp, "styleInvertPict"));
218
        scrActions->insert("styleTabulators", new ScrAction(tr("&Tabulators..."), QKeySequence(), ScApp, "styleTabulators"));
219
        connect( (*scrActions)["styleInvertPict"], SIGNAL(activated()), ScApp, SLOT(InvertPict()));
220
        connect( (*scrActions)["styleTabulators"], SIGNAL(activated()), ScApp, SLOT(EditTabs()));
221
 
222
}
223
 
224
void ActionManager::initItemMenuActions()
225
{
226
        //Item Menu
227
        scrActions->insert("itemDuplicate", new ScrAction(tr("D&uplicate"), CTRL+Key_D, ScApp, "itemDuplicate"));
228
        scrActions->insert("itemMulDuplicate", new ScrAction(tr("&Multiple Duplicate"), QKeySequence(), ScApp, "itemMulDuplicate"));
229
        scrActions->insert("itemDelete", new ScrAction(tr("&Delete"), CTRL+Key_K, ScApp, "itemDelete"));
230
        scrActions->insert("itemGroup", new ScrAction(tr("&Group"), CTRL+Key_G, ScApp, "itemGroup"));
231
        scrActions->insert("itemUngroup", new ScrAction(tr("&Ungroup"), CTRL+Key_U, ScApp, "itemUngroup"));
232
        scrActions->insert("itemLock", new ScrAction(tr("Is &Locked"), CTRL+Key_L, ScApp, "itemLock"));
233
        scrActions->insert("itemLockSize", new ScrAction(tr("Si&ze is Locked"), CTRL+SHIFT+Key_L, ScApp, "itemLockSize"));
234
        (*scrActions)["itemLock"]->setToggleAction(true);
235
        (*scrActions)["itemLockSize"]->setToggleAction(true);
236
        scrActions->insert("itemSendToBack", new ScrAction(tr("Send to &Back"), QKeySequence(Key_End), ScApp, "itemSendToBack"));
237
        scrActions->insert("itemBringToFront", new ScrAction(tr("Bring to &Front"), QKeySequence(Key_Home), ScApp, "itemBringToFront"));
238
        scrActions->insert("itemLower", new ScrAction(tr("&Lower"), QKeySequence(Key_PageDown), ScApp, "itemLower"));
239
        scrActions->insert("itemRaise", new ScrAction(tr("&Raise"), QKeySequence(Key_PageUp), ScApp, "itemRaise"));
240
        scrActions->insert("itemAlignDist", new ScrAction(tr("Distribute/&Align..."), QKeySequence(), ScApp, "itemAlignDist"));
241
        scrActions->insert("itemSendToScrapbook", new ScrAction(tr("Send to S&crapbook"), QKeySequence(), ScApp, "itemSendToScrapbook"));
242
 
243
        scrActions->insert("itemAttributes", new ScrAction(tr("&Attributes..."), QKeySequence(), ScApp, "itemAttributes"));
2026 cbradney 244
        scrActions->insert("itemImageIsVisible", new ScrAction(tr("I&mage Visible"), QKeySequence(), ScApp, "itemImageIsVisible"));
1993 cbradney 245
        scrActions->insert("itemPDFIsBookmark", new ScrAction(tr("Is PDF &Bookmark"), QKeySequence(), ScApp, "itemPDFIsBookmark"));
246
        (*scrActions)["itemPDFIsBookmark"]->setToggleAction(true);
247
        scrActions->insert("itemPDFIsAnnotation", new ScrAction(tr("Is PDF A&nnotation"), QKeySequence(), ScApp, "itemPDFIsAnnotation"));
248
        (*scrActions)["itemPDFIsAnnotation"]->setToggleAction(true);
249
        scrActions->insert("itemPDFAnnotationProps", new ScrAction(tr("Annotation P&roperties"), QKeySequence(), ScApp, "itemPDFAnnotationProps"));
250
        scrActions->insert("itemPDFFieldProps", new ScrAction(tr("Field P&roperties"), QKeySequence(), ScApp, "itemPDFFieldProps"));
251
 
252
        //CB TODO Make these work
253
        (*scrActions)["itemPDFIsBookmark"]->setEnabled(false);
254
        (*scrActions)["itemPDFIsAnnotation"]->setEnabled(false);
255
        (*scrActions)["itemPDFAnnotationProps"]->setEnabled(false);
256
        (*scrActions)["itemPDFFieldProps"]->setEnabled(false);
2026 cbradney 257
 
258
        (*scrActions)["itemImageIsVisible"]->setToggleAction(true);
1993 cbradney 259
 
260
        scrActions->insert("itemShapeEdit", new ScrAction(tr("&Edit Shape..."), QKeySequence(), ScApp, "itemShapeEdit"));
261
        (*scrActions)["itemShapeEdit"]->setToggleAction(true);
262
        scrActions->insert("itemAttachTextToPath", new ScrAction(tr("&Attach Text to Path"), QKeySequence(), ScApp, "itemAttachTextToPath"));
263
        scrActions->insert("itemDetachTextFromPath", new ScrAction(tr("&Detach Text from Path"), QKeySequence(), ScApp, "itemDetachTextFromPath"));
264
        scrActions->insert("itemCombinePolygons", new ScrAction(tr("&Combine Polygons"), QKeySequence(), ScApp, "itemCombinePolygons"));
265
        scrActions->insert("itemSplitPolygons", new ScrAction(tr("Split &Polygons"), QKeySequence(), ScApp, "itemSplitPolygons"));
266
        scrActions->insert("itemConvertToBezierCurve", new ScrAction(tr("&Bezier Curve"), QKeySequence(), ScApp, "itemConvertToBezierCurve"));
267
        scrActions->insert("itemConvertToImageFrame", new ScrAction(tr("&Image Frame"), QKeySequence(), ScApp, "itemConvertToImageFrame"));
268
        scrActions->insert("itemConvertToOutlines", new ScrAction(tr("&Outlines"), QKeySequence(), ScApp, "itemConvertToOutlines"));
269
        scrActions->insert("itemConvertToPolygon", new ScrAction(tr("&Polygon"), QKeySequence(), ScApp, "itemConvertToPolygon"));
270
        scrActions->insert("itemConvertToTextFrame", new ScrAction(tr("&Text Frame"), QKeySequence(), ScApp, "itemConvertToTextFrame"));
271
 
272
        connect( (*scrActions)["itemDuplicate"], SIGNAL(activated()), ScApp, SLOT(ObjektDup()) );
273
        connect( (*scrActions)["itemMulDuplicate"], SIGNAL(activated()), ScApp, SLOT(ObjektDupM()) );
274
        connect( (*scrActions)["itemDelete"], SIGNAL(activated()), ScApp, SLOT(DeleteObjekt()) );
275
        connect( (*scrActions)["itemGroup"], SIGNAL(activated()), ScApp, SLOT(GroupObj()) );
276
        connect( (*scrActions)["itemUngroup"], SIGNAL(activated()), ScApp, SLOT(UnGroupObj()) );
277
        connect( (*scrActions)["itemLock"], SIGNAL(activated()), ScApp, SLOT(ToggleObjLock()) );
278
        connect( (*scrActions)["itemLockSize"], SIGNAL(activated()), ScApp, SLOT(ToggleObjSizeLock()) );
279
        connect( (*scrActions)["itemPDFIsAnnotation"], SIGNAL(activated()), ScApp, SLOT(ToggleObjPDFAnnotation()) );
280
        connect( (*scrActions)["itemPDFIsBookmark"], SIGNAL(activated()), ScApp, SLOT(ToggleObjPDFBookmark()) );
281
        connect( (*scrActions)["itemPDFAnnotationProps"], SIGNAL(activated()), ScApp, SLOT(ModifyAnnot()) );
282
        connect( (*scrActions)["itemPDFFieldProps"], SIGNAL(activated()), ScApp, SLOT(ModifyAnnot()) );
2026 cbradney 283
        //connect( (*scrActions)["itemSendToBack"], SIGNAL(activated()), ScApp, SLOT(Objekt2Back()) );
284
        //connect( (*scrActions)["itemBringToFront"], SIGNAL(activated()), ScApp, SLOT(Objekt2Front()) );
285
        //connect( (*scrActions)["itemLower"], SIGNAL(activated()), ScApp, SLOT(ObjektLower()) );
286
        //connect( (*scrActions)["itemRaise"], SIGNAL(activated()), ScApp, SLOT(ObjektRaise()) );
1993 cbradney 287
        connect( (*scrActions)["itemAlignDist"], SIGNAL(activated()), ScApp, SLOT(ObjektAlign()) );
288
        connect( (*scrActions)["itemSendToScrapbook"], SIGNAL(activated()), ScApp, SLOT(PutScrap()) );
289
        connect( (*scrActions)["itemAttributes"], SIGNAL(activated()), ScApp, SLOT(objectAttributes()) );
290
        connect( (*scrActions)["itemShapeEdit"], SIGNAL(activated()), ScApp, SLOT(ToggleFrameEdit()) );
2026 cbradney 291
        //connect( (*scrActions)["itemAttachTextToPath"], SIGNAL(activated()), ScApp, SLOT(Pfadtext()) );
292
        //connect( (*scrActions)["itemDetachTextFromPath"], SIGNAL(activated()), ScApp, SLOT(noPfadtext()) );
293
        //connect( (*scrActions)["itemCombinePolygons"], SIGNAL(activated()), ScApp, SLOT(UniteOb()) );
294
        //connect( (*scrActions)["itemSplitPolygons"], SIGNAL(activated()), ScApp, SLOT(SplitUniteOb()) );
295
        //connect( (*scrActions)["itemConvertToBezierCurve"], SIGNAL(activated()), ScApp, SLOT(convertToBezierCurve()) );
296
        //connect( (*scrActions)["itemConvertToImageFrame"], SIGNAL(activated()), ScApp, SLOT(convertToImageFrame()) );
297
        //connect( (*scrActions)["itemConvertToOutlines"], SIGNAL(activated()), ScApp, SLOT(convertToOutlines()) );
298
        //connect( (*scrActions)["itemConvertToPolygon"], SIGNAL(activated()), ScApp, SLOT(convertToPolygon()) );
299
        //connect( (*scrActions)["itemConvertToTextFrame"], SIGNAL(activated()), ScApp, SLOT(convertToTextFrame()) );
1993 cbradney 300
}
301
 
302
void ActionManager::initInsertMenuActions()
303
{
304
        //Insert Menu
305
        scrActions->insert("insertGlyph", new ScrAction(tr("&Glyph..."), QKeySequence(), ScApp, "insertGlyph"));
306
        //(*scrActions)["insertGlyph"]->setText(tr("Insert Special Character"));
307
        scrActions->insert("insertSampleText", new ScrAction(tr("Sample Text"), QKeySequence(), ScApp, "insertSampleText"));
308
 
309
        connect( (*scrActions)["insertGlyph"], SIGNAL(activated()), ScApp, SLOT(slotCharSelect()) );
310
        connect( (*scrActions)["insertSampleText"], SIGNAL(activated()), ScApp, SLOT(insertSampleText()) );
311
}
312
 
313
void ActionManager::initPageMenuActions()
314
{
315
        //Page menu
316
        scrActions->insert("pageInsert", new ScrAction(tr("&Insert..."), QKeySequence(), ScApp, "pageInsert"));
317
        scrActions->insert("pageDelete", new ScrAction(tr("&Delete..."), QKeySequence(), ScApp, "pageDelete"));
318
        scrActions->insert("pageCopy", new ScrAction(tr("&Copy..."), QKeySequence(), ScApp, "pageCopy"));
319
        scrActions->insert("pageMove", new ScrAction(tr("&Move..."), QKeySequence(), ScApp, "pageMove"));
320
        scrActions->insert("pageApplyTemplate", new ScrAction(tr("&Apply Template..."), QKeySequence(), ScApp, "pageApplyTemplate"));
321
        scrActions->insert("pageManageGuides", new ScrAction(tr("Manage &Guides..."), QKeySequence(), ScApp, "pageManageGuides"));
322
 
323
        connect( (*scrActions)["pageInsert"], SIGNAL(activated()), ScApp, SLOT(slotNewPageM()) );
324
        connect( (*scrActions)["pageDelete"], SIGNAL(activated()), ScApp, SLOT(DeletePage()) );
325
        connect( (*scrActions)["pageCopy"], SIGNAL(activated()), ScApp, SLOT(CopyPage()) );
326
        connect( (*scrActions)["pageMove"], SIGNAL(activated()), ScApp, SLOT(MovePage()) );
327
        connect( (*scrActions)["pageApplyTemplate"], SIGNAL(activated()), ScApp, SLOT(ApplyTemp()) );
328
        connect( (*scrActions)["pageManageGuides"], SIGNAL(activated()), ScApp, SLOT(ManageGuides()) );
329
}
330
 
331
void ActionManager::initViewMenuActions()
332
{
333
        scrActions->insert("viewFitInWindow", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&Fit in window"), CTRL+Key_0, ScApp, "viewFitInWindow", 0, -100.0));
334
        scrActions->insert("viewFit50", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&50%"), QKeySequence(), ScApp, "viewFit50", 0, 50.0));
335
        scrActions->insert("viewFit75", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&75%"), QKeySequence(), ScApp, "viewFit75", 0, 75.0));
336
        scrActions->insert("viewFit100", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&100%"), CTRL+Key_1, ScApp, "viewFit100", 0, 100.0));
337
        scrActions->insert("viewFit200", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&200%"), QKeySequence(), ScApp, "viewFit200", 0, 200.0));
338
        scrActions->insert("viewFit20", new ScrAction(ScrAction::DataDouble, QIconSet(), tr("&Thumbnails"), QKeySequence(), ScApp, "viewFit20", 0, 20.0));
339
        scrActions->insert("viewShowMargins", new ScrAction(tr("Show &Margins"), QKeySequence(), ScApp, "viewShowMargins"));
340
        scrActions->insert("viewShowFrames", new ScrAction(tr("Show &Frames"), QKeySequence(), ScApp, "viewShowFrames"));
341
        scrActions->insert("viewShowImages", new ScrAction(tr("Show &Images"), QKeySequence(), ScApp, "viewShowImages"));
342
        scrActions->insert("viewShowGrid", new ScrAction(tr("Show &Grid"), QKeySequence(), ScApp, "viewShowGrid"));
343
        scrActions->insert("viewShowGuides", new ScrAction(tr("Show G&uides"), QKeySequence(), ScApp, "viewShowGuides"));
344
        scrActions->insert("viewShowBaseline", new ScrAction(tr("Show &Baseline Grid"), QKeySequence(), ScApp, "viewShowBaseline"));
345
        scrActions->insert("viewShowTextChain", new ScrAction(tr("Show &Text Chain"), QKeySequence(), ScApp, "viewShowTextChain"));
346
        scrActions->insert("viewSnapToGrid", new ScrAction(tr("Sn&ap to Grid"), QKeySequence(), ScApp, "viewSnapToGrid"));
347
        scrActions->insert("viewSnapToGuides", new ScrAction(tr("Sna&p to Guides"), QKeySequence(), ScApp, "viewSnapToGuides"));
348
//      scrActions->insert("viewNewView", new ScrAction(tr("New View"), QKeySequence(), ScApp, "viewNewView"));
349
 
350
        (*scrActions)["viewShowMargins"]->setToggleAction(true);
351
        (*scrActions)["viewShowFrames"]->setToggleAction(true);
352
        (*scrActions)["viewShowImages"]->setToggleAction(true);
353
        (*scrActions)["viewShowGrid"]->setToggleAction(true);
354
        (*scrActions)["viewShowGuides"]->setToggleAction(true);
355
        (*scrActions)["viewShowBaseline"]->setToggleAction(true);
356
        (*scrActions)["viewShowTextChain"]->setToggleAction(true);
357
        (*scrActions)["viewSnapToGrid"]->setToggleAction(true);
358
        (*scrActions)["viewSnapToGuides"]->setToggleAction(true);
359
 
360
        (*scrActions)["viewShowMargins"]->setOn(true);
361
        (*scrActions)["viewShowFrames"]->setOn(true);
362
        (*scrActions)["viewShowImages"]->setOn(true);
363
        (*scrActions)["viewShowGuides"]->setOn(true);
364
 
365
        connect( (*scrActions)["viewFitInWindow"], SIGNAL(activatedData(double)), ScApp, SLOT(slotZoom(double)) );
366
        connect( (*scrActions)["viewFit50"], SIGNAL(activatedData(double)), ScApp, SLOT(slotZoom(double)) );
367
        connect( (*scrActions)["viewFit75"], SIGNAL(activatedData(double)), ScApp, SLOT(slotZoom(double)) );
368
        connect( (*scrActions)["viewFit100"], SIGNAL(activatedData(double)), ScApp, SLOT(slotZoom(double)) );
369
        connect( (*scrActions)["viewFit200"], SIGNAL(activatedData(double)), ScApp, SLOT(slotZoom(double)) );
370
        connect( (*scrActions)["viewFit20"], SIGNAL(activatedData(double)), ScApp, SLOT(slotZoom(double)) );
371
        connect( (*scrActions)["viewShowMargins"], SIGNAL(activated()), ScApp, SLOT(ToggleMarks()) );
372
        connect( (*scrActions)["viewShowFrames"], SIGNAL(activated()), ScApp, SLOT(ToggleFrames()) );
373
        connect( (*scrActions)["viewShowImages"], SIGNAL(activated()), ScApp, SLOT(TogglePics()) );
374
        connect( (*scrActions)["viewShowGrid"], SIGNAL(activated()), ScApp, SLOT(ToggleRaster()) );
375
        connect( (*scrActions)["viewShowGuides"], SIGNAL(activated()), ScApp, SLOT(ToggleGuides()) );
376
        connect( (*scrActions)["viewShowBaseline"], SIGNAL(activated()), ScApp, SLOT(ToggleBase()) );
377
        connect( (*scrActions)["viewShowTextChain"], SIGNAL(activated()), ScApp, SLOT(ToggleTextLinks()) );
378
        connect( (*scrActions)["viewSnapToGrid"], SIGNAL(activated()), ScApp, SLOT(ToggleURaster()) );
379
        connect( (*scrActions)["viewSnapToGuides"], SIGNAL(activated()), ScApp, SLOT(ToggleUGuides()) );
380
//      connect( (*scrActions)["viewNewView"], SIGNAL(activated()), ScApp, SLOT(newView()) );
381
 
382
}
383
 
384
void ActionManager::initToolsMenuActions()
385
{
386
        //Tool menu
387
        scrActions->insert("toolsProperties", new ScrAction(tr("&Properties"), QKeySequence(), ScApp, "toolsProperties"));
388
        scrActions->insert("toolsOutline", new ScrAction(tr("&Outline"), QKeySequence(), ScApp, "toolsOutline"));
389
        scrActions->insert("toolsScrapbook", new ScrAction(tr("&Scrapbook"), QKeySequence(), ScApp, "toolsScrapbook"));
390
        scrActions->insert("toolsLayers", new ScrAction(tr("&Layers"), QKeySequence(Key_F6), ScApp, "toolsLayers"));
391
        scrActions->insert("toolsPages", new ScrAction(tr("P&age Palette"), QKeySequence(), ScApp, "toolsPages"));
392
        scrActions->insert("toolsBookmarks", new ScrAction(tr("&Bookmarks"), QKeySequence(), ScApp, "toolsBookmarks"));
393
        scrActions->insert("toolsMeasurements", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("dist.png"), loadIcon("dist.png")), tr("&Measurements"), QKeySequence(), ScApp, "toolsMeasurements", MeasurementTool));
394
        scrActions->insert("toolsActionHistory", new ScrAction(tr("Action &History"), QKeySequence(), ScApp, "toolsActionHistory"));
395
        scrActions->insert("toolsPreflightVerifier", new ScrAction(QIconSet(loadIcon("launch16.png"), loadIcon("launch.png")),tr("Preflight &Verifier"), QKeySequence(), ScApp, "toolsPreflightVerifier"));
396
        scrActions->insert("toolsToolbarTools", new ScrAction(tr("&Tools"), QKeySequence(), ScApp, "toolsToolbarTools"));
397
        scrActions->insert("toolsToolbarPDF", new ScrAction(tr("P&DF Tools"), QKeySequence(), ScApp, "toolsToolbarPDF"));
398
 
399
        //toolbar only items
400
        scrActions->insert("toolsSelect", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Kreuz.xpm"), loadIcon("Kreuz.xpm")), tr("Select Item"), QKeySequence(Key_C), ScApp, "toolsSelect", NormalMode));
401
 
402
        scrActions->insert("toolsInsertTextFrame", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Text16.xpm"), loadIcon("Text.xpm")), tr("&Text Frame"), QKeySequence(Key_T), ScApp, "toolsInsertTextFrame", DrawText));
403
        scrActions->insert("toolsInsertImageFrame", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Bild16.xpm"), loadIcon("Bild.xpm")), tr("&Image Frame"), QKeySequence(Key_I), ScApp, "toolsInsertImageFrame", DrawPicture));
404
        scrActions->insert("toolsInsertTableFrame", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("frame_table16.png"), loadIcon("frame_table.png")), tr("T&able"), QKeySequence(Key_A), ScApp, "toolsInsertTableFrame", DrawTable));
405
        scrActions->insert("toolsInsertShape", new ScrAction(ScrAction::DataInt,QIconSet(), tr("&Shape"), QKeySequence(Key_S), ScApp, "toolsInsertShape", DrawShapes));
406
        scrActions->insert("toolsInsertPolygon", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("spline16.png"), loadIcon("spline.png")), tr("&Polygon"), QKeySequence(Key_P), ScApp, "toolsInsertPolygon", DrawRegularPolygon));
407
        scrActions->insert("toolsInsertLine", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Stift16.xpm"), loadIcon("Stift.xpm")), tr("&Line"), QKeySequence(Key_L), ScApp, "toolsInsertLine", DrawLine));
408
        scrActions->insert("toolsInsertBezier", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("beziertool16.png"), loadIcon("beziertool.png")), tr("&Bezier Curve"), QKeySequence(Key_B), ScApp, "toolsInsertBezier", DrawBezierLine));
409
        scrActions->insert("toolsInsertFreehandLine", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Stiftalt16.xpm"), loadIcon("Stiftalt.xpm")), tr("&Freehand Line"), QKeySequence(Key_F), ScApp, "toolsInsertFreehandLine", DrawFreehandLine));
410
 
411
        (*scrActions)["toolsInsertTextFrame"]->setText(tr("Insert Text Frame"));
412
        (*scrActions)["toolsInsertImageFrame"]->setText(tr("Insert Image Frame"));
413
        (*scrActions)["toolsInsertTableFrame"]->setText(tr("Insert Table"));
414
        (*scrActions)["toolsInsertShape"]->setText(tr("Insert Shape"));
415
        (*scrActions)["toolsInsertPolygon"]->setText(tr("Insert Polygon"));
416
        (*scrActions)["toolsInsertLine"]->setText(tr("Insert Line"));
417
        (*scrActions)["toolsInsertBezier"]->setText(tr("Insert Bezier Curve"));
418
        (*scrActions)["toolsInsertFreehandLine"]->setText(tr("Insert Freehand Line"));
419
 
420
        scrActions->insert("toolsRotate", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Rotieren.xpm"), loadIcon("Rotieren.xpm")), tr("Rotate Item"), QKeySequence(Key_R), ScApp, "toolsRotate", Rotation));
421
        scrActions->insert("toolsZoom", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Lupe.xpm"), loadIcon("Lupe.xpm")), tr("Zoom in or out"), QKeySequence(Key_Z), ScApp, "toolsZoom", Magnifier));
422
        scrActions->insert("toolsZoomIn", new ScrAction(QIconSet(loadIcon("Gross.xpm"), loadIcon("Gross.xpm")), tr("Zoom in"), QKeySequence(CTRL+Key_Plus), ScApp, "toolsZoomIn"));
423
        scrActions->insert("toolsZoomOut", new ScrAction(QIconSet(loadIcon("Klein.xpm"), loadIcon("Klein.xpm")), tr("Zoom out"), QKeySequence(CTRL+Key_Minus), ScApp, "toolsZoomOut"));
424
        scrActions->insert("toolsEditContents", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Editm.xpm"), loadIcon("Editm.xpm")), tr("Edit Contents of Frame"), QKeySequence(Key_E), ScApp, "toolsEditContents", EditMode));
425
        scrActions->insert("toolsEditWithStoryEditor", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("signature.png"), loadIcon("signature.png")), tr("Text..."), QKeySequence(CTRL+Key_Y), ScApp, "toolsEditWithStoryEditor", StartStoryEditor));
426
        scrActions->insert("toolsLinkTextFrame", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Lock.xpm"), loadIcon("Lock.xpm")), tr("Link Text Frames"), QKeySequence(Key_N), ScApp, "toolsLinkTextFrame", LinkFrames));
427
        scrActions->insert("toolsUnlinkTextFrame", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("Unlock.xpm"), loadIcon("Unlock.xpm")), tr("Unlink Text Frames"), QKeySequence(Key_U), ScApp, "toolsUnlinkTextFrame", UnlinkFrames));
428
        scrActions->insert("toolsEyeDropper", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("colorpicker.png"), loadIcon("colorpicker.png")), tr("&Eye Dropper"), QKeySequence(Key_Y), ScApp, "toolsEyeDropper", EyeDropper));
429
        scrActions->insert("toolsCopyProperties", new ScrAction(ScrAction::DataInt,QIconSet(loadIcon("wizard.png"), loadIcon("wizard.png")), tr("Copy Item Properties"), QKeySequence(), ScApp, "toolsCopyProperties", CopyProperties));
430
 
431
        (*scrActions)["toolsEditWithStoryEditor"]->setText(tr("Edit the text with the Story Editor"));
432
 
433
        (*scrActions)["toolsProperties"]->setToggleAction(true);
434
        (*scrActions)["toolsOutline"]->setToggleAction(true);
435
        (*scrActions)["toolsScrapbook"]->setToggleAction(true);
436
        (*scrActions)["toolsLayers"]->setToggleAction(true);
437
        (*scrActions)["toolsPages"]->setToggleAction(true);
438
        (*scrActions)["toolsBookmarks"]->setToggleAction(true);
439
        (*scrActions)["toolsMeasurements"]->setToggleAction(true);
440
        (*scrActions)["toolsActionHistory"]->setToggleAction(true);
441
        (*scrActions)["toolsPreflightVerifier"]->setToggleAction(true);
442
        (*scrActions)["toolsToolbarTools"]->setToggleAction(true);
443
        (*scrActions)["toolsToolbarPDF"]->setToggleAction(true);
444
 
445
        (*scrActions)["toolsSelect"]->setToggleAction(true);
446
        (*scrActions)["toolsInsertTextFrame"]->setToggleAction(true);
447
        (*scrActions)["toolsInsertImageFrame"]->setToggleAction(true);
448
        (*scrActions)["toolsInsertTableFrame"]->setToggleAction(true);
449
        (*scrActions)["toolsInsertShape"]->setToggleAction(true);
450
        (*scrActions)["toolsInsertPolygon"]->setToggleAction(true);
451
        (*scrActions)["toolsInsertLine"]->setToggleAction(true);
452
        (*scrActions)["toolsInsertBezier"]->setToggleAction(true);
453
        (*scrActions)["toolsInsertFreehandLine"]->setToggleAction(true);
454
        (*scrActions)["toolsRotate"]->setToggleAction(true);
455
        (*scrActions)["toolsZoom"]->setToggleAction(true);
456
        (*scrActions)["toolsEditContents"]->setToggleAction(true);
457
        (*scrActions)["toolsEditWithStoryEditor"]->setToggleAction(true);
458
        (*scrActions)["toolsLinkTextFrame"]->setToggleAction(true);
459
        (*scrActions)["toolsUnlinkTextFrame"]->setToggleAction(true);
460
        (*scrActions)["toolsEyeDropper"]->setToggleAction(true);
461
        (*scrActions)["toolsCopyProperties"]->setToggleAction(true);
462
 
463
        *modeActionNames << "toolsSelect" << "toolsInsertTextFrame" << "toolsInsertImageFrame" << "toolsInsertTableFrame";
464
        *modeActionNames << "toolsInsertShape" << "toolsInsertPolygon" << "toolsInsertLine" << "toolsInsertBezier";
465
        *modeActionNames << "toolsInsertFreehandLine" << "toolsRotate" << "toolsZoom" << "toolsEditContents";
466
        *modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame";
467
        *modeActionNames << "toolsEyeDropper" << "toolsCopyProperties";
468
 
469
        *nonEditActionNames << "itemSendToBack" << "itemBringToFront" << "itemRaise" << "itemLower";
470
 
471
        connect( (*scrActions)["toolsActionHistory"], SIGNAL(toggled(bool)), ScApp, SLOT(setUndoPalette(bool)) );
472
        connect( (*scrActions)["toolsToolbarTools"], SIGNAL(toggled(bool)), ScApp, SLOT(setTools(bool)) );
473
        connect( (*scrActions)["toolsToolbarPDF"], SIGNAL(toggled(bool)), ScApp, SLOT(setPDFTools(bool)) );
474
 
475
        connectModeActions();
476
}
477
 
478
void ActionManager::initExtrasMenuActions()
479
{
480
        scrActions->insert("extrasManagePictures", new ScrAction(tr("&Manage Pictures"), QKeySequence(), ScApp, "extrasManagePictures"));
481
        scrActions->insert("extrasHyphenateText", new ScrAction(tr("&Hyphenate Text"), QKeySequence(), ScApp, "extrasHyphenateText"));
482
        scrActions->insert("extrasGenerateTableOfContents", new ScrAction(tr("&Generate Table Of Contents"), QKeySequence(), ScApp, "extrasGenerateTableOfContents"));
483
 
484
        connect( (*scrActions)["extrasManagePictures"], SIGNAL(activated()), ScApp, SLOT(StatusPic()) );
485
        connect( (*scrActions)["extrasHyphenateText"], SIGNAL(activated()), ScApp, SLOT(doHyphenate()) );
486
        connect( (*scrActions)["extrasGenerateTableOfContents"], SIGNAL(activated()), ScApp, SLOT(generateTableOfContents()) );
487
}
488
 
489
 
490
void ActionManager::initWindowsMenuActions()
491
{
492
}
493
 
494
void ActionManager::initScriptMenuActions()
495
{
496
}
497
 
498
void ActionManager::initHelpMenuActions()
499
{
500
        scrActions->insert("helpAboutScribus", new ScrAction(tr("&About Scribus"), QKeySequence(), ScApp, "helpAboutScribus"));
501
        scrActions->insert("helpAboutQt", new ScrAction(tr("About &Qt"), QKeySequence(), ScApp, "helpAboutQt"));
502
        scrActions->insert("helpTooltips", new ScrAction(tr("Toolti&ps"), QKeySequence(), ScApp, "helpTooltips"));
503
        scrActions->insert("helpManual", new ScrAction(tr("Scribus &Manual..."), Key_F1, ScApp, "helpManual"));
504
 
505
        (*scrActions)["helpTooltips"]->setToggleAction(true);
506
        (*scrActions)["helpTooltips"]->setOn(true);
507
 
508
        connect( (*scrActions)["helpAboutScribus"], SIGNAL(activated()), ScApp, SLOT(slotHelpAbout()) );
509
        connect( (*scrActions)["helpAboutQt"], SIGNAL(activated()), ScApp, SLOT(slotHelpAboutQt()) );
510
        connect( (*scrActions)["helpTooltips"], SIGNAL(activated()), ScApp, SLOT(ToggleTips()) );
511
        connect( (*scrActions)["helpManual"], SIGNAL(activated()), ScApp, SLOT(slotOnlineHelp()) );
512
}
513
 
514
void ActionManager::initSpecialActions()
515
{
516
        //typography
517
        scrActions->insert("specialSmartHyphen", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Smart &Hyphen"), CTRL+SHIFT+Key_Minus, ScApp, "specialSmartHyphen",-1));
518
        scrActions->insert("specialNonBreakingSpace", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Non Breaking &Space"), CTRL+Key_Space, ScApp, "specialNonBreakingSpace",29));
519
        scrActions->insert("specialPageNumber", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Page &Number"), CTRL+SHIFT+ALT+Key_P, ScApp, "specialPageNumber",30));
520
        scrActions->insert("specialCopyRight", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Copyright"), QKeySequence(), ScApp, "specialCopyRight",0x0A9));
521
        scrActions->insert("specialRegdTM", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Registered Trademark"), QKeySequence(), ScApp, "specialRegdTM",0x00AE));
522
        scrActions->insert("specialTM", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Trademark"), QKeySequence(), ScApp, "specialTM",0x2122));
523
        scrActions->insert("specialBullet", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Bullet"), QKeySequence(), ScApp, "specialBullet",0x2022));
524
        scrActions->insert("specialDashEm", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Em Dash"), QKeySequence(), ScApp, "specialDashEm",0x2014));
525
        scrActions->insert("specialDashEn", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("En Dash"), QKeySequence(), ScApp, "specialDashEn",0x2013));
526
        scrActions->insert("specialDashFigure", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Figure Dash"), QKeySequence(), ScApp, "specialDashFigure",0x2012));
527
        scrActions->insert("specialDashQuotation", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Quotation Dash"), QKeySequence(), ScApp, "specialDashQuotation",0x2015));
528
 
529
        scrActions->insert("specialQuoteDoubleLeft", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Double Left Quote"), QKeySequence(), ScApp, "specialQuoteDoubleLeft",0x201C));
530
        scrActions->insert("specialQuoteDoubleRight", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Double Right Quote"), QKeySequence(), ScApp, "specialQuoteDoubleRight",0x201D));
531
        scrActions->insert("specialQuoteSingleLeft", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Single Left Quote"), QKeySequence(), ScApp, "specialQuoteSingleLeft",0x2018));
532
        scrActions->insert("specialQuoteSingleRight", new ScrAction(ScrAction::UnicodeChar, QIconSet(), tr("Single Right Quote"), QKeySequence(), ScApp, "specialQuoteSingleRight",0x2019));
533
 
534
        (*scrActions)["specialSmartHyphen"]->setText("Insert Smart Hyphen");
535
        (*scrActions)["specialNonBreakingSpace"]->setText("Insert Non Breaking Space");
536
        (*scrActions)["specialPageNumber"]->setText("Insert Page Number");
537
 
538
        *unicodeCharActionNames << "specialSmartHyphen" << "specialNonBreakingSpace" << "specialPageNumber";
539
        *unicodeCharActionNames << "specialCopyRight" << "specialRegdTM" << "specialTM";
540
        *unicodeCharActionNames << "specialBullet";
541
        *unicodeCharActionNames << "specialDashEm" << "specialDashEn" << "specialDashFigure" << "specialDashQuotation";
542
        *unicodeCharActionNames << "specialQuoteDoubleLeft" << "specialQuoteDoubleRight" << "specialQuoteSingleLeft" << "specialQuoteSingleRight";
543
 
544
        for ( QStringList::Iterator it = unicodeCharActionNames->begin(); it != unicodeCharActionNames->end(); ++it )
545
                connect( (*scrActions)[*it], SIGNAL(activatedUnicodeShortcut(QString, int)), ScApp, SLOT(specialActionKeyEvent(QString, int)) );
546
 
547
        //GUI
548
        scrActions->insert("specialToggleAllPalettes", new ScrAction(ScrAction::DataQString, QIconSet(), tr("Toggle Palettes"), Key_F10, ScApp, "specialToggleAllPalettes",0,0.0,"specialToggleAllPalettes"));
549
        scrActions->insert("specialToggleAllGuides", new ScrAction(ScrAction::DataQString, QIconSet(), tr("Toggle Guides"), Key_F11, ScApp, "specialToggleAllGuides",0,0.0,"specialToggleAllGuides"));
550
 
551
        connect( (*scrActions)["specialToggleAllPalettes"], SIGNAL(activated()), ScApp, SLOT(ToggleAllPalettes()) );
552
        connect( (*scrActions)["specialToggleAllGuides"], SIGNAL(activated()), ScApp, SLOT(ToggleAllGuides()) );
553
}
554
 
555
void ActionManager::disconnectModeActions()
556
{
557
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
558
                disconnect( (*scrActions)[*it], SIGNAL(toggledData(bool, int)) , ScApp, SLOT(setAppModeByToggle(bool, int)) );
559
}
560
 
561
void ActionManager::connectModeActions()
562
{
563
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
564
                connect( (*scrActions)[*it], SIGNAL(toggledData(bool, int)) , ScApp, SLOT(setAppModeByToggle(bool, int)) );
565
}
566
 
2026 cbradney 567
void ActionManager::disconnectNewViewActions()
568
{
569
        disconnect( (*scrActions)["toolsZoomIn"], 0, 0, 0);
570
        disconnect( (*scrActions)["toolsZoomOut"], 0, 0, 0);
571
        disconnect( (*scrActions)["itemSendToBack"], 0, 0, 0);
572
        disconnect( (*scrActions)["itemImageIsVisible"], 0, 0, 0);
573
        disconnect( (*scrActions)["itemRaise"], 0, 0, 0);
574
        disconnect( (*scrActions)["itemLower"], 0, 0, 0);
575
        disconnect( (*scrActions)["itemCombinePolygons"], 0, 0, 0);
576
        disconnect( (*scrActions)["itemSplitPolygons"], 0, 0, 0);
577
        disconnect( (*scrActions)["itemConvertToBezierCurve"], 0, 0, 0);
578
        disconnect( (*scrActions)["itemConvertToImageFrame"], 0, 0, 0);
579
        disconnect( (*scrActions)["itemConvertToOutlines"], 0, 0, 0);
580
        disconnect( (*scrActions)["itemConvertToPolygon"], 0, 0, 0);
581
        disconnect( (*scrActions)["itemConvertToTextFrame"], 0, 0, 0);
582
        disconnect( (*scrActions)["itemAttachTextToPath"], 0, 0, 0);
583
        disconnect( (*scrActions)["itemDetachTextFromPath"], 0, 0, 0);
584
}
585
 
586
void ActionManager::connectNewViewActions(ScribusView *currView)
587
{
588
        if (currView==NULL)
589
                return;
590
        connect( (*scrActions)["toolsZoomIn"], SIGNAL(activated()) , currView, SLOT(slotZoomIn()) );
591
        connect( (*scrActions)["toolsZoomOut"], SIGNAL(activated()) , currView, SLOT(slotZoomOut()) );
592
        connect( (*scrActions)["itemSendToBack"], SIGNAL(activated()), currView, SLOT(ToBack()) );
593
        connect( (*scrActions)["itemBringToFront"], SIGNAL(activated()), currView, SLOT(ToFront()) );
594
        connect( (*scrActions)["itemRaise"], SIGNAL(activated()), currView, SLOT(RaiseItem()) );
595
        connect( (*scrActions)["itemLower"], SIGNAL(activated()), currView, SLOT(LowerItem()) );
596
        connect( (*scrActions)["itemCombinePolygons"], SIGNAL(activated()), currView, SLOT(UniteObj()) );
597
        connect( (*scrActions)["itemSplitPolygons"], SIGNAL(activated()), currView, SLOT(SplitObj()) );
598
        connect( (*scrActions)["itemConvertToBezierCurve"], SIGNAL(activated()), currView, SLOT(ToBezierFrame()) );
599
        connect( (*scrActions)["itemConvertToImageFrame"], SIGNAL(activated()), currView, SLOT(ToPicFrame()) );
600
        connect( (*scrActions)["itemConvertToOutlines"], SIGNAL(activated()), currView, SLOT(TextToPath()) );
601
        connect( (*scrActions)["itemConvertToPolygon"], SIGNAL(activated()), currView, SLOT(ToPolyFrame()) );
602
        connect( (*scrActions)["itemConvertToTextFrame"], SIGNAL(activated()), currView, SLOT(ToTextFrame()) );
603
        connect( (*scrActions)["itemAttachTextToPath"], SIGNAL(activated()), currView, SLOT(ToPathText()) );
604
        connect( (*scrActions)["itemDetachTextFromPath"], SIGNAL(activated()), currView, SLOT(FromPathText()) );
605
}
606
 
607
void ActionManager::disconnectNewSelectionActions()
608
{
609
        disconnect( (*scrActions)["itemImageIsVisible"], 0, 0, 0);
610
}
611
 
612
void ActionManager::connectNewSelectionActions(ScribusView *currView)
613
{
614
        connect( (*scrActions)["itemImageIsVisible"], SIGNAL(toggled(bool)) , currView, SLOT(TogglePic()) );
615
}
616
 
1993 cbradney 617
void ActionManager::saveActionShortcutsPreEditMode()
618
{
619
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
620
                (*scrActions)[*it]->saveShortcut();
621
        for ( QStringList::Iterator it = nonEditActionNames->begin(); it != nonEditActionNames->end(); ++it )
622
                (*scrActions)[*it]->saveShortcut();    
623
 
624
}
625
 
626
void ActionManager::restoreActionShortcutsPostEditMode()
627
{
628
        for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
629
                (*scrActions)[*it]->restoreShortcut();
630
        for ( QStringList::Iterator it = nonEditActionNames->begin(); it != nonEditActionNames->end(); ++it )
631
                (*scrActions)[*it]->restoreShortcut(); 
632
}
633
 
1995 cbradney 634
void ActionManager::enableActionStringList(QStringList *list, bool enabled, bool checkingUnicode)
1993 cbradney 635
{
636
        for ( QStringList::Iterator it = list->begin(); it != list->end(); ++it )
637
        {
638
                if(!checkingUnicode)
639
                        (*scrActions)[*it]->setEnabled(enabled);
640
                else
641
                {
642
                        //For UnicodeChar actions, only enable when the current font has that character.
643
                        if (ScApp->HaveDoc && (*scrActions)[*it]->actionType()==ScrAction::UnicodeChar)
644
                        {
645
                                int charCode=(*scrActions)[*it]->actionInt();
646
                                if(charCode==-1 || charCode==30 || (*ScApp->doc->AllFonts)[ScApp->doc->CurrFont]->CharWidth.contains(charCode) )
647
                                        (*scrActions)[*it]->setEnabled(enabled);
648
                        }
649
                }
650
        }
651
}
1995 cbradney 652
 
653
void ActionManager::enableUnicodeActions(bool enabled)
654
{
655
        enableActionStringList(unicodeCharActionNames, enabled, enabled);
656
}