changeset 58:5e382dee4c70

Rename CodePanel/CodeSlot to ProgramPanel/ActionSlot
author koryspansel <koryspansel@bendbroadband.com>
date Fri, 30 Sep 2011 22:39:08 -0700
parents dc1f4a668d50
children 63806b850aa5
files LightClone/LightClone.vcproj LightClone/Source/ActionSlot.cpp LightClone/Source/ActionSlot.h LightClone/Source/CodePanel.cpp LightClone/Source/CodePanel.h LightClone/Source/CodeSlot.cpp LightClone/Source/CodeSlot.h LightClone/Source/ProgramPanel.cpp LightClone/Source/ProgramPanel.h LightClone/Source/World.cpp LightClone/Source/World.h
diffstat 11 files changed, 503 insertions(+), 508 deletions(-) [+]
line wrap: on
line diff
--- a/LightClone/LightClone.vcproj	Fri Sep 30 20:26:44 2011 -0700
+++ b/LightClone/LightClone.vcproj	Fri Sep 30 22:39:08 2011 -0700
@@ -183,6 +183,10 @@
 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
 			>
 			<File
+				RelativePath=".\Source\ActionSlot.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\Source\Bot.cpp"
 				>
 			</File>
@@ -191,14 +195,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\Source\CodePanel.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\Source\CodeSlot.cpp"
-				>
-			</File>
-			<File
 				RelativePath=".\Source\Compiler.cpp"
 				>
 			</File>
@@ -223,6 +219,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\Source\ProgramPanel.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\Source\VirtualMachine.cpp"
 				>
 			</File>
@@ -329,6 +329,10 @@
 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
 			>
 			<File
+				RelativePath=".\Source\ActionSlot.h"
+				>
+			</File>
+			<File
 				RelativePath=".\Source\Bot.h"
 				>
 			</File>
@@ -337,14 +341,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\Source\CodePanel.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Source\CodeSlot.h"
-				>
-			</File>
-			<File
 				RelativePath=".\Source\Compiler.h"
 				>
 			</File>
@@ -369,6 +365,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\Source\ProgramPanel.h"
+				>
+			</File>
+			<File
 				RelativePath=".\Source\VirtualMachine.h"
 				>
 			</File>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LightClone/Source/ActionSlot.cpp	Fri Sep 30 22:39:08 2011 -0700
