[qet] [756] Il est desormais possible de ne pas conserver les couleurs des conducteurs lors de l 'export d'un schema.

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


Revision: 756
Author:   xavier
Date:     2009-10-04 00:02:14 +0200 (Sun, 04 Oct 2009)
Log Message:
-----------
Il est desormais possible de ne pas conserver les couleurs des conducteurs lors de l'export d'un schema.

Modified Paths:
--------------
    trunk/sources/conductor.cpp
    trunk/sources/diagram.cpp
    trunk/sources/diagram.h
    trunk/sources/exportdialog.cpp
    trunk/sources/exportproperties.cpp
    trunk/sources/exportproperties.h
    trunk/sources/exportpropertieswidget.cpp
    trunk/sources/exportpropertieswidget.h

Modified: trunk/sources/conductor.cpp
===================================================================
--- trunk/sources/conductor.cpp	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/conductor.cpp	2009-10-03 22:02:14 UTC (rev 756)
@@ -452,7 +452,16 @@
 	qp -> setRenderHint(QPainter::Antialiasing, false);
 	
 	// determine la couleur du conducteur
-	QColor final_conductor_color = isSelected() ? Qt::red : properties_.color;
+	QColor final_conductor_color(properties_.color);
+	if (isSelected()) {
+		final_conductor_color = Qt::red;
+	} else {
+		if (Diagram *parent_diagram = diagram()) {
+			if (!parent_diagram -> drawColoredConductors()) {
+				final_conductor_color = Qt::black;
+			}
+		}
+	}
 	
 	// affectation du QPen et de la QBrush modifies au QPainter
 	qp -> setBrush(conductor_brush);

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/diagram.cpp	2009-10-03 22:02:14 UTC (rev 756)
@@ -41,6 +41,7 @@
 	use_border(true),
 	moved_elements_fetched(false),
 	draw_terminals(true),
+	draw_colored_conductors_(true),
 	project_(0),
 	read_only_(false)
 {
@@ -928,6 +929,15 @@
 }
 
 /**
+	Definit s'il faut respecter ou non les couleurs des conducteurs.
+	Si non, les conducteurs sont tous dessines en noir.
+	@param dcc true pour respecter les couleurs, false sinon
+*/
+void Diagram::setDrawColoredConductors(bool dcc) {
+	draw_colored_conductors_ = dcc;
+}
+
+/**
 	@return la liste des conducteurs selectionnes sur le schema
 */
 QSet<Conductor *> Diagram::selectedConductors() const {

Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/diagram.h	2009-10-03 22:02:14 UTC (rev 756)
@@ -81,6 +81,7 @@
 	QGIManager *qgi_manager;
 	QUndoStack *undo_stack;
 	bool draw_terminals;
+	bool draw_colored_conductors_;
 	QDomDocument xml_document;
 	QETProject *project_;
 	bool read_only_;
@@ -137,6 +138,8 @@
 	
 	bool drawTerminals() const;
 	void setDrawTerminals(bool);
+	bool drawColoredConductors() const;
+	void setDrawColoredConductors(bool);
 	
 	QRectF border() const;
 	QString title() const;
@@ -300,4 +303,9 @@
 	return(draw_terminals);
 }
 
+/// @return true si les couleurs des conducteurs sont respectees, false sinon
+inline bool Diagram::drawColoredConductors() const {
+	return(draw_colored_conductors_);
+}
+
 #endif

Modified: trunk/sources/exportdialog.cpp
===================================================================
--- trunk/sources/exportdialog.cpp	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/exportdialog.cpp	2009-10-03 22:02:14 UTC (rev 756)
@@ -313,6 +313,7 @@
 	static bool state_drawInset;
 	static bool state_drawGrid;
 	static bool state_drawTerm;
