coriolis/hurricane/doc/viewer/CellPrinter.dox

119 lines
4.7 KiB
Plaintext
Raw Normal View History

// -*- C++ -*-
namespace Hurricane {
/*! \class CellPrinter
* \brief Widget to generate PDF file.
*
*
* \section secPrinterBasicUsage Basic Usage
*
* CellPrinter is a simple Qt Widget to write the contents of a CellWidget
* into a QPrinter. As it may uses lots of memory (due to the high-res bitmaps)
* it is advisable to delete it immediatly after usage. The same rendering engine
* is used to both display on screen and onto the printer so it is a "What You
* See Is What You Get" mode (except for the higher resolution). It optionaly
* adds a frame and a cartouche (on by default).
*
* \see CellImage.
*
* It's use is straigtforward, as shown in the example below. It consist
* of four steps:
* <ol>
* <li>Widget allocation.
* <li>Bind to a screen CellWidget (CellPrinter::setScreenCellWidget()).
* <li>Draw into a QPrinter (CellPrinter::toPdf()).
* <li>Delete the widget.
* </ol>
*
* Code example (took from CellViewer):
Enhanced techno rule support. Inspector support bug fix. * Bug: In Hurricane/Commons.h, modify the getRecord<>() templates so that for both vector<Element> and vector<Element*>, the individual record created for each element are donne with pointers. That is, for the vector<Element> case, we take a pointer. As a general policy, except for the POD types, always use pointers or references to data in the records/inspector. Never uses values that can call the copy constructor. Suppress INSPECTOR_PV_SUPPORT() macro, keep only INSPECTOR_PR_SUPPORT(). Provide value support only for getString<>() template. This value & copy constructor problem was causing a crash when trying to inspect Hurricane::AnalogCellExtension. * New: In Hurricane::Technology, change the API of the PhysicalRule, now we can only create/get PhysicalRule, but setting the value of the rule itself must be done on the rule. Enhance PhysicalRule to provide for stepped rules, non isotropic and ratio rules. Merge TwoLayersPhysicalrule in PhysicalRule, much simpler to suppress the management of derived classes. That means that we loose a little memory as some fields are mutually exclusive. Not a problem considering that there will not be so many of thoses objects. * New: In CRL/helpers.analogtechno.py, enhanced DTR support for rules like: ('minSpacing' , 'metal1', ((0.4,20.0), (0.8,1000.0)), Length, 'REF.1') ('minEnclosure', 'metal1', 'cut1', (0.2,0.3) , Length, 'REF.2') ('minDensity' , 'metal1', 0.30 , Unit , 'REF.3') The DTR parser has been updated, but not the oroshi.dtr Rule cache for analog components. Given a rule name, the value used will be the horizontal one of the first step. * Change: In hurricane/doc/hurricane, re-generate the documentation with updated support for Technology & PhysicalRule.
2020-07-21 04:22:04 -05:00
*
\code
void CellViewer::printDisplay ()
{
if (_cellWidget == NULL) return;
if (_cellWidget->getCell() == NULL) {
cerr << Warning("Unable to print, no cell loaded yet.") << endl;
return;
}
QPrinter printer( QPrinter::ScreenResolution );
printer.setPaperSize
( (QPrinter::PaperSize)Cfg::getParamEnumerate("viewer.printer.paper",0)->asInt() );
printer.setOutputFileName ( "unicorn-snapshot.pdf" );
QPrintDialog dialog ( &printer );
if ( dialog.exec() == QDialog::Accepted ) {
CellPrinter* cellPrinter = new CellPrinter();
cellPrinter->setScreenCellWidget( _cellWidget );
cellPrinter->toPdf ( &printer, false );
delete cellPrinter;
}
}
\endcode
*
* \remark The generated PDF file are bitmaps, so they can grew very large if
* you uses paper above A2...
*
*
* \section secPrinterConfiguration Configuration Variables
*
* The CellPrinter reads the following configuration variables for
* it's defaults settings (they are located in \c misc.conf, for
* the system-wide settings).
* <ul>
* <li>\c "viewer.printer.mode", select between the two resolution
* modes (Cell or Design).
* <li>\c "viewer.printer.paper", the output paper size, should be
* one value from the QPrinter::PaperSize enumeration.
* </ul>
*
*
* \section secPrinterImplDetails Implementation details
*
* This widget is build as a QMainWindow (top-level) one
* encapsulating only a CellWidget. It is configured to never been
* shown thanks to the \c Qt::WA_DontShowOnScreen attribute, but
* all the display computations still takes place as if it actually
* was.
*
* To obtain a sufficent resolution the CellPrinter/CellWidget are
* resized to the resolution of the printed page. For a better look
* select a display style with patterns of 32x32 pixels, such as
* \c "Printer.Coriolis".
*/
/*! \function CellPrinter::CellPrinter(QWidget* parent=NULL);
* Construct a CellPrinter window no screen CellWidget is actually bound.
*/
/*! \function CellPrinter::~CellPrinter();
* Destructor.
*/
/*! \function void CellPrinter::setScreenCellWidget(CellWidget* screenCellWidget);
* Bind the CellPrinter to the screen CellWidget \c screenCellWidget.
* It is those contents that will be printed.
*/
/*! \function void CellPrinter::setMode(int mode);
* Sets the display mode, that is the resolution that will be used.
* Two modes are availables:
* <ul>
* <li>CellWidget::Res_CellMode: (approx. 150 dpi), best suited for
* displaying lone Cell or very small scale designs.
* <li>CellWidget::Res_DesignMode: (approx. 300 dpi), for full
* fledged designs.
* </ul>
*/
/*! \function void CellPrinter::toPdf(QPrinter* printer, bool imageOnly=false);
* \param printer The QPrinter to draw into.
* \param imageOnly Whether to add the frame & cartouche or not.
*
* Perform the drawing operation on the QPrinter.
*/
}