Index: binaries/data/tools/atlas/toolbar/save.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: binaries/data/tools/atlas/toolbar/save.png
===================================================================
--- binaries/data/tools/atlas/toolbar/save.png	(revision 0)
+++ binaries/data/tools/atlas/toolbar/save.png	(working copy)

Property changes on: binaries/data/tools/atlas/toolbar/save.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.cpp
===================================================================
--- source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.cpp	(revision 15069)
+++ source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.cpp	(working copy)
@@ -1,19 +1,19 @@
 /* Copyright (C) 2011 Wildfire Games.
- * This file is part of 0 A.D.
- *
- * 0 A.D. is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * 0 A.D. is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
- */
+* This file is part of 0 A.D.
+*
+* 0 A.D. is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 2 of the License, or
+* (at your option) any later version.
+*
+* 0 A.D. is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 #include "precompiled.h"
 
@@ -29,9 +29,9 @@
 
 BEGIN_EVENT_TABLE(ToolButton, wxButton)
 	EVT_BUTTON(wxID_ANY, ToolButton::OnClick)
-END_EVENT_TABLE()
+	END_EVENT_TABLE()
 
-ToolButton::ToolButton
+	ToolButton::ToolButton
 	(ToolManager& toolManager, wxWindow *parent, const wxString& label, const wxString& toolName, const wxSize& size, long style)
 	: wxButton(parent, wxID_ANY, label, wxDefaultPosition, size, style)
 	, m_ToolManager(toolManager)
@@ -67,18 +67,51 @@
 
 BEGIN_EVENT_TABLE(ToolButtonBar, wxToolBar)
 	EVT_TOOL(wxID_ANY, ToolButtonBar::OnTool)
-END_EVENT_TABLE()
+	END_EVENT_TABLE()
 
-ToolButtonBar::ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID, long style)
-: wxToolBar(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style)
-, m_ToolManager(toolManager), m_SectionLayout(sectionLayout), m_Id(baseID), m_Size(-1)
+	ToolButtonBar::ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID, long style)
+	: wxToolBar(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style)
+	, m_ToolManager(toolManager), m_SectionLayout(sectionLayout), m_Id(baseID), m_Size(-1),m_IdAction(baseID)
 {
 	/* "msw.remap: If 1 (the default), wxToolBar bitmap colours will be remapped
-	   to the current theme's values. Set this to 0 to disable this functionality,
-	   for example if you're using more than 16 colours in your tool bitmaps." */
+	to the current theme's values. Set this to 0 to disable this functionality,
+	for example if you're using more than 16 colours in your tool bitmaps." */
 	wxSystemOptions::SetOption(wxT("msw.remap"), 0); // (has global effect)
 }
 
+void ToolButtonBar::AddToolAction(const wxString& shortLabel, const wxString& longLabel,
+								  const wxString& iconPNGFilename, fnAction action)
+{
+	wxFileName iconPath (_T("tools/atlas/toolbar/"));
+	iconPath.MakeAbsolute(Datafile::GetDataDirectory());
+	iconPath.SetFullName(iconPNGFilename);
+	wxFFileInputStream fstr (iconPath.GetFullPath());
+	if (! fstr.Ok())
+	{
+		wxLogError(_("Failed to open toolbar icon file '%s'"), iconPath.GetFullPath().c_str());
+		return;
+	}
+	wxImage img (fstr, wxBITMAP_TYPE_PNG);
+	if (! img.Ok())
+	{
+		wxLogError(_("Failed to load toolbar icon image '%s'"), iconPath.GetFullPath().c_str());
+		return;
+	}
+
+	if (m_Size == -1)
+	{
+		m_Size = img.GetWidth();
+		SetToolBitmapSize(wxSize(m_Size, m_Size));
+	}
+
+	if (img.GetWidth() != m_Size || img.GetHeight() != m_Size)
+		img = img.Scale(m_Size, m_Size);
+
+	AddTool(1000+m_IdAction, wxBitmap(img),shortLabel, longLabel);
+	m_ButtonsActions[m_IdAction] = ButtonAction(action);
+
+	++m_IdAction;
+}
 void ToolButtonBar::AddToolButton(const wxString& shortLabel, const wxString& longLabel,
 								  const wxString& iconPNGFilename, const wxString& toolName,
 								  const wxString& sectionPage)
@@ -98,7 +131,7 @@
 		wxLogError(_("Failed to load toolbar icon image '%s'"), iconPath.GetFullPath().c_str());
 		return;
 	}
