r23783 by jghali - Codes style fixes and refactoring for annotation dialogs

scribus-commit scribus-commit at lists.scribus.net
Tue May 12 01:21:52 UTC 2020


Author: jghali
Date: Tue May 12 01:21:52 2020
New Revision: 23783

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23783
Log:
Codes style fixes and refactoring for annotation dialogs

Modified:
    trunk/Scribus/scribus/navigator.cpp
    trunk/Scribus/scribus/navigator.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/annot.cpp
    trunk/Scribus/scribus/ui/annot.h
    trunk/Scribus/scribus/ui/annota.cpp
    trunk/Scribus/scribus/ui/annota.h
    trunk/Scribus/scribus/util_ghostscript.cpp
    trunk/Scribus/scribus/util_ghostscript.h

Modified: trunk/Scribus/scribus/navigator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/navigator.cpp
==============================================================================
--- trunk/Scribus/scribus/navigator.cpp	(original)
+++ trunk/Scribus/scribus/navigator.cpp	Tue May 12 01:21:52 2020
@@ -31,45 +31,45 @@
 #include "scribusview.h"
 #include "util_ghostscript.h"
 
-Navigator::Navigator(QWidget *parent, int Size, int Seite, ScribusView* vie, const QString& fn) : QLabel(parent)
+Navigator::Navigator(QWidget *parent, int size, int pageNr, ScribusView* view, const QString& fn) : QLabel(parent),
+	m_view(view)
 {
 	setScaledContents(false);
 	setAlignment(Qt::AlignLeft | Qt::AlignTop);
 	if (!fn.isEmpty())
 	{
-		QPixmap img = LoadPDF(fn, Seite, Size, &Width, &Height);
+		QPixmap img = loadPDF(fn, pageNr, size, &Width, &Height);
 		if (!img.isNull())
 			pmx = img;
 		else
-			pmx = LoadPDF(fn, 1, Size, &Width, &Height);
+			pmx = loadPDF(fn, 1, size, &Width, &Height);
 	}
 	else
-		pmx=QPixmap::fromImage(vie->PageToPixmap(Seite, Size));
+		pmx = QPixmap::fromImage(view->PageToPixmap(pageNr, size));
 	resize(pmx.width(), pmx.height());
 	Xp = 0;
 	Yp = 0;
 	drawMark(0, 0);
-	view = vie;
 }
 
 void Navigator::mouseMoveEvent(QMouseEvent *m)
 {
 	drawMark(m->x(), m->y());
-	emit Coords(static_cast<double>(m->x())/static_cast<double>(pmx.width()),
-			    static_cast<double>(m->y())/static_cast<double>(pmx.height()));
+	emit Coords(static_cast<double>(m->x()) / static_cast<double>(pmx.width()),
+			    static_cast<double>(m->y()) / static_cast<double>(pmx.height()));
 }
 
 void Navigator::mousePressEvent(QMouseEvent *m)
 {
 	drawMark(m->x(), m->y());
-	emit Coords(static_cast<double>(m->x())/static_cast<double>(pmx.width()),
-			    static_cast<double>(m->y())/static_cast<double>(pmx.height()));
+	emit Coords(static_cast<double>(m->x()) / static_cast<double>(pmx.width()),
+			    static_cast<double>(m->y()) / static_cast<double>(pmx.height()));
 }
 
 void Navigator::mouseReleaseEvent(QMouseEvent *m)
 {
-	emit Coords(static_cast<double>(m->x())/static_cast<double>(pmx.width()),
-			    static_cast<double>(m->y())/static_cast<double>(pmx.height()));
+	emit Coords(static_cast<double>(m->x()) / static_cast<double>(pmx.width()),
+			    static_cast<double>(m->y()) / static_cast<double>(pmx.height()));
 }
 
 void Navigator::paintEvent(QPaintEvent *e)
@@ -81,10 +81,10 @@
 	p.setClipRect(pmx.rect());
 	p.drawPixmap(0, 0, pmx);
 	p.setPen(QPen(QColor(Qt::black), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
-	p.drawLine(Xp-5, Yp-5, Xp-1, Yp-1);
-	p.drawLine(Xp-5, Yp+5, Xp-1, Yp+1);
-	p.drawLine(Xp+2, Yp+2, Xp+6, Yp+6);
-	p.drawLine(Xp+2, Yp-2, Xp+6, Yp-6);
+	p.drawLine(Xp - 5, Yp - 5, Xp - 1, Yp - 1);
+	p.drawLine(Xp - 5, Yp + 5, Xp - 1, Yp + 1);
+	p.drawLine(Xp + 2, Yp + 2, Xp + 6, Yp + 6);
+	p.drawLine(Xp + 2, Yp - 2, Xp + 6, Yp - 6);
 	p.end();
 }
 
@@ -95,23 +95,23 @@
 	repaint();
 }
 
-bool Navigator::SetSeite(int Seite, int Size, const QString& fn)
+bool Navigator::setPage(int pageNr, int size, const QString& fn)
 {
 	bool ret = false;
 	if (!fn.isEmpty())
 	{
-		QPixmap img = LoadPDF(fn, Seite, Size, &Width, &Height);
+		QPixmap img = loadPDF(fn, pageNr, size, &Width, &Height);
 		if (!img.isNull())
 		{
 			pmx = img;
 			ret = true;
 		}
 		else
-			pmx = LoadPDF(fn, 1, Size, &Width, &Height);
+			pmx = loadPDF(fn, 1, size, &Width, &Height);
 	}
 	else
 	{
-		pmx=QPixmap::fromImage(view->PageToPixmap(Seite, Size));
+		pmx = QPixmap::fromImage(m_view->PageToPixmap(pageNr, size));
 		ret = true;
 	}
 	resize(pmx.width(), pmx.height());

Modified: trunk/Scribus/scribus/navigator.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/navigator.h
==============================================================================
--- trunk/Scribus/scribus/navigator.h	(original)
+++ trunk/Scribus/scribus/navigator.h	Tue May 12 01:21:52 2020
@@ -42,21 +42,25 @@
 	Q_OBJECT
 
 public: 
-	Navigator(QWidget *parent, int Size, int Seite, ScribusView* vie, const QString& fn = "");
+	Navigator(QWidget *parent, int size, int pageNr, ScribusView* view, const QString& fn = "");
 	~Navigator() override {};
+
 	void mouseMoveEvent(QMouseEvent *m) override;
 	void mousePressEvent(QMouseEvent *m) override;
 	void mouseReleaseEvent(QMouseEvent *m) override;
 	void paintEvent(QPaintEvent *e) override;
 	void drawMark(int x, int y);
-	bool SetSeite(int Seite, int Size, const QString& fn = "");
+	bool setPage(int pageNr, int size, const QString& fn = QString());
+
 	int Xp;
 	int Yp;
 	int Width;
 	int Height;
-	ScribusView* view;
 	QPixmap pmx;
-	
+
+private:
+	ScribusView* m_view;
+
 signals:
 	void Coords(double x, double y);
 };

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Tue May 12 01:21:52 2020
@@ -8187,7 +8187,7 @@
 		int AnActType = currItem->annotation().ActionType();
 		QString AnAction = currItem->annotation().Action();
 		QString An_Extern = currItem->annotation().Extern();
-		Annota *dia = new Annota(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), view);
+		Annota *dia = new Annota(this, currItem, doc, view);
 		if (dia->exec())
 			slotDocCh();
 		else
@@ -8201,7 +8201,7 @@
 	}
 	else
 	{
-		ScAnnot *dia = new ScAnnot(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), doc->PageColors, view);
+		ScAnnot *dia = new ScAnnot(this, currItem, doc, view);
 		if (dia->exec())
 			slotDocCh();
 		delete dia;

Modified: trunk/Scribus/scribus/ui/annot.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/ui/annot.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annot.cpp	(original)
+++ trunk/Scribus/scribus/ui/annot.cpp	Tue May 12 01:21:52 2020
@@ -6,28 +6,28 @@
 */
 #include "annot.h"
 
+#include <QCheckBox>
+#include <QComboBox>
+#include <QDateTime>
+#include <QFrame>
+#include <QGroupBox>
 #include <QHBoxLayout>
 #include <QGridLayout>
 #include <QVBoxLayout>
-#include <QStackedWidget>
-#include <QGroupBox>
-#include <QTextEdit>
 #include <QLabel>
-#include <QFrame>
-#include <QComboBox>
 #include <QLineEdit>
-#include <QCheckBox>
+#include <QList>
+#include <QPixmap>
 #include <QPushButton>
 #include <QSpinBox>
 #include <QTabWidget>
+#include <QTextEdit>
+#include <QToolTip>
+#include <QRadioButton>
+#include <QSpacerItem>
+#include <QStackedWidget>
+#include <QStringList>
 #include <QWidget>
-#include <QRadioButton>
-#include <QList>
-#include <QStringList>
-#include <QSpacerItem>
-#include <QToolTip>
-#include <QDateTime>
-#include <QPixmap>
 
 #include "annotation.h"
 #include "buttonicon.h"
@@ -45,6 +45,7 @@
 #include "scfonts.h"
 #include "scimage.h"
 #include "scribusstructs.h"
+#include "scribusdoc.h"
 #include "scribusview.h"
 #include "selfield.h"
 #include "ui/customfdialog.h"
@@ -52,29 +53,29 @@
 #include "util.h"
 #include "util_formats.h"
 
