mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 06:20:53 +01:00
Le dialogue d'impression presente desormais les memes options que le dialogue d'export.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@759 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "qetprintpreviewdialog.h"
|
#include "qetprintpreviewdialog.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "diagramschooser.h"
|
#include "diagramschooser.h"
|
||||||
|
#include "exportproperties.h"
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
#include "qetmessagebox.h"
|
#include "qetmessagebox.h"
|
||||||
|
|
||||||
@@ -122,13 +123,23 @@ void DiagramPrintDialog::exec() {
|
|||||||
|
|
||||||
// Apercu avant impression
|
// Apercu avant impression
|
||||||
QETPrintPreviewDialog preview_dialog(project_, printer_, parentWidget());
|
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();
|
DiagramsChooser *dc = preview_dialog.diagramsChooser();
|
||||||
dc -> setSelectedAllDiagrams();
|
dc -> setSelectedAllDiagrams();
|
||||||
if (preview_dialog.exec() == QDialog::Rejected) return;
|
if (preview_dialog.exec() == QDialog::Rejected) return;
|
||||||
|
|
||||||
// effectue l'impression en elle-meme
|
// 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 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
|
|||||||
@param diagrams Schemas a imprimer
|
@param diagrams Schemas a imprimer
|
||||||
@param fit_page Booleen indiquant s'il faut adapter les schemas aux pages
|
@param fit_page Booleen indiquant s'il faut adapter les schemas aux pages
|
||||||
ou non
|
ou non
|
||||||
|
@param options Options de rendu
|
||||||
@param printer L'imprimante a utiliser
|
@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.";
|
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
|
||||||
|
|
||||||
// QPainter utiliser pour effectuer le rendu
|
// QPainter utiliser pour effectuer le rendu
|
||||||
@@ -333,7 +345,7 @@ void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page,
|
|||||||
|
|
||||||
// imprime les schemas
|
// imprime les schemas
|
||||||
for (int i = 0 ; i < diagrams.count() ; ++ i) {
|
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) {
|
if (i != diagrams.count() - 1) {
|
||||||
printer_ -> newPage();
|
printer_ -> newPage();
|
||||||
}
|
}
|
||||||
@@ -347,7 +359,7 @@ void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page,
|
|||||||
@param qp QPainter a utiliser (deja initialise sur printer)
|
@param qp QPainter a utiliser (deja initialise sur printer)
|
||||||
@param printer Imprimante a utiliser
|
@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();
|
//qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title();
|
||||||
// l'imprimante utilise-t-elle toute la feuille ?
|
// l'imprimante utilise-t-elle toute la feuille ?
|
||||||
bool full_page = printer -> fullPage ();
|
bool full_page = printer -> fullPage ();
|
||||||
@@ -357,8 +369,7 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
|||||||
// utiliser cette condition pour agir differemment en cas d'impression physique
|
// utiliser cette condition pour agir differemment en cas d'impression physique
|
||||||
}
|
}
|
||||||
|
|
||||||
diagram -> setDisplayGrid(false);
|
saveReloadDiagramParameters(diagram, options, true);
|
||||||
diagram -> setDrawTerminals(false);
|
|
||||||
|
|
||||||
if (fit_page) {
|
if (fit_page) {
|
||||||
// impression adaptee sur une seule page
|
// impression adaptee sur une seule page
|
||||||
@@ -426,6 +437,24 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diagram -> setDrawTerminals(true);
|
saveReloadDiagramParameters(diagram, options, false);
|
||||||
diagram -> setDisplayGrid(true);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
|
#include "exportproperties.h"
|
||||||
/**
|
/**
|
||||||
Cette classe represente le dialogue de configuration de l'impression d'un
|
Cette classe represente le dialogue de configuration de l'impression d'un
|
||||||
schema electrique.
|
schema electrique.
|
||||||
@@ -49,10 +50,11 @@ class DiagramPrintDialog : public QWidget {
|
|||||||
private:
|
private:
|
||||||
void buildPrintTypeDialog();
|
void buildPrintTypeDialog();
|
||||||
void buildDialog();
|
void buildDialog();
|
||||||
|
void saveReloadDiagramParameters(Diagram *, const ExportProperties, bool);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void print(const QList<Diagram *> &, bool, QPrinter *);
|
void print(const QList<Diagram *> &, bool, const ExportProperties, QPrinter *);
|
||||||
void printDiagram(Diagram *, bool, QPainter *, QPrinter * = 0);
|
void printDiagram(Diagram *, bool, const ExportProperties, QPainter *, QPrinter * = 0);
|
||||||
void updatePrintTypeDialog();
|
void updatePrintTypeDialog();
|
||||||
void acceptPrintTypeDialog();
|
void acceptPrintTypeDialog();
|
||||||
void browseFilePrintTypeDialog();
|
void browseFilePrintTypeDialog();
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "qetprintpreviewdialog.h"
|
#include "qetprintpreviewdialog.h"
|
||||||
#include "diagramschooser.h"
|
#include "diagramschooser.h"
|
||||||
|
#include "exportproperties.h"
|
||||||
|
#include "exportpropertieswidget.h"
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +61,13 @@ bool QETPrintPreviewDialog::fitDiagramsToPages() const {
|
|||||||
return(fit_diagram_to_page_ -> isChecked());
|
return(fit_diagram_to_page_ -> isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return les options de rendu definies par l'utilisateur
|
||||||
|
*/
|
||||||
|
ExportProperties QETPrintPreviewDialog::exportProperties() const {
|
||||||
|
return(render_properties_ -> exportProperties());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Passe a la premiere page
|
Passe a la premiere page
|
||||||
*/
|
*/
|
||||||
@@ -222,6 +231,9 @@ void QETPrintPreviewDialog::build() {
|
|||||||
fit_diagram_to_page_label_ -> setContentsMargins(20, 0, 0, 0);
|
fit_diagram_to_page_label_ -> setContentsMargins(20, 0, 0, 0);
|
||||||
fit_diagram_to_page_ -> setChecked(true);
|
fit_diagram_to_page_ -> setChecked(true);
|
||||||
|
|
||||||
|
render_properties_ = new ExportPropertiesWidget();
|
||||||
|
render_properties_ -> setPrintingMode(true);
|
||||||
|
|
||||||
buttons_ = new QDialogButtonBox();
|
buttons_ = new QDialogButtonBox();
|
||||||
buttons_ -> addButton(new QPushButton(QET::Icons::DocumentPrint, tr("Imprimer")), QDialogButtonBox::AcceptRole);
|
buttons_ -> addButton(new QPushButton(QET::Icons::DocumentPrint, tr("Imprimer")), QDialogButtonBox::AcceptRole);
|
||||||
buttons_ -> addButton(QDialogButtonBox::Cancel);
|
buttons_ -> addButton(QDialogButtonBox::Cancel);
|
||||||
@@ -246,6 +258,8 @@ void QETPrintPreviewDialog::build() {
|
|||||||
connect(use_full_page_, SIGNAL(toggled(bool)), this, SLOT(useFullPage(bool)));
|
connect(use_full_page_, SIGNAL(toggled(bool)), this, SLOT(useFullPage(bool)));
|
||||||
connect(fit_diagram_to_page_, SIGNAL(toggled(bool)), this, SLOT(fitDiagramToPage(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(preview_, SIGNAL(previewChanged()), this, SLOT(updateZoomList()));
|
||||||
connect(zoom_box_, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreviewZoom()));
|
connect(zoom_box_, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreviewZoom()));
|
||||||
|
|
||||||
@@ -271,6 +285,7 @@ void QETPrintPreviewDialog::build() {
|
|||||||
|
|
||||||
vlayout0_ -> addWidget(toolbar_);
|
vlayout0_ -> addWidget(toolbar_);
|
||||||
vlayout0_ -> addLayout(hlayout0_);
|
vlayout0_ -> addLayout(hlayout0_);
|
||||||
|
vlayout0_ -> addWidget(render_properties_);
|
||||||
vlayout0_ -> addWidget(print_options_box_);
|
vlayout0_ -> addWidget(print_options_box_);
|
||||||
vlayout0_ -> addWidget(buttons_);
|
vlayout0_ -> addWidget(buttons_);
|
||||||
|
|
||||||
@@ -289,6 +304,7 @@ void QETPrintPreviewDialog::requestPaint(QPrinter *printer) {
|
|||||||
paintRequested(
|
paintRequested(
|
||||||
diagrams_list_ -> selectedDiagrams(),
|
diagrams_list_ -> selectedDiagrams(),
|
||||||
fit_diagram_to_page_ -> isChecked(),
|
fit_diagram_to_page_ -> isChecked(),
|
||||||
|
render_properties_ -> exportProperties(),
|
||||||
printer
|
printer
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -328,6 +344,7 @@ void QETPrintPreviewDialog::setDiagramsListVisible(bool display) {
|
|||||||
*/
|
*/
|
||||||
void QETPrintPreviewDialog::setPrintOptionsVisible(bool display) {
|
void QETPrintPreviewDialog::setPrintOptionsVisible(bool display) {
|
||||||
print_options_box_ -> setVisible(display);
|
print_options_box_ -> setVisible(display);
|
||||||
|
render_properties_ -> setVisible(display);
|
||||||
|
|
||||||
if (display) {
|
if (display) {
|
||||||
toggle_print_options_ -> setText(tr("Cacher les options d'impression"));
|
toggle_print_options_ -> setText(tr("Cacher les options d'impression"));
|
||||||
|
|||||||
@@ -18,8 +18,10 @@
|
|||||||
#ifndef QET_PRINT_PREVIEW_DIALOG
|
#ifndef QET_PRINT_PREVIEW_DIALOG
|
||||||
#define QET_PRINT_PREVIEW_DIALOG
|
#define QET_PRINT_PREVIEW_DIALOG
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
#include "exportproperties.h"
|
||||||
class Diagram;
|
class Diagram;
|
||||||
class DiagramsChooser;
|
class DiagramsChooser;
|
||||||
|
class ExportPropertiesWidget;
|
||||||
class QETProject;
|
class QETProject;
|
||||||
/**
|
/**
|
||||||
Cette classe represente un dialogue permettant d'affiner les options
|
Cette classe represente un dialogue permettant d'affiner les options
|
||||||
@@ -40,10 +42,11 @@ class QETPrintPreviewDialog : public QDialog {
|
|||||||
public:
|
public:
|
||||||
DiagramsChooser *diagramsChooser();
|
DiagramsChooser *diagramsChooser();
|
||||||
bool fitDiagramsToPages() const;
|
bool fitDiagramsToPages() const;
|
||||||
|
ExportProperties exportProperties() const;
|
||||||
|
|
||||||
// signaux
|
// signaux
|
||||||
signals:
|
signals:
|
||||||
void paintRequested(const QList<Diagram *> &, bool, QPrinter *);
|
void paintRequested(const QList<Diagram *> &, bool, const ExportProperties, QPrinter *);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void firstPage();
|
void firstPage();
|
||||||
@@ -91,6 +94,7 @@ class QETPrintPreviewDialog : public QDialog {
|
|||||||
QLabel *use_full_page_label_;
|
QLabel *use_full_page_label_;
|
||||||
QCheckBox *fit_diagram_to_page_;
|
QCheckBox *fit_diagram_to_page_;
|
||||||
QLabel *fit_diagram_to_page_label_;
|
QLabel *fit_diagram_to_page_label_;
|
||||||
|
ExportPropertiesWidget *render_properties_;
|
||||||
|
|
||||||
// methodes
|
// methodes
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user