r17952 by fschmid - Fixed Bug #866: Implement check box radio behaviour in PDF forms

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 10 21:41:11 UTC 2012


Author: fschmid
Date: Mon Dec 10 21:41:10 2012
New Revision: 17952

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17952
Log:
Fixed Bug #866: Implement check box radio behaviour in PDF forms

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/annotation.h
    trunk/Scribus/scribus/canvasmode.cpp
    trunk/Scribus/scribus/canvasmode_create.cpp
    trunk/Scribus/scribus/commonstrings.cpp
    trunk/Scribus/scribus/commonstrings.h
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pdflib_core.h
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusstructs.h
    trunk/Scribus/scribus/ui/annot.cpp
    trunk/Scribus/scribus/ui/outlinepalette.cpp
    trunk/Scribus/scribus/ui/outlinepalette.h
    trunk/Scribus/scribus/ui/pdftoolbar.cpp
    trunk/Scribus/scribus/ui/selfield.cpp

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Mon Dec 10 21:41:10 2012
@@ -830,6 +830,8 @@
 	//PDF toolbar
 	name="toolsPDFPushButton";
 	scrActions->insert(name, new ScrAction(ScrAction::DataInt, loadIcon("16/insert-button.png"), loadIcon("22/insert-button.png"), "", defaultKey(name), mainWindow, modeInsertPDFButton));
+	name="toolsPDFRadioButton";
+	scrActions->insert(name, new ScrAction(ScrAction::DataInt, loadIcon("16/radiobutton.png"), loadIcon("22/radiobutton.png"), "", defaultKey(name), mainWindow, modeInsertPDFRadioButton));
 	name="toolsPDFTextField";
 	scrActions->insert(name, new ScrAction(ScrAction::DataInt, loadIcon("16/text-field.png"), loadIcon("22/text-field.png"), "", defaultKey(name), mainWindow, modeInsertPDFTextfield));
 	name="toolsPDFCheckBox";
@@ -879,7 +881,7 @@
 	*modeActionNames << "toolsInsertFreehandLine" << "toolsInsertCalligraphicLine" << "toolsInsertRenderFrame" << "toolsRotate" << "toolsZoom" << "toolsEditContents";
 	*modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame"; //<< "toolsUnlinkTextFrameWithTextCopy" << "toolsUnlinkTextFrameWithTextCut";
 	*modeActionNames << "toolsEyeDropper" << "toolsCopyProperties";
-	*modeActionNames << "toolsPDFPushButton" << "toolsPDFTextField" << "toolsPDFCheckBox" << "toolsPDFComboBox" << "toolsPDFListBox" << "toolsPDFAnnotText" << "toolsPDFAnnotLink";
+	*modeActionNames << "toolsPDFPushButton" << "toolsPDFRadioButton" << "toolsPDFTextField" << "toolsPDFCheckBox" << "toolsPDFComboBox" << "toolsPDFListBox" << "toolsPDFAnnotText" << "toolsPDFAnnotLink";
 #ifdef HAVE_OSG
 	*modeActionNames << "toolsPDFAnnot3D";
 #endif
@@ -1648,6 +1650,7 @@
 	(*scrActions)["toolsInsertFreehandLine"]->setText( tr("Insert &Freehand Line"));
 
 	(*scrActions)["toolsPDFPushButton"]->setTexts( tr("Insert PDF Push Button"));
+	(*scrActions)["toolsPDFRadioButton"]->setTexts( tr("Insert PDF Radio Button"));
 	(*scrActions)["toolsPDFTextField"]->setTexts( tr("Insert PDF Text Field"));
 	(*scrActions)["toolsPDFCheckBox"]->setTexts( tr("Insert PDF Check Box"));
 	(*scrActions)["toolsPDFComboBox"]->setTexts( tr("Insert PDF Combo Box"));
@@ -2285,6 +2288,7 @@
 	itnmenua->second << "toolsEyeDropper";
 	itnmenua->second << "toolsCopyProperties";
 	itnmenua->second << "toolsPDFPushButton";
+	itnmenua->second << "toolsPDFRadioButton";
 	itnmenua->second << "toolsPDFTextField";
 	itnmenua->second << "toolsPDFCheckBox";
 	itnmenua->second << "toolsPDFListBox";

Modified: trunk/Scribus/scribus/annotation.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/annotation.h
==============================================================================
--- trunk/Scribus/scribus/annotation.h (original)
+++ trunk/Scribus/scribus/annotation.h Mon Dec 10 21:41:10 2012
@@ -28,7 +28,6 @@
 
 #include <QString>
 #include "scribusapi.h"
-//#include "desaxe/saxio.h"
 
 //FIXME: Someone please fix these variable names.. 
 //They are simply moved here, not all fixed.
@@ -41,7 +40,6 @@
 						An_Fo_act(""), An_Bl_act(""), An_K_act(""), An_F_act(""), An_V_act(""), An_C_act(""),
 						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(false), AnUseIcons(false),
 						AnFont(4), AnIsChk(false), AnAAact(false), AnHTML(0), AnUseIcons(false),
 						AnIPlace(1), AnScaleW(0), AnFormat(0)
 		{
@@ -54,14 +52,30 @@
 			Listbox			= 6,
 			Text			= 10,
 			Link			= 11,
-			Annot3D		  	= 12
+			Annot3D		  	= 12,
+			RadioButton		= 13
 		};
-		
-//	static const Xml_string saxxDefaultElem;
-//	static void  desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
-	
-//	virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
-//	virtual void saxx(SaxHandler& handler)                     const { saxx(handler, saxxDefaultElem); }
+		enum AnnotationFlags {
+			Flag_ReadOnly			=		   1,	// Bit  1
+			Flag_Required			=		   2,	// Bit  2
+			Flag_NoExport			=		   4,	// Bit  3
+			Flag_Multiline			=		4096,	// Bit 13
+			Flag_Password			=		8192,	// Bit 14
+			Flag_NoToggleToOff		=	   16384,	// Bit 15
+			Flag_Radio				=	   32768,	// Bit 16
+			Flag_PushButton			=	   65536,	// Bit 17
+			Flag_Combo				=	  131072,	// Bit 18
+			Flag_Edit				=	  262144,	// Bit 19
+			Flag_Sort				=	  524288,	// Bit 20
+			Flag_FileSelect			=	 1048576,	// Bit 21
+			Flag_MultiSelect		=	 2097152,	// Bit 22
+			Flag_DoNotSpellCheck	=	 4194304,	// Bit 23
+			Flag_DoNotScroll		=	 8388608,	// Bit 24
+			Flag_Comb				=	16777216,	// Bit 25
+			Flag_RichText			=	33554432,	// Bit 26 for Textfields only
+			Flag_RadiosInUnison		=	33554432,	// Bit 26 for Radio Buttons only
+			Flag_CommitOnSelChange	=	67108864	// Bit 27
+		};
 
 	void setType(int newType) { AnType=newType; }
 	void setAction(const QString& newAction) { AnAction=newAction; }
@@ -93,7 +107,6 @@
 	void setFormat(int newFormat) { AnFormat=newFormat; }
 	void setIsChk(bool newIsChk) { AnIsChk=newIsChk; }
 	void setAAact(bool newAAct) { AnAAact=newAAct; }
-//	void setHTML(bool newHTML) { AnHTML=newHTML; }
 	void setHTML(int newHTML) { AnHTML=newHTML; }
 	void setUseIcons(bool newUseIcons) { AnUseIcons=newUseIcons; }
 	void setIPlace(int newIPlace) { AnIPlace=newIPlace; }
@@ -128,7 +141,6 @@
 	int Format() const { return AnFormat; }
 	bool IsChk() const { return AnIsChk; }
 	bool AAact() const { return AnAAact; }
