Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic ActorEditor UI for new <textures> tag.
- Loading branch information
zoot
committed
Jun 28, 2012
1 parent
ce9c2ae
commit 04ccb2f
Showing
4 changed files
with
147 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* Copyright (C) 2009 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/>. | ||
*/ | ||
|
||
#include "precompiled.h" | ||
|
||
#include "TexListEditor.h" | ||
|
||
#include "EditableListCtrl/FieldEditCtrl.h" | ||
#include "AtlasObject/AtlasObject.h" | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
TexListEditor::TexListEditor(wxWindow* parent) | ||
: AtlasDialog(parent, _("Texture editor"), wxSize(480, 280)) | ||
{ | ||
m_MainListBox = new TexListEditorListCtrl(m_MainPanel); | ||
|
||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); | ||
sizer->Add(m_MainListBox, | ||
wxSizerFlags().Proportion(1).Expand().Border(wxALL, 5)); | ||
|
||
m_MainPanel->SetSizer(sizer); | ||
} | ||
|
||
void TexListEditor::ThawData(AtObj& in) | ||
{ | ||
m_MainListBox->ThawData(in); | ||
} | ||
|
||
AtObj TexListEditor::FreezeData() | ||
{ | ||
return m_MainListBox->FreezeData(); | ||
} | ||
|
||
void TexListEditor::ImportData(AtObj& in) | ||
{ | ||
m_MainListBox->ImportData(in); | ||
} | ||
|
||
AtObj TexListEditor::ExportData() | ||
{ | ||
return m_MainListBox->ExportData(); | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
TexListEditorListCtrl::TexListEditorListCtrl(wxWindow* parent) | ||
: DraggableListCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, | ||
wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_SINGLE_SEL) | ||
{ | ||
AddColumnType(_("Tex name"), 100, "@name", new FieldEditCtrl_List("textures")); | ||
AddColumnType(_("File"), 200, "@file", new FieldEditCtrl_File(_T("art/textures/skins/"), _("All files (*.*)|*.*"))); // could be dds, or tga, or png, or bmp, etc, so just allow * | ||
} | ||
|
||
void TexListEditorListCtrl::DoImport(AtObj& in) | ||
{ | ||
for (AtIter prop = in["texture"]; prop.defined(); ++prop) | ||
AddRow(prop); | ||
|
||
UpdateDisplay(); | ||
} | ||
|
||
AtObj TexListEditorListCtrl::DoExport() | ||
{ | ||
AtObj out; | ||
for (size_t i = 0; i < m_ListData.size(); ++i) | ||
out.add("texture", m_ListData[i]); | ||
return out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* Copyright (C) 2009 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/>. | ||
*/ | ||
|
||
#include "Windows/AtlasDialog.h" | ||
|
||
#include "DraggableListCtrl/DraggableListCtrl.h" | ||
|
||
class TexListEditorListCtrl; | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
class TexListEditor : public AtlasDialog | ||
{ | ||
public: | ||
TexListEditor(wxWindow* parent); | ||
static AtlasDialog* Create(wxWindow* parent) { return new TexListEditor(parent); } | ||
|
||
protected: | ||
AtObj FreezeData(); | ||
void ThawData(AtObj& in); | ||
|
||
AtObj ExportData(); | ||
void ImportData(AtObj& in); | ||
|
||
private: | ||
TexListEditorListCtrl* m_MainListBox; | ||
}; | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
class TexListEditorListCtrl : public DraggableListCtrl | ||
{ | ||
friend class TexListEditor; | ||
|
||
public: | ||
TexListEditorListCtrl(wxWindow* parent); | ||
|
||
void OnUpdate(wxCommandEvent& event); | ||
|
||
void DoImport(AtObj& in); | ||
AtObj DoExport(); | ||
}; |