+	static bool state_drawColCond;
 	static bool state_useBorder;
 	
 	if (save) {
@@ -321,12 +322,14 @@
 		state_drawInset   = diagram -> border_and_inset.insetIsDisplayed();
 		state_drawGrid    = diagram -> displayGrid();
 		state_drawTerm    = diagram -> drawTerminals();
+		state_drawColCond = diagram -> drawColoredConductors();
 		state_useBorder   = diagram -> useBorder();
 		
 		ExportProperties export_properties = epw -> exportProperties();
 		
 		diagram -> setUseBorder                  (export_properties.exported_area == QET::BorderArea);
 		diagram -> setDrawTerminals              (export_properties.draw_terminals);
+		diagram -> setDrawColoredConductors      (export_properties.draw_colored_conductors);
 		diagram -> setDisplayGrid                (export_properties.draw_grid);
 		diagram -> border_and_inset.displayBorder(export_properties.draw_border);
 		diagram -> border_and_inset.displayInset (export_properties.draw_inset);
@@ -336,6 +339,7 @@
 		diagram -> border_and_inset.displayInset(state_drawInset);
 		diagram -> setDisplayGrid(state_drawGrid);
 		diagram -> setDrawTerminals(state_drawTerm);
+		diagram -> setDrawColoredConductors(state_drawColCond);
 		diagram -> setUseBorder(state_useBorder);
 	}
 }

Modified: trunk/sources/exportproperties.cpp
===================================================================
--- trunk/sources/exportproperties.cpp	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/exportproperties.cpp	2009-10-03 22:02:14 UTC (rev 756)
@@ -33,6 +33,7 @@
 	draw_border(true),
 	draw_inset(true),
 	draw_terminals(false),
+	draw_colored_conductors(true),
 	exported_area(QET::BorderArea)
 {
 }