-//	bool HTML() const { return AnHTML; }
 	int HTML() const { return AnHTML; }
 	bool UseIcons() const { return AnUseIcons; }
 	int IPlace() const { return AnIPlace; }
@@ -163,7 +175,6 @@
 		int AnFont;
 		bool AnIsChk;
 		bool AnAAact;
-//		bool AnHTML;
 		int AnHTML;
 		bool AnUseIcons;
 		int AnIPlace;

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Mon Dec 10 21:41:10 2012
@@ -157,6 +157,7 @@
 		case modeDrawArc:
 		case modeDrawSpiral:
 		case modeInsertPDFButton:
+		case modeInsertPDFRadioButton:
 		case modeInsertPDFTextfield:
 		case modeInsertPDFCheckbox:
 		case modeInsertPDFCombobox:
@@ -810,6 +811,7 @@
 		case modeEditMeshPatch:
 		case modeEditWeldPoint:
 		case modeInsertPDFButton:
+		case modeInsertPDFRadioButton:
 		case modeInsertPDFTextfield:
 		case modeInsertPDFCheckbox:
 		case modeInsertPDFCombobox:

Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp Mon Dec 10 21:41:10 2012
@@ -557,6 +557,7 @@
 		frameType = (int) PageItem::Unspecified;
 		break;
 	case modeInsertPDFButton:
+	case modeInsertPDFRadioButton:
 	case modeInsertPDFTextfield:
 	case modeInsertPDFCheckbox:
 	case modeInsertPDFCombobox:
@@ -592,7 +593,7 @@
 		(createObjectMode == modeInsertPDFTextfield) || (createObjectMode == modeInsertPDFCheckbox) ||
 		(createObjectMode == modeInsertPDFCombobox) || (createObjectMode == modeInsertPDFListbox) ||
 		(createObjectMode == modeInsertPDFTextAnnotation) || (createObjectMode == modeInsertPDFLinkAnnotation) ||
-		(createObjectMode == modeInsertPDF3DAnnotation))
+		(createObjectMode == modeInsertPDF3DAnnotation) || (createObjectMode == modeInsertPDFRadioButton))
 	{
 		skipOneClick = false;
 	}
@@ -723,6 +724,7 @@
 		m_doc->setRedrawBounding(m_doc->Items->at(z));
 		break;
 	case modeInsertPDFButton:
+	case modeInsertPDFRadioButton:
 	case modeInsertPDFTextfield:
 	case modeInsertPDFCheckbox:
 	case modeInsertPDFCombobox:
@@ -737,8 +739,13 @@
 		{
 		case modeInsertPDFButton:
 			currItem->annotation().setType(Annotation::Button);
-			currItem->annotation().setFlag(65536);
+			currItem->annotation().setFlag(Annotation::Flag_PushButton);
 			currItem->setItemName( CommonStrings::itemName_PushButton + QString("%1").arg(m_doc->TotalItems));
+			break;
+		case modeInsertPDFRadioButton:
+			currItem->annotation().setType(Annotation::RadioButton);
+			currItem->annotation().setFlag(Annotation::Flag_Radio | Annotation::Flag_NoToggleToOff);
+			currItem->setItemName( CommonStrings::itemName_RadioButton + QString("%1").arg(m_doc->TotalItems));
 			break;
 		case modeInsertPDFTextfield:
 			currItem->annotation().setType(Annotation::Textfield);
@@ -750,7 +757,7 @@
 			break;
 		case modeInsertPDFCombobox:
 			currItem->annotation().setType(Annotation::Combobox);
-			currItem->annotation().setFlag(131072);
+			currItem->annotation().setFlag(Annotation::Flag_Combo);
 			currItem->setItemName( CommonStrings::itemName_ComboBox + QString("%1").arg(m_doc->TotalItems));
 			break;
 		case modeInsertPDFListbox:

Modified: trunk/Scribus/scribus/commonstrings.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/commonstrings.cpp
==============================================================================
--- trunk/Scribus/scribus/commonstrings.cpp (original)
+++ trunk/Scribus/scribus/commonstrings.cpp Mon Dec 10 21:41:10 2012
@@ -63,6 +63,7 @@
 QString CommonStrings::itemType_Multiple		= "";
 
 QString CommonStrings::itemSubType_PDF_PushButton		= "";
+QString CommonStrings::itemSubType_PDF_RadioButton		= "";
 QString CommonStrings::itemSubType_PDF_TextField		= "";
 QString CommonStrings::itemSubType_PDF_CheckBox			= "";
 QString CommonStrings::itemSubType_PDF_ComboBox			= "";
@@ -70,6 +71,7 @@
 QString CommonStrings::itemSubType_PDF_TextAnnotation	= "";
 QString CommonStrings::itemSubType_PDF_LinkAnnotation	= "";
 QString CommonStrings::itemName_PushButton				= "";
+QString CommonStrings::itemName_RadioButton				= "";
 QString CommonStrings::itemName_TextField				= "";
 QString CommonStrings::itemName_CheckBox				= "";
 QString CommonStrings::itemName_ComboBox				= "";
@@ -305,14 +307,16 @@
 	CommonStrings::itemType_Spiral			= tr("Spiral");
 	CommonStrings::itemType_Table			= tr("Table");
 	CommonStrings::itemType_Multiple		= tr("Multiple", "Multiple frame types");
-	CommonStrings::itemSubType_PDF_PushButton     = tr("PDF Push Button");
-	CommonStrings::itemSubType_PDF_TextField      = tr("PDF Text Field");
-	CommonStrings::itemSubType_PDF_CheckBox       = tr("PDF Check Box");
-	CommonStrings::itemSubType_PDF_ComboBox       = tr("PDF Combo Box");
-	CommonStrings::itemSubType_PDF_ListBox        = tr("PDF List Box");
-	CommonStrings::itemSubType_PDF_TextAnnotation = tr("PDF Text Annotation");
-	CommonStrings::itemSubType_PDF_LinkAnnotation = tr("PDF Link Annotation");
+	CommonStrings::itemSubType_PDF_PushButton		= tr("PDF Push Button");
+	CommonStrings::itemSubType_PDF_RadioButton		= tr("PDF Radio Button");
+	CommonStrings::itemSubType_PDF_TextField		= tr("PDF Text Field");
+	CommonStrings::itemSubType_PDF_CheckBox			= tr("PDF Check Box");
+	CommonStrings::itemSubType_PDF_ComboBox			= tr("PDF Combo Box");
+	CommonStrings::itemSubType_PDF_ListBox			= tr("PDF List Box");
+	CommonStrings::itemSubType_PDF_TextAnnotation	= tr("PDF Text Annotation");
+	CommonStrings::itemSubType_PDF_LinkAnnotation	= tr("PDF Link Annotation");
 	CommonStrings::itemName_PushButton				= tr("Button");
+	CommonStrings::itemName_RadioButton				= tr("RadioButton");
 	CommonStrings::itemName_TextField				= tr("Textfield");
 	CommonStrings::itemName_CheckBox				= tr("Checkbox");
 	CommonStrings::itemName_ComboBox				= tr("Combobox");

Modified: trunk/Scribus/scribus/commonstrings.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/commonstrings.h
==============================================================================
--- trunk/Scribus/scribus/commonstrings.h (original)
+++ trunk/Scribus/scribus/commonstrings.h Mon Dec 10 21:41:10 2012
@@ -124,6 +124,7 @@
 	static QString itemType_Multiple;
 
 	static QString itemSubType_PDF_PushButton;
+	static QString itemSubType_PDF_RadioButton;
 	static QString itemSubType_PDF_TextField;
 	static QString itemSubType_PDF_CheckBox;
 	static QString itemSubType_PDF_ComboBox;
@@ -131,6 +132,7 @@
 	static QString itemSubType_PDF_TextAnnotation;
 	static QString itemSubType_PDF_LinkAnnotation;
 	static QString itemName_PushButton;
+	static QString itemName_RadioButton;
 	static QString itemName_TextField;
 	static QString itemName_CheckBox;
 	static QString itemName_ComboBox;

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Mon Dec 10 21:41:10 2012
@@ -3113,7 +3113,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)))
+	if (isAnnotation() && !((m_Doc->appMode == modeEdit) && (m_Doc->m_Selection->findItem(this) != -1)) && (((annotation().Type() > 1) && (annotation().Type() < 7)) || (annotation().Type() > 12)))
 	{
 		QColor fontColor;
 		SetQColor(&fontColor, itemText.defaultStyle().charStyle().fillColor(), itemText.defaultStyle().charStyle().fillShade());
@@ -3137,20 +3137,36 @@
 			}
 		}
 		p->save();
-		if ((annotation().Bwid() > 0) && (annotation().borderColor() != CommonStrings::None))
+		if (((annotation().Bwid() > 0) && (annotation().borderColor() != CommonStrings::None)))
 		{
 			QColor tmp;
 			SetQColor(&tmp, annotation().borderColor(), 100);
-			QPalette pal = QPalette(tmp);
-			if (annotation().Bsty() == 3)
-				p->drawShadePanel(QRect(0, 0, Width, Height), pal, false, annotation().Bwid());
-			else if (annotation().Bsty() == 4)
-				p->drawShadePanel(QRect(0, 0, Width, Height), pal, true, annotation().Bwid());
+			if (annotation().Type() == Annotation::RadioButton)
+			{
+				double bwh = annotation().Bwid() / 2.0;
+				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->setFillMode(ScPainter::None);
+				p->setStrokeMode(ScPainter::Solid);
+				p->strokePath();
+			}
 			else
 			{
-				p->setPen(tmp, annotation().Bwid(), annotation().Bsty() == 0 ? Qt::SolidLine : Qt::DashLine, Qt::FlatCap, Qt::MiterJoin);
-				p->setStrokeMode(ScPainter::Solid);
-				p->drawRect(0, 0, Width, Height);
+				QPalette pal = QPalette(tmp);
+				if (annotation().Bsty() == 3)
+					p->drawShadePanel(QRect(0, 0, Width, Height), pal, false, annotation().Bwid());
+				else if (annotation().Bsty() == 4)
+					p->drawShadePanel(QRect(0, 0, Width, Height), pal, true, annotation().Bwid());
+				else
+				{
+					p->setPen(tmp, annotation().Bwid(), annotation().Bsty() == 0 ? Qt::SolidLine : Qt::DashLine, Qt::FlatCap, Qt::MiterJoin);
+					p->setStrokeMode(ScPainter::Solid);
+					p->drawRect(0, 0, Width, Height);
+				}
 			}
 		}
 		if (annotation().Type() == Annotation::Button)
@@ -3193,6 +3209,23 @@
 			BExtra = wdt;
 			invalid = true;
 			layout();
