viewer improvment

This commit is contained in:
Christophe Alexandre 2008-01-22 18:26:07 +00:00
parent fd1e18bf8c
commit a0e381b632
8 changed files with 4169 additions and 395 deletions

View File

@ -247,6 +247,10 @@ Box& Box::inflate(const Unit& dxMin, const Unit& dyMin, const Unit& dxMax, const
return *this; return *this;
} }
Box Box::getInflated(const Unit& d) const {
return Box(*this).inflate(d);
}
Box& Box::shrinkByFactor(double factor) Box& Box::shrinkByFactor(double factor)
// ************************************** // **************************************
{ {

View File

@ -96,6 +96,7 @@ class Box {
public: Box& inflate(const Unit& d); public: Box& inflate(const Unit& d);
public: Box& inflate(const Unit& dx, const Unit& dy); 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& 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& shrinkByFactor(double factor); // 0 <= factor <= 1
public: Box& merge(const Unit& x, const Unit& y); public: Box& merge(const Unit& x, const Unit& y);

View File

@ -92,6 +92,10 @@ Point& Point::translate(const Unit& dx, const Unit& dy)
return *this; return *this;
} }
Point Point::getTranslated(const Unit& dx, const Unit& dy) const {
return Point(*this).translate(dx, dy);
}
string Point::_GetString() const string Point::_GetString() const
// ***************************** // *****************************
{ {

View File

@ -63,6 +63,7 @@ class Point {
public: void setX(const Unit& x) {_x = x;}; public: void setX(const Unit& x) {_x = x;};
public: void setY(const Unit& y) {_y = y;}; public: void setY(const Unit& y) {_y = y;};
public: Point& translate(const Unit& dx, const Unit& dy); public: Point& translate(const Unit& dx, const Unit& dy);
public: Point getTranslated(const Unit& dx, const Unit& dy) const;
// Others // Others
// ****** // ******

View File

@ -15,7 +15,7 @@ CellViewer::CellViewer(Cell* cell)
createMenus(); createMenus();
setWindowTitle(tr("Cell Viewer")); setWindowTitle(tr("Cell Viewer"));
resize(500, 400); resize(1000, 500);
} }
CellViewer::~CellViewer() { CellViewer::~CellViewer() {
@ -56,13 +56,17 @@ CellViewer::~CellViewer() {
void CellViewer::zoomIn() { void CellViewer::zoomIn() {
cellWidget->reframe(cellWidget->getScale() * 1.2); cellWidget->reframe(cellWidget->getScale() * 1.2);
cellWidget->redraw(); cellWidget->update();
} }
void CellViewer::zoomOut() { void CellViewer::zoomOut() {
cellWidget->reframe(cellWidget->getScale() / 1.2);
cellWidget->update();
} }
void CellViewer::fitToWindow() { void CellViewer::fitToWindow() {
cellWidget->fitToContent();
cellWidget->update();
} }
void CellViewer::createActions() { void CellViewer::createActions() {
@ -70,11 +74,23 @@ void CellViewer::createActions() {
zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setShortcut(tr("Ctrl++"));
zoomInAct->setEnabled(true); zoomInAct->setEnabled(true);
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); 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() { void CellViewer::createMenus() {
viewMenu = new QMenu(tr("&View"), this); viewMenu = new QMenu(tr("&View"), this);
viewMenu->addAction(zoomInAct); viewMenu->addAction(zoomInAct);
viewMenu->addAction(zoomOutAct);
viewMenu->addAction(fitToWindowAct);
menuBar()->addMenu(viewMenu); menuBar()->addMenu(viewMenu);
} }

View File

@ -20,6 +20,8 @@ class CellViewer : public QMainWindow {
LayersWidget* layersWidget; LayersWidget* layersWidget;
QAction *zoomInAct; QAction *zoomInAct;
QAction *zoomOutAct;
QAction *fitToWindowAct;
QMenu *viewMenu; QMenu *viewMenu;
void createActions(); void createActions();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff