This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 10129 for ps


Ignore:
Timestamp:
08/28/11 23:10:45 (13 years ago)
Author:
ben
Message:

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).

Location:
ps/trunk/source/tools/atlas
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.cpp

    r6910 r10129  
    1 /* Copyright (C) 2009 Wildfire Games.
     1/* Copyright (C) 2011 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
     
    7070END_EVENT_TABLE()
    7171
    72 ToolButtonBar::ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID)
    73 : wxToolBar(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL)
     72ToolButtonBar::ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID, long style)
     73: wxToolBar(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style)
    7474, m_ToolManager(toolManager), m_SectionLayout(sectionLayout), m_Id(baseID), m_Size(-1)
    7575{
  • ps/trunk/source/tools/atlas/AtlasUI/CustomControls/Buttons/ToolButton.h

    r6910 r10129  
    1 /* Copyright (C) 2009 Wildfire Games.
     1/* Copyright (C) 2011 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
     
    4545{
    4646public:
    47     ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID);
     47    ToolButtonBar(ToolManager& toolManager, wxWindow* parent, SectionLayout* sectionLayout, int baseID, long style);
    4848    void AddToolButton(const wxString& shortLabel, const wxString& longLabel,
    4949        const wxString& iconPNGFilename, const wxString& toolName, const wxString& sectionPage);
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp

    r10118 r10129  
    3232#include "General/Datafile.h"
    3333
    34 #include "CustomControls/HighResTimer/HighResTimer.h"
    3534#include "CustomControls/Buttons/ToolButton.h"
    3635#include "CustomControls/Canvas/Canvas.h"
     36#include "CustomControls/HighResTimer/HighResTimer.h"
    3737
    3838#include "GameInterface/MessagePasser.h"
     
    450450
    451451    // Toolbar:
    452 
    453     ToolButtonBar* toolbar = new ToolButtonBar(m_ToolManager, this, &m_SectionLayout, ID_Toolbar);
    454     // TODO: configurable small vs large icon images
    455 
    456     // (button label; tooltip text; image; internal tool name; section to switch to)
    457     toolbar->AddToolButton(_("Default"),       _("Default"),                   _T("default.png"),          _T(""),                 _T(""));
    458     toolbar->AddToolButton(_("Move"),          _("Move/rotate object"),        _T("moveobject.png"),       _T("TransformObject"),  _T("")/*_T("ObjectSidebar")*/);
    459     toolbar->AddToolButton(_("Elevation"),     _("Alter terrain elevation"),   _T("alterelevation.png"),   _T("AlterElevation"),   _T("")/*_T("TerrainSidebar")*/);
    460     toolbar->AddToolButton(_("Smooth"),        _("Smooth terrain elevation"),  _T("smoothelevation.png"),  _T("SmoothElevation"),  _T("")/*_T("TerrainSidebar")*/);
    461     toolbar->AddToolButton(_("Flatten"),       _("Flatten terrain elevation"), _T("flattenelevation.png"), _T("FlattenElevation"), _T("")/*_T("TerrainSidebar")*/);
    462     toolbar->AddToolButton(_("Paint Terrain"), _("Paint terrain texture"),     _T("paintterrain.png"),     _T("PaintTerrain"),     _T("")/*_T("TerrainSidebar")*/);
    463 
    464     toolbar->Realize();
    465     SetToolBar(toolbar);
     452    // wxOSX/Cocoa 2.9 doesn't seem to like SetToolBar, so we use CreateToolBar which implicitly associates
     453    //  the toolbar with the frame, and use OnCreateToolBar to construct our custom toolbar
     454    //  (this should be equivalent behavior on all platforms)
     455    CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL, ID_Toolbar);
     456
    466457    // Set the default tool to be selected
    467458    m_ToolManager.SetCurrentTool(_T(""));
     
    536527}
    537528
     529wxToolBar* ScenarioEditor::OnCreateToolBar(long style, wxWindowID id, const wxString& WXUNUSED(name))
     530{
     531    ToolButtonBar* toolbar = new ToolButtonBar(m_ToolManager, this, &m_SectionLayout, id, style);
     532    // TODO: configurable small vs large icon images
     533
     534    // (button label; tooltip text; image; internal tool name; section to switch to)
     535    toolbar->AddToolButton(_("Default"),       _("Default"),                   _T("default.png"),          _T(""),                 _T(""));
     536    toolbar->AddToolButton(_("Move"),          _("Move/rotate object"),        _T("moveobject.png"),       _T("TransformObject"),  _T("")/*_T("ObjectSidebar")*/);
     537    toolbar->AddToolButton(_("Elevation"),     _("Alter terrain elevation"),   _T("alterelevation.png"),   _T("AlterElevation"),   _T("")/*_T("TerrainSidebar")*/);
     538    toolbar->AddToolButton(_("Smooth"),        _("Smooth terrain elevation"),  _T("smoothelevation.png"),  _T("SmoothElevation"),  _T("")/*_T("TerrainSidebar")*/);
     539    toolbar->AddToolButton(_("Flatten"),       _("Flatten terrain elevation"), _T("flattenelevation.png"), _T("FlattenElevation"), _T("")/*_T("TerrainSidebar")*/);
     540    toolbar->AddToolButton(_("Paint Terrain"), _("Paint terrain texture"),     _T("paintterrain.png"),     _T("PaintTerrain"),     _T("")/*_T("TerrainSidebar")*/);
     541
     542    toolbar->Realize();
     543
     544    return toolbar;
     545}
     546
    538547float ScenarioEditor::GetSpeedModifier()
    539548{
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h

    r9649 r10129  
    1919#define INCLUDED_SCENARIOEDITOR
    2020
     21#include "wx/toolbar.h"
     22
    2123#include "General/AtlasWindowCommandProc.h"
    2224#include "General/Observable.h"
     
    3537    void OnTimer(wxTimerEvent& event);
    3638    void OnIdle(wxIdleEvent& event);
     39    wxToolBar* OnCreateToolBar(long style, wxWindowID id, const wxString &name);
    3740   
    3841    void OnNew(wxCommandEvent& event);
  • ps/trunk/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp

    r8433 r10129  
    1 /* Copyright (C) 2010 Wildfire Games.
     1/* Copyright (C) 2011 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
     
    163163{
    164164    CVideoMode::UpdateRenderer(msg->width, msg->height);
     165
     166#if OS_MACOSX
     167    // OS X seems to require this to update the GL canvas
     168    Atlas_GLSetCurrent(const_cast<void*>(g_GameLoop->glCanvas));
     169#endif
    165170}
    166171
Note: See TracChangeset for help on using the changeset viewer.