This commit is contained in:
parent
803f94e415
commit
ec9c8c2ab5
10 changed files with 79 additions and 43 deletions
|
@ -548,6 +548,20 @@ BOOL CCore::IsTileValid(int Set,int Tile)
|
||||||
return(TileBank.IsTileValid(Set,Tile));
|
return(TileBank.IsTileValid(Set,Tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CCore::CopySelection(CMapEditView *View)
|
||||||
|
{
|
||||||
|
Layer[ActiveLayer]->CopySelection(this);
|
||||||
|
UpdateView(View);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CCore::PasteSelection(CMapEditView *View)
|
||||||
|
{
|
||||||
|
Layer[ActiveLayer]->PasteSelection(this);
|
||||||
|
UpdateView(View);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Misc ********************************************************************/
|
/*** Misc ********************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -734,14 +748,3 @@ GString Path=FullPath.Dir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::CopySelection()
|
|
||||||
{
|
|
||||||
Layer[ActiveLayer]->CopySelection(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CCore::PasteSelection()
|
|
||||||
{
|
|
||||||
Layer[ActiveLayer]->PasteSelection(this);
|
|
||||||
}
|
|
||||||
|
|
|
@ -102,8 +102,8 @@ public:
|
||||||
float GetZoomW();
|
float GetZoomW();
|
||||||
float GetZoomH();
|
float GetZoomH();
|
||||||
|
|
||||||
void CopySelection();
|
void CopySelection(CMapEditView *View);
|
||||||
void PasteSelection();
|
void PasteSelection(CMapEditView *View);
|
||||||
|
|
||||||
GString GetCurrentPath();
|
GString GetCurrentPath();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -590,7 +590,7 @@ BOOL CLayerTile::CopySelection(CCore *Core)
|
||||||
CTileBank &TileBank=Core->GetTileBank();
|
CTileBank &TileBank=Core->GetTileBank();
|
||||||
CRect Rect=Selection.GetRect();
|
CRect Rect=Selection.GetRect();
|
||||||
|
|
||||||
TileBank.GetLBrush().Set(Map,Rect.left,Rect.top,Rect.Width(),Rect.Height());
|
TileBank.GetActiveBrush().Set(Map,Rect.left,Rect.top,Rect.Width(),Rect.Height());
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
|
|
||||||
|
@ -602,7 +602,10 @@ BOOL CLayerTile::PasteSelection(CCore *Core)
|
||||||
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
||||||
if (!Selection.IsValid()) return(false); // No Selection
|
if (!Selection.IsValid()) return(false); // No Selection
|
||||||
|
|
||||||
TRACE0("Paste\n");
|
CTileBank &TileBank=Core->GetTileBank();
|
||||||
|
CRect Rect=Selection.GetRect();
|
||||||
|
|
||||||
|
Map.Paste(TileBank.GetActiveBrush(),&Rect);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,8 @@ void CMap::SetSize(int Width,int Height,BOOL ClearFlag)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CMap::Clear()
|
void CMap::Clear()
|
||||||
{
|
{
|
||||||
int Width=GetWidth();
|
int Width=GetWidth();
|
||||||
int Height=GetHeight();
|
int Height=GetHeight();
|
||||||
|
|
||||||
for (int Y=0;Y<Height;Y++)
|
for (int Y=0;Y<Height;Y++)
|
||||||
{
|
{
|
||||||
|
@ -227,6 +227,28 @@ int Ofs=(R->bottom+R->top)-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void CMap::Paste(CMap &Src,CRect *R)
|
||||||
|
{
|
||||||
|
if (!R)
|
||||||
|
{ // No rect, use full
|
||||||
|
R=new CRect(0,0,GetWidth(),GetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int Y=0; Y<R->Height(); Y++)
|
||||||
|
{
|
||||||
|
for (int X=0; X<R->Width(); X++)
|
||||||
|
{
|
||||||
|
int SrcX=X % Src.GetWidth();
|
||||||
|
int SrcY=Y % Src.GetHeight();
|
||||||
|
sMapElem &ThisElem=Src.Get(SrcX,SrcY);
|
||||||
|
|
||||||
|
Set(X+R->left,Y+R->top,ThisElem,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
BOOL CMap::DoesContainTile(sMapElem &Tile)
|
BOOL CMap::DoesContainTile(sMapElem &Tile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
void Set(int X,int Y,CMap &Blk,BOOL Force=FALSE);
|
void Set(int X,int Y,CMap &Blk,BOOL Force=FALSE);
|
||||||
void Set(CMap &Src,int StartX,int StartY,int Width,int Height,BOOL Force=FALSE);
|
void Set(CMap &Src,int StartX,int StartY,int Width,int Height,BOOL Force=FALSE);
|
||||||
void Set(CMap &Src,CRect &Rect,BOOL Force=FALSE);
|
void Set(CMap &Src,CRect &Rect,BOOL Force=FALSE);
|
||||||
|
void Paste(CMap &Src,CRect *R);
|
||||||
|
|
||||||
void Resize(int Width,int Height);
|
void Resize(int Width,int Height);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[General Info]
|
[General Info]
|
||||||
Version=1
|
Version=1
|
||||||
LastClass=CMapEditDoc
|
LastClass=CMapEditView
|
||||||
LastTemplate=CDialog
|
LastTemplate=CDialog
|
||||||
NewFileInclude1=#include "stdafx.h"
|
NewFileInclude1=#include "stdafx.h"
|
||||||
NewFileInclude2=#include "mapedit.h"
|
NewFileInclude2=#include "mapedit.h"
|
||||||
|
@ -18,21 +18,21 @@ Class6=CMapEditDoc
|
||||||
Class7=CMapEditView
|
Class7=CMapEditView
|
||||||
|
|
||||||
ResourceCount=11
|
ResourceCount=11
|
||||||
Resource1=IDD_MULTIBAR (English (U.S.))
|
Resource1=IDR_TOOLBAR (English (U.S.))
|
||||||
Resource2=IDR_MAPEDITYPE (English (U.S.))
|
Resource2=IDR_MAPEDITYPE (English (U.S.))
|
||||||
Resource3=IDD_LAYERTILE_GUI
|
Resource3=IDD_ABOUTBOX (English (U.S.))
|
||||||
Resource4=IDD_DIALOGBAR (English (U.S.))
|
Resource4=IDD_DIALOGBAR (English (U.S.))
|
||||||
Resource5=IDR_TOOLBAR (English (U.S.))
|
Resource5=IDD_LAYERTILE_GUI
|
||||||
Class8=CMultiBar
|
Class8=CMultiBar
|
||||||
Resource6=IDD_MAPSIZE
|
Resource6=IDD_MULTIBAR (English (U.S.))
|
||||||
Resource7=IDD_NEW_LAYER
|
Resource7=IDD_LAYER_LIST_DIALOG
|
||||||
Class9=CLayerList
|
Class9=CLayerList
|
||||||
Class10=CMapSizeDlg
|
Class10=CMapSizeDlg
|
||||||
Resource8=IDR_MAINFRAME (English (U.S.))
|
Resource8=IDD_MAPSIZE
|
||||||
Class11=CGfxToolBar
|
Class11=CGfxToolBar
|
||||||
Class12=CLayerTileGUI
|
Class12=CLayerTileGUI
|
||||||
Resource9=IDD_LAYER_LIST_DIALOG
|
Resource9=IDR_MAINFRAME (English (U.S.))
|
||||||
Resource10=IDD_ABOUTBOX (English (U.S.))
|
Resource10=IDD_NEW_LAYER
|
||||||
Class13=CNewMapGUI
|
Class13=CNewMapGUI
|
||||||
Class14=CProgressDlg
|
Class14=CProgressDlg
|
||||||
Resource11=IDD_NEWMAP
|
Resource11=IDD_NEWMAP
|
||||||
|
@ -77,7 +77,7 @@ Type=0
|
||||||
BaseClass=CDocument
|
BaseClass=CDocument
|
||||||
HeaderFile=MapEditDoc.h
|
HeaderFile=MapEditDoc.h
|
||||||
ImplementationFile=MapEditDoc.cpp
|
ImplementationFile=MapEditDoc.cpp
|
||||||
LastObject=ID_EDIT_COPY
|
LastObject=ID_EXPORT_AGB
|
||||||
Filter=N
|
Filter=N
|
||||||
VirtualFilter=DC
|
VirtualFilter=DC
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ Type=0
|
||||||
BaseClass=CGLEnabledView
|
BaseClass=CGLEnabledView
|
||||||
HeaderFile=MapEditView.h
|
HeaderFile=MapEditView.h
|
||||||
ImplementationFile=MapEditView.cpp
|
ImplementationFile=MapEditView.cpp
|
||||||
LastObject=ID_ZOOM_IN
|
LastObject=ID_EDIT_PASTE
|
||||||
Filter=C
|
Filter=C
|
||||||
VirtualFilter=VWC
|
VirtualFilter=VWC
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ BEGIN_MESSAGE_MAP(CMapEditDoc, CDocument)
|
||||||
ON_COMMAND(ID_EXPORT_PSX, OnExportPsx)
|
ON_COMMAND(ID_EXPORT_PSX, OnExportPsx)
|
||||||
ON_COMMAND(ID_ZOOM_IN, OnZoomIn)
|
ON_COMMAND(ID_ZOOM_IN, OnZoomIn)
|
||||||
ON_COMMAND(ID_ZOOM_OUT, OnZoomOut)
|
ON_COMMAND(ID_ZOOM_OUT, OnZoomOut)
|
||||||
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
|
|
||||||
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
|
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
@ -194,6 +192,20 @@ void CMapEditDoc::MirrorY(CMapEditView *View)
|
||||||
FocusView();
|
FocusView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
void CMapEditDoc::CopySelection(CMapEditView *View)
|
||||||
|
{
|
||||||
|
Core.CopySelection(View);
|
||||||
|
FocusView();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************/
|
||||||
|
void CMapEditDoc::PasteSelection(CMapEditView *View)
|
||||||
|
{
|
||||||
|
Core.PasteSelection(View);
|
||||||
|
FocusView();
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
void CMapEditDoc::SetMode(int NewMode)
|
void CMapEditDoc::SetMode(int NewMode)
|
||||||
{
|
{
|
||||||
|
@ -331,14 +343,3 @@ void CMapEditDoc::FocusView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
void CMapEditDoc::OnEditCopy()
|
|
||||||
{
|
|
||||||
Core.CopySelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
void CMapEditDoc::OnEditPaste()
|
|
||||||
{
|
|
||||||
Core.PasteSelection();
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ public:
|
||||||
void ToggleGrid(CMapEditView *View);
|
void ToggleGrid(CMapEditView *View);
|
||||||
void MirrorX(CMapEditView *View);
|
void MirrorX(CMapEditView *View);
|
||||||
void MirrorY(CMapEditView *View);
|
void MirrorY(CMapEditView *View);
|
||||||
|
void CopySelection(CMapEditView *View);
|
||||||
|
void PasteSelection(CMapEditView *View);
|
||||||
void ActiveBrushLeft(CMapEditView *View);
|
void ActiveBrushLeft(CMapEditView *View);
|
||||||
void ActiveBrushRight(CMapEditView *View);
|
void ActiveBrushRight(CMapEditView *View);
|
||||||
void MapSetSize(CMapEditView *View);
|
void MapSetSize(CMapEditView *View);
|
||||||
|
@ -79,8 +81,6 @@ protected:
|
||||||
afx_msg void OnExportPsx();
|
afx_msg void OnExportPsx();
|
||||||
afx_msg void OnZoomIn();
|
afx_msg void OnZoomIn();
|
||||||
afx_msg void OnZoomOut();
|
afx_msg void OnZoomOut();
|
||||||
afx_msg void OnEditCopy();
|
|
||||||
afx_msg void OnEditPaste();
|
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ BEGIN_MESSAGE_MAP(CMapEditView, CGLEnabledView)
|
||||||
ON_COMMAND(ID_2D_3D_TOGGLE, On2d3dToggle)
|
ON_COMMAND(ID_2D_3D_TOGGLE, On2d3dToggle)
|
||||||
ON_COMMAND(ID_TOOLBAR_TILEPALETTE, OnToggleTileview)
|
ON_COMMAND(ID_TOOLBAR_TILEPALETTE, OnToggleTileview)
|
||||||
ON_COMMAND(ID_TOGGLE_GRID, OnToggleGrid)
|
ON_COMMAND(ID_TOGGLE_GRID, OnToggleGrid)
|
||||||
|
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
|
||||||
|
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
@ -158,6 +160,8 @@ void CMapEditView::OnToggleTileview() {GetDocument()->ToggleTileView(thi
|
||||||
void CMapEditView::OnToggleGrid() {GetDocument()->ToggleGrid(this);}
|
void CMapEditView::OnToggleGrid() {GetDocument()->ToggleGrid(this);}
|
||||||
void CMapEditView::OnMirrorx() {GetDocument()->MirrorX(this);}
|
void CMapEditView::OnMirrorx() {GetDocument()->MirrorX(this);}
|
||||||
void CMapEditView::OnMirrory() {GetDocument()->MirrorY(this);}
|
void CMapEditView::OnMirrory() {GetDocument()->MirrorY(this);}
|
||||||
|
void CMapEditView::OnEditCopy() {GetDocument()->CopySelection(this);}
|
||||||
|
void CMapEditView::OnEditPaste() {GetDocument()->PasteSelection(this);}
|
||||||
|
|
||||||
void CMapEditView::OnActivebrushLeft() {GetDocument()->ActiveBrushLeft(this);}
|
void CMapEditView::OnActivebrushLeft() {GetDocument()->ActiveBrushLeft(this);}
|
||||||
void CMapEditView::OnActivebrushRight() {GetDocument()->ActiveBrushRight(this);}
|
void CMapEditView::OnActivebrushRight() {GetDocument()->ActiveBrushRight(this);}
|
||||||
|
|
|
@ -63,6 +63,8 @@ protected:
|
||||||
afx_msg void OnActivebrushRight();
|
afx_msg void OnActivebrushRight();
|
||||||
afx_msg void OnMapSetSize();
|
afx_msg void OnMapSetSize();
|
||||||
afx_msg void On2d3dToggle();
|
afx_msg void On2d3dToggle();
|
||||||
|
afx_msg void OnEditCopy();
|
||||||
|
afx_msg void OnEditPaste();
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue