r17976 by fschmid - Preview Mode: first steps to handle the various user events (button press, release etc...) for widget annotations

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 23 16:42:06 UTC 2012


Author: fschmid
Date: Sun Dec 23 16:42:06 2012
New Revision: 17976

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17976
Log:
Preview Mode: first steps to handle the various user events (button press, release etc...) for widget annotations

Modified:
    trunk/Scribus/scribus/annotation.h
    trunk/Scribus/scribus/canvas.cpp
    trunk/Scribus/scribus/canvasmode.cpp
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/canvasmode_normal.h
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/annot.cpp

Modified: trunk/Scribus/scribus/annotation.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/annotation.h
==============================================================================
--- trunk/Scribus/scribus/annotation.h (original)
+++ trunk/Scribus/scribus/annotation.h Sun Dec 23 16:42:06 2012
@@ -41,7 +41,7 @@
 						AnToolTip(""), AnRollOver(""), AnDown(""), AnBColor(""), An_Extern(""), AnBsty(0),
 						AnBwid(1), AnFeed(1), AnZiel(0), AnFlag(0), AnMaxChar(-1), AnVis(0), AnChkStil(0),
 						AnFont(4), AnIsChk(false), AnAAact(false), AnHTML(0), AnUseIcons(false),
-						AnIPlace(1), AnScaleW(0), AnFormat(0)
+						AnIPlace(1), AnScaleW(0), AnFormat(0), tmp_Chk(false), on_State(false)
 		{
 		}
 		enum AnnotationType {
@@ -106,6 +106,8 @@
 	void setChkStil(int newChkStil) { AnChkStil=newChkStil; }
 	void setFormat(int newFormat) { AnFormat=newFormat; }
 	void setIsChk(bool newIsChk) { AnIsChk=newIsChk; }
+	void setCheckState(bool newIsChk) { tmp_Chk=newIsChk; }
+	void setOnState(bool newIsChk) { on_State=newIsChk; }
 	void setAAact(bool newAAct) { AnAAact=newAAct; }
 	void setHTML(int newHTML) { AnHTML=newHTML; }
 	void setUseIcons(bool newUseIcons) { AnUseIcons=newUseIcons; }
@@ -140,6 +142,8 @@
 	int ChkStil() const { return AnChkStil; }
 	int Format() const { return AnFormat; }
 	bool IsChk() const { return AnIsChk; }
+	bool IsChecked() const { return tmp_Chk; }
+	bool IsOn() const { return on_State; }
 	bool AAact() const { return AnAAact; }
 	int HTML() const { return AnHTML; }
 	bool UseIcons() const { return AnUseIcons; }
@@ -180,6 +184,8 @@
 		int AnIPlace;
 		int AnScaleW;
 		int AnFormat;
+		bool tmp_Chk;
+		bool on_State;
 };
 
 #endif

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Sun Dec 23 16:42:06 2012
@@ -477,7 +477,7 @@
 			--currNr;
 			continue;
 		}
