forked from 0ad/0ad
Changes Atlas toolbar construction to use CreateToolBar instead of explicitly setting it (which doesn't work on wxOSX 2.9).
Adds a call to Atlas_GLSetCurrent after setting Atlas resolution on OS X (otherwise the canvas doesn't seem to update properly). This was SVN commit r10129.
This commit is contained in:
parent
c1b6b6d76e
commit
769a927446
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2009 Wildfire Games.
|
||||
/* 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
|
||||
@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE(ToolButtonBar, wxToolBar)
|
||||
EVT_TOOL(wxID_ANY, ToolButtonBar::OnTool)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
ToolButtonBar::ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID)
|
||||
: wxToolBar(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL)
|
||||
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)
|
||||
{
|
||||
/* "msw.remap: If 1 (the default), wxToolBar bitmap colours will be remapped
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2009 Wildfire Games.
|
||||
/* 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
|
||||
@ -44,7 +44,7 @@ private:
|
||||
class ToolButtonBar : public wxToolBar
|
||||
{
|
||||
public:
|
||||
ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID);
|
||||
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);
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
#include "General/AtlasEventLoop.h"
|
||||
#include "General/Datafile.h"
|
||||
|
||||
#include "CustomControls/HighResTimer/HighResTimer.h"
|
||||
#include "CustomControls/Buttons/ToolButton.h"
|
||||
#include "CustomControls/Canvas/Canvas.h"
|
||||
#include "CustomControls/HighResTimer/HighResTimer.h"
|
||||
|
||||
#include "GameInterface/MessagePasser.h"
|
||||
#include "GameInterface/Messages.h"
|
||||
@ -449,20 +449,11 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent, ScriptInterface& scriptInterfac
|
||||
m_SectionLayout.SetWindow(this);
|
||||
|
||||
// Toolbar:
|
||||
// wxOSX/Cocoa 2.9 doesn't seem to like SetToolBar, so we use CreateToolBar which implicitly associates
|
||||
// the toolbar with the frame, and use OnCreateToolBar to construct our custom toolbar
|
||||
// (this should be equivalent behavior on all platforms)
|
||||
CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL, ID_Toolbar);
|
||||
|
||||
ToolButtonBar* toolbar = new ToolButtonBar(m_ToolManager, this, &m_SectionLayout, ID_Toolbar);
|
||||
// TODO: configurable small vs large icon images
|
||||
|
||||
// (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")*/);
|
||||
toolbar->AddToolButton(_("Elevation"), _("Alter terrain elevation"), _T("alterelevation.png"), _T("AlterElevation"), _T("")/*_T("TerrainSidebar")*/);
|
||||
toolbar->AddToolButton(_("Smooth"), _("Smooth terrain elevation"), _T("smoothelevation.png"), _T("SmoothElevation"), _T("")/*_T("TerrainSidebar")*/);
|
||||
toolbar->AddToolButton(_("Flatten"), _("Flatten terrain elevation"), _T("flattenelevation.png"), _T("FlattenElevation"), _T("")/*_T("TerrainSidebar")*/);
|
||||
toolbar->AddToolButton(_("Paint Terrain"), _("Paint terrain texture"), _T("paintterrain.png"), _T("PaintTerrain"), _T("")/*_T("TerrainSidebar")*/);
|
||||
|
||||
toolbar->Realize();
|
||||
SetToolBar(toolbar);
|
||||
// Set the default tool to be selected
|
||||
m_ToolManager.SetCurrentTool(_T(""));
|
||||
|
||||
@ -535,6 +526,24 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent, ScriptInterface& scriptInterfac
|
||||
#endif
|
||||
}
|
||||
|
||||
wxToolBar* ScenarioEditor::OnCreateToolBar(long style, wxWindowID id, const wxString& WXUNUSED(name))
|
||||
{
|
||||
ToolButtonBar* toolbar = new ToolButtonBar(m_ToolManager, this, &m_SectionLayout, id, style);
|
||||
// TODO: configurable small vs large icon images
|
||||
|
||||
// (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")*/);
|
||||
toolbar->AddToolButton(_("Elevation"), _("Alter terrain elevation"), _T("alterelevation.png"), _T("AlterElevation"), _T("")/*_T("TerrainSidebar")*/);
|
||||
toolbar->AddToolButton(_("Smooth"), _("Smooth terrain elevation"), _T("smoothelevation.png"), _T("SmoothElevation"), _T("")/*_T("TerrainSidebar")*/);
|
||||
toolbar->AddToolButton(_("Flatten"), _("Flatten terrain elevation"), _T("flattenelevation.png"), _T("FlattenElevation"), _T("")/*_T("TerrainSidebar")*/);
|
||||
toolbar->AddToolButton(_("Paint Terrain"), _("Paint terrain texture"), _T("paintterrain.png"), _T("PaintTerrain"), _T("")/*_T("TerrainSidebar")*/);
|
||||
|
||||
toolbar->Realize();
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
float ScenarioEditor::GetSpeedModifier()
|
||||
{
|
||||
if (wxGetKeyState(WXK_SHIFT) && wxGetKeyState(WXK_CONTROL))
|
||||
|
@ -18,6 +18,8 @@
|
||||
#ifndef INCLUDED_SCENARIOEDITOR
|
||||
#define INCLUDED_SCENARIOEDITOR
|
||||
|
||||
#include "wx/toolbar.h"
|
||||
|
||||
#include "General/AtlasWindowCommandProc.h"
|
||||
#include "General/Observable.h"
|
||||
#include "Tools/Common/ObjectSettings.h"
|
||||
@ -34,6 +36,7 @@ public:
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnTimer(wxTimerEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
wxToolBar* OnCreateToolBar(long style, wxWindowID id, const wxString &name);
|
||||
|
||||
void OnNew(wxCommandEvent& event);
|
||||
void OnOpen(wxCommandEvent& event);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010 Wildfire Games.
|
||||
/* 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
|
||||
@ -162,6 +162,11 @@ MESSAGEHANDLER(SetCanvas)
|
||||
MESSAGEHANDLER(ResizeScreen)
|
||||
{
|
||||
CVideoMode::UpdateRenderer(msg->width, msg->height);
|
||||
|
||||
#if OS_MACOSX
|
||||
// OS X seems to require this to update the GL canvas
|
||||
Atlas_GLSetCurrent(const_cast<void*>(g_GameLoop->glCanvas));
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user