@@ -0,0 +1,160 @@
+/*
+ * ActionSlot
+ */
+
+#include "ActionSlot.h"
+#include "GuiInterface.h"
+#include "InputManager.h"
+
+/*
+ * ActionTextureName
+ */
+const char* ActionTextureName[] = 
+{
+	"Data\\Textures\\Forward.tga",
+	"Data\\Textures\\RotateCW.tga",
+	"Data\\Textures\\RotateCCW.tga",
+	"Data\\Textures\\Jump.tga",
+	"Data\\Textures\\Light.tga",
+	"Data\\Textures\\Function1.tga",
+	"Data\\Textures\\Function2.tga",
+};
+
+/*
+ * ActionSlot
+ */
+ActionSlot::ActionSlot() : GuiImage(), nAction(Action_None), bPermanent(false)
+{
+	SetFlag(GuiElementFlag_Pickable);
+}
+
+/*
+ * Initialize
+ */
+ErrorCode ActionSlot::Initialize(ResourceManager* pManager)
+{
+	ErrorCode eCode = GuiImage::Initialize(pManager);
+	if(eCode == Error_Success)
+	{
+		SetTexture("Data\\Textures\\Slot.tga");
+	}
+
+	return eCode;
+}
+
+/*
+ * Terminate
+ */
+void ActionSlot::Terminate()
+{
+}
+
+/*
+ * SetSlot
+ */
+void ActionSlot::SetSlot(uint32 nValue)
+{
+	nSlot = nValue;
+}
+
+/*
+ * GetSlot
+ */
+uint32 ActionSlot::GetSlot() const
+{
+	return nSlot;
+}
+
+/*
+ * SetAction
+ */
+void ActionSlot::SetAction(uint32 nValue)
+{
+	nAction = nValue;
+
+	SetTexture(nAction == Action_None ? "Data\\Textures\\Slot.tga" : ActionTextureName[nAction - Action_Forward]);
+}
+
+/*
+ * GetAction
+ */
+uint32 ActionSlot::GetAction() const
+{
+	return nAction;
+}
+
+/*
+ * SetPermanent
+ */
+void ActionSlot::SetPermanent(bool bValue)
+{
+	bPermanent = bValue;
+}
+
+/*
+ * OnMouseDown
+ */
+void ActionSlot::OnMouseDown(uint32 nButton, float fX, float fY)
+{
+	if(nButton == MouseButton_Left)
+	{
+		pInterface->AcquireCursor(this);
+	}
+}
+
+/*
+ * OnMouseUp
+ */
+void ActionSlot::OnMouseUp(uint32 nButton, float fX, float fY)
+{
+	if(pInterface->IsCursorAcquiredBy(this))
+	{
+		pInterface->ReleaseCursor();
+	}
+}
+
+/*
+ * OnMouseMove
+ */
+void ActionSlot::OnMouseMove(float fX, float fY)
+{
+	if(pInterface->IsCursorAcquiredBy(this))
+	{
+		pInterface->ReleaseCursor();
+
+		if(nAction != Action_None)
+		{
+			//TODO: Figure out some other way of doing this
+
+			// create a new element to represent the object being dragged
+			ActionSlot* pInstance = new ActionSlot();
+			pInstance->Initialize(pResourceManager);
+			pInstance->SetAction(nAction);
+			pInstance->SetDimensions(kDimensions);
+			pInstance->SetPosition(kPosition);
+			pInstance->SetInterface(pInterface);
+
+			// let the interface and cursor manage the drag object
+			pInterface->BeginDrag(pInstance, MouseButton_Left);
+
+			// if this slot is always suppose to have a valid action, do
+			// not clear out the current action
+			if(!bPermanent)
+			{
+				SetAction(Action_None);
+			}
+		}
+	}
+}
+
+/*
+ * OnDrop
+ */
+void ActionSlot::OnDrop(GuiElement* pSource, float fX, float fY)
+{
+	//TODO: Need to make sure pSource is actually a ActionSlot
+	SetAction(((ActionSlot*)pSource)->nAction);
+
+	GuiEventArguments kArguments(this);
+	Fire(ActionSlot::EventDrop, kArguments);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LightClone/Source/ActionSlot.h	Fri Sep 30 22:39:08 2011 -0700
@@ -0,0 +1,96 @@
+/*
+ * ActionSlot
+ */
+
+#ifndef __ACTIONSLOT_H__
+#define __ACTIONSLOT_H__
+
+#include "Core.h"
+#include "GuiImage.h"
+
+/*
+ * ActionSlot
+ */
+class ActionSlot : public GuiImage
+{
+	/*
+	 * nSlot
+	 */
+	uint32 nSlot;
+
+	/*
+	 * nAction
+	 */
+	uint32 nAction;
+
+	/*
+	 * bPermanent
+	 */
+	bool bPermanent;
+
+public:
+
+	/*
+	 * ActionSlot
+	 */
+	ActionSlot();
+
+	/*
+	 * Initialize
+	 */
+	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
+
+	/*
+	 * Terminate
+	 */
+	virtual void Terminate();
+
+	/*
+	 * SetSlot
+	 */
+	void SetSlot(uint32 nSlot);
+
+	/*
+	 * GetSlot
+	 */
+	uint32 GetSlot() const;
+
+	/*
+	 * SetAction
+	 */
+	void SetAction(uint32 nAction);
+
+	/*
+	 * GetAction
+	 */
+	uint32 GetAction() const;
+
+	/*
+	 * SetPermanent
+	 */
+	void SetPermanent(bool bPermanent);
+
+protected:
+
+	/*
+	 * OnMouseDown
+	 */
+	virtual void OnMouseDown(uint32 nButton, float fX, float fY);
+
+	/*
+	 * OnMouseUp
+	 */
+	virtual void OnMouseUp(uint32 nButton, float fX, float fY);
+
+	/*
+	 * OnMouseMove
+	 */
+	virtual void OnMouseMove(float fX, float fY);
+
+	/*
+	 * OnDrop
+	 */
+	virtual void OnDrop(GuiElement* pSource, float fX, float fY);
+};
+
+#endif //__ACTIONSLOT_H__
--- a/LightClone/Source/CodePanel.cpp	Fri Sep 30 20:26:44 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * CodePanel
- */
-
-#include "CodePanel.h"
-
-/*
- * EventAction
- */
-const char* CodePanel::EventAction = "CodePanel:EventAction";
-
-/*
- * CodePanel
- */
-CodePanel::CodePanel(uint32 nWidth, uint32 nHeight) : GuiImage(), nSizeX(nWidth), nSizeY(nHeight)
-{
-	pSlot = new CodeSlot[nSizeX * nSizeY];
-}
-
-/*
- * Initialize
- */
-ErrorCode CodePanel::Initialize(ResourceManager* pResourceManager)
-{
-	const float fSlotSizeX		= 48.0f;
-	const float fSlotSizeY		= 48.0f;
-	const float fSlotPadding	= 16.0f;
-	const float fSlotSpacing	= 8.0f;
-
-	ErrorCode eCode = GuiImage::Initialize(pResourceManager);
-	if(eCode == Error_Success)
-	{
-		SetDimensions(2.0f * fSlotPadding + (fSlotSizeX + fSlotSpacing) * nSizeX - fSlotSpacing, 2.0f * fSlotPadding + (fSlotSizeY + fSlotSpacing) * nSizeY - fSlotSpacing);
-
-		for(uint32 i = 0; i < nSizeY; ++i)
-		{
-			for(uint32 j = 0; j < nSizeX; ++j)
-			{
-				const uint32 nIndex = i * nSizeX + j;
-
-				pSlot[nIndex].Initialize(pResourceManager);
-				pSlot[nIndex].SetTexture("Data\\Textures\\Slot.tga");
-				pSlot[nIndex].SetDimensions(fSlotSizeX, fSlotSizeY);
-				pSlot[nIndex].SetPosition(fSlotPadding + (fSlotSizeX + fSlotSpacing) * j, fSlotPadding + (fSlotSizeY + fSlotSpacing) * i);
-				pSlot[nIndex].Subscribe(CodeSlot::EventDrop, &CodePanel::OnActionDropped, this);
-				pSlot[nIndex].SetSlot(nIndex);
-				pSlot[nIndex].SetAction(Action_None);
-
-				Add(&pSlot[nIndex]);
-			}
-		}
-	}
-
-	return eCode;
-}
-
-/*
- * SetAction
- */
-void CodePanel::SetAction(uint32 nIndex, uint32 nAction)
-{
-	pSlot[nIndex].SetAction(nAction);
-}
-
-/*
- * GetAction
- */
-uint32 CodePanel::GetAction(uint32 nIndex) const
-{
-	return pSlot[nIndex].GetAction();
-}
-
-/*
- * Clear
- */
-void CodePanel::Clear()
-{
-	const uint32 nCount = nSizeX * nSizeY;
-
-	for(uint32 i = 0; i < nCount; ++i)
-	{
-		pSlot[i].SetAction(Action_None);
-	}
-}
-
-/*
- * SetPermanent
- */
-void CodePanel::SetPermanent(bool bPermanent)
-{
-	const uint32 nCount = nSizeX * nSizeY;
-
-	for(uint32 i = 0; i < nCount; ++i)
-	{
-		pSlot[i].SetPermanent(bPermanent);
-	}
-}
-
-/*
- * OnActionDropped
- */
-void CodePanel::OnActionDropped(GuiEventArguments& kArguments)
-{
-	CodeSlot* pSlot = (CodeSlot*)kArguments.pSource;
-	//ASSERT(pSlot != NULL);
-
-	const uint32 nIndex = pSlot->GetSlot();
-	//if(nIndex < nActionSlots)
-	{
-		ActionArguments kActionArguments(this, nIndex);
-		Fire(CodePanel::EventAction, kActionArguments);
-	}
-
-	Fire(CodePanel::EventDrop, kArguments);
-}
\ No newline at end of file
--- a/LightClone/Source/CodePanel.h	Fri Sep 30 20:26:44 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * CodePanel
- */
-
-#ifndef __CODEPANEL_H__
-#define __CODEPANEL_H__
-
-#include "Core.h"
-#include "CodeSlot.h"
-
-/*
- * ActionArguments
- */
-struct ActionArguments : public GuiEventArguments
-{
-	/*
-	 * nSlot
-	 */
-	uint32 nSlot;
-
-	/*
-	 * ActionArguments
-	 */
-	ActionArguments(GuiElement* pSource, uint32 nCodeSlot) : GuiEventArguments(pSource), nSlot(nCodeSlot)
-	{
-	}
-};
-
-/*
- * CodePanel
- */
-class CodePanel : public GuiImage
-{
-public:
-
-	/*
-	 * EventAction
-	 */
-	static const char* EventAction;
-
-private:
-
-	/*
-	 * pSlot
-	 */
-	CodeSlot* pSlot;
-
-	/*
-	 * nSizeX
-	 */
-	uint32 nSizeX;
-
-	/*
-	 * nSizeY
-	 */
-	uint32 nSizeY;
-
-public:
-
-	/*
-	 * CodePanel
-	 */
-	CodePanel(uint32 nWidth, uint32 nHeight);
-
-	/*
-	 * Initialize
-	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
-
-	/*
-	 * SetAvailableSlots
-	 */
-	void SetAvailableSlots(uint32 nCount);
-
-	/*
-	 * SetAction
-	 */
-	void SetAction(uint32 nIndex, uint32 nAction);
-
-	/*
-	 * GetAction
-	 */
-	uint32 GetAction(uint32 nIndex) const;
-
-	/*
-	 * Clear
-	 */
-	void Clear();
-
-	/*
-	 * SetPermanent
-	 */
-	void SetPermanent(bool bPermanent);
-
-private:
-
-	/*
-	 * OnActionDropped
-	 */
-	void OnActionDropped(GuiEventArguments& kArguments);
-};
-
-#endif //__CODEPANEL_H__
--- a/LightClone/Source/CodeSlot.cpp	Fri Sep 30 20:26:44 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*
- * CodeSlot
- */
-
-#include "CodeSlot.h"
-#include "GuiInterface.h"
-#include "InputManager.h"
-
-/*
- * ActionTextureName
- */
-const char* ActionTextureName[] = 
-{
-	"Data\\Textures\\Forward.tga",
-	"Data\\Textures\\RotateCW.tga",
-	"Data\\Textures\\RotateCCW.tga",
-	"Data\\Textures\\Jump.tga",
-	"Data\\Textures\\Light.tga",
-	"Data\\Textures\\Function1.tga",
-	"Data\\Textures\\Function2.tga",
-};
-
-/*
- * CodeSlot
- */
-CodeSlot::CodeSlot() : GuiImage(), nAction(Action_None), bPermanent(false)
-{
-	SetFlag(GuiElementFlag_Pickable);
-}
-
-/*
- * Initialize
- */
-ErrorCode CodeSlot::Initialize(ResourceManager* pManager)
-{
-	ErrorCode eCode = GuiImage::Initialize(pManager);
-	if(eCode == Error_Success)
-	{
-		SetTexture("Data\\Textures\\Slot.tga");
-	}
-
-	return eCode;
-}
-
-/*
- * Terminate
- */
-void CodeSlot::Terminate()
-{
-}
-
-/*
- * SetSlot
- */
-void CodeSlot::SetSlot(uint32 nValue)
-{
-	nSlot = nValue;
-}
-
-/*
- * GetSlot
- */
-uint32 CodeSlot::GetSlot() const
-{
-	return nSlot;
-}
-
-/*
- * SetAction
- */
-void CodeSlot::SetAction(uint32 nValue)
-{
-	nAction = nValue;
-
-	SetTexture(nAction == Action_None ? "Data\\Textures\\Slot.tga" : ActionTextureName[nAction - Action_Forward]);
-}
-
-/*
- * GetAction
- */
-uint32 CodeSlot::GetAction() const
-{
-	return nAction;
-}
-
-/*
- * SetPermanent
- */
-void CodeSlot::SetPermanent(bool bValue)
-{
-	bPermanent = bValue;
-}
-
-/*
- * OnMouseDown
- */
-void CodeSlot::OnMouseDown(uint32 nButton, float fX, float fY)
-{
-	if(nButton == MouseButton_Left)
-	{
-		pInterface->AcquireCursor(this);
-	}
-}
-
-/*
- * OnMouseUp
- */
-void CodeSlot::OnMouseUp(uint32 nButton, float fX, float fY)
-{
-	if(pInterface->IsCursorAcquiredBy(this))
-	{
-		pInterface->ReleaseCursor();
-	}
-}
-
-/*
- * OnMouseMove
- */
-void CodeSlot::OnMouseMove(float fX, float fY)
-{
-	if(pInterface->IsCursorAcquiredBy(this))
-	{
-		pInterface->ReleaseCursor();
-
-		if(nAction != Action_None)
-		{
-			//TODO: Figure out some other way of doing this
-
-			// create a new element to represent the object being dragged
-			CodeSlot* pInstance = new CodeSlot();
-			pInstance->Initialize(pResourceManager);
-			pInstance->SetAction(nAction);
-			pInstance->SetDimensions(kDimensions);
-			pInstance->SetPosition(kPosition);
-			pInstance->SetInterface(pInterface);
-
-			// let the interface and cursor manage the drag object
-			pInterface->BeginDrag(pInstance, MouseButton_Left);
-
-			// if this slot is always suppose to have a valid action, do
-			// not clear out the current action
-			if(!bPermanent)
-			{
-				SetAction(Action_None);
-			}
-		}
-	}
-}
-
-/*
- * OnDrop
- */
-void CodeSlot::OnDrop(GuiElement* pSource, float fX, float fY)
-{
-	//TODO: Need to make sure pSource is actually a CodeSlot
-	SetAction(((CodeSlot*)pSource)->nAction);
-
-	GuiEventArguments kArguments(this);
-	Fire(CodeSlot::EventDrop, kArguments);
-}
--- a/LightClone/Source/CodeSlot.h	Fri Sep 30 20:26:44 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * CodeSlot
- */
-
-#ifndef __CODESLOT_H__
-#define __CODESLOT_H__
-
-#include "Core.h"
-#include "GuiImage.h"
-
-/*
- * CodeSlot
- */
-class CodeSlot : public GuiImage
-{
-	/*
-	 * nSlot
-	 */
-	uint32 nSlot;
-
-	/*
-	 * nAction
-	 */
-	uint32 nAction;
-
-	/*
-	 * bPermanent
-	 */
-	bool bPermanent;
-
-public:
-
-	/*
-	 * CodeSlot
-	 */
-	CodeSlot();
-
-	/*
-	 * Initialize
-	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
-
-	/*
-	 * Terminate
-	 */
-	virtual void Terminate();
-
-	/*
-	 * SetSlot
-	 */
-	void SetSlot(uint32 nSlot);
-
-	/*
-	 * GetSlot
-	 */
-	uint32 GetSlot() const;
-
-	/*
-	 * SetAction
-	 */
-	void SetAction(uint32 nAction);
-
-	/*
-	 * GetAction
-	 */
-	uint32 GetAction() const;
-
-	/*
-	 * SetPermanent
-	 */
-	void SetPermanent(bool bPermanent);
-
-protected:
-
-	/*
-	 * OnMouseDown
-	 */
-	virtual void OnMouseDown(uint32 nButton, float fX, float fY);
-
-	/*
-	 * OnMouseUp
-	 */
-	virtual void OnMouseUp(uint32 nButton, float fX, float fY);
-
-	/*
-	 * OnMouseMove
-	 */
-	virtual void OnMouseMove(float fX, float fY);
-
-	/*
-	 * OnDrop
-	 */
-	virtual void OnDrop(GuiElement* pSource, float fX, float fY);
-};
-
-#endif //__CODESLOT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LightClone/Source/ProgramPanel.cpp	Fri Sep 30 22:39:08 2011 -0700
@@ -0,0 +1,115 @@
+/*
+ * ProgramPanel
+ */
+
+#include "ProgramPanel.h"
+
+/*
+ * EventAction
+ */
+const char* ProgramPanel::EventAction = "ProgramPanel:EventAction";
+
+/*
+ * ProgramPanel
+ */
+ProgramPanel::ProgramPanel(uint32 nWidth, uint32 nHeight) : GuiImage(), nSizeX(nWidth), nSizeY(nHeight)
+{
+	pSlot = new ActionSlot[nSizeX * nSizeY];
+}
+
+/*
+ * Initialize
+ */
+ErrorCode ProgramPanel::Initialize(ResourceManager* pResourceManager)
+{
+	const float fSlotSizeX		= 48.0f;
+	const float fSlotSizeY		= 48.0f;
+	const float fSlotPadding	= 16.0f;
+	const float fSlotSpacing	= 8.0f;
+
+	ErrorCode eCode = GuiImage::Initialize(pResourceManager);
+	if(eCode == Error_Success)
+	{
+		SetDimensions(2.0f * fSlotPadding + (fSlotSizeX + fSlotSpacing) * nSizeX - fSlotSpacing, 2.0f * fSlotPadding + (fSlotSizeY + fSlotSpacing) * nSizeY - fSlotSpacing);
+
+		for(uint32 i = 0; i < nSizeY; ++i)
+		{
+			for(uint32 j = 0; j < nSizeX; ++j)
+			{
+				const uint32 nIndex = i * nSizeX + j;
+
+				pSlot[nIndex].Initialize(pResourceManager);
+				pSlot[nIndex].SetTexture("Data\\Textures\\Slot.tga");
+				pSlot[nIndex].SetDimensions(fSlotSizeX, fSlotSizeY);
+				pSlot[nIndex].SetPosition(fSlotPadding + (fSlotSizeX + fSlotSpacing) * j, fSlotPadding + (fSlotSizeY + fSlotSpacing) * i);
+				pSlot[nIndex].Subscribe(ActionSlot::EventDrop, &ProgramPanel::OnActionDropped, this);
+				pSlot[nIndex].SetSlot(nIndex);
+				pSlot[nIndex].SetAction(Action_None);
+
+				Add(&pSlot[nIndex]);
+			}
+		}
+	}
+
+	return eCode;
+}
+
+/*
+ * SetAction
+ */
+void ProgramPanel::SetAction(uint32 nIndex, uint32 nAction)
+{
+	pSlot[nIndex].SetAction(nAction);
+}
+
+/*
+ * GetAction
+ */
+uint32 ProgramPanel::GetAction(uint32 nIndex) const
+{
+	return pSlot[nIndex].GetAction();
+}
+
+/*
+ * Clear
+ */
+void ProgramPanel::Clear()
+{
+	const uint32 nCount = nSizeX * nSizeY;
+
+	for(uint32 i = 0; i < nCount; ++i)
+	{
+		pSlot[i].SetAction(Action_None);
+	}
+}
+
+/*
+ * SetPermanent
+ */
+void ProgramPanel::SetPermanent(bool bPermanent)
+{
+	const uint32 nCount = nSizeX * nSizeY;
+
+	for(uint32 i = 0; i < nCount; ++i)
+	{
+		pSlot[i].SetPermanent(bPermanent);
+	}
+}
+
+/*
+ * OnActionDropped
+ */
+void ProgramPanel::OnActionDropped(GuiEventArguments& kArguments)
+{
+	ActionSlot* pSlot = (ActionSlot*)kArguments.pSource;
+	//ASSERT(pSlot != NULL);
+
+	const uint32 nIndex = pSlot->GetSlot();
+	//if(nIndex < nActionSlots)
+	{
+		ActionArguments kActionArguments(this, nIndex);
+		Fire(ProgramPanel::EventAction, kActionArguments);
+	}
+
+	Fire(ProgramPanel::EventDrop, kArguments);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LightClone/Source/ProgramPanel.h	Fri Sep 30 22:39:08 2011 -0700
@@ -0,0 +1,103 @@
+/*
+ * ProgramPanel
+ */
+
+#ifndef __PROGRAMPANEL_H__
+#define __PROGRAMPANEL_H__
+
+#include "Core.h"
+#include "ActionSlot.h"
+
+/*
+ * ActionArguments
+ */
+struct ActionArguments : public GuiEventArguments
+{
+	/*
+	 * nSlot
+	 */
+	uint32 nSlot;
+
+	/*
+	 * ActionArguments
+	 */
+	ActionArguments(GuiElement* pSource, uint32 nCodeSlot) : GuiEventArguments(pSource), nSlot(nCodeSlot)
+	{
+	}
+};
+
+/*
+ * ProgramPanel
+ */
+class ProgramPanel : public GuiImage
+{
+public:
+
+	/*
+	 * EventAction
+	 */
+	static const char* EventAction;
+
+private:
+
+	/*
+	 * pSlot
+	 */
+	ActionSlot* pSlot;
+
+	/*
+	 * nSizeX
+	 */
+	uint32 nSizeX;
+
+	/*
+	 * nSizeY
+	 */
+	uint32 nSizeY;
+
+public:
+
+	/*
+	 * ProgramPanel
+	 */
+	ProgramPanel(uint32 nWidth, uint32 nHeight);
+
+	/*
+	 * Initialize
+	 */
+	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
+
+	/*
+	 * SetAvailableSlots
+	 */
+	void SetAvailableSlots(uint32 nCount);
+
+	/*
+	 * SetAction
+	 */
+	void SetAction(uint32 nIndex, uint32 nAction);
+
+	/*
+	 * GetAction
+	 */
+	uint32 GetAction(uint32 nIndex) const;
+
+	/*
+	 * Clear
+	 */
+	void Clear();
+
+	/*
+	 * SetPermanent
+	 */
+	void SetPermanent(bool bPermanent);
+
+private:
+
+	/*
+	 * OnActionDropped
+	 */
+	void OnActionDropped(GuiEventArguments& kArguments);
+};
+
+#endif //__PROGRAMPANEL_H__
--- a/LightClone/Source/World.cpp	Fri Sep 30 20:26:44 2011 -0700
+++ b/LightClone/Source/World.cpp	Fri Sep 30 22:39:08 2011 -0700
@@ -221,7 +221,7 @@
 		pBackground->SetPosition(ScreenSizeX - pBackground->GetWidth(), 0.0f);
 		pBackground->SetDepth(512.0f);
 
-		pToolbar = new CodePanel(4, 2);
+		pToolbar = new ProgramPanel(4, 2);
 		pToolbar->Initialize(pResourceManager);
 		pToolbar->SetTexture("Data\\Textures\\PanelA.png");
 		pToolbar->SetPosition(16, 16.0f);
@@ -243,11 +243,11 @@
 		pMainLabel->SetPosition(26.0f, 149.0f);
 		pMainLabel->SetDepth(256.0f);
 
-		pCode[0] = new CodePanel(4, 3);
+		pCode[0] = new ProgramPanel(4, 3);
 		pCode[0]->Initialize(pResourceManager);
 		pCode[0]->SetTexture("Data\\Textures\\PanelB.png");
 		pCode[0]->SetPosition(16.0f, 160.0f);
-		pCode[0]->Subscribe(CodePanel::EventAction, &World::OnAction, this);
+		pCode[0]->Subscribe(ProgramPanel::EventAction, &World::OnAction, this);
 		pCode[0]->SetDepth(256.0f);
 
 		GuiLabel* pFunctionALabel = new GuiLabel();
@@ -257,11 +257,11 @@
 		pFunctionALabel->SetColor(D3DCOLOR_XRGB(0, 0, 0));
 		pFunctionALabel->SetPosition(26.0f, 349.0f);
 
-		pCode[1] = new CodePanel(4, 2);
+		pCode[1] = new ProgramPanel(4, 2);
 		pCode[1]->Initialize(pResourceManager);
 		pCode[1]->SetTexture("Data\\Textures\\PanelA.png");
 		pCode[1]->SetPosition(16.0f, 360.0f);
-		pCode[1]->Subscribe(CodePanel::EventAction, &World::OnAction, this);
+		pCode[1]->Subscribe(ProgramPanel::EventAction, &World::OnAction, this);
 
 		GuiLabel* pFunctionBLabel = new GuiLabel();
 		pFunctionBLabel->Initialize(pResourceManager);
@@ -270,11 +270,11 @@
 		pFunctionBLabel->SetColor(D3DCOLOR_XRGB(0, 0, 0));
 		pFunctionBLabel->SetPosition(26.0f, 493.0f);
 
-		pCode[2] = new CodePanel(4, 2);
+		pCode[2] = new ProgramPanel(4, 2);
 		pCode[2]->Initialize(pResourceManager);
 		pCode[2]->SetTexture("Data\\Textures\\PanelA.png");
 		pCode[2]->SetPosition(16.0f, 504.0f);
-		pCode[2]->Subscribe(CodePanel::EventAction, &World::OnAction, this);
+		pCode[2]->Subscribe(ProgramPanel::EventAction, &World::OnAction, this);
 
 		const float fButtonPadding	= 32.0f;
 		const float fButtonSpacing	= 8.0f;
@@ -507,7 +507,7 @@
 		{
 			kProgram.Clear();
 
-			for(uint32 i = 0; i < MaximumCodePanels; ++i)
+			for(uint32 i = 0; i < MaximumFunctionCount; ++i)
 			{
 				pCode[i]->Clear();
 			}
@@ -553,7 +553,7 @@
 {
 	ActionArguments& kActionArguments = (ActionArguments&)kArguments;
 
-	for(uint32 i = 0; i < MaximumCodePanels; ++i)
+	for(uint32 i = 0; i < MaximumFunctionCount; ++i)
 	{
 		if(kArguments.pSource == pCode[i])
 		{
@@ -604,7 +604,7 @@
 {
 	kProgram.Clear();
 
-	for(uint32 i = 0; i < MaximumCodePanels; ++i)
+	for(uint32 i = 0; i < MaximumFunctionCount; ++i)
 	{
 		pCode[i]->Clear();
 	}
--- a/LightClone/Source/World.h	Fri Sep 30 20:26:44 2011 -0700
+++ b/LightClone/Source/World.h	Fri Sep 30 22:39:08 2011 -0700
@@ -16,7 +16,7 @@
 #include "GuiInterface.h"
 #include "GuiImage.h"
 #include "GuiButton.h"
-#include "CodePanel.h"
+#include "ProgramPanel.h"
 #include "Program.h"
 #include "Dialog.h"
 
@@ -36,11 +36,6 @@
 class World
 {
 	/*
-	 * MaximumCodePanels
-	 */
-	static const uint32 MaximumCodePanels = 3;
-
-	/*
 	 * pInputManager
 	 */
 	InputManager* pInputManager;
@@ -143,12 +138,12 @@
 	/*
 	 * pToolbar
 	 */
-	CodePanel* pToolbar;
+	ProgramPanel* pToolbar;
 
 	/*
 	 * pCode
 	 */
-	CodePanel* pCode[MaximumCodePanels];
+	ProgramPanel* pCode[MaximumFunctionCount];
 
 	/*
 	 * pMessageDialog