コード例 #1
0
BOOL CMotionsDlg::OnKillActive ()
{
	if (m_Compiling)
	{
		return TRUE;
	}
	char OldMotionName[MAX_PATH];
	strcpy (OldMotionName, m_MotionFilename);

	UpdateData (TRUE);
	if (m_FilenameChanged)
	{
		m_FilenameChanged = false;
		if (!MakeHelp_GetRelativePath (m_Project, m_MotionFilename, OldMotionName))
		{
			m_MotionFilename = OldMotionName;
			UpdateData (FALSE);
			return FALSE;
		}
	}

	GetCurrentMotionIndex ();
	SetMotionFromDialog ();
	return TRUE;
}
コード例 #2
0
void CMotionsDlg::OnBrowsemotion() 
{
	CFileDialog *FileDlg = MyFileDialog_Create
	(
	  TRUE, IDS_MOTIONFILEPROMPT, IDS_MOTFILEEXT, IDS_MOTFILEFILTER,
	  m_MotionFilename, OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST, this
	);
	if (FileDlg != NULL)
	{
		if (FileDlg->DoModal () == IDOK)
		{
			char NewMotionName[MAX_PATH];

			SetModifiedFlag (true);
			strcpy (NewMotionName, m_MotionFilename);

			if (MakeHelp_GetRelativePath (m_Project, FileDlg->GetPathName (), NewMotionName))
			{
				m_MotionFilename = NewMotionName;
				SetMotionTypeFromFilename ();
				m_FilenameChanged = false;
			}
			UpdateData (FALSE);
		}
		delete FileDlg;	
	}
	else
	{
		AfxMessageBox (IDS_OUTOFMEMORY);
	}
}
コード例 #3
0
BOOL CTargetDlg::OnKillActive ()
{
	if (m_Compiling)
	{
		return TRUE;
	}
	char OldTargetName[MAX_PATH];
	strcpy (OldTargetName, m_TargetName);
	if (UpdateData (TRUE))
	{
		if (m_FilenameChanged)
		{
			// Have to set filename changed to false here before calling GetRelativePath.
			// Otherwise OnKillFocus will get called if an error message dialog box pops up, and
			// we end up with two of 'em.  The wonders of event-driven programming...
			m_FilenameChanged = false;
			if (!MakeHelp_GetRelativePath (m_Project, m_TargetName, OldTargetName))
			{
				m_TargetName = OldTargetName;
				UpdateData (FALSE);
				return FALSE;
			}
		}
		AProject_SetOutputFilename (m_Project, m_TargetName);
		return TRUE;
	}
	return FALSE;
}
コード例 #4
0
void CMotionsDlg::OnKillfocusEditmotion() 
{
	if (m_FilenameChanged)
	{
		char OldMotionName[MAX_PATH];

		// make sure that the new file is relative if required
		strcpy (OldMotionName, m_MotionFilename);

		UpdateData (TRUE);
		if (MakeHelp_GetRelativePath (m_Project, m_MotionFilename, OldMotionName))
		{
			SetMotionTypeFromFilename ();
		}
		else
		{
			m_MotionFilename = OldMotionName;
		}
		UpdateData (FALSE);
		m_FilenameChanged = false;
	}	
}
コード例 #5
0
void CMotionsDlg::OnSelchangeMotionslist() 
{
	char OldMotionName[MAX_PATH];
	strcpy (OldMotionName, m_MotionFilename);

	UpdateData (TRUE);
	if (m_FilenameChanged)
	{
		m_FilenameChanged = false;
		if (!MakeHelp_GetRelativePath (m_Project, m_MotionFilename, OldMotionName))
		{
			m_MotionFilename = OldMotionName;
		}
	}
	SetMotionFromDialog ();

	int CurSel = m_MotionsList.GetCurSel ();

	SetupCurrentItem (CurSel);

	UpdateData (FALSE);
}
コード例 #6
0
ファイル: BodyDlg.cpp プロジェクト: 5432935/genesis3d
BOOL CBodyDlg::OnKillActive ()
{
	if (m_Compiling)
	{
		return TRUE;
	}

	static const ApjBodyFormat Fmts[] = {ApjBody_Max, ApjBody_Nfo, ApjBody_Bdy, ApjBody_Act};

	// Save body name setting so we can go back if necessary
	char OldBodyName[MAX_PATH];
	strcpy (OldBodyName, m_BodyName);

	if (UpdateData (TRUE))
	{
		if (m_FilenameChanged)
		{
			// Have to set filename changed to false here before calling GetRelativePath.
			// Otherwise OnKillFocus will get called if an error message dialog box pops up, and
			// we end up with two of 'em.  The wonders of event-driven programming...
			m_FilenameChanged = false;
			if (MakeHelp_GetRelativePath (m_Project, m_BodyName, OldBodyName))
			{
				SetBodyTypeFromFilename ();
			}
			else
			{
				m_BodyName = OldBodyName;
				UpdateData (FALSE);
				return FALSE;
			}
		}
		AProject_SetBodyFilename (m_Project, m_BodyName);
		AProject_SetBodyFormat (m_Project, Fmts[m_BodyFormat]);
		return TRUE;
	}
	return FALSE;
}
コード例 #7
0
ファイル: BodyDlg.cpp プロジェクト: 5432935/genesis3d
void CBodyDlg::OnKillfocusEditbody() 
{
	UpdateData (true);

	// have to do this on KillFocus because we want to set the body type.
	if (m_FilenameChanged)
	{
		char NewBodyName[MAX_PATH];

		strcpy (NewBodyName, m_BodyName);
		UpdateData (TRUE);
		if (MakeHelp_GetRelativePath (m_Project, m_BodyName, NewBodyName))
		{
			SetBodyTypeFromFilename ();
			m_FilenameChanged = false;
		}
		else
		{
			m_BodyName = NewBodyName;
			m_FilenameChanged = false;
		}
		UpdateData (FALSE);
	}
}
コード例 #8
0
void CTargetDlg::OnBrowsetarget() 
{
	CFileDialog *FileDlg = MyFileDialog_Create
	(
	  FALSE, IDS_TARGETPROMPT, IDS_ACTFILEEXT, IDS_ACTFILEFILTER,
	  m_TargetName, OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST, this
	);
	
	if (FileDlg->DoModal () == IDOK)
	{
		char NewTargetName[MAX_PATH];

		SetModifiedFlag (true);
		strcpy (NewTargetName, m_TargetName);
		if (MakeHelp_GetRelativePath (m_Project, FileDlg->GetPathName (), NewTargetName))
		{
			m_TargetName = NewTargetName;
			m_FilenameChanged = false;
		}
		UpdateData (FALSE);
	}

	delete FileDlg;
}
コード例 #9
0
void CMotionsDlg::OnDropFiles (HDROP hDrop)
{
	// Files dropped.  Add each one to the listbox.
	// The motion name defaults to the name part of the full pathname

	// First make sure to update the current motion info
	OnSelchangeMotionslist ();

	bool AddedOne = false;

	// get the count
	const UINT FileCount = DragQueryFile (hDrop, 0xffffffff, NULL, 0);
	for (UINT iFile = 0; iFile < FileCount; ++iFile)
	{
		// get the file and add it to the motions list
		char Filename[MAX_PATH];
		char MotionName[MAX_PATH];
		char NewFilename[MAX_PATH];
		int Index;

		// get the filename
		DragQueryFile (hDrop, iFile, Filename, sizeof (Filename));

		// if we get a path that's not relative to the current path, then just exit
		strcpy (NewFilename, Filename);
		if (!MakeHelp_GetRelativePath (m_Project, Filename, NewFilename))
		{
			goto DropCleanup;
		}

		// Default motion name will be the base filename
		FilePath_GetName (Filename, MotionName);

		// Get motion type.
		// If the extension indicates that it's a Genesis3D motion file, then load
		// the motion and get its name.
		// We'll have to check for duplicates and display a message.
		ApjMotionFormat Fmt = AProject_GetMotionFormatFromFilename (Filename);
		if (Fmt == ApjMotion_Invalid)
		{
			// assume MAX
			Fmt = ApjMotion_Max;
		}
		else if (Fmt == ApjMotion_Mot)
		{
			// it's a Genesis3D motion file.  Try to load it.
			geVFile *MotFile = geVFile_OpenNewSystem (NULL, GE_VFILE_TYPE_DOS, Filename, NULL, GE_VFILE_OPEN_READONLY);
			if (MotFile != NULL)
			{
				// opened...Let's try to load it.
				geMotion *Motion = geMotion_CreateFromFile (MotFile);
				if (Motion != NULL)
				{
					// get the name from the motion
					const char *Name = geMotion_GetName (Motion);
					if (Name != NULL)
					{
						strcpy (MotionName, Name);
					}
					geMotion_Destroy (&Motion);
				}
				geVFile_Close (MotFile);
			}
		}

		// Well, we've determined the motion name.  Make sure it's unique.
		if (m_MotionsList.FindStringExact (-1, MotionName) != LB_ERR)
		{
			CString Msg;

			AfxFormatString2 (Msg, IDS_CANTDROPMOTION, Filename, MotionName);
			AfxMessageBox (Msg);
		}
		else
		{
			const geBoolean OptFlag = AOptions_GetMotionOptimizationFlag (m_Options);
			int OptLevel = AOptions_GetMotionOptimizationLevel (m_Options);
			// Everything's cool, so add it to the listbox.
			if (AProject_AddMotion (m_Project, MotionName, NewFilename, Fmt, OptFlag, OptLevel, "", &Index) != GE_FALSE)
			{
				// And add to listbox
				int LbItem = m_MotionsList.AddString (MotionName);
				if ((LbItem == LB_ERR) || (LbItem == LB_ERRSPACE))
				{
					// couldn't add it to listbox, so remove it
					CString Msg;

					AProject_RemoveMotion (m_Project, Index);

					AfxFormatString1 (Msg, IDS_ERRORDROPMOTION, Filename);
					AfxMessageBox (Msg);
				}
				else
				{
					// Added it to the listbox, so update item data
					m_MotionsList.SetItemData (LbItem, Index);
					SetModifiedFlag (true);
					AddedOne = true;
				}
			}
		}
	}

	// Let's focus at the beginning, 'cause I don't know what else to do...
	if (AddedOne)
	{
		SetupCurrentItem (0);
		UpdateData (FALSE);
	}

DropCleanup:
	// gotta do this or we'll leak memory and crash windows
	DragFinish (hDrop);
}