-ScAnnot::ScAnnot(QWidget* parent, PageItem *it, int Seite, int b, int h, ColorList Farben, ScribusView* vie)
-		: QDialog( parent )
-{
+ScAnnot::ScAnnot(QWidget* parent, PageItem *it, ScribusDoc* doc, ScribusView* view) : QDialog(parent),
+	m_item(it),
+	m_doc(doc),
+	m_view(view)
+{
+	m_prefsCtxt = PrefsManager::instance().prefsFile->getContext("dirs");
 	m_annotation = it->annotation();
 
 	setupUi(this);
 	setModal(true);
 	setWindowTitle( tr( "Field Properties" ) );
 	setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
-	item = it;
-	Width = b;
-	Height = h;
-	OriWidth = b;
-	OriHeight = h;
-	view = vie;
-	MaxSeite = Seite;
+
+	Width = static_cast<int>(m_doc->pageWidth());
+	Height = static_cast<int>(m_doc->pageHeight());
+	OriWidth = static_cast<int>(m_doc->pageWidth());
+	OriHeight = static_cast<int>(m_doc->pageHeight());
+	MaxPages = m_doc->DocPages.count();
+
 	QStringList tl;
-	dirs = PrefsManager::instance().prefsFile->getContext("dirs");
-
-	Annotation& annotation = m_annotation;
-	if ((annotation.ActionType() == Annotation::Action_GoTo) || (annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (annotation.ActionType() == Annotation::Action_GoToR_FileAbs))
-	{
-		QString tm = annotation.Action();
+	if ((m_annotation.ActionType() == Annotation::Action_GoTo) || (m_annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (m_annotation.ActionType() == Annotation::Action_GoToR_FileAbs))
+	{
+		QString tm = m_annotation.Action();
 		tl = tm.split(" ", QString::SkipEmptyParts);
 	}
 	else
@@ -83,56 +84,56 @@
 		tl.append("0");
 	}
 
-	if (annotation.Type() != Annotation::RadioButton)
-		ComboBox1->setCurrentIndex(annotation.Type()-2);
+	if (m_annotation.Type() != Annotation::RadioButton)
+		ComboBox1->setCurrentIndex(m_annotation.Type() - 2);
 	else
 		ComboBox1->setCurrentIndex(5);
 
 	PropertiesGroup->layout()->setAlignment(Qt::AlignTop);
 
-	Tip->setText(annotation.ToolTip());
-	Name->setText(item->itemName());
-	OldName = item->itemName();
+	Tip->setText(m_annotation.ToolTip());
+	Name->setText(m_item->itemName());
+	OldName = m_item->itemName();
 
 	TextGroup->layout()->setAlignment(Qt::AlignTop);
-	Schrift->setCurrentIndex(annotation.Font());
+	Schrift->setCurrentIndex(m_annotation.Font());
 
 	BorderGroup->layout()->setAlignment(Qt::AlignTop);
 
 	ColorList::Iterator cit;
 	BorderC->setPixmapType(ColorCombo::fancyPixmaps);
-	BorderC->setColors(Farben, true);
-	if (annotation.borderColor() == CommonStrings::None)
+	BorderC->setColors(m_doc->PageColors, true);
+	if (m_annotation.borderColor() == CommonStrings::None)
 		BorderC->setCurrentIndex(0);
 	else
-		BorderC->setCurrentText(annotation.borderColor());
+		BorderC->setCurrentText(m_annotation.borderColor());
 
 	// PFJ - 28/02/04 - Altered to the QString/size_t/for style
-	QString borders[] = {CommonStrings::tr_NoneColor, tr("Thin"), tr("Normal"), tr("Wide")};
+	QString borders[] = { CommonStrings::tr_NoneColor, tr("Thin"), tr("Normal"), tr("Wide") };
 	size_t bordersArray = sizeof(borders) / sizeof(*borders);
 	BorderW->clear();
 	for (uint propagate = 0; propagate < bordersArray; ++propagate)
 		BorderW->addItem(borders[propagate]);
-	BorderW->setCurrentIndex(annotation.borderWidth());
-
-	BorderS->setCurrentIndex(annotation.borderStyle());
+	BorderW->setCurrentIndex(m_annotation.borderWidth());
+
+	BorderS->setCurrentIndex(m_annotation.borderStyle());
 
 	OtherGroup->layout()->setAlignment(Qt::AlignTop);
 
-	ReadOnly->setEnabled(annotation.Type() != Annotation::Button);
-	ReadOnly->setChecked(annotation.Flag() & Annotation::Flag_ReadOnly);
-	Required->setEnabled(annotation.Type() != Annotation::Button);
-	Required->setChecked(annotation.Flag() & Annotation::Flag_Required);
-	NoExport->setEnabled(annotation.Type() != Annotation::Button);
-	NoExport->setChecked(annotation.Flag() & Annotation::Flag_NoExport);
-	Visib->setCurrentIndex(annotation.Vis());
+	ReadOnly->setEnabled(m_annotation.Type() != Annotation::Button);
+	ReadOnly->setChecked(m_annotation.Flag() & Annotation::Flag_ReadOnly);
+	Required->setEnabled(m_annotation.Type() != Annotation::Button);
+	Required->setChecked(m_annotation.Flag() & Annotation::Flag_Required);
+	NoExport->setEnabled(m_annotation.Type() != Annotation::Button);
+	NoExport->setChecked(m_annotation.Flag() & Annotation::Flag_NoExport);
+	Visib->setCurrentIndex(m_annotation.Vis());
 
 	TextOptionGroup->layout()->setAlignment(Qt::AlignTop);
-	DownT->setText(annotation.Down());
-	TextO->setText(annotation.RollOver());
+	DownT->setText(m_annotation.Down());
+	TextO->setText(m_annotation.RollOver());
 
 	IconOptionGroup->layout()->setAlignment(Qt::AlignTop);
-	UseIcons->setChecked(annotation.UseIcons());
+	UseIcons->setChecked(m_annotation.UseIcons());
 	IconNR->setEnabled(false);
 	IconPR->setEnabled(false);
 	IconRR->setEnabled(false);
@@ -150,25 +151,25 @@
 	{
 		QPixmap pmI1;
 		ScImage im;
-		CMSettings cms(view->m_doc, "", Intent_Perceptual);
+		CMSettings cms(m_view->m_doc, "", Intent_Perceptual);
 		cms.allowColorManagement(false);
-		if (!item->Pfile.isEmpty())
-		{
-			im.loadPicture(item->Pfile, 1, cms, ScImage::RGBData, 72);
+		if (!m_item->Pfile.isEmpty())
+		{
+			im.loadPicture(m_item->Pfile, 1, cms, ScImage::RGBData, 72);
 			pmI1=QPixmap::fromImage(im.qImage());
 			NiconPrev->setPixmap(pmI1);
 			IconNR->setEnabled(true);
 		}
-		if (!item->Pfile2.isEmpty())
-		{
-			im.loadPicture(item->Pfile2, 1, cms, ScImage::RGBData, 72);
+		if (!m_item->Pfile2.isEmpty())
+		{
+			im.loadPicture(m_item->Pfile2, 1, cms, ScImage::RGBData, 72);
 			pmI1=QPixmap::fromImage(im.qImage());
 			PiconPrev->setPixmap(pmI1);
 			IconPR->setEnabled(true);
 		}
-		if (!item->Pfile3.isEmpty())
-		{
-			im.loadPicture(item->Pfile3, 1, cms, ScImage::RGBData, 72);
+		if (!m_item->Pfile3.isEmpty())
+		{
+			im.loadPicture(m_item->Pfile3, 1, cms, ScImage::RGBData, 72);
 			pmI1=QPixmap::fromImage(im.qImage());
 			RiconPrev->setPixmap(pmI1);
 			IconRR->setEnabled(true);
@@ -176,26 +177,26 @@
 	}
 
 	HighlightOptionGroup->layout()->setAlignment(Qt::AlignTop);
-	ComboBox7_2->setCurrentIndex(annotation.Feed());
-
-	MultiL->setChecked(annotation.Flag() & Annotation::Flag_Multiline);
-	Passwd->setChecked(annotation.Flag() & Annotation::Flag_Password);
+	ComboBox7_2->setCurrentIndex(m_annotation.Feed());
+
+	MultiL->setChecked(m_annotation.Flag() & Annotation::Flag_Multiline);
+	Passwd->setChecked(m_annotation.Flag() & Annotation::Flag_Password);
 	MaxChars->setMinimum(0);
 	MaxChars->setMaximum(32768);
-	bool setter = annotation.MaxChar() != -1;
-	MaxChars->setValue(setter ? annotation.MaxChar() : 0);
+	bool setter = m_annotation.MaxChar() != -1;
+	MaxChars->setValue(setter ? m_annotation.MaxChar() : 0);
 	Limit->setChecked(setter);
 	MaxChars->setEnabled(setter);
-	NoScroll->setChecked(annotation.Flag() & Annotation::Flag_DoNotScroll);
-	NoSpell->setChecked(annotation.Flag() & Annotation::Flag_DoNotSpellCheck);
-
-	ChkStil->setCurrentIndex(annotation.ChkStil());
-	isChkd->setChecked(annotation.IsChk());
-
-	CanEdit->setChecked(annotation.Flag() & Annotation::Flag_Edit);
-
-	int tmpac = annotation.ActionType();
-	if (annotation.ActionType() < 0)
+	NoScroll->setChecked(m_annotation.Flag() & Annotation::Flag_DoNotScroll);
+	NoSpell->setChecked(m_annotation.Flag() & Annotation::Flag_DoNotSpellCheck);
+
+	ChkStil->setCurrentIndex(m_annotation.ChkStil());
+	isChkd->setChecked(m_annotation.IsChk());
+
+	CanEdit->setChecked(m_annotation.Flag() & Annotation::Flag_Edit);
+
+	int tmpac = m_annotation.ActionType();
+	if (m_annotation.ActionType() < 0)
 		tmpac = 1;
 	if ((tmpac == 7) || (tmpac == 9))
 		tmpac = 2;
@@ -205,8 +206,8 @@
 
 	QPalette palTxt = EditJava->palette();
 	palTxt.setColor(QPalette::Base, palette().color(QPalette::Window));
-	if ((annotation.ActionType() == Annotation::Action_JavaScript) || (annotation.AAact()))
-		EditJava->setPlainText(annotation.Action());
+	if ((m_annotation.ActionType() == Annotation::Action_JavaScript) || (m_annotation.AAact()))
+		EditJava->setPlainText(m_annotation.Action());
 	ScrEdited = Annotation::Java_ReleaseButton;
 	SelAction->setCurrentIndex(0);
 	EditJava->setReadOnly(true);
@@ -216,36 +217,36 @@
 	EditJava->setFocusPolicy(Qt::NoFocus);
 
 	GroupBoxDestination->layout()->setAlignment(Qt::AlignTop);
-	Destfile->setText(annotation.Extern());
+	Destfile->setText(m_annotation.Extern());
 	Destfile->setReadOnly(true);
-	if (annotation.ActionType() == Annotation::Action_GoToR_FileRel)
+	if (m_annotation.ActionType() == Annotation::Action_GoToR_FileRel)
 		useAbsolute->setChecked(false);
-	else if (annotation.ActionType() == Annotation::Action_GoToR_FileAbs)
+	else if (m_annotation.ActionType() == Annotation::Action_GoToR_FileAbs)
 		useAbsolute->setChecked(true);
 	SpinBox11->setMinimum(1);
-	SpinBox11->setMaximum(((annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (annotation.ActionType() == Annotation::Action_GoToR_FileAbs)) ? 1000 : Seite);
-	SpinBox11->setValue(qMin(annotation.Ziel()+1, Seite));
-
-	if ((annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (annotation.ActionType() == Annotation::Action_GoToR_FileAbs))
-		Pg1 = new Navigator( GroupBoxDestination, 100, annotation.Ziel()+1, view, annotation.Extern());
+	SpinBox11->setMaximum(((m_annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (m_annotation.ActionType() == Annotation::Action_GoToR_FileAbs)) ? 1000 : MaxPages);
+	SpinBox11->setValue(qMin(m_annotation.Ziel() + 1, MaxPages));
+
+	if ((m_annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (m_annotation.ActionType() == Annotation::Action_GoToR_FileAbs))
+		m_navig = new Navigator( GroupBoxDestination, 100, m_annotation.Ziel()+1, m_view, m_annotation.Extern());
 	else
-		Pg1 = new Navigator( GroupBoxDestination, 100, qMin(annotation.Ziel(), Seite-1), view);
-	Pg1->setMinimumSize(QSize(Pg1->pmx.width(), Pg1->pmx.height()));
-	GroupBoxDestinationLayout->addWidget(Pg1, 2, 2, 3, 1);
+		m_navig = new Navigator( GroupBoxDestination, 100, qMin(m_annotation.Ziel(), MaxPages - 1), m_view);
+	m_navig->setMinimumSize(QSize(m_navig->pmx.width(), m_navig->pmx.height()));
+	GroupBoxDestinationLayout->addWidget(m_navig, 2, 2, 3, 1);
 
 	SpinBox21->setSuffix( tr( " pt" ) );
 	SpinBox21->setMaximum(Width);
 	SpinBox21->setValue(tl[0].toInt());
 	SpinBox31->setMaximum(Height);
 	SpinBox31->setSuffix( tr( " pt" ) );
-	SpinBox31->setValue(Height-tl[1].toInt());
-
-	if (annotation.ActionType() == Annotation::Action_SubmitForm)
-		SubURL->setText(annotation.Action());
-	SelAsHtml->setCurrentIndex(annotation.HTML());
-
-	if (annotation.ActionType() == Annotation::Action_ImportData)
-		SubURLa->setText(annotation.Action());
+	SpinBox31->setValue(Height - tl[1].toInt());
+
+	if (m_annotation.ActionType() == Annotation::Action_SubmitForm)
+		SubURL->setText(m_annotation.Action());
+	SelAsHtml->setCurrentIndex(m_annotation.HTML());
+
+	if (m_annotation.ActionType() == Annotation::Action_ImportData)
+		SubURLa->setText(m_annotation.Action());
 
 	nameActionCombo->addItem( tr("First Page"), QString("FirstPage"));
 	nameActionCombo->addItem( tr("Previous Page"), QString("PrevPage"));
@@ -300,13 +301,13 @@
 	nameActionCombo->addItem( tr("Show/Hide Model Tree"), QString("ShowHideModelTree"));
 	nameActionCombo->addItem( tr("Show/Hide Signatures"), QString("ShowHideSignatures"));
 
-	if ((annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (annotation.ActionType() == Annotation::Action_GoToR_FileAbs))
+	if ((m_annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (m_annotation.ActionType() == Annotation::Action_GoToR_FileAbs))
 	{
 		LExtern->setChecked(true);
 		if (!Destfile->text().isEmpty())
 		{
-			Width = Pg1->Width;
-			Height = Pg1->Height;
+			Width = m_navig->Width;
+			Height = m_navig->Height;
 		}
 		else
 		{
@@ -323,7 +324,7 @@
 	}
 
 	// Format tab settings
-	TxFormat->setCurrentIndex(annotation.Format());
+	TxFormat->setCurrentIndex(m_annotation.Format());
 
 	NumbGroup->layout()->setAlignment( Qt::AlignTop );
 	Decim->setMinimum(0);
@@ -342,24 +343,24 @@
 
 	GroupCust->layout()->setAlignment(Qt::AlignTop);
 	EditFormat->setAutoDefault(false);
-	if (annotation.Format() != 5)
+	if (m_annotation.Format() != 5)
 		EditFormat->setEnabled( false );
-	if (annotation.Format() == 5)
-		FormatScript->setPlainText( annotation.F_act() );
+	if (m_annotation.Format() == 5)
+		FormatScript->setPlainText( m_annotation.F_act() );
 	FormatScript->setReadOnly(true);
 	FormatScript->setAutoFillBackground(true);
 	FormatScript->setPalette(palTxt);
 	FormatScript->setMaximumSize(QSize(32000,50));
 	FormatScript->setFocusPolicy(Qt::NoFocus);
 	EditKeystr->setAutoDefault( false );
-	if (annotation.Format() != 5)
+	if (m_annotation.Format() != 5)
 		EditKeystr->setEnabled( false );
-	if (annotation.Format() == 5)
-		KeyScript->setPlainText( annotation.K_act() );
+	if (m_annotation.Format() == 5)
+		KeyScript->setPlainText( m_annotation.K_act() );
 	KeyScript->setReadOnly(true);
 	KeyScript->setAutoFillBackground(true);
 	KeyScript->setPalette(palTxt);
-	KeyScript->setMaximumSize(QSize(32000,50));
+	KeyScript->setMaximumSize(QSize(32000, 50));
 	KeyScript->setFocusPolicy(Qt::NoFocus);
 
 	DecodeNum();
@@ -390,10 +391,10 @@
 	TabWidget2->setTabEnabled(TabWidget2->indexOf(tabCalculate), false);
 	SetCalc();
 
-	if (annotation.Type() == Annotation::RadioButton)
+	if (m_annotation.Type() == Annotation::RadioButton)
 		SetAnnotationType(5);
 	else
-		SetAnnotationType(annotation.Type()-2);
+		SetAnnotationType(m_annotation.Type()-2);
 
 	PushButton1->setDefault( true );
 
@@ -410,7 +411,7 @@
 	connect(ComboBox1, SIGNAL(activated(int)), this, SLOT(SetAnnotationType(int)));
 	connect(ActionCombo, SIGNAL(activated(int)), this, SLOT(SetActionType(int)));
 	connect(SelAction, SIGNAL(activated(int)), this, SLOT(SetActionScript(int)));
-	connect(Pg1, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
+	connect(m_navig, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
 	connect(SpinBox11, SIGNAL(valueChanged(int)), this, SLOT(SetPage(int)));
 	connect(SpinBox21, SIGNAL(valueChanged(int)), this, SLOT(SetCross()));
 	connect(SpinBox31, SIGNAL(valueChanged(int)), this, SLOT(SetCross()));
@@ -451,7 +452,7 @@
 	CalcFields->setToolTip( tr( "Enter a comma separated list of fields here" ) );
 	IconNR->setToolTip( tr("You need at least the Icon for Normal to use Icons for Buttons"));
 
-	SetPage(qMin(SpinBox11->value(), MaxSeite));
+	SetPage(qMin(SpinBox11->value(), MaxPages));
 	SetCross();
 	//resize( minimumSizeHint() );
 }
@@ -469,17 +470,17 @@
 	}
 	bool found = false;
 	QList<PageItem*> allItems;
-	for (int a = 0; a < view->m_doc->Items->count(); ++a)
-	{
-		PageItem *currItem = view->m_doc->Items->at(a);
+	for (int i = 0; i < m_view->m_doc->Items->count(); ++i)
+	{
+		PageItem *currItem = m_view->m_doc->Items->at(i);
 		if (currItem->isGroup())
 			allItems = currItem->getAllChildren();
 		else
 			allItems.append(currItem);
-		for (int ii = 0; ii < allItems.count(); ii++)
-		{
-			PageItem* ite = allItems.at(ii);
-			if ((NameNew == ite->itemName()) && (ite != item))
+		for (int j = 0; j < allItems.count(); j++)
+		{
+			PageItem* ite = allItems.at(j);
+			if ((NameNew == ite->itemName()) && (ite != m_item))
 			{
 				found = true;
 				break;
@@ -496,31 +497,28 @@
 
 void ScAnnot::IPlace()
 {
-	ButtonIcon* dia = new ButtonIcon(this, item);
+	ButtonIcon* dia = new ButtonIcon(this, m_item);
 	if (dia->exec())
 	{
-		int w = item->pixm.width();
-		int h = item->pixm.height();
-		double sw = item->width() / w;
-		double sh = item->height() / h;
+		int w = m_item->pixm.width();
+		int h = m_item->pixm.height();
+		double sw = m_item->width() / w;
+		double sh = m_item->height() / h;
 		double sc = qMin(sw, sh);
 		if (dia->IcScaleH == 3)
 		{
-			item->setImageXYScale(1.0, 1.0);
-			item->setImageXYOffset((item->width()-w)*dia->IcPlaceX, (item->height()-h)*dia->IcPlaceY);
+			m_item->setImageXYScale(1.0, 1.0);
+			m_item->setImageXYOffset((m_item->width() - w) * dia->IcPlaceX, (m_item->height() - h) * dia->IcPlaceY);
+		}
+		else if (dia->ScaleH->currentIndex() == 0)
+		{
+			m_item->setImageXYScale(sc, sc);
+			m_item->setImageXYOffset(((m_item->width() - w * sc) / sc) / 2.0 / sc, ((m_item->height() - h * sc) / sc) / 2.0 / sc);
 		}
 		else
 		{
-			if (dia->ScaleH->currentIndex() == 0)
-			{
-				item->setImageXYScale(sc, sc);
-				item->setImageXYOffset(((item->width()-w*sc)/sc)/2.0/ sc, ((item->height()-h*sc)/sc)/2.0/sc);
-			}
-			else
-			{
-				item->setImageXYScale(sw, sh);
-				item->setImageXYOffset(0.0, 0.0);
-			}
+			m_item->setImageXYScale(sw, sh);
+			m_item->setImageXYOffset(0.0, 0.0);
 		}
 		m_annotation.setIPlace(dia->Place->currentIndex());
 		m_annotation.setScaleW(dia->ScaleW->currentIndex());
@@ -531,22 +529,22 @@
 void ScAnnot::RemoveNIcon()
 {
 	NiconPrev->clear();
-	item->Pfile = "";
-	item->imageIsAvailable = false;
+	m_item->Pfile.clear();
+	m_item->imageIsAvailable = false;
 	IconNR->setEnabled(false);
 }
 
 void ScAnnot::RemovePIcon()
 {
 	PiconPrev->clear();
-	item->Pfile2 = "";
+	m_item->Pfile2.clear();
 	IconPR->setEnabled(false);
 }
 
 void ScAnnot::RemoveRIcon()
 {
 	RiconPrev->clear();
-	item->Pfile3 = "";
+	m_item->Pfile3.clear();
 	IconRR->setEnabled(false);
 }
 
@@ -561,16 +559,16 @@
 	PiconPrev->setEnabled(setter);
 	RiconPrev->setEnabled(setter);
 	PlaceIcon->setEnabled(setter);
-	IconNR->setEnabled(!item->Pfile.isEmpty());
-	IconPR->setEnabled(!item->Pfile2.isEmpty());
-	IconRR->setEnabled(!item->Pfile3.isEmpty());
+	IconNR->setEnabled(!m_item->Pfile.isEmpty());
+	IconPR->setEnabled(!m_item->Pfile2.isEmpty());
+	IconRR->setEnabled(!m_item->Pfile3.isEmpty());
 	m_annotation.setUseIcons(UseIcons->isChecked());
 }
 
 void ScAnnot::GetNIcon()
 {
 	QString fileName;
-	QString wdir = dirs->get("icon", ".");
+	QString wdir = m_prefsCtxt->get("icon", ".");
 	CustomFDialog dia(this, wdir, tr("Open"),
 					  tr("Images (*.tif *.png *.jpg *.xpm);;%1;;All Files (*)").arg(FormatsManager::instance()->extensionsForFormat(FormatsManager::EPS)), fdShowPreview | fdExistingFiles);
 	if (dia.exec() == QDialog::Accepted)
@@ -579,22 +577,22 @@
 		return;
 	if (!fileName.isEmpty())
 	{
-		dirs->set("icon", fileName.left(fileName.lastIndexOf("/")));
+		m_prefsCtxt->set("icon", fileName.left(fileName.lastIndexOf("/")));
 		QPixmap pmI1;
-		CMSettings cms(view->m_doc, "", Intent_Perceptual);
+		CMSettings cms(m_view->m_doc, "", Intent_Perceptual);
 		cms.allowColorManagement(false);
-		item->pixm.loadPicture(fileName, 1, cms, ScImage::RGBData, 72);
-		pmI1=QPixmap::fromImage(item->pixm.qImage());
+		m_item->pixm.loadPicture(fileName, 1, cms, ScImage::RGBData, 72);
+		pmI1=QPixmap::fromImage(m_item->pixm.qImage());
 		NiconPrev->setPixmap(pmI1);
-		item->Pfile = fileName;
-		item->imageIsAvailable = true;
-		int w = item->pixm.width();
-		int h = item->pixm.height();
-		double sw = item->width() / w;
-		double sh = item->height() / h;
+		m_item->Pfile = fileName;
+		m_item->imageIsAvailable = true;
+		int w = m_item->pixm.width();
+		int h = m_item->pixm.height();
+		double sw = m_item->width() / w;
+		double sh = m_item->height() / h;
 		double sc = qMin(sw,sh);
-		item->setImageXYScale(sc, sc);
-		item->setImageXYOffset(((item->width()-(w*sc))/2)/sc, ((item->height()-(h*sc))/2)/sc);
+		m_item->setImageXYScale(sc, sc);
+		m_item->setImageXYOffset(((m_item->width() - (w * sc)) / 2) / sc, ((m_item->height() - (h * sc)) / 2) / sc);
 		IconNR->setEnabled(true);
 	}
 }
@@ -602,7 +600,7 @@
 void ScAnnot::GetPIcon()
 {
 	QString fileName;
-	QString wdir = dirs->get("icon", ".");
+	QString wdir = m_prefsCtxt->get("icon", ".");
 	CustomFDialog dia(this, wdir, tr("Open"),
 	                  tr("Images (*.tif *.png *.jpg *.xpm);;PostScript (*.eps *.epsi);;All Files (*)"), fdShowPreview | fdExistingFiles);
 	if (dia.exec() == QDialog::Accepted)
@@ -611,15 +609,15 @@
 		return;
 	if (!fileName.isEmpty())
 	{
-		dirs->set("icon", fileName.left(fileName.lastIndexOf("/")));
+		m_prefsCtxt->set("icon", fileName.left(fileName.lastIndexOf("/")));
 		QPixmap pmI1;
 		ScImage im;
-		CMSettings cms(view->m_doc, "", Intent_Perceptual);
+		CMSettings cms(m_view->m_doc, "", Intent_Perceptual);
 		cms.allowColorManagement(false);
 		im.loadPicture(fileName, 1, cms, ScImage::RGBData, 72);
-		pmI1=QPixmap::fromImage(im.qImage());
+		pmI1 = QPixmap::fromImage(im.qImage());
 		PiconPrev->setPixmap(pmI1);
-		item->Pfile2 = fileName;
+		m_item->Pfile2 = fileName;
 		IconPR->setEnabled(true);
 	}
 }
@@ -627,7 +625,7 @@
 void ScAnnot::GetRIcon()
 {
 	QString fileName;
-	QString wdir = dirs->get("icon", ".");
+	QString wdir = m_prefsCtxt->get("icon", ".");
 	CustomFDialog dia(this, wdir, tr("Open"),
 	                  tr("Images (*.tif *.png *.jpg *.xpm);;PostScript (*.eps *.epsi);;All Files (*)"), fdShowPreview | fdExistingFiles);
 	if (dia.exec() == QDialog::Accepted)
@@ -636,22 +634,22 @@
 		return;
 	if (!fileName.isEmpty())
 	{
-		dirs->set("icon", fileName.left(fileName.lastIndexOf("/")));
+		m_prefsCtxt->set("icon", fileName.left(fileName.lastIndexOf("/")));
 		QPixmap pmI1;
 		ScImage im;
-		CMSettings cms(view->m_doc, "", Intent_Perceptual);
+		CMSettings cms(m_view->m_doc, "", Intent_Perceptual);
 		cms.allowColorManagement(false);
 		im.loadPicture(fileName, 1, cms, ScImage::RGBData, 72);
-		pmI1=QPixmap::fromImage(im.qImage());
+		pmI1 = QPixmap::fromImage(im.qImage());
 		RiconPrev->setPixmap(pmI1);
-		item->Pfile3 = fileName;
+		m_item->Pfile3 = fileName;
 		IconRR->setEnabled(true);
 	}
 }
 
 void ScAnnot::SelectFelder()
 {
-	SelectFields* dia = new SelectFields(this, CalcFields->text(), item->itemName(), view->m_doc, 3);
+	SelectFields* dia = new SelectFields(this, CalcFields->text(), m_item->itemName(), m_view->m_doc, 3);
 	if (dia->exec())
 		CalcFields->setText(dia->S_Fields);
 	delete dia;
@@ -659,7 +657,7 @@
 
 void ScAnnot::editKeySc()
 {
-	Editor* dia = new Editor(this, m_annotation.K_act(), view);
+	Editor* dia = new Editor(this, m_annotation.K_act(), m_view);
 	if (dia->exec())
 	{
 		m_annotation.setK_act(dia->EditTex->toPlainText());
@@ -670,7 +668,7 @@
 
 void ScAnnot::editFormatSc()
 {
-	Editor* dia = new Editor(this, m_annotation.F_act(), view);
+	Editor* dia = new Editor(this, m_annotation.F_act(), m_view);
 	if (dia->exec())
 	{
 		m_annotation.setF_act(dia->EditTex->toPlainText());
@@ -681,7 +679,7 @@
 
 void ScAnnot::editValidSc()
 {
-	Editor* dia = new Editor(this, m_annotation.V_act(), view);
+	Editor* dia = new Editor(this, m_annotation.V_act(), m_view);
 	if (dia->exec())
 	{
 		m_annotation.setV_act(dia->EditTex->toPlainText());
@@ -692,7 +690,7 @@
 
 void ScAnnot::editCalcSc()
 {
-	Editor* dia = new Editor(this, m_annotation.C_act(), view);
+	Editor* dia = new Editor(this, m_annotation.C_act(), m_view);
 	if (dia->exec())
 	{
 		m_annotation.setC_act(dia->EditTex->toPlainText());
@@ -703,7 +701,7 @@
 
 void ScAnnot::editJavaSc()
 {
-	Editor* dia = new Editor(this, EditJava->toPlainText(), view);
+	Editor* dia = new Editor(this, EditJava->toPlainText(), m_view);
 	if (dia->exec())
 		EditJava->setPlainText(dia->EditTex->toPlainText());
 	delete dia;
@@ -1045,19 +1043,19 @@
 	disconnect(SpinBox11, SIGNAL(valueChanged(int)), this, SLOT(SetPage(int)));
 	if ((m_annotation.ActionType() == Annotation::Action_GoToR_FileRel) || (m_annotation.ActionType() == 9))
 	{
-		if (!Pg1->SetSeite(v, 100, Destfile->text()))
+		if (!m_navig->setPage(v, 100, Destfile->text()))
 		{
 			SpinBox11->setValue(1);
-			Pg1->SetSeite(1, 100, Destfile->text());
-		}
-		Width = Pg1->Width;
-		Height = Pg1->Height;
+			m_navig->setPage(1, 100, Destfile->text());
+		}
+		Width = m_navig->Width;
+		Height = m_navig->Height;
 		//		SetCoords(0,0);
 	}
 	else
 	{
-		Pg1->SetSeite(qMin(v-1, MaxSeite-1), 100);
-		SpinBox11->setValue(qMin(v, MaxSeite));
+		m_navig->setPage(qMin(v-1, MaxPages - 1), 100);
+		SpinBox11->setValue(qMin(v, MaxPages));
 		Width = OriWidth;
 		Height = OriHeight;
 		//		SetCoords(0,0);
@@ -1069,12 +1067,12 @@
 
 void ScAnnot::SetCross()
 {
-	int x,y;
-	disconnect(Pg1, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
-	x = static_cast<int>(static_cast<double>(SpinBox21->value())/static_cast<double>(Width)*Pg1->pmx.width());
-	y = static_cast<int>(static_cast<double>(SpinBox31->value())/static_cast<double>(Height)*Pg1->pmx.height());
-	Pg1->drawMark(x, y);
-	connect(Pg1, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
+	int x, y;
+	disconnect(m_navig, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
+	x = static_cast<int>(static_cast<double>(SpinBox21->value()) / static_cast<double>(Width) * m_navig->pmx.width());
+	y = static_cast<int>(static_cast<double>(SpinBox31->value()) / static_cast<double>(Height) * m_navig->pmx.height());
+	m_navig->drawMark(x, y);
+	connect(m_navig, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
 }
 
 void ScAnnot::SetValues()
@@ -1083,7 +1081,7 @@
 	QString tmp, tmp2;
 	QString Nfo("");
 	
-	Annotation& annotation = item->annotation();
+	Annotation& annotation = m_item->annotation();
 	annotation = m_annotation;
 
 	if (ComboBox1->currentIndex() == 5)
@@ -1091,7 +1089,7 @@
 	else
 		annotation.setType(ComboBox1->currentIndex()+2);
 	if (Name->text() != OldName)
-		item->setItemName(Name->text());
+		m_item->setItemName(Name->text());
 	annotation.setToolTip(Tip->text());
 	annotation.setRollOver(TextO->text());
 	annotation.setDown(DownT->text());
@@ -1111,7 +1109,7 @@
 	if (annotation.Type() == Annotation::Button)
 	{
 		annotation.addToFlag(Annotation::Flag_PushButton);
-		if (item->Pfile.isEmpty())
+		if (m_item->Pfile.isEmpty())
 			annotation.setUseIcons(false);
 		annotation.setFormat(0);
 		annotation.setF_act(QString());
@@ -1469,7 +1467,7 @@
 		enable = false;
 		//		Destfile->setEnabled(false);
 		//		ChFile->setEnabled(false);
-		SetPage(qMin(SpinBox11->value(), MaxSeite));
+		SetPage(qMin(SpinBox11->value(), MaxPages));
 	}
 	else
 	{
@@ -1492,7 +1490,7 @@
 				LExtern->setChecked(false);
 			}
 		}
-		SetPage(qMin(SpinBox11->value(), MaxSeite));
+		SetPage(qMin(SpinBox11->value(), MaxPages));
 	}
 	Destfile->setEnabled(enable);
 	ChFile->setEnabled(enable);
@@ -1526,7 +1524,7 @@
 		setter = (m_annotation.ActionType() != Annotation::Action_GoToR_FileRel);
 		Destfile->setEnabled(setter);
 		ChFile->setEnabled(setter);
-		SetPage(qMin(SpinBox11->value(), MaxSeite));
+		SetPage(qMin(SpinBox11->value(), MaxPages));
 		break;
 	case 1:
 		Fram2->setCurrentIndex(1);
@@ -1594,21 +1592,19 @@
 
 void ScAnnot::GetFile()
 {
-	QString fn;
-	QString wdir = dirs->get("annot_getfile", ".");
+	QString wdir = m_prefsCtxt->get("annot_getfile", ".");
 	CustomFDialog dia(this, wdir, tr("Open"), tr("PDF Files (*.pdf);;All Files (*)"));
 	if (!Destfile->text().isEmpty())
 		dia.setSelection(Destfile->text());
-	if (dia.exec() == QDialog::Accepted)
-	{
-		fn = dia.selectedFile();
-		if (!fn.isEmpty())
-		{
-			dirs->set("annot_getfile", fn.left(fn.lastIndexOf("/")));
-			Destfile->setText(fn);
-			SpinBox11->setValue(1);
-			SpinBox11->setMaximum(1000);
-			SetPage(1);
-		}
-	}
-}
+	if (dia.exec() != QDialog::Accepted)
+		return;
+
+	QString fn = dia.selectedFile();
+	if (fn.isEmpty())
+		return;
+	m_prefsCtxt->set("annot_getfile", fn.left(fn.lastIndexOf("/")));
+	Destfile->setText(fn);
+	SpinBox11->setValue(1);
+	SpinBox11->setMaximum(1000);
+	SetPage(1);
+}

Modified: trunk/Scribus/scribus/ui/annot.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/ui/annot.h
==============================================================================
--- trunk/Scribus/scribus/ui/annot.h	(original)
+++ trunk/Scribus/scribus/ui/annot.h	Tue May 12 01:21:52 2020
@@ -16,9 +16,10 @@
 
 #include "ui_annot.h"
 
+class ColorCombo;
+class Navigator;
 class PageItem;
-class Navigator;
-class ColorCombo;
+class ScribusDoc;
 class ScribusView;
 class PrefsContext;
 
@@ -27,17 +28,13 @@
 	Q_OBJECT
 
 public:
-	ScAnnot ( QWidget* parent, PageItem *it, int Seite, int b, int h, ColorList Farben, ScribusView* vie );
+	ScAnnot(QWidget* parent, PageItem *it, ScribusDoc* doc, ScribusView* view);
 	~ScAnnot();
 
 	void DecodeNum();
 	void DecodeVali();
 	void DecodeCalc();
 
-	Navigator* Pg1;
-
-	PageItem* item;
-	ScribusView* view;
 	int Width;
 	int Height;
 	int OriWidth;
@@ -45,7 +42,7 @@
 	int ScrEdited;
 	int FormNum;
 	QString JavaScr;
-	int MaxSeite;
+	int MaxPages;
 	QString OldName;
 
 public slots:
@@ -84,7 +81,12 @@
 	void SetExternLink();
 
 protected:
-	PrefsContext* dirs;
+	Navigator* m_navig { nullptr };
+	PageItem* m_item { nullptr };
+	ScribusDoc* m_doc { nullptr };
+	ScribusView* m_view { nullptr };
+
+	PrefsContext* m_prefsCtxt{ nullptr };
 	Annotation m_annotation;
 };
 

Modified: trunk/Scribus/scribus/ui/annota.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/ui/annota.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annota.cpp	(original)
+++ trunk/Scribus/scribus/ui/annota.cpp	Tue May 12 01:21:52 2020
@@ -13,48 +13,55 @@
  *                                                                         *
  ***************************************************************************/
 
+
+#include <QCheckBox>
+#include <QComboBox>
+#include <QFrame>
+#include <QGridLayout>
+#include <QGroupBox>
 #include <QHBoxLayout>
-#include <QGridLayout>
 #include <QVBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QPixmap>
+#include <QPushButton>
+#include <QSignalBlocker>
 #include <QSpacerItem>
-#include <QFrame>
-#include <QLabel>
-#include <QComboBox>
 #include <QStackedWidget>
-#include <QGroupBox>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QPixmap>
 #include <QStringList>
-#include <QCheckBox>
-
-#include "scfonts.h"
+
 #include "annota.h"
-#include "ui/customfdialog.h"
+#include "commonstrings.h"
+#include "navigator.h"
 #include "prefsmanager.h"
 #include "prefsfile.h"
-#include "commonstrings.h"
 #include "pageitem.h"
-#include "navigator.h"
+#include "scfonts.h"
+#include "scribusdoc.h"
 #include "scribusview.h"
 #include "util_formats.h"
+#include "ui/customfdialog.h"
 #include "ui/scrspinbox.h"
 
-Annota::Annota(QWidget* parent, PageItem *it, int Seite, int b, int h, ScribusView* vie) : QDialog(parent)
+Annota::Annota(QWidget* parent, PageItem *it, ScribusDoc* doc, ScribusView* view) :
+	QDialog(parent),
+	m_item(it),
+	m_doc(doc),
+	m_view(view)
 {
 	setModal(true);
 	setWindowTitle( tr( "Annotation Properties" ) );
-	item = it;
-	Width = b;
-	Height = h;
-	OriWidth = b;
-	OriHeight = h;
-	view = vie;
-	MaxSeite = Seite;
+
+	m_pageCount = m_doc->DocPages.count(),
+	m_width = static_cast<int>(m_doc->pageWidth());
+	m_height = static_cast<int>(m_doc->pageHeight());
+	m_oriWidth = static_cast<int>(m_doc->pageWidth());
+	m_oriHeight = static_cast<int>(m_doc->pageWidth());
+
 	QStringList tl;
-	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();
+	if ((m_item->annotation().ActionType() == Annotation::Action_GoTo) || (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
+	{
+		QString tm = m_item->annotation().Action();
 		tl = tm.split(" ", QString::SkipEmptyParts);
 	}
 	else
@@ -72,7 +79,7 @@
 	Layout1->setMargin( 0 );
 
 	ComboBox1 = new QComboBox(this);
-	if (!view->m_doc->masterPageMode())
+	if (!m_view->m_doc->masterPageMode())
 		ComboBox1->addItem( tr("Text"));
 	ComboBox1->addItem( tr("Link"));
 	ComboBox1->addItem( tr("External Link"));
@@ -83,26 +90,26 @@
 	Layout1->addWidget( TextLabel1 );
 	Layout1->addWidget( ComboBox1 );
 	AnnotLayout->addLayout( Layout1 );
-	if (view->m_doc->masterPageMode())
-	{
-		if (item->annotation().Type() < 2)
-			ComboBox1->setCurrentIndex(item->annotation().Type() - 1);
+	if (m_view->m_doc->masterPageMode())
+	{
+		if (m_item->annotation().Type() < 2)
+			ComboBox1->setCurrentIndex(m_item->annotation().Type() - 1);
 		else
-			ComboBox1->setCurrentIndex(item->annotation().Type()-11);
-		if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_URI))
-			ComboBox1->setCurrentIndex(item->annotation().ActionType() - 6);
-		if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
+			ComboBox1->setCurrentIndex(m_item->annotation().Type() - 11);
+		if ((m_item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (m_item->annotation().ActionType() == Annotation::Action_URI))
+			ComboBox1->setCurrentIndex(m_item->annotation().ActionType() - 6);
+		if (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 			ComboBox1->setCurrentIndex(1);
 	}
 	else
 	{
-		if (item->annotation().Type() < 2)
-			ComboBox1->setCurrentIndex(item->annotation().Type());
+		if (m_item->annotation().Type() < 2)
+			ComboBox1->setCurrentIndex(m_item->annotation().Type());
 		else
-			ComboBox1->setCurrentIndex(item->annotation().Type()-10);
-		if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_URI))
-			ComboBox1->setCurrentIndex(item->annotation().ActionType() - 5);
-		if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
+			ComboBox1->setCurrentIndex(m_item->annotation().Type() - 10);
+		if ((m_item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (m_item->annotation().ActionType() == Annotation::Action_URI))
+			ComboBox1->setCurrentIndex(m_item->annotation().ActionType() - 5);
+		if (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 			ComboBox1->setCurrentIndex(2);
 	}
 	Fram = new QStackedWidget(this);
@@ -130,11 +137,11 @@
 	ComboBox2->addItem( tr("Cross"));
 	ComboBox2->addItem( tr("Circle"));
 	ComboBox2->setEditable(false);
-	ComboBox2->setCurrentIndex(item->annotation().Icon());
+	ComboBox2->setCurrentIndex(m_item->annotation().Icon());
 	GroupBox2Layout->addWidget( TextLabelG1, 0, 0 );
 	GroupBox2Layout->addWidget( ComboBox2, 0, 1 );
 	textIsOpen = new QCheckBox( tr("Annotation is Open"), GroupBox2);
-	textIsOpen->setChecked(item->annotation().IsAnOpen());
+	textIsOpen->setChecked(m_item->annotation().IsAnOpen());
 	GroupBox2Layout->addWidget( textIsOpen, 1, 0, 1, 1 );
 	Fram->addWidget(GroupBox2);
 
@@ -146,7 +153,7 @@
 	GroupBox1Layout->setMargin( 10 );
 
 	Destfile = new QLineEdit(GroupBox1);
-	Destfile->setText(item->annotation().Extern());
+	Destfile->setText(m_item->annotation().Extern());
 	Destfile->setReadOnly(true);
 	GroupBox1Layout->addWidget( Destfile, 0, 0, 1, 2 );
 	ChFile = new QPushButton(GroupBox1);
@@ -154,11 +161,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() == Annotation::Action_GoToR_FileRel)
+	if (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileRel)
 		useAbsolute->setChecked(false);
-	else if (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
+	else if (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)
 		useAbsolute->setChecked(true);
-	if ((item->annotation().ActionType() != Annotation::Action_GoToR_FileRel) && (item->annotation().ActionType() != Annotation::Action_URI) && (item->annotation().ActionType() != Annotation::Action_GoToR_FileAbs))
+	if ((m_item->annotation().ActionType() != Annotation::Action_GoToR_FileRel) && (m_item->annotation().ActionType() != Annotation::Action_URI) && (m_item->annotation().ActionType() != Annotation::Action_GoToR_FileAbs))
 	{
 		Destfile->hide();
 		ChFile->hide();
@@ -168,33 +175,33 @@
 	SpinBox1 = new ScrSpinBox( GroupBox1);
 	SpinBox1->setDecimals(0);
 	SpinBox1->setMinimum(1);
-	SpinBox1->setMaximum(((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)) ? 1000 : Seite);
+	SpinBox1->setMaximum(((m_item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)) ? 1000 : m_pageCount);
 	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() == 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
-	{
-		int targetPage = item->annotation().Ziel();
-		if ((targetPage >= 0) && (targetPage < view->m_doc->Pages->count()))
-			Pg = new Navigator( GroupBox1, 100, item->annotation().Ziel(), view);
+	if ((!Destfile->text().isEmpty()) && ((m_item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs)))
+		navigator = new Navigator( GroupBox1, 100, m_item->annotation().Ziel() + 1, m_view, m_item->annotation().Extern());
+	else
+	{
+		int targetPage = m_item->annotation().Ziel();
+		if ((targetPage >= 0) && (targetPage < m_view->m_doc->Pages->count()))
+			navigator = new Navigator( GroupBox1, 100, m_item->annotation().Ziel(), m_view);
 		else
 		{
-			item->annotation().setZiel(view->m_doc->currentPageNumber());
-			Pg = new Navigator( GroupBox1, 100, item->annotation().Ziel(), view);
-		}
-	}
-	SpinBox1->setValue(item->annotation().Ziel()+1);
-	Pg->setMinimumSize(QSize(Pg->pmx.width(), Pg->pmx.height()));
-	GroupBox1Layout->addWidget(Pg, 2, 2, 3, 1);
+			m_item->annotation().setZiel(m_view->m_doc->currentPageNumber());
+			navigator = new Navigator( GroupBox1, 100, m_item->annotation().Ziel(), m_view);
+		}
+	}
+	SpinBox1->setValue(m_item->annotation().Ziel() + 1);
+	navigator->setMinimumSize(QSize(navigator->pmx.width(), navigator->pmx.height()));
+	GroupBox1Layout->addWidget(navigator, 2, 2, 3, 1);
 
 	SpinBox2 = new ScrSpinBox( GroupBox1);
 	SpinBox2->setDecimals(0);
 	SpinBox2->setSuffix( tr( " pt" ) );
-	SpinBox2->setMaximum(Width);
+	SpinBox2->setMaximum(m_width);
 	SpinBox2->setValue(tl[0].toInt());
 	TextLabel4 = new QLabel( tr("&X-Pos:"), GroupBox1 );
 	TextLabel4->setBuddy(SpinBox2);
@@ -202,9 +209,9 @@
 	GroupBox1Layout->addWidget( SpinBox2, 3, 1 );
 	SpinBox3 = new ScrSpinBox( GroupBox1 );
 	SpinBox3->setDecimals(0);
-	SpinBox3->setMaximum(Height);
+	SpinBox3->setMaximum(m_height);
 	SpinBox3->setSuffix( tr( " pt" ) );
-	SpinBox3->setValue(Height-tl[1].toInt());
+	SpinBox3->setValue(m_height - tl[1].toInt());
 	TextLabel5 = new QLabel( tr("&Y-Pos:"), GroupBox1 );
 	TextLabel5->setBuddy(SpinBox3);
 	GroupBox1Layout->addWidget( TextLabel5, 4, 0 );
@@ -228,101 +235,99 @@
 	connect(PushButton2, SIGNAL(clicked()), this, SLOT(reject()));
 	connect(ComboBox1, SIGNAL(activated(int)), this, SLOT(SetTarget(int)));
 	connect(SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(SetPage(double)));
-	connect(Pg, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
+	connect(navigator, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
 	connect(SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(SetCross()));
 	connect(SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(SetCross()));
 	connect(ChFile, SIGNAL(clicked()), this, SLOT(GetFile()));
-	if (view->m_doc->masterPageMode())
-		SetTarget(item->annotation().Type() - 1);
-	else
-		SetTarget(item->annotation().Type());
+	if (m_view->m_doc->masterPageMode())
+		SetTarget(m_item->annotation().Type() - 1);
+	else
+		SetTarget(m_item->annotation().Type());
 	SetCross();
 }
 
 void Annota::SetCoords(double x, double y)
 {
-	SpinBox2->setValue(static_cast<int>(x*Width));
-	SpinBox3->setValue(static_cast<int>(y*Height));
+	SpinBox2->setValue(static_cast<int>(x * m_width));
+	SpinBox3->setValue(static_cast<int>(y * m_height));
 }
 
 void Annota::SetPage(double v)
 {
-	disconnect(SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(SetPage(double)));
-	int link = 2;
-	if (view->m_doc->masterPageMode())
-		link = 1;
+	QSignalBlocker spinBox1Blocker(SpinBox1);
+
+	int link = m_view->m_doc->masterPageMode() ? 1 : 2;
 	if (ComboBox1->currentIndex() == link)
 	{
-		if (!Pg->SetSeite(static_cast<int>(v), 100, Destfile->text()))
+		if (!navigator->setPage(static_cast<int>(v), 100, Destfile->text()))
 		{
 			SpinBox1->setValue(1);
-			Pg->SetSeite(1, 100, Destfile->text());
-		}
-		Width = Pg->Width;
-		Height = Pg->Height;
-	}
-	else
-	{
-		Pg->SetSeite(qMin(static_cast<int>(v)-1, MaxSeite-1), 100);
-		SpinBox1->setValue(qMin(static_cast<int>(v), MaxSeite));
-		Width = OriWidth;
-		Height = OriHeight;
-	}
-	SpinBox2->setMaximum(Width);
-	SpinBox3->setMaximum(Height);
-	connect(SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(SetPage(double)));
+			navigator->setPage(1, 100, Destfile->text());
+		}
+		m_width = navigator->Width;
+		m_height = navigator->Height;
+	}
+	else
+	{
+		navigator->setPage(qMin(static_cast<int>(v) - 1, m_pageCount - 1), 100);
+		SpinBox1->setValue(qMin(static_cast<int>(v), m_pageCount));
+		m_width = m_oriWidth;
+		m_height = m_oriHeight;
+	}
+	SpinBox2->setMaximum(m_width);
+	SpinBox3->setMaximum(m_height);
 }
 
 void Annota::SetCross()
 {
 	int x,y;
-	disconnect(Pg, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
-	x = static_cast<int>(SpinBox2->value()/static_cast<double>(Width)*Pg->pmx.width());
-	y = static_cast<int>(SpinBox3->value()/static_cast<double>(Height)*Pg->pmx.height());
-	Pg->drawMark(x, y);
-	connect(Pg, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
+	disconnect(navigator, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
+	x = static_cast<int>(SpinBox2->value() / static_cast<double>(m_width) * navigator->pmx.width());
+	y = static_cast<int>(SpinBox3->value() / static_cast<double>(m_height) * navigator->pmx.height());
+	navigator->drawMark(x, y);
+	connect(navigator, SIGNAL(Coords(double, double)), this, SLOT(SetCoords(double, double)));
 }
 
 void Annota::SetValues()
 {
 	QString tmp, tmp2;
-	item->annotation().setZiel(SpinBox1->value()-1);
-	if (view->m_doc->masterPageMode())
-		item->annotation().setType(ComboBox1->currentIndex()+11);
-	else
-		item->annotation().setType(ComboBox1->currentIndex()+10);
-	switch (item->annotation().Type())
+	m_item->annotation().setZiel(SpinBox1->value()-1);
+	if (m_view->m_doc->masterPageMode())
+		m_item->annotation().setType(ComboBox1->currentIndex()+11);
+	else
+		m_item->annotation().setType(ComboBox1->currentIndex()+10);
+	switch (m_item->annotation().Type())
 	{
 	case 10:
-		item->annotation().setActionType(Annotation::Action_None);
-		item->annotation().setAnOpen(textIsOpen->isChecked());
-		item->annotation().setIcon(ComboBox2->currentIndex());
+		m_item->annotation().setActionType(Annotation::Action_None);
+		m_item->annotation().setAnOpen(textIsOpen->isChecked());
+		m_item->annotation().setIcon(ComboBox2->currentIndex());
 		break;
 	case 11:
-		item->annotation().setAction(tmp.setNum(SpinBox2->value())+" "+ tmp2.setNum(Height-SpinBox3->value())+" 0");
-		item->annotation().setExtern("");
-		item->annotation().setActionType(Annotation::Action_GoTo);
+		m_item->annotation().setAction(tmp.setNum(SpinBox2->value()) + " " + tmp2.setNum(m_height - SpinBox3->value())+" 0");
+		m_item->annotation().setExtern("");
+		m_item->annotation().setActionType(Annotation::Action_GoTo);
 		break;
 	case 12:
-		item->annotation().setAction(tmp.setNum(SpinBox2->value())+" "+ tmp2.setNum(Height-SpinBox3->value())+" 0");
+		m_item->annotation().setAction(tmp.setNum(SpinBox2->value()) + " " + tmp2.setNum(m_height - SpinBox3->value())+" 0");
 		if (!Destfile->text().isEmpty())
 		{
-			item->annotation().setExtern(Destfile->text());
+			m_item->annotation().setExtern(Destfile->text());
 			if (useAbsolute->isChecked())
-				item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
+				m_item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
 			else
-				item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
-		}
-		item->annotation().setType(Annotation::Link);
+				m_item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
+		}
+		m_item->annotation().setType(Annotation::Link);
 		break;
 	case 13:
-		item->annotation().setAction("");
+		m_item->annotation().setAction("");
 		if (!Destfile->text().isEmpty())
 		{
-			item->annotation().setExtern(Destfile->text());
-			item->annotation().setActionType(Annotation::Action_URI);
-		}
-		item->annotation().setType(Annotation::Link);
+			m_item->annotation().setExtern(Destfile->text());
+			m_item->annotation().setActionType(Annotation::Action_URI);
+		}
+		m_item->annotation().setType(Annotation::Link);
 		break;
 	}
 	accept();
@@ -332,9 +337,9 @@
 {
 	int a = it;
 	disconnect(ComboBox1, SIGNAL(activated(int)), this, SLOT(SetTarget(int)));
-	if (view->m_doc->masterPageMode())
+	if (m_view->m_doc->masterPageMode())
 		a++;
-	Pg->show();
+	navigator->show();
 	TextLabel3->show();
 	TextLabel4->show();
 	TextLabel5->show();
@@ -349,8 +354,8 @@
 		Destfile->hide();
 		ChFile->hide();
 		useAbsolute->hide();
-		item->annotation().setActionType(Annotation::Action_GoTo);
-		SetPage(qMin(static_cast<int>(SpinBox1->value()), MaxSeite));
+		m_item->annotation().setActionType(Annotation::Action_GoTo);
+		SetPage(qMin(static_cast<int>(SpinBox1->value()), m_pageCount));
 		break;
 	case 2:
 		Fram->setCurrentIndex(1);
@@ -358,19 +363,19 @@
 		ChFile->show();
 		useAbsolute->show();
 		Destfile->setReadOnly(true);
-		if ((Destfile->text().isEmpty())  || (item->annotation().ActionType() == Annotation::Action_URI))
+		if ((Destfile->text().isEmpty())  || (m_item->annotation().ActionType() == Annotation::Action_URI))
 		{
 			Destfile->setText("");
 			GetFile();
 		}
 		if (Destfile->text().isEmpty())
 		{
-			item->annotation().setActionType(Annotation::Action_GoTo);
+			m_item->annotation().setActionType(Annotation::Action_GoTo);
 			Destfile->setText("");
 			Destfile->hide();
 			ChFile->hide();
 			useAbsolute->hide();
-			if (view->m_doc->masterPageMode())
+			if (m_view->m_doc->masterPageMode())
 				ComboBox1->setCurrentIndex(0);
 			else
 				ComboBox1->setCurrentIndex(1);
@@ -378,11 +383,11 @@
 		else
 		{
 			if (useAbsolute->isChecked())
-				item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
+				m_item->annotation().setActionType(Annotation::Action_GoToR_FileAbs);
 			else
-				item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
-		}
-		SetPage(qMin(static_cast<int>(SpinBox1->value()), MaxSeite));
+				m_item->annotation().setActionType(Annotation::Action_GoToR_FileRel);
+		}
+		SetPage(qMin(static_cast<int>(SpinBox1->value()), m_pageCount));
 		break;
 	case 3:
 		Fram->setCurrentIndex(1);
@@ -390,31 +395,31 @@
 		Destfile->setReadOnly(false);
 		ChFile->hide();
 		useAbsolute->hide();
-		Pg->hide();
+		navigator->hide();
 		TextLabel3->hide();
 		TextLabel4->hide();
 		TextLabel5->hide();
 		SpinBox1->hide();
 		SpinBox2->hide();
 		SpinBox3->hide();
-		item->annotation().setActionType(Annotation::Action_URI);
+		m_item->annotation().setActionType(Annotation::Action_URI);
 		break;
 	case 11:
 		Fram->setCurrentIndex(1);
-		if ((item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
+		if ((m_item->annotation().ActionType() == Annotation::Action_GoToR_FileRel) || (m_item->annotation().ActionType() == Annotation::Action_GoToR_FileAbs))
 		{
 			Destfile->show();
 			ChFile->show();
 			useAbsolute->show();
 			Destfile->setReadOnly(true);
 		}
-		if (item->annotation().ActionType() == Annotation::Action_URI)
+		if (m_item->annotation().ActionType() == Annotation::Action_URI)
 		{
 			Destfile->show();
 			Destfile->setReadOnly(false);
 			ChFile->hide();
 			useAbsolute->hide();
-			Pg->hide();
+			navigator->hide();
 			TextLabel3->hide();
 			TextLabel4->hide();
 			TextLabel5->hide();
@@ -422,8 +427,8 @@
 			SpinBox2->hide();
 			SpinBox3->hide();
 		}
-		if (Pg->isVisible())
-			SetPage(qMin(static_cast<int>(SpinBox1->value()), MaxSeite));
+		if (navigator->isVisible())
+			SetPage(qMin(static_cast<int>(SpinBox1->value()), m_pageCount));
 		break;
 	default:
 		Fram->setCurrentIndex(0);

Modified: trunk/Scribus/scribus/ui/annota.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/ui/annota.h
==============================================================================
--- trunk/Scribus/scribus/ui/annota.h	(original)
+++ trunk/Scribus/scribus/ui/annota.h	Tue May 12 01:21:52 2020
@@ -33,6 +33,7 @@
 
 class PageItem;
 class Navigator;
+class ScribusDoc;
 class ScribusView;
 
 class SCRIBUS_API Annota : public QDialog
@@ -40,36 +41,8 @@
 	Q_OBJECT
 
 public:
-	Annota(QWidget* parent, PageItem *it, int Seite, int b, int h, ScribusView* vie);
+	Annota(QWidget* parent, PageItem *it, ScribusDoc* doc, ScribusView* vie);
 	~Annota() {};
-	QStackedWidget* Fram;
-	QLabel* TextLabel1;
-	QComboBox* ComboBox1;
-	QGroupBox* GroupBox1;
-	QLabel* TextLabel3;
-	QLabel* TextLabel4;
-	QLabel* TextLabel5;
-	QLineEdit* Destfile;
-	QPushButton* ChFile;
-	QCheckBox* useAbsolute;
-	Navigator* Pg;
-	ScrSpinBox* SpinBox1;
-	ScrSpinBox* SpinBox2;
-	ScrSpinBox* SpinBox3;
-//	QFrame* Frame9;
-	QPushButton* PushButton1;
-	QPushButton* PushButton2;
-	QGroupBox* GroupBox2;
-	QLabel* TextLabelG1;
-	QComboBox* ComboBox2;
-	QCheckBox* textIsOpen;
-	PageItem* item;
-	ScribusView* view;
-	int Width;
-	int Height;
-	int OriWidth;
-	int OriHeight;
-	int MaxSeite;
 
 public slots:
 	void SetCoords(double x, double y);
@@ -80,11 +53,44 @@
 	void GetFile();
 
 protected:
-	QVBoxLayout* AnnotLayout;
-	QHBoxLayout* Layout1;
-	QGridLayout* GroupBox1Layout;
-	QGridLayout* GroupBox2Layout;
-	QHBoxLayout* Layout1_2;
+	PageItem* m_item { nullptr };
+	ScribusDoc* m_doc { nullptr };
+	ScribusView* m_view { nullptr };
+
+	int m_pageCount;
+	int m_width;
+	int m_height;
+	int m_oriWidth;
+	int m_oriHeight;
+
+protected:
+	QVBoxLayout* AnnotLayout { nullptr };
+	QHBoxLayout* Layout1 { nullptr };
+	QGridLayout* GroupBox1Layout { nullptr };
+	QGridLayout* GroupBox2Layout { nullptr };
+	QHBoxLayout* Layout1_2 { nullptr };
+	
+	QStackedWidget* Fram { nullptr };
+	QLabel* TextLabel1 { nullptr };
+	QComboBox* ComboBox1 { nullptr };
+	QGroupBox* GroupBox1 { nullptr };
+	QLabel* TextLabel3 { nullptr };
+	QLabel* TextLabel4 { nullptr };
+	QLabel* TextLabel5 { nullptr };
+	QLineEdit* Destfile { nullptr };
+	QPushButton* ChFile { nullptr };
+	QCheckBox* useAbsolute { nullptr };
+	Navigator* navigator { nullptr };
+	ScrSpinBox* SpinBox1 { nullptr };
+	ScrSpinBox* SpinBox2 { nullptr };
+	ScrSpinBox* SpinBox3 { nullptr };
+//	QFrame* Frame9;
+	QPushButton* PushButton1 { nullptr };
+	QPushButton* PushButton2 { nullptr };
+	QGroupBox* GroupBox2 { nullptr };
+	QLabel* TextLabelG1 { nullptr };
+	QComboBox* ComboBox2 { nullptr };
+	QCheckBox* textIsOpen { nullptr };
 };
 
 #endif // ANNOT_H

Modified: trunk/Scribus/scribus/util_ghostscript.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/util_ghostscript.cpp
==============================================================================
--- trunk/Scribus/scribus/util_ghostscript.cpp	(original)
+++ trunk/Scribus/scribus/util_ghostscript.cpp	Tue May 12 01:21:52 2020
@@ -210,7 +210,7 @@
 	if (!proc.waitForStarted(5000))
 		return false;
 	proc.waitForFinished(5000);
-	return (proc.exitCode()==0);
+	return (proc.exitCode() == 0);
 }
 
 bool testGSDeviceAvailability( const QString& device )
@@ -225,7 +225,7 @@
 	if (!proc.waitForStarted(5000))
 		return false;
 	proc.waitForFinished(5000);
-	return (proc.exitCode()==0);
+	return (proc.exitCode() == 0);
 }
 
 // Return the GhostScript version string, or QString() if it couldn't be retrived.
@@ -240,7 +240,7 @@
 		while (!proc.waitForFinished(5000))
 			qApp->processEvents();
 	QString gsVer;
-	if (proc.exitStatus()==QProcess::NormalExit)
+	if (proc.exitStatus() == QProcess::NormalExit)
 		gsVer = proc.readAllStandardOutput();
 	return gsVer;
 }
@@ -409,7 +409,7 @@
 	}
 #else
 	int gsNumericVer, gsMajor, gsMinor;
-	PrefsManager& prefsManager=PrefsManager::instance();
+	PrefsManager& prefsManager = PrefsManager::instance();
 	if (getNumericGSVersion(gsMajor, gsMinor))
 	{
 		gsNumericVer = gsMajor * 100 + gsMinor;
@@ -419,44 +419,47 @@
 	return gsVersions;
 }
 
-QPixmap LoadPDF(const QString& fn, int Page, int Size, int *w, int *h)
+QPixmap loadPDF(const QString& fn, int page, int size, int *w, int *h)
 {
 	QString tmp;
 	QString pdfFile = QDir::toNativeSeparators(fn);
 	QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc.png");
-	QPixmap pm;
-	int ret = -1;
-	tmp.setNum(Page);
+
+	tmp.setNum(page);
 	QStringList args;
 	args.append("-r72");
-//	args.append("-sOutputFile=\""+tmpFile+"\"");
-	args.append("-sOutputFile="+tmpFile);
-	args.append("-dFirstPage="+tmp);
-	args.append("-dLastPage="+tmp);
-//	args.append("\""+pdfFile+"\"");
+//	args.append("-sOutputFile=\"" + tmpFile + "\"");
+	args.append("-sOutputFile=" + tmpFile);
+	args.append("-dFirstPage=" + tmp);
+	args.append("-dLastPage=" + tmp);
+//	args.append("\"" + pdfFile + "\"");
 	args.append(pdfFile);
-	ret = callGS(args);
-	if (ret == 0)
-	{
-		QImage image;
-		image.load(tmpFile);
-		QFile::remove(tmpFile);
-		QImage im2;
-		*h = image.height();
-		*w = image.width();
-		double sx = image.width() / static_cast<double>(Size);
-		double sy = image.height() / static_cast<double>(Size);
-		double t = (sy < sx ? sx : sy);
-		im2 = image.scaled(static_cast<int>(image.width() / t), static_cast<int>(image.height() / t), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-		pm=QPixmap::fromImage(im2);
-		QPainter p;
-		p.begin(&pm);
-		p.setBrush(Qt::NoBrush);
-		p.setPen(Qt::black);
-		p.drawRect(0, 0, pm.width(), pm.height());
-		p.end();
-		im2.detach();
-	}
+
+	int ret = callGS(args);
+	if (ret != 0)
+		return QPixmap();
+
+	QImage image;
+	image.load(tmpFile);
+	QFile::remove(tmpFile);
+	*w = image.width();
+	*h = image.height();
+	if ((*w <= 0) || (*h <= 0))
+		return QPixmap();
+
+	double sx = image.width() / static_cast<double>(size);
+	double sy = image.height() / static_cast<double>(size);
+	double t = (sy < sx ? sx : sy);
+	QImage im2 = image.scaled(static_cast<int>(image.width() / t), static_cast<int>(image.height() / t), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+	QPixmap pm = QPixmap::fromImage(im2);
+	QPainter p;
+	p.begin(&pm);
+	p.setBrush(Qt::NoBrush);
+	p.setPen(Qt::black);
+	p.drawRect(0, 0, pm.width(), pm.height());
+	p.end();
+	im2.detach();
+
 	return pm;
 }
 

Modified: trunk/Scribus/scribus/util_ghostscript.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23783&path=/trunk/Scribus/scribus/util_ghostscript.h
==============================================================================
--- trunk/Scribus/scribus/util_ghostscript.h	(original)
+++ trunk/Scribus/scribus/util_ghostscript.h	Tue May 12 01:21:52 2020
@@ -21,7 +21,7 @@
 
 #include "scribusapi.h"
 
-QPixmap SCRIBUS_API LoadPDF(const QString& fn, int Page, int Size, int *w, int *h);
+QPixmap SCRIBUS_API loadPDF(const QString& fn, int page, int size, int *w, int *h);
 /**
  * @brief Call GhostScript synchronously and store output
    *




More information about the scribus-commit mailing list