Пример #1
0
bool fileSaveAs()
{
	wchar_t temp[_MAX_FNAME + 1];
	temp[0] = '\0';
	
	OPENFILENAMEW ofn;
	ZeroMemory(&ofn, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn);
	ofn.lpstrFile = temp;
	ofn.nMaxFile = _MAX_FNAME;
	ofn.lpstrDefExt = L"rocket";
	ofn.lpstrFilter = L"ROCKET File (*.rocket)\0*.rocket\0All Files (*.*)\0*.*\0\0";
	ofn.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
	
	if (GetSaveFileNameW(&ofn)) {
		if (document.save(temp)) {
			document.sendSaveCommand();
			setWindowFileName(temp);
			fileName = temp;
			
			mruFileList.insert(temp);
			mruFileList.update();
			DrawMenuBar(hwnd);
			return true;
		} else
			error("Failed to save file");
	}
	return false;
}
Пример #2
0
bool fileSave()
{
	if (fileName.empty())
		return fileSaveAs();

	if (!document.save(fileName.c_str())) {
		document.sendSaveCommand();
		error("Failed to save file");
		return false;
	}
	return true;
}
Пример #3
0
static bool fileSave()
{
	SyncDocument *doc = trackView->getDocument();
	if (doc->fileName.empty())
		return fileSaveAs();

	if (!doc->save(doc->fileName)) {
		doc->clientSocket.sendSaveCommand();
		error("Failed to save file");
		return false;
	}
	return true;
}