Skip to content
Snippets Groups Projects
Commit f1f1ec41 authored by jsiegle's avatar jsiegle
Browse files

If windowBounds file is missing, application no longer crashes

parent 64fca91a
No related branches found
No related tags found
No related merge requests found
......@@ -92,6 +92,7 @@ void MainWindow::saveWindowBounds()
File file = File("./windowState.xml");
XmlElement* xml = new XmlElement("MAINWINDOW");
XmlElement* bounds = new XmlElement("BOUNDS");
......@@ -121,31 +122,35 @@ void MainWindow::loadWindowBounds()
XmlDocument doc (file);
XmlElement* xml = doc.getDocumentElement();
// if (xml == 0 || ! xml->hasTagName (T("MAINWINDOW")))
// {
// delete xml;
// // return "Not a valid file.";
// }
if (xml == 0 || ! xml->hasTagName (T("MAINWINDOW")))
{
std::cout << "File not found." << std::endl;
delete xml;
centreWithSize (800, 600);
String description;// = T(" ");
} else {
forEachXmlChildElement (*xml, e)
{
String description;// = T(" ");
int x = e->getIntAttribute("x");
int y = e->getIntAttribute("y");
int w = e->getIntAttribute("w");
int h = e->getIntAttribute("h");
forEachXmlChildElement (*xml, e)
{
bool fs = e->getBoolAttribute("fullscreen");
int x = e->getIntAttribute("x");
int y = e->getIntAttribute("y");
int w = e->getIntAttribute("w");
int h = e->getIntAttribute("h");
// without the correction, you get drift over time
setTopLeftPosition(x,y-27);
getContentComponent()->setBounds(0,0,w,h-33);
//setFullScreen(fs);
bool fs = e->getBoolAttribute("fullscreen");
}
// without the correction, you get drift over time
setTopLeftPosition(x,y-27);
getContentComponent()->setBounds(0,0,w,h-33);
//setFullScreen(fs);
delete xml;
}
delete xml;
}
// return "Everything went ok.";
}
\ No newline at end of file
......@@ -407,37 +407,8 @@ void ProcessorGraph::removeProcessor(GenericProcessor* processor) {
std::cout << "Removing processor with ID " << processor->getNodeId() << std::endl;
// GenericProcessor* source = processor->getSourceNode();
// GenericProcessor* dest = processor->getDestNode();
// int numInputs = processor->getNumInputs();
// std::cout << " Source " << source << std::endl;
// std::cout << " Dest " << dest << std::endl;
removeNode(processor->getNodeId());
// eliminate connections for now
/*if (dest !=0 && source !=0) {
std::cout << " Making new connections...." << std::endl;
// connect source and dest
for (int chan = 0; chan < numInputs; chan++) {
addConnection(source->getNodeId(),
chan,
dest->getNodeId(),
chan);
}
}*/
// if (dest != 0)
// dest->setSourceNode(source);
// if (source != 0)
// source->setDestNode(dest);
}
void ProcessorGraph::setUIComponent(UIComponent* ui)
......
......@@ -1004,7 +1004,9 @@ const String FilterViewport::loadState(const File& file)
if (xml == 0 || ! xml->hasTagName (T("PROCESSORGRAPH")))
{
std::cout << "File not found." << std::endl;
delete xml;
// don't do anything
return "Not a valid file.";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment