r17977 by fschmid - Added proper enumeration for annotation actions.

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 24 12:00:47 UTC 2012


Author: fschmid
Date: Mon Dec 24 12:00:47 2012
New Revision: 17977

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17977
Log:
Added proper enumeration for annotation actions.

Modified:
    trunk/Scribus/scribus/annotation.h
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/ui/annot.cpp
    trunk/Scribus/scribus/ui/annota.cpp

Modified: trunk/Scribus/scribus/annotation.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/annotation.h
==============================================================================
--- trunk/Scribus/scribus/annotation.h (original)
+++ trunk/Scribus/scribus/annotation.h Mon Dec 24 12:00:47 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), tmp_Chk(false), on_State(false)
+						AnIPlace(1), AnScaleW(0), AnFormat(0), tmp_Chk(false), on_State(false), is_Open(false)
 		{
 		}
 		enum AnnotationType {
@@ -54,6 +54,18 @@
 			Link			= 11,
 			Annot3D		  	= 12,
 			RadioButton		= 13
+		};
+		enum AnnotationAction {
+			Action_None				= 0,
+			Action_JavaScript		= 1,
+			Action_GoTo				= 2,
+			Action_SubmitForm		= 3,
+			Action_ResetForm		= 4,
+			Action_ImportData		= 5,
+			Action_GoToR_FileRel	= 7,
+			Action_URI				= 8,
+			Action_GoToR_FileAbs	= 9,
+			Action_Named			= 10
 		};
 		enum AnnotationFlags {
 			Flag_ReadOnly			=		   1,	// Bit  1
@@ -107,6 +119,7 @@
 	void setFormat(int newFormat) { AnFormat=newFormat; }
 	void setIsChk(bool newIsChk) { AnIsChk=newIsChk; }
 	void setCheckState(bool newIsChk) { tmp_Chk=newIsChk; }
+	void setOpen(bool newIsOpen) { is_Open=newIsOpen; }
 	void setOnState(bool newIsChk) { on_State=newIsChk; }
 	void setAAact(bool newAAct) { AnAAact=newAAct; }
 	void setHTML(int newHTML) { AnHTML=newHTML; }
@@ -143,6 +156,7 @@
 	int Format() const { return AnFormat; }
 	bool IsChk() const { return AnIsChk; }
 	bool IsChecked() const { return tmp_Chk; }
+	bool IsOpen() const { return is_Open; }
 	bool IsOn() const { return on_State; }
 	bool AAact() const { return AnAAact; }
 	int HTML() const { return AnHTML; }
@@ -186,6 +200,7 @@
 		int AnFormat;
 		bool tmp_Chk;
 		bool on_State;
+		bool is_Open;
 };
 
 #endif

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Mon Dec 24 12:00:47 2012
@@ -375,11 +375,11 @@
 					}
 					else if (hoveredItem->annotation().Type() == Annotation::Link)
 					{
-						if (hoveredItem->annotation().ActionType() == 2)
+						if (hoveredItem->annotation().ActionType() == Annotation::Action_GoTo)
 							toolT = QString( tr("Go to Page %1").arg(hoveredItem->annotation().Ziel() + 1));
-						else if (hoveredItem->annotation().ActionType() == 8)
+						else if (hoveredItem->annotation().ActionType() == Annotation::Action_URI)
 							toolT = QString( tr("Go to URL %1").arg(hoveredItem->annotation().Extern()));
-						else if (hoveredItem->annotation().ActionType() == 9)
+						else if ((hoveredItem->annotation().ActionType() == Annotation::Action_GoToR_FileAbs) || (hoveredItem->annotation().ActionType() == Annotation::Action_GoToR_FileRel))
 							toolT = QString( tr("Go to Page %1 in File %2").arg(hoveredItem->annotation().Ziel() + 1).arg(hoveredItem->annotation().Extern()));
 						qApp->changeOverrideCursor(QCursor(Qt::PointingHandCursor));
 					}
@@ -1379,7 +1379,7 @@
 
 void CanvasMode_Normal::handleLinkAnnotation(PageItem* currItem)
 {
-	if (currItem->annotation().ActionType() == 2)
+	if (currItem->annotation().ActionType() == Annotation::Action_GoTo)
 	{
 		m_view->Deselect(true);
 		if (currItem->annotation().Ziel() < m_doc->Pages->count())
@@ -1390,12 +1390,12 @@
 			QMessageBox::warning(m_view, CommonStrings::trWarning, message, CommonStrings::tr_OK);
 		}
 	}
-	else if (currItem->annotation().ActionType() == 8)
+	else if (currItem->annotation().ActionType() == Annotation::Action_URI)
 	{
 		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)
+	else if ((currItem->annotation().ActionType() == Annotation::Action_GoToR_FileAbs) || (currItem->annotation().ActionType() == Annotation::Action_GoToR_FileRel))
 	{
 		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);

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Mon Dec 24 12:00:47 2012
@@ -3118,7 +3118,7 @@
 	double S_Extra = Extra;
 	double S_RExtra = RExtra;
 	double S_BExtra = BExtra;
-	if (isAnnotation() && !((m_Doc->appMode == modeEdit) && (m_Doc->m_Selection->findItem(this) != -1)) && (((annotation().Type() > 1) && (annotation().Type() < 7)) || (annotation().Type() > 12)))
+	if (isAnnotation() && !((m_Doc->appMode == modeEdit) && (m_Doc->m_Selection->findItem(this) != -1)) && (((annotation().Type() > 1) && (annotation().Type() < 11)) || (annotation().Type() > 12)))
 	{
 		QColor fontColor;
 		SetQColor(&fontColor, itemText.defaultStyle().charStyle().fillColor(), itemText.defaultStyle().charStyle().fillShade());
@@ -3142,7 +3142,7 @@
 			}
 		}
 		p->save();
-		if (((annotation().Bwid() > 0) && (annotation().borderColor() != CommonStrings::None)))
+		if ((annotation().Bwid() > 0) && (annotation().borderColor() != CommonStrings::None) && (annotation().Type() != Annotation::Text))
 		{
 			QColor tmp;
 			SetQColor(&tmp, annotation().borderColor(), 100);
@@ -3447,6 +3447,94 @@
 					p->drawText(QRectF(wdt + 1, wdt + 1, Width - (2 * wdt) - 17, Height - (2 * wdt) - 2), bmUtf16, false, 2);
 					p->restore();
 				}
