21#include <boost/any.hpp>
29#include "hurricane/Commons.h"
30#include "hurricane/Observer.h"
31#include "hurricane/Name.h"
32#include "hurricane/Occurrence.h"
33#include "hurricane/viewer/MoveCommand.h"
34#include "hurricane/viewer/ZoomCommand.h"
35#include "hurricane/viewer/RulerCommand.h"
36#include "hurricane/viewer/SelectCommand.h"
37#include "hurricane/viewer/HierarchyCommand.h"
38#include "hurricane/viewer/CellWidget.h"
47 class MousePositionWidget;
48 class ControllerWidget;
77 typedef QMainWindow Super;
79 enum { CellHistorySize = 10 };
80 enum Flag { InCellChange = 0x0001 };
81 enum FunctionFlag { NoFlags = 0x0000
84 typedef std::map< const QString, boost::any > ActionLut;
85 typedef bool (QWidget::* SlotMethod)();
87 static inline const std::vector<CellViewer*>&
89 static void notify (
CellViewer*,
unsigned int flags );
94 inline size_t getSettingsId ()
const;
95 void readQtSettings ();
96 void saveQtSettings ();
98 QMenu* createDebugMenu ();
99 bool hasMenu (
const QString& path )
const;
100 bool hasMenuAction (
const QString& path )
const;
101 QAction* getMenuAction (
const QString& path )
const;
102 QAction* addMenu (
const QString& path
104 ,
unsigned int flags=NoFlags
106 bool addToMenu (
const QString& path
107 , QString beforePath=
"" );
108 QAction* addToMenu (
const QString& path
110 , std::string textTip
111 , std::function<
void() >
113 , QString beforePath=
"" );
114 QAction* addToMenu (
const QString& path
116 , std::string textTip
117 , std::string scriptPath
118 , QString beforePath=
"" );
119 QAction* addToMenu ( QString path
122 ,
const QKeySequence& shortCut
123 , QIcon icon =QIcon()
124 , QString beforePath=
"" );
127 inline void setPixelThreshold (
int );
128 inline void setDbuMode (
int );
129 inline Observer<CellViewer>* getCellObserver ();
142 void reframe (
const Box& ,
bool historyEnable=
true );
143 void runScript ( QString scriptPath );
145 virtual void closeEvent ( QCloseEvent* );
146 virtual std::string _getString ()
const;
150 void selectionModeChanged ();
151 void setShowSelection (
bool );
152 void setCumulativeSelection (
bool );
153 void setState ( shared_ptr<CellWidget::State>& );
154 void removeHistory (
Cell* );
155 void openHistoryCell ();
156 void openDesignBlob ();
157 void saveDesignBlob ();
158 void printDisplay ();
159 void print ( QPrinter* );
160 void imageDisplay ();
161 void raiseToolInterrupt ();
162 void clearToolInterrupt ();
163 void runScriptWidget ();
164 void runStressScript ();
165 inline void emitCellAboutToChange ();
166 inline void emitCellChanged ();
167 inline void emitCellPreModificated ();
168 inline void emitCellPostModificated ();
170 void cellLoadedFromDisk (
Cell* );
171 void showSelectionToggled (
bool );
172 void stateChanged ( shared_ptr<CellWidget::State>& );
173 void redrawCellWidget ();
174 void cellPreModificated ();
175 void cellPostModificated ();
178 void refreshHistory ();
179 void rebuildHistory ();
181 QString _getAbsWidgetPath (
const QString& relPath )
const;
182 QAction* _getParentMenu (
const QString& )
const;
183 void _runScript ( QString scriptPath );
186 static std::vector<CellViewer*> _allViewers;
187 static QString _prefixWPath;
188 Observer<CellViewer> _cellObserver;
189 QString _applicationName;
190 QAction* _openAction;
191 QAction* _cellHistoryAction[CellHistorySize];
192 QAction* _showSelectionAction;
194 ActionLut _actionCallbacks;
196 MousePositionWidget* _mousePosition;
197 ControllerWidget* _controller;
198 ScriptWidget* _script;
201 MoveCommand _moveCommand;
202 ZoomCommand _zoomCommand;
203 RulerCommand _rulerCommand;
204 SelectCommand _selectCommand;
205 HierarchyCommand _hierarchyCommand;
206 list< shared_ptr<CellWidget::State> >
211 QString _pyScriptName;
216 inline const std::vector<CellViewer*>&
217 CellViewer::getAllViewers () {
return _allViewers; }
219 inline Observer<CellViewer>* CellViewer::getCellObserver () {
return &_cellObserver; }
225 inline void CellViewer::emitCellAboutToChange () { _flags |= InCellChange; emit cellPreModificated(); }
226 inline void CellViewer::emitCellChanged () { _flags &= ~InCellChange; emit cellPostModificated(); }
227 inline void CellViewer::emitCellPreModificated () { emit cellPreModificated(); }
228 inline void CellViewer::emitCellPostModificated () { emit cellPostModificated(); }
230 inline void CellViewer::setPixelThreshold (
int threshold )
231 { _cellWidget->setPixelThreshold( threshold ); }
234 { _cellWidget->setEnableRedrawInterrupt(state); }
236 inline void CellViewer::setDbuMode (
int mode )
237 { _cellWidget->setDbuMode(mode); }
239 inline size_t CellViewer::getSettingsId ()
const
241 for (
size_t i=0; i<_allViewers.size() ; ++i ) {
242 if (_allViewers[i] ==
this)
return i;
A simple top level window embedding the CellWidget.
Definition CellViewer.h:73
ControllerWidget * getControllerWidget()
Definition CellViewer.h:222
CellWidget * getCellWidget()
Definition CellViewer.h:220
void setEnableRedrawInterrupt(bool)
Definition CellViewer.h:233
void unselect(Occurrence &)
virtual void setCell(Cell *)
virtual Cell * getCellFromDb(const char *)
void setAnonNetSelectable(bool)
CellViewer(QWidget *parent=NULL)
void setApplicationName(const QString &)
Definition CellViewer.h:223
void select(Occurrence &)
bool isToolInterrupted() const
Definition CellViewer.h:218
void renameCell(const char *)
void setLayerVisible(const Name &layer, bool visible)
Definition CellViewer.h:224