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


Generated by doxygen 1.9.1 on Thu Aug 11 2022 Return to top of page
Hurricane Design Viewer Copyright © 2008-2020 Sorbonne Universite All rights reserved