-		if ((m_doc->drawAsPreview && !m_doc->editOnPreview) && !currItem->isAnnotation())
+		if ((m_doc->drawAsPreview && !m_doc->editOnPreview) && !currItem->isAnnotation() && !allowInGroup)
 		{
 			--currNr;
 			continue;

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Sun Dec 23 16:42:06 2012
@@ -272,6 +272,8 @@
 	m_pen["selection-group-inside"].setCosmetic(true);
 	QPen ba = QPen(Qt::white, 3.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 	ba.setCosmetic(true);
+	QPen bb = QPen(Qt::black, 1.0, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin);
+	bb.setCosmetic(true);
 	psx->scale(m_canvas->scale(), m_canvas->scale());
 	psx->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
 	
@@ -371,16 +373,25 @@
 				x = -currItem->visualLineWidth() / 2.0;
 				y = -currItem->visualLineWidth() / 2.0;
 				psx->setBrush(Qt::NoBrush);
-				psx->setPen(ba);
 				QRectF drRect = QRectF(x, y, w, h).normalized();
-				psx->drawRect(drRect);
-				if (drawHandles)
-					drawSelectionHandles(psx, QRectF(x, y, w, h), true, true, sx, sy);
-				psx->setPen(m_pen["selection-group-inside"]);
-				psx->setBrush(m_brush["selection-group-inside"]);
-				psx->drawRect(drRect);
-				if (drawHandles)
-					drawSelectionHandles(psx, QRectF(x, y, w, h), false, true, sx, sy);
+				if (m_doc->drawAsPreview && !m_doc->editOnPreview)
+				{
+					psx->setPen(bb);
+					psx->setBrush(Qt::NoBrush);
+					psx->drawRect(drRect.adjusted(-1, -1, 1, 1));
+				}
+				else
+				{
+					psx->setPen(ba);
+					psx->drawRect(drRect);
+					if (drawHandles)
+						drawSelectionHandles(psx, QRectF(x, y, w, h), true, true, sx, sy);
+					psx->setPen(m_pen["selection-group-inside"]);
+					psx->setBrush(m_brush["selection-group-inside"]);
+					psx->drawRect(drRect);
+					if (drawHandles)
+						drawSelectionHandles(psx, QRectF(x, y, w, h), false, true, sx, sy);
+				}
 			}
 			else
 			{
@@ -401,13 +412,22 @@
 					y = currItem->asLine() ? 0 : -lineAdjust;
 				}
 				psx->setBrush(Qt::NoBrush);
-				psx->setPen(ba);
-				psx->drawRect(QRectF(x, y, w, h));
-				if(drawHandles && !currItem->locked() && !currItem->isLine())
-					drawSelectionHandles(psx, QRectF(x, y, w, h), true);
-				psx->setPen(m_pen["selection"]);
-				psx->setBrush(m_brush["selection"]);
-				psx->drawRect(QRectF(x, y, w, h));
+				if (m_doc->drawAsPreview && !m_doc->editOnPreview)
+				{
+					psx->setPen(bb);
+					psx->setBrush(Qt::NoBrush);
+					psx->drawRect(QRectF(x, y, w, h).adjusted(-1, -1, 1, 1));
+				}
+				else
+				{
+					psx->setPen(ba);
+					psx->drawRect(QRectF(x, y, w, h));
+					if(drawHandles && !currItem->locked() && !currItem->isLine())
+						drawSelectionHandles(psx, QRectF(x, y, w, h), true);
+					psx->setPen(m_pen["selection"]);
+					psx->setBrush(m_brush["selection"]);
+					psx->drawRect(QRectF(x, y, w, h));
+				}
 				if(drawHandles && !currItem->locked())
 				{
 					if(currItem->asLine())
@@ -733,6 +753,7 @@
 		case modeEditMeshPatch:
 		case modeEditWeldPoint:
 		case modeInsertPDFButton:
+		case modeInsertPDFRadioButton:
 		case modeInsertPDFTextfield:
 		case modeInsertPDFCheckbox:
 		case modeInsertPDFCombobox:

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sun Dec 23 16:42:06 2012
@@ -476,7 +476,10 @@
 				newX = mousePointDoc.x(); //static_cast<int>(m->x()/sc);
 				newY = mousePointDoc.y(); //static_cast<int>(m->y()/sc);
 				m_canvas->m_viewMode.operItemMoving = true;
-				qApp->changeOverrideCursor(Qt::ClosedHandCursor);
+				if (!(m_doc->drawAsPreview && !m_doc->editOnPreview))
+					qApp->changeOverrideCursor(Qt::ClosedHandCursor);
+				else
+					qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 				erf = false;
 				int dX = qRound(newX - m_mousePressPoint.x()), dY = qRound(newY - m_mousePressPoint.y());
 				if (!m_doc->m_Selection->isMultipleSelection())
@@ -750,7 +753,7 @@
 //					setModeCursor();
 				}
 			}