+		}
+		else if (annotation().Type() == Annotation::RadioButton)
+		{
+			if (annotation().IsChk())
+			{
+				QPainterPath clp2;
+				clp2.addEllipse(QRectF(annotation().Bwid() * 1.5, annotation().Bwid() * 1.5, width() - annotation().Bwid() * 3, height() - annotation().Bwid() * 3).normalized());
+				FPointArray clpArr2;
+				clpArr2.fromQPainterPath(clp2);
+				p->setBrush(fontColor);
+				p->setFillMode(ScPainter::Solid);
+				p->setupPolygon(&clpArr2);
+				p->fillPath();
+			}
+			p->restore();
+			p->restore();
+			return;
 		}
 		else if (annotation().Type() == Annotation::Checkbox)
 		{
@@ -5042,7 +5075,7 @@
 		actionList << "itemPDFIsBookmark";
 	if (isAnnotation())
 	{
-		if ((annotation().Type() == 0) || (annotation().Type() == 1) || ((annotation().Type() > Annotation::Listbox) && (annotation().Type() < Annotation::Annot3D)))
+		if ((annotation().Type() == 0) || (annotation().Type() == 1) || ((annotation().Type() > Annotation::Listbox) && (annotation().Type() < Annotation::RadioButton)))
 			actionList << "itemPDFAnnotationProps";
 		else
 			actionList << "itemPDFFieldProps";

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Mon Dec 10 21:41:10 2012
@@ -1002,7 +1002,7 @@
 				{
 					int annotType  = pgit->annotation().Type();
 					bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
-					if (pgit->annotation().Type() == Annotation::Checkbox)
+					if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
 						StdFonts.insert("/ZapfDingbats", "");
 					if (pgit->itemText.length() > 0 || mustEmbed)
 					{
@@ -1054,7 +1054,7 @@
 				{
 					int annotType  = pgit->annotation().Type();
 					bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
-					if (pgit->annotation().Type() == Annotation::Checkbox)
+					if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
 						StdFonts.insert("/ZapfDingbats", "");
 					if (pgit->itemText.length() > 0 || mustEmbed)
 					{
@@ -1106,7 +1106,7 @@
 				{
 					int annotType  = pgit->annotation().Type();
 					bool mustEmbed = ((annotType >= Annotation::Button) && (annotType <= Annotation::Listbox) && (annotType != Annotation::Checkbox));
-					if (pgit->annotation().Type() == Annotation::Checkbox)
+					if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
 						StdFonts.insert("/ZapfDingbats", "");
 					if (pgit->itemText.length() > 0 || mustEmbed)
 					{
@@ -1164,7 +1164,7 @@
 				{
 					if (pgit->isAnnotation())
 					{
-						if (pgit->annotation().Type() == Annotation::Checkbox)
+						if ((pgit->annotation().Type() == Annotation::Checkbox) || (pgit->annotation().Type() == Annotation::RadioButton))
 							StdFonts.insert("/ZapfDingbats", "");
 						if (pgit->itemText.length() > 0)
 						{
@@ -2667,10 +2667,10 @@
 
 void PDFLibCore::PDF_Begin_Page(const ScPage* pag, QPixmap pm)
 {
-	QString tmp;
 	ActPageP = pag;
 	Content = "";
 	Seite.AObjects.clear();
+	Seite.radioButtonList.clear();
 	if (Options.Thumbnails)
 	{
 		ScImage img(pm.toImage());
@@ -2703,6 +2703,8 @@
 
 void PDFLibCore::PDF_End_Page(int physPage)
 {
+	if (!Seite.radioButtonList.isEmpty())
+		PDF_RadioButtons();
 	uint PgNr =  ActPageP->pageNr();
 	double markOffs = 0.0;
 	if ((Options.cropMarks) || (Options.bleedMarks) || (Options.registrationMarks) || (Options.colorMarks) || (Options.docInfoMarks))
@@ -3703,6 +3705,11 @@
 		case PageItem::TextFrame:
 			if ((ite->isAnnotation()) && (Options.Version != PDFOptions::PDFVersion_X3) && (Options.Version != PDFOptions::PDFVersion_X1a) && (Options.Version != PDFOptions::PDFVersion_X4))
 			{
+				if (ite->annotation().Type() == Annotation::RadioButton)
+				{
+					Seite.radioButtonList.append(ite);
+					break;
+				}
 				if (!PDF_Annotation(ite, PNr))
 					return false;
 				break;
@@ -8331,6 +8338,213 @@
 }
 #endif
 
+void PDFLibCore::PDF_RadioButtons()
+{
+	QMap<PageItem*, QList<PageItem*> > rbMap;
+	for (int a = 0; a < Seite.radioButtonList.count(); a++)
+	{
+		PageItem* pa = Seite.radioButtonList[a]->Parent;
+		if (rbMap.contains(pa))
+			rbMap[pa].append(Seite.radioButtonList[a]);
+		else
+		{
+			QList<PageItem*> aList;
+			aList.append(Seite.radioButtonList[a]);
+			rbMap.insert(pa, aList);
+		}
+	}
+	QMap<PageItem*, QList<PageItem*> >::Iterator it;
+	for (it = rbMap.begin(); it != rbMap.end(); ++it)
+	{
+		QList<PageItem*> bList = it.value();
+		QList<uint> kidsList;
+		uint parentObject = newObject();
+		QString onState = "";
+		for (int a = 0; a < bList.count(); a++)
+		{
+			uint kid = PDF_RadioButton(bList[a], parentObject);
+			kidsList.append(kid);
+			if (bList[a]->annotation().IsChk())
+				onState = QString("/%1").arg(bList[a]->itemName().replace(".", "_" ));
+		}
+		QString anTitle;
+		if (it.key() == 0)
+			anTitle = QString("Page%1").arg(ActPageP->pageNr() + 1);
+		else
+			anTitle = QString("/%1").arg(it.key()->itemName().replace(".", "_" ));
+		StartObj(parentObject);
+		Seite.AObjects.append(parentObject);
+		Seite.FormObjects.append(parentObject);
+		PutDoc("<<\n/Type /Annot\n");
+		PutDoc("/Subtype /Widget\n");
+		PutDoc("/FT /Btn\n");
+		PutDoc("/T " + EncString(anTitle, parentObject) + "\n");
+		PutDoc("/Ff "+QString::number(Annotation::Flag_Radio | Annotation::Flag_NoToggleToOff)+"\n");
+		PutDoc("/V "+onState+"\n");
+		PutDoc("/DV "+onState+"\n");
+		PutDoc("/Kids\n[\n");
+		for (int a = 0; a < kidsList.count(); a++)
+		{
+			PutDoc(QString::number(kidsList[a]) + " 0 R\n");
+		}
+		PutDoc("]\n");
+		PutDoc("/Rect [0 0 0 0]\n");
+		PutDoc(">>\nendobj\n");
+	}
+}
+
+uint PDFLibCore::PDF_RadioButton(PageItem* ite, uint parent)
+{
+	QMap<int, QString> ind2PDFabr;
+	static const QString bifonts[] = {"/Courier", "/Courier-Bold", "/Courier-Oblique", "/Courier-BoldOblique",
+												"/Helvetica", "/Helvetica-Bold", "/Helvetica-Oblique", "/Helvetica-BoldOblique",
+												"/Times-Roman", "/Times-Bold", "/Times-Italic", "/Times-BoldItalic",
+												"/ZapfDingbats", "/Symbol"};
+	static const size_t ar = sizeof(bifonts) / sizeof(*bifonts);
+	for (uint a = 0; a < ar; ++a)
+		ind2PDFabr[a] = bifonts[a];
+	double x = ite->xPos() - ActPageP->xOffset();
+	double y = ActPageP->height() - (ite->yPos()  - ActPageP->yOffset());
+	double x2 = x+ite->width();
+	double y2 = y-ite->height();
+	QString cc;
+	uint annotationObj = newObject();
+	uint actionObj = 0;
+	if ((ite->annotation().Type() > 1) && ((ite->annotation().ActionType() == 1) || (ite->annotation().AAact())) && (!ite->annotation().Action().isEmpty()))
+		actionObj = WritePDFString(ite->annotation().Action());
+	uint AActionObj = writeActions(ite->annotation(), annotationObj);
+	StartObj(annotationObj);
+	Seite.AObjects.append(annotationObj);
+	PutDoc("<<\n/Type /Annot\n");
+	Seite.FormObjects.append(annotationObj);
+	PutDoc("/Subtype /Widget\n");
+	PutDoc("/Parent " + QString::number(parent) + " 0 R\n");
+	if (!ite->annotation().ToolTip().isEmpty())
+		PutDoc("/TU " + EncStringUTF16(ite->annotation().ToolTip(), annotationObj) + "\n");
+	PutDoc("/F ");
+	QString mm[] = {"4", "2", "0", "32"};
+	PutDoc(mm[ite->annotation().Vis()]);
+	PutDoc("\n");
+	QString cnx = "/"+StdFonts["/ZapfDingbats"];
+	cnx += " "+FToStr(ite->itemText.defaultStyle().charStyle().fontSize() / 10.0)+" Tf";
+	if (ite->itemText.defaultStyle().charStyle().fillColor() != CommonStrings::None)
+		cnx += " "+ putColor(ite->itemText.defaultStyle().charStyle().fillColor(), ite->itemText.defaultStyle().charStyle().fillShade(), true);
+	if (ite->fillColor() != CommonStrings::None)
+		cnx += " "+ putColor(ite->fillColor(), ite->fillShade(), false);
+	PutDoc("/DA " + EncString(cnx, annotationObj) + "\n");
+	int flg = ite->annotation().Flag();
+	if (Options.Version == PDFOptions::PDFVersion_13)
+		flg = flg & 522247;
+	PutDoc("/Ff "+QString::number(flg)+"\n");
+	PutDoc("/FT /Btn\n");
+	PutDoc("/BS << /Type /Border /W ");
+	PutDoc(ite->annotation().borderColor() != CommonStrings::None ? QString::number(ite->annotation().Bwid()) : QString("0"));
+	PutDoc(" /S /");
+	const QString xb[] = {"S", "D", "U", "B", "I"};
+	PutDoc(xb[ite->annotation().Bsty()]);
+	PutDoc(" >>\n");
+	PutDoc("/MK << ");
+	PutDoc("/BG [ 1 1 1 ] ");
+	if (ite->annotation().borderColor() != CommonStrings::None)
+		PutDoc("/BC [ "+SetColor(ite->annotation().borderColor(), 100)+" ] ");
+	if (ite->rotation() != 0)
+		PutDoc("/R "+QString::number((abs(static_cast<int>(ite->rotation())) / 90)*90)+" ");
+	PutDoc(">>\n");
+	QString onState = QString("/%1").arg(ite->itemName().replace(".", "_" ));
+	if (ite->annotation().IsChk())
+		PutDoc("/AS "+onState+"\n");
+	else
+		PutDoc("/AS /Off\n");
+	uint appearanceObj1 = newObject();
+	uint appearanceObj2 = newObject();
+	PutDoc("/AP << /N <<\n");
+	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().Action().isEmpty())
+			{
+				PutDoc("/A << /Type /Action /S /JavaScript /JS " + QString::number(actionObj) + " 0 R >>\n");
+			}
+		}
+		if (ite->annotation().AAact())
+		{
+			if (!ite->annotation().Action().isEmpty())
+			{
+				PutDoc("/A << /Type /Action /S /JavaScript /JS " + QString::number(actionObj) + " 0 R >>\n");
+			}
+			PutDoc("/AA " + QString::number(AActionObj) + " 0 R\n");
+		}
+	}
+	switch (((abs(static_cast<int>(ite->rotation())) / 90)*90))
+	{
+		case 0:
+			break;
+		case 90:
+			x = ite->xPos() - ActPageP->xOffset();
+			y2 = ActPageP->height() - (ite->yPos()  - ActPageP->yOffset());
+			x2 = x + ite->height();
+			y = y2 + ite->width();
+			break;
+		case 180:
+			x = ite->xPos() - ActPageP->xOffset() - ite->width();
+			y2 = ActPageP->height() - (ite->yPos()  - ActPageP->yOffset());
+			x2 = ite->xPos() - ActPageP->xOffset();
+			y = y2 + ite->height();
+			break;
+		case 270:
+			x = ite->xPos() - ActPageP->xOffset() - ite->height();
+			y2 = ActPageP->height() - (ite->yPos()  - ActPageP->yOffset()) - ite->width();
+			x2 = ite->xPos() - ActPageP->xOffset();
+			y = ActPageP->height() - (ite->yPos()  - ActPageP->yOffset());
+			break;
+	}
+	PutDoc("/Rect [ "+FToStr(x+bleedDisplacementX)+" "+FToStr(y2+bleedDisplacementY)+" "+FToStr(x2+bleedDisplacementX)+" "+FToStr(y+bleedDisplacementY)+" ]\n");
+	PutDoc(">>\nendobj\n");
+
+	double bwh = ite->annotation().Bwid() / 2.0;
+	QPainterPath clp;
+	clp.addEllipse(QRectF(bwh, bwh, ite->width() - ite->annotation().Bwid(), ite->height() - ite->annotation().Bwid()));
+	FPointArray clpArr;
+	clpArr.fromQPainterPath(clp);
+	clpArr.translate(0, -ite->height());
+	cc = "q\n";
+	cc += QString::number(ite->annotation().Bwid())+" w\n";
+	if (ite->annotation().borderColor() != CommonStrings::None)
+		cc += putColor(ite->annotation().borderColor(), 100.0, false);
+	else
+		cc += "0 G\n";
+	cc += SetClipPathArray(&clpArr, true);
+	cc += "h\nS\n";
+	if (ite->itemText.defaultStyle().charStyle().fillColor() != CommonStrings::None)
+		cc += putColor(ite->itemText.defaultStyle().charStyle().fillColor(), ite->itemText.defaultStyle().charStyle().fillShade(), true);
+	else if (ite->fillColor() != CommonStrings::None)
+		cc += putColor(ite->fillColor(), ite->fillShade(), true);
+	QPainterPath clp2;
+	clp2.addEllipse(QRectF(ite->annotation().Bwid() * 1.5, ite->annotation().Bwid() * 1.5, ite->width() - ite->annotation().Bwid() * 3, ite->height() - ite->annotation().Bwid() * 3).normalized());
+	FPointArray clpArr2;
+	clpArr2.fromQPainterPath(clp2);
+	clpArr2.translate(0, -ite->height());
+	cc += SetClipPathArray(&clpArr2, true);
+	cc += "h\nf\nQ\n";
+	PDF_xForm(appearanceObj1, ite->width(), ite->height(), cc);
+	cc = "";
+	cc = "q\n";
+	cc += QString::number(ite->annotation().Bwid())+" w\n";
+	if (ite->annotation().borderColor() != CommonStrings::None)
+		cc += putColor(ite->annotation().borderColor(), 100.0, false);
+	else
+		cc += "0 G\n";
+	cc += SetClipPathArray(&clpArr, true);
+	cc += "h\nS\n";
+	cc += "Q";
+	PDF_xForm(appearanceObj2, ite->width(), ite->height(), cc);
+	return annotationObj;
+}
+
 bool PDFLibCore::PDF_Annotation(PageItem *ite, uint)
 {
 	ScImage img;
@@ -8432,7 +8646,7 @@
 			PutDoc(x[ite->annotation().Bsty()]);
 			PutDoc(" >>\n");
 			QString cnx;
-			if (ite->annotation().Type() == 4)
+			if (ite->annotation().Type() == Annotation::Checkbox)
 				cnx += "/"+StdFonts["/ZapfDingbats"];
 			else
 			{
@@ -8502,7 +8716,7 @@
 				if (ite->annotation().borderColor() != CommonStrings::None)
 					PutDoc("/BC [ "+SetColor(ite->annotation().borderColor(), 100)+" ] ");
 			}
-				else
+			else
 			{
 				if (ite->fillColor() != CommonStrings::None)
 					PutDoc("/BG [ "+SetColor(ite->fillColor(), ite->fillShade())+" ] ");

Modified: trunk/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/pdflib_core.h
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.h (original)
+++ trunk/Scribus/scribus/pdflib_core.h Mon Dec 10 21:41:10 2012
@@ -165,10 +165,12 @@
 	bool    PDF_GradientFillStroke(QString& output, PageItem *currItem, bool stroke = false, bool forArrow = false);
 	QString PDF_TransparenzFill(PageItem *currItem);
 	QString PDF_TransparenzStroke(PageItem *currItem);
-	bool    PDF_Annotation(PageItem *ite, uint PNr);
 #ifdef HAVE_OSG
 	bool    PDF_3DAnnotation(PageItem *ite, uint PNr);
 #endif
+	void	PDF_RadioButtons();
+	uint    PDF_RadioButton(PageItem *ite, uint parent);
+	bool    PDF_Annotation(PageItem *ite, uint PNr);
 	void    PDF_Form(const QString& im);
 	void    PDF_xForm(uint objNr, double w, double h, QString im);
 	bool    PDF_Image(PageItem* c, const QString& fn, double sx, double sy, double x, double y, bool fromAN = false, const QString& Profil = "", bool Embedded = false, eRenderIntent Intent = Intent_Relative_Colorimetric, QString* output = NULL);
@@ -218,6 +220,7 @@
 		QMap<QString,int> FObjects;
 		QList<int> AObjects;
 		QList<int> FormObjects;
+		QList<PageItem*> radioButtonList;
 	}
 	Seite;
 	struct OutL

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&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 Mon Dec 10 21:41:10 2012
@@ -652,7 +652,7 @@
 							else
 								ite->itemText.insertChars(itemText);
 							applyTextStyle(ite, fontName, CurrColorText, fontSize);
-							ite->annotation().addToFlag(65536);
+							ite->annotation().addToFlag(Annotation::Flag_PushButton);
 							handleActions(ite, ano);
 						}
 						else if (wtyp == 3) // Textfield
@@ -663,13 +663,13 @@
 								ite->itemText.insertChars(UnicodeParsedString(btn->getContent()));
 								applyTextStyle(ite, fontName, CurrColorText, fontSize);
 								if (btn->isMultiline())
-									ite->annotation().addToFlag(4096);
+									ite->annotation().addToFlag(Annotation::Flag_Multiline);
 								if (btn->isPassword())
-									ite->annotation().addToFlag(8192);
+									ite->annotation().addToFlag(Annotation::Flag_Password);
 								if (btn->noSpellCheck())
-									ite->annotation().addToFlag(4194304);
+									ite->annotation().addToFlag(Annotation::Flag_DoNotSpellCheck);
 								if (btn->noScroll())
-									ite->annotation().addToFlag(8388608);
+									ite->annotation().addToFlag(Annotation::Flag_DoNotScroll);
 								int mxLen = btn->getMaxLen();
 								if (mxLen > 0)
 									ite->annotation().setMaxChar(mxLen);
@@ -706,7 +706,7 @@
 							if (btn)
 							{
 								if (wtyp == 5)
-									ite->annotation().addToFlag(131072);
+									ite->annotation().addToFlag(Annotation::Flag_Combo);
 								int co = btn->getNumChoices();
 								if (co > 0)
 								{
@@ -719,7 +719,7 @@
 								}
 								applyTextStyle(ite, fontName, CurrColorText, fontSize);
 								if (!btn->isReadOnly())
-									ite->annotation().addToFlag(262144);
+									ite->annotation().addToFlag(Annotation::Flag_Edit);
 								handleActions(ite, ano);
 							}
 						}

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Mon Dec 10 21:41:10 2012
@@ -2464,6 +2464,7 @@
 		scrMenuMgr->setMenuEnabled("FileOpenRecent", false);
 		pagePalette->enablePalette(false);
 		scrActions["toolsPDFPushButton"]->setEnabled(false);
+		scrActions["toolsPDFRadioButton"]->setEnabled(false);
 		scrActions["toolsPDFTextField"]->setEnabled(false);
 		scrActions["toolsPDFCheckBox"]->setEnabled(false);
 		scrActions["toolsPDFComboBox"]->setEnabled(false);
@@ -2504,6 +2505,7 @@
 		scrActions["fileSaveAs"]->setEnabled(true);
 		scrActions["fileCollect"]->setEnabled(true);
 		scrActions["toolsPDFPushButton"]->setEnabled(true);
+		scrActions["toolsPDFRadioButton"]->setEnabled(true);
 		scrActions["toolsPDFTextField"]->setEnabled(true);
 		scrActions["toolsPDFCheckBox"]->setEnabled(true);
 		scrActions["toolsPDFComboBox"]->setEnabled(true);
@@ -2598,6 +2600,7 @@
 	scrActions["toolsMeasurements"]->setEnabled(true);
 	scrActions["toolsEyeDropper"]->setEnabled(true);
 	scrActions["toolsPDFPushButton"]->setEnabled(true);
+	scrActions["toolsPDFRadioButton"]->setEnabled(true);
 	scrActions["toolsPDFTextField"]->setEnabled(true);
 	scrActions["toolsPDFCheckBox"]->setEnabled(true);
 	scrActions["toolsPDFComboBox"]->setEnabled(true);
@@ -4919,6 +4922,7 @@
 		scrActions["toolsCopyProperties"]->setEnabled(false);
 		scrActions["toolsEyeDropper"]->setEnabled(false);
 		scrActions["toolsPDFPushButton"]->setEnabled(false);
+		scrActions["toolsPDFRadioButton"]->setEnabled(false);
 		scrActions["toolsPDFTextField"]->setEnabled(false);
 		scrActions["toolsPDFCheckBox"]->setEnabled(false);
 		scrActions["toolsPDFComboBox"]->setEnabled(false);
@@ -6505,6 +6509,7 @@
 		scrActions["toolsCopyProperties"]->setEnabled(false);
 		scrActions["toolsEyeDropper"]->setEnabled(false);
 		scrActions["toolsPDFPushButton"]->setEnabled(false);
+		scrActions["toolsPDFRadioButton"]->setEnabled(false);
 		scrActions["toolsPDFTextField"]->setEnabled(false);
 		scrActions["toolsPDFCheckBox"]->setEnabled(false);
 		scrActions["toolsPDFComboBox"]->setEnabled(false);
@@ -6584,6 +6589,7 @@
 	scrActions["toolsInsertSpiral"]->setEnabled(true);
 	scrActions["toolsInsertRenderFrame"]->setEnabled(true);
 	scrActions["toolsPDFPushButton"]->setEnabled(true);
+	scrActions["toolsPDFRadioButton"]->setEnabled(true);
 	scrActions["toolsPDFTextField"]->setEnabled(true);
 	scrActions["toolsPDFCheckBox"]->setEnabled(true);
 	scrActions["toolsPDFComboBox"]->setEnabled(true);
@@ -6693,6 +6699,7 @@
 	scrActions["toolsMeasurements"]->setChecked(mode==modeMeasurementTool);
 	scrActions["toolsCopyProperties"]->setChecked(mode==modeCopyProperties);
 	scrActions["toolsPDFPushButton"]->setChecked(mode==modeInsertPDFButton);
+	scrActions["toolsPDFRadioButton"]->setChecked(mode==modeInsertPDFRadioButton);
 	scrActions["toolsPDFTextField"]->setChecked(mode==modeInsertPDFTextfield);
 	scrActions["toolsPDFCheckBox"]->setChecked(mode==modeInsertPDFCheckbox);
 	scrActions["toolsPDFComboBox"]->setChecked(mode==modeInsertPDFCombobox);
@@ -6933,6 +6940,7 @@
 				qApp->changeOverrideCursor(QCursor(loadIcon("colorpickercursor.png"), 0, 32));
 				break;
 			case modeInsertPDFButton:
+			case modeInsertPDFRadioButton:
 			case modeInsertPDFTextfield:
 			case modeInsertPDFCheckbox:
 			case modeInsertPDFCombobox:
@@ -8755,6 +8763,7 @@
 		scrActions["fileExportAsPDF"]->setEnabled(false);
 		scrActions["PrintPreview"]->setEnabled(false);
 		scrActions["toolsPDFPushButton"]->setEnabled(false);
+		scrActions["toolsPDFRadioButton"]->setEnabled(false);
 		scrActions["toolsPDFTextField"]->setEnabled(false);
 		scrActions["toolsPDFCheckBox"]->setEnabled(false);
 		scrActions["toolsPDFComboBox"]->setEnabled(false);
@@ -8819,6 +8828,7 @@
 	scrActions["pageDelete"]->setEnabled(setter);
 	scrActions["pageMove"]->setEnabled(setter);
 	scrActions["toolsPDFPushButton"]->setEnabled(true);
+	scrActions["toolsPDFRadioButton"]->setEnabled(true);
 	scrActions["toolsPDFTextField"]->setEnabled(true);
 	scrActions["toolsPDFCheckBox"]->setEnabled(true);
 	scrActions["toolsPDFComboBox"]->setEnabled(true);
@@ -8877,6 +8887,7 @@
 		scrActions["fileExportAsPDF"]->setEnabled(false);
 		scrActions["PrintPreview"]->setEnabled(false);
 		scrActions["toolsPDFPushButton"]->setEnabled(false);
+		scrActions["toolsPDFRadioButton"]->setEnabled(false);
 		scrActions["toolsPDFTextField"]->setEnabled(false);
 		scrActions["toolsPDFCheckBox"]->setEnabled(false);
 		scrActions["toolsPDFComboBox"]->setEnabled(false);
@@ -8926,6 +8937,7 @@
 	scrActions["pageDelete"]->setEnabled(setter);
 	scrActions["pageMove"]->setEnabled(setter);
 	scrActions["toolsPDFPushButton"]->setEnabled(true);
+	scrActions["toolsPDFRadioButton"]->setEnabled(true);
 	scrActions["toolsPDFTextField"]->setEnabled(true);
 	scrActions["toolsPDFCheckBox"]->setEnabled(true);
 	scrActions["toolsPDFComboBox"]->setEnabled(true);
@@ -8993,6 +9005,7 @@
 	scrActions["filePrint"]->setEnabled(false);
 	scrActions["PrintPreview"]->setEnabled(false);
 	scrActions["toolsPDFPushButton"]->setEnabled(false);
+	scrActions["toolsPDFRadioButton"]->setEnabled(false);
 	scrActions["toolsPDFTextField"]->setEnabled(false);
 	scrActions["toolsPDFCheckBox"]->setEnabled(false);
 	scrActions["toolsPDFComboBox"]->setEnabled(false);
@@ -9034,6 +9047,7 @@
 	scrActions["pageDelete"]->setEnabled(setter);
 	scrActions["pageMove"]->setEnabled(setter);
 	scrActions["toolsPDFPushButton"]->setEnabled(true);
+	scrActions["toolsPDFRadioButton"]->setEnabled(true);
 	scrActions["toolsPDFTextField"]->setEnabled(true);
 	scrActions["toolsPDFCheckBox"]->setEnabled(true);
 	scrActions["toolsPDFComboBox"]->setEnabled(true);
@@ -9427,7 +9441,7 @@
 	if (doc->m_Selection->count() != 0)
 	{
 		PageItem *currItem = doc->m_Selection->itemAt(0);
-		if ((currItem->annotation().Type() == 0) || (currItem->annotation().Type() == 1) || (currItem->annotation().Type() > 9))
+		if ((currItem->annotation().Type() == 0) || (currItem->annotation().Type() == 1) || ((currItem->annotation().Type() > 9) && (currItem->annotation().Type() < 13)))
 		{
 			int AnType = currItem->annotation().Type();
 			int AnActType = currItem->annotation().ActionType();
@@ -9526,6 +9540,7 @@
 	if (doc->masterPageMode())
 	{
 		scrActions["toolsPDFPushButton"]->setEnabled(false);
+		scrActions["toolsPDFRadioButton"]->setEnabled(false);
 		scrActions["toolsPDFTextField"]->setEnabled(false);
 		scrActions["toolsPDFCheckBox"]->setEnabled(false);
 		scrActions["toolsPDFComboBox"]->setEnabled(false);
@@ -9538,6 +9553,7 @@
 	else
 	{
 		scrActions["toolsPDFPushButton"]->setEnabled(setter);
+		scrActions["toolsPDFRadioButton"]->setEnabled(setter);
 		scrActions["toolsPDFTextField"]->setEnabled(setter);
 		scrActions["toolsPDFCheckBox"]->setEnabled(setter);
 		scrActions["toolsPDFComboBox"]->setEnabled(setter);

Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Mon Dec 10 21:41:10 2012
@@ -328,7 +328,8 @@
 	modeEditSpiral,
 	modeEditTable,
 	modeEditMeshPatch,
-	modeEditWeldPoint
+	modeEditWeldPoint,
+	modeInsertPDFRadioButton
 };
 
 struct AlignObjs

Modified: trunk/Scribus/scribus/ui/annot.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/ui/annot.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annot.cpp (original)
+++ trunk/Scribus/scribus/ui/annot.cpp Mon Dec 10 21:41:10 2012
@@ -93,14 +93,17 @@
 	Layout1->addWidget( TextLabel1 );
 
 	ComboBox1 = new QComboBox( this );
-	QString tmp[] = { tr("Button"), tr("Text Field"), tr("Check Box"), tr("Combo Box"), tr("List Box")};
+	QString tmp[] = { tr("Button"), tr("Text Field"), tr("Check Box"), tr("Combo Box"), tr("List Box"), tr("Radio Button")};
 	size_t array = sizeof(tmp) / sizeof(*tmp);
 	for (uint a = 0; a < array; ++a)
 		ComboBox1->addItem(tmp[a]);
 	ComboBox1->setEditable(false);
 	Layout1->addWidget( ComboBox1 );
 	AnnotLayout->addLayout( Layout1 );
-	ComboBox1->setCurrentIndex(item->annotation().Type()-2);
+	if (item->annotation().Type() != Annotation::RadioButton)
+		ComboBox1->setCurrentIndex(item->annotation().Type()-2);
+	else
+		ComboBox1->setCurrentIndex(5);
 
 	Fram = new QStackedWidget(this);
 	AnnotLayout->addWidget( Fram );
@@ -230,19 +233,19 @@
 	ReadOnly->setText( tr( "Read Only" ) );
 	if (item->annotation().Type() == Annotation::Button)
 		ReadOnly->setEnabled(false);
-	ReadOnly->setChecked(item->annotation().Flag() & 1);
+	ReadOnly->setChecked(item->annotation().Flag() & Annotation::Flag_ReadOnly);
 	GroupBox30Layout->addWidget( ReadOnly, 0, 0, 1, 2 );
 	Required = new QCheckBox( GroupBox30 );
 	Required->setText( tr( "Required" ) );
 	if (item->annotation().Type() == Annotation::Button)
 		Required->setEnabled(false);
-	Required->setChecked(item->annotation().Flag() & 2);
+	Required->setChecked(item->annotation().Flag() & Annotation::Flag_Required);
 	GroupBox30Layout->addWidget( Required, 1, 0, 1, 2 );
 	NoExport = new QCheckBox( GroupBox30 );
 	NoExport->setText( tr( "Do Not Export Value" ) );
 	if (item->annotation().Type() == Annotation::Button)
 		NoExport->setEnabled(false);
-	NoExport->setChecked(item->annotation().Flag() & 4);
+	NoExport->setChecked(item->annotation().Flag() & Annotation::Flag_NoExport);
 	GroupBox30Layout->addWidget( NoExport, 2, 0, 1, 2 );
 	TextLabel90 = new QLabel( GroupBox30 );
 	TextLabel90->setText( tr( "Visibility:" ) );
@@ -437,11 +440,11 @@
 	OptTextFeldLayout->setAlignment( Qt::AlignTop );
 	MultiL = new QCheckBox( OptTextFeld );
 	MultiL->setText( tr( "Multi-Line" ) );
-	MultiL->setChecked(item->annotation().Flag() & 4096);
+	MultiL->setChecked(item->annotation().Flag() & Annotation::Flag_Multiline);
 	OptTextFeldLayout->addWidget( MultiL );
 	Passwd = new QCheckBox( OptTextFeld );
 	Passwd->setText( tr( "Password" ) );
-	Passwd->setChecked(item->annotation().Flag() & 8192);
+	Passwd->setChecked(item->annotation().Flag() & Annotation::Flag_Password);
 	OptTextFeldLayout->addWidget( Passwd );
 	Layout8 = new QHBoxLayout;
 	Layout8->setSpacing( 5 );
@@ -465,11 +468,11 @@
 	OptTextFeldLayout->addLayout( Layout8 );
 	NoScroll = new QCheckBox( OptTextFeld );
 	NoScroll->setText( tr( "Do Not Scroll" ) );
-	NoScroll->setChecked(item->annotation().Flag() & 8388608);
+	NoScroll->setChecked(item->annotation().Flag() & Annotation::Flag_DoNotScroll);
 	OptTextFeldLayout->addWidget( NoScroll );
 	NoSpell = new QCheckBox( OptTextFeld );
 	NoSpell->setText( tr( "Do Not Spell Check" ) );
-	NoSpell->setChecked(item->annotation().Flag() & 4194304);
+	NoSpell->setChecked(item->annotation().Flag() & Annotation::Flag_DoNotSpellCheck);
 	OptTextFeldLayout->addWidget( NoSpell );
 	FramOp->addWidget( OptTextFeld );
 
@@ -513,7 +516,7 @@
 	OptComboLayout->setAlignment( Qt::AlignTop );
 	CanEdit = new QCheckBox( OptCombo );
 	CanEdit->setText( tr( "Editable" ) );
-	CanEdit->setChecked(item->annotation().Flag() & 262144);
+	CanEdit->setChecked(item->annotation().Flag() & Annotation::Flag_Edit);
 	OptComboLayout->addWidget( CanEdit );
 	FramOp->addWidget( OptCombo );
 
@@ -1192,7 +1195,10 @@
 	Frame9->setFrameShadow( QFrame::Plain );
 	Fram->addWidget(Frame9);
 
-	SetAnnotationType(item->annotation().Type()-2);
+	if (item->annotation().Type() == Annotation::RadioButton)
+		SetAnnotationType(5);
+	else
+		SetAnnotationType(item->annotation().Type()-2);
 	Layout1_2 = new QHBoxLayout;
 	Layout1_2->setSpacing( 5 );
 	Layout1_2->setMargin( 0 );
@@ -1890,7 +1896,10 @@
 	QString tmp, tmp2;
 	QString Nfo("");
 	bool AAct = false;
-	item->annotation().setType(ComboBox1->currentIndex()+2);
+	if (ComboBox1->currentIndex() == 5)
+		item->annotation().setType(Annotation::RadioButton);
+	else
+		item->annotation().setType(ComboBox1->currentIndex()+2);
 	if (Name->text() != OldName)
 		item->setItemName(Name->text());
 	item->annotation().setToolTip(Tip->text());
@@ -1910,7 +1919,7 @@
 	Limit->isChecked() ? item->annotation().setMaxChar(MaxChars->value()) : item->annotation().setMaxChar(-1);
 	if (item->annotation().Type() == Annotation::Button)
 	{
-		item->annotation().addToFlag(65536);
+		item->annotation().addToFlag(Annotation::Flag_PushButton);
 		if (item->Pfile.isEmpty())
 			item->annotation().setUseIcons(false);
 	}
@@ -1918,28 +1927,32 @@
 	{
 		item->annotation().setUseIcons(false);
 		if (ReadOnly->isChecked())
-			item->annotation().addToFlag(1);
+			item->annotation().addToFlag(Annotation::Flag_ReadOnly);
 		if (Required->isChecked())
-			item->annotation().addToFlag(2);
+			item->annotation().addToFlag(Annotation::Flag_Required);
 		if (NoExport->isChecked())
-			item->annotation().addToFlag(4);
+			item->annotation().addToFlag(Annotation::Flag_NoExport);
+	}
+	if (item->annotation().Type() == Annotation::RadioButton)
+	{
+		item->annotation().addToFlag(Annotation::Flag_Radio | Annotation::Flag_NoToggleToOff);
 	}
 	if (item->annotation().Type() == Annotation::Combobox)
 	{
-		item->annotation().addToFlag(131072);
+		item->annotation().addToFlag(Annotation::Flag_Combo);
 		if (CanEdit->isChecked())
-			item->annotation().addToFlag(262144);
+			item->annotation().addToFlag(Annotation::Flag_Edit);
 	}
 	if (item->annotation().Type() == Annotation::Textfield)
 	{
 		if (MultiL->isChecked())
-			item->annotation().addToFlag(4096);
+			item->annotation().addToFlag(Annotation::Flag_Multiline);
 		if (Passwd->isChecked())
-			item->annotation().addToFlag(8192);
+			item->annotation().addToFlag(Annotation::Flag_Password);
 		if (NoSpell->isChecked())
-			item->annotation().addToFlag(4194304);
+			item->annotation().addToFlag(Annotation::Flag_DoNotSpellCheck);
 		if (NoScroll->isChecked())
-			item->annotation().addToFlag(8388608);
+			item->annotation().addToFlag(Annotation::Flag_DoNotScroll);
 	}
 	if ((item->annotation().Type() == Annotation::Textfield) || (item->annotation().Type() == Annotation::Combobox))
 	{
@@ -2136,6 +2149,8 @@
 	TabWidget2->setTabEnabled(TabWidget2->indexOf(tab_5), false);
 	EditFormat->setEnabled( false );
 	EditKeystr->setEnabled( false );
+	CText1->show();
+	ChkStil->show();
 	SelAction->clear();
 	QString tmp_selact[]={tr("Mouse Up"), tr("Mouse Down"), tr("Mouse Enter"),
 	                      tr("Mouse Exit"), tr("On Focus"), tr("On Blur")};
@@ -2188,11 +2203,20 @@
 		if (sela == 6)
 			SelAction->addItem( tr( "Selection Change" ) );
 		ReadOnly->setEnabled(true);
-		ReadOnly->setChecked(item->annotation().Flag() & 1);
-		Required->setChecked(item->annotation().Flag() & 2);
-		NoExport->setChecked(item->annotation().Flag() & 4);
+		ReadOnly->setChecked(item->annotation().Flag() & Annotation::Flag_ReadOnly);
+		Required->setChecked(item->annotation().Flag() & Annotation::Flag_Required);
+		NoExport->setChecked(item->annotation().Flag() & Annotation::Flag_NoExport);
 		Fram->setCurrentIndex(3);
-		sela > 5 ? FramOp->setCurrentIndex(3) : FramOp->setCurrentIndex(sela-2);
+		if (sela < 6)
+			FramOp->setCurrentIndex(sela-2);
+		else if (sela == 6)
+			FramOp->setCurrentIndex(3);
+		else
+		{
+			CText1->hide();
+			ChkStil->hide();
+			FramOp->setCurrentIndex(2);
+		}
 		ActionCombo->clear();
 		ActionCombo->addItem( tr( "None" ) );
 		ActionCombo->addItem( tr( "JavaScript" ) );
@@ -2203,11 +2227,11 @@
 		Fram->setCurrentIndex(2);
 		break;
 	}
-	MultiL->setChecked(item->annotation().Flag() & 4096);
-	Passwd->setChecked(item->annotation().Flag() & 8192);
-	CanEdit->setChecked(item->annotation().Flag() & 262144);
-	NoSpell->setChecked(item->annotation().Flag() & 4194304);
-	NoScroll->setChecked(item->annotation().Flag() & 8388608);
+	MultiL->setChecked(item->annotation().Flag() & Annotation::Flag_Multiline);
+	Passwd->setChecked(item->annotation().Flag() & Annotation::Flag_Password);
+	CanEdit->setChecked(item->annotation().Flag() & Annotation::Flag_Edit);
+	NoSpell->setChecked(item->annotation().Flag() & Annotation::Flag_DoNotSpellCheck);
+	NoScroll->setChecked(item->annotation().Flag() & Annotation::Flag_DoNotScroll);
 	ChkStil->setCurrentIndex(item->annotation().ChkStil());
 	isChkd->setChecked(item->annotation().IsChk());
 	setter = item->annotation().MaxChar() != -1 ? true : false;

Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp Mon Dec 10 21:41:10 2012
@@ -414,6 +414,7 @@
 	tableIcon = loadIcon("22/insert-table.png");
 	groupIcon = loadIcon("u_group.png");
 	buttonIcon = loadIcon("22/insert-button.png");
+	radiobuttonIcon = loadIcon("22/radiobutton.png");
 	textFieldIcon = loadIcon("22/text-field.png");
 	checkBoxIcon = loadIcon("22/checkbox.png");
 	comboBoxIcon = loadIcon("22/combobox.png");
@@ -753,6 +754,9 @@
 		{
 			case Annotation::Button:
 				item->setIcon( 0, buttonIcon );
+				break;
+			case Annotation::RadioButton:
+				item->setIcon( 0, radiobuttonIcon );
 				break;
 			case Annotation::Textfield:
 				item->setIcon( 0, textFieldIcon );

Modified: trunk/Scribus/scribus/ui/outlinepalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/ui/outlinepalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.h (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.h Mon Dec 10 21:41:10 2012
@@ -115,6 +115,7 @@
 	QPixmap groupIcon;
 	QPixmap tableIcon;
 	QPixmap buttonIcon;
+	QPixmap radiobuttonIcon;
 	QPixmap textFieldIcon;
 	QPixmap checkBoxIcon;
 	QPixmap comboBoxIcon;

Modified: trunk/Scribus/scribus/ui/pdftoolbar.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/ui/pdftoolbar.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pdftoolbar.cpp (original)
+++ trunk/Scribus/scribus/ui/pdftoolbar.cpp Mon Dec 10 21:41:10 2012
@@ -29,8 +29,9 @@
 PDFToolBar::PDFToolBar(ScribusMainWindow* parent) : ScToolBar( tr("PDF Tools"), "PDF_Tools", parent)
 {
 	this->addAction(parent->scrActions["toolsPDFPushButton"]);
+	this->addAction(parent->scrActions["toolsPDFCheckBox"]);
+	this->addAction(parent->scrActions["toolsPDFRadioButton"]);
 	this->addAction(parent->scrActions["toolsPDFTextField"]);
-	this->addAction(parent->scrActions["toolsPDFCheckBox"]);
 	this->addAction(parent->scrActions["toolsPDFComboBox"]);
 	this->addAction(parent->scrActions["toolsPDFListBox"]);
 	this->addAction(parent->scrActions["toolsPDFAnnotText"]);

Modified: trunk/Scribus/scribus/ui/selfield.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17952&path=/trunk/Scribus/scribus/ui/selfield.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/selfield.cpp (original)
+++ trunk/Scribus/scribus/ui/selfield.cpp Mon Dec 10 21:41:10 2012
@@ -53,7 +53,7 @@
 			PageItem* item = allItems.at(ii);
 			if (Art < 2)
 			{
-				if ((item->isAnnotation()) && ((item->annotation().Type() > 1) && (item->annotation().Type() < Annotation::Annot3D)))
+				if ((item->isAnnotation()) && ((item->annotation().Type() > 1) && (item->annotation().Type() < Annotation::RadioButton)))
 					AvailFields->addItem(item->itemName());
 			}
 			else




More information about the scribus-commit mailing list