diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp
index bff0255..edb9c42 100644
--- a/src/GUI/IntelliPhotoGui.cpp
+++ b/src/GUI/IntelliPhotoGui.cpp
@@ -14,7 +14,7 @@ IntelliPhotoGui::IntelliPhotoGui(){
// set style of the gui
setIntelliStyle();
// Size the app
- resize(600,600);
+ resize(600,600);
//showMaximized();
setDefaultToolValue();
}
@@ -103,6 +103,25 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
}
}
+// Opens a dialog that allows the user to change Dimension
+void IntelliPhotoGui::slotChangeDim(){
+ // Stores button value
+ bool ok1, ok2;
+
+ // "change Dimension" is the title of the window
+ // the next tr is the text to display
+ // Define the standard Value, min, step and ok button
+ int width = IntelliInputDialog::getInt("New Layer", "Width:", 600, 1, 50000 , 1, &ok1);
+
+ int height = IntelliInputDialog::getInt("New Layer", "Height:", 600, 1, 50000, 1, &ok2);
+
+ // Change dimension
+ if (ok1&&ok2) {
+ paintingArea->setLayerDimensions(height,width);
+ UpdateGui();
+ }
+}
+
// Opens a dialog that allows the user to delete a Layer
void IntelliPhotoGui::slotDeleteLayer(){
@@ -264,6 +283,15 @@ void IntelliPhotoGui::slotAboutDialog(){
tr("
IntelliPhoto - A Pretty basic editor.
Developed by Team 7."));
}
+// Open an dialog about the dimensions
+void IntelliPhotoGui::slotGetDim(){
+
+ // Window dimesnion display
+ QMessageBox::about(this, tr("Dimension"),
+ tr("Width: %1\nHeight: %2").arg(paintingArea->getMaxWidth()).arg(paintingArea->getMaxHeight()));
+}
+
+
void IntelliPhotoGui::slotEnterPressed(){
QString string = EditLineWidth->text();
if(string.toInt() > 50) {
@@ -298,7 +326,7 @@ void IntelliPhotoGui::slotSetWidth(){
void IntelliPhotoGui::slotSetInnerAlpha(){
bool ok1;
- int temp = IntelliInputDialog::getInt("Toolsettings", "Width:", 5, 1, 50, 1, &ok1);
+ int temp = IntelliInputDialog::getInt("Toolsettings", "Alpha:", 5, 1, 50, 1, &ok1);
if(ok1) {
paintingArea->Toolsettings.setInnerAlpha(temp);
EditLineInnerAlpha->setText(QString("%1").arg(temp));
@@ -359,6 +387,14 @@ void IntelliPhotoGui::createActions(){
actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
+ actionChangeDim = new QAction(tr("&Change Dimension"), this);
+ actionChangeDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_X));
+ connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim()));
+
+ actionGetDim = new QAction(tr("&Get Dimension"), this);
+ actionGetDim->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Y));
+ connect(actionGetDim, SIGNAL(triggered()), this, SLOT(slotGetDim()));
+
actionSetActiveLayer = new QAction(tr("&set Active"), this);
actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer()));
@@ -515,9 +551,9 @@ void IntelliPhotoGui::createMenus(){
fileMenu->addAction(actionExit);
//Attach all actions to Render Settings
- renderMenu = new QMenu(tr("&Fast Renderer"), this);
- renderMenu->addAction(actionUpdateRenderSettingsOn);
- renderMenu->addAction(actionUpdateRenderSettingsOff);
+ renderMenu = new QMenu(tr("&Fast Renderer"), this);
+ renderMenu->addAction(actionUpdateRenderSettingsOn);
+ renderMenu->addAction(actionUpdateRenderSettingsOff);
//Attach all Layer Creations to Menu
layerCreationMenu = new QMenu(tr("&Create new Layer"), this);
@@ -574,6 +610,8 @@ void IntelliPhotoGui::createMenus(){
optionMenu->addMenu(toolMenu);
optionMenu->addSeparator();
optionMenu->addMenu(renderMenu);
+ optionMenu->addAction(actionChangeDim);
+ optionMenu->addAction(actionGetDim);
// Attach all actions to Help
helpMenu = new QMenu(tr("&Help"), this);
@@ -596,7 +634,10 @@ void IntelliPhotoGui::createGui(){
centralGuiWidget->setLayout(mainLayout);
// create Gui elements
- paintingArea = new PaintingArea();
+ // get and set max width and height
+ int maxHeight = IntelliInputDialog::getInt("New Layer", "Height:", 600, 1);
+ int maxWidth = IntelliInputDialog::getInt("New Layer", "Width:", 600, 1);
+ paintingArea = new PaintingArea(maxWidth, maxHeight);
paintingArea->DummyGui = this;
preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
diff --git a/src/GUI/IntelliPhotoGui.h b/src/GUI/IntelliPhotoGui.h
index f3d2900..26f7c7d 100644
--- a/src/GUI/IntelliPhotoGui.h
+++ b/src/GUI/IntelliPhotoGui.h
@@ -77,6 +77,9 @@ void slotCreateFloodFillTool();
void slotAboutDialog();
+void slotChangeDim();
+void slotGetDim();
+
void slotEnterPressed();
void slotSetWidth();
@@ -160,6 +163,10 @@ QAction*actionCreateCircleTool;
QAction*actionCreatePolygonTool;
QAction*actionCreateFloodFillTool;
+// dimension actions
+QAction*actionChangeDim;
+QAction*actionGetDim;
+
// dialog actions
QAction*actionAboutDialog;
QAction*actionAboutQtDialog;