-			if (GetItem(&currItem) && m_doc->appMode == modeNormal)
+			if (GetItem(&currItem) && (m_doc->appMode == modeNormal))
 			{
 				int how = m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem);
 				if (how > 0)
@@ -762,10 +765,15 @@
 						if ((!currItem->sizeHLocked() && !currItem->sizeVLocked()) || (currItem->sizeHLocked() && (how == 5 || how == 8))
 							|| (currItem->sizeVLocked() && (how == 6 || how == 7)))
 						setResizeCursor(how, currItem->rotation());
-				}
+					}
 				}
 				else if (how == 0)
-					qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
+				{
+					if (!(m_doc->drawAsPreview && !m_doc->editOnPreview))
+						qApp->changeOverrideCursor(QCursor(Qt::OpenHandCursor));
+					else
+						qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+				}
 				else
 				{
 					qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
@@ -848,8 +856,10 @@
 //#7928			else
 //#7928				return;
 		}
-		
-		qApp->changeOverrideCursor(Qt::ClosedHandCursor);
+		if (!(m_doc->drawAsPreview && !m_doc->editOnPreview))
+			qApp->changeOverrideCursor(Qt::ClosedHandCursor);
+		else
+			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 #if 1				
 		if (m_doc->m_Selection->isMultipleSelection() && (!m_doc->drawAsPreview))
 		{
@@ -918,7 +928,8 @@
 		}
 		else
 		{
-			m_canvas->setRenderModeFillBuffer();
+			if (!(m_doc->drawAsPreview && !m_doc->editOnPreview))
+				m_canvas->setRenderModeFillBuffer();
 		}
 	}
 /*	if (m->button() == MidButton)
@@ -932,6 +943,23 @@
 	{
 		m_canvas->m_viewMode.m_MouseButtonPressed = true;
 		m_mousePressPoint = m_mouseCurrentPoint;
+	}
+	if (m_doc->drawAsPreview && !m_doc->editOnPreview)
+	{
+		m_canvas->setRenderModeUseBuffer(false);
+		if (m_doc->m_Selection->count() == 1)
+		{
+			currItem = m_doc->m_Selection->itemAt(0);
+			if (currItem->isAnnotation())
+			{
+				if (currItem->annotation().Type() == Annotation::Checkbox)
+					handleCheckBoxPress(currItem);
+				else if (currItem->annotation().Type() == Annotation::RadioButton)
+					handleRadioButtonPress(currItem);
+				else if (currItem->annotation().Type() == Annotation::Button)
+					handlePushButtonPress(currItem);
+			}
+		}
 	}
 // Commented out to fix bug #7865
 //	if ((m_doc->m_Selection->count() != 0) && (m->button() == Qt::LeftButton) && (frameResizeHandle == 0))
@@ -1236,32 +1264,152 @@
 			if (currItem->isAnnotation())
 			{
 				if (currItem->annotation().Type() == Annotation::Link)
-				{
-					if (currItem->annotation().ActionType() == 2)
-					{
-						m_view->Deselect(true);
-						if (currItem->annotation().Ziel() < m_doc->Pages->count())
-							m_view->GotoPage(currItem->annotation().Ziel());
-						else
-						{
-							QString message = tr("Page %1 does not exist!").arg(currItem->annotation().Ziel() + 1);
-							QMessageBox::warning(m_view, CommonStrings::trWarning, message, CommonStrings::tr_OK);
-						}
-					}
-					else if (currItem->annotation().ActionType() == 8)
-					{
-						QString message = tr("Link Target is Web URL.\nURL: %1").arg(currItem->annotation().Extern());
-						QMessageBox::information(m_view, tr("Information"), message, CommonStrings::tr_OK);
-					}
-					else if (currItem->annotation().ActionType() == 9)
-					{
-						QString message = tr("Link Target is external File.\nFile: %1\nPage: %2").arg(currItem->annotation().Extern()).arg(currItem->annotation().Ziel() + 1);
-						QMessageBox::information(m_view, tr("Information"), message, CommonStrings::tr_OK);
-					}
-				}
-			}
-		}
-	}
+					handleLinkAnnotation(currItem);
+				else if (currItem->annotation().Type() == Annotation::Checkbox)
+					handleCheckBoxRelease(currItem);
+				else if (currItem->annotation().Type() == Annotation::RadioButton)
+					handleRadioButtonRelease(currItem);
+				else if (currItem->annotation().Type() == Annotation::Button)
+					handlePushButtonRelease(currItem);
+			}
+		}
+	}
+}
+
+void CanvasMode_Normal::handleCheckBoxPress(PageItem* currItem)
+{
+	currItem->annotation().setOnState(true);
+	currItem->update();
+	m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());
+}
+
+void CanvasMode_Normal::handlePushButtonPress(PageItem* currItem)
+{
+	currItem->annotation().setOnState(true);
+	currItem->update();
+	m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());
+}
+
+void CanvasMode_Normal::handleRadioButtonPress(PageItem* currItem)
+{
+	if (currItem->Parent != NULL)
+	{
+		PageItem *group = currItem->Parent->asGroupFrame();
+		for (int a = 0; a < group->groupItemList.count(); a++)
+		{
+			PageItem *gItem = group->groupItemList[a];
+			if ((gItem->isAnnotation()) && (gItem->annotation().Type() == Annotation::RadioButton))
+			{
+				gItem->update();
+			}
+		}
+		currItem->annotation().setOnState(true);
+		currItem->update();
+	}
+	else
+	{
+		int op = currItem->OwnPage;
+		uint docItemCount = m_doc->Items->count();
+		for (uint i = 0; i < docItemCount; ++i)
+		{
+			PageItem *gItem = m_doc->Items->at(i);
+			if ((gItem->isAnnotation()) && (gItem->annotation().Type() == Annotation::RadioButton) && (gItem->OwnPage == op))
+			{
+				gItem->update();
+			}
+		}
+		currItem->annotation().setOnState(true);
+		currItem->update();
+	}
+	m_view->updateContents();
+}
+
+void CanvasMode_Normal::handleCheckBoxRelease(PageItem* currItem)
+{
+	currItem->annotation().setOnState(false);
+	currItem->annotation().setCheckState(!currItem->annotation().IsChecked());
+	currItem->update();
+	m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());
+}
+
+void CanvasMode_Normal::handlePushButtonRelease(PageItem* currItem)
+{
+	currItem->annotation().setOnState(false);
+	currItem->update();
+	m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());
+}
+
+void CanvasMode_Normal::handleRadioButtonRelease(PageItem* currItem)
+{
+	if (currItem->Parent != NULL)
+	{
+		PageItem *group = currItem->Parent->asGroupFrame();
+		for (int a = 0; a < group->groupItemList.count(); a++)
+		{
+			PageItem *gItem = group->groupItemList[a];
+			if ((gItem->isAnnotation()) && (gItem->annotation().Type() == Annotation::RadioButton))
+			{
+				gItem->annotation().setCheckState(false);
+				gItem->update();
+			}
+		}
+		currItem->annotation().setCheckState(true);
+		currItem->annotation().setOnState(false);
+		currItem->update();
+	}
+	else
+	{
+		int op = currItem->OwnPage;
+		uint docItemCount = m_doc->Items->count();
+		for (uint i = 0; i < docItemCount; ++i)
+		{
+			PageItem *gItem = m_doc->Items->at(i);
+			if ((gItem->isAnnotation()) && (gItem->annotation().Type() == Annotation::RadioButton) && (gItem->OwnPage == op))
+			{
+				gItem->annotation().setCheckState(false);
+				gItem->update();
+			}
+		}
+		currItem->annotation().setCheckState(true);
+		currItem->annotation().setOnState(false);
+		currItem->update();
+	}
+	m_view->updateContents();
+}
+
+void CanvasMode_Normal::handleLinkAnnotation(PageItem* currItem)
+{
+	if (currItem->annotation().ActionType() == 2)
+	{
+		m_view->Deselect(true);
+		if (currItem->annotation().Ziel() < m_doc->Pages->count())
+			m_view->GotoPage(currItem->annotation().Ziel());
+		else
+		{
+			QString message = tr("Page %1 does not exist!").arg(currItem->annotation().Ziel() + 1);
+			QMessageBox::warning(m_view, CommonStrings::trWarning, message, CommonStrings::tr_OK);
+		}
+	}
+	else if (currItem->annotation().ActionType() == 8)
+	{
+		QString message = tr("Link Target is Web URL.\nURL: %1").arg(currItem->annotation().Extern());
+		QMessageBox::information(m_view, tr("Information"), message, CommonStrings::tr_OK);
+	}
+	else if (currItem->annotation().ActionType() == 9)
+	{
+		QString message = tr("Link Target is external File.\nFile: %1\nPage: %2").arg(currItem->annotation().Extern()).arg(currItem->annotation().Ziel() + 1);
+		QMessageBox::information(m_view, tr("Information"), message, CommonStrings::tr_OK);
+	}
+}
+
+void CanvasMode_Normal::handleFocusOut(PageItem* currItem)
+{
+//	qDebug() << "Focus Out" << currItem->itemName();
+}
+
+void CanvasMode_Normal::handleFocusIn(PageItem* currItem)
+{
+//	qDebug() << "Focus In" << currItem->itemName();
 }
 
 void CanvasMode_Normal::keyPressEvent(QKeyEvent *e)
@@ -1277,6 +1425,9 @@
 //CB-->Doc/Fix
 bool CanvasMode_Normal::SeleItem(QMouseEvent *m)
 {
+	PageItem *previousSelectedItem = NULL;
+	if (m_doc->m_Selection->count() != 0)
+		previousSelectedItem = m_doc->m_Selection->itemAt(0);
 	m_canvas->m_viewMode.operItemSelecting = true;
 	const unsigned SELECT_IN_GROUP = Qt::AltModifier; // Qt::MetaModifier;
 	const unsigned SELECT_MULTIPLE = Qt::ShiftModifier;
@@ -1400,7 +1551,7 @@
 	{
 		m_view->Deselect(false);
 	}
-	currItem = m_canvas->itemUnderCursor(m->globalPos(), currItem, (m->modifiers() & SELECT_IN_GROUP));
+	currItem = m_canvas->itemUnderCursor(m->globalPos(), currItem, ((m->modifiers() & SELECT_IN_GROUP) || (m_doc->drawAsPreview && !m_doc->editOnPreview)));
 	if (currItem)
 	{
 		m_doc->m_Selection->delaySignalsOn();
@@ -1418,7 +1569,7 @@
 			if (m_doc->drawAsPreview && !m_doc->editOnPreview)
 				m_doc->m_Selection->clear();
 			m_doc->m_Selection->addItem(currItem);
-			if ( (m->modifiers() & SELECT_IN_GROUP) && (!currItem->isGroup()))
+			if (((m->modifiers() & SELECT_IN_GROUP) || (m_doc->drawAsPreview && !m_doc->editOnPreview)) && (!currItem->isGroup()))
 			{
 				currItem->isSingleSel = true;
 			}
@@ -1446,6 +1597,16 @@
 			m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
 			m_view->getGroupRectScreen(&x, &y, &w, &h);
 		}
+		if (previousSelectedItem != NULL)
+		{
+			if (currItem != previousSelectedItem)
+			{
+				handleFocusOut(previousSelectedItem);
+				handleFocusIn(currItem);
+			}
+		}
+		else
+			handleFocusIn(currItem);
 		return true;
 	}
 	if ((m_doc->guidesPrefs().guidesShown) /*&& (!m_doc->GuideLock)*/ && (m_doc->OnPage(MxpS, MypS) != -1))