@@ -49,13 +50,14 @@
 	@param prefix prefixe a ajouter devant les noms des parametres
 */
 void ExportProperties::toSettings(QSettings &settings, const QString &prefix) const {
-	settings.setValue(prefix + "path",          QDir::toNativeSeparators(destination_directory.absolutePath()));
-	settings.setValue(prefix + "format",        format);
-	settings.setValue(prefix + "drawgrid",      draw_grid);
-	settings.setValue(prefix + "drawborder",    draw_border);
-	settings.setValue(prefix + "drawinset",     draw_inset);
-	settings.setValue(prefix + "drawterminals", draw_terminals);
-	settings.setValue(prefix + "area",          QET::diagramAreaToString(exported_area));
+	settings.setValue(prefix + "path",                  QDir::toNativeSeparators(destination_directory.absolutePath()));
+	settings.setValue(prefix + "format",                format);
+	settings.setValue(prefix + "drawgrid",              draw_grid);
+	settings.setValue(prefix + "drawborder",            draw_border);
+	settings.setValue(prefix + "drawinset",             draw_inset);
+	settings.setValue(prefix + "drawterminals",         draw_terminals);
+	settings.setValue(prefix + "drawcoloredconductors", draw_colored_conductors);
+	settings.setValue(prefix + "area",                  QET::diagramAreaToString(exported_area));
 }
 
 /**
@@ -70,10 +72,11 @@
 	
 	format = settings.value(prefix + "format").toString();
 	
-	draw_grid      = settings.value(prefix + "drawgrid",      false).toBool();
-	draw_border    = settings.value(prefix + "drawborder",    true ).toBool();
-	draw_inset     = settings.value(prefix + "drawinset",     true ).toBool();
-	draw_terminals = settings.value(prefix + "drawterminals", false).toBool();
+	draw_grid               = settings.value(prefix + "drawgrid",              false).toBool();
+	draw_border             = settings.value(prefix + "drawborder",            true ).toBool();
+	draw_inset              = settings.value(prefix + "drawinset",             true ).toBool();
+	draw_terminals          = settings.value(prefix + "drawterminals",         false).toBool();
+	draw_colored_conductors = settings.value(prefix + "drawcoloredconductors", true ).toBool();
 	
 	exported_area  = QET::diagramAreaFromString(settings.value(prefix + "area", "border").toString());
 }

Modified: trunk/sources/exportproperties.h
===================================================================
--- trunk/sources/exportproperties.h	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/exportproperties.h	2009-10-03 22:02:14 UTC (rev 756)
@@ -43,6 +43,7 @@
 	bool draw_border;               ///< Faut-il dessiner le cadre ?
 	bool draw_inset;                ///< Faut-il dessiner le cartouche ?
 	bool draw_terminals;            ///< Faut-il dessiner les bornes ?
+	bool draw_colored_conductors;   ///< Faut-il respecter les couleurs des conducteurs ?
 	QET::DiagramArea exported_area; ///< Zone du schema a exporter
 };
 #endif

Modified: trunk/sources/exportpropertieswidget.cpp
===================================================================
--- trunk/sources/exportpropertieswidget.cpp	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/exportpropertieswidget.cpp	2009-10-03 22:02:14 UTC (rev 756)
@@ -46,13 +46,14 @@
 ExportProperties ExportPropertiesWidget::exportProperties() const {
 	ExportProperties export_properties;
 	
-	export_properties.destination_directory = QDir(dirpath -> text());
-	export_properties.format                = format -> itemData(format -> currentIndex()).toString();
-	export_properties.draw_grid             = draw_grid      -> isChecked();
-	export_properties.draw_border           = draw_border    -> isChecked();
-	export_properties.draw_inset            = draw_inset     -> isChecked();
-	export_properties.draw_terminals        = draw_terminals -> isChecked();
-	export_properties.exported_area         = export_border -> isChecked() ? QET::BorderArea : QET::ElementsArea;
+	export_properties.destination_directory   = QDir(dirpath -> text());
+	export_properties.format                  = format -> itemData(format -> currentIndex()).toString();
+	export_properties.draw_grid               = draw_grid      -> isChecked();
+	export_properties.draw_border             = draw_border    -> isChecked();
+	export_properties.draw_inset              = draw_inset     -> isChecked();
+	export_properties.draw_terminals          = draw_terminals -> isChecked();
+	export_properties.draw_colored_conductors = draw_colored_conductors -> isChecked();
+	export_properties.exported_area           = export_border -> isChecked() ? QET::BorderArea : QET::ElementsArea;
 	
 	return(export_properties);
 }
@@ -67,10 +68,11 @@
 	if (index == -1) index = 0;
 	format -> setCurrentIndex(index);
 	
-	draw_grid           -> setChecked(export_properties.draw_grid);
-	draw_border         -> setChecked(export_properties.draw_border);
-	draw_inset          -> setChecked(export_properties.draw_inset);
-	draw_terminals      -> setChecked(export_properties.draw_terminals);
+	draw_grid               -> setChecked(export_properties.draw_grid);
+	draw_border             -> setChecked(export_properties.draw_border);
+	draw_inset              -> setChecked(export_properties.draw_inset);
+	draw_terminals          -> setChecked(export_properties.draw_terminals);
+	draw_colored_conductors -> setChecked(export_properties.draw_colored_conductors);
 	
 	if (export_properties.exported_area == QET::BorderArea) {
 		export_border -> setChecked(true);
@@ -156,7 +158,11 @@
 	// dessiner les bornes
 	draw_terminals = new QCheckBox(tr("Dessiner les bornes"), groupbox_options);
 	optionshlayout -> addWidget(draw_terminals, 2, 1);
-
+	
+	// conserver les couleurs des conducteurs
+	draw_colored_conductors = new QCheckBox(tr("Conserver les couleurs des conducteurs"), groupbox_options);
+	optionshlayout -> addWidget(draw_colored_conductors, 3, 0);
+	
 	vboxLayout -> addWidget(groupbox_options);
 	vboxLayout -> addStretch();
 	
@@ -170,7 +176,8 @@
 	setTabOrder(draw_border, draw_grid);
 	setTabOrder(draw_grid, draw_inset);
 	setTabOrder(draw_inset, draw_terminals);
-
+	setTabOrder(draw_terminals, draw_colored_conductors);
+	
 	// connexion du bouton permettant le choix du repertoire
 	connect(button_browse, SIGNAL(released()), this, SLOT(slot_chooseADirectory()));
 	

Modified: trunk/sources/exportpropertieswidget.h
===================================================================
--- trunk/sources/exportpropertieswidget.h	2009-09-27 15:04:17 UTC (rev 755)
+++ trunk/sources/exportpropertieswidget.h	2009-10-03 22:02:14 UTC (rev 756)
@@ -59,6 +59,7 @@
 	QCheckBox *draw_border;
 	QCheckBox *draw_inset;
 	QCheckBox *draw_terminals;
+	QCheckBox *draw_colored_conductors;
 	QRadioButton *export_border;
 	QRadioButton *export_elements;
 	QButtonGroup *exported_content_choices;


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