Ejemplo n.º 1
0
LRESULT CALLBACK DocWin::IdmSave(
    HWND hwnd,
    WPARAM wParam,
    LPARAM lParam
    ) {
    SaveDoc(hwnd);
    return 0;
}
Ejemplo n.º 2
0
bool AssetManager::SaveFile (const char* filename)
{
  csRef<iDocument> doc = SaveDoc ();

  Report ("Writing '%s' at '%s\n", filename, vfs->GetCwd ());
  csRef<iString> xml;
  xml.AttachNew (new scfString ());
  doc->Write (xml);
  vfs->WriteFile (filename, xml->GetData (), xml->Length ());
  return true;
}
Ejemplo n.º 3
0
void CXMLDlg::CreateNewProject(HTREEITEM pItem)
{
	AGDOCTYPE ProjectType = GetCurrentDocType(pItem);
	if (ProjectType == DOC_CALENDAR)
		return;

	ASSERT(!m_pAGDoc);

	if (!(m_pAGDoc = new CAGDoc()))
	{
		ASSERT(false);
		return;
	}

	m_pAGDoc->SetDocType(ProjectType);
	m_pAGDoc->SetPortrait(GetCurrentPortrait(pItem));

	CString strFileName = GetCurrentObjectFile(pItem);
	m_szProjectPath = strFileName.Left(strFileName.ReverseFind('\\')+1);
	CString szName = strFileName.Mid(strFileName.ReverseFind('\\')+1);
	m_pAGDoc->SetFileName(CString(szName)); // Filename and extension only; no path

	int nPages = CreatePages(pItem);

	m_pAGDoc->SetCurrentPageNum(0);
	m_pAGDoc->SetModified(false);

	// Create Dir
	CString szDir = _T("D:\\content\\"); // m_szProjectPath;
	CreateDirectory(szDir, NULL);
	szDir += szName.Left(2);
	szDir += '\\';
	CreateDirectory(szDir, NULL);

	// Create File
	// If you want to remove the old extension first, uncomment the line below
	//szName = szName.Left(szName.ReverseFind('.'));
	CString szFile = szDir + szName + CString(_T("ctp"));
	
	// Keep the tree relative current
	bool bSaveOK = SaveDoc(szFile);

	delete m_pAGDoc;
	m_pAGDoc = NULL;
}
Ejemplo n.º 4
0
/*
    SaveAs
    ------

    calls the common Windows dialog function to prompt the user for the
    filename to use
*/
void
TOLEDocument::SaveAs ()
{
  char          path[MAXPATHLENGTH];  // result of GetSaveFileName()
  OPENFILENAME  fnStruct;

  Setup (&fnStruct);
  fnStruct.Flags |= OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
  wsprintf (path, "*.%s", (LPSTR) szFileExt);
  fnStruct.lpstrFile = path;

  if (GetSaveFileName (&fnStruct)) {
    type = doctypeFromFile;
    SetDocumentName (path);  // we must do this BEFORE we call SaveDoc()
    SaveDoc();

    //
    // now inform the server library that we have renamed the document
    //
    OleRenameServerDoc (lhDoc, szName);
  }
}
Ejemplo n.º 5
0
BOOL DocWin::IsDocSaved(
    HWND hwnd,
    WPARAM wParam,
    LPARAM lParam
    ) {
    if(m_pEdit->IsModified()) {
        char msg[MAX_PATH + 100];
        char fullpath[MAX_PATH]; fullpath[0] = '\0';
        GetWindowText(hwnd, fullpath, MAX_PATH);
        strcpy(msg, "Save changes to ");
        strcat(msg, fullpath);
        strcat(msg, " ?");
        int answer = MessageBox(hwnd, msg, "RubyWin", MB_YESNOCANCEL);
        switch(answer) {
        case IDYES:
            return SaveDoc(hwnd);
        case IDNO:
            return TRUE;
        case IDCANCEL:
            return FALSE;
        }
    }
    return TRUE;
}