[qet] [759] Le dialogue d' impression presente desormais les memes options que le dialogue d'export. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 759
Author: xavier
Date: 2009-10-04 03:32:45 +0200 (Sun, 04 Oct 2009)
Log Message:
-----------
Le dialogue d'impression presente desormais les memes options que le dialogue d'export.
Modified Paths:
--------------
trunk/sources/diagramprintdialog.cpp
trunk/sources/diagramprintdialog.h
trunk/sources/qetprintpreviewdialog.cpp
trunk/sources/qetprintpreviewdialog.h
Modified: trunk/sources/diagramprintdialog.cpp
===================================================================
--- trunk/sources/diagramprintdialog.cpp 2009-10-04 01:20:45 UTC (rev 758)
+++ trunk/sources/diagramprintdialog.cpp 2009-10-04 01:32:45 UTC (rev 759)
@@ -19,6 +19,7 @@
#include "qetprintpreviewdialog.h"
#include <math.h>
#include "diagramschooser.h"
+#include "exportproperties.h"
#include "qeticons.h"
#include "qetmessagebox.h"
@@ -122,13 +123,23 @@
// Apercu avant impression
QETPrintPreviewDialog preview_dialog(project_, printer_, parentWidget());
- connect(&preview_dialog, SIGNAL(paintRequested(const QList<Diagram *> &, bool, QPrinter *)), this, SLOT(print(const QList<Diagram *> &, bool, QPrinter *)));
+ connect(
+ &preview_dialog,
+ SIGNAL(paintRequested(const QList<Diagram *> &, bool, const ExportProperties, QPrinter *)),
+ this,
+ SLOT(print(const QList<Diagram *> &, bool, const ExportProperties, QPrinter *))
+ );
DiagramsChooser *dc = preview_dialog.diagramsChooser();
dc -> setSelectedAllDiagrams();
if (preview_dialog.exec() == QDialog::Rejected) return;
// effectue l'impression en elle-meme
- print(dc -> selectedDiagrams(), preview_dialog.fitDiagramsToPages(), printer_);
+ print(
+ dc -> selectedDiagrams(),
+ preview_dialog.fitDiagramsToPages(),
+ preview_dialog.exportProperties(),
+ printer_
+ );
}
/**
@@ -317,9 +328,10 @@
@param diagrams Schemas a imprimer
@param fit_page Booleen indiquant s'il faut adapter les schemas aux pages
ou non
+ @param options Options de rendu
@param printer L'imprimante a utiliser
*/
-void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, QPrinter */*printer*/) {
+void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties options, QPrinter */*printer*/) {
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
// QPainter utiliser pour effectuer le rendu
@@ -333,7 +345,7 @@
// imprime les schemas
for (int i = 0 ; i < diagrams.count() ; ++ i) {
- printDiagram(diagrams[i], fit_page, &qp, printer_);
+ printDiagram(diagrams[i], fit_page, options, &qp, printer_);
if (i != diagrams.count() - 1) {
printer_ -> newPage();
}
@@ -347,7 +359,7 @@
@param qp QPainter a utiliser (deja initialise sur printer)
@param printer Imprimante a utiliser
*/
-void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, QPainter *qp, QPrinter *printer) {
+void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const ExportProperties options, QPainter *qp, QPrinter *printer) {
//qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title();
// l'imprimante utilise-t-elle toute la feuille ?
bool full_page = printer -> fullPage ();
@@ -357,8 +369,7 @@
// utiliser cette condition pour agir differemment en cas d'impression physique
}
- diagram -> setDisplayGrid(false);
- diagram -> setDrawTerminals(false);
+ saveReloadDiagramParameters(diagram, options, true);
if (fit_page) {
// impression adaptee sur une seule page
@@ -426,6 +437,24 @@
}
}
}
- diagram -> setDrawTerminals(true);
- diagram -> setDisplayGrid(true);
+ saveReloadDiagramParameters(diagram, options, false);
}
+
+/**
+ Sauve ou restaure les parametres du schema
+ @param diagram Schema dont on sauve ou restaure les parametres
+ @param options Parametres a appliquer
+ @param save true pour memoriser les parametres du schema et appliquer ceux
+ definis dans options, false pour restaurer les parametres
+*/
+void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const ExportProperties options, bool save) {
+ static ExportProperties state_exportProperties;
+
+ if (save) {
+ // memorise les parametres relatifs au schema tout en appliquant les nouveaux
+ state_exportProperties = diagram -> applyProperties(options);
+ } else {
+ // restaure les parametres relatifs au schema
+ diagram -> applyProperties(state_exportProperties);
+ }
+}
Modified: trunk/sources/diagramprintdialog.h
===================================================================
--- trunk/sources/diagramprintdialog.h 2009-10-04 01:20:45 UTC (rev 758)
+++ trunk/sources/diagramprintdialog.h 2009-10-04 01:32:45 UTC (rev 759)
@@ -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();
Modified: trunk/sources/qetprintpreviewdialog.cpp
===================================================================
--- trunk/sources/qetprintpreviewdialog.cpp 2009-10-04 01:20:45 UTC (rev 758)
+++ trunk/sources/qetprintpreviewdialog.cpp 2009-10-04 01:32:45 UTC (rev 759)
@@ -17,6 +17,8 @@
*/
#include "qetprintpreviewdialog.h"
#include "diagramschooser.h"
+#include "exportproperties.h"
+#include "exportpropertieswidget.h"
#include "qeticons.h"
/**
@@ -60,6 +62,13 @@
}
/**
+ @return les options de rendu definies par l'utilisateur
+*/
+ExportProperties QETPrintPreviewDialog::exportProperties() const {
+ return(render_properties_ -> exportProperties());
+}
+
+/**
Passe a la premiere page
*/
void QETPrintPreviewDialog::firstPage() {
@@ -222,6 +231,9 @@
fit_diagram_to_page_label_ -> setContentsMargins(20, 0, 0, 0);
fit_diagram_to_page_ -> setChecked(true);
+ render_properties_ = new ExportPropertiesWidget();
+ render_properties_ -> setPrintingMode(true);
+
buttons_ = new QDialogButtonBox();
buttons_ -> addButton(new QPushButton(QET::Icons::DocumentPrint, tr("Imprimer")), QDialogButtonBox::AcceptRole);
buttons_ -> addButton(QDialogButtonBox::Cancel);
@@ -246,6 +258,8 @@
connect(use_full_page_, SIGNAL(toggled(bool)), this, SLOT(useFullPage(bool)));
connect(fit_diagram_to_page_, SIGNAL(toggled(bool)), this, SLOT(fitDiagramToPage(bool)));
+ connect(render_properties_, SIGNAL(optionChanged()), preview_, SLOT(updatePreview()));
+
connect(preview_, SIGNAL(previewChanged()), this, SLOT(updateZoomList()));
connect(zoom_box_, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreviewZoom()));
@@ -271,6 +285,7 @@
vlayout0_ -> addWidget(toolbar_);
vlayout0_ -> addLayout(hlayout0_);
+ vlayout0_ -> addWidget(render_properties_);
vlayout0_ -> addWidget(print_options_box_);
vlayout0_ -> addWidget(buttons_);
@@ -289,6 +304,7 @@
paintRequested(
diagrams_list_ -> selectedDiagrams(),
fit_diagram_to_page_ -> isChecked(),
+ render_properties_ -> exportProperties(),
printer
)
);
@@ -328,6 +344,7 @@
*/
void QETPrintPreviewDialog::setPrintOptionsVisible(bool display) {
print_options_box_ -> setVisible(display);
+ render_properties_ -> setVisible(display);
if (display) {
toggle_print_options_ -> setText(tr("Cacher les options d'impression"));
Modified: trunk/sources/qetprintpreviewdialog.h
===================================================================
--- trunk/sources/qetprintpreviewdialog.h 2009-10-04 01:20:45 UTC (rev 758)
+++ trunk/sources/qetprintpreviewdialog.h 2009-10-04 01:32:45 UTC (rev 759)
@@ -18,8 +18,10 @@
#ifndef QET_PRINT_PREVIEW_DIALOG
#define QET_PRINT_PREVIEW_DIALOG
#include <QtGui>
+#include "exportproperties.h"
class Diagram;
class DiagramsChooser;
+class ExportPropertiesWidget;
class QETProject;
/**
Cette classe represente un dialogue permettant d'affiner les options
@@ -40,10 +42,11 @@
public:
DiagramsChooser *diagramsChooser();
bool fitDiagramsToPages() const;
+ ExportProperties exportProperties() const;
// signaux
signals:
- void paintRequested(const QList<Diagram *> &, bool, QPrinter *);
+ void paintRequested(const QList<Diagram *> &, bool, const ExportProperties, QPrinter *);
public slots:
void firstPage();
@@ -91,6 +94,7 @@
QLabel *use_full_page_label_;
QCheckBox *fit_diagram_to_page_;
QLabel *fit_diagram_to_page_label_;
+ ExportPropertiesWidget *render_properties_;
// methodes
private: