r18928 by craig - Move Toggle Bookmark and Annotation to the doc

scribus-commit scribus-commit at lists.scribus.net
Fri Mar 21 22:03:38 UTC 2014


Author: craig
Date: Fri Mar 21 22:03:37 2014
New Revision: 18928

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18928
Log:
Move Toggle Bookmark and Annotation to the doc

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/scribusview.h

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18928&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Fri Mar 21 22:03:37 2014
@@ -1400,8 +1400,8 @@
 		(*scrActions)["itemPDFAnnotationProps"]->setEnabled(false);
 		(*scrActions)["itemPDFFieldProps"]->setEnabled(false);
 	}
-	connect( (*scrActions)["itemPDFIsAnnotation"], SIGNAL(triggered()), currView, SLOT(ToggleAnnotation()) );
-	connect( (*scrActions)["itemPDFIsBookmark"], SIGNAL(triggered()), currView, SLOT(ToggleBookmark()) );
+	connect( (*scrActions)["itemPDFIsAnnotation"], SIGNAL(triggered()), mainWindow->doc, SLOT(itemSelection_ToggleAnnotation()) );
+	connect( (*scrActions)["itemPDFIsBookmark"], SIGNAL(triggered()), mainWindow->doc, SLOT(itemSelection_ToggleBookMark()) );
 }
 
 void ActionManager::changeEvent(QEvent *e)

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18928&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Fri Mar 21 22:03:37 2014
@@ -2228,6 +2228,9 @@
 		disconnect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin()));
 		disconnect(undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone()));
 		disconnect(undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew()));
+		disconnect(doc, SIGNAL(addBookmark(PageItem *)), this, SLOT(AddBookMark(PageItem *)));
+		disconnect(doc, SIGNAL(deleteBookmark(PageItem *)), this, SLOT(DelBookMark(PageItem *)));
+
 	}
 
 	doc = ActWin->doc();
@@ -2238,6 +2241,9 @@
 		connect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin()));
 		connect(undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone()));
 		connect(undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew()));
+		connect(doc, SIGNAL(addBookmark(PageItem *)), this, SLOT(AddBookMark(PageItem *)));
+		connect(doc, SIGNAL(deleteBookmark(PageItem *)), this, SLOT(DelBookMark(PageItem *)));
+
 	}
 
 	if (view!=NULL)

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18928&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Fri Mar 21 22:03:37 2014
@@ -9036,6 +9036,98 @@
 	}*/
 }
 
+void ScribusDoc::itemSelection_ToggleBookMark(Selection *customSelection)
+{
+	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+	assert(itemSelection!=0);
+	uint selectedItemCount=itemSelection->count();
+	if (selectedItemCount == 0)
+		return;
+
+	for (uint a = 0; a < selectedItemCount; ++a)
+	{
+		UndoTransaction* activeTransaction = NULL;
+		if (UndoManager::undoEnabled())
+			activeTransaction = new UndoTransaction(undoManager->beginTransaction());
+		PageItem* currItem = itemSelection->itemAt(a);
+		if (currItem->asTextFrame())
+		{
+			if (currItem->OwnPage != -1)
+			{
+				bool old = currItem->isBookmark;
+				currItem->setIsBookMark(!currItem->isBookmark);
+				if (currItem->isBookmark)
+				{
+					currItem->setIsAnnotation(false);
+					emit addBookmark(currItem);
+				}
+				else
+				{
+					if (old)
+						emit deleteBookmark(currItem);
+				}
+			}
+		}
+		if (activeTransaction){
+			activeTransaction->commit(Um::Selection,
+									  Um::IGroup,
+									  Um::ActionPDF,
+									  "",
+									  Um::IGroup);
+			delete activeTransaction;
+			activeTransaction = NULL;
+		}
+	}
+	m_ScMW->actionManager->setPDFActions(m_View);
+	changed();
+}
+
+void ScribusDoc::itemSelection_ToggleAnnotation(Selection *customSelection)
+{
+	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+	assert(itemSelection!=0);
+	uint selectedItemCount=itemSelection->count();
+	if (selectedItemCount == 0)
+		return;
+
+	for (uint a = 0; a < selectedItemCount; ++a)
+	{
+		UndoTransaction* activeTransaction = NULL;
+		if (UndoManager::undoEnabled())
+			activeTransaction = new UndoTransaction(undoManager->beginTransaction());
+		PageItem* currItem = itemSelection->itemAt(a);
+		if (currItem->asTextFrame())
+		{
+			bool old = currItem->isBookmark;
+			currItem->setIsAnnotation(!currItem->isAnnotation());
+			if (currItem->isAnnotation())
+			{
+				currItem->AutoName = false;
+				if (m_masterPageMode)
+				{
+					currItem->annotation().setType(Annotation::Link);
+					currItem->annotation().setZiel(0);
+					currItem->annotation().setAction("0 0");
+				}
+				if (old)
+					emit deleteBookmark(currItem);
+				currItem->isBookmark = false;
+			}
+		}
+		if (activeTransaction){
+			activeTransaction->commit(Um::Selection,
+									  Um::IGroup,
+									  Um::ActionPDF,
+									  "",
+									  Um::IGroup);
+			delete activeTransaction;
+			activeTransaction = NULL;
+		}
+	}
+	m_ScMW->actionManager->setPDFActions(m_View);
+	changed();
+}
+
 void ScribusDoc::itemSelection_SetParagraphStyle(const ParagraphStyle & newStyle, Selection* customSelection)
 {
 	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18928&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Fri Mar 21 22:03:37 2014
@@ -1408,6 +1408,8 @@
 	void rotationMode(int);
 	void updateEditItem();
 	void updateAutoSaveClock();
+	void addBookmark(PageItem *);
+	void deleteBookmark(PageItem *);
 	
 public slots:
 	void selectionChanged();
@@ -1415,6 +1417,8 @@
 	void itemSelection_ToggleSizeLock();
 	void itemSelection_ToggleImageShown();
 	void itemSelection_TogglePrintEnabled();
+	void itemSelection_ToggleBookMark(Selection* customSelection=0);
+	void itemSelection_ToggleAnnotation(Selection* customSelection=0);
 	void itemSelection_Transform(int nrOfCopies, QTransform matrix, int basepoint);
 	void itemSelection_ChangePreviewResolution(int id);
 

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18928&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Fri Mar 21 22:03:37 2014
@@ -1867,96 +1867,6 @@
 	}
 	if (prop && !Doc->m_Selection->signalsDelayed())
 		emit HaveSel(-1);
