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


Ignore:
Timestamp:
06/24/11 00:38:26 (14 years ago)
Author:
ben
Message:

Adds player settings shortcut to Atlas map panel. Fixes #874
Tweaks some control positions and layouts for consistency

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

Legend:

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

    r9609 r9649  
    6969    ToolManager& GetToolManager() { return m_ToolManager; }
    7070
     71    void SelectPage(const wxString& classname) { m_SectionLayout.SelectPage(classname); }
     72
    7173private:
    7274    ScriptInterface& m_ScriptInterface;
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp

    r9566 r9649  
    231231
    232232    m_MainSizer->Add(new LightControl(this, wxSize(150, 150), g_EnvironmentSettings));
    233     m_MainSizer->Add(m_SkyList = new VariableListBox(this, _("Sky set"), g_EnvironmentSettings.skyset));
    234     m_MainSizer->Add(new VariableColourBox(this, _("Sun colour"), g_EnvironmentSettings.suncolour));
    235     m_MainSizer->Add(new VariableColourBox(this, _("Terrain ambient colour"), g_EnvironmentSettings.terraincolour));
    236     m_MainSizer->Add(new VariableColourBox(this, _("Object ambient colour"), g_EnvironmentSettings.unitcolour));
     233    m_MainSizer->Add(m_SkyList = new VariableListBox(this, _("Sky set"), g_EnvironmentSettings.skyset), wxSizerFlags().Expand());
     234    m_MainSizer->Add(new VariableColourBox(this, _("Sun colour"), g_EnvironmentSettings.suncolour), wxSizerFlags().Expand());
     235    m_MainSizer->Add(new VariableColourBox(this, _("Terrain ambient colour"), g_EnvironmentSettings.terraincolour), wxSizerFlags().Expand());
     236    m_MainSizer->Add(new VariableColourBox(this, _("Object ambient colour"), g_EnvironmentSettings.unitcolour), wxSizerFlags().Expand());
    237237
    238238    m_Conn = g_EnvironmentSettings.RegisterObserver(0, &SendToGame);
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp

    r9636 r9649  
    4747    ID_SimSlow,
    4848    ID_SimPause,
    49     ID_SimReset
     49    ID_SimReset,
     50    ID_OpenPlayerPanel
    5051};
    5152
     
    123124    wxSizer* sizer = GetSizer();
    124125
     126    /////////////////////////////////////////////////////////////////////////
     127    // Map settings
    125128    wxBoxSizer* nameSizer = new wxBoxSizer(wxHORIZONTAL);
    126129    nameSizer->Add(new wxStaticText(this, wxID_ANY, _("Name")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
     
    173176    }
    174177
    175     m_MapSettingsKeywords.clear();
    176     for (AtIter keyword = m_MapSettings["Keywords"]["item"]; keyword.defined(); ++keyword)
    177         m_MapSettingsKeywords.insert(std::wstring(keyword));
    178 
     178    // map name
    179179    wxDynamicCast(FindWindow(ID_MapName), wxTextCtrl)->ChangeValue(wxString(m_MapSettings["Name"]));
    180180
     181    // map description
    181182    wxDynamicCast(FindWindow(ID_MapDescription), wxTextCtrl)->ChangeValue(wxString(m_MapSettings["Description"]));
    182183
     184    // reveal map
    183185    wxDynamicCast(FindWindow(ID_MapReveal), wxCheckBox)->SetValue(wxString(m_MapSettings["RevealMap"]) == L"true");
    184186
     187    // game type / victory conditions
    185188    if (m_MapSettings["GameType"].defined())
    186189        wxDynamicCast(FindWindow(ID_MapType), wxChoice)->SetStringSelection(wxString(m_MapSettings["GameType"]));
     
    188191        wxDynamicCast(FindWindow(ID_MapType), wxChoice)->SetSelection(0);
    189192
     193    // lock teams
    190194    wxDynamicCast(FindWindow(ID_MapTeams), wxCheckBox)->SetValue(wxString(m_MapSettings["LockTeams"]) == L"true");
    191195
    192     wxDynamicCast(FindWindow(ID_MapKW_Demo), wxCheckBox)->SetValue(m_MapSettingsKeywords.count(L"demo") != 0);
    193     wxDynamicCast(FindWindow(ID_MapKW_Hidden), wxCheckBox)->SetValue(m_MapSettingsKeywords.count(L"hidden") != 0);
     196    // keywords
     197    {
     198        m_MapSettingsKeywords.clear();
     199        for (AtIter keyword = m_MapSettings["Keywords"]["item"]; keyword.defined(); ++keyword)
     200            m_MapSettingsKeywords.insert(std::wstring(keyword));
     201
     202        wxDynamicCast(FindWindow(ID_MapKW_Demo), wxCheckBox)->SetValue(m_MapSettingsKeywords.count(L"demo") != 0);
     203        wxDynamicCast(FindWindow(ID_MapKW_Hidden), wxCheckBox)->SetValue(m_MapSettingsKeywords.count(L"hidden") != 0);
     204    }
    194205}
    195206
    196207AtObj MapSettingsControl::UpdateSettingsObject()
    197208{
     209    // map name
    198210    m_MapSettings.set("Name", wxDynamicCast(FindWindow(ID_MapName), wxTextCtrl)->GetValue());
    199211
     212    // map description
    200213    m_MapSettings.set("Description", wxDynamicCast(FindWindow(ID_MapDescription), wxTextCtrl)->GetValue());
    201214
     215    // reveal map
    202216    m_MapSettings.setBool("RevealMap", wxDynamicCast(FindWindow(ID_MapReveal), wxCheckBox)->GetValue());
    203217
     218    // game type / victory conditions
    204219    m_MapSettings.set("GameType", wxDynamicCast(FindWindow(ID_MapType), wxChoice)->GetStringSelection());
    205220
    206     if (wxDynamicCast(FindWindow(ID_MapKW_Demo), wxCheckBox)->GetValue())
    207         m_MapSettingsKeywords.insert(L"demo");
    208     else
    209         m_MapSettingsKeywords.erase(L"demo");
    210 
    211     if (wxDynamicCast(FindWindow(ID_MapKW_Hidden), wxCheckBox)->GetValue())
    212         m_MapSettingsKeywords.insert(L"hidden");
    213     else
    214         m_MapSettingsKeywords.erase(L"hidden");
    215 
     221    // keywords
     222    {
     223        if (wxDynamicCast(FindWindow(ID_MapKW_Demo), wxCheckBox)->GetValue())
     224            m_MapSettingsKeywords.insert(L"demo");
     225        else
     226            m_MapSettingsKeywords.erase(L"demo");
     227
     228        if (wxDynamicCast(FindWindow(ID_MapKW_Hidden), wxCheckBox)->GetValue())
     229            m_MapSettingsKeywords.insert(L"hidden");
     230        else
     231            m_MapSettingsKeywords.erase(L"hidden");
     232
     233        AtObj keywords;
     234        keywords.set("@array", L"");
     235        for (std::set<std::wstring>::iterator it = m_MapSettingsKeywords.begin(); it != m_MapSettingsKeywords.end(); ++it)
     236            keywords.add("item", it->c_str());
     237        m_MapSettings.set("Keywords", keywords);
     238    }
     239
     240    // teams locked
    216241    m_MapSettings.setBool("LockTeams", wxDynamicCast(FindWindow(ID_MapTeams), wxCheckBox)->GetValue());
    217 
    218     AtObj keywords;
    219     keywords.set("@array", L"");
    220     for (std::set<std::wstring>::iterator it = m_MapSettingsKeywords.begin(); it != m_MapSettingsKeywords.end(); ++it)
    221         keywords.add("item", it->c_str());
    222     m_MapSettings.set("Keywords", keywords);
    223242
    224243    return m_MapSettings;
     
    243262    m_MainSizer->Add(m_MapSettingsCtrl, wxSizerFlags().Expand());
    244263
    245     {
     264    m_MainSizer->Add(new wxButton(this, ID_OpenPlayerPanel, _T("Player settings")), wxSizerFlags().Expand().Border(wxTOP, 16));
     265
     266    {
     267        /////////////////////////////////////////////////////////////////////////
     268        // Random map settings
    246269        wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Random map"));
    247270
     
    273296
    274297    {
     298        /////////////////////////////////////////////////////////////////////////
     299        // Simulation buttons
    275300        wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Simulation test"));
    276301        sizer->Add(new wxButton(this, ID_SimPlay, _("Play")), wxSizerFlags().Proportion(1));
     
    465490
    466491    m_ScenarioEditor.NotifyOnMapReload();
     492}
     493
     494void MapSidebar::OnOpenPlayerPanel(wxCommandEvent& WXUNUSED(evt))
     495{
     496    m_ScenarioEditor.SelectPage(_T("PlayerSidebar"));
    467497}
    468498
     
    476506    EVT_BUTTON(ID_RandomReseed, MapSidebar::OnRandomReseed)
    477507    EVT_BUTTON(ID_RandomGenerate, MapSidebar::OnRandomGenerate)
     508    EVT_BUTTON(ID_OpenPlayerPanel, MapSidebar::OnOpenPlayerPanel)
    478509END_EVENT_TABLE();
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.h

    r9608 r9649  
    4141    void OnRandomReseed(wxCommandEvent& evt);
    4242    void OnRandomGenerate(wxCommandEvent& evt);
     43    void OnOpenPlayerPanel(wxCommandEvent& evt);
    4344    void UpdateSimButtons();
    4445
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp

    r9643 r9649  
    9292
    9393        playerInfoSizer->Add(gridSizer, wxSizerFlags(1).Expand());
    94         sizer->Add(playerInfoSizer, wxSizerFlags().Expand());
     94        sizer->Add(playerInfoSizer, wxSizerFlags().Expand().Border(wxTOP, 10));
    9595
    9696        /////////////////////////////////////////////////////////////////////////
     
    121121
    122122        resourceSizer->Add(gridSizer, wxSizerFlags(1).Expand());
    123         sizer->Add(resourceSizer, wxSizerFlags().Expand());
     123        sizer->Add(resourceSizer, wxSizerFlags().Expand().Border(wxTOP, 10));
    124124
    125125        /////////////////////////////////////////////////////////////////////////
     
    144144        diplomacySizer->Add(advPane, 0, wxGROW | wxALL, 2);*/
    145145
    146         sizer->Add(diplomacySizer, wxSizerFlags().Expand());
     146        sizer->Add(diplomacySizer, wxSizerFlags().Expand().Border(wxTOP, 10));
    147147
    148148        /////////////////////////////////////////////////////////////////////////
     
    158158        cameraSizer->Add(Tooltipped(cameraClear, _("Clear player camera")), wxSizerFlags(1));
    159159
    160         sizer->Add(cameraSizer, wxSizerFlags().Expand());
     160        sizer->Add(cameraSizer, wxSizerFlags().Expand().Border(wxTOP, 10));
    161161
    162162        Layout();
     
    617617        // team
    618618        if (player["Team"].defined())
    619             controls.team->SetSelection((*player["Team"]).getInt());
     619            controls.team->SetSelection((*player["Team"]).getInt() + 1);
    620620        else
    621621            controls.team->SetSelection(0);
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp

    r9608 r9649  
    5858{
    5959    {
     60        /////////////////////////////////////////////////////////////////////////
     61        // Terrain elevation
    6062        wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Elevation tools"));
    6163        wxSizer* gridSizer = new wxGridSizer(3);
     
    6466        gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Flatten"), _T("FlattenElevation")), wxSizerFlags().Expand());
    6567        sizer->Add(gridSizer, wxSizerFlags().Expand());
    66         m_MainSizer->Add(sizer, wxSizerFlags().Expand());
    67     }
    68 
    69     {
     68        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
     69    }
     70
     71    {
     72        /////////////////////////////////////////////////////////////////////////
     73        // Terrain texture
    7074        wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Texture tools"));
    7175        wxSizer* gridSizer = new wxGridSizer(3);
     
    7377        gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Replace"), _T("ReplaceTerrain")), wxSizerFlags().Expand());
    7478        sizer->Add(gridSizer, wxSizerFlags().Expand());
    75         m_MainSizer->Add(sizer, wxSizerFlags().Expand());
    76     }
    77 
    78     {
     79        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
     80    }
     81
     82    {
     83        /////////////////////////////////////////////////////////////////////////
     84        // Brush settings
    7985        wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Brush"));
    8086        g_Brush_Elevation.CreateUI(this, sizer);
    81         m_MainSizer->Add(sizer);
    82     }
    83 
    84     {
     87        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
     88    }
     89
     90    {
     91        /////////////////////////////////////////////////////////////////////////
     92        // Visualise
    8593        wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Visualise"));
    86         m_MainSizer->Add(sizer);
    87 
    88         wxSizer* visSizer = new wxFlexGridSizer(2);
     94        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
     95
     96        wxSizer* visSizer = new wxFlexGridSizer(2, 2, 5, 5);
    8997        sizer->Add(visSizer);
    9098
     
    94102        m_PassabilityChoice->SetSelection(0);
    95103
    96         visSizer->Add(new wxStaticText(this, wxID_ANY, _("Passability")), wxSizerFlags().Right());
     104        visSizer->Add(new wxStaticText(this, wxID_ANY, _("Passability")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT));
    97105        visSizer->Add(m_PassabilityChoice);
    98106
    99         visSizer->Add(new wxStaticText(this, wxID_ANY, _("Priorities")), wxSizerFlags().Right());
     107        visSizer->Add(new wxStaticText(this, wxID_ANY, _("Priorities")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT));
    100108        visSizer->Add(new wxCheckBox(this, ID_ShowPriorities, _("")));
    101109    }
    102110
    103111    {
     112        /////////////////////////////////////////////////////////////////////////
     113        // Misc tools
    104114        wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Misc tools"));
    105115        sizer->Add(new wxButton(this, ID_ResizeMap, _("Resize map")), wxSizerFlags().Expand());
    106         m_MainSizer->Add(sizer, wxSizerFlags().Expand());
     116        m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10));
    107117    }
    108118
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/Brushes.cpp

    r9566 r9649  
    212212    shapes.Add(_("Square"));
    213213    // TODO (maybe): get rid of the extra static box, by not using wxRadioBox
    214     sizer->Add(new BrushShapeCtrl(parent, shapes, *this));
     214    sizer->Add(new BrushShapeCtrl(parent, shapes, *this), wxSizerFlags().Expand());
     215
     216    sizer->AddSpacer(5);
    215217
    216218    // TODO: These are yucky
    217     wxSizer* spinnerSizer = new wxFlexGridSizer(2);
    218     spinnerSizer->Add(new wxStaticText(parent, wxID_ANY, _("Size")), wxSizerFlags().Right());
     219    wxSizer* spinnerSizer = new wxFlexGridSizer(2, 2, 5, 5);
     220    spinnerSizer->Add(new wxStaticText(parent, wxID_ANY, _("Size")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT));
    219221    spinnerSizer->Add(new BrushSizeCtrl(parent, *this));
    220     spinnerSizer->Add(new wxStaticText(parent, wxID_ANY, _("Strength")), wxSizerFlags().Right());
     222    spinnerSizer->Add(new wxStaticText(parent, wxID_ANY, _("Strength")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT));
    221223    spinnerSizer->Add(new BrushStrengthCtrl(parent, *this));
    222     sizer->Add(spinnerSizer);
     224    sizer->Add(spinnerSizer, wxSizerFlags().Expand());
    223225}
    224226
Note: See TracChangeset for help on using the changeset viewer.