# Hurricane Documentation

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