# Hurricane Design Viewer

CellWidget.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC/LIP6 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | V L S I B a c k e n d D a t a - B a s e |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./hurricane/viewer/CellWidget.h" |
14 // +-----------------------------------------------------------------+
15
16
17 #ifndef HURRICANE_CELL_WIDGET_H
18 #define HURRICANE_CELL_WIDGET_H
19
20 #include <math.h>
21 #include <vector>
22 #include <functional>
23 #include <memory>
24 #include <boost/function.hpp>
25 #include <QWidget>
26 #include <QPixmap>
27 #include <QPainter>
28 #include <QPrinter>
29 #include <QImage>
30 #include <QRect>
31 #include <QPoint>
32 class QCursor;
33 class QShowEvent;
34 class QResizeEvent;
35 class QMouseEvent;
36 class QKeyEvent;
37 class QAction;
38
39 #include "hurricane/Timer.h"
40 #include "hurricane/Commons.h"
41 #include "hurricane/Warning.h"
42 #include "hurricane/Point.h"
43 #include "hurricane/Box.h"
44 #include "hurricane/Transformation.h"
45 #include "hurricane/Query.h"
46 #include "hurricane/viewer/DisplayStyle.h"
47 #include "hurricane/viewer/CellWidgets.h"
48 #include "hurricane/viewer/Selector.h"
49 #include "hurricane/viewer/SelectorCriterion.h"
50 #include "hurricane/viewer/Ruler.h"
51
52
53 namespace Hurricane {
54
55 using std::vector;
56 using std::unary_function;
57 using std::shared_ptr;
58
59 class Technology;
60 class BasicLayer;
61 class Go;
62 class Net;
63 class Cell;
64 class Instance;
65 class Slice;
66 class Segment;
67 class Contact;
68 class Pad;
69 class Selector;
70 class PaletteWidget;
71 class Command;
72 //class MapView;
73
74 enum UpdateState { ExternalEmit = 0
75 , InternalEmit
76 , InternalReceive
77 };
78
79
80 // -------------------------------------------------------------------
81 // Class : "Hurricane::CellWidget".
82
83
84 class CellWidget : public QWidget {
85 Q_OBJECT;
86
87 private:
88 class DrawingPlanes;
89 public:
90 class State;
91 typedef void ( DrawExtensionGo_t )( CellWidget*
92 , const Go*
93 , const BasicLayer*
94 , const Box&
95 , const Transformation&
96 );
97 typedef void ( InitExtensionGo_t )( CellWidget* );
98 typedef boost::function< void(QPainter&) > PainterCb_t;
99 enum RubberShape { Centric=1, Barycentric, Steiner };
100 enum TextFlag { Bold =0x0001
101 , BigFont =0x0002
102 , Reverse =0x0004
103 , Frame =0x0008
104 , Rounded =0x0010
105 , Center =0x0020
106 , Left =0x0040
107 , Right =0x0080
108 , Top =0x0100
109 };
110 enum Flag { NoFlags =0x0000
111 , NoResetCommands=0x0001
112 };
113 public:
114 enum ResolutionMode { Res_CellMode=1, Res_DesignMode=2 };
115 public:
116 // Constructor & Destructor.
117 CellWidget ( QWidget* parent=NULL );
118 virtual ~CellWidget ();
119 // Accessors.
120 // MapView* getMapView () { return _mapView; };
121 void setCell ( Cell*, Path topPath=Path(), unsigned int flags=NoFlags );
122 inline Cell* getCell () const;
123 inline Cell* getTopCell () const;
124 inline Path getTopPath () const;
125 inline shared_ptr<State>& getState ();
126 inline shared_ptr<State> getStateClone ();
127 inline PaletteWidget* getPalette ();
128 inline Occurrences getOccurrencesUnder ( const QRect& ) const;
129 Occurrences getOccurrencesUnder ( const Box& ) const;
130 inline SelectorSet& getSelectorSet ();
131 inline RulerSet& getRulerSet ();
132 inline RubberShape getRubberShape () const;
133 inline int getStartLevel () const;
134 inline int getStopLevel () const;
135 inline Query::Mask getQueryFilter () const ;
136 void bindToPalette ( PaletteWidget* );
137 void detachFromPalette ();
138 void detach ( Selector*);
139 void bindCommand ( Command* );
140 void unbindCommand ( Command* );
141 void resetCommands ();
142 inline void setActiveCommand ( Command* );
143 inline Command* getActiveCommand () const;
144 Command* getCommand ( const std::string& ) const;
145 inline void resetActiveCommand ();
146 inline void setCursorStep ( DbU::Unit );
147 inline void setRealSnapGridStep ( DbU::Unit step );
148 inline unsigned int getDbuMode () const;
149 inline bool gridMode () const;
150 inline bool symbolicMode () const;
151 inline bool physicalMode () const;
152 inline DbU::UnitPower getUnitPower () const;
153 inline bool showBoundaries () const;
154 inline bool showSelection () const;
155 inline bool cumulativeSelection () const;
156 inline void setDbuMode ( int );
157 inline void setUnitPower ( DbU::UnitPower );
158 inline void setRubberShape ( RubberShape );
159 inline void setStartLevel ( int );
160 inline void setStopLevel ( int );
161 inline void setQueryFilter ( Query::Mask );
162 inline bool timeout ( const char*, const Timer&, double timeout, bool& timedout ) const;
163 // Painter control & Hurricane objects drawing primitives.
164 inline void setEnableRedrawInterrupt ( bool );
165 inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* );
166 inline void copyDrawExtensionGos ( const CellWidget* );
167 inline QPainter& getPainter ( size_t plane=PlaneId::Working );
168 inline const DisplayStyle::HSVr& getDarkening () const;
169 inline void copyToPrinter ( int xpaper, int ypaper, QPrinter*, PainterCb_t& );
170 inline void copyToImage ( QImage*, PainterCb_t& );
171 inline const float& getScale () const;
172 inline const QPoint& getMousePosition () const;
173 inline void updateMousePosition ();
174 void setLayerVisible ( const Name& layer, bool visible );
175 bool isLayerVisible ( const Name& );
176 bool isDrawable ( const Name& );
177 bool isDrawableLayer ( const Name& );
178 bool isDrawableExtension ( const Name& );
179 bool isSelectable ( const Name& ) const;
180 bool isSelectable ( const Layer* ) const;
181 bool isPrinter () const;
182 void setPrinter ( bool );
183 inline void setDarkening ( const DisplayStyle::HSVr& );
184 inline void setPen ( const QPen& , size_t plane=PlaneId::Working );
185 void drawBox ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
186 void drawBox ( const Box& );
187 void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit, bool mode=true );
188 void drawLine ( const Point&, const Point&, bool mode=true );
189 void drawText ( const Point&, const char*, unsigned int flags=0, int angle=0 );
190 void drawGrid ( QRect );
191 void drawSpot ();
192 void drawRuler ( shared_ptr<Ruler> );
193 void drawRulers ( QRect );
194 void drawDisplayText ( const QRect& , const char*, unsigned int flags=0 );
195 void drawDisplayText ( const QPoint&, const char*, unsigned int flags=0, int angle=0 );
196 void drawScreenPolygon ( const QPoint*, int count, size_t plane=PlaneId::Working );
197 void drawScreenPolygon ( const QPolygon&, size_t plane=PlaneId::Working );
198 void drawScreenLine ( const QPoint&, const QPoint&, size_t plane=PlaneId::Working, bool mode=true );
199 void drawScreenRect ( const QPoint&, const QPoint&, size_t plane=PlaneId::Working );
200 void drawScreenRect ( const QRect& , size_t plane=PlaneId::Working );
201 void drawScreenPolyline ( const QPoint*, int, int, size_t plane=PlaneId::Working );
202 // Geometric conversions.
203 inline DbU::Unit toDbu ( float ) const;
204 QRect dbuToScreenRect ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2, bool usePoint=true ) const;
205 QRect dbuToScreenRect ( const Box& box , bool usePoint=true ) const;
206 inline int dbuToScreenX ( DbU::Unit x ) const;
207 inline int dbuToScreenY ( DbU::Unit y ) const;
208 inline int dbuToScreenLength ( DbU::Unit length ) const;
209 inline QPoint dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const;
210 inline QPoint dbuToScreenPoint ( const Point& point ) const;
211 inline DbU::Unit screenToDbuLength ( int length ) const;
212 inline DbU::Unit screenToDbuX ( int x ) const;
213 inline DbU::Unit screenToDbuY ( int y ) const;
214 inline Point screenToDbuPoint ( const QPoint& point ) const;
215 inline Box screenToDbuBox ( const QRect& rect ) const;
216 inline Box& pixelInflate ( Box&, int pixels ) const;
217 inline Point getTopLeft () const;
218 inline Box getVisibleArea () const;
219 Box computeVisibleArea ( float scale ) const;
220 Box computeVisibleArea ( float scale, const Point& topLeft ) const;
221 Box computeVisibleArea ( const Box&, float& scale ) const;
222 inline DbU::Unit cursorStep () const;
223 inline bool _underDetailedGridThreshold() const;
224 inline DbU::Unit _snapGridStep () const;
225 inline DbU::Unit _onSnapGrid ( DbU::Unit ) const;
226 inline Point _onSnapGrid ( const Point& ) const;
227 inline DbU::Unit _onCursorGrid ( DbU::Unit ) const;
228 inline Point _onCursorGrid ( const Point& ) const;
229 // Qt QWidget Functions Overloads.
230 void pushCursor ( Qt::CursorShape cursor );
231 void popCursor ();
232 virtual QSize minimumSizeHint () const;
233 virtual void showEvent ( QShowEvent* );
234 virtual void resizeEvent ( QResizeEvent* );
235 virtual void wheelEvent ( QWheelEvent* );
236 virtual void keyPressEvent ( QKeyEvent* );
237 virtual void keyReleaseEvent ( QKeyEvent* );
238 virtual void mouseMoveEvent ( QMouseEvent* );
239 virtual void mousePressEvent ( QMouseEvent* );
240 virtual void mouseReleaseEvent ( QMouseEvent* );
241 signals:
242 void cellChanged ( Cell* );
243 void cellPreModificated ();
244 void cellPostModificated ();
245 void stateChanged ( shared_ptr<CellWidget::State>& );
246 void styleChanged ();
247 void queryFilterChanged ();
248 void dbuModeChanged ( unsigned int mode, DbU::UnitPower );
249 void updatePalette ( Cell* );
250 void mousePositionChanged ( const Point& position );
251 void selectionModeChanged ();
252 void selectionChanged ( const SelectorSet& );
253 void selectionToggled ( Selector* );
254 void unlinkSelector ( Selector* );
255 void showBoundariesToggled ( bool );
256 protected:
257 virtual void paintEvent ( QPaintEvent* );
258 public slots:
259 // Qt QWidget Slots Overload & CellWidget Specifics.
260 void setState ( shared_ptr<CellWidget::State>&
261 , unsigned int flags=NoFlags );
262 inline void openRefreshSession ();
263 inline void closeRefreshSession ();
264 inline DrawingPlanes& getDrawingPlanes ();
265 // void select ( const Net* );
266 void select ( Occurrence );
267 bool isSelected ( Occurrence );
268 void selectOccurrencesUnder ( Box selectArea );
269 // void unselect ( const Net* );
270 void unselect ( Occurrence );
271 void unselectAll ();
272 void toggleSelection ( Occurrence );
273 void setShowSelection ( bool state );
274 void setCumulativeSelection ( bool state );
275 // void _select ( const Net* );
276 // void _unselect ( const Net* );
277 // void _selectOccurrencesUnder ( Box selectArea );
278 void _unselectAll ();
279 inline void addRuler ( const Point&, const Point& );
280 inline void addRuler ( shared_ptr<Ruler> );
281 inline void clearRulers ();
282 void changeQueryFilter ();
283 void rubberChange ();
284 void changeDbuMode ( unsigned int mode, DbU::UnitPower );
285 void setStyle ( int id );
286 void updatePalette ();
287 void cellPreModificate ();
288 void cellPostModificate ();
289 inline void refresh ();
290 void _redraw ( QRect redrawArea );
291 inline void redrawSelection ();
292 void redrawSelection ( QRect redrawArea );
293 void goLeft ( int dx = 0 );
294 void goRight ( int dx = 0 );
295 void goUp ( int dy = 0 );
296 void goDown ( int dy = 0 );
297 void fitToContents ( bool historyEnable=true );
298 void fitToNet ( const Net*, bool historyEnable=true );
299 void setScale ( float );
300 void scaleHistoryUp ();
301 void scaleHistoryDown ();
302 // void setGridMode ();
303 // void setSymbolicMode ();
304 // void setPhysicalMode ( DbU::UnitPower );
305 void setShowBoundaries ( bool state );
306 void reframe ();
307 void reframe ( const Box& box, bool historyEnable=true );
308 void displayReframe ();
309 void _goLeft ( int dx );
310 void _goRight ( int dx );
311 void _goUp ( int dy );
312 void _goDown ( int dy );
313 void _refresh ();
314 std::string _getString () const;
315
316 private:
317 class Spot {
318 public:
319 Spot ( CellWidget* );
320 void setRestore ( bool );
321 inline void setShowSpot ( bool );
322 inline const QPoint& getSpotPoint () const;
323 void restore ();
324 QPoint computeSpotPoint ( const QPoint& );
325 void moveTo ( const QPoint& );
326 private:
327 CellWidget* _cellWidget;
328 QPoint _spotPoint;
329 bool _restore;
330 bool _showSpot;
331 };
332
333 private:
334 class RedrawEvent {
335 public:
336 enum EventType { GoLeft = 1
337 , GoRight = 2
338 , GoUp = 3
339 , GoDown = 4
340 , Refresh = 5
341 };
342 public:
343 RedrawEvent ( EventType, int shift, CellWidget* );
344 inline EventType getType () const;
345 inline int getShift () const;
346 private:
347 EventType _type;
348 int _shift;
349 };
350
351 private:
352 class RedrawManager {
353 public:
354 inline RedrawManager ( CellWidget* );
355 ~RedrawManager ();
356 void goLeft ( int );
357 void goRight ( int );
358 void goUp ( int );
359 void goDown ( int );
360 void refresh ();
361 void process ();
362 inline void stopProcessing ();
363 inline bool isProcessing () const;
364 inline bool interrupted () const;
365 inline size_t getPendings () const;
366 inline void openRefreshSession ();
367 inline void closeRefreshSession ();
368 private:
369 CellWidget* _widget;
370 list<RedrawEvent*> _events;
371 int _refreshSession;
372 bool _processing;
373 bool _interrupted;
374 };
375
376 public:
377 class PlaneId {
378 public:
379 enum Ids { Normal = 0 // _planes[0]
380 , Selection = 1 // _planes[1]
381 , AutoCopy = 2 // _planes[2]
382 , Widget = 3
383 , Printer = 4
384 , Image = 5
385 , Working = 6
386 };
387 };
388
389 private:
390 class DrawingPlanes {
391 public:
392 DrawingPlanes ( const QSize& size, CellWidget* cw );
393 ~DrawingPlanes ();
394 inline bool getLineMode () const;
395 inline size_t getWorkingPlane () const;
396 inline void pushWorkingPlane ();
397 inline void popWorkingPlane ();
398 inline int width () const;
399 inline int height () const;
400 inline QSize size () const;
401 inline void select ( size_t i );
402 inline QPainter& painter ( size_t i=PlaneId::Working );
403 inline void begin ( size_t i=PlaneId::Working );
404 inline void end ( size_t i=PlaneId::Working );
405 inline void buffersBegin ();
406 inline void buffersEnd ();
407 void setLineMode ( bool mode );
408 void setPen ( const QPen& pen );
409 void setBrush ( const QBrush& brush );
410 void setBackground ( const QBrush& brush );
411 void setBackgroundMode ( Qt::BGMode mode );
412 void resize ( const QSize& size );
413 void shiftLeft ( int dx );
414 void shiftRight ( int dx );
415 void shiftUp ( int dy );
416 void shiftDown ( int dy );
417 inline void copyToSelect ();
418 inline void copyToSelect ( const QRect& );
419 void copyToSelect ( int sx, int sy, int h, int w );
420 inline void copyToScreen ();
421 void copyToScreen ( int sx, int sy, int h, int w );
422 inline void copyToPrinter ( int xpaper, int ypaper, QPrinter*, CellWidget::PainterCb_t& );
423 void copyToPrinter ( int xpaper, int ypaper, int sx, int sy, int h, int w, QPrinter*, CellWidget::PainterCb_t& );
424 inline void copyToImage ( QImage*, CellWidget::PainterCb_t& );
425 void copyToImage ( int sx, int sy, int h, int w, QImage*, CellWidget::PainterCb_t& );
426 private:
427 static const int _cartoucheWidth;
428 static const int _cartoucheHeight;
429 static const int _titleHeight;
430 CellWidget* _cellWidget;
431 QPrinter* _printer;
432 QImage* _image;
433 QPixmap* _planes[3];
434 QPainter _painters[PlaneId::Working];
435 QPen _normalPen;
436 QPen _linePen;
437 QPoint _brushOrigin;
438 size_t _workingPlane;
439 size_t _pushWorkingPlane;
440 bool _lineMode;
441 private:
442 DrawingPlanes ( const DrawingPlanes& );
443 DrawingPlanes& operator= ( const DrawingPlanes& );
444 };
445
446 private:
447 class DrawingQuery : public Query {
448 public:
449 DrawingQuery ( CellWidget* widget );
450 inline void setQuery ( const Box& area
451 , const Transformation& transformation
452 , const BasicLayer* basicLayer
453 , ExtensionSlice::Mask extensionMask
454 , unsigned int filter
455 );
456 inline void addDrawExtensionGo ( const Name&
457 , InitExtensionGo_t*
458 , DrawExtensionGo_t*
459 );
460 inline void copyDrawExtensionGos ( const DrawingQuery& );
461 void setDrawExtensionGo ( const Name& );
462 virtual bool hasMasterCellCallback () const;
463 virtual bool hasGoCallback () const;
464 virtual bool hasMarkerCallback () const;
465 virtual bool hasRubberCallback () const;
466 virtual bool hasExtensionGoCallback () const;
467 virtual void masterCellCallback ();
468 virtual void goCallback ( Go* );
469 virtual void rubberCallback ( Rubber* );
470 virtual void markerCallback ( Marker* );
471 virtual void extensionGoCallback ( Go* );
472 void drawMasterCell ( const Cell* cell
473 , const Transformation& transformation
474 );
475 void drawGo ( const Go* go
476 , const BasicLayer* basicLayer
477 , const Box& area
478 , const Transformation& transformation
479 );
480 void drawRubber ( const Rubber* rubber
481 , const Box& area
482 , const Transformation& transformation
483 );
484 void drawMarker ( const Marker* marker
485 , const Box& area
486 , const Transformation& transformation
487 );
488 void drawExtensionGo ( CellWidget* widget
489 , const Go* go
490 , const BasicLayer* basicLayer
491 , const Box& area
492 , const Transformation& transformation
493 );
494 inline unsigned int getGoCount () const;
495 inline unsigned int getExtensionGoCount () const;
496 inline unsigned int getInstanceCount () const;
497 inline void resetGoCount ();
498 inline void resetExtensionGoCount ();
499 inline void resetInstanceCount ();
500
501 protected:
502 CellWidget* _cellWidget;
503 DrawExtensionGo_t* _drawExtensionGo;
504 map<Name,pair<InitExtensionGo_t*,DrawExtensionGo_t*> >
505 _drawExtensionGos;
506 unsigned int _goCount;
507 unsigned int _extensionGoCount;
508 unsigned int _instanceCount;
509 };
510
511 private:
512 class TextDrawingQuery : public Query {
513 public:
514 TextDrawingQuery ( CellWidget* widget );
515 inline void setQuery ( const Box& area
516 , const Transformation& transformation
517 );
518 virtual bool hasMasterCellCallback () const;
519 virtual bool hasGoCallback () const;
520 virtual bool hasRubberCallback () const;
521 virtual bool hasExtensionGoCallback () const;
522 virtual void masterCellCallback ();
523 virtual void goCallback ( Go* go );
524 virtual void extensionGoCallback ( Go* go );
525 virtual void rubberCallback ( Rubber* );
526
527 protected:
528 CellWidget* _cellWidget;
529 };
530
531 private:
532 class SelectorCriterions {
533 public:
534 SelectorCriterions ();
535 ~SelectorCriterions ();
536 inline void setCellWidget ( CellWidget* );
537 inline const vector<SelectorCriterion*>& getCriterions () const;
538 SelectorCriterion* add ( const Net* net );
539 SelectorCriterion* add ( Box area );
540 inline SelectorCriterion* add ( SelectorCriterion* );
541 bool remove ( const Net* net );
542 void clear ();
543 void invalidate ();
544 void revalidate ();
545 inline size_t size () const;
546 private:
547 CellWidget* _cellWidget;
548 vector<SelectorCriterion*> _criterions;
549 };
550
551 public:
552 class State {
553 public:
554 inline State ( Cell* cell=NULL, Path topPath=Path() );
555 State* clone () const;
556 inline void setCell ( Cell* );
557 inline void setTopPath ( Path );
558 inline void setCellWidget ( CellWidget* );
559 inline void setCursorStep ( DbU::Unit );
560 inline DbU::Unit getCursorStep () const;
561 inline DbU::UnitPower getUnitPower () const;
562 inline void setDbuMode ( int );
563 inline void setUnitPower ( DbU::UnitPower );
564 inline void setShowBoundaries ( bool );
565 inline void setShowSelection ( bool );
566 inline void setCumulativeSelection ( bool );
567 void setScale ( float );
568 inline void setTopLeft ( DbU::Unit, DbU::Unit );
569 inline void setTopLeft ( const Point& );
570 inline void setQueryFilter ( Query::Mask );
571 inline void setStartLevel ( int );
572 inline void setStopLevel ( int );
573 inline void setRubberShape ( RubberShape );
574 inline void setHistoryEnable ( bool );
575 bool scaleHistoryUp ();
576 bool scaleHistoryDown ();
577 inline Cell* getCell () const;
578 inline Cell* getTopCell () const;
579 inline Path getTopPath () const;
580 const Name& getName () const;
581 inline SelectorCriterions& getSelection ();
582 inline RulerSet& getRulers ();
583 inline DbU::Unit cursorStep () const;
584 inline unsigned int getDbuMode () const;
585 inline bool gridMode () const;
586 inline bool symbolicMode () const;
587 inline bool physicalMode () const;
588 inline bool nanoMode () const;
589 inline bool microMode () const;
590 inline bool showBoundaries () const;
591 inline bool showSelection () const;
592 inline bool cumulativeSelection () const;
593 inline bool getHistoryEnable () const;
594 inline size_t getHistorySize () const;
595 inline const float& getScale () const;
596 inline const Point& getTopLeft () const;
597 inline Query::Mask getQueryFilter () const;
598 inline int getStartLevel () const;
599 inline int getStopLevel () const;
600 inline RubberShape getRubberShape () const;
601
602 private:
603 class ScaleEntry {
604 public:
605 inline ScaleEntry ( float, const Point& );
606 public:
607 float _scale;
608 Point _topLeft;
609 };
610
611 private:
612 Cell* _cell;
613 Path _topPath;
614 Name _hierarchicalName;
615 CellWidget* _cellWidget;
616 SelectorCriterions _selection;
617 RulerSet _rulers;
618 DbU::Unit _cursorStep;
619 unsigned int _dbuMode;
620 DbU::UnitPower _unitPower;
621 bool _showBoundaries;
622 bool _showSelection;
623 Query::Mask _queryFilter;
624 int _startLevel;
625 int _stopLevel;
626 RubberShape _rubberShape;
627 bool _cumulativeSelection;
628 vector<ScaleEntry> _scaleHistory;
629 size_t _ihistory;
630 bool _historyEnable;
631 };
632 public:
633 class FindStateName : public unary_function< const shared_ptr<State>&, bool > {
634 public:
635 inline FindStateName ( const Name& );
636 inline bool operator() ( const shared_ptr<State>& );
637 private:
638 const Name _cellHierName;
639 };
640
641 protected:
642 // Internal: Attributes.
643 static int _initialSide;
644 vector<Qt::CursorShape> _cursors;
645 // MapView* _mapView;
646 Technology* _technology;
647 PaletteWidget* _palette;
648 Box _screenArea;
649 RedrawManager _redrawManager;
650 DrawingPlanes _drawingPlanes;
651 DrawingQuery _drawingQuery;
652 TextDrawingQuery _textDrawingQuery;
653 DisplayStyle::HSVr _darkening;
654 QPoint _mousePosition;
655 Spot _spot;
656 shared_ptr<State> _state;
657 bool _isPrinter;
658 bool _cellChanged;
659 bool _selectionHasChanged;
660 int _delaySelectionChanged;
661 bool _cellModificated;
662 bool _enableRedrawInterrupt;
663 SelectorSet _selectors;
664 Command* _activeCommand;
665 vector<Command*> _commands;
666 size_t _redrawRectCount;
667 int _textFontHeight;
668
669 friend class RedrawManager;
670 };
671
672
673 inline void CellWidget::Spot::setShowSpot ( bool show )
674 { _showSpot = show; }
675
676
677 inline const QPoint& CellWidget::Spot::getSpotPoint () const
678 { return _spotPoint; }
679
680
681 inline void CellWidget::DrawingQuery::setQuery ( const Box& area
682 , const Transformation& transformation
683 , const BasicLayer* basicLayer
684 , ExtensionSlice::Mask extensionMask
685 , unsigned int filter
686 )
687 {
688 Query::setQuery ( _cellWidget->getCell()
689 , area
690 , transformation
691 , basicLayer
692 , extensionMask
693 , filter
694 );
695 }
696
697
698 inline void CellWidget::setEnableRedrawInterrupt ( bool state )
699 { _enableRedrawInterrupt = state; }
700
701
702 inline void CellWidget::openRefreshSession ()
703 { _redrawManager.openRefreshSession (); }
704
705
706 inline void CellWidget::closeRefreshSession ()
707 { _redrawManager.closeRefreshSession (); }
708
709
710 inline void CellWidget::DrawingQuery::addDrawExtensionGo ( const Name& name
711 , InitExtensionGo_t* initExtensionGo
712 , DrawExtensionGo_t* drawExtensionGo
713 )
714 { _drawExtensionGos[name] = make_pair(initExtensionGo,drawExtensionGo); }
715
716
717 inline void CellWidget::DrawingQuery::copyDrawExtensionGos ( const CellWidget::DrawingQuery& other )
718 { _drawExtensionGos = other._drawExtensionGos; }
719
720
721 inline void CellWidget::DrawingQuery::resetGoCount ()
722 { _goCount = 0; }
723
724
725 inline void CellWidget::DrawingQuery::resetExtensionGoCount ()
726 { _extensionGoCount = 0; }
727
728
729 inline void CellWidget::DrawingQuery::resetInstanceCount ()
730 { _instanceCount = 0; }
731
732
733 inline unsigned int CellWidget::DrawingQuery::getGoCount () const
734 { return _goCount; }
735
736
737 inline unsigned int CellWidget::DrawingQuery::getExtensionGoCount () const
738 { return _extensionGoCount; }
739
740
741 inline unsigned int CellWidget::DrawingQuery::getInstanceCount () const
742 { return _instanceCount; }
743
744
745 inline CellWidget::RedrawEvent::EventType CellWidget::RedrawEvent::getType () const
746 { return _type; }
747
748
749 inline int CellWidget::RedrawEvent::getShift () const
750 { return _shift; }
751
752
753 inline bool CellWidget::RedrawManager::isProcessing () const
754 { return _processing; }
755
756
757 inline void CellWidget::RedrawManager::stopProcessing ()
758 { _processing = false; }
759
760
761 inline size_t CellWidget::RedrawManager::getPendings () const
762 { return _events.size(); }
763
764
765 inline void CellWidget::RedrawManager::openRefreshSession ()
766 { _refreshSession++; }
767
768
769 inline void CellWidget::RedrawManager::closeRefreshSession ()
770 {
771 _refreshSession--;
772 if ( !_processing && (_refreshSession == 0) ) process ();
773 }
774
775
776 inline bool CellWidget::RedrawManager::interrupted () const
777 {
778 #ifdef ALLOW_REQUEST_INTERRUPT
779 return ( _events.size() > 5 ) || _interrupted;
780 #else
781 return _interrupted;
782 #endif
783 }
784
785
786 inline bool CellWidget::DrawingPlanes::getLineMode () const
787 { return _lineMode; }
788
789
790 inline size_t CellWidget::DrawingPlanes::getWorkingPlane () const
791 { return _workingPlane; }
792
793
794 inline void CellWidget::DrawingPlanes::pushWorkingPlane ()
795 { _pushWorkingPlane = _workingPlane; }
796
797
798 inline void CellWidget::DrawingPlanes::popWorkingPlane ()
799 { _workingPlane = _pushWorkingPlane; }
800
801
802 inline int CellWidget::DrawingPlanes::width () const
803 { return _planes[PlaneId::Normal]->width(); }
804
805
806 inline int CellWidget::DrawingPlanes::height () const
807 { return _planes[PlaneId::Normal]->height(); }
808
809
810 inline QSize CellWidget::DrawingPlanes::size () const
811 { return _planes[PlaneId::Normal]->size(); }
812
813
814 inline void CellWidget::DrawingPlanes::select ( size_t i )
815 { _workingPlane = i; }
816
817
818 inline QPainter& CellWidget::DrawingPlanes::painter ( size_t i )
819 { return _painters[ (i>=PlaneId::Working) ? _workingPlane : i ]; }
820
821
822 inline void CellWidget::DrawingPlanes::begin ( size_t i )
823 {
824 size_t wp = (i>=PlaneId::Working) ? _workingPlane : i;
825 switch ( wp ) {
826 case PlaneId::Normal:
827 case PlaneId::Selection:
828 case PlaneId::AutoCopy: _painters[wp ].begin( _planes[wp] ); break;
829 case PlaneId::Widget: _painters[PlaneId::Widget ].begin( _cellWidget ); break;
830 case PlaneId::Printer: _painters[PlaneId::Printer].begin( _printer ); break;
831 case PlaneId::Image: _painters[PlaneId::Image ].begin( _image ); break;
832 default:
833 std::cerr << "[BUG] Bad plane selection." << std::endl;
834 }
835 }
836
837
838 inline void CellWidget::DrawingPlanes::end ( size_t i )
839 { _painters[(i>=PlaneId::Working)?_workingPlane:i].end (); }
840
841
842 inline void CellWidget::DrawingPlanes::buffersBegin ()
843 {
844 begin( PlaneId::Normal );
845 begin( PlaneId::Selection );
846 begin( PlaneId::AutoCopy );
847 }
848
849
850 inline void CellWidget::DrawingPlanes::buffersEnd ()
851 {
852 end( PlaneId::Normal );
853 end( PlaneId::Selection );
854 end( PlaneId::AutoCopy );
855 }
856
857
858 inline void CellWidget::DrawingPlanes::copyToSelect ()
859 { copyToSelect ( 0, 0, width(), height() ); }
860
861
862 inline void CellWidget::DrawingPlanes::copyToSelect ( const QRect& r )
863 { copyToSelect ( r.x(), r.y(), r.width(), r.height() ); }
864
865
866 inline void CellWidget::DrawingPlanes::copyToScreen ()
867 { copyToScreen ( 0, 0, width(), height() ); }
868
869
870 inline void CellWidget::DrawingPlanes::copyToPrinter ( int xpaper, int ypaper, QPrinter* printer, CellWidget::PainterCb_t& cb )
871 {
872 copyToPrinter ( xpaper
873 , ypaper
874 , 0
875 , 0
876 , _cellWidget->geometry().width()
877 , _cellWidget->geometry().height()
878 , printer
879 , cb
880 );
881 }
882
883
884 inline void CellWidget::DrawingPlanes::copyToImage ( QImage* image, CellWidget::PainterCb_t& cb )
885 {
886 copyToImage ( 0
887 , 0
888 , _cellWidget->geometry().width()
889 , _cellWidget->geometry().height()
890 , image
891 , cb
892 );
893 }
894
895
896 inline void CellWidget::SelectorCriterions::setCellWidget ( CellWidget* cw )
897 { _cellWidget = cw; }
898
899
900 inline size_t CellWidget::SelectorCriterions::size () const
901 { return _criterions.size(); }
902
903
904 inline const vector<SelectorCriterion*>& CellWidget::SelectorCriterions::getCriterions () const
905 { return _criterions; }
906
907
908 inline SelectorCriterion* CellWidget::SelectorCriterions::add ( SelectorCriterion* criterion )
909 {
910 _criterions.push_back( criterion );
911 return _criterions.back();
912 }
913
914
915 inline CellWidget::State::ScaleEntry::ScaleEntry ( float scale, const Point& topLeft )
916 : _scale(scale), _topLeft(topLeft)
917 { }
918
919
920 inline CellWidget::State::State ( Cell* cell, Path topPath )
921 : _cell (cell)
922 , _topPath (topPath)
923 , _hierarchicalName ()
924 , _cellWidget (NULL)
925 , _selection ()
926 , _rulers ()
927 , _cursorStep (DbU::lambda(0.5))
928 , _dbuMode (DbU::Symbolic)
929 , _unitPower (DbU::Nano)
930 , _showBoundaries (true)
931 , _showSelection (false)
932 , _queryFilter (~Query::DoTerminalCells)
933 , _startLevel (0)
934 , _stopLevel (99)
935 , _rubberShape (CellWidget::Barycentric)
936 , _cumulativeSelection(false)
937 , _scaleHistory ()
938 , _ihistory (0)
939 , _historyEnable (false)
940 {
941 _scaleHistory.push_back ( ScaleEntry(1.0,Point(0,0)) );
942 if (_cell) _hierarchicalName = Name( _cell->getHierarchicalName() );
943 }
944
945
946 inline unsigned int CellWidget::State::getDbuMode () const
947 { return _dbuMode; }
948
949
950 inline bool CellWidget::State::symbolicMode () const
951 { return (_dbuMode == DbU::Symbolic); }
952
953
954 inline bool CellWidget::State::gridMode () const
955 { return (_dbuMode == DbU::Grid); }
956
957
958 inline bool CellWidget::State::physicalMode () const
959 { return (_dbuMode == DbU::Physical); }
960
961
962 inline void CellWidget::State::setCell ( Cell* cell )
963 {
964 _cell = cell;
965 if (_cell) _hierarchicalName = Name( _cell->getHierarchicalName() );
966 }
967
968
969 inline void CellWidget::State::setTopPath ( Path topPath )
970 { _topPath = topPath; }
971
972
973 inline void CellWidget::State::setCellWidget ( CellWidget* cw )
974 {
975 _cellWidget = cw;
976 _selection.setCellWidget ( cw );
977 }
978
979
980 inline void CellWidget::State::setCursorStep ( DbU::Unit step )
981 { _cursorStep = step; }
982
983 inline DbU::Unit CellWidget::State::getCursorStep () const
984 { return _cursorStep; }
985
986
987 inline DbU::UnitPower CellWidget::State::getUnitPower () const
988 { return _unitPower; }
989
990
991 inline void CellWidget::State::setDbuMode ( int mode )
992 {
993 _dbuMode = mode;
994 switch ( _dbuMode ) {
995 case DbU::Symbolic: _cursorStep = DbU::lambda(0.5); break;
996 case DbU::Grid: _cursorStep = DbU::grid (1.0); break;
997 case DbU::Physical: _cursorStep = DbU::grid (1.0); break;
998 }
999 }
1000
1001
1002 inline void CellWidget::State::setUnitPower ( DbU::UnitPower p )
1003 { _unitPower = p; }
1004
1005
1006 inline void CellWidget::State::setShowBoundaries ( bool state )
1007 { _showBoundaries = state; }
1008
1009
1010 inline void CellWidget::State::setShowSelection ( bool state )
1011 { _showSelection = state; }
1012
1013
1014 inline void CellWidget::State::setCumulativeSelection ( bool state )
1015 { _cumulativeSelection = state; }
1016
1017
1018 inline void CellWidget::State::setTopLeft ( DbU::Unit x, DbU::Unit y )
1019 {
1020 _scaleHistory[_ihistory]._topLeft.setX(x);
1021 _scaleHistory[_ihistory]._topLeft.setY(y);
1022 }
1023
1024
1025 inline void CellWidget::State::setTopLeft ( const Point& topLeft )
1026 { _scaleHistory[_ihistory]._topLeft = topLeft; }
1027
1028
1029 inline void CellWidget::State::setQueryFilter ( Query::Mask mask )
1030 { _queryFilter = mask; }
1031
1032
1033 inline void CellWidget::State::setStartLevel ( int level )
1034 { _startLevel = level; }
1035
1036
1037 inline void CellWidget::State::setStopLevel ( int level )
1038 { _stopLevel = level; }
1039
1040
1041 inline void CellWidget::State::setRubberShape ( RubberShape shape )
1042 { _rubberShape = shape; }
1043
1044
1045 inline void CellWidget::State::setHistoryEnable ( bool enable )
1046 { _historyEnable = enable; }
1047
1048
1049 inline Cell* CellWidget::State::getCell () const
1050 { return _cell; }
1051
1052
1053 inline Path CellWidget::State::getTopPath () const
1054 { return _topPath; }
1055
1056
1057 inline Cell* CellWidget::State::getTopCell () const
1058 { return (_topPath.isEmpty()) ? _cell : _topPath.getOwnerCell(); }
1059
1060
1061 inline DbU::Unit CellWidget::State::cursorStep () const
1062 { return _cursorStep; }
1063
1064
1065 inline CellWidget::SelectorCriterions& CellWidget::State::getSelection ()
1066 { return _selection; }
1067
1068
1069 inline RulerSet& CellWidget::State::getRulers ()
1070 { return _rulers; }
1071
1072
1073 inline bool CellWidget::State::showBoundaries () const
1074 { return _showBoundaries; }
1075
1076
1077 inline bool CellWidget::State::showSelection () const
1078 { return _showSelection; }
1079
1080
1081 inline bool CellWidget::State::cumulativeSelection () const
1082 { return _cumulativeSelection; }
1083
1084
1085 inline bool CellWidget::State::getHistoryEnable () const
1086 { return _historyEnable; }
1087
1088
1089 inline size_t CellWidget::State::getHistorySize () const
1090 { return _scaleHistory.size(); }
1091
1092
1093 inline const Point& CellWidget::State::getTopLeft () const
1094 { return _scaleHistory[_ihistory]._topLeft; }
1095
1096
1097 inline Query::Mask CellWidget::State::getQueryFilter () const
1098 { return _queryFilter; }
1099
1100
1101 inline int CellWidget::State::getStartLevel () const
1102 { return _startLevel; }
1103
1104
1105 inline int CellWidget::State::getStopLevel () const
1106 { return _stopLevel; }
1107
1108
1109 inline CellWidget::RubberShape CellWidget::State::getRubberShape () const
1110 { return _rubberShape; }
1111
1112
1113 inline const float& CellWidget::State::getScale () const
1114 { return _scaleHistory[_ihistory]._scale; }
1115
1116
1117 inline CellWidget::FindStateName::FindStateName ( const Name& cellHierName )
1118 : unary_function< const shared_ptr<State>&, bool >()
1119 , _cellHierName(cellHierName)
1120 { }
1121
1122
1123 inline bool CellWidget::FindStateName::operator () ( const shared_ptr<State>& state )
1124 { return state->getName() == _cellHierName; }
1125
1126
1127 inline void CellWidget::setActiveCommand ( Command* command )
1128 { _activeCommand = command; }
1129
1130
1131 inline Command* CellWidget::getActiveCommand () const
1132 { return _activeCommand; }
1133
1134
1135 inline void CellWidget::resetActiveCommand ()
1136 { _activeCommand = NULL; }
1137
1138
1139 inline void CellWidget::setCursorStep ( DbU::Unit step )
1140 { _state->setCursorStep(step); }
1141
1142
1143 inline void CellWidget::setRealSnapGridStep ( DbU::Unit step )
1144 { DbU::setRealSnapGridStep(step); }
1145
1146
1147 inline shared_ptr<CellWidget::State>& CellWidget::getState ()
1148 {
1149 _state->setTopLeft ( getTopLeft() );
1150 return _state;
1151 }
1152
1153
1154 inline shared_ptr<CellWidget::State> CellWidget::getStateClone ()
1155 {
1156 _state->setTopLeft ( getTopLeft() );
1157 return shared_ptr<State>( _state->clone() );
1158 }
1159
1160
1161 inline void CellWidget::addDrawExtensionGo ( const Name& name
1162 , InitExtensionGo_t* initExtensionGo
1163 , DrawExtensionGo_t* drawExtensionGo
1164 )
1165 { _drawingQuery.addDrawExtensionGo( name, initExtensionGo, drawExtensionGo ); }
1166
1167
1168 inline void CellWidget::copyDrawExtensionGos ( const CellWidget* other )
1169 { _drawingQuery.copyDrawExtensionGos( other->_drawingQuery ); }
1170
1171
1172 inline void CellWidget::setStartLevel ( int level )
1173 {
1174 _drawingQuery.setStartLevel ( level );
1175 _state->setStartLevel ( level );
1176 emit queryFilterChanged ();
1177 }
1178
1179
1180 inline void CellWidget::setStopLevel ( int level )
1181 {
1182 _drawingQuery.setStopLevel ( level );
1183 _state->setStopLevel ( level );
1184 emit queryFilterChanged ();
1185 }
1186
1187
1188 inline int CellWidget::getStartLevel () const
1189 { return _drawingQuery.getStartLevel (); }
1190
1191
1192 inline int CellWidget::getStopLevel () const
1193 { return _drawingQuery.getStopLevel (); }
1194
1195
1196 inline CellWidget::DrawingPlanes& CellWidget::getDrawingPlanes ()
1197 { return _drawingPlanes; }
1198
1199
1200 inline SelectorSet& CellWidget::getSelectorSet ()
1201 { return _selectors; }
1202
1203
1204 Occurrences CellWidget::getOccurrencesUnder ( const QRect& area ) const
1205 { return getOccurrencesUnder(screenToDbuBox(area)); }
1206
1207
1208 inline void CellWidget::addRuler ( const Point& origin, const Point& extremity )
1209 {
1210 _state->getRulers().insert ( shared_ptr<Ruler>( new Ruler(origin,extremity) ) );
1211 refresh ();
1212 }
1213
1214
1215 inline void CellWidget::addRuler ( shared_ptr<Ruler> ruler )
1216 {
1217 _state->getRulers().insert ( ruler );
1218 refresh ();
1219 }
1220
1221
1222 inline void CellWidget::clearRulers ()
1223 { _state->getRulers().clear (); refresh(); }
1224
1225
1226 inline void CellWidget::refresh ()
1227 { _redrawManager.refresh(); }
1228
1229
1230 inline void CellWidget::redrawSelection ()
1231 { redrawSelection ( QRect(QPoint(0,0),_drawingPlanes.size()) ); }
1232
1233
1234 inline void CellWidget::copyToPrinter ( int xpaper, int ypaper, QPrinter* printer, CellWidget::PainterCb_t& cb )
1235 { _drawingPlanes.copyToPrinter( xpaper, ypaper, printer, cb ); }
1236
1237
1238 inline void CellWidget::copyToImage ( QImage* image, PainterCb_t& cb )
1239 { _drawingPlanes.copyToImage ( image, cb ); }
1240
1241
1242 inline DbU::Unit CellWidget::toDbu ( float d ) const
1243 {
1244 DbU::Unit unit;
1245 switch ( getDbuMode() ) {
1246 case DbU::Physical: unit = DbU::grid(DbU::physicalToGrid(d,DbU::Micro)); break;
1247 case DbU::Grid: unit = DbU::grid(d); break;
1248 case DbU::Db: unit = DbU::db((long)d); break;
1249 default:
1250 case DbU::Symbolic: unit = DbU::lambda(d); break;
1251 }
1252 return unit;
1253 }
1254
1255
1256 inline int CellWidget::dbuToScreenX ( DbU::Unit x ) const
1257 { return (int)rint ( (float)( x - _screenArea.getXMin() ) * getScale() ); }
1258
1259
1260 inline int CellWidget::dbuToScreenY ( DbU::Unit y ) const
1261 { return (int)rint ( (float)( _screenArea.getYMax() - y ) * getScale() ); }
1262
1263
1264 inline int CellWidget::dbuToScreenLength ( DbU::Unit length ) const
1265 { return (int)rint ( (float)length * getScale() ); }
1266
1267
1268 inline QPoint CellWidget::dbuToScreenPoint ( DbU::Unit x, DbU::Unit y ) const
1269 { return QPoint ( dbuToScreenX(x), dbuToScreenY(y) ); }
1270
1271
1272 inline QPoint CellWidget::dbuToScreenPoint ( const Point& point ) const
1273 { return QPoint ( dbuToScreenX(point.getX()), dbuToScreenY(point.getY()) ); }
1274
1275
1276 inline DbU::Unit CellWidget::screenToDbuX ( int x ) const
1277 { return (DbU::Unit)(x/getScale()) + _screenArea.getXMin(); }
1278
1279
1280 inline DbU::Unit CellWidget::screenToDbuY ( int y ) const
1281 { return _screenArea.getYMax() - (DbU::Unit)(y/getScale()); }
1282
1283
1284 inline DbU::Unit CellWidget::screenToDbuLength ( int length ) const
1285 { return (int)( (float)length / getScale() ); }
1286
1287
1288 inline Point CellWidget::screenToDbuPoint ( const QPoint& point ) const
1289 { return Point ( screenToDbuX(point.x()), screenToDbuY(point.y()) ); }
1290
1291
1292 inline Box CellWidget::screenToDbuBox ( const QRect& rect ) const
1293 {
1294 return Box ( screenToDbuX(rect.x())
1295 , screenToDbuY(rect.y())
1296 , screenToDbuX(rect.x()+rect.width ())
1297 , screenToDbuY(rect.y()+rect.height())
1298 );
1299 }
1300
1301
1302 inline Box& CellWidget::pixelInflate ( Box& box, int pixels ) const
1303 { return box.inflate(screenToDbuLength(pixels)); }
1304
1305
1306 inline Point CellWidget::getTopLeft () const
1307 { return Point(_screenArea.getXMin(),_screenArea.getYMax()); }
1308
1309
1310 inline Box CellWidget::getVisibleArea () const
1311 { return computeVisibleArea(getScale()); }
1312
1313
1314 inline Cell* CellWidget::getCell () const
1315 { return _state->getCell(); }
1316
1317
1318 inline Cell* CellWidget::getTopCell () const
1319 { return _state->getTopCell(); }
1320
1321
1322 inline Path CellWidget::getTopPath () const
1323 { return _state->getTopPath(); }
1324
1325
1326 inline PaletteWidget* CellWidget::getPalette ()
1327 { return _palette; }
1328
1329
1330 inline DbU::Unit CellWidget::cursorStep () const
1331 { return _state->cursorStep(); }
1332
1333
1334 inline unsigned int CellWidget::getDbuMode () const
1335 { return _state->getDbuMode(); }
1336
1337
1338 inline bool CellWidget::gridMode () const
1339 { return _state->gridMode(); }
1340
1341
1342 inline bool CellWidget::symbolicMode () const
1343 { return _state->symbolicMode(); }
1344
1345
1346 inline bool CellWidget::physicalMode () const
1347 { return _state->physicalMode(); }
1348
1349
1350 inline DbU::UnitPower CellWidget::getUnitPower () const
1351 { return _state->getUnitPower(); }
1352
1353
1354 inline bool CellWidget::showBoundaries () const
1355 { return _state->showBoundaries(); }
1356
1357
1358 inline bool CellWidget::showSelection () const
1359 { return _state->showSelection(); }
1360
1361
1362 inline bool CellWidget::cumulativeSelection () const
1363 { return _state->cumulativeSelection(); }
1364
1365
1366 inline QPainter& CellWidget::getPainter ( size_t plane )
1367 { return _drawingPlanes.painter(plane); }
1368
1369
1370 inline const DisplayStyle::HSVr& CellWidget::getDarkening () const
1371 { return _darkening; }
1372
1373
1374 inline const float& CellWidget::getScale () const
1375 { return _state->getScale(); }
1376
1377
1378 inline const QPoint& CellWidget::getMousePosition () const
1379 { return _mousePosition; }
1380
1381
1382 inline void CellWidget::updateMousePosition ()
1383 {
1384 Point mousePoint = screenToDbuPoint ( _mousePosition );
1385 emit mousePositionChanged ( _onCursorGrid(mousePoint) );
1386 }
1387
1388
1389 inline void CellWidget::setQueryFilter ( Query::Mask filter )
1390 {
1391 _state->setQueryFilter ( filter );
1392 emit queryFilterChanged ();
1393 }
1394
1395
1396 inline Query::Mask CellWidget::getQueryFilter () const
1397 { return _state->getQueryFilter(); }
1398
1399
1400 inline void CellWidget::setDbuMode ( int mode )
1401 { _state->setDbuMode(mode); }
1402
1403
1404 inline void CellWidget::setUnitPower ( DbU::UnitPower p )
1405 { _state->setUnitPower(p); }
1406
1407
1408 inline void CellWidget::setRubberShape ( RubberShape shape )
1409 {
1410 _state->setRubberShape ( shape );
1411 _redrawManager.refresh ();
1412 emit queryFilterChanged ();
1413 }
1414
1415
1416 inline CellWidget::RubberShape CellWidget::getRubberShape () const
1417 { return _state->getRubberShape(); }
1418
1419
1420 inline void CellWidget::setPen ( const QPen& pen, size_t plane )
1421 { _drawingPlanes.painter(plane).setPen(pen); }
1422
1423
1424 inline void CellWidget::setDarkening ( const DisplayStyle::HSVr& darkening )
1425 { _darkening = darkening; }
1426
1427
1428 inline bool CellWidget::isPrinter () const
1429 { return _isPrinter; }
1430
1431
1432 inline void CellWidget::setPrinter ( bool state )
1433 { _isPrinter = state; }
1434
1435
1436 inline bool CellWidget::timeout ( const char* fname, const Timer& timer, double timeout, bool& timedout ) const
1437 {
1438 if ( timedout ) return true;
1439 if ( timer.getCombTimeOnTheFly() < timeout ) return false;
1440
1441 timedout = true;
1442 cerr << Warning("CellWidget::%s(): timeout %.3f (limit:%.1f)."
1443 ,fname,timer.getCombTimeOnTheFly(),timeout) << endl;
1444 return true;
1445 }
1446
1447
1448 inline DbU::Unit CellWidget::_snapGridStep () const
1449 { return symbolicMode() ? DbU::getSymbolicSnapGridStep() : DbU::getRealSnapGridStep(); }
1450
1451
1452 inline DbU::Unit CellWidget::_onSnapGrid ( DbU::Unit u ) const
1453 { return symbolicMode() ? DbU::getOnSymbolicSnapGrid(u) : DbU::getOnRealSnapGrid(u); }
1454
1455
1456 inline Point CellWidget::_onSnapGrid ( const Point& p ) const
1457 { return Point(_onSnapGrid(p.getX()),_onSnapGrid(p.getY())); }
1458
1459
1460 inline DbU::Unit CellWidget::_onCursorGrid ( DbU::Unit u ) const
1461 { return DbU::getOnCustomGrid(u,cursorStep()); }
1462
1463
1464 inline Point CellWidget::_onCursorGrid ( const Point& p ) const
1465 { return Point(_onCursorGrid(p.getX()),_onCursorGrid(p.getY())); }
1466
1467
1468 } // End of Hurricane namespace.
1469
1470
1471 GETSTRING_POINTER_SUPPORT(Hurricane::CellWidget);
1472 IOSTREAM_POINTER_SUPPORT(Hurricane::CellWidget);
1473
1474
1475 #endif // HURRICANE_CELL_WIDGET
Hurricane::DbU::getOnCustomGrid
static DbU::Unit getOnCustomGrid(DbU::Unit u, DbU::Unit step, SnapMode mode=Nearest)
Hurricane::Path
Hurricane::Go
Hurricane::Occurrence
Hurricane::BasicLayer
lambda
static Unit lambda(double value)
Hurricane::DbU::getOnSymbolicSnapGrid
static DbU::Unit getOnSymbolicSnapGrid(DbU::Unit u, SnapMode mode=Nearest)
Hurricane::DbU::Db
Db
Hurricane::Box::getYMax
const DbU::Unit & getYMax() const
Hurricane::Name
Hurricane::DbU::Unit
std::int64_t Unit
Hurricane::Cell
Hurricane::CellWidget::Res_DesignMode
Definition: CellWidget.h:114
Hurricane::Point
Hurricane::Box::getXMin
const DbU::Unit & getXMin() const
Hurricane::CellWidget::ResolutionMode
ResolutionMode
Definition: CellWidget.h:114
getOnRealSnapGrid
static DbU::Unit getOnRealSnapGrid(DbU::Unit u, SnapMode mode=Nearest)
Hurricane::DbU::Grid
Grid
Hurricane::Transformation
Hurricane::GenericCollection
getRealSnapGridStep
static DbU::Unit getRealSnapGridStep()
Hurricane::Query::setQuery
void setQuery(Cell *cell, const Box &area, const Transformation &transformation, const BasicLayer *basicLayer, ExtensionSlice::Mask extensionMask, Mask filter)
Hurricane::Box
Hurricane::DbU::db
static Unit db(Unit value)
Hurricane::DbU::Micro
Micro
Hurricane::Layer
setRealSnapGridStep
static void setRealSnapGridStep(DbU::Unit step)
Hurricane::DbU::UnitPower
UnitPower
Hurricane::DbU::grid
static Unit grid(double value)
Nano
Nano
Symbolic
Symbolic
Hurricane
Hurricane::DbU::getSymbolicSnapGridStep
static DbU::Unit getSymbolicSnapGridStep()
Hurricane::Net
Hurricane::CellWidget
The Widget to display a Cell.
Definition: CellWidget.h:84
Hurricane::Occurrences
GenericCollection< Occurrence > Occurrences
Hurricane::CellWidget::Res_CellMode
Definition: CellWidget.h:114

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