+				p->restore();
+				p->restore();
+				return;
+			}
+		}
+		else if (annotation().Type() == Annotation::Text)
+		{
+			if (m_Doc->drawAsPreview && !m_Doc->editOnPreview)
+			{
+				QPainterPath chkPath;
+				p->save();
+				p->translate(0, 24);
+				p->scale(1, -1);
+				p->setBrush(QColor(255, 255, 255));
+				p->setFillMode(ScPainter::Solid);
+				p->setStrokeMode(ScPainter::None);
+				chkPath.moveTo(3.602, 24.0);
+				chkPath.lineTo(20.398, 24.0);
+				chkPath.cubicTo(22.387, 24, 24, 22.387, 24, 20.398);
+				chkPath.lineTo(24.0, 3.602);
+				chkPath.cubicTo(24, 1.613, 22.387, 0, 20.398, 0);
+				chkPath.lineTo(3.602, 0);
+				chkPath.cubicTo(1.613, 0, 0, 1.613, 0, 3.602);
+				chkPath.lineTo(0, 20.398);
+				chkPath.cubicTo(0, 22.387, 1.613, 24, 3.602, 24);
+				chkPath.closeSubpath();
+				FPointArray chArr;
+				chArr.fromQPainterPath(chkPath);
+				p->setupPolygon(&chArr);
+				p->fillPath();
+				p->setFillMode(ScPainter::None);
+				p->setStrokeMode(ScPainter::Solid);
+				chkPath = QPainterPath();
+				chkPath.moveTo(9, 18);
+				chkPath.lineTo(4, 18);
+				chkPath.cubicTo(4, 7, 4, 4, 6, 3);
+				chkPath.lineTo(20, 3);
+				chkPath.cubicTo(18, 4, 18, 7, 18, 18);
+				chkPath.lineTo(17, 18);
+				chArr.fromQPainterPath(chkPath);
+				p->setupPolygon(&chArr, false);
+				p->setPen(QColor(qRound(255 * 0.533333), qRound(255 * 0.541176), qRound(255 * 0.521569)), 2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				p->strokePath();
+				p->setPen(QColor(qRound(255 * 0.533333), qRound(255 * 0.541176), qRound(255 * 0.521569)), 1.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				p->drawLine(QPointF(10, 16), QPointF(14, 21));
+				p->setPen(QColor(qRound(255 * 0.533333), qRound(255 * 0.541176), qRound(255 * 0.521569)), 1.85625, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				chkPath = QPainterPath();
+				chkPath.moveTo(15.07, 20.523);
+				chkPath.cubicTo(15.07, 19.672, 14.379, 18.977, 13.523, 18.977);
+				chkPath.cubicTo(12.672, 18.977, 11.977, 19.672, 11.977, 20.523);
+				chkPath.cubicTo(11.977, 21.379, 12.672, 22.07, 13.523, 22.07);
+				chkPath.cubicTo(14.379, 22.07, 15.07, 21.379, 15.07, 20.523);
+				chkPath.closeSubpath();
+				chArr.fromQPainterPath(chkPath);
+				p->setupPolygon(&chArr);
+				p->strokePath();
+				p->drawLine(QPointF(6.5, 13.5), QPointF(15.5, 13.5));
+				p->drawLine(QPointF(6.5, 10.5), QPointF(13.5, 10.5));
+				p->drawLine(QPointF(6.801, 7.5), QPointF(15.5, 7.5));
+				chkPath = QPainterPath();
+				chkPath.moveTo(9, 19);
+				chkPath.lineTo(4, 19);
+				chkPath.cubicTo(4, 8, 4, 5, 6, 4);
+				chkPath.lineTo(20, 4);
+				chkPath.cubicTo(18, 5, 18, 8, 18, 19);
+				chkPath.lineTo(17, 19);
+				chArr.fromQPainterPath(chkPath);
+				p->setupPolygon(&chArr, false);
+				p->setPen(QColor(qRound(255 * 0.729412), qRound(255 * 0.741176), qRound(255 * 0.713725)), 2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				p->strokePath();
+				p->setPen(QColor(qRound(255 * 0.729412), qRound(255 * 0.741176), qRound(255 * 0.713725)), 1.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				p->drawLine(QPointF(10, 17), QPointF(14, 22));
+				chkPath = QPainterPath();                             \
+				chkPath.moveTo(15.07, 21.523);
+				chkPath.cubicTo(15.07, 20.672, 14.379, 19.977, 13.523, 19.977);
+				chkPath.cubicTo(12.672, 19.977, 11.977, 20.672, 11.977, 21.523);
+				chkPath.cubicTo(11.977, 22.379, 12.672, 23.07, 13.523, 23.07);
+				chkPath.cubicTo(14.379, 23.07, 15.07, 22.379, 15.07, 21.523);
+				chkPath.closeSubpath();
+				chArr.fromQPainterPath(chkPath);
+				p->setupPolygon(&chArr);
+				p->setPen(QColor(qRound(255 * 0.729412), qRound(255 * 0.741176), qRound(255 * 0.713725)), 1.85625, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				p->strokePath();
+				p->setPen(QColor(qRound(255 * 0.729412), qRound(255 * 0.741176), qRound(255 * 0.713725)), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+				p->drawLine(QPointF(6.5, 14.5), QPointF(15.5, 14.5));
+				p->drawLine(QPointF(6.5, 11.5), QPointF(13.5, 11.5));
+				p->drawLine(QPointF(6.801, 8.5), QPointF(15.5, 8.5));
+				p->restore();
 				p->restore();
 				p->restore();
 				return;

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Mon Dec 24 12:00:47 2012
@@ -8411,7 +8411,7 @@
 	QString cc;
 	uint annotationObj = newObject();
 	uint actionObj = 0;
-	if ((ite->annotation().Type() > 1) && ((ite->annotation().ActionType() == 1) || (ite->annotation().AAact())) && (!ite->annotation().Action().isEmpty()))
+	if ((ite->annotation().Type() > 1) && ((ite->annotation().ActionType() == Annotation::Action_JavaScript) || (ite->annotation().AAact())) && (!ite->annotation().Action().isEmpty()))
 		actionObj = WritePDFString(ite->annotation().Action());
 	uint AActionObj = writeActions(ite->annotation(), annotationObj);
 	StartObj(annotationObj);
@@ -8462,9 +8462,9 @@
 	PutDoc(onState + " " + QString::number(appearanceObj1)+" 0 R\n");
 	PutDoc("/Off " + QString::number(appearanceObj2)+" 0 R\n");
 	PutDoc(">> >>\n");
-	if ((ite->annotation().ActionType() != 0) || (ite->annotation().AAact()))
-	{
-		if (ite->annotation().ActionType() == 1)
+	if ((ite->annotation().ActionType() != Annotation::Action_None) || (ite->annotation().AAact()))
+	{
+		if (ite->annotation().ActionType() == Annotation::Action_JavaScript)
 		{
 			if (!ite->annotation().Action().isEmpty())
 			{
@@ -8569,7 +8569,7 @@
 	uint icon2Obj = 0;
 	uint icon3Obj = 0;
 	uint actionObj = 0;
-	if ((ite->annotation().Type() > 1) && ((ite->annotation().ActionType() == 1) || (ite->annotation().AAact())) && (!ite->annotation().Action().isEmpty()))
+	if ((ite->annotation().Type() > 1) && ((ite->annotation().ActionType() == Annotation::Action_JavaScript) || (ite->annotation().AAact())) && (!ite->annotation().Action().isEmpty()))
 		actionObj = WritePDFString(ite->annotation().Action());
 	uint AActionObj = writeActions(ite->annotation(), annotationObj);
 	StartObj(annotationObj);
@@ -8586,7 +8586,7 @@
 		case 1:
 		case Annotation::Link:
 			PutDoc("/Subtype /Link\n");
-			if (ite->annotation().ActionType() == 2)
+			if (ite->annotation().ActionType() == Annotation::Action_GoTo)
 			{
 				PutDoc("/Dest /"+NDnam+QString::number(NDnum)+"\n");
 				Dest de;
@@ -8596,14 +8596,14 @@
 				NamedDest.append(de);
 				NDnum++;
 			}
-			if (ite->annotation().ActionType() == 7)
+			if (ite->annotation().ActionType() == Annotation::Action_GoToR_FileRel)
 			{
 				PutDoc("/A << /Type /Action /S /GoToR\n/F " + EncString(Path2Relative(ite->annotation().Extern(), baseDir), annotationObj) + "\n");
 				PutDoc("/D ["+QString::number(ite->annotation().Ziel())+" /XYZ "+ite->annotation().Action()+"]\n>>\n");
 			}
-			if (ite->annotation().ActionType() == 8)
+			if (ite->annotation().ActionType() == Annotation::Action_URI)
 				PutDoc("/A << /Type /Action /S /URI\n/URI " + EncString(ite->annotation().Extern(), annotationObj) + "\n>>\n");
-			if (ite->annotation().ActionType() == 9)
+			if (ite->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 			{
 				PutDoc("/A << /Type /Action /S /GoToR\n/F " + EncString(ite->annotation().Extern(), ObjCounter-1) + "\n");
 				PutDoc("/D ["+QString::number(ite->annotation().Ziel())+" /XYZ "+ite->annotation().Action()+"]\n>>\n");
@@ -8795,23 +8795,23 @@
 			if (ite->rotation() != 0)
 				PutDoc("/R "+QString::number((abs(static_cast<int>(ite->rotation())) / 90)*90)+" ");
 			PutDoc(">>\n");
-			if ((ite->annotation().ActionType() != 0) || (ite->annotation().AAact()))
-			{
-				if (ite->annotation().ActionType() == 7)
+			if ((ite->annotation().ActionType() != Annotation::Action_None) || (ite->annotation().AAact()))
+			{
+				if (ite->annotation().ActionType() == Annotation::Action_GoToR_FileRel)
 				{
 					PutDoc("/A << /Type /Action /S /GoToR\n/F " + EncString(Path2Relative(ite->annotation().Extern(), baseDir), annotationObj) + "\n");
 					PutDoc("/D ["+QString::number(ite->annotation().Ziel())+" /XYZ "+ite->annotation().Action()+"]\n>>\n");
 				}
-				if (ite->annotation().ActionType() == 9)
+				if (ite->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 				{
 					PutDoc("/A << /Type /Action /S /GoToR\n/F " + EncString(ite->annotation().Extern(), ObjCounter-1) + "\n");
 					PutDoc("/D ["+QString::number(ite->annotation().Ziel())+" /XYZ "+ite->annotation().Action()+"]\n>>\n");
 				}
-				if (ite->annotation().ActionType() == 5)
+				if (ite->annotation().ActionType() == Annotation::Action_ImportData)
 					PutDoc("/A << /Type /Action /S /ImportData\n/F " + EncString(ite->annotation().Action(), annotationObj) + " >>\n");
-				if (ite->annotation().ActionType() == 4)
+				if (ite->annotation().ActionType() == Annotation::Action_ResetForm)
 					PutDoc("/A << /Type /Action /S /ResetForm >>\n");
-				if (ite->annotation().ActionType() == 3)
+				if (ite->annotation().ActionType() == Annotation::Action_SubmitForm)
 				{
 					PutDoc("/A << /Type /Action /S /SubmitForm\n/F << /FS /URL /F " + EncString(ite->annotation().Action(), annotationObj) + " >>\n");
 //					if (ite->annotation().HTML())
@@ -8838,7 +8838,7 @@
 					}
 					PutDoc(">>\n");
 				}
-				if (ite->annotation().ActionType() == 1)
+				if (ite->annotation().ActionType() == Annotation::Action_JavaScript)
 				{
 					if (!ite->annotation().Action().isEmpty())
 					{
@@ -8853,7 +8853,7 @@
 					}
 					PutDoc("/AA " + QString::number(AActionObj) + " 0 R\n");
 				}
-				if (ite->annotation().ActionType() == 2)
+				if (ite->annotation().ActionType() == Annotation::Action_GoTo)
 				{
 					PutDoc("/A << /Type /Action /S /GoTo /D /" + NDnam + QString::number(NDnum) + " >>\n");
 					Dest de;
@@ -8863,7 +8863,7 @@
 					NamedDest.append(de);
 					NDnum++;
 				}
-				if (ite->annotation().ActionType() == 10)
+				if (ite->annotation().ActionType() == Annotation::Action_Named)
 				{
 					if (!ite->annotation().Action().isEmpty())
 					{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Mon Dec 24 12:00:47 2012
@@ -2442,7 +2442,7 @@
 		docu.writeAttribute("ANFACT", item->annotation().F_act());
 		docu.writeAttribute("ANVACT", item->annotation().V_act());
 		docu.writeAttribute("ANCACT", item->annotation().C_act());
-		if (item->annotation().ActionType() == 8)
+		if (item->annotation().ActionType() == Annotation::Action_URI)
 			docu.writeAttribute("ANEXTERN", item->annotation().Extern());
 		else
 			docu.writeAttribute("ANEXTERN", Path2Relative(item->annotation().Extern(), baseDir));

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Mon Dec 24 12:00:47 2012
@@ -1318,12 +1318,12 @@
 		case 1:
 		case Annotation::Link:
 			PutStream("/Subtype /Link\n");
-			if (item->annotation().ActionType() == 2)
+			if (item->annotation().ActionType() == Annotation::Action_GoTo)
 			{
 				PutStream("/Page " + QString::number(item->annotation().Ziel() + 1) + "\n");
 				PutStream("/View [ /XYZ " + item->annotation().Action() + "]\n");
 			}
-			if (item->annotation().ActionType() == 7)
+			if (item->annotation().ActionType() == Annotation::Action_GoToR_FileRel)
 			{
 				QFileInfo fiBase(Spool.fileName());
 				QString baseDir = fiBase.absolutePath();
@@ -1332,7 +1332,7 @@
 				PutStream("/Page " + QString::number(item->annotation().Ziel() + 1) + "\n");
 				PutStream("/View [ /XYZ " + item->annotation().Action() + "]\n");
 			}
-			if (item->annotation().ActionType() == 8)
+			if (item->annotation().ActionType() == Annotation::Action_URI)
 			{
 			/* The PDFMark docs say that for URI actions should contain an entry /Subtype /URI
 			   but tests with Ghostscript shows that only /S /URI works. Don't know if that is
@@ -1341,7 +1341,7 @@
 			*/
 				PutStream("/Action << /S /URI /URI (" + item->annotation().Extern() + ") >>\n");
 			}
-			if (item->annotation().ActionType() == 9)
+			if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 			{
 				PutStream("/Action /GoToR\n");
 				PutStream("/File (" + item->annotation().Extern() + ")\n");

Modified: trunk/Scribus/scribus/ui/annot.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/ui/annot.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annot.cpp (original)
+++ trunk/Scribus/scribus/ui/annot.cpp Mon Dec 24 12:00:47 2012
@@ -69,7 +69,7 @@
 	MaxSeite = Seite;
 	QStringList tl;
 	dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
-	if ((item->annotation().ActionType() == 2) || (item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9))
+	if ((item->annotation().ActionType() == Annotation::Action_GoTo) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
 	{
 		QString tm = item->annotation().Action();
 		tl = tm.split(" ", QString::SkipEmptyParts);
@@ -598,7 +598,7 @@
 	EditJava = new QTextEdit( Frame3 );
 	QPalette palTxt = EditJava->palette();
 	palTxt.setColor(QPalette::Base, palette().color(QPalette::Window));
-	if ((item->annotation().ActionType() == 1) || (item->annotation().AAact()))
+	if ((item->annotation().ActionType() == Annotation::Action_JavaScript) || (item->annotation().AAact()))
 		EditJava->setPlainText(item->annotation().Action());
 	ScrEdited = 0;
 	SelAction->setCurrentIndex(0);
@@ -632,19 +632,19 @@
 	GroupBox11Layout->addWidget( ChFile, 0, 2 );
 	useAbsolute = new QCheckBox( tr("Export absolute Filename"), GroupBox11);
 	GroupBox11Layout->addWidget( useAbsolute, 1, 0, 1, 3 );
-	if (item->annotation().ActionType() == 7)
+	if (item->annotation().ActionType() == Annotation::Action_GoToR_FileRel)
 		useAbsolute->setChecked(false);
-	else if (item->annotation().ActionType() == 9)
+	else if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 		useAbsolute->setChecked(true);
 	TextLabel31 = new QLabel( GroupBox11 );
 	TextLabel31->setText( tr( "Page:" ) );
 	GroupBox11Layout->addWidget( TextLabel31, 2, 0 );
 	SpinBox11 = new QSpinBox( GroupBox11 );
 	SpinBox11->setMinimum(1);
-	SpinBox11->setMaximum(((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9)) ? 1000 : Seite);
+	SpinBox11->setMaximum(((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)) ? 1000 : Seite);
 	SpinBox11->setValue(qMin(item->annotation().Ziel()+1, Seite));
 	GroupBox11Layout->addWidget( SpinBox11, 2, 1 );
-	if ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9))
+	if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
 		Pg1 = new Navigator( GroupBox11, 100, item->annotation().Ziel()+1, view, item->annotation().Extern());
 	else
 		Pg1 = new Navigator( GroupBox11, 100, qMin(item->annotation().Ziel(), Seite-1), view);
@@ -679,7 +679,7 @@
 	Frame3bLayout->addWidget( SubText1 );
 	SubURL = new QLineEdit( Frame3b );
 	Frame3bLayout->addWidget( SubURL );
-	if (item->annotation().ActionType() == 3)
+	if (item->annotation().ActionType() == Annotation::Action_SubmitForm)
 		SubURL->setText(item->annotation().Action());
 
 	SubText2 = new QLabel( Frame3b );
@@ -712,7 +712,7 @@
 	Frame3cLayout->addWidget( SubText1a );
 	SubURLa = new QLineEdit( Frame3c );
 	Frame3cLayout->addWidget( SubURLa );
-	if (item->annotation().ActionType() == 5)
+	if (item->annotation().ActionType() == Annotation::Action_ImportData)
 		SubURLa->setText(item->annotation().Action());
 	QSpacerItem* spacerSua = new QSpacerItem( 2, 2, QSizePolicy::Minimum, QSizePolicy::Expanding );
 	Frame3cLayout->addItem( spacerSua);
@@ -786,7 +786,7 @@
 	Fram2->addWidget( Frame5 );
 
 	TabWidget2->addTab( tab_2, tr( "Action" ) );
-	if ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9))
+	if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
 	{
 		LExtern->setChecked(true);
 		if (!Destfile->text().isEmpty())
@@ -1857,7 +1857,7 @@
 void ScAnnot::SetPage(int v)
 {
 	disconnect(SpinBox11, SIGNAL(valueChanged(int)), this, SLOT(SetPage(int)));
-	if ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9))
+	if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == 9))
 	{
 		if (!Pg1->SetSeite(v, 100, Destfile->text()))
 		{
@@ -2050,10 +2050,10 @@
 	switch (ActionCombo->currentIndex())
 	{
 		case 0:
-			item->annotation().setActionType(0);
+			item->annotation().setActionType(Annotation::Action_None);
 			break;
 		case 1:
-			item->annotation().setActionType(1);
+			item->annotation().setActionType(Annotation::Action_JavaScript);
 			switch (ScrEdited)
 			{
 				case 0:
@@ -2084,32 +2084,32 @@
 			{
 				item->annotation().setExtern(Destfile->text());
 				if (useAbsolute->isChecked())
-					item->annotation().setActionType(9);
+					item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
 				else
-					item->annotation().setActionType(7);
+					item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
 			}
 			else
 			{
 				item->annotation().setExtern("");
-				item->annotation().setActionType(2);
+				item->annotation().setActionType(Annotation::Action_GoTo);
 			}
 			item->annotation().setZiel(SpinBox11->value()-1);
 			item->annotation().setAction(tmp.setNum(SpinBox21->value())+" "+tmp2.setNum(Height-SpinBox31->value())+" 0");
 			break;
 		case 3:
-			item->annotation().setActionType(3);
+			item->annotation().setActionType(Annotation::Action_SubmitForm);
 			item->annotation().setAction(SubURL->text().simplified());
 			item->annotation().setHTML(SelAsHtml->currentIndex());
 			break;
 		case 4:
-			item->annotation().setActionType(4);
+			item->annotation().setActionType(Annotation::Action_ResetForm);
 			break;
 		case 5:
-			item->annotation().setActionType(5);
+			item->annotation().setActionType(Annotation::Action_ImportData);
 			item->annotation().setAction(SubURLa->text().simplified());
 			break;
 		case 6:
-			item->annotation().setActionType(10);
+			item->annotation().setActionType(Annotation::Action_Named);
 			item->annotation().setAction(nameActionCombo->itemData(nameActionCombo->currentIndex()).toString());
 			break;
 	}
@@ -2180,7 +2180,7 @@
 			for (uint prop = 0; prop < array_act; ++prop)
 				ActionCombo->addItem(tmp_actcom[prop]);
 			ActionCombo->setCurrentIndex(qMin(tmpac,6));
-			setter = ((item->annotation().ActionType() != 7) && (item->annotation().ActionType() != 9)) ? true : false;
+			setter = ((item->annotation().ActionType() != Annotation::Action_GoToR_FileRel) && (item->annotation().ActionType() != Annotation::Action_GoToR_FileAbs)) ? true : false;
 			Destfile->setEnabled(setter);
 			ChFile->setEnabled(setter);
 			SetActionType(tmpac);
@@ -2254,7 +2254,7 @@
 	bool enable;
 	if (!LExtern->isChecked())
 	{
-		item->annotation().setActionType(2);
+		item->annotation().setActionType(Annotation::Action_GoTo);
 		enable = false;
 		//		Destfile->setEnabled(false);
 		//		ChFile->setEnabled(false);
@@ -2263,9 +2263,9 @@
 	else
 	{
 		if (useAbsolute->isChecked())
-			item->annotation().setActionType(9);
+			item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
 		else
-			item->annotation().setActionType(7);
+			item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
 		enable = true;
 		//		Destfile->setEnabled(true);
 		//		ChFile->setEnabled(true);
@@ -2274,7 +2274,7 @@
 			GetFile();
 			if (Destfile->text().isEmpty())
 			{
-				item->annotation().setActionType(2);
+				item->annotation().setActionType(Annotation::Action_GoTo);
 				enable = false;
 				//				Destfile->setEnabled(false);
 				//				ChFile->setEnabled(false);
@@ -2312,7 +2312,7 @@
 		break;
 	case 2:
 		Fram2->setCurrentIndex(2);
-		setter = item->annotation().ActionType() != 7 ? true : false;
+		setter = item->annotation().ActionType() != Annotation::Action_GoToR_FileRel ? true : false;
 		Destfile->setEnabled(setter);
 		ChFile->setEnabled(setter);
 		SetPage(qMin(SpinBox11->value(), MaxSeite));

Modified: trunk/Scribus/scribus/ui/annota.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17977&path=/trunk/Scribus/scribus/ui/annota.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annota.cpp (original)
+++ trunk/Scribus/scribus/ui/annota.cpp Mon Dec 24 12:00:47 2012
@@ -53,7 +53,7 @@
 	view = vie;
 	MaxSeite = Seite;
 	QStringList tl;
-	if ((item->annotation().ActionType() == 2) || (item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9))
+	if ((item->annotation().ActionType() == Annotation::Action_GoTo) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
 	{
 		QString tm = item->annotation().Action();
 		tl = tm.split(" ", QString::SkipEmptyParts);
@@ -90,9 +90,9 @@
 			ComboBox1->setCurrentIndex(item->annotation().Type() - 1);
 		else
 			ComboBox1->setCurrentIndex(item->annotation().Type()-11);
-		if ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 8))
+		if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_URI))
 			ComboBox1->setCurrentIndex(item->annotation().ActionType() - 6);
-		if (item->annotation().ActionType() == 9)
+		if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 			ComboBox1->setCurrentIndex(1);
 	}
 	else
@@ -101,9 +101,9 @@
 			ComboBox1->setCurrentIndex(item->annotation().Type());
 		else
 			ComboBox1->setCurrentIndex(item->annotation().Type()-10);
-		if ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 8))
+		if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_URI))
 			ComboBox1->setCurrentIndex(item->annotation().ActionType() - 5);
-		if (item->annotation().ActionType() == 9)
+		if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 			ComboBox1->setCurrentIndex(2);
 	}
 	Fram = new QStackedWidget(this);
@@ -130,11 +130,11 @@
 	GroupBox1Layout->addWidget( ChFile, 0, 2 );
 	useAbsolute = new QCheckBox( tr("Export absolute Filename"), GroupBox1);
 	GroupBox1Layout->addWidget( useAbsolute, 1, 0, 1, 3 );
-	if (item->annotation().ActionType() == 7)
+	if (item->annotation().ActionType() == Annotation::Action_GoToR_FileRel)
 		useAbsolute->setChecked(false);
-	else if (item->annotation().ActionType() == 9)
+	else if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 		useAbsolute->setChecked(true);
-	if ((item->annotation().ActionType() != 7) && (item->annotation().ActionType() != 8) && (item->annotation().ActionType() != 9))
+	if ((item->annotation().ActionType() != Annotation::Action_GoToR_FileRel) && (item->annotation().ActionType() != Annotation::Action_URI) && (item->annotation().ActionType() != Annotation::Action_GoToR_FileAbs))
 	{
 		Destfile->hide();
 		ChFile->hide();
@@ -144,13 +144,13 @@
 	SpinBox1 = new ScrSpinBox( GroupBox1);
 	SpinBox1->setDecimals(0);
 	SpinBox1->setMinimum(1);
-	SpinBox1->setMaximum(((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9)) ? 1000 : Seite);
+	SpinBox1->setMaximum(((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)) ? 1000 : Seite);
 	SpinBox1->setSuffix("");
 	TextLabel3 = new QLabel( tr("&Page:"), GroupBox1);
 	TextLabel3->setBuddy(SpinBox1);
 	GroupBox1Layout->addWidget( TextLabel3, 2, 0 );
 	GroupBox1Layout->addWidget( SpinBox1, 2, 1 );
-	if ((!Destfile->text().isEmpty()) && ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9)))
+	if ((!Destfile->text().isEmpty()) && ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)))
 		Pg = new Navigator( GroupBox1, 100, item->annotation().Ziel()+1, view, item->annotation().Extern());
 	else
 	{
@@ -269,12 +269,12 @@
 	switch (item->annotation().Type())
 	{
 	case 10:
-		item->annotation().setActionType(0);
+		item->annotation().setActionType(Annotation::Action_None);
 		break;
 	case 11:
 		item->annotation().setAction(tmp.setNum(SpinBox2->value())+" "+ tmp2.setNum(Height-SpinBox3->value())+" 0");
 		item->annotation().setExtern("");
-		item->annotation().setActionType(2);
+		item->annotation().setActionType(Annotation::Action_GoTo);
 		break;
 	case 12:
 		item->annotation().setAction(tmp.setNum(SpinBox2->value())+" "+ tmp2.setNum(Height-SpinBox3->value())+" 0");
@@ -282,9 +282,9 @@
 		{
 			item->annotation().setExtern(Destfile->text());
 			if (useAbsolute->isChecked())
-				item->annotation().setActionType(9);
+				item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
 			else
-				item->annotation().setActionType(7);
+				item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
 		}
 		item->annotation().setType(Annotation::Link);
 		break;
@@ -293,7 +293,7 @@
 		if (!Destfile->text().isEmpty())
 		{
 			item->annotation().setExtern(Destfile->text());
-			item->annotation().setActionType(8);
+			item->annotation().setActionType(Annotation::Action_URI);
 		}
 		item->annotation().setType(Annotation::Link);
 		break;
@@ -322,7 +322,7 @@
 		Destfile->hide();
 		ChFile->hide();
 		useAbsolute->hide();
-		item->annotation().setActionType(2);
+		item->annotation().setActionType(Annotation::Action_GoTo);
 		SetPage(qMin(static_cast<int>(SpinBox1->value()), MaxSeite));
 		break;
 	case 2:
@@ -331,14 +331,14 @@
 		ChFile->show();
 		useAbsolute->show();
 		Destfile->setReadOnly(true);
-		if ((Destfile->text().isEmpty())  || (item->annotation().ActionType() == 8))
+		if ((Destfile->text().isEmpty())  || (item->annotation().ActionType() == Annotation::Action_URI))
 		{
 			Destfile->setText("");
 			GetFile();
 		}
 		if (Destfile->text().isEmpty())
 		{
-			item->annotation().setActionType(2);
+			item->annotation().setActionType(Annotation::Action_GoTo);
 			Destfile->setText("");
 			Destfile->hide();
 			ChFile->hide();
@@ -351,9 +351,9 @@
 		else
 		{
 			if (useAbsolute->isChecked())
-				item->annotation().setActionType(9);
+				item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
 			else
-				item->annotation().setActionType(7);
+				item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
 		}
 		SetPage(qMin(static_cast<int>(SpinBox1->value()), MaxSeite));
 		break;
@@ -370,18 +370,18 @@
 		SpinBox1->hide();
 		SpinBox2->hide();
 		SpinBox3->hide();
-		item->annotation().setActionType(8);
+		item->annotation().setActionType(Annotation::Action_URI);
 		break;
 	case 11:
 		Fram->setCurrentIndex(1);
-		if ((item->annotation().ActionType() == 7) || (item->annotation().ActionType() == 9))
+		if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
 		{
 			Destfile->show();
 			ChFile->show();
 			useAbsolute->show();
 			Destfile->setReadOnly(true);
 		}
-		if (item->annotation().ActionType() == 8)
+		if (item->annotation().ActionType() == Annotation::Action_URI)
 		{
 			Destfile->show();
 			Destfile->setReadOnly(false);




More information about the scribus-commit mailing list