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