-	
+
 	if (m_Size == -1)
 	{
 		m_Size = img.GetWidth();
@@ -110,7 +143,7 @@
 
 	AddCheckTool(m_Id, shortLabel, wxBitmap(img), wxNullBitmap, longLabel);
 	m_Buttons[m_Id] = Button(toolName, sectionPage);
-	
+
 	RegisterToolBarButton(this, m_Id, toolName);
 
 	++m_Id;
@@ -118,9 +151,22 @@
 
 void ToolButtonBar::OnTool(wxCommandEvent& evt)
 {
-	std::map<int, Button>::iterator it = m_Buttons.find(evt.GetId());
-	wxCHECK_RET(it != m_Buttons.end(), _T("Invalid toolbar button"));
-	m_ToolManager.SetCurrentTool(it->second.name);
-	if (! it->second.sectionPage.IsEmpty())
-		m_SectionLayout->SelectPage(it->second.sectionPage);
+	int action=evt.GetId();
+	if(action>=1000)
+	{
+		//is an action
+		action-=1000;
+		
+		std::map<int, ButtonAction>::iterator it = m_ButtonsActions.find(action);
+		wxCHECK_RET(it != m_ButtonsActions.end(), _T("Invalid toolbar button"));
+		it->second.m_funcion();
+	} 
+	else 
+	{	
+		std::map<int, Button>::iterator it = m_Buttons.find(action);
+		wxCHECK_RET(it != m_Buttons.end(), _T("Invalid toolbar button"));
+		m_ToolManager.SetCurrentTool(it->second.name);
+		if (! it->second.sectionPage.IsEmpty())
+			m_SectionLayout->SelectPage(it->second.sectionPage);
+	}
 }
Index: source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.h
===================================================================
--- source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.h	(revision 15069)
+++ source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.h	(working copy)
@@ -18,11 +18,14 @@
 //#include "wx/tglbtn.h"
 
 #include <map>
+#include "boost/function.hpp"
 
 class ITool;
 class SectionLayout;
 class ToolManager;
 
+typedef boost::function<void()> fnAction;
+
 class ToolButton : public wxButton
 {
 public:
@@ -47,6 +50,8 @@
 	ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID, long style);
 	void AddToolButton(const wxString& shortLabel, const wxString& longLabel,
 		const wxString& iconPNGFilename, const wxString& toolName, const wxString& sectionPage);
+	void AddToolAction(const wxString& shortLabel, const wxString& longLabel,
+		const wxString& iconPNGFilename, fnAction fn);
 
 protected:
 	void OnTool(wxCommandEvent& evt);
@@ -54,6 +59,7 @@
 private:
 	ToolManager& m_ToolManager;
 	int m_Id;
+	int m_IdAction;
 	int m_Size;
 	struct Button
 	{
@@ -62,7 +68,14 @@
 		wxString name;
 		wxString sectionPage;
 	};
+	struct ButtonAction
+	{
+		ButtonAction(){}
+		ButtonAction(fnAction action):m_funcion(action){}
+		fnAction m_funcion;
+	};
 	std::map<int, Button> m_Buttons;
+	std::map<int, ButtonAction> m_ButtonsActions;
 	SectionLayout* m_SectionLayout;
 
 	DECLARE_EVENT_TABLE();
Index: source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp
===================================================================
--- source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp	(revision 15069)
+++ source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp	(working copy)
@@ -331,6 +331,7 @@
  	EVT_MENU(ID_New, ScenarioEditor::OnNew)
 	EVT_MENU(ID_Open, ScenarioEditor::OnOpen)
 	EVT_MENU(ID_Save, ScenarioEditor::OnSave)
+	EVT_BUTTON(ID_Save,ScenarioEditor::OnSave)
 	EVT_MENU(ID_SaveAs, ScenarioEditor::OnSaveAs)
 	EVT_MENU(ID_ImportHeightmap, ScenarioEditor::OnImportHeightmap)
 	EVT_MENU_RANGE(wxID_FILE1, wxID_FILE9, ScenarioEditor::OnMRUFile)
@@ -543,6 +544,8 @@
 	ToolButtonBar* toolbar = new ToolButtonBar(m_ToolManager, this, &m_SectionLayout, id, style);
 	// TODO: configurable small vs large icon images
 
+	toolbar->AddToolAction(_("Save"),_("Save"),_T("save.png"),boost::bind(&ScenarioEditor::OnToolSave,this));
+	toolbar->AddSeparator();
 	// (button label; tooltip text; image; internal tool name; section to switch to)
 	toolbar->AddToolButton(_("Default"),       _("Default"),                   _T("default.png"),          _T(""),                 _T(""));
 	toolbar->AddToolButton(_("Move"),          _("Move/rotate object"),        _T("moveobject.png"),       _T("TransformObject"),  _T("")/*_T("ObjectSidebar")*/);
@@ -713,6 +716,12 @@
 	}
 }
 
+void ScenarioEditor::OnToolSave()
+{
+	wxCommandEvent evt(wxEVT_NULL,0);
+	this->OnSave(evt);
+}
+
 void ScenarioEditor::OnSave(wxCommandEvent& event)
 {
 	if (m_OpenFilename.IsEmpty())
Index: source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h
===================================================================
--- source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h	(revision 15069)
+++ source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h	(working copy)
@@ -26,6 +26,7 @@
 #include "Tools/Common/Tools.h"
 #include "CustomControls/FileHistory/FileHistory.h"
 #include "SectionLayout.h"
+#include "boost/bind.hpp"
 
 class ScenarioEditor : public wxFrame
 {
@@ -35,6 +36,8 @@
 	void OnTimer(wxTimerEvent& event);
 	void OnIdle(wxIdleEvent& event);
 	wxToolBar* OnCreateToolBar(long style, wxWindowID id, const wxString &name);
+
+	void OnToolSave();
 	
  	void OnNew(wxCommandEvent& event);
 	void OnOpen(wxCommandEvent& event);
