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 */
7 /***************************************************************************
8 begin : Apr 2005
9 copyright : (C) 2005 by Craig Bradney
10 email : cbradney@zip.com.au
11 ***************************************************************************/
12
13 /***************************************************************************
14 * *
15 * mainWindow program is free software; you can redistribute it and/or modify *
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"
23 #include "appmodes.h"
24
25 #include "scribuscore.h"
26 #include "scribusdoc.h"
27 #include "scribusview.h"
28 #include "selection.h"
29 #include "text/storytext.h"
30 #include "undomanager.h"
31 #include "urllauncher.h"
32 #include "iconmanager.h"
33
34 QMap<QString, QKeySequence> ActionManager::defKeys;
35 QVector< QPair<QString, QStringList> > ActionManager::defMenuNames;
36 QVector< QPair<QString, QStringList> > ActionManager::defMenus;
37 QVector< QPair<QString, QStringList> > ActionManager::defNonMenuNames;
38 QVector< QPair<QString, QStringList> > ActionManager::defNonMenuActions;
39
ActionManager(QObject * parent)40 ActionManager::ActionManager ( QObject * parent ) :
41 QObject ( parent),
42 im (IconManager::instance())
43 {
44 }
45
~ActionManager()46 ActionManager::~ActionManager()
47 {
48 while (!scrActions->isEmpty())
49 {
50 ScrAction *value = (*scrActions->begin());
51 scrActions->erase(scrActions->begin());
52 delete value;
53 }
54 scrActions->clear();
55 delete modeActionNames;
56 delete nonEditActionNames;
57 delete unicodeCharActionNames;
58 }
59
init(ScribusMainWindow * mw)60 void ActionManager::init(ScribusMainWindow *mw)
61 {
62 mainWindow=mw;
63 scrActions=&(mainWindow->scrActions);
64 scrActionGroups=&(mainWindow->scrActionGroups);
65 modeActionNames=new QStringList();
66 nonEditActionNames=new QStringList();
67 unicodeCharActionNames=new QStringList();
68 undoManager = UndoManager::instance();
69
70 #ifdef Q_OS_MAC
71 noIcon = im.loadPixmap("noicon.png");
72 #endif
73
74 createActions();
75 createDefaultMenus();
76 createDefaultNonMenuActions();
77 languageChange();
78 setActionTooltips(scrActions);
79 }
80
compareKeySeqToShortcut(const QKeySequence & ks,const QString & actionName)81 bool ActionManager::compareKeySeqToShortcut(const QKeySequence& ks, const QString& actionName)
82 {
83 if (!scrActions->contains(actionName))
84 return false;
85 return ks.matches((*scrActions)[actionName]->shortcut())==QKeySequence::ExactMatch;
86 }
87
compareKeySeqToShortcut(int k,Qt::KeyboardModifiers km,const QString & actionName)88 bool ActionManager::compareKeySeqToShortcut(int k, Qt::KeyboardModifiers km, const QString& actionName)
89 {
90 return compareKeySeqToShortcut(QKeySequence(k | km), actionName);
91 }
92
createActions()93 void ActionManager::createActions()
94 {
95 initFileMenuActions();
96 initEditMenuActions();
97 initStyleMenuActions();
98 initItemMenuActions();
99 initInsertMenuActions();
100 initPageMenuActions();
101 initTableMenuActions();
102 initViewMenuActions();
103 initToolsMenuActions();
104 initExtrasMenuActions();
105 initWindowsMenuActions();
106 initScriptMenuActions();
107 initHelpMenuActions();
108 initUnicodeActions(scrActions, mainWindow, unicodeCharActionNames);
109 enableUnicodeActions(scrActions, false);
110 initSpecialActions();
111 }
112
initFileMenuActions()113 void ActionManager::initFileMenuActions()
114 {
115 QString name;
116 //File Menu
117 name = "fileNew";
118 scrActions->insert(name, new ScrAction("16/document-new.png", "22/document-new.png", "", defaultKey(name), mainWindow));
119 name = "fileNewFromTemplate";
120 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
121 name = "fileOpen";
122 scrActions->insert(name, new ScrAction("16/document-open.png", "22/document-open.png", "", defaultKey(name), mainWindow));
123 name = "fileClose";
124 scrActions->insert(name, new ScrAction("16/close.png", "22/close.png", "", defaultKey(name), mainWindow));
125 name = "fileSave";
126 scrActions->insert(name, new ScrAction("16/document-save.png", "22/document-save.png", "", defaultKey(name), mainWindow));
127 name = "fileSaveAs";
128 scrActions->insert(name, new ScrAction("16/document-save-as.png", "22/document-save-as.png", "", defaultKey(name), mainWindow));
129 name = "fileRevert";
130 scrActions->insert(name, new ScrAction("revert.png", QString(), "", defaultKey(name), mainWindow));
131 name = "fileCollect";
132 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
133 //File Import Menu
134 name = "fileImportText";
135 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
136 name = "fileImportText2";
137 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
138 name = "fileImportAppendText";
139 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
140 name = "fileImportImage";
141 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
142 name = "fileImportVector";
143 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
144
145 //File Export Menu
146 name = "fileExportText";
147 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
148 name = "fileExportAsEPS";
149 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
150 name = "fileExportAsPDF";
151 scrActions->insert(name, new ScrAction("acroread16.png", "acroread22.png", "", defaultKey(name), mainWindow));
152 //Rest of File Menu
153 // name = "fileDocSetup";
154 // scrActions->insert(name, new ScrAction("16/document-properties.png", "22/document-properties.png", "", defaultKey(name), mainWindow));
155 name = "fileDocSetup150";
156 scrActions->insert(name, new ScrAction("16/document-properties.png", "22/document-properties.png", "", defaultKey(name), mainWindow));
157 // name = "filePreferences";
158 // scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
159 // (*scrActions)[name]->setMenuRole(QAction::NoRole);
160 name = "filePreferences150";
161 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
162 (*scrActions)[name]->setMenuRole(QAction::PreferencesRole);
163 name = "filePrint";
164 scrActions->insert(name, new ScrAction("16/document-print.png", "22/document-print.png", "", defaultKey(name), mainWindow));
165 name = "PrintPreview";
166 scrActions->insert(name, new ScrAction("16/document-print-preview.png", "22/document-print-preview.png", "", defaultKey(name), mainWindow));
167 name = "OutputPreviewPDF";
168 scrActions->insert(name, new ScrAction(QString(), defaultKey(name), mainWindow));
169 name = "OutputPreviewPS";
170 scrActions->insert(name, new ScrAction(QString(), defaultKey(name), mainWindow));
171 name = "fileQuit";
172 scrActions->insert(name, new ScrAction("exit.png", QString(), "", defaultKey(name), mainWindow));
173 (*scrActions)[name]->setMenuRole(QAction::QuitRole);
174
175 //Connect our signals and slots
176 //File Menu
177 connect( (*scrActions)["fileNew"], SIGNAL(triggered()), mainWindow, SLOT(slotFileNew()) );
178 connect( (*scrActions)["fileNewFromTemplate"], SIGNAL(triggered()), mainWindow, SLOT(newFileFromTemplate()) );
179 connect( (*scrActions)["fileOpen"], SIGNAL(triggered()), mainWindow, SLOT(slotFileOpen()) );
180 connect( (*scrActions)["fileClose"], SIGNAL(triggered()), mainWindow, SLOT(slotFileClose()) );
181 connect( (*scrActions)["filePrint"], SIGNAL(triggered()), mainWindow, SLOT(slotFilePrint()) );
182 connect( (*scrActions)["PrintPreview"], SIGNAL(triggered()), mainWindow, SLOT(printPreview()) );
183 connect( (*scrActions)["OutputPreviewPDF"], SIGNAL(triggered()), mainWindow, SLOT(outputPreviewPDF()) );
184 connect( (*scrActions)["OutputPreviewPS"], SIGNAL(triggered()), mainWindow, SLOT(outputPreviewPS()) );
185 connect( (*scrActions)["fileSave"], SIGNAL(triggered()), mainWindow, SLOT(slotFileSave()) );
186 connect( (*scrActions)["fileSaveAs"], SIGNAL(triggered()), mainWindow, SLOT(slotFileSaveAs()) );
187 connect( (*scrActions)["fileDocSetup150"], SIGNAL(triggered()), mainWindow, SLOT(slotDocSetup()) );
188 connect( (*scrActions)["filePreferences150"], SIGNAL(triggered()), mainWindow, SLOT(slotPrefsOrg()) );
189 connect( (*scrActions)["fileRevert"], SIGNAL(triggered()), mainWindow, SLOT(slotFileRevert()) );
190 connect( (*scrActions)["fileCollect"], SIGNAL(triggered()), mainWindow, SLOT(fileCollect()) );
191 connect( (*scrActions)["fileQuit"], SIGNAL(triggered()), mainWindow, SLOT(slotFileQuit()) );
192 //File Import Menu
193 connect( (*scrActions)["fileImportText"], SIGNAL(triggered()), mainWindow, SLOT(slotGetContent()) );
194 connect( (*scrActions)["fileImportText2"], SIGNAL(triggered()), mainWindow, SLOT(slotGetContent2()) );
195 connect( (*scrActions)["fileImportAppendText"], SIGNAL(triggered()), mainWindow, SLOT(slotFileAppend()) );
196 connect( (*scrActions)["fileImportImage"], SIGNAL(triggered()), mainWindow, SLOT(slotGetContent()) );
197 connect( (*scrActions)["fileImportVector"], SIGNAL(triggered()), mainWindow, SLOT(importVectorFile()) );
198 //File Export Menu
199 connect( (*scrActions)["fileExportText"], SIGNAL(triggered()), mainWindow, SLOT(SaveText()) );
200 connect( (*scrActions)["fileExportAsEPS"], SIGNAL(triggered()), mainWindow, SLOT(SaveAsEps()) );
201 connect( (*scrActions)["fileExportAsPDF"], SIGNAL(triggered()), mainWindow, SLOT(SaveAsPDF()) );
202 //The rest are plugins
203
204
205 (*scrActions)["fileClose"]->setShortcutContext(Qt::WidgetShortcut);
206 }
207
initEditMenuActions()208 void ActionManager::initEditMenuActions()
209 {
210 QString name;
211 //Edit Menu
212 name = "editUndoAction";
213 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/edit-undo.png", "22/edit-undo.png", "", defaultKey(name), mainWindow, 1));
214 name = "editRedoAction";
215 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/edit-redo.png", "22/edit-redo.png", "", defaultKey(name), mainWindow, 1));
216 name = "editActionMode";
217 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
218 (*scrActions)["editActionMode"]->setToggleAction(true);
219
220 name = "editCut";
221 scrActions->insert(name, new ScrAction("16/edit-cut.png", "22/edit-cut.png", "", defaultKey(name), mainWindow));
222 name = "editCopy";
223 scrActions->insert(name, new ScrAction("16/edit-copy.png", "22/edit-copy.png", "", defaultKey(name), mainWindow));
224 name = "editPaste";
225 scrActions->insert(name, new ScrAction("16/edit-paste.png", "22/edit-paste.png", "", defaultKey(name), mainWindow));
226 name = "editCopyContents";
227 scrActions->insert(name, new ScrAction("16/edit-copy.png", "22/edit-copy.png", "", defaultKey(name), mainWindow));
228 name = "editPasteContents";
229 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/edit-paste.png", QString(), "", defaultKey(name), mainWindow, 0));
230 name = "editPasteContentsAbs";
231 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/edit-paste.png", QString(), "", defaultKey(name), mainWindow, 1));
232 name = "editPasteImageFromClipboard";
233 scrActions->insert(name, new ScrAction("16/edit-paste.png", "22/edit-paste.png", "", defaultKey(name), mainWindow));
234 name = "editClearContents";
235 scrActions->insert(name, new ScrAction("16/edit-delete.png", "22/edit-delete.png", "", defaultKey(name), mainWindow));
236 name = "editTruncateContents";
237 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
238 name = "editSelectAll";
239 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
240 name = "editSelectAllOnLayer";
241 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
242 name = "editDeselectAll";
243 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
244 name = "editSearchReplace";
245 scrActions->insert(name, new ScrAction("16/edit-find-replace.png", "22/edit-find-replace.png", "", defaultKey(name), mainWindow));
246 name = "editEditWithImageEditor";
247 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
248 name = "editEditRenderSource";
249 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
250 name = "editColorsAndFills";
251 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
252 name = "editReplaceColors";
253 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
254 name = "editStyles";
255 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
256 name = "editMasterPages";
257 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
258 name = "editJavascripts";
259 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
260 name = "editMarks";
261 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
262 name = "editNotesStyles";
263 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
264
265 (*scrActions)["editStyles"]->setToggleAction(true);
266 (*scrActions)["editMarks"]->setToggleAction(true);
267 (*scrActions)["editNotesStyles"]->setToggleAction(true);
268
269 connect( (*scrActions)["editUndoAction"], SIGNAL(triggeredData(int)) , undoManager, SLOT(undo(int)) );
270 connect( (*scrActions)["editRedoAction"], SIGNAL(triggeredData(int)) , undoManager, SLOT(redo(int)) );
271 connect( (*scrActions)["editActionMode"], SIGNAL(toggled(bool)), mainWindow, SLOT(setUndoMode(bool)) );
272 connect( (*scrActions)["editCut"], SIGNAL(triggered()), mainWindow, SLOT(slotEditCut()) );
273 connect( (*scrActions)["editCopy"], SIGNAL(triggered()), mainWindow, SLOT(slotEditCopy()) );
274 connect( (*scrActions)["editPaste"], SIGNAL(triggered()), mainWindow, SLOT(slotEditPaste()) );
275 connect( (*scrActions)["editCopyContents"], SIGNAL(triggered()), mainWindow, SLOT(slotEditCopyContents()) );
276 connect( (*scrActions)["editPasteContents"], SIGNAL(triggeredData(int)), mainWindow, SLOT(slotEditPasteContents(int)) );
277 connect( (*scrActions)["editPasteContentsAbs"], SIGNAL(triggeredData(int)), mainWindow, SLOT(slotEditPasteContents(int)) );
278 connect( (*scrActions)["editPasteImageFromClipboard"], SIGNAL(triggered()), mainWindow, SLOT(slotGetClipboardImage()) );
279 connect( (*scrActions)["editSelectAll"], SIGNAL(triggered()), mainWindow, SLOT(SelectAll()) );
280 connect( (*scrActions)["editSelectAllOnLayer"], SIGNAL(triggered()), mainWindow, SLOT(SelectAllOnLayer()) );
281 connect( (*scrActions)["editDeselectAll"], SIGNAL(triggered()), mainWindow, SLOT(deselectAll()) );
282 connect( (*scrActions)["editSearchReplace"], SIGNAL(triggered()), mainWindow, SLOT(SearchText()) );
283 connect( (*scrActions)["editEditWithImageEditor"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
284 connect( (*scrActions)["editEditRenderSource"], SIGNAL(triggered()), mainWindow, SLOT(callImageEditor()) );
285 connect( (*scrActions)["editColorsAndFills"], SIGNAL(triggered()), mainWindow, SLOT(manageColorsAndFills()) );
286 connect( (*scrActions)["editReplaceColors"], SIGNAL(triggered()), mainWindow, SLOT(slotReplaceColors()) );
287 connect( (*scrActions)["editMasterPages"], SIGNAL(triggered()), mainWindow, SLOT(editMasterPagesStart()) );
288 connect( (*scrActions)["editJavascripts"], SIGNAL(triggered()), mainWindow, SLOT(ManageJava()) );
289 }
290
initStyleMenuActions()291 void ActionManager::initStyleMenuActions()
292 {
293 //Text Size actions
294 scrActionGroups->insert("fontSize", new QActionGroup(mainWindow));
295 QString name("fontSizeOther");
296 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("fontSize"), -1));
297 connect( (*scrActions)["fontSizeOther"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFontSize(int)));
298
299 int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
300 size_t f_size = sizeof(font_sizes) / sizeof(*font_sizes);
301 for (uint s = 0; s < f_size; ++s)
302 {
303 QString fontSizeName=QString("fontSize%1").arg(font_sizes[s]);
304 scrActions->insert(fontSizeName, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("fontSize"), font_sizes[s]));
305 (*scrActions)[fontSizeName]->setToggleAction(true);
306 connect( (*scrActions)[fontSizeName], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFontSize(int)));
307 }
308
309 //Alignment actions
310 name = "alignLeft";
311 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), mainWindow, 0));
312 name = "alignCenter";
313 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), mainWindow, 1));
314 name = "alignRight";
315 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), mainWindow, 2));
316 name = "alignBlock";
317 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), mainWindow, 3));
318 name = "alignForced";
319 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), mainWindow, 4));
320
321 (*scrActions)["alignLeft"]->setToggleAction(true);
322 (*scrActions)["alignCenter"]->setToggleAction(true);
323 (*scrActions)["alignRight"]->setToggleAction(true);
324 (*scrActions)["alignBlock"]->setToggleAction(true);
325 (*scrActions)["alignForced"]->setToggleAction(true);
326
327 connect( (*scrActions)["alignLeft"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
328 connect( (*scrActions)["alignCenter"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
329 connect( (*scrActions)["alignRight"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
330 connect( (*scrActions)["alignBlock"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
331 connect( (*scrActions)["alignForced"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setNewAlignment(int)));
332
333 //Shade actions
334 /*
335 scrActionGroups->insert("shade", new QActionGroup(mainWindow));
336 name = "shadeOther";
337 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("shade"), -1));
338 connect( (*scrActions)["shadeOther"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemShade(int)));
339 for (uint i=0; i<=100 ; i+=10)
340 {
341 QString shadeName=QString("shade%1").arg(i);
342 scrActions->insert(shadeName, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("shade"), i));
343 (*scrActions)[shadeName]->setToggleAction(true);
344 connect( (*scrActions)[shadeName], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemShade(int)));
345 }
346 */
347
348 //Type Effects actions
349 scrActionGroups->insert("typeEffects", new QActionGroup(mainWindow));
350 name = "typeEffectNormal";
351 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 0));
352 name = "typeEffectUnderline";
353 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 1));
354 name = "typeEffectUnderlineWords";
355 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 8));
356 name = "typeEffectStrikeThrough";
357 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 2));
358 name = "typeEffectAllCaps";
359 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 7));
360 name = "typeEffectSmallCaps";
361 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 3));
362 name = "typeEffectSuperscript";
363 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 4));
364 name = "typeEffectSubscript";
365 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 5));
366 name = "typeEffectOutline";
367 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 6));
368 name = "typeEffectShadow";
369 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), scrActionGroups->value("typeEffects"), 9));
370 (*scrActions)["typeEffectNormal"]->setToggleAction(true);
371 (*scrActions)["typeEffectUnderline"]->setToggleAction(true);
372 (*scrActions)["typeEffectUnderlineWords"]->setToggleAction(true);
373 (*scrActions)["typeEffectStrikeThrough"]->setToggleAction(true);
374 (*scrActions)["typeEffectAllCaps"]->setToggleAction(true);
375 (*scrActions)["typeEffectSmallCaps"]->setToggleAction(true);
376 (*scrActions)["typeEffectSuperscript"]->setToggleAction(true);
377 (*scrActions)["typeEffectSubscript"]->setToggleAction(true);
378 (*scrActions)["typeEffectOutline"]->setToggleAction(true);
379 (*scrActions)["typeEffectShadow"]->setToggleAction(true);
380 connect( (*scrActions)["typeEffectNormal"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
381 connect( (*scrActions)["typeEffectUnderline"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
382 connect( (*scrActions)["typeEffectUnderlineWords"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
383 connect( (*scrActions)["typeEffectStrikeThrough"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
384 connect( (*scrActions)["typeEffectSmallCaps"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
385 connect( (*scrActions)["typeEffectAllCaps"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
386 connect( (*scrActions)["typeEffectSuperscript"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
387 connect( (*scrActions)["typeEffectSubscript"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
388 connect( (*scrActions)["typeEffectOutline"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
389 connect( (*scrActions)["typeEffectShadow"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemTypeStyle(int)));
390
391 //Other Style menu items that get added in various places
392 name = "styleImageEffects";
393 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
394 name = "styleTabulators";
395 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
396 connect( (*scrActions)["styleImageEffects"], SIGNAL(triggered()), mainWindow, SLOT(ImageEffects()));
397 connect( (*scrActions)["styleTabulators"], SIGNAL(triggered()), mainWindow, SLOT(EditTabs()));
398 }
399
initItemMenuActions()400 void ActionManager::initItemMenuActions()
401 {
402 QString name;
403 //Item Menu
404 name = "itemDuplicate";
405 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
406 name = "itemMulDuplicate";
407 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
408 name = "itemTransform";
409 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
410 name = "itemDelete";
411 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
412 name = "itemGroup";
413 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
414 name = "itemUngroup";
415 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
416 name = "itemGroupAdjust";
417 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
418 name = "itemLock";
419 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
420 name = "itemLockSize";
421 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
422 name = "itemPrintingEnabled";
423 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
424 name = "itemFlipH";
425 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
426 name = "itemFlipV";
427 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
428 (*scrActions)["itemLock"]->setToggleAction(true, true);
429 (*scrActions)["itemLockSize"]->setToggleAction(true, true);
430 (*scrActions)["itemPrintingEnabled"]->setToggleAction(true, true);
431 (*scrActions)["itemFlipH"]->setToggleAction(true, true);
432 (*scrActions)["itemFlipV"]->setToggleAction(true, true);
433 name = "itemLowerToBottom";
434 scrActions->insert(name, new ScrAction("16/go-bottom.png", "22/go-bottom.png", "", defaultKey(name), mainWindow));
435 name = "itemRaiseToTop";
436 scrActions->insert(name, new ScrAction("16/go-top.png", "22/go-top.png", "", defaultKey(name), mainWindow));
437 name = "itemLower";
438 scrActions->insert(name, new ScrAction("16/go-down.png", "22/go-down.png", "", defaultKey(name), mainWindow));
439 name = "itemRaise";
440 scrActions->insert(name, new ScrAction("16/go-up.png", "22/go-up.png", "", defaultKey(name), mainWindow));
441 name = "itemSendToPattern";
442 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
443 name = "itemSendToInline";
444 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
445 name = "itemImageInfo";
446 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
447 name = "itemAttributes";
448 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
449 name = "itemImageIsVisible";
450 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
451 name = "itemUpdateImage";
452 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
453 name = "itemAdjustFrameHeightToText";
454 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
455 name = "itemAdjustFrameToImage";
456 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
457 name = "itemAdjustImageToFrame";
458 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
459 name = "itemExtendedImageProperties";
460 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
461 name = "itemToggleInlineImage";
462 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
463
464 QActionGroup* itemPreviewGroup = new QActionGroup(mainWindow);
465 scrActionGroups->insert("itemPreview", itemPreviewGroup);
466 itemPreviewGroup->setExclusive(true);
467 name = "itemPreviewFull";
468 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), itemPreviewGroup, 0));
469 name = "itemPreviewNormal";
470 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), itemPreviewGroup, 1));
471 name = "itemPreviewLow";
472 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), itemPreviewGroup, 2));
473
474 (*scrActions)["itemImageIsVisible"]->setToggleAction(true);
475 (*scrActions)["itemPreviewFull"]->setToggleAction(true);
476 (*scrActions)["itemPreviewNormal"]->setToggleAction(true);
477 (*scrActions)["itemPreviewLow"]->setToggleAction(true);
478 (*scrActions)["itemToggleInlineImage"]->setToggleAction(true);
479
480 name = "itemPDFIsBookmark";
481 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
482 (*scrActions)["itemPDFIsBookmark"]->setToggleAction(true);
483 name = "itemPDFIsAnnotation";
484 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
485 (*scrActions)["itemPDFIsAnnotation"]->setToggleAction(true);
486 name = "itemPDFAnnotationProps";
487 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
488 name = "itemPDFFieldProps";
489 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
490
491 name = "itemShapeEdit";
492 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
493 (*scrActions)["itemShapeEdit"]->setToggleAction(true);
494 name = "itemAttachTextToPath";
495 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
496 name = "itemDetachTextFromPath";
497 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
498 name = "itemCombinePolygons";
499 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
500 name = "itemSplitPolygons";
501 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
502 name = "itemConvertToBezierCurve";
503 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
504 name = "itemConvertToImageFrame";
505 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
506 name = "itemConvertToOutlines";
507 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
508 name = "itemConvertToPolygon";
509 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
510 name = "itemConvertToTextFrame";
511 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
512 name = "itemConvertToSymbolFrame";
513 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
514
515 name = "itemsUnWeld";
516 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
517 name = "itemWeld";
518 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
519 name = "itemEditWeld";
520 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
521
522 connect( (*scrActions)["itemDuplicate"], SIGNAL(triggered()), mainWindow, SLOT(duplicateItem()) );
523 connect( (*scrActions)["itemMulDuplicate"], SIGNAL(triggered()), mainWindow, SLOT(duplicateItemMulti()) );
524 connect( (*scrActions)["itemTransform"], SIGNAL(triggered()), mainWindow, SLOT(slotItemTransform()) );
525 connect( (*scrActions)["itemGroup"], SIGNAL(triggered()), mainWindow, SLOT(GroupObj()) );
526 connect( (*scrActions)["itemUngroup"], SIGNAL(triggered()), mainWindow, SLOT(UnGroupObj()) );
527 connect( (*scrActions)["itemGroupAdjust"], SIGNAL(triggered()), mainWindow, SLOT(AdjustGroupObj()) );
528 connect( (*scrActions)["itemPDFAnnotationProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
529 connect( (*scrActions)["itemPDFFieldProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
530 connect( (*scrActions)["itemSendToPattern"], SIGNAL(triggered()), mainWindow, SLOT(PutToPatterns()) );
531 connect( (*scrActions)["itemSendToInline"], SIGNAL(triggered()), mainWindow, SLOT(PutToInline()) );
532 connect( (*scrActions)["itemConvertToSymbolFrame"], SIGNAL(triggered()), mainWindow, SLOT(ConvertToSymbol()) );
533 connect( (*scrActions)["itemAttributes"], SIGNAL(triggered()), mainWindow, SLOT(objectAttributes()) );
534 connect( (*scrActions)["itemShapeEdit"], SIGNAL(triggered()), mainWindow, SLOT(toggleNodeEdit()) );
535 connect( (*scrActions)["itemImageInfo"], SIGNAL(triggered()), mainWindow, SLOT(getImageInfo()) );
536 connect( (*scrActions)["itemToggleInlineImage"], SIGNAL(triggered()), mainWindow, SLOT(toogleInlineState()) );
537 }
538
initInsertMenuActions()539 void ActionManager::initInsertMenuActions()
540 {
541 QString name;
542 //Insert Menu
543 name = "insertFrame";
544 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
545 name = "insertGlyph";
546 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
547 (*scrActions)["insertGlyph"]->setToggleAction(true);
548 name = "insertSampleText";
549 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
550 name = "stickyTools";
551 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
552 (*scrActions)["stickyTools"]->setToggleAction(true);
553
554 //Marks
555 name = "insertMarkAnchor";
556 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
557 (*scrActions)[name]->setEnabled(true);
558 name = "insertMarkVariableText";
559 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
560 (*scrActions)[name]->setEnabled(true);
561 name = "insertMarkItem";
562 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
563 (*scrActions)[name]->setEnabled(true);
564 name = "insertMark2Mark";
565 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
566 (*scrActions)[name]->setEnabled(true);
567 name = "insertMarkNote";
568 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
569 (*scrActions)[name]->setEnabled(true);
570 // name = "insertMarkIndex";
571 // scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
572 // (*scrActions)[name]->setEnabled(true);
573 name = "editMark";
574 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
575 (*scrActions)[name]->setEnabled(false);
576 name = "itemUpdateMarks";
577 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
578 (*scrActions)[name]->setEnabled(false);
579
580 connect( (*scrActions)["insertFrame"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertFrame()) );
581 connect( (*scrActions)["insertGlyph"], SIGNAL(triggered()), mainWindow, SLOT(slotCharSelect()) );
582 connect( (*scrActions)["insertSampleText"], SIGNAL(triggered()), mainWindow, SLOT(insertSampleText()) );
583 connect( (*scrActions)["stickyTools"], SIGNAL(triggered()), mainWindow, SLOT(ToggleStickyTools()) );
584
585 connect( (*scrActions)["insertMarkAnchor"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkAnchor()) );
586 connect( (*scrActions)["insertMarkVariableText"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkVariableText()) );
587 connect( (*scrActions)["insertMarkItem"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkItem()) );
588 connect( (*scrActions)["insertMark2Mark"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMark2Mark()) );
589 connect( (*scrActions)["insertMarkNote"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkNote()) );
590 // connect( (*scrActions)["insertMarkIndex"], SIGNAL(triggered()), mainWindow, SLOT(slotInsertMarkIndex()) );
591 connect( (*scrActions)["editMark"], SIGNAL(triggered()), mainWindow, SLOT(slotEditMark()) );
592 connect( (*scrActions)["itemUpdateMarks"], SIGNAL(triggered()), mainWindow, SLOT(slotUpdateMarks()) );
593 }
594
initPageMenuActions()595 void ActionManager::initPageMenuActions()
596 {
597 QString name;
598 //Page menu
599 name = "pageInsert";
600 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
601 name = "pageImport";
602 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
603 name = "pageDelete";
604 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
605 name = "pageCopy";
606 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
607 name = "pageMove";
608 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
609 name = "pageApplyMasterPage";
610 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
611 name = "pageCopyToMasterPage";
612 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
613 name = "pageManageGuides";
614 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
615 (*scrActions)["pageManageGuides"]->setToggleAction(true);
616 name = "pageManageProperties";
617 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
618
619 connect( (*scrActions)["pageInsert"], SIGNAL(triggered()), mainWindow, SLOT(slotNewPageM()) );
620 connect( (*scrActions)["pageImport"], SIGNAL(triggered()), mainWindow, SLOT(slotPageImport()) );
621 connect( (*scrActions)["pageDelete"], SIGNAL(triggered()), mainWindow, SLOT(deletePage()) );
622 connect( (*scrActions)["pageCopy"], SIGNAL(triggered()), mainWindow, SLOT(copyPage()) );
623 connect( (*scrActions)["pageMove"], SIGNAL(triggered()), mainWindow, SLOT(movePage()) );
624 connect( (*scrActions)["pageApplyMasterPage"], SIGNAL(triggered()), mainWindow, SLOT(ApplyMasterPage()) );
625 connect( (*scrActions)["pageCopyToMasterPage"], SIGNAL(triggered()), mainWindow, SLOT(duplicateToMasterPage()) );
626 connect( (*scrActions)["pageManageProperties"], SIGNAL(triggered()), mainWindow, SLOT(changePageProperties()) );
627 }
628
initTableMenuActions()629 void ActionManager::initTableMenuActions()
630 {
631 QString name;
632
633 name = "tableInsertRows";
634 scrActions->insert(name, new ScrAction("16/insert-table-rows.png", "22/insert-table-rows.png", "", defaultKey(name), mainWindow));
635 name = "tableInsertColumns";
636 scrActions->insert(name, new ScrAction("16/insert-table-columns.png", "22/insert-table-columns.png", "", defaultKey(name), mainWindow));
637 name = "tableDeleteRows";
638 scrActions->insert(name, new ScrAction("16/delete-table-rows.png", "22/delete-table-rows.png", "", defaultKey(name), mainWindow));
639 name = "tableDeleteColumns";
640 scrActions->insert(name, new ScrAction("16/delete-table-columns.png", "22/delete-table-columns.png", "", defaultKey(name), mainWindow));
641 name = "tableMergeCells";
642 scrActions->insert(name, new ScrAction("16/merge-table-cells.png", "22/merge-table-cells.png", "", defaultKey(name), mainWindow));
643 name = "tableSplitCells";
644 scrActions->insert(name, new ScrAction("16/split-table-cells.png", "22/split-table-cells.png", "", defaultKey(name), mainWindow));
645 name = "tableSetRowHeights";
646 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
647 name = "tableSetColumnWidths";
648 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
649 name = "tableDistributeRowsEvenly";
650 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
651 name = "tableDistributeColumnsEvenly";
652 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
653 name = "tableAdjustFrameToTable";
654 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
655 name = "tableAdjustTableToFrame";
656 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
657 }
658
initViewMenuActions()659 void ActionManager::initViewMenuActions()
660 {
661 QString name;
662 name = "viewFitInWindow";
663 scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QString(), QString(), "", defaultKey(name), mainWindow, -100.0));
664 name = "viewFitWidth";
665 scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QString(), QString(), "", defaultKey(name), mainWindow, -200.0));
666 name = "viewFit50";
667 scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QString(), QString(), "", defaultKey(name), mainWindow, 50.0));
668 name = "viewFit75";
669 scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QString(), QString(), "", defaultKey(name), mainWindow, 75.0));
670 name = "viewFit100";
671 scrActions->insert(name, new ScrAction(ScrAction::DataDouble, "16/zoom-original.png", "22/zoom-original.png", "", defaultKey(name), mainWindow, 100.0));
672 name = "viewFit200";
673 scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QString(), QString(), "", defaultKey(name), mainWindow, 200.0));
674 name = "viewFit400";
675 scrActions->insert(name, new ScrAction(ScrAction::DataDouble, QString(), QString(), "", defaultKey(name), mainWindow, 400.0));
676 name = "viewPreviewMode";
677 scrActions->insert(name, new ScrAction("previewOn.png", "previewOn.png", "", defaultKey(name), mainWindow));
678 name = "viewEditInPreview";
679 scrActions->insert(name, new ScrAction("16/editdoc.png", "16/editdoc.png", "", defaultKey(name), mainWindow));
680 name = "viewToggleCMS";
681 scrActions->insert(name, new ScrAction("cmsOn.png", "cmsOn.png", "", defaultKey(name), mainWindow));
682 name = "viewShowMargins";
683 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
684 name = "viewShowBleeds";
685 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
686 name = "viewShowFrames";
687 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
688 name = "viewShowLayerMarkers";
689 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
690 name = "viewShowImages";
691 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
692 name = "viewShowGrid";
693 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
694 name = "viewShowGuides";
695 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
696 name = "viewShowColumnBorders";
697 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
698 name = "viewShowBaseline";
699 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
700 name = "viewShowTextChain";
701 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
702 name = "viewShowTextControls";
703 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
704 name = "viewShowRulers";
705 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
706 name = "viewRulerMode";
707 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
708 name = "viewSnapToGrid";
709 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
710 name = "viewSnapToGuides";
711 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
712 name = "viewSnapToElements";
713 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
714 name = "viewShowContextMenu";
715 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
716 name = "showMouseCoordinates";
717 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
718
719 name = "viewToggleCM";
720 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
721 // name = "viewVisionNormal";
722 // name = "viewVisionProtanopia";
723 // name = "viewVisionDeuteranopia";
724 // name = "viewVisionTritanopia";
725 // name = "viewVisionFullColorBlind";
726
727 // scrActions->insert("viewNewView", new ScrAction("", defaultKey(name), mainWindow));
728
729 (*scrActions)["viewPreviewMode"]->setToggleAction(true);
730 (*scrActions)["viewEditInPreview"]->setToggleAction(true);
731 (*scrActions)["viewToggleCMS"]->setToggleAction(true);
732 (*scrActions)["viewShowMargins"]->setToggleAction(true);
733 (*scrActions)["viewShowBleeds"]->setToggleAction(true);
734 (*scrActions)["viewShowFrames"]->setToggleAction(true);
735 (*scrActions)["viewShowLayerMarkers"]->setToggleAction(true);
736 (*scrActions)["viewShowImages"]->setToggleAction(true);
737 (*scrActions)["viewShowGrid"]->setToggleAction(true);
738 (*scrActions)["viewShowGuides"]->setToggleAction(true);
739 (*scrActions)["viewShowColumnBorders"]->setToggleAction(true);
740 (*scrActions)["viewShowBaseline"]->setToggleAction(true);
741 (*scrActions)["viewShowTextChain"]->setToggleAction(true);
742 (*scrActions)["viewShowTextControls"]->setToggleAction(true);
743 (*scrActions)["viewShowRulers"]->setToggleAction(true);
744 (*scrActions)["viewRulerMode"]->setToggleAction(true);
745 (*scrActions)["viewSnapToGrid"]->setToggleAction(true);
746 (*scrActions)["viewSnapToGuides"]->setToggleAction(true);
747 (*scrActions)["viewSnapToElements"]->setToggleAction(true);
748 (*scrActions)["showMouseCoordinates"]->setToggleAction(true);
749
750 (*scrActions)["viewPreviewMode"]->setChecked(false);
751 (*scrActions)["viewEditInPreview"]->setChecked(false);
752 (*scrActions)["viewToggleCMS"]->setChecked(false);
753 (*scrActions)["viewShowMargins"]->setChecked(true);
754 (*scrActions)["viewShowBleeds"]->setChecked(true);
755 (*scrActions)["viewShowFrames"]->setChecked(true);
756 (*scrActions)["viewShowLayerMarkers"]->setChecked(false);
757 (*scrActions)["viewShowImages"]->setChecked(true);
758 (*scrActions)["viewShowGuides"]->setChecked(true);
759 (*scrActions)["viewShowColumnBorders"]->setChecked(false);
760 (*scrActions)["viewShowRulers"]->setChecked(true);
761 (*scrActions)["viewRulerMode"]->setChecked(true);
762 (*scrActions)["showMouseCoordinates"]->setChecked(true);
763
764 connect( (*scrActions)["viewFitInWindow"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
765 connect( (*scrActions)["viewFitWidth"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
766 connect( (*scrActions)["viewFit50"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
767 connect( (*scrActions)["viewFit75"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
768 connect( (*scrActions)["viewFit100"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
769 connect( (*scrActions)["viewFit200"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
770 connect( (*scrActions)["viewFit400"], SIGNAL(triggeredData(double)), mainWindow, SLOT(slotZoom(double)) );
771 connect( (*scrActions)["viewShowMargins"], SIGNAL(triggered()), mainWindow, SLOT(toggleMarks()) );
772 connect( (*scrActions)["viewShowBleeds"], SIGNAL(triggered()), mainWindow, SLOT(toggleBleeds()) );
773 connect( (*scrActions)["viewShowFrames"], SIGNAL(triggered()), mainWindow, SLOT(toggleFrames()) );
774 connect( (*scrActions)["viewShowLayerMarkers"], SIGNAL(triggered()), mainWindow, SLOT(toggleLayerMarkers()) );
775 connect( (*scrActions)["viewShowImages"], SIGNAL(triggered()), mainWindow, SLOT(toggleImageVisibility()) );
776 connect( (*scrActions)["viewShowGrid"], SIGNAL(triggered()), mainWindow, SLOT(toggleGrid()) );
777 connect( (*scrActions)["viewShowGuides"], SIGNAL(triggered()), mainWindow, SLOT(toggleGuides()) );
778 connect( (*scrActions)["viewShowColumnBorders"], SIGNAL(triggered()), mainWindow, SLOT(toggleColumnBorders()) );
779 connect( (*scrActions)["viewShowBaseline"], SIGNAL(triggered()), mainWindow, SLOT(toggleBase()) );
780 connect( (*scrActions)["viewShowTextChain"], SIGNAL(triggered()), mainWindow, SLOT(toggleTextLinks()) );
781 connect( (*scrActions)["viewShowTextControls"], SIGNAL(triggered()), mainWindow, SLOT(toggleTextControls()) );
782 connect( (*scrActions)["viewShowRulers"], SIGNAL(triggered()), mainWindow, SLOT(toggleRulers()) );
783 connect( (*scrActions)["viewRulerMode"], SIGNAL(triggered()), mainWindow, SLOT(toggleRulerMode()) );
784 connect( (*scrActions)["viewSnapToGrid"], SIGNAL(triggered()), mainWindow, SLOT(toggleSnapGrid()) );
785 connect( (*scrActions)["viewSnapToGuides"], SIGNAL(triggered()), mainWindow, SLOT(toggleSnapGuides()) );
786 connect( (*scrActions)["viewSnapToElements"], SIGNAL(triggered()), mainWindow, SLOT(toggleSnapElements()) );
787 connect( (*scrActions)["showMouseCoordinates"], SIGNAL(triggered()), mainWindow, SLOT(ToggleMouseTips()) );
788 // connect( (*scrActions)["viewNewView"], SIGNAL(triggered()), mainWindow, SLOT(newView()) );
789
790 }
791
initToolsMenuActions()792 void ActionManager::initToolsMenuActions()
793 {
794 QString name;
795 //Tool menu
796 name = "toolsProperties";
797 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
798 name="toolsContent";
799 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
800 name = "toolsOutline";
801 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
802 name = "toolsScrapbook";
803 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
804 name = "toolsLayers";
805 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
806 name = "toolsPages";
807 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
808 name = "toolsBookmarks";
809 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
810 name = "toolsDownloads";
811 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
812 name = "toolsResources";
813 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
814 name = "toolsMeasurements";
815 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/measure.png", "22/measure.png", "", defaultKey(name), mainWindow, modeMeasurementTool));
816 name = "toolsActionHistory";
817 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
818 name = "toolsPreflightVerifier";
819 scrActions->insert(name, new ScrAction("16/preflight-verifier.png", "22/preflight-verifier.png","", defaultKey(name), mainWindow));
820 name = "toolsAlignDistribute";
821 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
822 name = "toolsSymbols";
823 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
824 name = "toolsInline";
825 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
826 name = "toolsToolbarTools";
827 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
828 name = "toolsToolbarPDF";
829 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
830 name = "toolsToolbarView";
831 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
832
833 //toolbar only items
834 name = "toolsSelect";
835 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/pointer.png", "22/pointer.png", "", defaultKey(name), mainWindow, modeNormal));
836 name = "toolsInsertTextFrame";
837 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/insert-text-frame.png", "22/insert-text-frame.png", "", defaultKey(name), mainWindow, modeDrawText));
838 name = "toolsInsertImageFrame";
839 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/insert-image.png", "22/insert-image.png", "", defaultKey(name), mainWindow, modeDrawImage));
840 name = "toolsInsertRenderFrame";
841 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/insert-renderframe.png", "22/insert-renderframe.png", "", defaultKey(name), mainWindow, modeDrawLatex));
842 name = "toolsInsertTable";
843 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/insert-table.png", "22/insert-table.png", "", defaultKey(name), mainWindow, modeDrawTable2));
844 name = "toolsInsertShape";
845 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), mainWindow, modeDrawShapes));
846 name = "toolsInsertPolygon";
847 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/draw-polygon.png", "22/draw-polygon.png", "", defaultKey(name), mainWindow, modeDrawRegularPolygon));
848 name = "toolsInsertArc";
849 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/draw-arc.png", "22/draw-arc.png", "", defaultKey(name), mainWindow, modeDrawArc));
850 name = "toolsInsertSpiral";
851 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/draw-spiral.png", "22/draw-spiral.png", "", defaultKey(name), mainWindow, modeDrawSpiral));
852 name = "toolsInsertLine";
853 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "Stift16.png", "stift.png", "", defaultKey(name), mainWindow, modeDrawLine));
854 name = "toolsInsertBezier";
855 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/draw-path.png", "22/draw-path.png", "", defaultKey(name), mainWindow, modeDrawBezierLine));
856 name = "toolsInsertFreehandLine";
857 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/draw-freehand.png", "22/draw-freehand.png", "", defaultKey(name), mainWindow, modeDrawFreehandLine));
858 name = "toolsInsertCalligraphicLine";
859 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/draw-calligraphic.png", "22/draw-calligraphic.png", "", defaultKey(name), mainWindow, modeDrawCalligraphicLine));
860 name = "toolsRotate";
861 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/transform-rotate.png", "22/transform-rotate.png", "", defaultKey(name), mainWindow, modeRotation));
862 name = "toolsZoom";
863 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/zoom.png", "22/zoom.png", "", defaultKey(name), mainWindow, modeMagnifier));
864 name = "toolsZoomIn";
865 scrActions->insert(name, new ScrAction("16/zoom-in.png", "22/zoom-in.png", "", defaultKey(name), mainWindow));
866 name = "toolsZoomOut";
867 scrActions->insert(name, new ScrAction("16/zoom-out.png", "22/zoom-out.png", "", defaultKey(name), mainWindow));
868 name = "toolsEditContents";
869 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "Editm16.png", "editm.png", "", defaultKey(name), mainWindow, modeEdit));
870 name = "toolsEditWithStoryEditor";
871 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/story-editor.png", "22/story-editor.png", "", defaultKey(name), mainWindow, modeStoryEditor));
872 name = "toolsLinkTextFrame";
873 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/text-frame-link.png", "22/text-frame-link.png", "", defaultKey(name), mainWindow, modeLinkFrames));
874 name = "toolsUnlinkTextFrame";
875 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/text-frame-unlink.png", "22/text-frame-unlink.png", "", defaultKey(name), mainWindow, modeUnlinkFrames));
876 name = "toolsEyeDropper";
877 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/color-picker.png", "22/color-picker.png", "", defaultKey(name), mainWindow, modeEyeDropper));
878 name = "toolsCopyProperties";
879 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "wizard16.png", "wizard.png", "", defaultKey(name), mainWindow, modeCopyProperties));
880 name = "toolsUnlinkTextFrameAndCutText";
881 scrActions->insert(name, new ScrAction(ScrAction::DataInt, QString(), QString(), "", defaultKey(name), mainWindow, modeUnlinkFrames));
882
883 //PDF toolbar
884 name = "toolsPDFPushButton";
885 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/insert-button.png", "22/insert-button.png", "", defaultKey(name), mainWindow, modeInsertPDFButton));
886 name = "toolsPDFRadioButton";
887 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/radiobutton.png", "22/radiobutton.png", "", defaultKey(name), mainWindow, modeInsertPDFRadioButton));
888 name = "toolsPDFTextField";
889 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/text-field.png", "22/text-field.png", "", defaultKey(name), mainWindow, modeInsertPDFTextfield));
890 name = "toolsPDFCheckBox";
891 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/checkbox.png", "22/checkbox.png", "", defaultKey(name), mainWindow, modeInsertPDFCheckbox));
892 name = "toolsPDFComboBox";
893 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/combobox.png", "22/combobox.png", "", defaultKey(name), mainWindow, modeInsertPDFCombobox));
894 name = "toolsPDFListBox";
895 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/list-box.png", "22/list-box.png", "", defaultKey(name), mainWindow, modeInsertPDFListbox));
896 name = "toolsPDFAnnotText";
897 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/pdf-annotations.png", "22/pdf-annotations.png", "", defaultKey(name), mainWindow, modeInsertPDFTextAnnotation));
898 name = "toolsPDFAnnotLink";
899 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "goto16.png", "goto.png", "", defaultKey(name), mainWindow, modeInsertPDFLinkAnnotation));
900 #ifdef HAVE_OSG
901 name = "toolsPDFAnnot3D";
902 scrActions->insert(name, new ScrAction(ScrAction::DataInt, "16/annot3d.png", "22/annot3d.png", "", defaultKey(name), mainWindow, modeInsertPDF3DAnnotation));
903 #endif
904 //Set the applicaton wide palette shortcuts
905 (*scrActions)["toolsProperties"]->setShortcutContext(Qt::ApplicationShortcut);
906 (*scrActions)["toolsContent"]->setShortcutContext(Qt::ApplicationShortcut);
907 (*scrActions)["toolsScrapbook"]->setShortcutContext(Qt::ApplicationShortcut);
908 (*scrActions)["toolsLayers"]->setShortcutContext(Qt::ApplicationShortcut);
909 (*scrActions)["toolsPages"]->setShortcutContext(Qt::ApplicationShortcut);
910 (*scrActions)["toolsBookmarks"]->setShortcutContext(Qt::ApplicationShortcut);
911 (*scrActions)["toolsDownloads"]->setShortcutContext(Qt::ApplicationShortcut);
912 (*scrActions)["toolsActionHistory"]->setShortcutContext(Qt::ApplicationShortcut);
913 (*scrActions)["toolsPreflightVerifier"]->setShortcutContext(Qt::ApplicationShortcut);
914 (*scrActions)["toolsAlignDistribute"]->setShortcutContext(Qt::ApplicationShortcut);
915 (*scrActions)["toolsSymbols"]->setShortcutContext(Qt::ApplicationShortcut);
916 (*scrActions)["toolsInline"]->setShortcutContext(Qt::ApplicationShortcut);
917
918
919 (*scrActions)["toolsProperties"]->setToggleAction(true);
920 (*scrActions)["toolsContent"]->setToggleAction(true);
921 (*scrActions)["toolsOutline"]->setToggleAction(true);
922 (*scrActions)["toolsScrapbook"]->setToggleAction(true);
923 (*scrActions)["toolsLayers"]->setToggleAction(true);
924 (*scrActions)["toolsPages"]->setToggleAction(true);
925 (*scrActions)["toolsBookmarks"]->setToggleAction(true);
926 (*scrActions)["toolsDownloads"]->setToggleAction(true);
927 (*scrActions)["toolsMeasurements"]->setToggleAction(true);
928 (*scrActions)["toolsActionHistory"]->setToggleAction(true);
929 (*scrActions)["toolsPreflightVerifier"]->setToggleAction(true);
930 (*scrActions)["toolsAlignDistribute"]->setToggleAction(true);
931 (*scrActions)["toolsSymbols"]->setToggleAction(true);
932 (*scrActions)["toolsInline"]->setToggleAction(true);
933 (*scrActions)["toolsToolbarTools"]->setToggleAction(true);
934 (*scrActions)["toolsToolbarPDF"]->setToggleAction(true);
935 (*scrActions)["toolsToolbarView"]->setToggleAction(true);
936
937 *modeActionNames << "toolsSelect" << "toolsInsertTextFrame" << "toolsInsertImageFrame" << "toolsInsertTable";
938 *modeActionNames << "toolsInsertShape" << "toolsInsertPolygon" << "toolsInsertArc" << "toolsInsertSpiral" << "toolsInsertLine" << "toolsInsertBezier";
939 *modeActionNames << "toolsInsertFreehandLine" << "toolsInsertCalligraphicLine" << "toolsInsertRenderFrame" << "toolsRotate" << "toolsZoom" << "toolsEditContents";
940 *modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame"; //<< "toolsUnlinkTextFrameAndCutText";
941 *modeActionNames << "toolsEyeDropper" << "toolsCopyProperties";
942 *modeActionNames << "toolsPDFPushButton" << "toolsPDFRadioButton" << "toolsPDFTextField" << "toolsPDFCheckBox" << "toolsPDFComboBox" << "toolsPDFListBox" << "toolsPDFAnnotText" << "toolsPDFAnnotLink";
943 #ifdef HAVE_OSG
944 *modeActionNames << "toolsPDFAnnot3D";
945 #endif
946 for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
947 {
948 (*scrActions)[*it]->setEnabled(false);
949 (*scrActions)[*it]->setToggleAction(true);
950 }
951
952
953 *nonEditActionNames << "itemLowerToBottom" << "itemRaiseToTop" << "itemRaise" << "itemLower";
954
955 connect( (*scrActions)["toolsActionHistory"], SIGNAL(toggled(bool)), mainWindow, SLOT(setUndoPalette(bool)) );
956 connect( (*scrActions)["toolsResources"], SIGNAL(triggered()), mainWindow, SLOT(slotResourceManager()) );
957 connectModeActions();
958 }
959
initExtrasMenuActions()960 void ActionManager::initExtrasMenuActions()
961 {
962 QString name;
963 name = "extrasManageImages";
964 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
965 name = "extrasHyphenateText";
966 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
967 name = "extrasDeHyphenateText";
968 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
969 name = "extrasGenerateTableOfContents";
970 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
971 name = "extrasUpdateDocument";
972 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
973 connect( (*scrActions)["extrasManageImages"], SIGNAL(triggered()), mainWindow, SLOT(StatusPic()) );
974 connect( (*scrActions)["extrasGenerateTableOfContents"], SIGNAL(triggered()), mainWindow, SLOT(generateTableOfContents()) );
975 connect( (*scrActions)["extrasUpdateDocument"], SIGNAL(triggered()), mainWindow, SLOT(updateDocument()) );
976 }
977
978
initWindowsMenuActions()979 void ActionManager::initWindowsMenuActions()
980 {
981 QString name;
982 name = "windowsCascade";
983 scrActions->insert(name, new ScrAction( "", defaultKey(name), mainWindow));
984 name = "windowsTile";
985 scrActions->insert(name, new ScrAction( "", defaultKey(name), mainWindow));
986 }
987
initScriptMenuActions()988 void ActionManager::initScriptMenuActions()
989 {
990 }
991
initHelpMenuActions()992 void ActionManager::initHelpMenuActions()
993 {
994 QString name;
995 name = "helpAboutScribus";
996 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
997 (*scrActions)[name]->setMenuRole(QAction::AboutRole);
998 name = "helpAboutPlugins";
999 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1000 (*scrActions)[name]->setMenuRole(QAction::ApplicationSpecificRole);
1001 name = "helpAboutQt";
1002 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1003 (*scrActions)[name]->setMenuRole(QAction::AboutQtRole);
1004 name = "helpActionSearch";
1005 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1006 name = "helpTooltips";
1007 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1008 name = "helpManual";
1009 scrActions->insert(name, new ScrAction("16/help-browser.png", QString(), "", defaultKey(name), mainWindow));
1010 name = "helpOnlineWWW";
1011 scrActions->insert(name, new ScrAction(ScrAction::DataQString, QString(), QString(), "", defaultKey(name), mainWindow, "http://www.scribus.net"));
1012 name = "helpOnlineDocs";
1013 scrActions->insert(name, new ScrAction(ScrAction::DataQString, QString(), QString(), "", defaultKey(name), mainWindow, "http://docs.scribus.net"));
1014 name = "helpOnlineWiki";
1015 scrActions->insert(name, new ScrAction(ScrAction::DataQString, QString(), QString(), "", defaultKey(name), mainWindow, "http://wiki.scribus.net"));
1016 name = "helpOnlineTutorial1";
1017 scrActions->insert(name, new ScrAction(ScrAction::DataQString, QString(), QString(), "", defaultKey(name), mainWindow, ""));
1018 name = "helpChat";
1019 scrActions->insert(name, new ScrAction(ScrAction::DataQString, QString(), QString(), "", defaultKey(name), mainWindow, "http://webchat.freenode.net/?channels=scribus"));
1020 name = "helpCheckUpdates";
1021 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1022
1023 (*scrActions)["helpTooltips"]->setToggleAction(true);
1024 (*scrActions)["helpTooltips"]->setChecked(true);
1025
1026 connect( (*scrActions)["helpAboutScribus"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpAbout()) );
1027 connect( (*scrActions)["helpAboutPlugins"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpAboutPlugins()) );
1028 connect( (*scrActions)["helpAboutQt"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpAboutQt()) );
1029 connect( (*scrActions)["helpActionSearch"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpActionSearch()) );
1030 connect( (*scrActions)["helpTooltips"], SIGNAL(triggered()), mainWindow, SLOT(ToggleTips()) );
1031 connect( (*scrActions)["helpManual"], SIGNAL(triggered()), mainWindow, SLOT(slotOnlineHelp()) );
1032 connect( (*scrActions)["helpCheckUpdates"], SIGNAL(triggered()), mainWindow, SLOT(slotHelpCheckUpdates()) );
1033 UrlLauncher& ul=UrlLauncher::instance();
1034 connect( (*scrActions)["helpOnlineWWW"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1035 connect( (*scrActions)["helpOnlineDocs"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1036 connect( (*scrActions)["helpOnlineWiki"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1037 connect( (*scrActions)["helpOnlineTutorial1"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1038 connect( (*scrActions)["helpChat"], SIGNAL(triggeredData(QString)), &ul, SLOT(launchUrlExt(QString)) );
1039 }
1040
initUnicodeActions(QMap<QString,QPointer<ScrAction>> * actionMap,QWidget * actionParent,QStringList * actionNamesList)1041 void ActionManager::initUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap, QWidget *actionParent, QStringList *actionNamesList)
1042 {
1043 QString name;
1044 //typography
1045 name = "unicodeZWNJ";
1046 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWNJ.unicode()));
1047 name = "unicodeZWJ";
1048 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWJ.unicode()));
1049 name = "unicodeSoftHyphen";
1050 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::SHYPHEN.unicode()));
1051 name = "unicodeNonBreakingHyphen";
1052 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBHYPHEN.unicode()));
1053 name = "unicodeNonBreakingSpace";
1054 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::NBSPACE.unicode()));
1055 name = "unicodeNarrowNoBreakSpace";
1056 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x202F));
1057 name = "unicodePageNumber";
1058 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGENUMBER.unicode()));
1059 name = "unicodePageCount";
1060 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::PAGECOUNT.unicode()));
1061 //Spaces
1062 name = "unicodeSpaceEN";
1063 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2002));
1064 name = "unicodeSpaceEM";
1065 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2003));
1066 name = "unicodeSpaceThin";
1067 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2009));
1068 name = "unicodeSpaceThick";
1069 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2004));
1070 name = "unicodeSpaceMid";
1071 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2005));
1072 name = "unicodeSpaceHair";
1073 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x200A));
1074 //Breaks
1075 name = "unicodeNewLine";
1076 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::LINEBREAK.unicode()));
1077 name = "unicodeFrameBreak";
1078 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::FRAMEBREAK.unicode()));
1079 name = "unicodeColumnBreak";
1080 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::COLBREAK.unicode()));
1081 name = "unicodeZerowidthSpace";
1082 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWSPACE.unicode()));
1083 name = "unicodeZerowidthNonBreakingSpace";
1084 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, SpecialChars::ZWNBSPACE.unicode()));
1085 //Special
1086 name = "unicodeCopyRight";
1087 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0A9));
1088 name = "unicodeRegdTM";
1089 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AE));
1090 name = "unicodeTM";
1091 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2122));
1092 name = "unicodeBullet";
1093 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2022));
1094 name = "unicodeMidpoint";
1095 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00B7));
1096 name = "unicodeSolidus";
1097 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2044));
1098 //Dashes
1099 name = "unicodeDashEm";
1100 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2014));
1101 name = "unicodeDashEn";
1102 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2013));
1103 name = "unicodeDashFigure";
1104 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2012));
1105 name = "unicodeDashQuotation";
1106 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2015));
1107 //Quotes
1108 name = "unicodeQuoteApostrophe";
1109 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0027));
1110 name = "unicodeQuoteStraight";
1111 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x0022));
1112 name = "unicodeQuoteSingleLeft";
1113 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2018));
1114 name = "unicodeQuoteSingleRight";
1115 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2019));
1116 name = "unicodeQuoteDoubleLeft";
1117 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201C));
1118 name = "unicodeQuoteDoubleRight";
1119 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201D));
1120 name = "unicodeQuoteSingleReversed";
1121 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201B));
1122 name = "unicodeQuoteDoubleReversed";
1123 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201F));
1124 name = "unicodeQuoteSingleLeftGuillemet";
1125 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x2039));
1126 name = "unicodeQuoteSingleRightGuillemet";
1127 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x203A));
1128 name = "unicodeQuoteDoubleLeftGuillemet";
1129 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00AB));
1130 name = "unicodeQuoteDoubleRightGuillemet";
1131 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x00BB));
1132 name = "unicodeQuoteLowSingleComma";
1133 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201A));
1134 name = "unicodeQuoteLowDoubleComma";
1135 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x201E));
1136 name = "unicodeQuoteCJKSingleLeft";
1137 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300C));
1138 name = "unicodeQuoteCJKSingleRight";
1139 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300D));
1140 name = "unicodeQuoteCJKDoubleLeft";
1141 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300E));
1142 name = "unicodeQuoteCJKDoubleRight";
1143 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0x300F));
1144 //Ligatures
1145 name = "unicodeLigature_ff";
1146 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB00));
1147 name = "unicodeLigature_fi";
1148 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB01));
1149 name = "unicodeLigature_fl";
1150 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB02));
1151 name = "unicodeLigature_ffi";
1152 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB03));
1153 name = "unicodeLigature_ffl";
1154 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB04));
1155 name = "unicodeLigature_ft";
1156 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB05));
1157 name = "unicodeLigature_st";
1158 actionMap->insert(name, new ScrAction(defaultKey(name), actionParent, 0xFB06));
1159
1160 //Spaces and special characters
1161
1162 *actionNamesList << "unicodeZWNJ" << "unicodeZWJ";
1163 *actionNamesList << "unicodeSoftHyphen" << "unicodeNonBreakingHyphen" << "unicodeNonBreakingSpace" << "unicodeNarrowNoBreakSpace" << "unicodePageNumber" << "unicodePageCount";
1164 *actionNamesList << "unicodeSpaceEN" << "unicodeSpaceEM" << "unicodeSpaceThin" << "unicodeSpaceThick" << "unicodeSpaceMid" << "unicodeSpaceHair";
1165 //Breaks
1166 *actionNamesList << "unicodeNewLine" << "unicodeFrameBreak" << "unicodeColumnBreak" << "unicodeZerowidthSpace";
1167 //Copyrights and TMs
1168 *actionNamesList << "unicodeCopyRight" << "unicodeRegdTM" << "unicodeTM";
1169 //Slashes
1170 *actionNamesList << "unicodeSolidus";
1171 //Bullets
1172 *actionNamesList << "unicodeBullet" << "unicodeMidpoint";
1173 //Dashes
1174 *actionNamesList << "unicodeDashEm" << "unicodeDashEn" << "unicodeDashFigure" << "unicodeDashQuotation";
1175 //Straight quotes
1176 *actionNamesList << "unicodeQuoteApostrophe" << "unicodeQuoteStraight";
1177 //Double quotes
1178 *actionNamesList << "unicodeQuoteDoubleLeft" << "unicodeQuoteDoubleRight" << "unicodeQuoteSingleLeft" << "unicodeQuoteSingleRight";
1179 //Alternative single quotes
1180 *actionNamesList << "unicodeQuoteSingleReversed" << "unicodeQuoteDoubleReversed";
1181 //French quotes
1182 *actionNamesList << "unicodeQuoteSingleLeftGuillemet" << "unicodeQuoteSingleRightGuillemet" << "unicodeQuoteDoubleLeftGuillemet" << "unicodeQuoteDoubleRightGuillemet";
1183 //German quotes
1184 *actionNamesList << "unicodeQuoteLowSingleComma" << "unicodeQuoteLowDoubleComma";
1185 //CJK Quotes
1186 *actionNamesList << "unicodeQuoteCJKSingleLeft" << "unicodeQuoteCJKSingleRight" << "unicodeQuoteCJKDoubleLeft" << "unicodeQuoteCJKDoubleRight";
1187 //Ligatures
1188 *actionNamesList << "unicodeLigature_ff" << "unicodeLigature_fi" << "unicodeLigature_fl" << "unicodeLigature_ffi" << "unicodeLigature_ffl" << "unicodeLigature_ft" << "unicodeLigature_st";
1189 for ( QStringList::Iterator it = actionNamesList->begin(); it != actionNamesList->end(); ++it )
1190 connect( (*actionMap)[*it], SIGNAL(triggeredUnicodeShortcut(int)), actionParent, SLOT(specialActionKeyEvent(int)) );
1191 }
1192
initSpecialActions()1193 void ActionManager::initSpecialActions()
1194 {
1195 QString name;
1196 //GUI
1197 name = "specialToggleAllPalettes";
1198 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1199 name = "specialToggleAllGuides";
1200 scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
1201 name = "specialUnicodeSequenceBegin";
1202 scrActions->insert(name, new ScrAction( "", defaultKey(name), mainWindow));
1203 connect( (*scrActions)["specialToggleAllPalettes"], SIGNAL(triggered()), mainWindow, SLOT(ToggleAllPalettes()) );
1204 connect( (*scrActions)["specialToggleAllGuides"], SIGNAL(triggered()), mainWindow, SLOT(ToggleAllGuides()) );
1205 }
1206
setActionTooltips(QMap<QString,QPointer<ScrAction>> * actionMap)1207 void ActionManager::setActionTooltips(QMap<QString, QPointer<ScrAction> > *actionMap)
1208 {
1209 for( QMap<QString, QPointer<ScrAction> >::Iterator it = actionMap->begin(); it!=actionMap->end(); ++it )
1210 it.value()->setToolTipFromTextAndShortcut();
1211 }
1212
disconnectModeActions()1213 void ActionManager::disconnectModeActions()
1214 {
1215 for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
1216 disconnect( (*scrActions)[*it], SIGNAL(toggledData(bool,int)) , mainWindow, SLOT(setAppModeByToggle(bool,int)) );
1217 }
1218
connectModeActions()1219 void ActionManager::connectModeActions()
1220 {
1221 for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
1222 connect( (*scrActions)[*it], SIGNAL(toggledData(bool,int)) , mainWindow, SLOT(setAppModeByToggle(bool,int)) );
1223 }
1224
disconnectNewDocActions()1225 void ActionManager::disconnectNewDocActions()
1226 {
1227 (*scrActions)["tableInsertRows"]->disconnect();
1228 (*scrActions)["tableInsertColumns"]->disconnect();
1229 (*scrActions)["tableDeleteRows"]->disconnect();
1230 (*scrActions)["tableDeleteColumns"]->disconnect();
1231 (*scrActions)["tableMergeCells"]->disconnect();
1232 (*scrActions)["tableSplitCells"]->disconnect();
1233 (*scrActions)["tableSetRowHeights"]->disconnect();
1234 (*scrActions)["tableSetColumnWidths"]->disconnect();
1235 (*scrActions)["tableDistributeRowsEvenly"]->disconnect();
1236 (*scrActions)["tableDistributeColumnsEvenly"]->disconnect();
1237 (*scrActions)["tableAdjustFrameToTable"]->disconnect();
1238 (*scrActions)["tableAdjustTableToFrame"]->disconnect();
1239 (*scrActions)["itemAdjustFrameHeightToText"]->disconnect();
1240 (*scrActions)["itemAdjustFrameToImage"]->disconnect();
1241 (*scrActions)["itemAdjustImageToFrame"]->disconnect();
1242 (*scrActions)["itemLock"]->disconnect();
1243 (*scrActions)["itemLockSize"]->disconnect();
1244 (*scrActions)["itemPrintingEnabled"]->disconnect();
1245 (*scrActions)["itemFlipH"]->disconnect();
1246 (*scrActions)["itemFlipV"]->disconnect();
1247 (*scrActions)["itemCombinePolygons"]->disconnect();
1248 (*scrActions)["itemSplitPolygons"]->disconnect();
1249 (*scrActions)["itemUpdateImage"]->disconnect();
1250 (*scrActions)["itemDelete"]->disconnect();
1251 (*scrActions)["extrasHyphenateText"]->disconnect();
1252 (*scrActions)["extrasDeHyphenateText"]->disconnect();
1253 (*scrActions)["itemsUnWeld"]->disconnect();
1254 (*scrActions)["itemWeld"]->disconnect();
1255 (*scrActions)["itemEditWeld"]->disconnect();
1256 (*scrActions)["itemLowerToBottom"]->disconnect();
1257 (*scrActions)["itemRaiseToTop"]->disconnect();
1258 (*scrActions)["itemLower"]->disconnect();
1259 (*scrActions)["itemRaise"]->disconnect();
1260 (*scrActions)["toolsUnlinkTextFrameAndCutText"]->disconnect();
1261 }
1262
connectNewDocActions(ScribusDoc * currDoc)1263 void ActionManager::connectNewDocActions(ScribusDoc *currDoc)
1264 {
1265 if (currDoc==nullptr)
1266 return;
1267 connect( (*scrActions)["itemLock"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_ToggleLock()) );
1268 connect( (*scrActions)["itemLockSize"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_ToggleSizeLock()));
1269 connect( (*scrActions)["itemPrintingEnabled"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_TogglePrintEnabled()));
1270 connect( (*scrActions)["itemFlipH"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_FlipH()));
1271 connect( (*scrActions)["itemFlipV"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_FlipV()));
1272 connect( (*scrActions)["itemCombinePolygons"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UniteItems()) );
1273 connect( (*scrActions)["itemSplitPolygons"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SplitItems()) );
1274 connect( (*scrActions)["itemUpdateImage"], SIGNAL(triggered()), currDoc, SLOT(updatePic()) );
1275 connect( (*scrActions)["extrasHyphenateText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DoHyphenate()) );
1276 connect( (*scrActions)["extrasDeHyphenateText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DoDeHyphenate()) );
1277 connect( (*scrActions)["itemDelete"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DeleteItem()) );
1278 connect( (*scrActions)["tableInsertRows"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_InsertTableRows()));
1279 connect( (*scrActions)["tableInsertColumns"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_InsertTableColumns()));
1280 connect( (*scrActions)["tableDeleteRows"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DeleteTableRows()));
1281 connect( (*scrActions)["tableDeleteColumns"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DeleteTableColumns()));
1282 connect( (*scrActions)["tableMergeCells"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_MergeTableCells()));
1283 connect( (*scrActions)["tableSplitCells"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SplitTableCells()));
1284 connect( (*scrActions)["tableSetRowHeights"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SetTableRowHeights()));
1285 connect( (*scrActions)["tableSetColumnWidths"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_SetTableColumnWidths()));
1286 connect( (*scrActions)["tableDistributeRowsEvenly"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DistributeTableRowsEvenly()));
1287 connect( (*scrActions)["tableDistributeColumnsEvenly"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_DistributeTableColumnsEvenly()));
1288 connect( (*scrActions)["tableAdjustFrameToTable"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustFrameToTable()));
1289 connect( (*scrActions)["tableAdjustTableToFrame"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustTableToFrame()));
1290 connect( (*scrActions)["itemAdjustFrameHeightToText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustFrameHeightToText()) );
1291 connect( (*scrActions)["itemAdjustFrameToImage"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustFrametoImageSize()) );
1292 connect( (*scrActions)["itemAdjustImageToFrame"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_AdjustImagetoFrameSize()) );
1293 connect( (*scrActions)["itemsUnWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnWeld()) );
1294 connect( (*scrActions)["itemWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_Weld()) );
1295 connect( (*scrActions)["itemEditWeld"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_EditWeld()) );
1296 connect( (*scrActions)["itemLowerToBottom"], SIGNAL(triggered()), currDoc, SLOT(sendItemSelectionToBack()) );
1297 connect( (*scrActions)["itemRaiseToTop"], SIGNAL(triggered()), currDoc, SLOT(bringItemSelectionToFront()) );
1298 connect( (*scrActions)["itemLower"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_LowerItem()) );
1299 connect( (*scrActions)["itemRaise"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_RaiseItem()) );
1300 connect( (*scrActions)["toolsUnlinkTextFrameAndCutText"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnlinkTextFrameAndCutText()) );
1301 }
1302
disconnectNewViewActions()1303 void ActionManager::disconnectNewViewActions()
1304 {
1305 //qDebug()<<"disconnectNewViewActions"<<mainWindow->doc->DocName;
1306 (*scrActions)["viewPreviewMode"]->disconnect();
1307 (*scrActions)["viewEditInPreview"]->disconnect();
1308 (*scrActions)["viewToggleCMS"]->disconnect();
1309 (*scrActions)["toolsZoomIn"]->disconnect();
1310 (*scrActions)["toolsZoomOut"]->disconnect();
1311 (*scrActions)["itemImageIsVisible"]->disconnect();
1312 (*scrActions)["itemPreviewFull"]->disconnect(SIGNAL(triggeredData(int)));
1313 (*scrActions)["itemPreviewNormal"]->disconnect(SIGNAL(triggeredData(int)));
1314 (*scrActions)["itemPreviewLow"]->disconnect(SIGNAL(triggeredData(int)));
1315 (*scrActions)["itemConvertToBezierCurve"]->disconnect();
1316 (*scrActions)["itemConvertToImageFrame"]->disconnect();
1317 (*scrActions)["itemConvertToOutlines"]->disconnect();
1318 (*scrActions)["itemConvertToPolygon"]->disconnect();
1319 (*scrActions)["itemConvertToTextFrame"]->disconnect();
1320 (*scrActions)["itemAttachTextToPath"]->disconnect();
1321 (*scrActions)["itemDetachTextFromPath"]->disconnect();
1322 (*scrActions)["itemExtendedImageProperties"]->disconnect();
1323 }
1324
connectNewViewActions(ScribusView * currView)1325 void ActionManager::connectNewViewActions(ScribusView *currView)
1326 {
1327 if (currView==nullptr)
1328 return;
1329 //qDebug()<<"connectNewViewActions"<<currView->Doc->DocName;
1330 connect( (*scrActions)["viewPreviewMode"], SIGNAL(toggled(bool)), currView, SLOT(togglePreview(bool)) );
1331 connect( (*scrActions)["viewEditInPreview"], SIGNAL(toggled(bool)), currView, SLOT(togglePreviewEdit(bool)) );
1332 connect( (*scrActions)["viewToggleCMS"], SIGNAL(toggled(bool)), currView, SLOT(toggleCMS(bool)));
1333 connect( (*scrActions)["toolsZoomIn"], SIGNAL(triggered()) , currView, SLOT(slotZoomIn()) );
1334 connect( (*scrActions)["toolsZoomOut"], SIGNAL(triggered()) , currView, SLOT(slotZoomOut()) );
1335 connect( (*scrActions)["itemConvertToBezierCurve"], SIGNAL(triggered()), currView, SLOT(ToBezierFrame()) );
1336 connect( (*scrActions)["itemConvertToImageFrame"], SIGNAL(triggered()), currView, SLOT(ToPicFrame()) );
1337 connect( (*scrActions)["itemConvertToOutlines"], SIGNAL(triggered()), currView, SLOT(TextToPath()) );
1338 connect( (*scrActions)["itemConvertToPolygon"], SIGNAL(triggered()), currView, SLOT(ToPolyFrame()) );
1339 connect( (*scrActions)["itemConvertToTextFrame"], SIGNAL(triggered()), currView, SLOT(ToTextFrame()) );
1340 connect( (*scrActions)["itemAttachTextToPath"], SIGNAL(triggered()), currView, SLOT(ToPathText()) );
1341 connect( (*scrActions)["itemDetachTextFromPath"], SIGNAL(triggered()), currView, SLOT(FromPathText()) );
1342 connect( (*scrActions)["itemExtendedImageProperties"], SIGNAL(triggered()), currView, SLOT(editExtendedImageProperties()) );
1343 }
1344
disconnectNewSelectionActions()1345 void ActionManager::disconnectNewSelectionActions()
1346 {
1347 (*scrActions)["itemImageIsVisible"]->disconnect();
1348 //Only disconnect triggeredData for data based actions or you will disconnect the internal signal
1349 (*scrActions)["itemPreviewFull"]->disconnect(SIGNAL(triggeredData(int)));
1350 (*scrActions)["itemPreviewNormal"]->disconnect(SIGNAL(triggeredData(int)));
1351 (*scrActions)["itemPreviewLow"]->disconnect(SIGNAL(triggeredData(int)));
1352 (*scrActions)["editClearContents"]->disconnect();
1353 (*scrActions)["editTruncateContents"]->disconnect();
1354 }
1355
connectNewSelectionActions(ScribusView *,ScribusDoc * currDoc)1356 void ActionManager::connectNewSelectionActions(ScribusView* /*currView*/, ScribusDoc* currDoc)
1357 {
1358 connect( (*scrActions)["itemImageIsVisible"], SIGNAL(toggled(bool)), currDoc, SLOT(itemSelection_ToggleImageShown()) );
1359 connect( (*scrActions)["itemPreviewFull"], SIGNAL(triggeredData(int)), currDoc, SLOT(itemSelection_ChangePreviewResolution(int)) );
1360 connect( (*scrActions)["itemPreviewNormal"], SIGNAL(triggeredData(int)), currDoc, SLOT(itemSelection_ChangePreviewResolution(int)) );
1361 connect( (*scrActions)["itemPreviewLow"], SIGNAL(triggeredData(int)), currDoc, SLOT(itemSelection_ChangePreviewResolution(int)) );
1362 connect( (*scrActions)["editClearContents"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_ClearItem()) );
1363 connect( (*scrActions)["editTruncateContents"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_TruncateItem()) );
1364 }
1365
saveActionShortcutsPreEditMode()1366 void ActionManager::saveActionShortcutsPreEditMode()
1367 {
1368 for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
1369 {
1370 (*scrActions)[*it]->setShortcutContext(Qt::WidgetShortcut); // in theory, this should be enough, but...
1371 (*scrActions)[*it]->saveShortcut();
1372 #ifdef Q_OS_MAC
1373 if ((*scrActions)[*it]->menu() != nullptr)
1374 (*scrActions)[*it]->setEnabled(false);
1375 #endif
1376 }
1377 for ( QStringList::Iterator it = nonEditActionNames->begin(); it != nonEditActionNames->end(); ++it )
1378 {
1379 (*scrActions)[*it]->setShortcutContext(Qt::WidgetShortcut); // in theory, this should be enough, but...
1380 (*scrActions)[*it]->saveShortcut();
1381 }
1382 }
1383
restoreActionShortcutsPostEditMode()1384 void ActionManager::restoreActionShortcutsPostEditMode()
1385 {
1386 for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )
1387 {
1388 (*scrActions)[*it]->setShortcutContext(Qt::WindowShortcut); // see above
1389 (*scrActions)[*it]->restoreShortcut();
1390 #ifdef Q_OS_MAC
1391 (*scrActions)[*it]->setEnabled(true);
1392 #endif
1393 }
1394 for ( QStringList::Iterator it = nonEditActionNames->begin(); it != nonEditActionNames->end(); ++it )
1395 {
1396 (*scrActions)[*it]->setShortcutContext(Qt::WindowShortcut); // see above
1397 (*scrActions)[*it]->restoreShortcut();
1398 }
1399 }
1400
enableActionStringList(QMap<QString,QPointer<ScrAction>> * actionMap,QStringList * list,bool enabled,bool checkingUnicode,const QString & fontName)1401 void ActionManager::enableActionStringList(QMap<QString, QPointer<ScrAction> > *actionMap, QStringList *list, bool enabled, bool checkingUnicode, const QString& fontName)
1402 {
1403 for (QStringList::Iterator it = list->begin(); it != list->end(); ++it)
1404 {
1405 if (!checkingUnicode)
1406 (*actionMap)[*it]->setEnabled(enabled);
1407 else
1408 {
1409 //For UnicodeChar actions, only enable when the current font has that character.
1410 if (mainWindow->HaveDoc && (*actionMap)[*it]->actionType()==ScrAction::UnicodeChar)
1411 {
1412 int charCode=(*actionMap)[*it]->actionInt();
1413 if (charCode==-1 ||
1414 charCode==23 ||
1415 charCode==24 ||
1416 charCode==26 ||
1417 charCode==27 ||
1418 charCode==28 ||
1419 charCode==29 ||
1420 charCode==30 ||
1421 ((*mainWindow->doc->AllFonts)[fontName].usable() &&
1422 (*mainWindow->doc->AllFonts)[fontName].canRender(charCode)) )
1423 (*actionMap)[*it]->setEnabled(true);
1424 else
1425 (*actionMap)[*it]->setEnabled(false);
1426 }
1427 }
1428 }
1429 }
1430
enableUnicodeActions(QMap<QString,QPointer<ScrAction>> * actionMap,bool enabled,const QString & fontName)1431 void ActionManager::enableUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap, bool enabled, const QString& fontName)
1432 {
1433 enableActionStringList(actionMap, unicodeCharActionNames, enabled, enabled, fontName);
1434 (*actionMap)["insertGlyph"]->setEnabled(enabled);
1435 }
1436
setPDFActions(ScribusView * currView)1437 void ActionManager::setPDFActions(ScribusView *currView)
1438 {
1439 if (currView==nullptr)
1440 return;
1441 PageItem* currItem = mainWindow->doc->m_Selection->itemAt(0);
1442 if (currItem == nullptr)
1443 return;
1444
1445 (*scrActions)["itemPDFIsBookmark"]->disconnect();
1446 (*scrActions)["itemPDFIsAnnotation"]->disconnect();
1447
1448 if (!currItem->isTextFrame())
1449 {
1450 (*scrActions)["itemPDFIsAnnotation"]->setEnabled(false);
1451 (*scrActions)["itemPDFIsBookmark"]->setEnabled(false);
1452 (*scrActions)["itemPDFIsAnnotation"]->setChecked(false);
1453 (*scrActions)["itemPDFIsBookmark"]->setChecked(false);
1454 (*scrActions)["itemPDFAnnotationProps"]->setEnabled(false);
1455 (*scrActions)["itemPDFFieldProps"]->setEnabled(false);
1456 return;
1457 }
1458
1459 (*scrActions)["itemPDFIsAnnotation"]->setEnabled(true);
1460 (*scrActions)["itemPDFIsBookmark"]->setEnabled(true);
1461 (*scrActions)["itemPDFIsAnnotation"]->setChecked(currItem->isAnnotation());
1462 (*scrActions)["itemPDFIsBookmark"]->setChecked(currItem->isBookmark);
1463 if (currItem->isAnnotation())
1464 {
1465 int aType=currItem->annotation().Type();
1466 bool setter=((aType == 0) || (aType == 1) || ((aType > Annotation::Listbox) && (aType < Annotation::Annot3D)));
1467 (*scrActions)["itemPDFAnnotationProps"]->setEnabled(setter);
1468 (*scrActions)["itemPDFFieldProps"]->setEnabled(!setter);
1469 }
1470 else
1471 {
1472 (*scrActions)["itemPDFAnnotationProps"]->setEnabled(false);
1473 (*scrActions)["itemPDFFieldProps"]->setEnabled(false);
1474 }
1475 connect( (*scrActions)["itemPDFIsAnnotation"], SIGNAL(triggered()), mainWindow->doc, SLOT(itemSelection_ToggleAnnotation()) );
1476 connect( (*scrActions)["itemPDFIsBookmark"], SIGNAL(triggered()), mainWindow->doc, SLOT(itemSelection_ToggleBookMark()) );
1477 }
1478
changeEvent(QEvent * e)1479 void ActionManager::changeEvent(QEvent *e)
1480 {
1481 if (e->type() == QEvent::LanguageChange)
1482 {
1483 languageChange();
1484 }
1485 }
1486
languageChange()1487 void ActionManager::languageChange()
1488 {
1489 createDefaultMenuNames();
1490 createDefaultNonMenuNames();
1491
1492 //File Menu
1493 (*scrActions)["fileNew"]->setTexts( tr("&New..."));
1494 (*scrActions)["fileNewFromTemplate"]->setTexts( tr("New &from Template..."));
1495 (*scrActions)["fileOpen"]->setTexts( tr("&Open..."));
1496 (*scrActions)["fileClose"]->setTexts( tr("&Close"));
1497 (*scrActions)["fileSave"]->setTexts( tr("&Save"));
1498 (*scrActions)["fileSaveAs"]->setTexts( tr("Save &As..."));
1499 (*scrActions)["fileRevert"]->setTexts( tr("Re&vert to Saved"));
1500 (*scrActions)["fileCollect"]->setTexts( tr("Collect for O&utput..."));
1501 (*scrActions)["fileImportText"]->setTexts( tr("Get Text..."));
1502 (*scrActions)["fileImportAppendText"]->setTexts( tr("Append &Text..."));
1503 (*scrActions)["fileImportImage"]->setTexts( tr("Get Image..."));
1504 (*scrActions)["fileImportVector"]->setTexts( tr("Get Vector File..."));
1505
1506 (*scrActions)["fileExportText"]->setTexts( tr("Save &Text..."));
1507 (*scrActions)["fileExportAsEPS"]->setTexts( tr("Save as &EPS..."));
1508 (*scrActions)["fileExportAsPDF"]->setTexts( tr("Save as P&DF..."));
1509 // (*scrActions)["fileDocSetup"]->setTexts( tr("Document &Setup (old)..."));
1510 (*scrActions)["fileDocSetup150"]->setTexts( tr("Document &Setup..."));
1511 // (*scrActions)["filePreferences"]->setTexts( tr("P&references (old)..."));
1512 (*scrActions)["filePreferences150"]->setTexts( tr("P&references..."));
1513 (*scrActions)["filePrint"]->setTexts( tr("&Print..."));
1514 (*scrActions)["PrintPreview"]->setTexts( tr("Print Previe&w..."));
1515 (*scrActions)["OutputPreviewPDF"]->setTexts( tr("PDF..."));
1516 (*scrActions)["OutputPreviewPS"]->setTexts( tr("PostScript..."));
1517 (*scrActions)["fileQuit"]->setTexts( tr("&Quit"));
1518 //Edit Menu
1519 (*scrActions)["editUndoAction"]->setTexts( tr("&Undo"));
1520 (*scrActions)["editRedoAction"]->setTexts( tr("&Redo"));
1521 (*scrActions)["editActionMode"]->setTexts( tr("&Item Action Mode"));
1522 (*scrActions)["editCut"]->setTexts( tr("Cu&t"));
1523 (*scrActions)["editCopy"]->setTexts( tr("&Copy"));
1524 (*scrActions)["editPaste"]->setTexts( tr("&Paste"));
1525 (*scrActions)["editCopyContents"]->setTexts( tr("&Copy"));
1526 (*scrActions)["editPasteContents"]->setTexts( tr("&Paste"));
1527 (*scrActions)["editPasteContentsAbs"]->setTexts( tr("Paste (&Absolute)"));
1528 (*scrActions)["editPasteImageFromClipboard"]->setTexts( tr("Paste Image from Clipboard"));
1529 (*scrActions)["editClearContents"]->setTexts( tr("C&lear"));
1530 (*scrActions)["editTruncateContents"]->setTexts( tr("T&runcate"));
1531 (*scrActions)["editSelectAll"]->setTexts( tr("Select &All"));
1532 (*scrActions)["editSelectAllOnLayer"]->setTexts( tr("Advanced Select All..."));
1533 (*scrActions)["editDeselectAll"]->setTexts( tr("&Deselect All"));
1534 (*scrActions)["editSearchReplace"]->setTexts( tr("&Search/Replace..."));
1535 (*scrActions)["editEditWithImageEditor"]->setTexts( tr("Edit Image..."));
1536 (*scrActions)["editEditRenderSource"]->setTexts( tr("Edit Source..."));
1537 (*scrActions)["editColorsAndFills"]->setTexts( tr("Colors and Fills..."));
1538 (*scrActions)["editReplaceColors"]->setTexts( tr("Replace Colors..."));
1539 (*scrActions)["editStyles"]->setTexts( tr("S&tyles..."));
1540 (*scrActions)["editMarks"]->setTexts( tr("Marks..."));
1541 (*scrActions)["editNotesStyles"]->setTexts( tr("Notes Styles..."));
1542 (*scrActions)["editMasterPages"]->setTexts( tr("&Master Pages..."));
1543 (*scrActions)["editJavascripts"]->setTexts( tr("&JavaScripts..."));
1544
1545 int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
1546 size_t f_size = sizeof(font_sizes) / sizeof(*font_sizes);
1547 for (uint s = 0; s < f_size; ++s)
1548 {
1549 QString fontSizeName=QString("fontSize%1").arg(font_sizes[s]);
1550 (*scrActions)[fontSizeName]->setTexts( tr("%1 pt").arg(font_sizes[s]));
1551 }
1552 (*scrActions)["fontSizeOther"]->setTexts( tr("&Other..."));
1553 (*scrActions)["alignLeft"]->setTexts( tr("&Left"));
1554 (*scrActions)["alignCenter"]->setTexts( tr("&Center"));
1555 (*scrActions)["alignRight"]->setTexts( tr("&Right"));
1556 (*scrActions)["alignBlock"]->setTexts( tr("&Block"));
1557 (*scrActions)["alignForced"]->setTexts( tr("&Forced"));
1558
1559 (*scrActions)["typeEffectNormal"]->setTexts( tr("&Normal"));
1560 (*scrActions)["typeEffectUnderline"]->setTexts( tr("&Underline"));
1561 (*scrActions)["typeEffectUnderlineWords"]->setTexts( tr("Underline &Words"));
1562 (*scrActions)["typeEffectStrikeThrough"]->setTexts( tr("&Strike Through"));
1563 (*scrActions)["typeEffectAllCaps"]->setTexts( tr("&All Caps"));
1564 (*scrActions)["typeEffectSmallCaps"]->setTexts( tr("Small &Caps"));
1565 (*scrActions)["typeEffectSuperscript"]->setTexts( tr("Su&perscript"));
1566 (*scrActions)["typeEffectSubscript"]->setTexts( tr("Su&bscript"));
1567 (*scrActions)["typeEffectOutline"]->setTexts( tr("&Outline", "type effect"));
1568 (*scrActions)["typeEffectShadow"]->setTexts( tr("S&hadow"));
1569
1570 (*scrActions)["styleImageEffects"]->setTexts( tr("&Image Effects..."));
1571 (*scrActions)["styleTabulators"]->setTexts( tr("&Tabulators..."));
1572
1573 //Item Menu
1574 (*scrActions)["itemDuplicate"]->setTexts( tr("D&uplicate"));
1575 (*scrActions)["itemMulDuplicate"]->setTexts( tr("&Multiple Duplicate..."));
1576 (*scrActions)["itemTransform"]->setTexts( tr("&Transform..."));
1577 (*scrActions)["itemDelete"]->setTexts( tr("&Delete"));
1578 (*scrActions)["itemGroup"]->setTexts( tr("&Group"));
1579 (*scrActions)["itemUngroup"]->setTexts( tr("&Ungroup"));
1580 (*scrActions)["itemGroupAdjust"]->setTexts( tr("Adjust Group"));
1581 (*scrActions)["itemLock"]->setTexts( tr("Is &Locked"));
1582 (*scrActions)["itemLockSize"]->setTexts( tr("Si&ze is Locked"));
1583 (*scrActions)["itemPrintingEnabled"]->setTexts( tr("&Printing Enabled"));
1584 (*scrActions)["itemFlipH"]->setTexts( tr("&Flip Horizontally"));
1585 (*scrActions)["itemFlipV"]->setTexts( tr("&Flip Vertically"));
1586 (*scrActions)["itemLowerToBottom"]->setTexts( tr("Lower to &Bottom"));
1587 (*scrActions)["itemRaiseToTop"]->setTexts( tr("Raise to &Top"));
1588 (*scrActions)["itemLower"]->setTexts( tr("&Lower"));
1589 (*scrActions)["itemRaise"]->setTexts( tr("&Raise"));
1590 (*scrActions)["itemSendToPattern"]->setTexts( tr("Patterns"));
1591 (*scrActions)["itemSendToInline"]->setTexts( tr("Inline Items"));
1592 (*scrActions)["itemAttributes"]->setTexts( tr("&Attributes..."));
1593 (*scrActions)["itemImageInfo"]->setTexts( tr("More Info..."));
1594 (*scrActions)["itemImageIsVisible"]->setTexts( tr("I&mage Visible"));
1595 (*scrActions)["itemUpdateImage"]->setTexts( tr("&Update Image"));
1596 (*scrActions)["tableInsertRows"]->setTexts(tr("Insert Rows..."));
1597 (*scrActions)["tableInsertColumns"]->setTexts(tr("Insert Columns..."));
1598 (*scrActions)["tableDeleteRows"]->setTexts(tr("Delete Rows"));
1599 (*scrActions)["tableDeleteColumns"]->setTexts(tr("Delete Columns"));
1600 (*scrActions)["tableMergeCells"]->setTexts(tr("Merge Cells"));
1601 (*scrActions)["tableSplitCells"]->setTexts(tr("Split Cells..."));
1602 (*scrActions)["tableSetRowHeights"]->setTexts(tr("Set Row Heights..."));
1603 (*scrActions)["tableSetColumnWidths"]->setTexts(tr("Set Column Widths..."));
1604 (*scrActions)["tableDistributeRowsEvenly"]->setTexts(tr("Distribute Rows Evenly"));
1605 (*scrActions)["tableDistributeColumnsEvenly"]->setTexts(tr("Distribute Columns Evenly"));
1606 (*scrActions)["tableAdjustFrameToTable"]->setTexts(tr("Adjust Frame to Table"));
1607 (*scrActions)["tableAdjustTableToFrame"]->setTexts(tr("Adjust Table to Frame"));
1608 (*scrActions)["itemAdjustFrameHeightToText"]->setTexts( tr("Adjust Frame Height to Text"));
1609 (*scrActions)["itemAdjustFrameToImage"]->setTexts( tr("Adjust Frame to Image"));
1610 (*scrActions)["itemAdjustImageToFrame"]->setTexts( tr("Adjust Image to Frame"));
1611 (*scrActions)["itemToggleInlineImage"]->setTexts( tr("Embed Image"));
1612 (*scrActions)["itemExtendedImageProperties"]->setTexts( tr("Extended Image Properties..."));
1613 (*scrActions)["itemPreviewFull"]->setTexts( tr("&Full Resolution"));
1614 (*scrActions)["itemPreviewNormal"]->setTexts( tr("&Normal Resolution"));
1615 (*scrActions)["itemPreviewLow"]->setTexts( tr("&Low Resolution"));
1616 (*scrActions)["itemPDFIsBookmark"]->setTexts( tr("Is PDF &Bookmark"));
1617 (*scrActions)["itemPDFIsAnnotation"]->setTexts( tr("Is PDF A&nnotation"));
1618 (*scrActions)["itemPDFAnnotationProps"]->setTexts( tr("Annotation P&roperties..."));
1619 (*scrActions)["itemPDFFieldProps"]->setTexts( tr("Field P&roperties..."));
1620 (*scrActions)["itemShapeEdit"]->setTexts( tr("&Edit Shape..."));
1621 (*scrActions)["itemAttachTextToPath"]->setTexts( tr("&Attach Text to Path"));
1622 (*scrActions)["itemDetachTextFromPath"]->setTexts( tr("&Detach Text from Path"));
1623 (*scrActions)["itemCombinePolygons"]->setTexts( tr("&Combine Polygons"));
1624 (*scrActions)["itemSplitPolygons"]->setTexts( tr("Split &Polygons"));
1625 (*scrActions)["itemConvertToBezierCurve"]->setTexts( tr("&Bezier Curve"));
1626 (*scrActions)["itemConvertToImageFrame"]->setTexts( tr("&Image Frame"));
1627 (*scrActions)["itemConvertToOutlines"]->setTexts( tr("&Outlines", "Convert to oulines"));
1628 (*scrActions)["itemConvertToPolygon"]->setTexts( tr("&Polygon"));
1629 (*scrActions)["itemConvertToTextFrame"]->setTexts( tr("&Text Frame"));
1630 (*scrActions)["itemConvertToSymbolFrame"]->setTexts( tr("&Symbol"));
1631 (*scrActions)["itemsUnWeld"]->setTexts( tr("Unweld Items"));
1632 (*scrActions)["itemWeld"]->setTexts( tr("Weld Items"));
1633 (*scrActions)["itemEditWeld"]->setTexts( tr("Edit Weld"));
1634
1635 //Insert Menu
1636 (*scrActions)["insertFrame"]->setTexts( tr("&Frames..."));
1637 (*scrActions)["insertGlyph"]->setTexts( tr("&Glyph..."));
1638 (*scrActions)["insertSampleText"]->setTexts( tr("Sample Text..."));
1639 (*scrActions)["stickyTools"]->setTexts( tr("Sticky Tools"));
1640 (*scrActions)["insertMarkAnchor"]->setTexts( tr("Anchor Mark"));
1641 (*scrActions)["insertMarkVariableText"]->setTexts( tr("Variable Text"));
1642 (*scrActions)["insertMarkItem"]->setTexts( tr("Reference to Item"));
1643 (*scrActions)["insertMark2Mark"]->setTexts( tr("Reference to Mark"));
1644 (*scrActions)["insertMarkNote"]->setTexts( tr("Foot/Endnote"));
1645 // (*scrActions)["insertMarkIndex"]->setTexts( tr("Index entry"));
1646 (*scrActions)["editMark"]->setTexts( tr("Edit Mark"));
1647 (*scrActions)["itemUpdateMarks"]->setTexts( tr("Update Marks"));
1648
1649 //Page menu
1650 (*scrActions)["pageInsert"]->setTexts( tr("&Insert..."));
1651 (*scrActions)["pageImport"]->setTexts( tr("Im&port..."));
1652 (*scrActions)["pageDelete"]->setTexts( tr("&Delete..."));
1653 (*scrActions)["pageCopy"]->setTexts( tr("&Copy..."));
1654 (*scrActions)["pageMove"]->setTexts( tr("&Move..."));
1655 (*scrActions)["pageApplyMasterPage"]->setTexts( tr("&Apply Master Page..."));
1656 (*scrActions)["pageCopyToMasterPage"]->setTexts( tr("Convert to Master Page..."));
1657 (*scrActions)["pageManageGuides"]->setTexts( tr("Manage &Guides..."));
1658 (*scrActions)["pageManageProperties"]->setTexts( tr("Manage Page Properties..."));
1659
1660 //View Menu
1661 (*scrActions)["viewFitInWindow"]->setTexts( tr("&Fit to Height"));
1662 (*scrActions)["viewFitWidth"]->setTexts( tr("Fit to Width"));
1663 (*scrActions)["viewFit50"]->setTexts( tr("&50%"));
1664 (*scrActions)["viewFit75"]->setTexts( tr("&75%"));
1665 (*scrActions)["viewFit100"]->setTexts( tr("&100%"));
1666 (*scrActions)["viewFit200"]->setTexts( tr("&200%"));
1667 (*scrActions)["viewFit400"]->setTexts( tr("&400%"));
1668 (*scrActions)["viewPreviewMode"]->setTexts( tr("Preview Mode"));
1669 (*scrActions)["viewEditInPreview"]->setTexts( tr("Edit in Preview Mode") );
1670 (*scrActions)["viewToggleCMS"]->setTexts( tr("Toggle Color Management System"));
1671 (*scrActions)["viewShowMargins"]->setTexts( tr("Show &Margins"));
1672 (*scrActions)["viewShowBleeds"]->setTexts( tr("Show Bleeds"));
1673 (*scrActions)["viewShowFrames"]->setTexts( tr("Show &Frames"));
1674 (*scrActions)["viewShowLayerMarkers"]->setTexts( tr("Show Layer Indicators"));
1675 (*scrActions)["viewShowImages"]->setTexts( tr("Show &Images"));
1676 (*scrActions)["viewShowGrid"]->setTexts( tr("Show &Grid"));
1677 (*scrActions)["viewShowGuides"]->setTexts( tr("Show G&uides"));
1678 (*scrActions)["viewShowColumnBorders"]->setTexts( tr("Show Text Frame Columns"));
1679 (*scrActions)["viewShowBaseline"]->setTexts( tr("Show &Baseline Grid"));
1680 (*scrActions)["viewShowTextChain"]->setTexts( tr("Show &Text Chain"));
1681 (*scrActions)["viewShowTextControls"]->setTexts( tr("Show Control Characters"));
1682 (*scrActions)["viewShowRulers"]->setTexts( tr("Show Rulers"));
1683 (*scrActions)["viewRulerMode"]->setTexts( tr("Rulers Relative to Page"));
1684 (*scrActions)["viewSnapToGrid"]->setTexts( tr("Sn&ap to Grid"));
1685 (*scrActions)["viewSnapToGuides"]->setTexts( tr("Sna&p to Guides"));
1686 (*scrActions)["viewSnapToElements"]->setTexts( tr("Snap to Items"));
1687 (*scrActions)["viewShowContextMenu"]->setTexts( tr("Show Context Menu"));
1688 // (*scrActions)["viewNewView"]->setTexts( tr("New View"));
1689
1690 //Tool menu
1691 (*scrActions)["toolsProperties"]->setTexts( tr("&Properties"));
1692 (*scrActions)["toolsContent"]->setTexts( tr("Content Properties"));
1693 (*scrActions)["toolsOutline"]->setTexts( tr("&Outline", "Document Outline Palette"));
1694 (*scrActions)["toolsScrapbook"]->setTexts( tr("&Scrapbook"));
1695 (*scrActions)["toolsLayers"]->setTexts( tr("&Layers"));
1696 (*scrActions)["toolsPages"]->setTexts( tr("&Arrange Pages"));
1697 (*scrActions)["toolsBookmarks"]->setTexts( tr("&Bookmarks"));
1698 (*scrActions)["toolsDownloads"]->setTexts( tr("&Downloads"));
1699 (*scrActions)["toolsResources"]->setTexts( tr("&Resources"));
1700 (*scrActions)["toolsMeasurements"]->setTexts( tr("&Measurements"));
1701 (*scrActions)["toolsActionHistory"]->setTexts( tr("Action &History"));
1702 (*scrActions)["toolsPreflightVerifier"]->setTexts( tr("Preflight &Verifier"));
1703 (*scrActions)["toolsAlignDistribute"]->setTexts( tr("&Align and Distribute"));
1704 (*scrActions)["toolsSymbols"]->setTexts( tr("Symbols"));
1705 (*scrActions)["toolsInline"]->setTexts( tr("Inline Items"));
1706 (*scrActions)["toolsToolbarTools"]->setTexts( tr("&Tools"));
1707 (*scrActions)["toolsToolbarPDF"]->setTexts( tr("P&DF Tools"));
1708 (*scrActions)["toolsToolbarView"]->setTexts( tr("&View Tools"));
1709
1710 //toolbar only items
1711 (*scrActions)["toolsSelect"]->setTexts( tr("Select Item"));
1712 (*scrActions)["toolsRotate"]->setTexts( tr("Rotate Item"));
1713 (*scrActions)["toolsZoom"]->setTexts( tr("Zoom in or out"));
1714 (*scrActions)["toolsZoomIn"]->setTexts( tr("Zoom in"));
1715 (*scrActions)["toolsZoomOut"]->setTexts( tr("Zoom out"));
1716 (*scrActions)["toolsEditContents"]->setTexts( tr("Edit Contents of Frame"));
1717 (*scrActions)["toolsEditWithStoryEditor"]->setText( tr("Edit Text with Story Editor..."));
1718 (*scrActions)["toolsLinkTextFrame"]->setTexts( tr("Link Text Frames"));
1719 (*scrActions)["toolsUnlinkTextFrame"]->setTexts( tr("Unlink Text Frames"));
1720 (*scrActions)["toolsUnlinkTextFrameAndCutText"]->setTexts( tr("Unlink Text Frames and Cut Text"));
1721 (*scrActions)["toolsEyeDropper"]->setTexts( tr("&Eye Dropper"));
1722 (*scrActions)["toolsCopyProperties"]->setTexts( tr("Copy Item Properties"));
1723
1724 (*scrActions)["toolsInsertTextFrame"]->setText( tr("&Text Frame"));
1725 (*scrActions)["toolsInsertImageFrame"]->setText( tr("&Image Frame"));
1726 (*scrActions)["toolsInsertRenderFrame"]->setText( tr("&Render Frame"));
1727 (*scrActions)["toolsInsertTable"]->setText( tr("T&able"));
1728 (*scrActions)["toolsInsertShape"]->setText( tr("&Shape"));
1729 (*scrActions)["toolsInsertPolygon"]->setText( tr("&Polygon"));
1730 (*scrActions)["toolsInsertArc"]->setText( tr("Arc"));
1731 (*scrActions)["toolsInsertSpiral"]->setText( tr("Spiral"));
1732 (*scrActions)["toolsInsertLine"]->setText( tr("&Line"));
1733 (*scrActions)["toolsInsertCalligraphicLine"]->setText( tr("Calligraphic Line"));
1734 (*scrActions)["toolsInsertBezier"]->setText( tr("&Bezier Curve"));
1735 (*scrActions)["toolsInsertFreehandLine"]->setText( tr("&Freehand Line"));
1736
1737 (*scrActions)["toolsPDFPushButton"]->setTexts( tr("PDF Push Button"));
1738 (*scrActions)["toolsPDFRadioButton"]->setTexts( tr("PDF Radio Button"));
1739 (*scrActions)["toolsPDFTextField"]->setTexts( tr("PDF Text Field"));
1740 (*scrActions)["toolsPDFCheckBox"]->setTexts( tr("PDF Check Box"));
1741 (*scrActions)["toolsPDFComboBox"]->setTexts( tr("PDF Combo Box"));
1742 (*scrActions)["toolsPDFListBox"]->setTexts( tr("PDF List Box"));
1743 (*scrActions)["toolsPDFAnnotText"]->setTexts( tr("Text Annotation"));
1744 (*scrActions)["toolsPDFAnnotLink"]->setTexts( tr("Link Annotation"));
1745 #ifdef HAVE_OSG
1746 (*scrActions)["toolsPDFAnnot3D"]->setTexts( tr("3D Annotation"));
1747 #endif
1748
1749 //Extras Menu
1750 (*scrActions)["extrasManageImages"]->setTexts( tr("&Manage Images..."));
1751 (*scrActions)["extrasHyphenateText"]->setTexts( tr("&Hyphenate Text"));
1752 (*scrActions)["extrasDeHyphenateText"]->setTexts( tr("Dehyphenate Text"));
1753 (*scrActions)["extrasGenerateTableOfContents"]->setTexts( tr("&Generate Table Of Contents"));
1754 (*scrActions)["extrasUpdateDocument"]->setTexts( tr("&Update Document"));
1755 //(*scrActions)["extrasTestQTQuick2_1"]->setTexts( tr("Test Qt Quick"));
1756 //Windows Menu
1757 (*scrActions)["windowsCascade"]->setText( tr("&Cascade"));
1758 (*scrActions)["windowsTile"]->setText( tr("&Tile"));
1759
1760 //Help Menu
1761 (*scrActions)["helpAboutScribus"]->setTexts( tr("&About Scribus"));
1762 (*scrActions)["helpAboutPlugins"]->setTexts( tr("&About Plugins"));
1763 (*scrActions)["helpAboutQt"]->setTexts( tr("About &Qt"));
1764 (*scrActions)["helpActionSearch"]->setTexts( tr("Action &Search"));
1765 (*scrActions)["helpTooltips"]->setTexts( tr("Toolti&ps"));
1766 (*scrActions)["showMouseCoordinates"]->setTexts( tr("Move/Resize Value Indicator"));
1767 (*scrActions)["helpManual"]->setTexts( tr("Scribus &Help..."));
1768 (*scrActions)["helpOnlineWWW"]->setTexts( tr("Scribus Homepage"));
1769 (*scrActions)["helpOnlineDocs"]->setTexts( tr("Scribus Online Documentation"));
1770 (*scrActions)["helpOnlineWiki"]->setTexts( tr("Scribus Wiki"));
1771 (*scrActions)["helpOnlineTutorial1"]->setTexts( tr("Getting Started with Scribus"));
1772 (*scrActions)["helpCheckUpdates"]->setTexts( tr("Check for Updates"));
1773 (*scrActions)["helpChat"]->setTexts( tr("Chat with the Community"));
1774
1775 //GUI and specials
1776 (*scrActions)["specialToggleAllPalettes"]->setTexts( tr("Toggle Palettes"));
1777 (*scrActions)["specialToggleAllGuides"]->setTexts( tr("Toggle Guides"));
1778 (*scrActions)["specialUnicodeSequenceBegin"]->setTexts( tr("Insert Unicode Character Begin Sequence"));
1779
1780
1781 //Status texts for toolbar items
1782 (*scrActions)["editCopy"]->setStatusTextAndShortcut( tr("Copy"));
1783 (*scrActions)["editCut"]->setStatusTextAndShortcut( tr("Cut"));
1784 (*scrActions)["editPaste"]->setStatusTextAndShortcut( tr("Paste"));
1785 (*scrActions)["editRedoAction"]->setStatusTextAndShortcut( tr("Redo"));
1786 (*scrActions)["editUndoAction"]->setStatusTextAndShortcut( tr("Undo"));
1787 (*scrActions)["fileClose"]->setStatusTextAndShortcut( tr("Close the current document"));
1788 (*scrActions)["fileExportAsPDF"]->setStatusTextAndShortcut( tr("Export the document to PDF"));
1789 (*scrActions)["fileNew"]->setStatusTextAndShortcut( tr("Create a new document"));
1790 (*scrActions)["fileOpen"]->setStatusTextAndShortcut( tr("Open an existing document"));
1791 (*scrActions)["filePrint"]->setStatusTextAndShortcut( tr("Print the document"));
1792 (*scrActions)["fileSave"]->setStatusTextAndShortcut( tr("Save the current document"));
1793 (*scrActions)["toolsCopyProperties"]->setStatusTextAndShortcut( tr("Copy item properties"));
1794 (*scrActions)["toolsEditContents"]->setStatusTextAndShortcut( tr("Edit contents of a frame"));
1795 (*scrActions)["toolsEditWithStoryEditor"]->setStatusTextAndShortcut( tr("Edit text in story editor"));
1796 (*scrActions)["toolsEyeDropper"]->setStatusTextAndShortcut( tr("Eye Dropper"));
1797 (*scrActions)["toolsInsertArc"]->setStatusTextAndShortcut( tr("Insert an arc"));
1798 (*scrActions)["toolsInsertBezier"]->setStatusTextAndShortcut( tr("Insert a bezier curve"));
1799 (*scrActions)["toolsInsertCalligraphicLine"]->setStatusTextAndShortcut( tr("Insert a calligraphic line"));
1800 (*scrActions)["toolsInsertFreehandLine"]->setStatusTextAndShortcut( tr("Insert a freehand line"));
1801 (*scrActions)["toolsInsertImageFrame"]->setStatusTextAndShortcut( tr("Insert an image frame"));
1802 (*scrActions)["toolsInsertLine"]->setStatusTextAndShortcut( tr("Insert a line"));
1803 (*scrActions)["toolsInsertPolygon"]->setStatusTextAndShortcut( tr("Insert a polygon"));
1804 (*scrActions)["toolsInsertRenderFrame"]->setStatusTextAndShortcut( tr("Insert a render frame"));
1805 (*scrActions)["toolsInsertShape"]->setStatusTextAndShortcut( tr("Insert a shape"));
1806 (*scrActions)["toolsInsertSpiral"]->setStatusTextAndShortcut( tr("Insert a spiral"));
1807 (*scrActions)["toolsInsertTable"]->setStatusTextAndShortcut( tr("Insert a table"));
1808 (*scrActions)["toolsInsertTextFrame"]->setStatusTextAndShortcut( tr("Insert a text frame"));
1809 (*scrActions)["toolsLinkTextFrame"]->setStatusTextAndShortcut( tr("Link text frames"));
1810 (*scrActions)["toolsMeasurements"]->setStatusTextAndShortcut( tr("Measurements"));
1811 (*scrActions)["toolsPDFAnnotLink"]->setStatusTextAndShortcut( tr("Insert link annotation"));
1812 (*scrActions)["toolsPDFAnnotText"]->setStatusTextAndShortcut( tr("Insert text annotation"));
1813 (*scrActions)["toolsPDFCheckBox"]->setStatusTextAndShortcut( tr("Insert PDF check box"));
1814 (*scrActions)["toolsPDFComboBox"]->setStatusTextAndShortcut( tr("Insert PDF combo box"));
1815 (*scrActions)["toolsPDFListBox"]->setStatusTextAndShortcut( tr("Insert PDF list box"));
1816 (*scrActions)["toolsPDFPushButton"]->setStatusTextAndShortcut( tr("Insert PDF push button"));
1817 (*scrActions)["toolsPDFRadioButton"]->setStatusTextAndShortcut( tr("Insert PDF radio button"));
1818 (*scrActions)["toolsPDFTextField"]->setStatusTextAndShortcut( tr("Insert PDF text field"));
1819 (*scrActions)["toolsPreflightVerifier"]->setStatusTextAndShortcut( tr("Analyse the document for issues prior to exporting to PDF"));
1820 (*scrActions)["toolsRotate"]->setStatusTextAndShortcut( tr("Rotate an item"));
1821 (*scrActions)["toolsSelect"]->setStatusTextAndShortcut( tr("Select an item"));
1822 (*scrActions)["toolsUnlinkTextFrame"]->setStatusTextAndShortcut( tr("Unlink text frames"));
1823 (*scrActions)["toolsZoom"]->setStatusTextAndShortcut( tr("Zoom in or out"));
1824 (*scrActions)["viewPreviewMode"]->setStatusTextAndShortcut( tr("Enable preview mode"));
1825 (*scrActions)["viewEditInPreview"]->setStatusTextAndShortcut( tr("Enable editing in preview mode"));
1826 (*scrActions)["viewToggleCMS"]->setStatusTextAndShortcut( tr("Toggle color management system"));
1827 #ifdef HAVE_OSG
1828 (*scrActions)["toolsPDFAnnot3D"]->setStatusTextAndShortcut( tr("Insert 3D annotation"));
1829 #endif
1830
1831 //////
1832 languageChangeUnicodeActions(scrActions);
1833 languageChangeActions();
1834
1835 //Reset tooltips on actions after the translation process
1836 for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrActions->begin(); it!=scrActions->end(); ++it )
1837 {
1838 if ((*it)!=nullptr)
1839 (*it)->setToolTipFromTextAndShortcut();
1840 }
1841 }
1842
languageChangeUnicodeActions(QMap<QString,QPointer<ScrAction>> * actionMap)1843 void ActionManager::languageChangeUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap)
1844 {
1845 //typography
1846 (*actionMap)["unicodeZWNJ"]->setText( tr("Zero Width Non-Joiner"));
1847 (*actionMap)["unicodeZWJ"]->setText( tr("Zero Width Joiner"));
1848 (*actionMap)["unicodeSoftHyphen"]->setText( tr("Soft &Hyphen"));
1849 (*actionMap)["unicodeNonBreakingHyphen"]->setText( tr("Non Breaking Hyphen"));
1850 (*actionMap)["unicodeNonBreakingSpace"]->setText( tr("Non Breaking &Space"));
1851 (*actionMap)["unicodeNarrowNoBreakSpace"]->setTexts( tr("Narrow No-Break Space"));
1852 (*actionMap)["unicodePageNumber"]->setText( tr("Page &Number"));
1853 (*actionMap)["unicodePageCount"]->setText( tr("Number of Pages"));
1854 (*actionMap)["unicodeNewLine"]->setText( tr("New Line"));
1855 (*actionMap)["unicodeFrameBreak"]->setText( tr("Frame Break"));
1856 (*actionMap)["unicodeColumnBreak"]->setText( tr("Column Break"));
1857 (*actionMap)["unicodeZerowidthSpace"]->setText( tr("&Zero Width Space"));
1858 (*actionMap)["unicodeZerowidthNonBreakingSpace"]->setText( tr("Zero Width NB Space"));
1859 (*actionMap)["unicodeCopyRight"]->setTexts( tr("Copyright"));
1860 (*actionMap)["unicodeRegdTM"]->setTexts( tr("Registered Trademark"));
1861 (*actionMap)["unicodeTM"]->setTexts( tr("Trademark"));
1862 (*actionMap)["unicodeSolidus"]->setTexts( tr("Solidus"));
1863 (*actionMap)["unicodeBullet"]->setTexts( tr("Bullet"));
1864 (*actionMap)["unicodeMidpoint"]->setTexts( tr("Middle Dot"));
1865 (*actionMap)["unicodeDashEm"]->setTexts( tr("Em Dash"));
1866 (*actionMap)["unicodeDashEn"]->setTexts( tr("En Dash"));
1867 (*actionMap)["unicodeDashFigure"]->setTexts( tr("Figure Dash"));
1868 (*actionMap)["unicodeDashQuotation"]->setTexts( tr("Quotation Dash"));
1869
1870 (*actionMap)["unicodeQuoteApostrophe"]->setTexts( tr("Apostrophe", "Unicode 0x0027"));
1871 (*actionMap)["unicodeQuoteStraight"]->setTexts( tr("Straight Double", "Unicode 0x0022"));
1872 (*actionMap)["unicodeQuoteSingleLeft"]->setTexts( tr("Single Left", "Unicode 0x2018"));
1873 (*actionMap)["unicodeQuoteSingleRight"]->setTexts( tr("Single Right", "Unicode 0x2019"));
1874 (*actionMap)["unicodeQuoteDoubleLeft"]->setTexts( tr("Double Left", "Unicode 0x201C"));
1875 (*actionMap)["unicodeQuoteDoubleRight"]->setTexts( tr("Double Right", "Unicode 0x201D"));
1876 (*actionMap)["unicodeQuoteSingleReversed"]->setTexts( tr("Single Reversed", "Unicode 0x201B"));
1877 (*actionMap)["unicodeQuoteDoubleReversed"]->setTexts( tr("Double Reversed", "Unicode 0x201F"));
1878 (*actionMap)["unicodeQuoteSingleLeftGuillemet"]->setTexts( tr("Single Left Guillemet", "Unicode 0x2039"));
1879 (*actionMap)["unicodeQuoteSingleRightGuillemet"]->setTexts( tr("Single Right Guillemet", "Unicode 0x203A"));
1880 (*actionMap)["unicodeQuoteDoubleLeftGuillemet"]->setTexts( tr("Double Left Guillemet", "Unicode 0x00AB"));
1881 (*actionMap)["unicodeQuoteDoubleRightGuillemet"]->setTexts( tr("Double Right Guillemet", "Unicode 0x00BB"));
1882 (*actionMap)["unicodeQuoteLowSingleComma"]->setTexts( tr("Low Single Comma", "Unicode 0x201A"));
1883 (*actionMap)["unicodeQuoteLowDoubleComma"]->setTexts( tr("Low Double Comma", "Unicode 0x201E"));
1884 (*actionMap)["unicodeQuoteCJKSingleLeft"]->setTexts( tr("CJK Single Left", "Unicode 0x300C"));
1885 (*actionMap)["unicodeQuoteCJKSingleRight"]->setTexts( tr("CJK Single Right", "Unicode 0x300D"));
1886 (*actionMap)["unicodeQuoteCJKDoubleLeft"]->setTexts( tr("CJK Double Left", "Unicode 0x300E"));
1887 (*actionMap)["unicodeQuoteCJKDoubleRight"]->setTexts( tr("CJK Double Right", "Unicode 0x300F"));
1888
1889 (*actionMap)["unicodeSpaceEN"]->setTexts( tr("En Space"));
1890 (*actionMap)["unicodeSpaceEM"]->setTexts( tr("Em Space"));
1891 (*actionMap)["unicodeSpaceThin"]->setTexts( tr("Thin Space"));
1892 (*actionMap)["unicodeSpaceThick"]->setTexts( tr("Thick Space"));
1893 (*actionMap)["unicodeSpaceMid"]->setTexts( tr("Mid Space"));
1894 (*actionMap)["unicodeSpaceHair"]->setTexts( tr("Hair Space"));
1895
1896 (*actionMap)["unicodeLigature_ff"]->setTexts( tr("ff"));
1897 (*actionMap)["unicodeLigature_fi"]->setTexts( tr("fi"));
1898 (*actionMap)["unicodeLigature_fl"]->setTexts( tr("fl"));
1899 (*actionMap)["unicodeLigature_ffi"]->setTexts( tr("ffi"));
1900 (*actionMap)["unicodeLigature_ffl"]->setTexts( tr("ffl"));
1901 (*actionMap)["unicodeLigature_ft"]->setTexts( tr("ft"));
1902 (*actionMap)["unicodeLigature_st"]->setTexts( tr("st"));
1903 }
1904
createDefaultShortcuts()1905 void ActionManager::createDefaultShortcuts()
1906 {
1907 defKeys.clear();
1908
1909 defKeys.insert("fileNew", QKeySequence::New);
1910 defKeys.insert("fileNewFromTemplate", Qt::CTRL+Qt::ALT+Qt::Key_N);
1911 defKeys.insert("fileOpen", QKeySequence::Open);
1912 defKeys.insert("fileClose", QKeySequence::Close);
1913 defKeys.insert("fileSave", QKeySequence::Save);
1914 defKeys.insert("fileSaveAs", Qt::CTRL+Qt::SHIFT+Qt::Key_S);
1915 defKeys.insert("fileImportText", Qt::CTRL+Qt::Key_I);
1916 defKeys.insert("fileImportImage", Qt::CTRL+Qt::Key_I);
1917 defKeys.insert("filePrint", QKeySequence::Print);
1918 defKeys.insert("fileExportAsPDF", Qt::CTRL+Qt::SHIFT+Qt::Key_P);
1919 defKeys.insert("fileQuit", Qt::CTRL+Qt::Key_Q);
1920 //Edit Menu
1921 defKeys.insert("editUndoAction", QKeySequence::Undo);
1922 defKeys.insert("editRedoAction", QKeySequence::Redo);
1923 defKeys.insert("editCut", QKeySequence::Cut);
1924 defKeys.insert("editCopy", QKeySequence::Copy);
1925 defKeys.insert("editPaste", QKeySequence::Paste);
1926 defKeys.insert("editClearContents", Qt::CTRL+Qt::SHIFT+Qt::Key_Delete);
1927 defKeys.insert("editCopyContents", Qt::CTRL+Qt::SHIFT+Qt::Key_C);
1928 defKeys.insert("editPasteContents", Qt::CTRL+Qt::SHIFT+Qt::Key_V);
1929 defKeys.insert("editPasteContentsAbs", Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_V);
1930 defKeys.insert("editSelectAll", Qt::CTRL+Qt::Key_A);
1931 defKeys.insert("editSelectAllOnLayer", Qt::CTRL+Qt::ALT+Qt::Key_A);
1932 defKeys.insert("editDeselectAll", Qt::CTRL+Qt::SHIFT+Qt::Key_A);
1933 defKeys.insert("editSearchReplace", Qt::CTRL+Qt::Key_F);
1934 defKeys.insert("editStyles", QKeySequence(Qt::Key_F4));
1935 defKeys.insert("styleImageEffects", Qt::CTRL+Qt::Key_E);
1936
1937 //Item Menu
1938 defKeys.insert("itemDuplicate", Qt::CTRL+Qt::Key_D);
1939 defKeys.insert("itemMulDuplicate", Qt::CTRL+Qt::SHIFT+Qt::Key_D);
1940 defKeys.insert("itemDelete", QKeySequence::Delete);
1941 defKeys.insert("itemGroup", Qt::CTRL+Qt::Key_G);
1942 defKeys.insert("itemUngroup", Qt::CTRL+Qt::SHIFT+Qt::Key_G);
1943 defKeys.insert("itemLock", Qt::CTRL+Qt::Key_L);
1944 defKeys.insert("itemLockSize", Qt::CTRL+Qt::SHIFT+Qt::Key_L);
1945 defKeys.insert("itemLowerToBottom", Qt::Key_End);
1946 defKeys.insert("itemRaiseToTop", Qt::Key_Home);
1947 defKeys.insert("itemLower", Qt::CTRL+Qt::Key_End);
1948 defKeys.insert("itemRaise", Qt::CTRL+Qt::Key_Home);
1949
1950 //Insert Menu
1951 //Page menu
1952 //View Menu
1953 defKeys.insert("viewFitInWindow", Qt::CTRL+Qt::Key_0);
1954 defKeys.insert("viewFit100", Qt::CTRL+Qt::Key_1);
1955 defKeys.insert("viewPreviewMode", Qt::CTRL+Qt::ALT+Qt::Key_P);
1956 defKeys.insert("viewShowRulers", Qt::CTRL+Qt::SHIFT+Qt::Key_R);
1957 defKeys.insert("viewShowContextMenu", Qt::Key_Menu); //Context menu key on Windows. Do we have one to use on Linux/OSX? Super_L ?
1958
1959 //Tool menu
1960 defKeys.insert("toolsProperties", Qt::Key_F2);
1961 defKeys.insert("toolsContent", Qt::Key_F3);
1962 defKeys.insert("toolsLayers", Qt::Key_F6);
1963
1964 //toolbar only items
1965 defKeys.insert("toolsSelect", Qt::Key_C);
1966 defKeys.insert("toolsInsertTextFrame", QKeySequence(Qt::Key_T));
1967 defKeys.insert("toolsInsertImageFrame", Qt::Key_I);
1968 defKeys.insert("toolsInsertTable", Qt::Key_A);
1969 defKeys.insert("toolsInsertShape", Qt::Key_S);
1970 defKeys.insert("toolsInsertPolygon", Qt::Key_P);
1971 defKeys.insert("toolsInsertLine", Qt::Key_L);
1972 defKeys.insert("toolsInsertBezier", Qt::Key_B);
1973 defKeys.insert("toolsInsertFreehandLine", Qt::Key_F);
1974
1975 defKeys.insert("toolsInsertRenderFrame", Qt::Key_D); //TODO: First free key. Select a meaningful
1976 defKeys.insert("toolsRotate", Qt::Key_R);
1977 defKeys.insert("toolsZoom", Qt::Key_Z);
1978 defKeys.insert("toolsZoomIn", Qt::CTRL+Qt::Key_Plus);
1979 defKeys.insert("toolsZoomOut", Qt::CTRL+Qt::Key_Minus);
1980 defKeys.insert("toolsEditContents", Qt::Key_E);
1981 defKeys.insert("toolsEditWithStoryEditor", Qt::CTRL+Qt::Key_T);
1982 defKeys.insert("toolsLinkTextFrame", Qt::Key_N);
1983 defKeys.insert("toolsUnlinkTextFrame", Qt::Key_U);
1984 defKeys.insert("toolsEyeDropper", Qt::Key_Y);
1985
1986 //PDF items
1987 //Extras Menu
1988 //Windows Menu
1989 //Help Menu
1990 defKeys.insert("helpActionSearch", Qt::CTRL+Qt::Key_Slash);
1991 defKeys.insert("helpManual", Qt::Key_F1);
1992
1993 //GUI and specials
1994 defKeys.insert("specialToggleAllPalettes", Qt::Key_F12);
1995 defKeys.insert("specialToggleAllGuides", Qt::Key_F11);
1996 defKeys.insert("specialUnicodeSequenceBegin", Qt::CTRL+Qt::SHIFT+Qt::Key_U);
1997
1998 //typography
1999 defKeys.insert("unicodeFrameBreak", Qt::CTRL+Qt::Key_Return);
2000 defKeys.insert("unicodeColumnBreak", Qt::CTRL+Qt::SHIFT+Qt::Key_Return);
2001
2002 defKeys.insert("unicodeSoftHyphen", Qt::CTRL+Qt::SHIFT+Qt::Key_Minus);
2003 defKeys.insert("unicodeNonBreakingHyphen", Qt::CTRL+Qt::ALT+Qt::Key_Minus);
2004 defKeys.insert("unicodeNonBreakingSpace", Qt::CTRL+Qt::Key_Space);
2005 defKeys.insert("unicodeNarrowNoBreakSpace", Qt::CTRL+Qt::ALT+Qt::Key_Space);
2006 defKeys.insert("unicodePageNumber", Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_P);
2007 defKeys.insert("unicodeNewLine", Qt::SHIFT+Qt::Key_Return);
2008
2009 //Plugins
2010 defKeys.insert("ExportAsImage", Qt::CTRL+Qt::SHIFT+Qt::Key_E);
2011 defKeys.insert("NewFromDocumentTemplate", Qt::CTRL+Qt::ALT+Qt::Key_N);
2012 defKeys.insert("SaveAsDocumentTemplate", Qt::CTRL+Qt::ALT+Qt::Key_S);
2013 }
2014
createDefaultMenuNames()2015 void ActionManager::createDefaultMenuNames()
2016 {
2017 defMenuNames.clear();
2018
2019 defMenuNames.append(QPair<QString, QStringList>("File", QStringList()));
2020 defMenuNames.append(QPair<QString, QStringList>("Edit", QStringList()));
2021 defMenuNames.append(QPair<QString, QStringList>("Style", QStringList()));
2022 defMenuNames.append(QPair<QString, QStringList>("Item", QStringList()));
2023 defMenuNames.append(QPair<QString, QStringList>("Insert", QStringList()));
2024 defMenuNames.append(QPair<QString, QStringList>("Page", QStringList()));
2025 defMenuNames.append(QPair<QString, QStringList>("View", QStringList()));
2026 defMenuNames.append(QPair<QString, QStringList>("Table", QStringList()));
2027 defMenuNames.append(QPair<QString, QStringList>("Extras", QStringList()));
2028 defMenuNames.append(QPair<QString, QStringList>("Windows", QStringList()));
2029 defMenuNames.append(QPair<QString, QStringList>("Help", QStringList()));
2030
2031 QVector< QPair<QString, QStringList> >::Iterator itMenuNames = defMenuNames.begin();
2032 itMenuNames->second << tr("File") << "&File" << tr("&File");
2033 ++itMenuNames;
2034 itMenuNames->second << tr("Edit") << "&Edit" << tr("&Edit");
2035 ++itMenuNames;
2036 itMenuNames->second << tr("Style") << "&Style" << tr("&Style");
2037 ++itMenuNames;
2038 itMenuNames->second << tr("Item") << "&Item" << tr("&Item");
2039 ++itMenuNames;
2040 itMenuNames->second << tr("Insert") << "I&nsert" << tr("I&nsert");
2041 ++itMenuNames;
2042 itMenuNames->second << tr("Page") << "&Page" << tr("&Page");
2043 ++itMenuNames;
2044 itMenuNames->second << tr("View") << "&View" << tr("&View");
2045 ++itMenuNames;
2046 itMenuNames->second << tr("Table") << "&Table" << tr("&Table");
2047 ++itMenuNames;
2048 itMenuNames->second << tr("Extras") << "E&xtras" << tr("E&xtras");
2049 ++itMenuNames;
2050 itMenuNames->second << tr("Windows") << "&Windows" << tr("&Windows");
2051 ++itMenuNames;
2052 itMenuNames->second << tr("Help") << "&Help" << tr("&Help");
2053 ++itMenuNames;
2054 }
2055
createDefaultMenus()2056 void ActionManager::createDefaultMenus()
2057 { //CB TODO use this to also create the menus
2058
2059 if (defMenuNames.empty())
2060 createDefaultMenuNames();
2061
2062 defMenus.clear();
2063 for (int i = 0; i < defMenuNames.size(); ++i)
2064 {
2065 if (!defMenuNames.at(i).second.isEmpty())
2066 defMenus.append(QPair<QString, QStringList>(defMenuNames.at(i).second.at(0), QStringList()));
2067 }
2068 QVector< QPair<QString, QStringList> >::Iterator itmenu = defMenus.begin();
2069 //File
2070 itmenu->second
2071 << "fileNew"
2072 << "fileNewFromTemplate"
2073 << "fileOpen"
2074 << "fileClose"
2075 << "fileSave"
2076 << "fileSaveAs"
2077 << "fileRevert"
2078 << "fileCollect"
2079 << "fileImportText"
2080 << "fileImportAppendText"
2081 << "fileImportImage"
2082 << "fileImportVector"
2083 << "fileExportText"
2084 << "fileExportAsEPS"
2085 << "fileExportAsPDF"
2086 // << "fileDocSetup"
2087 << "fileDocSetup150"
2088 // << "filePreferences"
2089 << "filePreferences150"
2090 << "filePrint"
2091 << "PrintPreview"
2092 << "OutputPreviewPDF"
2093 << "OutputPreviewPS"
2094 << "fileQuit";
2095 ++itmenu;
2096 //Edit
2097 itmenu->second
2098 << "editUndoAction"
2099 << "editRedoAction"
2100 << "editActionMode"
2101 << "editCut"
2102 << "editCopy"
2103 << "editPaste"
2104 << "editCopyContents"
2105 << "editPasteContents"
2106 << "editPasteContentsAbs"
2107 << "editPasteImageFromClipboard"
2108 << "editClearContents"
2109 << "editTruncateContents"
2110 << "editSelectAll"
2111 << "editSelectAllOnLayer"
2112 << "editDeselectAll"
2113 << "editSearchReplace"
2114 << "toolsEditWithStoryEditor"
2115 << "editEditWithImageEditor"
2116 << "editEditRenderSource"
2117 << "editColorsAndFills"
2118 << "editReplaceColors"
2119 << "editStyles"
2120 << "editMarks"
2121 << "editNotesStyles"
2122 << "editMasterPages"
2123 << "editJavascripts";
2124 //Style
2125 ++itmenu;
2126 int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
2127 size_t f_size = sizeof(font_sizes) / sizeof(*font_sizes);
2128 for (uint s = 0; s < f_size; ++s)
2129 itmenu->second << QString("fontSize%1").arg(font_sizes[s]);
2130 itmenu->second
2131 << "fontSizeOther"
2132 << "alignLeft"
2133 << "alignCenter"
2134 << "alignRight"
2135 << "alignBlock"
2136 << "alignForced";
2137 // for (uint i=0; i<=100 ; i+=10)
2138 // itmenu->second << QString("shade%1").arg(i);
2139 // itmenu->second << "shadeOther";
2140 itmenu->second
2141 << "typeEffectNormal"
2142 << "typeEffectUnderline"
2143 << "typeEffectUnderlineWords"
2144 << "typeEffectStrikeThrough"
2145 << "typeEffectAllCaps"
2146 << "typeEffectSmallCaps"
2147 << "typeEffectSuperscript"
2148 << "typeEffectSubscript"
2149 << "typeEffectOutline"
2150 << "typeEffectShadow"
2151 << "styleImageEffects"
2152 << "styleTabulators";
2153 //Item
2154 ++itmenu;
2155 itmenu->second
2156 << "itemDuplicate"
2157 << "itemMulDuplicate"
2158 << "itemTransform"
2159 << "itemDelete"
2160 << "itemGroup"
2161 << "itemUngroup"
2162 << "itemGroupAdjust"
2163 << "itemLock"
2164 << "itemLockSize"
2165 << "itemImageIsVisible"
2166 << "itemUpdateImage"
2167 << "itemAdjustFrameHeightToText"
2168 << "itemAdjustFrameToImage"
2169 << "itemAdjustImageToFrame"
2170 << "itemToggleInlineImage"
2171 << "itemExtendedImageProperties"
2172 << "itemPreviewFull"
2173 << "itemPreviewNormal"
2174 << "itemPreviewLow"
2175 << "itemRaise"
2176 << "itemLower"
2177 << "itemRaiseToTop"
2178 << "itemLowerToBottom"
2179 << "itemSendToPattern"
2180 << "itemSendToInline"
2181 << "itemAttributes"
2182 << "itemPDFIsAnnotation"
2183 << "itemPDFIsBookmark"
2184 << "itemPDFAnnotationProps"
2185 << "itemPDFFieldProps"
2186 << "itemShapeEdit"
2187 << "itemConvertToBezierCurve"
2188 << "itemConvertToImageFrame"
2189 << "itemConvertToOutlines"
2190 << "itemConvertToPolygon"
2191 << "itemConvertToTextFrame"
2192 << "itemConvertToSymbolFrame"
2193 << "itemAttachTextToPath"
2194 << "itemDetachTextFromPath"
2195 << "itemCombinePolygons"
2196 << "itemSplitPolygons"
2197 << "itemsUnWeld"
2198 << "itemWeld"
2199 << "itemEditWeld"
2200 << "toolsUnlinkTextFrameAndCutText";
2201
2202 //Insert
2203 ++itmenu;
2204 itmenu->second
2205 << "insertFrame"
2206 << "toolsInsertTextFrame"
2207 << "toolsInsertImageFrame"
2208 << "toolsInsertTable"
2209 << "toolsInsertShape"
2210 << "toolsInsertPolygon"
2211 << "toolsInsertArc"
2212 << "toolsInsertSpiral"
2213 << "toolsInsertLine"
2214 << "toolsInsertBezier"
2215 << "toolsInsertFreehandLine"
2216 << "toolsInsertCalligraphicLine"
2217 << "toolsInsertRenderFrame"
2218 << "stickyTools"
2219 << "insertGlyph"
2220 << "insertSampleText"
2221 << "insertMarkAnchor"
2222 << "insertMarkVariableText"
2223 << "insertMarkItem"
2224 << "insertMark2Mark"
2225 << "insertMarkNote"
2226 // << "insertMarkIndex"
2227 << "editMark"
2228 << "itemUpdateMarks";
2229
2230 itmenu->second
2231 << "unicodeZWNJ"
2232 << "unicodeZWJ"
2233 << "unicodeSoftHyphen"
2234 << "unicodeNonBreakingHyphen"
2235 << "unicodeNonBreakingSpace"
2236 << "unicodeNarrowNoBreakSpace"
2237 << "unicodePageNumber"
2238 << "unicodePageCount"
2239 << "unicodeNewLine"
2240 << "unicodeFrameBreak"
2241 << "unicodeColumnBreak"
2242 << "unicodeZerowidthSpace"
2243 << "unicodeCopyRight"
2244 << "unicodeRegdTM"
2245 << "unicodeTM"
2246 << "unicodeSolidus"
2247 << "unicodeBullet"
2248 << "unicodeMidpoint"
2249 << "unicodeDashEm"
2250 << "unicodeDashEn"
2251 << "unicodeDashFigure"
2252 << "unicodeDashQuotation";
2253
2254 itmenu->second
2255 << "unicodeQuoteApostrophe"
2256 << "unicodeQuoteStraight"
2257 << "unicodeQuoteSingleLeft"
2258 << "unicodeQuoteSingleRight"
2259 << "unicodeQuoteDoubleLeft"
2260 << "unicodeQuoteDoubleRight"
2261 << "unicodeQuoteSingleReversed"
2262 << "unicodeQuoteDoubleReversed"
2263 << "unicodeQuoteSingleLeftGuillemet"
2264 << "unicodeQuoteSingleRightGuillemet"
2265 << "unicodeQuoteDoubleLeftGuillemet"
2266 << "unicodeQuoteDoubleRightGuillemet"
2267 << "unicodeQuoteLowSingleComma"
2268 << "unicodeQuoteLowDoubleComma"
2269 << "unicodeQuoteCJKSingleLeft"
2270 << "unicodeQuoteCJKSingleRight"
2271 << "unicodeQuoteCJKDoubleLeft"
2272 << "unicodeQuoteCJKDoubleRight";
2273
2274 itmenu->second
2275 << "unicodeSpaceEN"
2276 << "unicodeSpaceEM"
2277 << "unicodeSpaceThin"
2278 << "unicodeSpaceThick"
2279 << "unicodeSpaceMid"
2280 << "unicodeSpaceHair";
2281
2282 itmenu->second
2283 << "unicodeSoftHyphen"
2284 << "unicodeNonBreakingHyphen"
2285 << "unicodeNonBreakingSpace"
2286 << "unicodeNarrowNoBreakSpace"
2287 << "unicodePageNumber"
2288 << "unicodePageCount"
2289 << "unicodeNewLine"
2290 << "unicodeFrameBreak"
2291 << "unicodeColumnBreak";
2292
2293 itmenu->second
2294 << "unicodeLigature_ff"
2295 << "unicodeLigature_fi"
2296 << "unicodeLigature_fl"
2297 << "unicodeLigature_ffi"
2298 << "unicodeLigature_ffl"
2299 << "unicodeLigature_ft"
2300 << "unicodeLigature_st";
2301
2302
2303 //Page
2304 ++itmenu;
2305 itmenu->second
2306 << "pageInsert"
2307 << "pageImport"
2308 << "pageDelete"
2309 << "pageCopy"
2310 << "pageMove"
2311 << "pageApplyMasterPage"
2312 << "pageCopyToMasterPage"
2313 << "pageManageGuides"
2314 << "pageManageProperties"
2315 << "viewSnapToGrid"
2316 << "viewSnapToGuides"
2317 << "viewSnapToElements";
2318 //View
2319 ++itmenu;
2320 itmenu->second
2321 << "viewFitWidth"
2322 << "viewFitInWindow"
2323 << "viewFit50"
2324 << "viewFit75"
2325 << "viewFit100"
2326 << "viewFit200"
2327 << "viewFit400"
2328 << "viewPreviewMode"
2329 << "viewEditInPreview"
2330 << "viewToggleCMS"
2331 << "viewShowMargins"
2332 << "viewShowBleeds"
2333 << "viewShowFrames"
2334 << "viewShowLayerMarkers"
2335 << "viewShowImages"
2336 << "viewShowGrid"
2337 << "viewShowGuides"
2338 << "viewShowColumnBorders"
2339 << "viewShowBaseline"
2340 << "viewShowTextChain"
2341 << "viewShowTextControls"
2342 << "viewShowRulers"
2343 << "viewRulerMode"
2344 << "showMouseCoordinates";
2345 ++itmenu;
2346 itmenu->second
2347 << "tableInsertRows"
2348 << "tableInsertColumns"
2349 << "tableDeleteRows"
2350 << "tableDeleteColumns"
2351 << "tableMergeCells"
2352 << "tableSplitCells"
2353 << "tableSetRowHeights"
2354 << "tableSetColumnWidths"
2355 << "tableDistributeRowsEvenly"
2356 << "tableDistributeColumnsEvenly"
2357 << "tableAdjustFrameToTable"
2358 << "tableAdjustTableToFrame";
2359 //Extras
2360 ++itmenu;
2361 itmenu->second
2362 << "extrasManageImages"
2363 << "extrasHyphenateText"
2364 << "extrasDeHyphenateText"
2365 << "extrasGenerateTableOfContents"
2366 << "extrasUpdateDocument";
2367 //Windows
2368 ++itmenu;
2369 itmenu->second
2370 << "windowsCascade"
2371 << "windowsTile"
2372 << "toolsProperties"
2373 << "toolsContent"
2374 << "toolsOutline"
2375 << "toolsScrapbook"
2376 << "toolsLayers"
2377 << "toolsPages"
2378 << "toolsBookmarks"
2379 << "toolsDownloads"
2380 << "toolsResources"
2381 << "toolsMeasurements"
2382 << "toolsActionHistory"
2383 << "toolsPreflightVerifier"
2384 << "toolsAlignDistribute"
2385 << "toolsSymbols"
2386 << "toolsInline"
2387 << "toolsToolbarTools"
2388 << "toolsToolbarPDF"
2389 << "toolsToolbarView";
2390 //Help
2391 ++itmenu;
2392 itmenu->second
2393 << "helpAboutScribus"
2394 << "helpAboutPlugins"
2395 << "helpAboutQt"
2396 << "helpTooltips"
2397 << "helpManual"
2398 << "helpOnlineWWW"
2399 << "helpOnlineDocs"
2400 << "helpOnlineWiki"
2401 << "helpOnlineTutorial1"
2402 << "helpCheckUpdates"
2403 << "helpChat";
2404 //Other
2405 // ++itmenu;
2406 // itmenu->second << "";
2407 }
2408
createDefaultNonMenuNames()2409 void ActionManager::createDefaultNonMenuNames()
2410 {
2411 defNonMenuNames.clear();
2412
2413 defNonMenuNames.append(QPair<QString, QStringList>("Plugin Menu Items", QStringList()));
2414 defNonMenuNames.append(QPair<QString, QStringList>("Others", QStringList()));
2415 defNonMenuNames.append(QPair<QString, QStringList>("Unicode Characters", QStringList()));
2416
2417 QVector< QPair<QString, QStringList> >::Iterator itNonMenuNames = defNonMenuNames.begin();
2418 itNonMenuNames->second << tr("Plugin Menu Items") << "Plugin Menu Items" << tr("Plugin Menu Items");
2419 ++itNonMenuNames;
2420 itNonMenuNames->second << tr("Others") << "Others" << tr("Others");
2421 ++itNonMenuNames;
2422 itNonMenuNames->second << tr("Unicode Characters") << "Unicode Characters" << tr("Unicode Characters");
2423 ++itNonMenuNames;
2424 }
2425
createDefaultNonMenuActions()2426 void ActionManager::createDefaultNonMenuActions()
2427 { //CB TODO use this to also create the menus
2428
2429 if (defNonMenuNames.empty())
2430 createDefaultNonMenuNames();
2431
2432 defNonMenuActions.clear();
2433 for (int i = 0; i < defNonMenuNames.size(); ++i)
2434 {
2435 if (!defNonMenuNames.at(i).second.isEmpty())
2436 defNonMenuActions.append(QPair<QString, QStringList>(defNonMenuNames.at(i).second.at(0), QStringList()));
2437 }
2438 /*
2439 defNonMenuActions.append(QPair<QString, QStringList>("Plugin Menu Items", QStringList()));
2440 defNonMenuActions.append(QPair<QString, QStringList>("Others", QStringList()));
2441 defNonMenuActions.append(QPair<QString, QStringList>("Unicode Characters", QStringList()));
2442 */
2443
2444 QVector< QPair<QString, QStringList> >::Iterator itnmenua = defNonMenuActions.begin();
2445 //Plugins
2446 // itnmenua->second << "ExportAsImage";
2447 // itnmenua->second << "NewFromDocumentTemplate";
2448 // itnmenua->second << "SaveAsDocumentTemplate";
2449
2450 //Others
2451 ++itnmenua;
2452 itnmenua->second << "toolsSelect";
2453 itnmenua->second << "toolsRotate";
2454 itnmenua->second << "toolsZoom";
2455 itnmenua->second << "toolsZoomIn";
2456 itnmenua->second << "toolsZoomOut";
2457 itnmenua->second << "toolsEditContents";
2458 itnmenua->second << "toolsLinkTextFrame";
2459 itnmenua->second << "toolsUnlinkTextFrame";
2460 // itnmenua->second << "toolsUnlinkTextFrameAndCutText";
2461 itnmenua->second << "toolsEyeDropper";
2462 itnmenua->second << "toolsCopyProperties";
2463 itnmenua->second << "toolsPDFPushButton";
2464 itnmenua->second << "toolsPDFRadioButton";
2465 itnmenua->second << "toolsPDFTextField";
2466 itnmenua->second << "toolsPDFCheckBox";
2467 itnmenua->second << "toolsPDFListBox";
2468 itnmenua->second << "toolsPDFAnnotText";
2469 itnmenua->second << "toolsPDFAnnotLink";
2470 #ifdef HAVE_OSG
2471 itnmenua->second << "toolsPDFAnnot3D";
2472 #endif
2473 itnmenua->second << "specialToggleAllPalettes";
2474 itnmenua->second << "specialToggleAllGuides";
2475 itnmenua->second << "specialUnicodeSequenceBegin";
2476 itnmenua->second << "viewShowContextMenu";
2477
2478 //Unicode
2479 ++itnmenua;
2480 itnmenua->second << "unicodeZWNJ";
2481 itnmenua->second << "unicodeZWJ";
2482 itnmenua->second << "unicodeSoftHyphen";
2483 itnmenua->second << "unicodeNonBreakingHyphen";
2484 itnmenua->second << "unicodeNonBreakingSpace";
2485 itnmenua->second << "unicodeNarrowNoBreakSpace";
2486 itnmenua->second << "unicodePageNumber";
2487 itnmenua->second << "unicodePageCount";
2488 itnmenua->second << "unicodeNewLine";
2489 itnmenua->second << "unicodeFrameBreak";
2490 itnmenua->second << "unicodeColumnBreak";
2491 itnmenua->second << "unicodeZerowidthSpace";
2492 itnmenua->second << "unicodeCopyRight";
2493 itnmenua->second << "unicodeRegdTM";
2494 itnmenua->second << "unicodeTM";
2495 itnmenua->second << "unicodeSolidus";
2496 itnmenua->second << "unicodeBullet";
2497 itnmenua->second << "unicodeMidpoint";
2498 itnmenua->second << "unicodeDashEm";
2499 itnmenua->second << "unicodeDashEn";
2500 itnmenua->second << "unicodeDashFigure";
2501 itnmenua->second << "unicodeDashQuotation";
2502
2503 itnmenua->second << "unicodeQuoteApostrophe";
2504 itnmenua->second << "unicodeQuoteStraight";
2505 itnmenua->second << "unicodeQuoteSingleLeft";
2506 itnmenua->second << "unicodeQuoteSingleRight";
2507 itnmenua->second << "unicodeQuoteDoubleLeft";
2508 itnmenua->second << "unicodeQuoteDoubleRight";
2509 itnmenua->second << "unicodeQuoteSingleReversed";
2510 itnmenua->second << "unicodeQuoteDoubleReversed";
2511 itnmenua->second << "unicodeQuoteSingleLeftGuillemet";
2512 itnmenua->second << "unicodeQuoteSingleRightGuillemet";
2513 itnmenua->second << "unicodeQuoteDoubleLeftGuillemet";
2514 itnmenua->second << "unicodeQuoteDoubleRightGuillemet";
2515 itnmenua->second << "unicodeQuoteLowSingleComma";
2516 itnmenua->second << "unicodeQuoteLowDoubleComma";
2517 itnmenua->second << "unicodeQuoteCJKSingleLeft";
2518 itnmenua->second << "unicodeQuoteCJKSingleRight";
2519 itnmenua->second << "unicodeQuoteCJKDoubleLeft";
2520 itnmenua->second << "unicodeQuoteCJKDoubleRight";
2521
2522 itnmenua->second << "unicodeSpaceEN";
2523 itnmenua->second << "unicodeSpaceEM";
2524 itnmenua->second << "unicodeSpaceThin";
2525 itnmenua->second << "unicodeSpaceThick";
2526 itnmenua->second << "unicodeSpaceMid";
2527 itnmenua->second << "unicodeSpaceHair";
2528
2529 itnmenua->second << "unicodeZWNJ";
2530 itnmenua->second << "unicodeZWJ";
2531
2532 itnmenua->second << "unicodeSoftHyphen";
2533 itnmenua->second << "unicodeNonBreakingHyphen";
2534 itnmenua->second << "unicodeNonBreakingSpace";
2535 itnmenua->second << "unicodePageNumber";
2536 itnmenua->second << "unicodePageCount";
2537 itnmenua->second << "unicodeNewLine";
2538
2539 itnmenua->second << "unicodeLigature_ff";
2540 itnmenua->second << "unicodeLigature_fi";
2541 itnmenua->second << "unicodeLigature_fl";
2542 itnmenua->second << "unicodeLigature_ffi";
2543 itnmenua->second << "unicodeLigature_ffl";
2544 itnmenua->second << "unicodeLigature_ft";
2545 itnmenua->second << "unicodeLigature_st";
2546 }
2547
handleMultipleSelections()2548 void ActionManager::handleMultipleSelections()
2549 {
2550 bool isMultiple = true;
2551 if (mainWindow->HaveDoc && (mainWindow->doc->m_Selection->count() <= 1))
2552 isMultiple = false;
2553 (*scrActions)["itemAttributes"]->setEnabled(!isMultiple);
2554 }
2555
languageChangeActions()2556 void ActionManager::languageChangeActions()
2557 {
2558 //Here we mangle the URL based on the current GUI language, returning English if we don't get one of these hard coded options.
2559 //CB TODO make more flexible one day.
2560 QString language("EN");
2561 QString langpref(ScCore->getGuiLanguage().left(2));
2562 if (langpref=="de" || langpref=="fr" || langpref=="po" || langpref=="pt" || langpref=="ru")
2563 language=langpref.toUpper();
2564 (*scrActions)["helpOnlineTutorial1"]->setActionQString("http://wiki.scribus.net/index.php/tutorial"+language);
2565 }
2566
defaultKey(const QString & actionName)2567 QKeySequence ActionManager::defaultKey(const QString& actionName)
2568 {
2569 if (defKeys.contains(actionName))
2570 return defKeys.value(actionName);
2571 return QKeySequence();
2572 }
2573
2574
defaultMenuNameEntryTranslated(const QString & index)2575 QString ActionManager::defaultMenuNameEntryTranslated(const QString& index)
2576 {
2577 for (int i = 0; i < defMenuNames.size(); ++i)
2578 {
2579 if (defMenuNames.at(i).first == index)
2580 return defMenuNames.at(i).second.at(2);
2581 }
2582 return QString();
2583 }
2584
2585