add
This commit is contained in:
parent
ea0d867b93
commit
fd1e18bf8c
|
@ -0,0 +1,80 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "CellWidget.h"
|
||||
#include "LayersWidget.h"
|
||||
|
||||
#include "CellViewer.h"
|
||||
|
||||
CellViewer::CellViewer(Cell* cell)
|
||||
: QMainWindow()
|
||||
{
|
||||
cellWidget = new CellWidget(cell);
|
||||
setCentralWidget(cellWidget);
|
||||
|
||||
createActions();
|
||||
createMenus();
|
||||
|
||||
setWindowTitle(tr("Cell Viewer"));
|
||||
resize(500, 400);
|
||||
}
|
||||
|
||||
CellViewer::~CellViewer() {
|
||||
delete cellWidget;
|
||||
delete layersWidget;
|
||||
}
|
||||
|
||||
//void CellViewer::keyPressEvent(QKeyEvent *event) {
|
||||
// switch (event->key()) {
|
||||
// case Qt::Key_Plus:
|
||||
// zoom(ZoomInFactor);
|
||||
// break;
|
||||
// case Qt::Key_Minus:
|
||||
// zoom(ZoomOutFactor);
|
||||
// break;
|
||||
// case Qt::Key_Left:
|
||||
// scroll(-ScrollStep, 0);
|
||||
// break;
|
||||
// case Qt::Key_Right:
|
||||
// scroll(+ScrollStep, 0);
|
||||
// break;
|
||||
// case Qt::Key_Down:
|
||||
// scroll(0, -ScrollStep);
|
||||
// break;
|
||||
// case Qt::Key_Up:
|
||||
// scroll(0, +ScrollStep);
|
||||
// break;
|
||||
// default:
|
||||
// QWidget::keyPressEvent(event);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void CellViewer::wheelEvent(QWheelEvent *event) {
|
||||
// int numDegrees = event->delta() / 8;
|
||||
// double numSteps = numDegrees / 15.0f;
|
||||
// zoom(pow(ZoomInFactor, numSteps));
|
||||
//}
|
||||
|
||||
void CellViewer::zoomIn() {
|
||||
cellWidget->reframe(cellWidget->getScale() * 1.2);
|
||||
cellWidget->redraw();
|
||||
}
|
||||
|
||||
void CellViewer::zoomOut() {
|
||||
}
|
||||
|
||||
void CellViewer::fitToWindow() {
|
||||
}
|
||||
|
||||
void CellViewer::createActions() {
|
||||
zoomInAct = new QAction(tr("Zoom &In (25%)"), this);
|
||||
zoomInAct->setShortcut(tr("Ctrl++"));
|
||||
zoomInAct->setEnabled(true);
|
||||
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
||||
}
|
||||
|
||||
void CellViewer::createMenus() {
|
||||
viewMenu = new QMenu(tr("&View"), this);
|
||||
viewMenu->addAction(zoomInAct);
|
||||
|
||||
menuBar()->addMenu(viewMenu);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef __CELL_VIEWER_H
|
||||
#define __CELL_VIEWER_H
|
||||
|
||||
#include "Cell.h"
|
||||
using namespace H;
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
class CellWidget;
|
||||
class LayersWidget;
|
||||
|
||||
class CellViewer : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CellViewer(Cell* cell);
|
||||
~CellViewer();
|
||||
private:
|
||||
CellWidget* cellWidget;
|
||||
LayersWidget* layersWidget;
|
||||
|
||||
QAction *zoomInAct;
|
||||
QMenu *viewMenu;
|
||||
|
||||
void createActions();
|
||||
void createMenus();
|
||||
|
||||
private slots:
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void fitToWindow();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
#include "DataBase.h"
|
||||
#include "Technology.h"
|
||||
#include "BasicLayer.h"
|
||||
using namespace H;
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QGridLayout>
|
||||
|
||||
#include "LayersWidget.h"
|
||||
|
||||
LayersWidget::LayersWidget(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
widgets()
|
||||
{
|
||||
DataBase* db = GetDataBase();
|
||||
Technology* techno = db->GetTechnology();
|
||||
QGridLayout* mainLayout = new QGridLayout;
|
||||
|
||||
int line = 0;
|
||||
for_each_basic_layer(basicLayer, techno->GetBasicLayers()) {
|
||||
QCheckBox* checkBox = new QCheckBox();
|
||||
widgets.insert(checkBox);
|
||||
mainLayout->addWidget(checkBox, line, 0, Qt::AlignRight);
|
||||
//connect(checkBox, SIGNAL(toggled(bool)),
|
||||
// renderArea, SLOT(setAntialiased(bool)));
|
||||
|
||||
string layerName = GetString(basicLayer->GetName());
|
||||
QLabel* label = new QLabel(tr(layerName.c_str()));
|
||||
widgets.insert(label);
|
||||
mainLayout->addWidget(label, line, 1, Qt::AlignRight);
|
||||
++line;
|
||||
end_for;
|
||||
}
|
||||
setLayout(mainLayout);
|
||||
setWindowTitle(tr("Layers"));
|
||||
}
|
||||
|
||||
LayersWidget::~LayersWidget() {
|
||||
for (set<QWidget*>::iterator wsit = widgets.begin();
|
||||
wsit != widgets.end();
|
||||
wsit++) {
|
||||
delete *wsit;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef LAYERS_WIDGET_H
|
||||
#define LAYERS_WIDGET_H
|
||||
|
||||
#include <set>
|
||||
using namespace std;
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class LayersWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public :
|
||||
LayersWidget(QWidget *parent = 0);
|
||||
~LayersWidget();
|
||||
private:
|
||||
set<QWidget*> widgets;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue