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));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::CopySelection(CMapEditView *View)
|
||||
{
|
||||
Layer[ActiveLayer]->CopySelection(this);
|
||||
UpdateView(View);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::PasteSelection(CMapEditView *View)
|
||||
{
|
||||
Layer[ActiveLayer]->PasteSelection(this);
|
||||
UpdateView(View);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** 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 GetZoomH();
|
||||
|
||||
void CopySelection();
|
||||
void PasteSelection();
|
||||
void CopySelection(CMapEditView *View);
|
||||
void PasteSelection(CMapEditView *View);
|
||||
|
||||
GString GetCurrentPath();
|
||||
private:
|
||||
|
|
|
@ -590,7 +590,7 @@ BOOL CLayerTile::CopySelection(CCore *Core)
|
|||
CTileBank &TileBank=Core->GetTileBank();
|
||||
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);
|
||||
|
||||
|
@ -602,7 +602,10 @@ BOOL CLayerTile::PasteSelection(CCore *Core)
|
|||
if (Mode!=MouseModeSelect) return(false); // Not in select mode
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ void CMap::SetSize(int Width,int Height,BOOL ClearFlag)
|
|||
/*****************************************************************************/
|
||||
void CMap::Clear()
|
||||
{
|
||||
int Width=GetWidth();
|
||||
int Height=GetHeight();
|
||||
int Width=GetWidth();
|
||||
int Height=GetHeight();
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
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,CRect &Rect,BOOL Force=FALSE);
|
||||
void Paste(CMap &Src,CRect *R);
|
||||
|
||||
void Resize(int Width,int Height);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[General Info]
|
||||
Version=1
|
||||
LastClass=CMapEditDoc
|
||||
LastClass=CMapEditView
|
||||
LastTemplate=CDialog
|
||||
NewFileInclude1=#include "stdafx.h"
|
||||
NewFileInclude2=#include "mapedit.h"
|
||||
|
@ -18,21 +18,21 @@ Class6=CMapEditDoc
|
|||
Class7=CMapEditView
|
||||
|
||||
ResourceCount=11
|
||||
Resource1=IDD_MULTIBAR (English (U.S.))
|
||||
Resource1=IDR_TOOLBAR (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.))
|
||||
Resource5=IDR_TOOLBAR (English (U.S.))
|
||||
Resource5=IDD_LAYERTILE_GUI
|
||||
Class8=CMultiBar
|
||||
Resource6=IDD_MAPSIZE
|
||||
Resource7=IDD_NEW_LAYER
|
||||
Resource6=IDD_MULTIBAR (English (U.S.))
|
||||
Resource7=IDD_LAYER_LIST_DIALOG
|
||||
Class9=CLayerList
|
||||
Class10=CMapSizeDlg
|
||||
Resource8=IDR_MAINFRAME (English (U.S.))
|
||||
Resource8=IDD_MAPSIZE
|
||||
Class11=CGfxToolBar
|
||||
Class12=CLayerTileGUI
|
||||
Resource9=IDD_LAYER_LIST_DIALOG
|
||||
Resource10=IDD_ABOUTBOX (English (U.S.))
|
||||
Resource9=IDR_MAINFRAME (English (U.S.))
|
||||
Resource10=IDD_NEW_LAYER
|
||||
Class13=CNewMapGUI
|
||||
Class14=CProgressDlg
|
||||
Resource11=IDD_NEWMAP
|
||||
|
@ -77,7 +77,7 @@ Type=0
|
|||
BaseClass=CDocument
|
||||
HeaderFile=MapEditDoc.h
|
||||
ImplementationFile=MapEditDoc.cpp
|
||||
LastObject=ID_EDIT_COPY
|
||||
LastObject=ID_EXPORT_AGB
|
||||
Filter=N
|
||||
VirtualFilter=DC
|
||||
|
||||
|
@ -86,7 +86,7 @@ Type=0
|
|||
BaseClass=CGLEnabledView
|
||||
HeaderFile=MapEditView.h
|
||||
ImplementationFile=MapEditView.cpp
|
||||
LastObject=ID_ZOOM_IN
|
||||
LastObject=ID_EDIT_PASTE
|
||||
Filter=C
|
||||
VirtualFilter=VWC
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ BEGIN_MESSAGE_MAP(CMapEditDoc, CDocument)
|
|||
ON_COMMAND(ID_EXPORT_PSX, OnExportPsx)
|
||||
ON_COMMAND(ID_ZOOM_IN, OnZoomIn)
|
||||
ON_COMMAND(ID_ZOOM_OUT, OnZoomOut)
|
||||
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
|
||||
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
@ -194,6 +192,20 @@ void CMapEditDoc::MirrorY(CMapEditView *View)
|
|||
FocusView();
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
void CMapEditDoc::CopySelection(CMapEditView *View)
|
||||
{
|
||||
Core.CopySelection(View);
|
||||
FocusView();
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
void CMapEditDoc::PasteSelection(CMapEditView *View)
|
||||
{
|
||||
Core.PasteSelection(View);
|
||||
FocusView();
|
||||
}
|
||||
|
||||
/*********************************************************************************/
|
||||
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 MirrorX(CMapEditView *View);
|
||||
void MirrorY(CMapEditView *View);
|
||||
void CopySelection(CMapEditView *View);
|
||||
void PasteSelection(CMapEditView *View);
|
||||
void ActiveBrushLeft(CMapEditView *View);
|
||||
void ActiveBrushRight(CMapEditView *View);
|
||||
void MapSetSize(CMapEditView *View);
|
||||
|
@ -79,8 +81,6 @@ protected:
|
|||
afx_msg void OnExportPsx();
|
||||
afx_msg void OnZoomIn();
|
||||
afx_msg void OnZoomOut();
|
||||
afx_msg void OnEditCopy();
|
||||
afx_msg void OnEditPaste();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ BEGIN_MESSAGE_MAP(CMapEditView, CGLEnabledView)
|
|||
ON_COMMAND(ID_2D_3D_TOGGLE, On2d3dToggle)
|
||||
ON_COMMAND(ID_TOOLBAR_TILEPALETTE, OnToggleTileview)
|
||||
ON_COMMAND(ID_TOGGLE_GRID, OnToggleGrid)
|
||||
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
|
||||
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
@ -158,6 +160,8 @@ void CMapEditView::OnToggleTileview() {GetDocument()->ToggleTileView(thi
|
|||
void CMapEditView::OnToggleGrid() {GetDocument()->ToggleGrid(this);}
|
||||
void CMapEditView::OnMirrorx() {GetDocument()->MirrorX(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::OnActivebrushRight() {GetDocument()->ActiveBrushRight(this);}
|
||||
|
|
|
@ -63,6 +63,8 @@ protected:
|
|||
afx_msg void OnActivebrushRight();
|
||||
afx_msg void OnMapSetSize();
|
||||
afx_msg void On2d3dToggle();
|
||||
afx_msg void OnEditCopy();
|
||||
afx_msg void OnEditPaste();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue