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