second fix

all kown bugs according to history, fixed
This commit is contained in:
Mienek
2020-01-30 12:17:28 +01:00
parent db07e6fcb0
commit 3eb61abb94
4 changed files with 14 additions and 9 deletions

View File

@@ -103,6 +103,7 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){
// Create New Layer // Create New Layer
if (ok1&&ok2) { if (ok1&&ok2) {
paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE); paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE);
paintingArea->historyadd();
UpdateGui(); UpdateGui();
} }
} }
@@ -122,6 +123,7 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
// Create New Layer // Create New Layer
if (ok1&&ok2) { if (ok1&&ok2) {
paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE); paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE);
paintingArea->historyadd();
UpdateGui(); UpdateGui();
} }
} }

View File

@@ -94,6 +94,7 @@ bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){
} }
Canvas->setRenderSettings(static_cast<bool>(rendersetting)); Canvas->setRenderSettings(static_cast<bool>(rendersetting));
openFile.close(); openFile.close();
Canvas->historyadd();
return true; return true;
} }

View File

@@ -106,7 +106,6 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
} }
this->layerBundle.push_back(newLayer); this->layerBundle.push_back(newLayer);
activeLayer = static_cast<int>(layerBundle.size()) - 1; activeLayer = static_cast<int>(layerBundle.size()) - 1;
historyadd();
return activeLayer; return activeLayer;
} }
@@ -524,10 +523,12 @@ void PaintingArea::historyGoBack(){
if (historyPresent != historyMaxPast) { if (historyPresent != historyMaxPast) {
if (--historyPresent == -1) if (--historyPresent == -1)
historyPresent = 99; historyPresent = 99;
if (activeLayer == -1)
activeLayer = 0;
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size()) if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
activeLayer--; activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size())-1;
if ((layerBundle.size() == 0) && (layerBundle.size() < history[static_cast<size_t>(historyPresent)].size())) if (history[static_cast<size_t>(historyPresent)].size() == 0)
activeLayer++; activeLayer = -1;
layerBundle = history[static_cast<size_t>(historyPresent)]; layerBundle = history[static_cast<size_t>(historyPresent)];
} }
this->guiReference->UpdateGui(); this->guiReference->UpdateGui();
@@ -537,10 +538,12 @@ void PaintingArea::historyGoForward(){
if (historyPresent != historyMaxFuture) { if (historyPresent != historyMaxFuture) {
if (++historyPresent == 100) if (++historyPresent == 100)
historyPresent = 0; historyPresent = 0;
if (activeLayer == -1)
activeLayer = 0;
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size()) if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
activeLayer--; activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size())-1;
if ((layerBundle.size() == 0) && (layerBundle.size() < history[static_cast<size_t>(historyPresent)].size())) if (history[static_cast<size_t>(historyPresent)].size() == 0)
activeLayer++; activeLayer = -1;
layerBundle = history[static_cast<size_t>(historyPresent)]; layerBundle = history[static_cast<size_t>(historyPresent)];
} }
this->guiReference->UpdateGui(); this->guiReference->UpdateGui();

View File

@@ -223,6 +223,7 @@ std::vector<LayerObject>* getLayerBundle();
IntelliToolsettings Toolsettings; IntelliToolsettings Toolsettings;
IntelliColorPicker colorPicker; IntelliColorPicker colorPicker;
void historyadd();
void historyGoBack(); void historyGoBack();
void historyGoForward(); void historyGoForward();
@@ -285,8 +286,6 @@ int historyMaxPast = 0;
int historyMaxFuture = 0; int historyMaxFuture = 0;
int historyPresent = 0; int historyPresent = 0;
void historyadd();
}; };
#endif #endif