# Hurricane Design Viewer

CellPrinter.h
1
2 // -*- C++ -*-
3 //
4 // This file is part of the Coriolis Software.
5 // Copyright (c) UPMC/LIP6 2012-2018, All Rights Reserved
6 //
7 // +-----------------------------------------------------------------+
8 // | H U R R I C A N E |
9 // | V L S I B a c k e n d D a t a - B a s e |
10 // | |
11 // | Author : Jean-Paul CHAPUT |
12 // | E-mail : Jean-Paul.Chaput@lip6.fr |
13 // | =============================================================== |
14 // | C++ Header : "./hurricane/viewer/CellPrinter.h" |
15 // +-----------------------------------------------------------------+
16
17
18 #ifndef HURRICANE_CELL_PRINTER_H
19 #define HURRICANE_CELL_PRINTER_H
20
21
22 #include <list>
23
24 using namespace std;
25
26 #include <QMainWindow>
27
28 class QEvent;
29 class QKeyEvent;
30 class QAction;
31 class QMenu;
32 class QPainter;
33 class QPrinter;
34
35 #include "hurricane/Commons.h"
36 #include "hurricane/Name.h"
37 #include "hurricane/viewer/CellWidget.h"
38
39
40 namespace Hurricane {
41
42
43 class Cell;
44 class PaletteWidget;
45
46
47 class CellPrinter : public QMainWindow {
48 Q_OBJECT;
49
50 public:
51 static std::string getUserName ();
52 static std::string getTime ( const char* format );
53 static QString getUnitQString ();
54 static QString dbuToPrinterString ( DbU::Unit unit );
55 public:
56 CellPrinter ( QWidget* parent=NULL );
57 virtual ~CellPrinter ();
58 inline CellWidget* getCellWidget ();
59 inline const CellWidget* getCellWidget () const;
60 void setScreenCellWidget ( CellWidget* );
61 inline void setMode ( int mode );
62 inline void setFitOnAbutmentBox ( bool );
63 void createLayout ();
64 inline bool fitOnAbutmentBox () const;
65 inline int resolution () const;
66 inline int frameMargin () const;
67 inline int cartoucheWidth () const;
68 inline int cartoucheHeight () const;
69 inline int titleHeight () const;
70 void pageDecorate ( QPainter& );
71 void toPdf ( QPrinter* , bool imageOnly=false );
72 virtual std::string _getString () const;
73 private:
74 int _scalePixels ( int pixels );
75
76 protected:
77 CellWidget* _screenCellWidget;
78 CellWidget* _cellWidget;
79 PaletteWidget* _palette;
80 QPrinter* _printer;
81 int _dpi;
82 int _mode;
83 int _paperWidth;
84 int _paperHeight;
85 int _frameMargin;
86 int _cartoucheWidth;
87 int _cartoucheHeight;
88 int _titleHeight;
89 int _xpaper;
90 int _ypaper;
91 int _drawingWidth;
92 int _drawingHeight;
93 bool _fitOnAbutmentBox;
94 };
95
96
97 // Inline Functions.
98 inline CellWidget* CellPrinter::getCellWidget () { return _cellWidget; }
99 inline const CellWidget* CellPrinter::getCellWidget () const { return _cellWidget; }
100 inline void CellPrinter::setMode ( int mode ) { _mode = mode; }
101 inline void CellPrinter::setFitOnAbutmentBox ( bool state ) { _fitOnAbutmentBox = state; }
102 inline int CellPrinter::resolution () const { return (_mode == CellWidget::Res_CellMode) ? 150 : 300; }
103 inline bool CellPrinter::fitOnAbutmentBox () const { return _fitOnAbutmentBox; }
104 inline int CellPrinter::frameMargin () const { return _frameMargin*_mode; }
105 inline int CellPrinter::cartoucheWidth () const { return _cartoucheWidth*_mode; }
106 inline int CellPrinter::cartoucheHeight () const { return _cartoucheHeight*_mode; }
107 inline int CellPrinter::titleHeight () const { return _titleHeight*_mode; }
108
109
110 } // Hurricane namespace.
111
112
113 GETSTRING_POINTER_SUPPORT(Hurricane::CellPrinter)
114 IOSTREAM_POINTER_SUPPORT(Hurricane::CellPrinter)
115
116
117 #endif
Hurricane::CellPrinter
Widget to generate PDF file.
Definition: CellPrinter.h:47
std
STL namespace.
Hurricane::DbU::Unit
std::int64_t Unit
Hurricane
Hurricane::CellWidget
The Widget to display a Cell.
Definition: CellWidget.h:84

Generated by doxygen 1.8.14 on Tue Jul 21 2020 | Return to top of page

Hurricane Design Viewer | Copyright © 2008-2016 UPMC All rights reserved