void CGumpEditorDoc::OnSettings()
{
	CGumpEditorView* pView = (CGumpEditorView*)FindView(RUNTIME_CLASS(CGumpEditorView));
	if (!pView) return;

	CDEditor& editor = pView->GetDEditor();

	CDialogSettings	dlg;

	dlg.m_width = editor.GetVirtualSize().cx;
	dlg.m_height = editor.GetVirtualSize().cy;
	dlg.m_gridWidth = editor.GetGridSize().cx;
	dlg.m_gridHeight = editor.GetGridSize().cy;
	editor.GetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom );
	
	dlg.m_strName = GetName();
	dlg.m_iAlpha = GetAlpha();
	dlg.m_iFlags = GetFlags();
	dlg.m_iFadeAlpha = GetFadeAlpha();
	dlg.m_iFadeTime = GetFadeTime();
	dlg.m_strShapeName = GetShapeName();
	GetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed);

	if( dlg.DoModal() == IDOK )
	{
		editor.SetGridSize( CSize( dlg.m_gridWidth, dlg.m_gridHeight ) );
		editor.SetVirtualSize( CSize( dlg.m_width, dlg.m_height ) );
		editor.SetMargins( dlg.m_marginLeft, dlg.m_marginTop, dlg.m_marginRight, dlg.m_marginBottom );
		
		SetName(dlg.m_strName);
		SetAlpha(dlg.m_iAlpha);
		SetFlags(dlg.m_iFlags);
		SetFade(dlg.m_iFadeAlpha, dlg.m_iFadeTime);
		SetShapeName(dlg.m_strShapeName);
		SetEventHandler(dlg.m_strEvClick, dlg.m_strEvClose, dlg.m_strEvMouseUp, dlg.m_strEvMouseDown, dlg.m_strEvKeyPressed);
		
		editor.RedrawWindow();
	}
}
BOOL CGumpEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
	// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.
	CStdioFile file;
	if (!file.Open(lpszPathName, CFile::modeCreate | CFile::modeWrite | CFile::typeText))
		return FALSE;
	
	CString str;
	CSize size = m_objs.GetVirtualSize();
	str = "<?xml version='1.0'?>\n";
	file.WriteString(str);

	str.Format("<form width='%d' height='%d' alpha='%d' flags='%d' shape='%s'>\n", size.cx, size.cy, GetAlpha(), GetFlags(), GetShapeName());
	file.WriteString( str );

	str.Format(" <fade alpha='%d' time='%d'/>\n", GetFadeAlpha(), GetFadeTime());
	file.WriteString(str);
	str.Format(" <event onclick='%s' onclose='%s' onmouseup='%s' onmousedown='%s' onkeypressed='%s'/>\n",
			GetEventHandler(ONCLICK), GetEventHandler(ONCLOSE), GetEventHandler(ONMOUSEUP), GetEventHandler(ONMOUSEDOWN), GetEventHandler(ONKEYPRESSED));
	file.WriteString(str);

	int count = 0;
	CDiagramEntity* obj;
	while( ( obj = m_objs.GetAt( count++ ) ) ) {
		file.WriteString( obj->GetString(TRUE) + _T( "\n" ) );
		file.WriteString( obj->GetString(FALSE) + _T( "\n" ) );
	}

	file.WriteString("</form>\n");

	file.Close();

	m_objs.SetModified( FALSE );

	SetModifiedFlag(FALSE);

	return TRUE;
}
Ejemplo n.º 3
0
 int NSF::GetLength ()
 {
   return GetPlayTime () + GetLoopTime () * GetLoopNum () + GetFadeTime ();
 }