viewer improvment
This commit is contained in:
parent
fd1e18bf8c
commit
a0e381b632
|
@ -247,6 +247,10 @@ Box& Box::inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const
|
|||
return *this;
|
||||
}
|
||||
|
||||
Box Box::getInflated(const Unit& d) const {
|
||||
return Box(*this).inflate(d);
|
||||
}
|
||||
|
||||
Box& Box::shrinkByFactor(double factor)
|
||||
// **************************************
|
||||
{
|
||||
|
|
|
@ -96,6 +96,7 @@ class Box {
|
|||
public: Box& inflate(const Unit& d);
|
||||
public: Box& inflate(const Unit& dx, const Unit& dy);
|
||||
public: Box& inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const Unit& dyMax);
|
||||
public: Box getInflated(const Unit& d) const;
|
||||
public: Box& shrinkByFactor(double factor); // 0 <= factor <= 1
|
||||
|
||||
public: Box& merge(const Unit& x, const Unit& y);
|
||||
|
|
|
@ -92,6 +92,10 @@ Point& Point::translate(const Unit& dx, const Unit& dy)
|
|||
return *this;
|
||||
}
|
||||
|
||||
Point Point::getTranslated(const Unit& dx, const Unit& dy) const {
|
||||
return Point(*this).translate(dx, dy);
|
||||
}
|
||||
|
||||
string Point::_GetString() const
|
||||
// *****************************
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ class Point {
|
|||
public: void setX(const Unit& x) {_x = x;};
|
||||
public: void setY(const Unit& y) {_y = y;};
|
||||
public: Point& translate(const Unit& dx, const Unit& dy);
|
||||
public: Point getTranslated(const Unit& dx, const Unit& dy) const;
|
||||
|
||||
// Others
|
||||
// ******
|
||||
|
|
|
@ -15,7 +15,7 @@ CellViewer::CellViewer(Cell* cell)
|
|||
createMenus();
|
||||
|
||||
setWindowTitle(tr("Cell Viewer"));
|
||||
resize(500, 400);
|
||||
resize(1000, 500);
|
||||
}
|
||||
|
||||
CellViewer::~CellViewer() {
|
||||
|
@ -56,13 +56,17 @@ CellViewer::~CellViewer() {
|
|||
|
||||
void CellViewer::zoomIn() {
|
||||
cellWidget->reframe(cellWidget->getScale() * 1.2);
|
||||
cellWidget->redraw();
|
||||
cellWidget->update();
|
||||
}
|
||||
|
||||
void CellViewer::zoomOut() {
|
||||
cellWidget->reframe(cellWidget->getScale() / 1.2);
|
||||
cellWidget->update();
|
||||
}
|
||||
|
||||
void CellViewer::fitToWindow() {
|
||||
cellWidget->fitToContent();
|
||||
cellWidget->update();
|
||||
}
|
||||
|
||||
void CellViewer::createActions() {
|
||||
|
@ -70,11 +74,23 @@ void CellViewer::createActions() {
|
|||
zoomInAct->setShortcut(tr("Ctrl++"));
|
||||
zoomInAct->setEnabled(true);
|
||||
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
||||
|
||||
zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this);
|
||||
zoomOutAct->setShortcut(tr("Ctrl+-"));
|
||||
zoomOutAct->setEnabled(true);
|
||||
connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut()));
|
||||
|
||||
fitToWindowAct = new QAction(tr("Fit &To &Window"), this);
|
||||
fitToWindowAct->setShortcut(tr("f"));
|
||||
fitToWindowAct->setEnabled(true);
|
||||
connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow()));
|
||||
}
|
||||
|
||||
void CellViewer::createMenus() {
|
||||
viewMenu = new QMenu(tr("&View"), this);
|
||||
viewMenu->addAction(zoomInAct);
|
||||
viewMenu->addAction(zoomOutAct);
|
||||
viewMenu->addAction(fitToWindowAct);
|
||||
|
||||
menuBar()->addMenu(viewMenu);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ class CellViewer : public QMainWindow {
|
|||
LayersWidget* layersWidget;
|
||||
|
||||
QAction *zoomInAct;
|
||||
QAction *zoomOutAct;
|
||||
QAction *fitToWindowAct;
|
||||
QMenu *viewMenu;
|
||||
|
||||
void createActions();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue