r18903 by craig - Move enableTextActions code to AppModeHelper
scribus-commit
scribus-commit at lists.scribus.net
Wed Mar 12 19:51:06 UTC 2014
Author: craig
Date: Wed Mar 12 19:51:05 2014
New Revision: 18903
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18903
Log:
Move enableTextActions code to AppModeHelper
Modified:
trunk/Scribus/scribus/appmodehelper.cpp
trunk/Scribus/scribus/appmodehelper.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribus.h
Modified: trunk/Scribus/scribus/appmodehelper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18903&path=/trunk/Scribus/scribus/appmodehelper.cpp
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.cpp (original)
+++ trunk/Scribus/scribus/appmodehelper.cpp Wed Mar 12 19:51:05 2014
@@ -22,10 +22,12 @@
QObject(parent)
{
scrActions=NULL;
-}
-
-void AppModeHelper::setScrActions(QMap<QString, QPointer<ScrAction> > *scra)
-{
+ actMgr=NULL;
+}
+
+void AppModeHelper::setup(ActionManager* am, QMap<QString, QPointer<ScrAction> > *scra)
+{
+ actMgr=am;
scrActions=scra;
}
@@ -231,3 +233,18 @@
(*scrActions)["toolsPDFAnnotText"]->setEnabled(setter2);
(*scrActions)["toolsPDFAnnotLink"]->setEnabled(setter);
}
+
+void AppModeHelper::enableTextActions(bool enabled, const QString& fontName)
+{
+ (*scrActions)["insertGlyph"]->setEnabled(enabled);
+ actMgr->enableUnicodeActions(scrActions, enabled, fontName);
+ if (!enabled)
+ {
+ (*scrActions)["insertMarkVariableText"]->setEnabled(false);
+ (*scrActions)["insertMarkAnchor"]->setEnabled(false);
+ (*scrActions)["insertMarkItem"]->setEnabled(false);
+ (*scrActions)["insertMark2Mark"]->setEnabled(false);
+ (*scrActions)["insertMarkNote"]->setEnabled(false);
+ (*scrActions)["editMark"]->setEnabled(false);
+ }
+}
Modified: trunk/Scribus/scribus/appmodehelper.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18903&path=/trunk/Scribus/scribus/appmodehelper.h
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.h (original)
+++ trunk/Scribus/scribus/appmodehelper.h Wed Mar 12 19:51:05 2014
@@ -33,12 +33,14 @@
public:
explicit AppModeHelper(QObject *parent = 0);
- void setScrActions(QMap<QString, QPointer<ScrAction> > *);
+ void setup(ActionManager* am, QMap<QString, QPointer<ScrAction> > *);
void setFrameEditMode(bool b);
void setSymbolEditMode(bool b, ScribusDoc* doc);
void setInlineEditMode(bool b, ScribusDoc* doc);
void setMasterPageEditMode(bool b, ScribusDoc *doc);
void changeLayer(ScribusDoc *doc, bool clipScrapHaveData);
+ //! \brief enable or disable the unicode actions and their menus
+ void enableTextActions(bool enabled, const QString& fontName=QString::null);
signals:
@@ -46,6 +48,7 @@
protected:
QMap<QString, QPointer<ScrAction> > *scrActions;
+ ActionManager* actMgr;
};
#endif // APPMODEHELPER_H
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18903&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Mar 12 19:51:05 2014
@@ -341,8 +341,8 @@
scrWindowsActions.clear();
scrLayersActions.clear();
scrScrapActions.clear();
- appModeHelper.setScrActions(&scrActions);
actionManager = new ActionManager(this);
+ appModeHelper.setup(actionManager, &scrActions);
scrMenuMgr = new ScMWMenuManager(menuBar(), actionManager);
prefsManager = PrefsManager::instance();
formatsManager = FormatsManager::instance();
@@ -2821,7 +2821,7 @@
scrActions["itemPreviewFull"]->setChecked(false);
}
if ((SelectedType==-1) || (SelectedType!=-1 && !currItem->asTextFrame()))
- enableTextActions(&scrActions, false);
+ appModeHelper.enableTextActions(false);
scrActions["insertSampleText"]->setEnabled(false);
view->horizRuler->textMode(false);
@@ -3024,7 +3024,7 @@
charPalette->setEnabled(true, currItem);
if (currItem->asTextFrame())
{
- enableTextActions(&scrActions, true, currItem->currentStyle().charStyle().font().scName());
+ appModeHelper.enableTextActions(true, currItem->currentStyle().charStyle().font().scName());
currItem->asTextFrame()->togleEditModeActions();
}
view->horizRuler->setItem(currItem);
@@ -3054,7 +3054,7 @@
{
charPalette->setEnabled(true, currItem);
PageItem *i2 = currItem->asTable()->activeCell().textFrame();
- enableTextActions(&scrActions, true, i2->currentCharStyle().font().scName());
+ appModeHelper.enableTextActions(true, i2->currentCharStyle().font().scName());
scrActions["insertSampleText"]->setEnabled(true);
scrActions["toolsEditWithStoryEditor"]->setEnabled(true);
}
@@ -6768,7 +6768,7 @@
{
outlinePalette->setEnabled(true);
charPalette->setEnabled(false, 0);
- enableTextActions(&scrActions, false);
+ appModeHelper.enableTextActions(false);
scrActions["insertSampleText"]->setEnabled(false);
scrActions["toolsEditWithStoryEditor"]->setEnabled(false);
actionManager->restoreActionShortcutsPostEditMode();
@@ -6780,7 +6780,7 @@
scrActions["insertSampleText"]->setEnabled(true);
scrActions["toolsEditWithStoryEditor"]->setEnabled(true);
PageItem *i2 = currItem->asTable()->activeCell().textFrame();
- enableTextActions(&scrActions, true, i2->currentCharStyle().font().scName());
+ appModeHelper.enableTextActions(true, i2->currentCharStyle().font().scName());
actionManager->saveActionShortcutsPreEditMode();
}
if (oldMode == modeEdit)
@@ -6794,7 +6794,7 @@
{
currItem->update();
if (currItem->asTextFrame())
- enableTextActions(&scrActions, false);
+ appModeHelper.enableTextActions(false);
// scrMenuMgr->setMenuEnabled("Item", true);
scrActions["itemDuplicate"]->setEnabled(true);
scrActions["itemMulDuplicate"]->setEnabled(true);
@@ -6840,7 +6840,7 @@
charPalette->setEnabled(true, currItem);
if (currItem!=NULL && currItem->asTextFrame())
{
- enableTextActions(&scrActions, true, currItem->currentCharStyle().font().scName());
+ appModeHelper.enableTextActions(true, currItem->currentCharStyle().font().scName());
currItem->asTextFrame()->togleEditModeActions();
}
if (ScMimeData::clipboardHasScribusData())
@@ -6889,7 +6889,7 @@
}
//disable text action which work only text frame in edit mode
if ((mode != modeEdit) || !currItem->isTextFrame())
- enableTextActions(&scrActions, false);
+ appModeHelper.enableTextActions(false);
int docSelectionCount=doc->m_Selection->count();
if (mode == modeDrawBezierLine)
{
@@ -10665,26 +10665,6 @@
}
}
-void ScribusMainWindow::enableTextActions(QMap<QString, QPointer<ScrAction> > *actionMap, bool enabled, const QString& fontName)
-{
- scrActions["insertGlyph"]->setEnabled(enabled);
- actionManager->enableUnicodeActions(actionMap, enabled, fontName);
- scrMenuMgr->setMenuEnabled("InsertChar", enabled);
- scrMenuMgr->setMenuEnabled("InsertQuote", enabled);
- scrMenuMgr->setMenuEnabled("InsertSpace", enabled);
- scrMenuMgr->setMenuEnabled("InsertLigature", enabled);
- scrMenuMgr->setMenuEnabled("InsertMark", enabled);
- if (!enabled)
- {
- scrActions["insertMarkVariableText"]->setEnabled(false);
- scrActions["insertMarkAnchor"]->setEnabled(false);
- scrActions["insertMarkItem"]->setEnabled(false);
- scrActions["insertMark2Mark"]->setEnabled(false);
- scrActions["insertMarkNote"]->setEnabled(false);
- scrActions["editMark"]->setEnabled(false);
- }
-}
-
void ScribusMainWindow::updateGUIAfterPagesChanged()
{
view->DrawNew();
@@ -11198,8 +11178,8 @@
{
if (Mrk != mrk)
{
- currItem->itemText.replaceMark(currItem->itemText.cursorPosition(), Mrk);
- mrk = Mrk;
+ currItem->itemText.replaceMark(currItem->itemText.cursorPosition(), Mrk);
+ mrk = Mrk;
oldMark = *mrk;
replaceMark = true;
}
Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18903&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Wed Mar 12 19:51:05 2014
@@ -516,8 +516,6 @@
void slotItemTransform();
//! \brief manages paints
void managePaints();
- //! \brief enable or disable the unicode actions and their menus
- void enableTextActions(QMap<QString, QPointer<ScrAction> > *actionMap, bool enabled, const QString& fontName=QString::null);
//! \brief allow SE to get the SM for edit stlyes
StyleManager *styleMgr() const {return styleManager;};
//! \brief drawnew, call palettes to update for new page layout
More information about the scribus-commit
mailing list