@@ -1481,6 +1642,8 @@
 		else
 			m_view->Deselect(true);
 	}
+	if (previousSelectedItem != NULL)
+		handleFocusOut(previousSelectedItem);
 	return false;
 }
 

Modified: trunk/Scribus/scribus/canvasmode_normal.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/canvasmode_normal.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.h (original)
+++ trunk/Scribus/scribus/canvasmode_normal.h Sun Dec 23 16:42:06 2012
@@ -60,6 +60,15 @@
 
 private:
 	inline bool GetItem(PageItem** pi);
+	void handleCheckBoxPress(PageItem* currItem);
+	void handlePushButtonPress(PageItem* currItem);
+	void handleRadioButtonPress(PageItem* currItem);
+	void handleCheckBoxRelease(PageItem* currItem);
+	void handlePushButtonRelease(PageItem* currItem);
+	void handleRadioButtonRelease(PageItem* currItem);
+	void handleLinkAnnotation(PageItem* currItem);
+	void handleFocusOut(PageItem* currItem);
+	void handleFocusIn(PageItem* currItem);
 	bool SeleItem(QMouseEvent *m);
 	void createContextMenu(PageItem *currItem, double mx, double my);
 

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun Dec 23 16:42:06 2012
@@ -3105,6 +3105,11 @@
 	{
 		if ((fillColor() != CommonStrings::None) || (GrType != 0))
 		{
+			if (isAnnotation() && !((m_Doc->appMode == modeEdit) && (m_Doc->m_Selection->findItem(this) != -1)) && ((annotation().Type() == 2) || (annotation().Type() == 5) || (annotation().Type() == 6)))
+			{
+				if ((annotation().Feed() == 1) && annotation().IsOn())
+					p->setBrush(QColor(255 - fillQColor.red(), 255 - fillQColor.green(), 255 - fillQColor.blue(), fillQColor.alpha()));
+			}
 			p->setupPolygon(&PoLine);
 			p->fillPath();
 		}
@@ -3141,35 +3146,57 @@
 		{
 			QColor tmp;
 			SetQColor(&tmp, annotation().borderColor(), 100);
+			int BStyle = annotation().Bsty();
+			if (annotation().IsOn())
+			{
+				if (annotation().Feed() == 2)
+					tmp = QColor(255 - tmp.red(), 255 - tmp.green(), 255 - tmp.blue(), tmp.alpha());
+				if (annotation().Feed() == 3)
+					BStyle = 4;
+			}
 			if (annotation().Type() == Annotation::RadioButton)
 			{
 				double bwh = annotation().Bwid() / 2.0;
-				if ((annotation().Bsty() == 0) || (annotation().Bsty() == 1))
+				if (annotation().IsOn())
+				{
+					if (BStyle == 4)
+						BStyle = 3;
+					else
+						BStyle = 4;
+				}
+				if ((BStyle == 0) || (BStyle == 1))
 				{
 					QPainterPath clp;
 					clp.addEllipse(QRectF(bwh, bwh, Width - annotation().Bwid(), Height - annotation().Bwid()));
 					FPointArray clpArr;
 					clpArr.fromQPainterPath(clp);
 					p->setupPolygon(&clpArr);
-					p->setPen(tmp, annotation().Bwid(), annotation().Bsty() == 0 ? Qt::SolidLine : Qt::DashLine, Qt::FlatCap, Qt::MiterJoin);
+					p->setPen(tmp, annotation().Bwid(), BStyle == 0 ? Qt::SolidLine : Qt::DashLine, Qt::FlatCap, Qt::MiterJoin);
 					p->setFillMode(ScPainter::None);
 					p->setStrokeMode(ScPainter::Solid);
 					p->strokePath();
 				}
-				else if (annotation().Bsty() == 3)
+				else if (BStyle == 3)
 					p->drawShadeCircle(QRectF(0, 0, Width, Height), tmp, false, annotation().Bwid());
-				else if (annotation().Bsty() == 4)
+				else if (BStyle == 4)
 					p->drawShadeCircle(QRectF(0, 0, Width, Height), tmp, true, annotation().Bwid());
 			}
 			else
 			{
-				if (annotation().Bsty() == 3)
+				if ((annotation().Type() == Annotation::Checkbox) && annotation().IsOn())
+				{
+					if (BStyle == 4)
+						BStyle = 3;
+					else
+						BStyle = 4;
+				}
+				if (BStyle == 3)
 					p->drawShadePanel(QRectF(0, 0, Width, Height), tmp, false, annotation().Bwid());
-				else if (annotation().Bsty() == 4)
+				else if (BStyle == 4)
 					p->drawShadePanel(QRectF(0, 0, Width, Height), tmp, true, annotation().Bwid());
 				else
 				{
-					p->setPen(tmp, annotation().Bwid(), annotation().Bsty() == 0 ? Qt::SolidLine : Qt::DashLine, Qt::FlatCap, Qt::MiterJoin);
+					p->setPen(tmp, annotation().Bwid(), BStyle == 0 ? Qt::SolidLine : Qt::DashLine, Qt::FlatCap, Qt::MiterJoin);
 					p->setStrokeMode(ScPainter::Solid);
 					p->drawRect(0, 0, Width, Height);
 				}
@@ -3186,7 +3213,10 @@
 			p->setClipPath();
 			if (!bmUtf16.isEmpty())
 			{
-				p->setPen(fontColor);
+				if ((annotation().Feed() == 1) && annotation().IsOn())
+					p->setPen(QColor(255 - fontColor.red(), 255 - fontColor.green(), 255 - fontColor.blue(), fontColor.alpha()));
+				else
+					p->setPen(fontColor);
 				p->setFont(QFont(fontName, fontSize));
 				p->drawText(QRectF(wdt, wdt, Width - (2 * wdt), Height - (2 * wdt)), bmUtf16, false);
 			}
@@ -3218,7 +3248,7 @@
 		}
 		else if (annotation().Type() == Annotation::RadioButton)
 		{
-			if (annotation().IsChk())
+			if (annotation().IsChecked())
 			{
 				QPainterPath clp2;
 				double siz = qMin(width(), height()) * 0.4;
@@ -3238,7 +3268,7 @@
 		}
 		else if (annotation().Type() == Annotation::Checkbox)
 		{
-			if (annotation().IsChk())
+			if (annotation().IsChecked())
 			{
 				p->setBrush(fontColor);
 				p->setFillMode(ScPainter::Solid);

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Sun Dec 23 16:42:06 2012
@@ -1514,6 +1514,7 @@
 	OB->m_annotation.setFormat(obj->attribute("ANFORMAT", "0").toInt());
 	OB->m_annotation.setVis(obj->attribute("ANVIS", "0").toInt());
 	OB->m_annotation.setIsChk(static_cast<bool>(obj->attribute("ANCHK", "0").toInt()));
+	OB->m_annotation.setCheckState(OB->m_annotation.IsChk());
 	OB->m_annotation.setAAact(static_cast<bool>(obj->attribute("ANAA", "0").toInt()));
 	OB->m_annotation.setHTML(obj->attribute("ANHTML", "0").toInt());
 	OB->m_annotation.setUseIcons(static_cast<bool>(obj->attribute("ANICON", "0").toInt()));

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sun Dec 23 16:42:06 2012
@@ -2764,6 +2764,7 @@
 	currItem->annotation().setFormat( attrs.valueAsInt("ANFORMAT", 0));
 	currItem->annotation().setVis( attrs.valueAsInt("ANVIS", 0));
 	currItem->annotation().setIsChk( attrs.valueAsBool("ANCHK", false) );
+	currItem->annotation().setCheckState(currItem->annotation().IsChk());
 	currItem->annotation().setAAact( attrs.valueAsBool("ANAA", false) );
 	currItem->annotation().setHTML ( attrs.valueAsInt("ANHTML", 0));
 	currItem->annotation().setUseIcons( attrs.valueAsBool("ANICON", false));

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Sun Dec 23 16:42:06 2012
@@ -1781,6 +1781,7 @@
 	currItem->annotation().setFormat(obj->attribute("ANFORMAT", "0").toInt());
 	currItem->annotation().setVis(obj->attribute("ANVIS", "0").toInt());
 	currItem->annotation().setIsChk(static_cast<bool>(obj->attribute("ANCHK", "0").toInt()));
+	currItem->annotation().setCheckState(currItem->annotation().IsChk());
 	currItem->annotation().setAAact(static_cast<bool>(obj->attribute("ANAA", "0").toInt()));
 	currItem->annotation().setHTML(obj->attribute("ANHTML", "0").toInt());
 	currItem->annotation().setUseIcons(static_cast<bool>(obj->attribute("ANICON", "0").toInt()));

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sun Dec 23 16:42:06 2012
@@ -4681,6 +4681,7 @@
 	currItem->annotation().setFormat( attrs.valueAsInt("ANFORMAT", 0));
 	currItem->annotation().setVis( attrs.valueAsInt("ANVIS", 0));
 	currItem->annotation().setIsChk( attrs.valueAsBool("ANCHK", false) );
+	currItem->annotation().setCheckState(currItem->annotation().IsChk());
 	currItem->annotation().setAAact( attrs.valueAsBool("ANAA", false) );
 	currItem->annotation().setHTML ( attrs.valueAsInt("ANHTML", 0));
 	currItem->annotation().setUseIcons( attrs.valueAsBool("ANICON", false));

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Sun Dec 23 16:42:06 2012
@@ -687,6 +687,7 @@
 							if (btn)
 							{
 								ite->annotation().setIsChk(btn->getState());
+								ite->annotation().setCheckState(ite->annotation().IsChk());
 								handleActions(ite, ano);
 								if (itemText == "4")
 									ite->annotation().setChkStil(0);
@@ -734,6 +735,7 @@
 							{
 								ite->setItemName( CommonStrings::itemName_RadioButton + QString("%1").arg(m_doc->TotalItems));
 								ite->annotation().setIsChk(btn->getState());
+								ite->annotation().setCheckState(ite->annotation().IsChk());
 								handleActions(ite, ano);
 								m_radioButtons.insert(annota->getRef().num, ite);
 							}

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Dec 23 16:42:06 2012
@@ -11316,6 +11316,7 @@
 	symbolPalette->setEnabled(!doc->drawAsPreview);
 	inlinePalette->setEnabled(!doc->drawAsPreview);
 	undoPalette->setEnabled(!doc->drawAsPreview);
+	outlinePalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview));
 	propertiesPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview));
 	scrMenuMgr->setMenuEnabled("Edit", !doc->drawAsPreview);
 	scrMenuMgr->setMenuEnabled("Item", !doc->drawAsPreview);

Modified: trunk/Scribus/scribus/ui/annot.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17976&path=/trunk/Scribus/scribus/ui/annot.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annot.cpp (original)
+++ trunk/Scribus/scribus/ui/annot.cpp Sun Dec 23 16:42:06 2012
@@ -1912,6 +1912,7 @@
 	item->annotation().setFont(Schrift->currentIndex());
 	item->annotation().setFlag(0);
 	item->annotation().setIsChk(isChkd->isChecked());
+	item->annotation().setCheckState(isChkd->isChecked());
 	item->annotation().setChkStil(ChkStil->currentIndex());
 	item->annotation().setBorderColor(BorderC->currentText());
 	if (item->annotation().borderColor() == CommonStrings::tr_NoneColor)




More information about the scribus-commit mailing list