-}
-
-
-//CB-->Doc/Fix
-void ScribusView::ToggleBookmark()
-{
-	uint docSelectionCount=Doc->m_Selection->count();
-	if (docSelectionCount != 0)
-	{
-		for (uint a = 0; a < docSelectionCount; ++a)
-		{
-			UndoTransaction* activeTransaction = NULL;
-			if (UndoManager::undoEnabled())
-				activeTransaction = new UndoTransaction(undoManager->beginTransaction());
-			PageItem* currItem = Doc->m_Selection->itemAt(a);
-			if (currItem->asTextFrame())
-			{
-				if (currItem->OwnPage != -1)
-				{
-					bool old = currItem->isBookmark;
-					currItem->setIsBookMark(!currItem->isBookmark);
-					if (currItem->isBookmark)
-					{
-						currItem->setIsAnnotation(false);
-						emit AddBM(currItem);
-					}
-					else
-					{
-						if (old)
-							emit DelBM(currItem);
-					}
-				}
-			}
-			if (activeTransaction){
-				activeTransaction->commit(Um::Selection,
-										  Um::IGroup,
-										  Um::ActionPDF,
-										  "",
-										  Um::IGroup);
-				delete activeTransaction;
-				activeTransaction = NULL;
-			}
-		}
-		m_ScMW->actionManager->setPDFActions(this);
-		emit DocChanged();
-	}
-}
-
-//CB-->Doc/Fix
-void ScribusView::ToggleAnnotation()
-{
-	if (Doc->m_Selection->count() != 0)
-	{
-		for (int a = 0; a < Doc->m_Selection->count(); ++a)
-		{
-			UndoTransaction* activeTransaction = NULL;
-			if (UndoManager::undoEnabled())
-				activeTransaction = new UndoTransaction(undoManager->beginTransaction());
-			PageItem* currItem = Doc->m_Selection->itemAt(a);
-			if (currItem->asTextFrame())
-			{
-				bool old = currItem->isBookmark;
-				currItem->setIsAnnotation(!currItem->isAnnotation());
-				if (currItem->isAnnotation())
-				{
-					currItem->AutoName = false;
-					if (Doc->masterPageMode())
-					{
-						currItem->annotation().setType(Annotation::Link);
-						currItem->annotation().setZiel(0);
-						currItem->annotation().setAction("0 0");
-					}
-					if (old)
-						emit DelBM(currItem);
-					currItem->isBookmark = false;
-				}
-			}
-			if (activeTransaction){
-				activeTransaction->commit(Um::Selection,
-										  Um::IGroup,
-										  Um::ActionPDF,
-										  "",
-										  Um::IGroup);
-				delete activeTransaction;
-				activeTransaction = NULL;
-			}
-		}
-		m_ScMW->actionManager->setPDFActions(this);
-		emit DocChanged();
-	}
 }
 
  // FIXME:av -> CanvasMode_legacy / Doc

Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18928&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Fri Mar 21 22:03:37 2014
@@ -287,8 +287,6 @@
 	void SetCCPo(double x, double y);
 	void editExtendedImageProperties();
 	void RefreshGradient(PageItem *currItem, double dx = 8, double dy = 8);
-	void ToggleBookmark();
-	void ToggleAnnotation();
 	void ToPicFrame();
 	void ToPolyFrame();
 	void ToTextFrame();




More information about the scribus-commit mailing list