//------------------------------------------------------------------------------ // virtual void SaveData() //------------------------------------------------------------------------------ void SetPathDialog::SaveData() { #ifdef DEBUG_SETPATH_DIALOG_SAVE MessageInterface::ShowMessage(wxT("SetPathDialog::SaveData() entered.\n")); #endif canClose = true; FileManager *fm = FileManager::Instance(); wxArrayString pathNames; // Gmat Function paths if (mGmatFunPathPanel->HasDataChanged()) { #ifdef DEBUG_SETPATH_DIALOG_SAVE MessageInterface::ShowMessage(wxT(" Saving GmatFunction paths...\n")); #endif pathNames = mGmatFunPathPanel->GetPathNames(); #ifdef DEBUG_SETPATH_DIALOG_SAVE MessageInterface::ShowMessage(wxT(" ...Adding %d paths\n"), pathNames.GetCount()); #endif fm->ClearGmatFunctionPath(); for (UnsignedInt i=0; i<pathNames.GetCount(); i++) { #ifdef DEBUG_SETPATH_DIALOG_SAVE MessageInterface::ShowMessage(wxT(" ...Adding '%s'\n"), pathNames[i].c_str()); #endif fm->AddGmatFunctionPath(pathNames[i].c_str(), false); } } // Matlab Function paths if (mMatlabPathPanel->HasDataChanged()) { #ifdef DEBUG_SETPATH_DIALOG_SAVE MessageInterface::ShowMessage(wxT(" Saving MatlabFunction paths...\n")); #endif pathNames = mMatlabPathPanel->GetPathNames(); fm->ClearMatlabFunctionPath(); for (UnsignedInt i=0; i<pathNames.GetCount(); i++) fm->AddMatlabFunctionPath(pathNames[i].c_str(), false); } // Log file path if (mOutputPathPanel->HasDataChanged()) { wxString pathName = mOutputPathPanel->GetFullPathName().c_str(); if (wxDir::Exists(pathName.c_str())) { #ifdef DEBUG_SETPATH_DIALOG_SAVE MessageInterface::ShowMessage(wxT(" Saving Log path to '%s'\n"), pathName.c_str()); #endif fm->SetAbsPathname(wxT("OUTPUT_PATH"), pathName); MessageInterface::SetLogPath(pathName); } else { wxString str; str.Printf(wxT("The directory \" %s \" does not exist.\n"), pathName.c_str()); wxMessageBox(str, wxT("Directory Error")); // find page int numPage = mPathNotebook->GetPageCount(); for (int i=0; i<numPage; i++) { if (mPathNotebook->GetPageText(i) == wxT("Output")) { mPathNotebook->SetSelection(i); break; } } canClose = false; } } #ifdef DEBUG_SETPATH_DIALOG_SAVE MessageInterface::ShowMessage(wxT("SetPathDialog::SaveData() exiting.\n")); #endif }
//------------------------------------------------------------------------------ bool GmatFunction::SetStringParameter(const Integer id, const wxString &value) { #ifdef DEBUG_FUNCTION_SET MessageInterface::ShowMessage (wxT("GmatFunction::SetStringParameter() entered, id=%d, value=%s\n"), id, value.c_str()); #endif switch (id) { case FUNCTION_PATH: { FileManager *fm = FileManager::Instance(); // Compose full path if it has relative path. // Assuming if first char has '.', it has relative path. wxString temp = GmatStringUtil::Trim(value); if (temp[0] == wxT('.')) { wxString currPath = fm->GetCurrentPath(); #ifdef DEBUG_FUNCTION_SET MessageInterface::ShowMessage(wxT(" currPath=%s\n"), currPath.c_str()); #endif functionPath = currPath + temp.substr(1); } else { functionPath = value; } // Add to GmatFunction path fm->AddGmatFunctionPath(functionPath); // Remove path functionName = GmatFileUtil::ParseFileName(functionPath); // Remove .gmf if GmatGmatFunction wxString::size_type dotIndex = functionName.find(wxT(".gmf")); functionName = functionName.substr(0, dotIndex); #ifdef DEBUG_FUNCTION_SET MessageInterface::ShowMessage (wxT(" functionPath=<%s>\n"), functionPath.c_str()); MessageInterface::ShowMessage (wxT(" functionName=<%s>\n"), functionName.c_str()); #endif return true; } case FUNCTION_NAME: { // Remove path if it has one functionName = GmatFileUtil::ParseFileName(functionPath); // Remove .gmf if GmatGmatFunction wxString::size_type dotIndex = functionName.find(wxT(".gmf")); functionName = functionName.substr(0, dotIndex); return true; } default: return Function::SetStringParameter(id, value); } }