CStack* CDocument::AddNewStack( std::string inStackName ) { ObjectID stackID = GetUniqueIDForStack(); std::stringstream fileName; fileName << "stack_" << stackID << ".xml"; std::string stackURL = mURL; if( stackURL[stackURL.length()-1] != '/' ) stackURL.append( 1, '/' ); stackURL.append( fileName.str() ); if( inStackName.size() == 0 ) { std::stringstream nameForUser; nameForUser << "Stack " << mStacks.size() +1; inStackName = nameForUser.str(); } CStack * theStack = NewStackWithURLIDNameForDocument( stackURL, stackID, inStackName, fileName.str(), this ); theStack->AddNewCardWithBackground(); theStack->SetLoaded(true); mStacks.push_back( theStack ); theStack->Release(); IncrementChangeCount(); return theStack; }