[qet] [758] Ajout de la methode Diagram:: applyProperties pour appliquer des options de rendu sur un schema.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 758
Author:   xavier
Date:     2009-10-04 02:13:58 +0200 (Sun, 04 Oct 2009)
Log Message:
-----------
Ajout de la methode Diagram::applyProperties pour appliquer des options de rendu sur un schema.

Modified Paths:
--------------
    trunk/sources/diagram.cpp
    trunk/sources/diagram.h
    trunk/sources/diagramprintdialog.h

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2009-10-03 23:54:07 UTC (rev 757)
+++ trunk/sources/diagram.cpp	2009-10-04 00:13:58 UTC (rev 758)
@@ -899,6 +899,34 @@
 }
 
 /**
+	Cette methode permet d'appliquer de nouvelles options de rendu tout en
+	accedant aux proprietes de rendu en cours.
+	@param new_properties Nouvelles options de rendu a appliquer
+	@return les options de rendu avant l'application de new_properties
+*/
+ExportProperties Diagram::applyProperties(const ExportProperties &new_properties) {
+	// exporte les options de rendu en cours
+	ExportProperties old_properties;
+	old_properties.draw_grid               = displayGrid();
+	old_properties.draw_border             = border_and_inset.borderIsDisplayed();
+	old_properties.draw_inset              = border_and_inset.insetIsDisplayed();
+	old_properties.draw_terminals          = drawTerminals();
+	old_properties.draw_colored_conductors = drawColoredConductors();
+	old_properties.exported_area           = useBorder() ? QET::BorderArea : QET::ElementsArea;
+	
+	// applique les nouvelles options de rendu
+	setUseBorder                  (new_properties.exported_area == QET::BorderArea);
+	setDrawTerminals              (new_properties.draw_terminals);
+	setDrawColoredConductors      (new_properties.draw_colored_conductors);
+	setDisplayGrid                (new_properties.draw_grid);
+	border_and_inset.displayBorder(new_properties.draw_border);
+	border_and_inset.displayInset (new_properties.draw_inset);
+	
+	// retourne les anciennes options de rendu
+	return(old_properties);
+}
+
+/**
 	@param pos Position cartesienne (ex : 10.3, 45.2) a transformer en position
 	dans la grille (ex : B2)
 	@return la position dans la grille correspondant a pos

Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h	2009-10-03 23:54:07 UTC (rev 757)
+++ trunk/sources/diagram.h	2009-10-04 00:13:58 UTC (rev 758)
@@ -22,6 +22,7 @@
 #include "borderinset.h"
 #include "qgimanager.h"
 #include "conductorproperties.h"
+#include "exportproperties.h"
 class Element;
 class CustomElement;
 class Terminal;
@@ -128,6 +129,7 @@
 	void removeDiagramTextItem(DiagramTextItem *);
 	
 	// fonctions relatives aux options graphiques
+	ExportProperties applyProperties(const ExportProperties &);
 	void setDisplayGrid(bool);
 	bool displayGrid();
 	void setUseBorder(bool);

Modified: trunk/sources/diagramprintdialog.h
===================================================================
--- trunk/sources/diagramprintdialog.h	2009-10-03 23:54:07 UTC (rev 757)
+++ trunk/sources/diagramprintdialog.h	2009-10-04 00:13:58 UTC (rev 758)
@@ -20,6 +20,7 @@
 #include <QtGui>
 #include "qetproject.h"
 #include "diagram.h"
+#include "exportproperties.h"
 /**
 	Cette classe represente le dialogue de configuration de l'impression d'un
 	schema electrique.
@@ -49,10 +50,11 @@
 	private:
 	void buildPrintTypeDialog();
 	void buildDialog();
+	void saveReloadDiagramParameters(Diagram *, const ExportProperties, bool);
 	
 	private slots:
-	void print(const QList<Diagram *> &, bool, QPrinter *);
-	void printDiagram(Diagram *, bool, QPainter *, QPrinter * = 0);
+	void print(const QList<Diagram *> &, bool, const ExportProperties, QPrinter *);
+	void printDiagram(Diagram *, bool, const ExportProperties, QPainter *, QPrinter * = 0);
 	void updatePrintTypeDialog();
 	void acceptPrintTypeDialog();
 	void browseFilePrintTypeDialog();


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/