21 #include <boost/any.hpp>
23 #include <QMainWindow>
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 enum { CellHistorySize = 10 };
78 enum Flag { InCellChange = 0x0001 };
79 enum FunctionFlag { NoFlags = 0x0000
82 typedef std::map< const QString, boost::any > ActionLut;
83 typedef bool (QWidget::* SlotMethod)();
85 static inline const std::vector<CellViewer*>&
87 static void notify (
CellViewer*,
unsigned int flags );
92 inline size_t getSettingsId ()
const;
93 void readQtSettings ();
94 void saveQtSettings ();
96 QMenu* createDebugMenu ();
97 bool hasMenu (
const QString& path )
const;
98 bool hasMenuAction (
const QString& path )
const;
99 QAction* getMenuAction (
const QString& path )
const;
100 QAction* addMenu (
const QString& path
102 ,
unsigned int flags=NoFlags
104 bool addToMenu (
const QString& path
105 , QString beforePath=
"" );
106 QAction* addToMenu (
const QString& path
108 , std::string textTip
109 , std::function<
void() >
111 , QString beforePath=
"" );
112 QAction* addToMenu (
const QString& path
114 , std::string textTip
115 , std::string scriptPath
116 , QString beforePath=
"" );
117 QAction* addToMenu ( QString path
120 ,
const QKeySequence& shortCut
121 , QIcon icon =QIcon()
122 , QString beforePath=
"" );
125 inline void setPixelThreshold (
int );
126 inline void setDbuMode (
int );
127 inline Observer<CellViewer>* getCellObserver ();
140 void reframe (
const Box& ,
bool historyEnable=
true );
141 void runScript ( QString scriptPath );
143 virtual std::string _getString ()
const;
147 void selectionModeChanged ();
148 void setShowSelection (
bool );
149 void setCumulativeSelection (
bool );
150 void setState ( shared_ptr<CellWidget::State>& );
151 void removeHistory (
Cell* );
152 void openHistoryCell ();
153 void openDesignBlob ();
154 void saveDesignBlob ();
155 void printDisplay ();
156 void print ( QPrinter* );
157 void imageDisplay ();
158 void raiseToolInterrupt ();
159 void clearToolInterrupt ();
160 void runScriptWidget ();
161 void runStressScript ();
162 inline void emitCellAboutToChange ();
163 inline void emitCellChanged ();
164 inline void emitCellPreModificated ();
165 inline void emitCellPostModificated ();
167 void cellLoadedFromDisk (
Cell* );
168 void showSelectionToggled (
bool );
169 void stateChanged ( shared_ptr<CellWidget::State>& );
170 void redrawCellWidget ();
171 void cellPreModificated ();
172 void cellPostModificated ();
175 void refreshHistory ();
176 void rebuildHistory ();
178 QString _getAbsWidgetPath (
const QString& relPath )
const;
179 QAction* _getParentMenu (
const QString& )
const;
180 void _runScript ( QString scriptPath );
183 static std::vector<CellViewer*> _allViewers;
184 static QString _prefixWPath;
185 Observer<CellViewer> _cellObserver;
186 QString _applicationName;
187 QAction* _openAction;
188 QAction* _cellHistoryAction[CellHistorySize];
189 QAction* _showSelectionAction;
191 ActionLut _actionCallbacks;
193 MousePositionWidget* _mousePosition;
194 ControllerWidget* _controller;
195 ScriptWidget* _script;
198 MoveCommand _moveCommand;
199 ZoomCommand _zoomCommand;
200 RulerCommand _rulerCommand;
201 SelectCommand _selectCommand;
202 HierarchyCommand _hierarchyCommand;
203 list< shared_ptr<CellWidget::State> >
208 QString _pyScriptName;
213 inline const std::vector<CellViewer*>&
214 CellViewer::getAllViewers () {
return _allViewers; }
216 inline Observer<CellViewer>* CellViewer::getCellObserver () {
return &_cellObserver; }
222 inline void CellViewer::emitCellAboutToChange () { _flags |= InCellChange; emit cellPreModificated(); }
223 inline void CellViewer::emitCellChanged () { _flags &= ~InCellChange; emit cellPostModificated(); }
224 inline void CellViewer::emitCellPreModificated () { emit cellPreModificated(); }
225 inline void CellViewer::emitCellPostModificated () { emit cellPostModificated(); }
227 inline void CellViewer::setPixelThreshold (
int threshold )
228 { _cellWidget->setPixelThreshold( threshold ); }
231 { _cellWidget->setEnableRedrawInterrupt(state); }
233 inline void CellViewer::setDbuMode (
int mode )
234 { _cellWidget->setDbuMode(mode); }
236 inline size_t CellViewer::getSettingsId ()
const
238 for (
size_t i=0; i<_allViewers.size() ; ++i ) {
239 if (_allViewers[i] ==
this)
return i;
A simple top level window embedding the CellWidget.
Definition: CellViewer.h:73
virtual Cell * getCellFromDb(const char *)
ControllerWidget * getControllerWidget()
Definition: CellViewer.h:219
CellWidget * getCellWidget()
Definition: CellViewer.h:217
void setEnableRedrawInterrupt(bool)
Definition: CellViewer.h:230
void unselect(Occurrence &)
virtual void setCell(Cell *)
void setAnonNetSelectable(bool)
CellViewer(QWidget *parent=NULL)
void setApplicationName(const QString &)
Definition: CellViewer.h:220
void select(Occurrence &)
bool isToolInterrupted() const
Definition: CellViewer.h:215
void renameCell(const char *)
void setLayerVisible(const Name &layer, bool visible)
Definition: CellViewer.h:221