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 10131 for ps


Ignore:
Timestamp:
08/29/11 05:50:29 (13 years ago)
Author:
ben
Message:

Fixes Atlas toolbar in wxOSX (only Realize() it after creation).
Fixes terrain preview not displaying first page in wxOSX.
Formats terrain page labels more nicely.
Adds a bunch of tooltips.

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

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp

    r10129 r10131  
    453453    //  the toolbar with the frame, and use OnCreateToolBar to construct our custom toolbar
    454454    //  (this should be equivalent behavior on all platforms)
    455     CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL, ID_Toolbar);
     455    CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL, ID_Toolbar)->Realize();
    456456
    457457    // Set the default tool to be selected
     
    540540    toolbar->AddToolButton(_("Paint Terrain"), _("Paint terrain texture"),     _T("paintterrain.png"),     _T("PaintTerrain"),     _T("")/*_T("TerrainSidebar")*/);
    541541
    542     toolbar->Realize();
    543 
    544542    return toolbar;
    545543}
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp

    r10117 r10131  
    148148    gridSizer->AddGrowableCol(1);
    149149    gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Reveal map")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    150     gridSizer->Add(new wxCheckBox(this, ID_MapReveal, wxEmptyString));
     150    gridSizer->Add(Tooltipped(new wxCheckBox(this, ID_MapReveal, wxEmptyString),
     151        _("If checked, players won't need to explore")));
    151152    gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Game type")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    152     gridSizer->Add(new wxChoice(this, ID_MapType, wxDefaultPosition, wxDefaultSize, gameTypes), wxSizerFlags().Expand());
     153    gridSizer->Add(Tooltipped(new wxChoice(this, ID_MapType, wxDefaultPosition, wxDefaultSize, gameTypes),
     154        _("Select the game type (or victory condition)")), wxSizerFlags().Expand());
    153155    gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Lock teams")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    154     gridSizer->Add(new wxCheckBox(this, ID_MapTeams, wxEmptyString));
     156    gridSizer->Add(Tooltipped(new wxCheckBox(this, ID_MapTeams, wxEmptyString),
     157        _("NOT IMPLEMENTED")));
    155158    sizer->Add(gridSizer, wxSizerFlags().Expand());
    156159
     
    160163    wxFlexGridSizer* kwGridSizer = new wxFlexGridSizer(2, 5, 5);
    161164    kwGridSizer->Add(new wxStaticText(this, wxID_ANY, _("Demo")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    162     kwGridSizer->Add(new wxCheckBox(this, ID_MapKW_Demo, wxEmptyString));
     165    kwGridSizer->Add(Tooltipped(new wxCheckBox(this, ID_MapKW_Demo, wxEmptyString),
     166        _("If checked, map will only be visible using filters in game setup")));
    163167    kwGridSizer->Add(new wxStaticText(this, wxID_ANY, _("Hidden")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    164     kwGridSizer->Add(new wxCheckBox(this, ID_MapKW_Hidden, wxEmptyString));
     168    kwGridSizer->Add(Tooltipped(new wxCheckBox(this, ID_MapKW_Hidden, wxEmptyString),
     169        _("If checked, map will only be visible using filters in game setup")));
    165170    keywordsSizer->Add(kwGridSizer);
    166171    sizer->Add(keywordsSizer, wxSizerFlags().Expand());
     
    263268    m_MainSizer->Add(m_MapSettingsCtrl, wxSizerFlags().Expand());
    264269
    265     m_MainSizer->Add(new wxButton(this, ID_OpenPlayerPanel, _T("Player settings")), wxSizerFlags().Expand().Border(wxTOP, 16));
    266 
    267270    {
    268271        /////////////////////////////////////////////////////////////////////////
     
    274277        sizer->AddSpacer(5);
    275278
     279        sizer->Add(new wxButton(this, ID_OpenPlayerPanel, _T("Change players")), wxSizerFlags().Expand());
     280
     281        sizer->AddSpacer(5);
     282
    276283        wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2, 5, 5);
    277284        gridSizer->AddGrowableCol(1);
     
    283290        gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Random seed")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    284291        wxBoxSizer* seedSizer = new wxBoxSizer(wxHORIZONTAL);
    285         seedSizer->Add(Tooltipped(new wxTextCtrl(this, ID_RandomSeed, _T("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)), _("Seed value for random map")), wxSizerFlags(1).Expand());
    286         seedSizer->Add(Tooltipped(new wxButton(this, ID_RandomReseed, _("R"), wxDefaultPosition, wxSize(24, -1)), _("New random seed")));
     292        seedSizer->Add(Tooltipped(new wxTextCtrl(this, ID_RandomSeed, _T("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC)),
     293            _("Seed value for random map")), wxSizerFlags(1).Expand());
     294        seedSizer->Add(Tooltipped(new wxButton(this, ID_RandomReseed, _("R"), wxDefaultPosition, wxSize(24, -1)),
     295            _("New random seed")));
    287296        gridSizer->Add(seedSizer, wxSizerFlags().Expand());
    288297
     
    291300        sizer->AddSpacer(5);
    292301
    293         sizer->Add(new wxButton(this, ID_RandomGenerate, _("Generate map")), wxSizerFlags().Expand());
    294 
    295         m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 16));
     302        sizer->Add(Tooltipped(new wxButton(this, ID_RandomGenerate, _("Generate map")),
     303            _("Run selected random map script")), wxSizerFlags().Expand());
     304
     305        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
    296306    }
    297307
     
    301311        wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Simulation test"));
    302312        wxGridSizer* gridSizer = new wxGridSizer(5);
    303         gridSizer->Add(new wxButton(this, ID_SimPlay, _("Play")), wxSizerFlags().Expand());
    304         gridSizer->Add(new wxButton(this, ID_SimFast, _("Fast")), wxSizerFlags().Expand());
    305         gridSizer->Add(new wxButton(this, ID_SimSlow, _("Slow")), wxSizerFlags().Expand());
    306         gridSizer->Add(new wxButton(this, ID_SimPause, _("Pause")), wxSizerFlags().Expand());
    307         gridSizer->Add(new wxButton(this, ID_SimReset, _("Reset")), wxSizerFlags().Expand());
     313        gridSizer->Add(Tooltipped(new wxButton(this, ID_SimPlay, _("Play")),
     314            _("Run the simulation at normal speed")), wxSizerFlags().Expand());
     315        gridSizer->Add(Tooltipped(new wxButton(this, ID_SimFast, _("Fast")),
     316            _("Run the simulation at 8x speed")), wxSizerFlags().Expand());
     317        gridSizer->Add(Tooltipped(new wxButton(this, ID_SimSlow, _("Slow")),
     318            _("Run the simulation at 1/8x speed")), wxSizerFlags().Expand());
     319        gridSizer->Add(Tooltipped(new wxButton(this, ID_SimPause, _("Pause")),
     320            _("Pause the simulation")), wxSizerFlags().Expand());
     321        gridSizer->Add(Tooltipped(new wxButton(this, ID_SimReset, _("Reset")),
     322            _("Reset the editor to initial state")), wxSizerFlags().Expand());
    308323        sizer->Add(gridSizer, wxSizerFlags().Expand());
    309324        UpdateSimButtons();
    310         m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 16));
     325        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
    311326    }
    312327}
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp

    r10123 r10131  
    114114    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    115115    sizer->Add(new wxStaticText(this, wxID_ANY, _("Filter")), wxSizerFlags().Align(wxALIGN_CENTER));
    116     wxTextCtrl* objectFilter = new wxTextCtrl(this, ID_ObjectFilter);
    117     sizer->Add(objectFilter, wxSizerFlags().Expand().Proportion(1));
     116    sizer->Add(Tooltipped(new wxTextCtrl(this, ID_ObjectFilter),
     117        _("Enter text to filter object list")), wxSizerFlags().Expand().Proportion(1));
    118118    m_MainSizer->Add(sizer, wxSizerFlags().Expand());
    119119
     
    194194void ObjectSidebar::ToggleViewer(wxCommandEvent& WXUNUSED(evt))
    195195{
     196    // Change name of button
    196197    if (p->m_ActorViewerActive)
     198    {
     199        wxDynamicCast(FindWindow(ID_ToggleViewer), wxButton)->SetLabel(_("Switch to actor viewer"));
    197200        m_ScenarioEditor.GetToolManager().SetCurrentTool(_T(""), NULL);
     201    }
    198202    else
     203    {
     204        wxDynamicCast(FindWindow(ID_ToggleViewer), wxButton)->SetLabel(_("Return to game view"));
    199205        m_ScenarioEditor.GetToolManager().SetCurrentTool(_T("ActorViewerTool"), NULL);
     206    }
    200207}
    201208
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp

    r10117 r10131  
    8686            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Colour")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    8787            wxButton* colourButton = new wxButton(this, ID_PlayerColour);
    88             gridSizer->Add(Tooltipped(colourButton, _("Set player colour")), wxSizerFlags(1).Expand().Align(wxALIGN_RIGHT));
     88            gridSizer->Add(Tooltipped(colourButton,
     89                _("Set player colour")), wxSizerFlags(1).Expand().Align(wxALIGN_RIGHT));
    8990            m_Controls.colour = colourButton;
    9091            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Default AI")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    9192            wxChoice* aiChoice = new wxChoice(this, wxID_ANY);
    92             gridSizer->Add(Tooltipped(aiChoice, _("Select default AI")), wxSizerFlags(1).Expand().Align(wxALIGN_RIGHT));
     93            gridSizer->Add(Tooltipped(aiChoice,
     94                _("Select default AI")), wxSizerFlags(1).Expand().Align(wxALIGN_RIGHT));
    9395            m_Controls.ai = aiChoice;
    9496
     
    105107            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Food")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    106108            wxSpinCtrl* foodCtrl = new wxSpinCtrl(this, ID_PlayerFood, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, INT_MAX);
    107             gridSizer->Add(Tooltipped(foodCtrl, _("Initial value of food resource")), wxSizerFlags().Expand());
     109            gridSizer->Add(Tooltipped(foodCtrl,
     110                _("Initial value of food resource")), wxSizerFlags().Expand());
    108111            m_Controls.food = foodCtrl;
    109112            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Wood")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    110113            wxSpinCtrl* woodCtrl = new wxSpinCtrl(this, ID_PlayerWood, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, INT_MAX);
    111             gridSizer->Add(Tooltipped(woodCtrl, _("Initial value of wood resource")), wxSizerFlags().Expand());
     114            gridSizer->Add(Tooltipped(woodCtrl,
     115                _("Initial value of wood resource")), wxSizerFlags().Expand());
    112116            m_Controls.wood = woodCtrl;
    113117            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Metal")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    114118            wxSpinCtrl* metalCtrl = new wxSpinCtrl(this, ID_PlayerMetal, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, INT_MAX);
    115             gridSizer->Add(Tooltipped(metalCtrl, _("Initial value of metal resource")), wxSizerFlags().Expand());
     119            gridSizer->Add(Tooltipped(metalCtrl,
     120                _("Initial value of metal resource")), wxSizerFlags().Expand());
    116121            m_Controls.metal = metalCtrl;
    117122            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Stone")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    118123            wxSpinCtrl* stoneCtrl = new wxSpinCtrl(this, ID_PlayerStone, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, INT_MAX);
    119             gridSizer->Add(Tooltipped(stoneCtrl, _("Initial value of stone resource")), wxSizerFlags().Expand());
     124            gridSizer->Add(Tooltipped(stoneCtrl,
     125                _("Initial value of stone resource")), wxSizerFlags().Expand());
    120126            m_Controls.stone = stoneCtrl;
    121127            gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Pop limit")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
    122128            wxSpinCtrl* popCtrl = new wxSpinCtrl(this, ID_PlayerPop, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, INT_MAX);
    123             gridSizer->Add(Tooltipped(popCtrl, _("Population limit for this player")), wxSizerFlags().Expand());
     129            gridSizer->Add(Tooltipped(popCtrl,
     130                _("Population limit for this player")), wxSizerFlags().Expand());
    124131            m_Controls.pop = popCtrl;
    125132
     
    158165            wxGridSizer* gridSizer = new wxGridSizer(3);
    159166            wxButton* cameraSet = new wxButton(this, ID_CameraSet, _("Set"));
    160             gridSizer->Add(Tooltipped(cameraSet, _("Set player camera to this view")), wxSizerFlags().Expand());
     167            gridSizer->Add(Tooltipped(cameraSet,
     168                _("Set player camera to this view")), wxSizerFlags().Expand());
    161169            wxButton* cameraView = new wxButton(this, ID_CameraView, _("View"));
    162170            cameraView->Enable(false);
    163             gridSizer->Add(Tooltipped(cameraView, _("View the player camera")), wxSizerFlags().Expand());
     171            gridSizer->Add(Tooltipped(cameraView,
     172                _("View the player camera")), wxSizerFlags().Expand());
    164173            wxButton* cameraClear = new wxButton(this, ID_CameraClear, _("Clear"));
    165174            cameraClear->Enable(false);
    166             gridSizer->Add(Tooltipped(cameraClear, _("Clear player camera")), wxSizerFlags().Expand());
     175            gridSizer->Add(Tooltipped(cameraClear,
     176                _("Clear player camera")), wxSizerFlags().Expand());
    167177            cameraSizer->Add(gridSizer, wxSizerFlags().Expand());
    168178
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp

    r10064 r10131  
    5454};
    5555
     56// Helper function for adding tooltips
     57static wxWindow* Tooltipped(wxWindow* window, const wxString& tip)
     58{
     59    window->SetToolTip(tip);
     60    return window;
     61}
     62
    5663TerrainSidebar::TerrainSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) :
    5764    Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer)
     
    6269        wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Elevation tools"));
    6370        wxSizer* gridSizer = new wxGridSizer(3);
    64         gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Modify"), _T("AlterElevation")), wxSizerFlags().Expand());
    65         gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Smooth"), _T("SmoothElevation")), wxSizerFlags().Expand());
    66         gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Flatten"), _T("FlattenElevation")), wxSizerFlags().Expand());
     71        gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Modify"), _T("AlterElevation")),
     72            _("Brush with left mouse buttons to raise terrain,\nright mouse button to lower it")), wxSizerFlags().Expand());
     73        gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Smooth"), _T("SmoothElevation")),
     74            _("Brush with left mouse button to smooth terrain,\nright mouse button to roughen it")), wxSizerFlags().Expand());
     75        gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Flatten"), _T("FlattenElevation")),
     76            _("Brush with left mouse button to flatten terrain")), wxSizerFlags().Expand());
    6777        sizer->Add(gridSizer, wxSizerFlags().Expand());
    6878        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
     
    7484        wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Texture tools"));
    7585        wxSizer* gridSizer = new wxGridSizer(3);
    76         gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Paint"), _T("PaintTerrain")), wxSizerFlags().Expand());
    77         gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Replace"), _T("ReplaceTerrain")), wxSizerFlags().Expand());
    78         gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Fill"), _T("FillTerrain")), wxSizerFlags().Expand());
     86        gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Paint"), _T("PaintTerrain")),
     87            _("Brush with left mouse button to paint texture dominantly,\nright mouse button to paint submissively")), wxSizerFlags().Expand());
     88        gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Replace"), _T("ReplaceTerrain")),
     89            _("Replace all of a terrain texture with a new one")), wxSizerFlags().Expand());
     90        gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Fill"), _T("FillTerrain")),
     91            _T("Bucket fill a patch of terrain texture with a new one")), wxSizerFlags().Expand());
    7992        sizer->Add(gridSizer, wxSizerFlags().Expand());
    8093        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
     
    105118
    106119        visSizer->Add(new wxStaticText(this, wxID_ANY, _("Passability")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT));
    107         visSizer->Add(m_PassabilityChoice, wxSizerFlags().Expand());
     120        visSizer->Add(Tooltipped(m_PassabilityChoice,
     121            _("View passability classes")), wxSizerFlags().Expand());
    108122
    109123        visSizer->Add(new wxStaticText(this, wxID_ANY, _("Priorities")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT));
    110         visSizer->Add(new wxCheckBox(this, ID_ShowPriorities, _("")));
     124        visSizer->Add(Tooltipped(new wxCheckBox(this, ID_ShowPriorities, _("")),
     125            _("Show terrain texture priorities")));
    111126    }
    112127
     
    165180    // TODO: set default based on current map size
    166181
    167     wxSingleChoiceDialog dlg(this, _("Select new map size. WARNING: This probably only works reliably on blank maps, and cannot be undone."),
     182    wxSingleChoiceDialog dlg(this, _("Select new map size. WARNING: This probably only works reliably on blank maps."),
    168183            _("Resize map"), sizeNames);
    169184
     
    245260            // Add spaces into the displayed name so there are more wrapping opportunities
    246261            wxString labelText = name;
     262            if (labelText.Len())
     263                labelText[0] = wxToupper(labelText[0]);
    247264            labelText.Replace(_T("_"), _T(" "));
    248265            wxStaticText* label = new wxStaticText(m_ScrolledPanel, wxID_ANY, labelText, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
     
    358375        {
    359376            wxString visibleName = m_TerrainGroups[i];
     377            // Format name slightly
    360378            if (visibleName.Len())
    361379                visibleName[0] = wxToupper(visibleName[0]);
     380            visibleName.Replace(_T("_"), _T(" "));
    362381            AddPage(new TextureNotebookPage(m_ScenarioEditor, this, m_TerrainGroups[i]), visibleName);
     382        }
     383
     384        // On some platforms (wxOSX) there is no initial OnPageChanged event, so it loads with a blank page
     385        //  and setting selection to 0 won't trigger it either, so just force first page to display
     386        // (this is safe because the sidebar has already been displayed)
     387        if (GetPageCount() > 0)
     388        {
     389            static_cast<TextureNotebookPage*>(GetPage(0))->OnDisplay();
    363390        }
    364391    }
Note: See TracChangeset for help on using the changeset viewer.