Beispiel #1
0
bool MAPS::OpenMap(HWND hMaps, const char* fileName)
{
	MapNode* newMap = new MapNode;

	if ( newMap->map.LoadFile(fileName) )
	{
		if ( newMap->map.setHandle( AddMDIChild(hMaps, fileName) ) )
		{
			SetWindowText(newMap->map.getHandle(), fileName);
			PushNode(newMap);
			Focus(newMap->map.getHandle());
			curr->Scroll(SCROLL_X|SCROLL_Y);
			curr->Redraw(true);
			return true;
		} 
		else
		{
			delete newMap;
			Error("Failed to create MDI Child Window!");
		}
	}
	else
	{
		delete newMap;
		Error(LastError);
	}

	return false;
}
Beispiel #2
0
bool MAPS::NewMap(u16 width, u16 height, u16 tileset, u32 terrain, u32 triggers, HWND hMaps)
{
	MapNode* newMap = new MapNode;
	
	if ( newMap->map.CreateNew(width, height, tileset, terrain, triggers) )
	{
		char title[256] = { "Untitled" };
		if ( UntitledNumber > 0 )
			sprintf_s(title, 256, "Untitled %d", UntitledNumber);

		if ( newMap->map.setHandle(AddMDIChild(hMaps, title)) )
		{
			curr = &newMap->map;
			UntitledNumber++;
			PushNode(newMap);
			Focus(newMap->map.getHandle());
			curr->Redraw(true);
			return true;
		}
		else
		{
			delete newMap;
			Error("Failed to create MDI Child Window!");
		}
	}
	else
	{
		CHKD_ERR("Failed to create scenario file!\n\nError in %s\n\n%s", LastErrorLoc, LastError);
		Error(LastError);
	}

	return false;
}
Beispiel #3
0
BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:
		AddMDIChild(new CSimpleMDIChild); // CMDIFrame::RemoveMDIChild deletes this pointer
		return TRUE;
	case IDM_FILE_CLOSE:          // Close the active MDI window
		GetActiveMDIChild()->SendMessage(WM_CLOSE, 0, 0);
		return TRUE;
	case IDM_FILE_OPEN:
		OnFileOpen();
		return TRUE;
	case IDM_FILE_SAVE:
		OnFileSave();
    return TRUE;
	case IDM_FILE_SAVEAS:
		OnFileSaveAs();
    return TRUE;
	case IDM_FILE_PRINT:
		OnFilePrint();
		return TRUE;
	case IDW_VIEW_STATUSBAR:
		OnViewStatusbar();

		break;
	case IDW_VIEW_TOOLBAR:
		OnViewToolbar();
		break;
	case IDW_WINDOW_ARRANGE:
		::PostMessage (GetView()->GetHwnd(), WM_MDIICONARRANGE, 0L, 0L) ;
		break;
	case IDW_WINDOW_CASCADE:
		::PostMessage (GetView()->GetHwnd(), WM_MDICASCADE, 0L, 0L) ;
		break;
	case IDW_WINDOW_CLOSEALL:
		RemoveAllMDIChildren();
		break;
	case IDW_WINDOW_TILE:
		::PostMessage (GetView()->GetHwnd(), WM_MDITILE, 0L, 0L) ;
		break;
	default:    // Pass to active child...
		{
			if (GetActiveMDIChild())
				GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam);
		}
		break ;
	case IDM_FILE_EXIT:
		::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
		return TRUE;
	case IDM_HELP_ABOUT:
		OnHelp();
		return TRUE;
	}
	return FALSE;
}
Beispiel #4
0
void CMainMDIFrame::OnFileOpen()
{
	TCHAR szFilePathName[_MAX_PATH] = _T( LiteSQL_L( "" ));
	OPENFILENAME ofn = {0};
	ofn.lStructSize = sizeof(OPENFILENAME);
	ofn.hwndOwner = m_hWnd;
	ofn.lpstrFile = szFilePathName;
	ofn.nMaxFile = _MAX_PATH;
	ofn.lpstrTitle = _T( LiteSQL_L( "Open File" ));

	// Bring up the dialog, and open the file
	::GetOpenFileName(&ofn);
  
  AddMDIChild(new CSimpleMDIChild(ofn.lpstrFile)); // CMDIFrame::RemoveMDIChild deletes this pointer
	
  // TODO:
	// Add your own code here. Refer to the tutorial for additional information 
}
Beispiel #5
0
BOOL CMainMDIFrame::OnFileNew()
{
	AddMDIChild(new CSimpleMDIChild);
	return TRUE;
}