diff --git a/Utils/MapEdit/Core.cpp b/Utils/MapEdit/Core.cpp index 22020653f..415a38cb5 100644 --- a/Utils/MapEdit/Core.cpp +++ b/Utils/MapEdit/Core.cpp @@ -65,7 +65,9 @@ int Width,Height; Dlg.m_Mid=TRUE; Dlg.m_Fore=FALSE; +#ifndef _DEBUG if (Dlg.DoModal()!=IDOK) return FALSE; +#endif Width=Dlg.m_Width; Height=Dlg.m_Height; @@ -418,6 +420,7 @@ CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); CMultiBar *ParamBar=Frm->GetParamBar(); CLayerList *List=(CLayerList*)Frm->GetDialog(IDD_LAYER_LIST_DIALOG); + if (NewLayer<0) NewLayer=0; // If toggling layer, dont change the layer if ((int)List->ListBox.GetCheck(NewLayer)!=(int)Layer[NewLayer]->IsVisible()) { @@ -431,6 +434,34 @@ CLayerList *List=(CLayerList*)Frm->GetDialog(IDD_LAYER_LIST_DIALOG); } +/*****************************************************************************/ +void CCore::AddLayer(int CurrentLayer) +{ +CMainFrame *Frm=(CMainFrame*)AfxGetApp()->GetMainWnd(); +CMultiBar *ParamBar=Frm->GetParamBar(); +CLayerList *List=(CLayerList*)Frm->GetDialog(IDD_LAYER_LIST_DIALOG); + + TRACE1("Add Layer %i\n",CurrentLayer); + +} + +/*****************************************************************************/ +void CCore::DeleteLayer(int CurrentLayer) +{ + if (Layer[CurrentLayer]->CanDelete()) + { + delete Layer[CurrentLayer]; + Layer.erase(Layer.begin() + CurrentLayer); + SetLayer(CurrentLayer-1); + UpdateAll(NULL); + TRACE1("Deleted Layer %i\n",CurrentLayer); + } + else + { + TRACE1("Cant Delete Layer %i\n",CurrentLayer); + } +} + /*****************************************************************************/ /*** Grid ********************************************************************/ /*****************************************************************************/ diff --git a/Utils/MapEdit/Core.h b/Utils/MapEdit/Core.h index 3de7b7913..93fa0b016 100644 --- a/Utils/MapEdit/Core.h +++ b/Utils/MapEdit/Core.h @@ -69,6 +69,8 @@ public: // Layers void SetLayer(int Layer); + void AddLayer(int Layer); + void DeleteLayer(int Layer); void UpdateLayerGUI(CMapEditView *View); // Grid diff --git a/Utils/MapEdit/Layer.h b/Utils/MapEdit/Layer.h index b9db74379..8ea93dbda 100644 --- a/Utils/MapEdit/Layer.h +++ b/Utils/MapEdit/Layer.h @@ -62,6 +62,8 @@ virtual void Save(CFile *File)=0; virtual void Export(CCore *Core,CExport &Exp)=0; +virtual bool CanDelete()=0; + // Functions virtual BOOL SetMode(int NewMode)=0; virtual BOOL InitMode()=0; diff --git a/Utils/MapEdit/LayerTile.h b/Utils/MapEdit/LayerTile.h index bc266abf5..9cb0dd123 100644 --- a/Utils/MapEdit/LayerTile.h +++ b/Utils/MapEdit/LayerTile.h @@ -54,6 +54,7 @@ public: void CheckLayerSize(int Width,int Height); void Export(CCore *Core,CExport &Exp); + bool CanDelete() {if (SubType==LAYERTILE_FORE) return(true); else return(false);} // Functions BOOL SetMode(int NewMode); diff --git a/Utils/MapEdit/MapEdit.clw b/Utils/MapEdit/MapEdit.clw index 717ba0b46..f09fe25d0 100644 --- a/Utils/MapEdit/MapEdit.clw +++ b/Utils/MapEdit/MapEdit.clw @@ -2,7 +2,7 @@ [General Info] Version=1 -LastClass=CMapEditView +LastClass=CLayerList LastTemplate=CDialog NewFileInclude1=#include "stdafx.h" NewFileInclude2=#include "mapedit.h" @@ -18,24 +18,24 @@ Class6=CMapEditDoc Class7=CMapEditView ResourceCount=11 -Resource1=IDD_LAYER_LIST_DIALOG +Resource1=IDD_NEW_LAYER Resource2=IDR_MAPEDITYPE (English (U.S.)) -Resource3=IDD_NEW_LAYER +Resource3=IDD_ABOUTBOX (English (U.S.)) Resource4=IDD_DIALOGBAR (English (U.S.)) -Resource5=IDR_MAINFRAME (English (U.S.)) +Resource5=IDD_LAYER_LIST_DIALOG Class8=CMultiBar -Resource6=IDD_MAPSIZE -Resource7=IDD_NEWMAP +Resource6=IDD_LAYERTILE_GUI +Resource7=IDD_MULTIBAR (English (U.S.)) Class9=CLayerList Class10=CMapSizeDlg -Resource8=IDD_ABOUTBOX (English (U.S.)) +Resource8=IDR_MAINFRAME (English (U.S.)) Class11=CGfxToolBar Class12=CLayerTileGUI -Resource9=IDD_LAYERTILE_GUI -Resource10=IDD_MULTIBAR (English (U.S.)) +Resource9=IDR_TOOLBAR (English (U.S.)) +Resource10=IDD_MAPSIZE Class13=CNewMapGUI Class14=CProgressDlg -Resource11=IDR_TOOLBAR (English (U.S.)) +Resource11=IDD_NEWMAP [CLS:CChildFrame] Type=0 @@ -216,8 +216,10 @@ ControlCount=0 [DLG:IDD_LAYER_LIST_DIALOG] Type=1 Class=CLayerList -ControlCount=1 +ControlCount=3 Control1=IDC_LAYER_LIST,listbox,1352728913 +Control2=IDC_LAYERLIST_ADD,button,1342242816 +Control3=IDC_LAYERLIST_DELETE,button,1342242816 [CLS:CLayerList] Type=0 @@ -226,7 +228,7 @@ ImplementationFile=LayerList.cpp BaseClass=CDialog Filter=D VirtualFilter=dWC -LastObject=CLayerList +LastObject=IDC_LAYERLIST_ADD [CLS:CGfxToolBar] Type=0 diff --git a/Utils/MapEdit/MapEdit.cpp b/Utils/MapEdit/MapEdit.cpp index 245283546..81aff45fa 100644 --- a/Utils/MapEdit/MapEdit.cpp +++ b/Utils/MapEdit/MapEdit.cpp @@ -95,8 +95,9 @@ BOOL CMapEditApp::InitInstance() CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Prevent creating new doc on startup (should still open cmd line file tho) +#ifndef _DEBUG if (cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew) cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing; - +#endif // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; diff --git a/Utils/MapEdit/MapEdit.rc b/Utils/MapEdit/MapEdit.rc index d0e6e5d18..13fd2c130 100644 --- a/Utils/MapEdit/MapEdit.rc +++ b/Utils/MapEdit/MapEdit.rc @@ -458,13 +458,15 @@ IDI_SELECT ICON DISCARDABLE "res\\select.ico" // Dialog // -IDD_LAYER_LIST_DIALOG DIALOG DISCARDABLE 0, 0, 155, 94 +IDD_LAYER_LIST_DIALOG DIALOG DISCARDABLE 0, 0, 156, 115 STYLE WS_CHILD | WS_BORDER FONT 8, "MS Sans Serif" BEGIN LISTBOX IDC_LAYER_LIST,5,5,145,85,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Add",IDC_LAYERLIST_ADD,5,95,70,15 + PUSHBUTTON "Delete",IDC_LAYERLIST_DELETE,80,95,70,15 END IDD_LAYERTILE_GUI DIALOG DISCARDABLE 0, 0, 151, 81 @@ -552,9 +554,9 @@ BEGIN IDD_LAYER_LIST_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 148 + RIGHTMARGIN, 149 TOPMARGIN, 7 - BOTTOMMARGIN, 87 + BOTTOMMARGIN, 108 END IDD_LAYERTILE_GUI, DIALOG diff --git a/Utils/MapEdit/MapEditDoc.cpp b/Utils/MapEdit/MapEditDoc.cpp index cd804c912..78dc93038 100644 --- a/Utils/MapEdit/MapEditDoc.cpp +++ b/Utils/MapEdit/MapEditDoc.cpp @@ -220,6 +220,20 @@ void CMapEditDoc::SetLayer(int Layer) FocusView(); } +/*********************************************************************************/ +void CMapEditDoc::AddLayer(int Layer) +{ + Core.AddLayer(Layer); + FocusView(); +} + +/*********************************************************************************/ +void CMapEditDoc::DeleteLayer(int Layer) +{ + Core.DeleteLayer(Layer); + FocusView(); +} + /*********************************************************************************/ /*********************************************************************************/ /*********************************************************************************/ diff --git a/Utils/MapEdit/MapEditDoc.h b/Utils/MapEdit/MapEditDoc.h index 511ab851c..6ec6e18dd 100644 --- a/Utils/MapEdit/MapEditDoc.h +++ b/Utils/MapEdit/MapEditDoc.h @@ -49,6 +49,8 @@ public: void SetMode(int NewMode); void SetLayer(int Layer); + void AddLayer(int Layer); + void DeleteLayer(int Layer); // Operations public: diff --git a/Utils/MapEdit/resource.h b/Utils/MapEdit/resource.h index 48c81a410..453357445 100644 --- a/Utils/MapEdit/resource.h +++ b/Utils/MapEdit/resource.h @@ -41,6 +41,8 @@ #define IDC_NEWMAP_FORE_CHECK 1051 #define IDC_NEW_LAYER_WIDTH_NAME2 1052 #define IDC_NEW_LAYER_WIDTH_EDIT2 1053 +#define IDC_LAYERLIST_ADD 1056 +#define IDC_LAYERLIST_DELETE 1057 #define ID_TOOLBAR_LAYERBAR 32773 #define ID_TOOLBAR_TILEPALETTE 32774 #define ID_TOOLBAR_COMBO 32777 @@ -68,7 +70,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 172 #define _APS_NEXT_COMMAND_VALUE 32799 -#define _APS_NEXT_CONTROL_VALUE 1056 +#define _APS_NEXT_CONTROL_VALUE 1057 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Utils/MapEdit/utils.cpp b/Utils/MapEdit/utils.cpp index 00fb273fc..1e12f5ba8 100644 --- a/Utils/MapEdit/utils.cpp +++ b/Utils/MapEdit/utils.cpp @@ -128,8 +128,6 @@ int ID; /**************************************************************************************/ /**************************************************************************************/ -/**************************************************************************************/ - /**************************************************************************************/ struct sTgaHdr { @@ -168,8 +166,6 @@ sTgaHdr FileHdr; fwrite(Data,W*H*3,1,File); fclose(File); - - } /**************************************************************************************/