This commit is contained in:
parent
e04ad09c18
commit
b16738b403
13 changed files with 491 additions and 312 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include "MapEditView.h"
|
#include "MapEditView.h"
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -21,8 +22,10 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CCore::CCore()
|
CCore::CCore()
|
||||||
{
|
{
|
||||||
|
MouseMode=MOUSE_MODE_NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CCore::~CCore()
|
CCore::~CCore()
|
||||||
{
|
{
|
||||||
|
@ -32,6 +35,9 @@ CCore::~CCore()
|
||||||
void CCore::Init(CMapEditView *Wnd)
|
void CCore::Init(CMapEditView *Wnd)
|
||||||
{
|
{
|
||||||
ParentWindow=Wnd;
|
ParentWindow=Wnd;
|
||||||
|
// ParentWindow->SetCapture();
|
||||||
|
// ParentWindow->SetCapture();
|
||||||
|
|
||||||
// TestLayer.Init();
|
// TestLayer.Init();
|
||||||
// UpdateView();
|
// UpdateView();
|
||||||
|
|
||||||
|
@ -42,6 +48,9 @@ void CCore::Init(CMapEditView *Wnd)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::Render()
|
void CCore::Render()
|
||||||
{
|
{
|
||||||
|
TRACE0("HERE");
|
||||||
|
Layers[ActiveLayer].Render();
|
||||||
|
|
||||||
// if (RenderMode & RENDER_MODE_GFX) TestLayer.Render();
|
// if (RenderMode & RENDER_MODE_GFX) TestLayer.Render();
|
||||||
// if (RenderMode & RENDER_MODE_POS) TestLayer.UpdateCursor(this);
|
// if (RenderMode & RENDER_MODE_POS) TestLayer.UpdateCursor(this);
|
||||||
// RenderMode=0;
|
// RenderMode=0;
|
||||||
|
@ -61,15 +70,34 @@ void CCore::UpdateView(float XOfs,float YOfs,float ZOfs)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Control *****************************************************************/
|
/*** Control *****************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CCore::SetMouseMode(MOUSE_MODE CurrentMode,MOUSE_MODE NewMode)
|
||||||
|
{
|
||||||
|
if (MouseMode==CurrentMode)
|
||||||
|
{
|
||||||
|
// ReleaseCapture();
|
||||||
|
MouseMode=NewMode;
|
||||||
|
// if (MouseMode!=MOUSE_MODE_NONE) ParentWindow->SetCapture(); // Set new capture
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
void CCore::LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||||
{
|
{
|
||||||
// TestLayer.LButtonControl(nFlags,point,DownFlag);
|
// TestLayer.LButtonControl(nFlags,point,DownFlag);
|
||||||
|
SetMouseMode(MOUSE_MODE_NONE,MOUSE_MODE_LMB);
|
||||||
|
TRACE0("LMB\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
void CCore::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||||
{
|
{
|
||||||
|
if (DownFlag)
|
||||||
|
SetMouseMode(MOUSE_MODE_NONE,MOUSE_MODE_MMB);
|
||||||
|
else
|
||||||
|
SetMouseMode(MOUSE_MODE_MMB,MOUSE_MODE_NONE);
|
||||||
|
TRACE0("MMB\n");
|
||||||
|
/*
|
||||||
if (DownFlag)
|
if (DownFlag)
|
||||||
{
|
{
|
||||||
LastMousePos=point;
|
LastMousePos=point;
|
||||||
|
@ -79,13 +107,15 @@ void CCore::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||||
{
|
{
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
void CCore::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||||
{
|
{
|
||||||
// TestLayer.RButtonControl(nFlags,point,DownFlag);
|
// TestLayer.RButtonControl(nFlags,point,DownFlag);
|
||||||
|
SetMouseMode(MOUSE_MODE_NONE,MOUSE_MODE_RMB);
|
||||||
|
TRACE0("RMB\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -102,12 +132,12 @@ void CCore::MouseWheel(UINT nFlags, short zDelta, CPoint &pt)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::MouseMove(UINT nFlags, CPoint &Point,BOOL CaptureFlag)
|
void CCore::MouseMove(UINT nFlags, CPoint &point,BOOL CaptureFlag)
|
||||||
{
|
{
|
||||||
float XOfs=0;
|
float XOfs=0;
|
||||||
float YOfs=0;
|
float YOfs=0;
|
||||||
|
|
||||||
CurrentMousePos=Point;
|
CurrentMousePos=point;
|
||||||
|
|
||||||
if (CaptureFlag)
|
if (CaptureFlag)
|
||||||
{
|
{
|
||||||
|
@ -121,15 +151,16 @@ float YOfs=0;
|
||||||
|
|
||||||
XOfs=LastMousePos.x-CurrentMousePos.x;
|
XOfs=LastMousePos.x-CurrentMousePos.x;
|
||||||
YOfs=LastMousePos.y-CurrentMousePos.y;
|
YOfs=LastMousePos.y-CurrentMousePos.y;
|
||||||
LastMousePos=Point;
|
LastMousePos=CurrentMousePos;
|
||||||
|
|
||||||
XOfs*=XS;
|
XOfs*=XS;
|
||||||
YOfs*=YS;
|
YOfs*=YS;
|
||||||
}
|
}
|
||||||
UpdateView(-XOfs,-YOfs,0);
|
UpdateView(-XOfs,-YOfs,0);
|
||||||
if (nFlags & MK_LBUTTON) LButtonControl(nFlags,Point,TRUE);
|
// if (nFlags & MK_LBUTTON) LButtonControl(nFlags,point,TRUE);
|
||||||
if (nFlags & MK_RBUTTON) RButtonControl(nFlags,Point,TRUE);
|
// if (nFlags & MK_RBUTTON) RButtonControl(nFlags,point,TRUE);
|
||||||
|
|
||||||
|
TRACE3("Move %i %i %i \n",point.x,point.y,CaptureFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -137,7 +168,7 @@ float YOfs=0;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::LayerAdd(char *Name)
|
void CCore::LayerAdd(char *Name)
|
||||||
{
|
{
|
||||||
sLayer NewLayer;
|
CLayer NewLayer;
|
||||||
|
|
||||||
if (!Name)
|
if (!Name)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +177,8 @@ sLayer NewLayer;
|
||||||
Name=DynName;
|
Name=DynName;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(NewLayer.Name,Name);
|
NewLayer.SetName(Name);
|
||||||
|
// strcpy(NewLayer.Name,Name);
|
||||||
TRACE1("New Layer [%s]\n",Name);
|
TRACE1("New Layer [%s]\n",Name);
|
||||||
Layers.push_back(NewLayer);
|
Layers.push_back(NewLayer);
|
||||||
|
|
||||||
|
@ -170,7 +202,7 @@ int CCore::LayerGetCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
sLayer const &CCore::LayerGet(int i)
|
CLayer &CCore::LayerGet(int i)
|
||||||
{
|
{
|
||||||
return(Layers[i]);
|
return(Layers[i]);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +218,7 @@ void CCore::LayerDelete(int Layer)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::LayerMoveUp(int Layer)
|
void CCore::LayerMoveUp(int Layer)
|
||||||
{
|
{
|
||||||
sLayer Tmp;
|
CLayer Tmp;
|
||||||
|
|
||||||
Tmp=Layers[Layer];
|
Tmp=Layers[Layer];
|
||||||
Layers[Layer]=Layers[Layer-1];
|
Layers[Layer]=Layers[Layer-1];
|
||||||
|
@ -198,7 +230,7 @@ sLayer Tmp;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CCore::LayerMoveDown(int Layer)
|
void CCore::LayerMoveDown(int Layer)
|
||||||
{
|
{
|
||||||
sLayer Tmp;
|
CLayer Tmp;
|
||||||
|
|
||||||
Tmp=Layers[Layer];
|
Tmp=Layers[Layer];
|
||||||
Layers[Layer]=Layers[Layer+1];
|
Layers[Layer]=Layers[Layer+1];
|
||||||
|
|
|
@ -7,14 +7,16 @@
|
||||||
|
|
||||||
#include <Vector>
|
#include <Vector>
|
||||||
#include "gl3d.h"
|
#include "gl3d.h"
|
||||||
|
#include "Layer.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
//struct sLayer;
|
enum MOUSE_MODE
|
||||||
struct sLayer
|
|
||||||
{
|
{
|
||||||
char Name[32];
|
MOUSE_MODE_NONE=0,
|
||||||
// sLayer *Next,*Prev;
|
MOUSE_MODE_LMB,
|
||||||
|
MOUSE_MODE_MMB,
|
||||||
|
MOUSE_MODE_RMB,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -35,14 +37,14 @@ public:
|
||||||
void Init(CMapEditView *Wnd);
|
void Init(CMapEditView *Wnd);
|
||||||
void Render();
|
void Render();
|
||||||
void UpdateView(float XOfs,float YOfs,float ZOfs);
|
void UpdateView(float XOfs,float YOfs,float ZOfs);
|
||||||
|
void SetMouseMode(MOUSE_MODE CurrentMode,MOUSE_MODE NewMode);
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
void LayerAdd(char *Name=0);
|
void LayerAdd(char *Name=0);
|
||||||
void LayerSetActive(int Layer);
|
void LayerSetActive(int Layer);
|
||||||
int LayerGetActive();
|
int LayerGetActive();
|
||||||
int LayerGetCount();
|
int LayerGetCount();
|
||||||
sLayer const &LayerGet(int i);
|
CLayer &LayerGet(int i);
|
||||||
void LayerDelete(int Layer);
|
void LayerDelete(int Layer);
|
||||||
void LayerMoveUp(int Layer);
|
void LayerMoveUp(int Layer);
|
||||||
void LayerMoveDown(int Layer);
|
void LayerMoveDown(int Layer);
|
||||||
|
@ -51,10 +53,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMapEditView *ParentWindow;
|
CMapEditView *ParentWindow;
|
||||||
|
MOUSE_MODE MouseMode;
|
||||||
CPoint CurrentMousePos,LastMousePos;
|
CPoint CurrentMousePos,LastMousePos;
|
||||||
Vec ViewPos;
|
Vec ViewPos;
|
||||||
|
|
||||||
std::vector<sLayer> Layers;
|
|
||||||
|
std::vector<CLayer> Layers;
|
||||||
int ActiveLayer;
|
int ActiveLayer;
|
||||||
|
|
||||||
|
|
||||||
|
|
67
Utils/MapEdit/Layer.cpp
Normal file
67
Utils/MapEdit/Layer.cpp
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
/******************/
|
||||||
|
/*** Layer Core ***/
|
||||||
|
/******************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "gl3d.h"
|
||||||
|
#include <gl\gl.h>
|
||||||
|
#include <gl\glu.h>
|
||||||
|
#include <gl\glut.h>
|
||||||
|
//#include "GLEnabledView.h"
|
||||||
|
|
||||||
|
//#include "MapEditDoc.h"
|
||||||
|
//#include "MapEditView.h"
|
||||||
|
|
||||||
|
#include "Layer.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
CLayer::CLayer()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/*****************************************************************************/
|
||||||
|
CLayer::~CLayer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayer::Init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayer::SetName(char *Str)
|
||||||
|
{
|
||||||
|
strcpy(Name,Str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CLayer::Render()
|
||||||
|
{
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glColor3f(1,0,1);
|
||||||
|
BuildGLBox(-1,LayerWidth+1,-1,0,LayerZ,LayerZ+1); // Bottom
|
||||||
|
BuildGLBox(-1,LayerWidth+1,LayerHeight+1,LayerHeight,LayerZ,LayerZ+1); // Top
|
||||||
|
BuildGLBox(-1,0,LayerHeight,0,LayerZ,LayerZ+1); // Left
|
||||||
|
BuildGLBox(LayerWidth,LayerWidth+1,LayerHeight,0,LayerZ,LayerZ+1); // Right
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
43
Utils/MapEdit/Layer.h
Normal file
43
Utils/MapEdit/Layer.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/******************/
|
||||||
|
/*** Layer Core ***/
|
||||||
|
/******************/
|
||||||
|
|
||||||
|
#ifndef __LAYER_HEADER__
|
||||||
|
#define __LAYER_HEADER__
|
||||||
|
|
||||||
|
#include <Vector>
|
||||||
|
#include "gl3d.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
class CLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLayer();
|
||||||
|
~CLayer();
|
||||||
|
// Blah
|
||||||
|
void Init();
|
||||||
|
void Render();
|
||||||
|
|
||||||
|
void SetName(char *Str);
|
||||||
|
char *GetName() {return(Name);}
|
||||||
|
|
||||||
|
// Control
|
||||||
|
// void LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
||||||
|
// void MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
||||||
|
// void RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag);
|
||||||
|
// void MouseWheel(UINT nFlags, short zDelta, CPoint &pt);
|
||||||
|
// void MouseMove(UINT nFlags, CPoint &point, BOOL CaptureFlag);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
char Name[32];
|
||||||
|
|
||||||
|
float LayerWidth,LayerHeight,LayerDepth;
|
||||||
|
float LayerX,LayerY,LayerZ;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
#endif
|
|
@ -5,7 +5,6 @@
|
||||||
#if !defined(AFX_MAINFRM_H__CEC14D79_A1F2_4281_AA53_544F0924E7D8__INCLUDED_)
|
#if !defined(AFX_MAINFRM_H__CEC14D79_A1F2_4281_AA53_544F0924E7D8__INCLUDED_)
|
||||||
#define AFX_MAINFRM_H__CEC14D79_A1F2_4281_AA53_544F0924E7D8__INCLUDED_
|
#define AFX_MAINFRM_H__CEC14D79_A1F2_4281_AA53_544F0924E7D8__INCLUDED_
|
||||||
|
|
||||||
#include "LayerBar.h"
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
#if _MSC_VER > 1000
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -21,7 +20,7 @@ public:
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
public:
|
public:
|
||||||
CLayerBar *GetLayerBar() {return(&m_wndLayerBar);}
|
CDialogBar *GetLayerBar() {return(&m_wndLayerBar);}
|
||||||
// Operations
|
// Operations
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ public:
|
||||||
protected: // control bar embedded members
|
protected: // control bar embedded members
|
||||||
CStatusBar m_wndStatusBar;
|
CStatusBar m_wndStatusBar;
|
||||||
CToolBar m_wndToolBar;
|
CToolBar m_wndToolBar;
|
||||||
CLayerBar m_wndLayerBar;
|
CDialogBar m_wndLayerBar;
|
||||||
|
|
||||||
|
|
||||||
// Generated message map functions
|
// Generated message map functions
|
||||||
|
|
|
@ -5,162 +5,87 @@ Version=1
|
||||||
LastClass=CMapEditView
|
LastClass=CMapEditView
|
||||||
LastTemplate=CDialog
|
LastTemplate=CDialog
|
||||||
NewFileInclude1=#include "stdafx.h"
|
NewFileInclude1=#include "stdafx.h"
|
||||||
NewFileInclude2=#include "MapEdit.h"
|
NewFileInclude2=#include "mapedit.h"
|
||||||
LastPage=0
|
LastPage=0
|
||||||
|
|
||||||
ClassCount=7
|
ClassCount=8
|
||||||
Class1=CMapEditApp
|
Class1=CChildFrame
|
||||||
Class2=CMapEditDoc
|
Class2=CGLEnabledView
|
||||||
Class3=CMapEditView
|
Class3=CListBoxEx
|
||||||
Class4=CMainFrame
|
Class4=CMainFrame
|
||||||
|
Class5=CMapEditApp
|
||||||
ResourceCount=10
|
|
||||||
Resource1=IDD_ABOUTBOX
|
|
||||||
Resource2=IDR_MAINFRAME
|
|
||||||
Resource3=IDR_MAPEDITYPE
|
|
||||||
Resource8=IDD_PROPPAGE_SMALL (English (U.S.))
|
|
||||||
Class5=CChildFrame
|
|
||||||
Class6=CAboutDlg
|
Class6=CAboutDlg
|
||||||
Resource4=IDR_MAINFRAME (English (U.S.))
|
Class7=CMapEditDoc
|
||||||
Resource5=IDD_ABOUTBOX (English (U.S.))
|
Class8=CMapEditView
|
||||||
Resource6=IDR_MAPEDITYPE (English (U.S.))
|
|
||||||
Resource7=IDD_PROPPAGE_LARGE (English (U.S.))
|
|
||||||
Resource9=IDD_DIALOGBAR (English (U.S.))
|
|
||||||
Class7=CLayerBar
|
|
||||||
Resource10=IDD_LAYERBAR (English (U.S.))
|
|
||||||
|
|
||||||
[CLS:CMapEditApp]
|
|
||||||
Type=0
|
|
||||||
HeaderFile=MapEdit.h
|
|
||||||
ImplementationFile=MapEdit.cpp
|
|
||||||
Filter=N
|
|
||||||
LastObject=CMapEditApp
|
|
||||||
|
|
||||||
[CLS:CMapEditDoc]
|
|
||||||
Type=0
|
|
||||||
HeaderFile=MapEditDoc.h
|
|
||||||
ImplementationFile=MapEditDoc.cpp
|
|
||||||
Filter=N
|
|
||||||
LastObject=CMapEditDoc
|
|
||||||
BaseClass=CDocument
|
|
||||||
VirtualFilter=DC
|
|
||||||
|
|
||||||
[CLS:CMapEditView]
|
|
||||||
Type=0
|
|
||||||
HeaderFile=MapEditView.h
|
|
||||||
ImplementationFile=MapEditView.cpp
|
|
||||||
Filter=W
|
|
||||||
LastObject=CMapEditView
|
|
||||||
BaseClass=CGLEnabledView
|
|
||||||
VirtualFilter=VWC
|
|
||||||
|
|
||||||
|
|
||||||
[CLS:CMainFrame]
|
|
||||||
Type=0
|
|
||||||
HeaderFile=MainFrm.h
|
|
||||||
ImplementationFile=MainFrm.cpp
|
|
||||||
Filter=D
|
|
||||||
LastObject=CMainFrame
|
|
||||||
BaseClass=CMDIFrameWnd
|
|
||||||
VirtualFilter=fWC
|
|
||||||
|
|
||||||
|
ResourceCount=4
|
||||||
|
Resource1=IDR_MAPEDITYPE (English (U.S.))
|
||||||
|
Resource2=IDD_ABOUTBOX (English (U.S.))
|
||||||
|
Resource3=IDR_MAINFRAME (English (U.S.))
|
||||||
|
Resource4=IDD_LAYERBAR (English (U.S.))
|
||||||
|
|
||||||
[CLS:CChildFrame]
|
[CLS:CChildFrame]
|
||||||
Type=0
|
Type=0
|
||||||
|
BaseClass=CMDIChildWnd
|
||||||
HeaderFile=ChildFrm.h
|
HeaderFile=ChildFrm.h
|
||||||
ImplementationFile=ChildFrm.cpp
|
ImplementationFile=ChildFrm.cpp
|
||||||
Filter=M
|
|
||||||
LastObject=CChildFrame
|
LastObject=CChildFrame
|
||||||
|
|
||||||
|
[CLS:CGLEnabledView]
|
||||||
|
Type=0
|
||||||
|
BaseClass=CView
|
||||||
|
HeaderFile=GLEnabledView.h
|
||||||
|
ImplementationFile=GLEnabledView.cpp
|
||||||
|
LastObject=CGLEnabledView
|
||||||
|
|
||||||
|
[CLS:CListBoxEx]
|
||||||
|
Type=0
|
||||||
|
BaseClass=CListBox
|
||||||
|
HeaderFile=ListBoxEx.h
|
||||||
|
ImplementationFile=ListBoxEx.cpp
|
||||||
|
LastObject=CListBoxEx
|
||||||
|
|
||||||
|
[CLS:CMainFrame]
|
||||||
|
Type=0
|
||||||
|
BaseClass=CMDIFrameWnd
|
||||||
|
HeaderFile=MainFrm.h
|
||||||
|
ImplementationFile=MainFrm.cpp
|
||||||
|
LastObject=CMainFrame
|
||||||
|
|
||||||
|
[CLS:CMapEditApp]
|
||||||
|
Type=0
|
||||||
|
BaseClass=CWinApp
|
||||||
|
HeaderFile=MapEdit.h
|
||||||
|
ImplementationFile=MapEdit.cpp
|
||||||
|
LastObject=CMapEditApp
|
||||||
|
|
||||||
[CLS:CAboutDlg]
|
[CLS:CAboutDlg]
|
||||||
Type=0
|
Type=0
|
||||||
|
BaseClass=CDialog
|
||||||
HeaderFile=MapEdit.cpp
|
HeaderFile=MapEdit.cpp
|
||||||
ImplementationFile=MapEdit.cpp
|
ImplementationFile=MapEdit.cpp
|
||||||
Filter=D
|
|
||||||
LastObject=CAboutDlg
|
LastObject=CAboutDlg
|
||||||
|
|
||||||
|
[CLS:CMapEditDoc]
|
||||||
|
Type=0
|
||||||
|
BaseClass=CDocument
|
||||||
|
HeaderFile=MapEditDoc.h
|
||||||
|
ImplementationFile=MapEditDoc.cpp
|
||||||
|
LastObject=CMapEditDoc
|
||||||
|
|
||||||
|
[CLS:CMapEditView]
|
||||||
|
Type=0
|
||||||
|
BaseClass=CGLEnabledView
|
||||||
|
HeaderFile=MapEditView.h
|
||||||
|
ImplementationFile=MapEditView.cpp
|
||||||
|
LastObject=CMapEditView
|
||||||
|
Filter=C
|
||||||
|
VirtualFilter=VWC
|
||||||
|
|
||||||
[DLG:IDD_ABOUTBOX]
|
[DLG:IDD_ABOUTBOX]
|
||||||
Type=1
|
Type=1
|
||||||
ControlCount=4
|
|
||||||
Control1=IDC_STATIC,static,1342177283
|
|
||||||
Control2=IDC_STATIC,static,1342308352
|
|
||||||
Control3=IDC_STATIC,static,1342308352
|
|
||||||
Control4=IDOK,button,1342373889
|
|
||||||
Class=CAboutDlg
|
Class=CAboutDlg
|
||||||
|
|
||||||
[MNU:IDR_MAINFRAME]
|
|
||||||
Type=1
|
|
||||||
Class=CMainFrame
|
|
||||||
Command1=ID_FILE_NEW
|
|
||||||
Command2=ID_FILE_OPEN
|
|
||||||
Command3=ID_FILE_PRINT_SETUP
|
|
||||||
Command4=ID_FILE_MRU_FILE1
|
|
||||||
Command5=ID_APP_EXIT
|
|
||||||
Command6=ID_VIEW_TOOLBAR
|
|
||||||
Command7=ID_VIEW_STATUS_BAR
|
|
||||||
CommandCount=8
|
|
||||||
Command8=ID_APP_ABOUT
|
|
||||||
|
|
||||||
[TB:IDR_MAINFRAME]
|
|
||||||
Type=1
|
|
||||||
Class=CMainFrame
|
|
||||||
Command1=ID_FILE_NEW
|
|
||||||
Command2=ID_FILE_OPEN
|
|
||||||
Command3=ID_FILE_SAVE
|
|
||||||
Command4=ID_EDIT_CUT
|
|
||||||
Command5=ID_EDIT_COPY
|
|
||||||
Command6=ID_EDIT_PASTE
|
|
||||||
Command7=ID_FILE_PRINT
|
|
||||||
CommandCount=8
|
|
||||||
Command8=ID_APP_ABOUT
|
|
||||||
|
|
||||||
[MNU:IDR_MAPEDITYPE]
|
|
||||||
Type=1
|
|
||||||
Class=CMapEditView
|
|
||||||
Command1=ID_FILE_NEW
|
|
||||||
Command2=ID_FILE_OPEN
|
|
||||||
Command3=ID_FILE_CLOSE
|
|
||||||
Command4=ID_FILE_SAVE
|
|
||||||
Command5=ID_FILE_SAVE_AS
|
|
||||||
Command6=ID_FILE_PRINT
|
|
||||||
Command7=ID_FILE_PRINT_PREVIEW
|
|
||||||
Command8=ID_FILE_PRINT_SETUP
|
|
||||||
Command9=ID_FILE_MRU_FILE1
|
|
||||||
Command10=ID_APP_EXIT
|
|
||||||
Command11=ID_EDIT_UNDO
|
|
||||||
Command12=ID_EDIT_CUT
|
|
||||||
Command13=ID_EDIT_COPY
|
|
||||||
Command14=ID_EDIT_PASTE
|
|
||||||
CommandCount=21
|
|
||||||
Command15=ID_VIEW_TOOLBAR
|
|
||||||
Command16=ID_VIEW_STATUS_BAR
|
|
||||||
Command17=ID_WINDOW_NEW
|
|
||||||
Command18=ID_WINDOW_CASCADE
|
|
||||||
Command19=ID_WINDOW_TILE_HORZ
|
|
||||||
Command20=ID_WINDOW_ARRANGE
|
|
||||||
Command21=ID_APP_ABOUT
|
|
||||||
|
|
||||||
[ACL:IDR_MAINFRAME]
|
|
||||||
Type=1
|
|
||||||
Class=CMainFrame
|
|
||||||
Command1=ID_FILE_NEW
|
|
||||||
Command2=ID_FILE_OPEN
|
|
||||||
Command3=ID_FILE_SAVE
|
|
||||||
Command4=ID_FILE_PRINT
|
|
||||||
Command5=ID_EDIT_UNDO
|
|
||||||
Command6=ID_EDIT_CUT
|
|
||||||
Command7=ID_EDIT_COPY
|
|
||||||
Command8=ID_EDIT_PASTE
|
|
||||||
Command9=ID_EDIT_UNDO
|
|
||||||
Command10=ID_EDIT_CUT
|
|
||||||
Command11=ID_EDIT_COPY
|
|
||||||
Command12=ID_EDIT_PASTE
|
|
||||||
CommandCount=14
|
|
||||||
Command13=ID_NEXT_PANE
|
|
||||||
Command14=ID_PREV_PANE
|
|
||||||
|
|
||||||
|
|
||||||
[TB:IDR_MAINFRAME (English (U.S.))]
|
[TB:IDR_MAINFRAME (English (U.S.))]
|
||||||
Type=1
|
Type=1
|
||||||
Class=?
|
Class=?
|
||||||
|
@ -178,7 +103,7 @@ CommandCount=10
|
||||||
|
|
||||||
[MNU:IDR_MAINFRAME (English (U.S.))]
|
[MNU:IDR_MAINFRAME (English (U.S.))]
|
||||||
Type=1
|
Type=1
|
||||||
Class=CMainFrame
|
Class=?
|
||||||
Command1=ID_FILE_NEW
|
Command1=ID_FILE_NEW
|
||||||
Command2=ID_FILE_OPEN
|
Command2=ID_FILE_OPEN
|
||||||
Command3=ID_FILE_PRINT_SETUP
|
Command3=ID_FILE_PRINT_SETUP
|
||||||
|
@ -236,7 +161,7 @@ CommandCount=14
|
||||||
|
|
||||||
[DLG:IDD_ABOUTBOX (English (U.S.))]
|
[DLG:IDD_ABOUTBOX (English (U.S.))]
|
||||||
Type=1
|
Type=1
|
||||||
Class=CAboutDlg
|
Class=?
|
||||||
ControlCount=4
|
ControlCount=4
|
||||||
Control1=IDC_STATIC,static,1342177283
|
Control1=IDC_STATIC,static,1342177283
|
||||||
Control2=IDC_STATIC,static,1342308480
|
Control2=IDC_STATIC,static,1342308480
|
||||||
|
@ -245,7 +170,7 @@ Control4=IDOK,button,1342373889
|
||||||
|
|
||||||
[DLG:IDD_LAYERBAR (English (U.S.))]
|
[DLG:IDD_LAYERBAR (English (U.S.))]
|
||||||
Type=1
|
Type=1
|
||||||
Class=CLayerBar
|
Class=?
|
||||||
ControlCount=5
|
ControlCount=5
|
||||||
Control1=IDC_LAYERBAR_NEW,button,1342242816
|
Control1=IDC_LAYERBAR_NEW,button,1342242816
|
||||||
Control2=IDC_LAYERBAR_DELETE,button,1342242816
|
Control2=IDC_LAYERBAR_DELETE,button,1342242816
|
||||||
|
@ -253,31 +178,3 @@ Control3=IDC_LAYERBAR_UP,button,1342242816
|
||||||
Control4=IDC_LAYERBAR_DOWN,button,1342242816
|
Control4=IDC_LAYERBAR_DOWN,button,1342242816
|
||||||
Control5=IDC_LAYERBAR_LIST,listbox,1352728833
|
Control5=IDC_LAYERBAR_LIST,listbox,1352728833
|
||||||
|
|
||||||
[DLG:IDD_PROPPAGE_SMALL (English (U.S.))]
|
|
||||||
Type=1
|
|
||||||
Class=?
|
|
||||||
ControlCount=1
|
|
||||||
Control1=IDC_STATIC,static,1342308352
|
|
||||||
|
|
||||||
[DLG:IDD_PROPPAGE_LARGE (English (U.S.))]
|
|
||||||
Type=1
|
|
||||||
Class=?
|
|
||||||
ControlCount=1
|
|
||||||
Control1=IDC_STATIC,static,1342308352
|
|
||||||
|
|
||||||
[DLG:IDD_DIALOGBAR (English (U.S.))]
|
|
||||||
Type=1
|
|
||||||
Class=?
|
|
||||||
ControlCount=2
|
|
||||||
Control1=IDC_STATIC,static,1342308352
|
|
||||||
Control2=IDC_CUSTOM1,casd,1342242816
|
|
||||||
|
|
||||||
[CLS:CLayerBar]
|
|
||||||
Type=0
|
|
||||||
HeaderFile=LayerBar.h
|
|
||||||
ImplementationFile=LayerBar.cpp
|
|
||||||
BaseClass=CDialogBar
|
|
||||||
Filter=D
|
|
||||||
VirtualFilter=dWC
|
|
||||||
LastObject=CLayerBar
|
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,19 @@ SOURCE=.\Core.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\gl3d.h
|
SOURCE=.\Layer.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Layer.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\utils.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\utils.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Group "Shell"
|
# Begin Group "Shell"
|
||||||
|
@ -118,10 +130,6 @@ SOURCE=.\GLEnabledView.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\LayerBar.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\MainFrm.cpp
|
SOURCE=.\MainFrm.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -155,11 +163,11 @@ SOURCE=.\ChildFrm.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\GLEnabledView.h
|
SOURCE=.\gl3d.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\LayerBar.h
|
SOURCE=.\GLEnabledView.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "MapEdit.h"
|
#include "MapEdit.h"
|
||||||
#include "Mainfrm.h"
|
|
||||||
|
|
||||||
#include "MapEditDoc.h"
|
#include "MapEditDoc.h"
|
||||||
|
|
||||||
|
@ -20,10 +19,6 @@ IMPLEMENT_DYNCREATE(CMapEditDoc, CDocument)
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(CMapEditDoc, CDocument)
|
BEGIN_MESSAGE_MAP(CMapEditDoc, CDocument)
|
||||||
//{{AFX_MSG_MAP(CMapEditDoc)
|
//{{AFX_MSG_MAP(CMapEditDoc)
|
||||||
ON_BN_CLICKED(IDC_LAYERBAR_NEW, OnLayerbarNew)
|
|
||||||
ON_BN_CLICKED(IDC_LAYERBAR_DELETE, OnLayerbarDelete)
|
|
||||||
ON_BN_CLICKED(IDC_LAYERBAR_UP, OnLayerbarUp)
|
|
||||||
ON_BN_CLICKED(IDC_LAYERBAR_DOWN, OnLayerbarDown)
|
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
@ -32,10 +27,6 @@ END_MESSAGE_MAP()
|
||||||
|
|
||||||
CMapEditDoc::CMapEditDoc()
|
CMapEditDoc::CMapEditDoc()
|
||||||
{
|
{
|
||||||
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
|
||||||
LayerBar=Frm->GetLayerBar();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMapEditDoc::~CMapEditDoc()
|
CMapEditDoc::~CMapEditDoc()
|
||||||
|
@ -86,91 +77,3 @@ void CMapEditDoc::Dump(CDumpContext& dc) const
|
||||||
#endif //_DEBUG
|
#endif //_DEBUG
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void CMapEditDoc::UpdateAll()
|
|
||||||
{
|
|
||||||
UpdateLayerBar();
|
|
||||||
|
|
||||||
}
|
|
||||||
/***************************************************************************/
|
|
||||||
/*** Layer Commands ********************************************************/
|
|
||||||
/***************************************************************************/
|
|
||||||
void CMapEditDoc::OnLayerbarNew()
|
|
||||||
{
|
|
||||||
Core.LayerAdd();
|
|
||||||
UpdateLayerBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void CMapEditDoc::OnLayerbarDelete()
|
|
||||||
{
|
|
||||||
int Sel=GetLayerCurSel();
|
|
||||||
|
|
||||||
if (Sel==-1) return;
|
|
||||||
Core.LayerDelete(Sel);
|
|
||||||
UpdateLayerBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void CMapEditDoc::OnLayerbarUp()
|
|
||||||
{
|
|
||||||
int Sel=GetLayerCurSel();
|
|
||||||
|
|
||||||
if (Sel==-1) return;
|
|
||||||
if (Sel>0)
|
|
||||||
{
|
|
||||||
Core.LayerMoveUp(Sel);
|
|
||||||
UpdateLayerBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void CMapEditDoc::OnLayerbarDown()
|
|
||||||
{
|
|
||||||
int Sel=GetLayerCurSel();
|
|
||||||
if (Sel==-1) return;
|
|
||||||
if (Sel<GetLayerCount()-1)
|
|
||||||
{
|
|
||||||
Core.LayerMoveDown(GetLayerCurSel());
|
|
||||||
UpdateLayerBar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void CMapEditDoc::UpdateLayerBar()
|
|
||||||
{
|
|
||||||
int LayerCount=Core.LayerGetCount();
|
|
||||||
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
|
||||||
int CurSel=Dlg->GetCurSel();
|
|
||||||
|
|
||||||
Dlg->ResetContent();
|
|
||||||
|
|
||||||
for (int i=0;i<LayerCount;i++)
|
|
||||||
{
|
|
||||||
sLayer const &ThisLayer=Core.LayerGet(i);
|
|
||||||
Dlg->AddString(ThisLayer.Name);
|
|
||||||
}
|
|
||||||
Dlg->SetCurSel(CurSel);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
int CMapEditDoc::GetLayerCurSel()
|
|
||||||
{
|
|
||||||
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
|
||||||
return(Dlg->GetCurSel());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
int CMapEditDoc::GetLayerCount()
|
|
||||||
{
|
|
||||||
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
|
||||||
return(Dlg->GetCount());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/***************************************************************************/
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
|
||||||
class CLayerBar;
|
|
||||||
class CMapEditDoc : public CDocument
|
class CMapEditDoc : public CDocument
|
||||||
{
|
{
|
||||||
protected: // create from serialization only
|
protected: // create from serialization only
|
||||||
|
@ -39,23 +38,13 @@ public:
|
||||||
virtual void AssertValid() const;
|
virtual void AssertValid() const;
|
||||||
virtual void Dump(CDumpContext& dc) const;
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
#endif
|
#endif
|
||||||
void UpdateAll();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void UpdateLayerBar();
|
|
||||||
int GetLayerCurSel();
|
|
||||||
int GetLayerCount();
|
|
||||||
|
|
||||||
CCore Core;
|
|
||||||
CLayerBar *LayerBar;
|
|
||||||
|
|
||||||
// Generated message map functions
|
// Generated message map functions
|
||||||
protected:
|
protected:
|
||||||
//{{AFX_MSG(CMapEditDoc)
|
//{{AFX_MSG(CMapEditDoc)
|
||||||
afx_msg void OnLayerbarNew();
|
|
||||||
afx_msg void OnLayerbarDelete();
|
|
||||||
afx_msg void OnLayerbarUp();
|
|
||||||
afx_msg void OnLayerbarDown();
|
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include "MapEditDoc.h"
|
#include "MapEditDoc.h"
|
||||||
#include "MapEditView.h"
|
#include "MapEditView.h"
|
||||||
|
#include "MainFrm.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
@ -32,6 +34,12 @@ BEGIN_MESSAGE_MAP(CMapEditView, CGLEnabledView)
|
||||||
ON_WM_MOUSEWHEEL()
|
ON_WM_MOUSEWHEEL()
|
||||||
ON_WM_RBUTTONDOWN()
|
ON_WM_RBUTTONDOWN()
|
||||||
ON_WM_RBUTTONUP()
|
ON_WM_RBUTTONUP()
|
||||||
|
ON_BN_CLICKED(IDC_LAYERBAR_NEW, OnLayerbarNew)
|
||||||
|
ON_BN_CLICKED(IDC_LAYERBAR_DELETE, OnLayerbarDelete)
|
||||||
|
ON_BN_CLICKED(IDC_LAYERBAR_UP, OnLayerbarUp)
|
||||||
|
ON_BN_CLICKED(IDC_LAYERBAR_DOWN, OnLayerbarDown)
|
||||||
|
ON_WM_MOUSEMOVE()
|
||||||
|
ON_WM_CAPTURECHANGED()
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
@ -40,6 +48,9 @@ END_MESSAGE_MAP()
|
||||||
|
|
||||||
CMapEditView::CMapEditView()
|
CMapEditView::CMapEditView()
|
||||||
{
|
{
|
||||||
|
CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd();
|
||||||
|
LayerBar=Frm->GetLayerBar();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMapEditView::~CMapEditView()
|
CMapEditView::~CMapEditView()
|
||||||
|
@ -68,14 +79,14 @@ void CMapEditView::OnCreateGL()
|
||||||
glEnable(GL_COLOR_MATERIAL); // Enable Material Coloring
|
glEnable(GL_COLOR_MATERIAL); // Enable Material Coloring
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
|
||||||
|
|
||||||
//Core.Init(this);
|
Core.Init(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
void CMapEditView::OnDrawGL()
|
void CMapEditView::OnDrawGL()
|
||||||
{
|
{
|
||||||
// Core.Render();
|
Core.Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -104,24 +115,115 @@ CMapEditDoc* CMapEditView::GetDocument() // non-debug version is inline
|
||||||
|
|
||||||
void CMapEditView::OnSetFocus(CWnd* pOldWnd)
|
void CMapEditView::OnSetFocus(CWnd* pOldWnd)
|
||||||
{
|
{
|
||||||
|
|
||||||
CMapEditDoc *CurDoc=GetDocument();
|
CMapEditDoc *CurDoc=GetDocument();
|
||||||
CGLEnabledView::OnSetFocus(pOldWnd);
|
CGLEnabledView::OnSetFocus(pOldWnd);
|
||||||
theApp.SetCurrent(CurDoc);
|
theApp.SetCurrent(CurDoc);
|
||||||
|
UpdateAll();
|
||||||
CurDoc->UpdateAll(); // woohoo, that was easy
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void CMapEditView::OnLButtonDown(UINT nFlags, CPoint point) {}
|
void CMapEditView::UpdateAll()
|
||||||
void CMapEditView::OnLButtonUp(UINT nFlags, CPoint point) {}
|
{
|
||||||
void CMapEditView::OnMButtonDown(UINT nFlags, CPoint point) {}
|
UpdateLayerBar();
|
||||||
void CMapEditView::OnMButtonUp(UINT nFlags, CPoint point) {}
|
|
||||||
BOOL CMapEditView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) {return(0);}
|
|
||||||
void CMapEditView::OnRButtonDown(UINT nFlags, CPoint point) {}
|
|
||||||
void CMapEditView::OnRButtonUp(UINT nFlags, CPoint point) {}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/*********************************************************************************/
|
||||||
|
/*** Layer Commands **************************************************************/
|
||||||
|
/*********************************************************************************/
|
||||||
|
void CMapEditView::OnLayerbarNew()
|
||||||
|
{
|
||||||
|
Core.LayerAdd();
|
||||||
|
UpdateLayerBar();
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
|
void CMapEditView::OnLayerbarDelete()
|
||||||
|
{
|
||||||
|
int Sel=GetLayerCurSel();
|
||||||
|
|
||||||
|
if (Sel==-1) return;
|
||||||
|
Core.LayerDelete(Sel);
|
||||||
|
UpdateLayerBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
void CMapEditView::OnLayerbarUp()
|
||||||
|
{
|
||||||
|
int Sel=GetLayerCurSel();
|
||||||
|
|
||||||
|
if (Sel==-1) return;
|
||||||
|
if (Sel>0)
|
||||||
|
{
|
||||||
|
Core.LayerMoveUp(Sel);
|
||||||
|
UpdateLayerBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
void CMapEditView::OnLayerbarDown()
|
||||||
|
{
|
||||||
|
int Sel=GetLayerCurSel();
|
||||||
|
if (Sel==-1) return;
|
||||||
|
if (Sel<GetLayerCount()-1)
|
||||||
|
{
|
||||||
|
Core.LayerMoveDown(GetLayerCurSel());
|
||||||
|
UpdateLayerBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
void CMapEditView::UpdateLayerBar()
|
||||||
|
{
|
||||||
|
int LayerCount=Core.LayerGetCount();
|
||||||
|
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
||||||
|
int CurSel=Dlg->GetCurSel();
|
||||||
|
|
||||||
|
Dlg->ResetContent();
|
||||||
|
|
||||||
|
for (int i=0;i<LayerCount;i++)
|
||||||
|
{
|
||||||
|
CLayer &ThisLayer=Core.LayerGet(i);
|
||||||
|
Dlg->AddString(ThisLayer.GetName());
|
||||||
|
}
|
||||||
|
Dlg->SetCurSel(CurSel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
int CMapEditView::GetLayerCurSel()
|
||||||
|
{
|
||||||
|
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
||||||
|
return(Dlg->GetCurSel());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
int CMapEditView::GetLayerCount()
|
||||||
|
{
|
||||||
|
CListBox *Dlg=(CListBox *)LayerBar->GetDlgItem(IDC_LAYERBAR_LIST);
|
||||||
|
return(Dlg->GetCount());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
/*********************************************************************************/
|
||||||
|
/*********************************************************************************/
|
||||||
|
void CMapEditView::OnLButtonDown(UINT nFlags, CPoint point) {Core.LButtonControl(nFlags,point,TRUE);}
|
||||||
|
void CMapEditView::OnLButtonUp(UINT nFlags, CPoint point) {Core.LButtonControl(nFlags,point,FALSE);}
|
||||||
|
void CMapEditView::OnMButtonDown(UINT nFlags, CPoint point) {Core.MButtonControl(nFlags,point,TRUE);}
|
||||||
|
void CMapEditView::OnMButtonUp(UINT nFlags, CPoint point) {Core.MButtonControl(nFlags,point,FALSE);}
|
||||||
|
BOOL CMapEditView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) {Core.MouseWheel(nFlags,zDelta,pt) ;return(0);}
|
||||||
|
void CMapEditView::OnRButtonDown(UINT nFlags, CPoint point) {Core.RButtonControl(nFlags,point,TRUE);}
|
||||||
|
void CMapEditView::OnRButtonUp(UINT nFlags, CPoint point) {Core.RButtonControl(nFlags,point,FALSE);}
|
||||||
|
void CMapEditView::OnMouseMove(UINT nFlags, CPoint point) {Core.MouseMove(nFlags, point,GetCapture()==this);}
|
||||||
|
|
||||||
|
|
||||||
|
void CMapEditView::OnCaptureChanged(CWnd *pWnd)
|
||||||
|
{
|
||||||
|
// TODO: Add your message handler code here
|
||||||
|
TRACE0("!!!!");
|
||||||
|
CGLEnabledView::OnCaptureChanged(pWnd);
|
||||||
|
}
|
||||||
|
|
|
@ -36,9 +36,16 @@ public:
|
||||||
virtual void AssertValid() const;
|
virtual void AssertValid() const;
|
||||||
virtual void Dump(CDumpContext& dc) const;
|
virtual void Dump(CDumpContext& dc) const;
|
||||||
#endif
|
#endif
|
||||||
|
void UpdateAll();
|
||||||
|
void UpdateLayerBar();
|
||||||
|
int GetLayerCurSel();
|
||||||
|
int GetLayerCount();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void VideoMode(ColorsNumber &c,ZAccuracy &z,BOOL &dbuf);
|
void VideoMode(ColorsNumber &c,ZAccuracy &z,BOOL &dbuf);
|
||||||
|
CCore Core;
|
||||||
|
CDialogBar *LayerBar;
|
||||||
|
|
||||||
// Generated message map functions
|
// Generated message map functions
|
||||||
protected:
|
protected:
|
||||||
//{{AFX_MSG(CMapEditView)
|
//{{AFX_MSG(CMapEditView)
|
||||||
|
@ -50,6 +57,12 @@ protected:
|
||||||
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
|
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
|
||||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||||
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnLayerbarNew();
|
||||||
|
afx_msg void OnLayerbarDelete();
|
||||||
|
afx_msg void OnLayerbarUp();
|
||||||
|
afx_msg void OnLayerbarDown();
|
||||||
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||||
|
afx_msg void OnCaptureChanged(CWnd *pWnd);
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
};
|
};
|
||||||
|
|
106
Utils/MapEdit/utils.cpp
Normal file
106
Utils/MapEdit/utils.cpp
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
/*************/
|
||||||
|
/*** Utils ***/
|
||||||
|
/*************/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "gl3d.h"
|
||||||
|
#include <gl\gl.h>
|
||||||
|
#include <gl\glu.h>
|
||||||
|
#include <gl\glut.h>
|
||||||
|
#include "GLEnabledView.h"
|
||||||
|
|
||||||
|
#include "Utils.H"
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
void DbgMsg(const char * pszFmt,...)
|
||||||
|
{
|
||||||
|
char szBuf[256];
|
||||||
|
if (pszFmt)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start(args,pszFmt);
|
||||||
|
vsprintf(szBuf,pszFmt,args);
|
||||||
|
OutputDebugString(szBuf);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************************************************************************/
|
||||||
|
void BuildGLBox(float XMin,float XMax,float YMin,float YMax,float ZMin,float ZMax)
|
||||||
|
{
|
||||||
|
// Bottom Face
|
||||||
|
glNormal3f( 0.0f,-1.0f, 0.0f);
|
||||||
|
glVertex3f( XMin, YMin, ZMin);
|
||||||
|
glVertex3f( XMax, YMin, ZMin);
|
||||||
|
glVertex3f( XMax, YMin, ZMax);
|
||||||
|
glVertex3f( XMin, YMin, ZMax);
|
||||||
|
// Front Face
|
||||||
|
glNormal3f( 0.0f, 0.0f, 1.0f);
|
||||||
|
glVertex3f( XMin, YMin, ZMax);
|
||||||
|
glVertex3f( XMax, YMin, ZMax);
|
||||||
|
glVertex3f( XMax, YMax, ZMax);
|
||||||
|
glVertex3f( XMin, YMax, ZMax);
|
||||||
|
// Back Face
|
||||||
|
glNormal3f( 0.0f, 0.0f,-1.0f);
|
||||||
|
glVertex3f( XMin, YMin, ZMin);
|
||||||
|
glVertex3f( XMin, YMax, ZMin);
|
||||||
|
glVertex3f( XMax, YMax, ZMin);
|
||||||
|
glVertex3f( XMax, YMin, ZMin);
|
||||||
|
// Right face
|
||||||
|
glNormal3f( 1.0f, 0.0f, 0.0f);
|
||||||
|
glVertex3f( XMax, YMin, ZMin);
|
||||||
|
glVertex3f( XMax, YMax, ZMin);
|
||||||
|
glVertex3f( XMax, YMax, ZMax);
|
||||||
|
glVertex3f( XMax, YMin, ZMax);
|
||||||
|
// Left Face
|
||||||
|
glNormal3f(-1.0f, 0.0f, 0.0f);
|
||||||
|
glVertex3f( XMin, YMin, ZMin);
|
||||||
|
glVertex3f( XMin, YMin, ZMax);
|
||||||
|
glVertex3f( XMin, YMax, ZMax);
|
||||||
|
glVertex3f( XMin, YMax, ZMin);
|
||||||
|
// Top Face
|
||||||
|
glNormal3f( 0.0f, 1.0f, 0.0f);
|
||||||
|
glVertex3f( XMin, YMax, ZMin);
|
||||||
|
glVertex3f( XMin, YMax, ZMax);
|
||||||
|
glVertex3f( XMax, YMax, ZMax);
|
||||||
|
glVertex3f( XMax, YMax, ZMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
void BuildGLBoxNoNormals(float XMin,float XMax,float YMin,float YMax,float ZMin,float ZMax)
|
||||||
|
{
|
||||||
|
// Bottom Face
|
||||||
|
glVertex3f( XMin, YMin, ZMin);
|
||||||
|
glVertex3f( XMax, YMin, ZMin);
|
||||||
|
glVertex3f( XMax, YMin, ZMax);
|
||||||
|
glVertex3f( XMin, YMin, ZMax);
|
||||||
|
// Front Face
|
||||||
|
glVertex3f( XMin, YMin, ZMax);
|
||||||
|
glVertex3f( XMax, YMin, ZMax);
|
||||||
|
glVertex3f( XMax, YMax, ZMax);
|
||||||
|
glVertex3f( XMin, YMax, ZMax);
|
||||||
|
// Back Face
|
||||||
|
glVertex3f( XMin, YMin, ZMin);
|
||||||
|
glVertex3f( XMin, YMax, ZMin);
|
||||||
|
glVertex3f( XMax, YMax, ZMin);
|
||||||
|
glVertex3f( XMax, YMin, ZMin);
|
||||||
|
// Right face
|
||||||
|
glVertex3f( XMax, YMin, ZMin);
|
||||||
|
glVertex3f( XMax, YMax, ZMin);
|
||||||
|
glVertex3f( XMax, YMax, ZMax);
|
||||||
|
glVertex3f( XMax, YMin, ZMax);
|
||||||
|
// Left Face
|
||||||
|
glVertex3f( XMin, YMin, ZMin);
|
||||||
|
glVertex3f( XMin, YMin, ZMax);
|
||||||
|
glVertex3f( XMin, YMax, ZMax);
|
||||||
|
glVertex3f( XMin, YMax, ZMin);
|
||||||
|
// Top Face
|
||||||
|
glVertex3f( XMin, YMax, ZMin);
|
||||||
|
glVertex3f( XMin, YMax, ZMax);
|
||||||
|
glVertex3f( XMax, YMax, ZMax);
|
||||||
|
glVertex3f( XMax, YMax, ZMin);
|
||||||
|
}
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************************************************************************/
|
16
Utils/MapEdit/utils.h
Normal file
16
Utils/MapEdit/utils.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*************/
|
||||||
|
/*** Utils ***/
|
||||||
|
/*************/
|
||||||
|
|
||||||
|
#ifndef __UTILS_HEADER__
|
||||||
|
#define __UTILS_HEADER__
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
void DbgMsg(const char * pszFmt,...);
|
||||||
|
void BuildGLBox(float XMin,float XMax,float YMin,float YMax,float ZMin,float ZMax);
|
||||||
|
void BuildGLBoxNoNormals(float XMin,float XMax,float YMin,float YMax,float ZMin,float ZMax);
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue