diff --git a/install/user.xml b/install/user.xml index 2f9150653b..743744f6c0 100644 --- a/install/user.xml +++ b/install/user.xml @@ -90,9 +90,9 @@ - + - + diff --git a/radiant/CMakeLists.txt b/radiant/CMakeLists.txt index 23c62f1e99..e11395cc66 100644 --- a/radiant/CMakeLists.txt +++ b/radiant/CMakeLists.txt @@ -36,7 +36,6 @@ add_executable(darkradiant ui/common/ImageFilePopulator.cpp ui/common/ImageFileSelector.cpp ui/common/MapPreview.cpp - ui/common/ShaderChooser.cpp ui/common/TexturePreviewCombo.cpp ui/common/SkinChooser.cpp ui/common/SoundChooser.cpp @@ -94,6 +93,7 @@ add_executable(darkradiant ui/materials/editor/MaterialEditor.cpp ui/materials/editor/MaterialEditorModule.cpp ui/materials/editor/MaterialPreview.cpp + ui/materials/MaterialChooser.cpp ui/materials/MaterialPopulator.cpp ui/materials/MaterialSelector.cpp ui/materials/MaterialTreeView.cpp diff --git a/radiant/ui/einspector/TexturePropertyEditor.cpp b/radiant/ui/einspector/TexturePropertyEditor.cpp index 002491dcf2..248483d01b 100644 --- a/radiant/ui/einspector/TexturePropertyEditor.cpp +++ b/radiant/ui/einspector/TexturePropertyEditor.cpp @@ -1,5 +1,5 @@ #include "TexturePropertyEditor.h" -#include "ui/common/ShaderChooser.h" +#include "ui/materials/MaterialChooser.h" #include "PropertyEditorFactory.h" #include "i18n.h" @@ -24,7 +24,7 @@ TexturePropertyEditor::TexturePropertyEditor(wxWindow* parent, IEntitySelection& // Browse button callback void TexturePropertyEditor::onBrowseButtonClick() { - auto dialog = new ShaderChooser(getWidget(), MaterialSelector::TextureFilter::Lights); + auto dialog = new MaterialChooser(getWidget(), MaterialSelector::TextureFilter::Lights); dialog->setSelectedTexture(getKeyValue(_key->getFullKey())); diff --git a/radiant/ui/findshader/FindShader.cpp b/radiant/ui/findshader/FindShader.cpp index 16bbed7594..09f9d44787 100644 --- a/radiant/ui/findshader/FindShader.cpp +++ b/radiant/ui/findshader/FindShader.cpp @@ -5,7 +5,7 @@ #include "imousetoolmanager.h" #include "ishaderclipboard.h" -#include "ui/common/ShaderChooser.h" +#include "ui/materials/MaterialChooser.h" #include "wxutil/dialog/MessageBox.h" #include "wxutil/MouseButton.h" #include "wxutil/Modifier.h" @@ -106,7 +106,7 @@ void FindAndReplaceShader::performReplace() void FindAndReplaceShader::onChooseFind(wxCommandEvent& ev) { // Construct the modal dialog - ShaderChooser* chooser = new ShaderChooser(this, MaterialSelector::TextureFilter::Regular, + auto chooser = new MaterialChooser(this, MaterialSelector::TextureFilter::Regular, findNamedObject(this, "FindReplaceDialogFindEntry")); chooser->ShowModal(); @@ -116,7 +116,7 @@ void FindAndReplaceShader::onChooseFind(wxCommandEvent& ev) void FindAndReplaceShader::onChooseReplace(wxCommandEvent& ev) { // Construct the modal dialog - ShaderChooser* chooser = new ShaderChooser(this, MaterialSelector::TextureFilter::Regular, + auto chooser = new MaterialChooser(this, MaterialSelector::TextureFilter::Regular, findNamedObject(this, "FindReplaceDialogReplaceEntry")); chooser->ShowModal(); diff --git a/radiant/ui/lightinspector/LightInspector.cpp b/radiant/ui/lightinspector/LightInspector.cpp index d10ee35855..5779a2fcb8 100644 --- a/radiant/ui/lightinspector/LightInspector.cpp +++ b/radiant/ui/lightinspector/LightInspector.cpp @@ -20,7 +20,7 @@ #include -#include "ui/common/ShaderChooser.h" // for static displayLightInfo() function +#include "ui/materials/MaterialChooser.h" // for static displayLightInfo() function #include "util/ScopedBoolLock.h" #include "gamelib.h" diff --git a/radiant/ui/common/ShaderChooser.cpp b/radiant/ui/materials/MaterialChooser.cpp similarity index 69% rename from radiant/ui/common/ShaderChooser.cpp rename to radiant/ui/materials/MaterialChooser.cpp index ef791f3729..b0b37f0825 100644 --- a/radiant/ui/common/ShaderChooser.cpp +++ b/radiant/ui/materials/MaterialChooser.cpp @@ -1,4 +1,4 @@ -#include "ShaderChooser.h" +#include "MaterialChooser.h" #include "i18n.h" #include "ishaders.h" @@ -13,12 +13,12 @@ namespace ui { namespace { - const char* const LABEL_TITLE = N_("Choose Shader"); - const std::string RKEY_WINDOW_STATE = "user/ui/textures/shaderChooser/window"; + const char* const LABEL_TITLE = N_("Choose Material"); + const std::string RKEY_WINDOW_STATE = "user/ui/textures/materialChooser/window"; } // Construct the dialog -ShaderChooser::ShaderChooser(wxWindow* parent, MaterialSelector::TextureFilter filter, wxTextCtrl* targetEntry) : +MaterialChooser::MaterialChooser(wxWindow* parent, MaterialSelector::TextureFilter filter, wxTextCtrl* targetEntry) : wxutil::DialogBase(_(LABEL_TITLE), parent), _targetEntry(targetEntry), _selector(nullptr) @@ -31,7 +31,7 @@ ShaderChooser::ShaderChooser(wxWindow* parent, MaterialSelector::TextureFilter f mainPanel->GetSizer()->Add(dialogVBox, 1, wxEXPAND | wxALL, 12); _selector = new MaterialSelector(mainPanel, - std::bind(&ShaderChooser::shaderSelectionChanged, this), filter); + std::bind(&MaterialChooser::shaderSelectionChanged, this), filter); if (_targetEntry != nullptr) { @@ -41,7 +41,7 @@ ShaderChooser::ShaderChooser(wxWindow* parent, MaterialSelector::TextureFilter f _selector->SetSelectedDeclName(_initialShader); } - _selector->Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, &ShaderChooser::_onItemActivated, this); + _selector->Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, &MaterialChooser::_onItemActivated, this); // Pack in the MaterialSelector and buttons panel dialogVBox->Add(_selector, 1, wxEXPAND); @@ -55,23 +55,23 @@ ShaderChooser::ShaderChooser(wxWindow* parent, MaterialSelector::TextureFilter f _windowPosition.applyPosition(); } -std::string ShaderChooser::getSelectedTexture() +std::string MaterialChooser::getSelectedTexture() { return _selector->GetSelectedDeclName(); } -void ShaderChooser::setSelectedTexture(const std::string& textureName) +void MaterialChooser::setSelectedTexture(const std::string& textureName) { _selector->SetSelectedDeclName(textureName); } -void ShaderChooser::shutdown() +void MaterialChooser::shutdown() { // Tell the position tracker to save the information _windowPosition.saveToPath(RKEY_WINDOW_STATE); } -void ShaderChooser::_onItemActivated(wxDataViewEvent& ev) +void MaterialChooser::_onItemActivated(wxDataViewEvent& ev) { if (!_selector->GetSelectedDeclName().empty()) { @@ -86,15 +86,15 @@ void ShaderChooser::_onItemActivated(wxDataViewEvent& ev) } // Construct the buttons -void ShaderChooser::createButtons(wxPanel* mainPanel, wxBoxSizer* dialogVBox) +void MaterialChooser::createButtons(wxPanel* mainPanel, wxBoxSizer* dialogVBox) { wxBoxSizer* buttons = new wxBoxSizer(wxHORIZONTAL); wxButton* okButton = new wxButton(mainPanel, wxID_OK); wxButton* cancelButton = new wxButton(mainPanel, wxID_CANCEL); - okButton->Connect(wxEVT_BUTTON, wxCommandEventHandler(ShaderChooser::callbackOK), NULL, this); - cancelButton->Connect(wxEVT_BUTTON, wxCommandEventHandler(ShaderChooser::callbackCancel), NULL, this); + okButton->Connect(wxEVT_BUTTON, wxCommandEventHandler(MaterialChooser::callbackOK), NULL, this); + cancelButton->Connect(wxEVT_BUTTON, wxCommandEventHandler(MaterialChooser::callbackCancel), NULL, this); buttons->Add(okButton); buttons->Add(cancelButton, 0, wxLEFT, 6); @@ -102,7 +102,7 @@ void ShaderChooser::createButtons(wxPanel* mainPanel, wxBoxSizer* dialogVBox) dialogVBox->Add(buttons, 0, wxALIGN_RIGHT | wxTOP, 6); } -void ShaderChooser::shaderSelectionChanged() +void MaterialChooser::shaderSelectionChanged() { if (_targetEntry) { @@ -113,7 +113,7 @@ void ShaderChooser::shaderSelectionChanged() _shaderChangedSignal.emit(); } -void ShaderChooser::revertShader() +void MaterialChooser::revertShader() { // Revert the shadername to the value it had at dialog startup if (_targetEntry) @@ -125,7 +125,7 @@ void ShaderChooser::revertShader() } } -void ShaderChooser::callbackCancel(wxCommandEvent& ev) +void MaterialChooser::callbackCancel(wxCommandEvent& ev) { // Revert the shadername to the value it had at dialog startup revertShader(); @@ -134,7 +134,7 @@ void ShaderChooser::callbackCancel(wxCommandEvent& ev) ev.Skip(); } -void ShaderChooser::callbackOK(wxCommandEvent& ev) +void MaterialChooser::callbackOK(wxCommandEvent& ev) { if (_targetEntry) { diff --git a/radiant/ui/common/ShaderChooser.h b/radiant/ui/materials/MaterialChooser.h similarity index 93% rename from radiant/ui/common/ShaderChooser.h rename to radiant/ui/materials/MaterialChooser.h index 9941716340..261f553119 100644 --- a/radiant/ui/common/ShaderChooser.h +++ b/radiant/ui/materials/MaterialChooser.h @@ -16,7 +16,7 @@ namespace ui * buttons. The MaterialSelector subclass is automatically populated with * all shaders matching the "texture/" prefix. */ -class ShaderChooser : +class MaterialChooser : public wxutil::DialogBase { // The text entry the chosen texture is written into (can be NULL) @@ -43,7 +43,7 @@ class ShaderChooser : * Also, the initially selected shader will be read from * this field at startup. */ - ShaderChooser(wxWindow* parent, MaterialSelector::TextureFilter filter, wxTextCtrl* targetEntry = nullptr); + MaterialChooser(wxWindow* parent, MaterialSelector::TextureFilter filter, wxTextCtrl* targetEntry = nullptr); std::string getSelectedTexture(); diff --git a/radiant/ui/materials/editor/MaterialEditor.cpp b/radiant/ui/materials/editor/MaterialEditor.cpp index f438c5f251..2e780538b8 100644 --- a/radiant/ui/materials/editor/MaterialEditor.cpp +++ b/radiant/ui/materials/editor/MaterialEditor.cpp @@ -40,7 +40,7 @@ #include "CheckBoxBinding.h" #include "MapExpressionEntry.h" #include "TexturePreview.h" -#include "ui/common/ShaderChooser.h" +#include "../MaterialChooser.h" namespace ui { @@ -411,7 +411,7 @@ void MaterialEditor::setupPreviewLightProperties(wxWindow* previewPanel) getControl("MaterialPreviewRoomMaterialButton")->Bind(wxEVT_BUTTON, [this](wxCommandEvent& ev) { auto textCtrl = getControl("MaterialPreviewRoomMaterial"); - auto selector = new ShaderChooser(this, MaterialSelector::TextureFilter::Regular, textCtrl); + auto selector = new MaterialChooser(this, MaterialSelector::TextureFilter::Regular, textCtrl); selector->ShowModal(); selector->Destroy(); }); diff --git a/radiant/ui/surfaceinspector/SurfaceInspector.cpp b/radiant/ui/surfaceinspector/SurfaceInspector.cpp index af57286a2b..220ffba90b 100644 --- a/radiant/ui/surfaceinspector/SurfaceInspector.cpp +++ b/radiant/ui/surfaceinspector/SurfaceInspector.cpp @@ -24,6 +24,7 @@ #include "textool/TexTool.h" #include "ui/patch/PatchInspector.h" +#include "ui/materials/MaterialChooser.h" namespace ui { @@ -376,7 +377,7 @@ void SurfaceInspector::populateWindow() _shaderEntry->Connect(wxEVT_TEXT_ENTER, wxCommandEventHandler(SurfaceInspector::onShaderEntryActivate), NULL, this); shaderHBox->Add(_shaderEntry, 1, wxEXPAND); - // Create the icon button to open the ShaderChooser + // Create the icon button to open the MaterialChooser _selectShaderButton = new wxBitmapButton( this, wxID_ANY, wxutil::GetLocalBitmap(FOLDER_ICON) ); @@ -788,7 +789,7 @@ void SurfaceInspector::onShaderSelect(wxCommandEvent& ev) std::string previousShader = _shaderEntry->GetValue().ToStdString(); // Instantiate the modal dialog, will block execution - auto* chooser = new ShaderChooser(this, MaterialSelector::TextureFilter::Regular, _shaderEntry); + auto* chooser = new MaterialChooser(this, MaterialSelector::TextureFilter::Regular, _shaderEntry); chooser->signal_shaderChanged().connect( sigc::mem_fun(this, &SurfaceInspector::emitShader) diff --git a/radiant/ui/surfaceinspector/SurfaceInspector.h b/radiant/ui/surfaceinspector/SurfaceInspector.h index 7a82e71f06..1f8047cf29 100644 --- a/radiant/ui/surfaceinspector/SurfaceInspector.h +++ b/radiant/ui/surfaceinspector/SurfaceInspector.h @@ -6,7 +6,6 @@ #include "iradiant.h" #include "wxutil/window/TransientWindow.h" #include "wxutil/FormLayout.h" -#include "ui/common/ShaderChooser.h" #include "messages/TextureChanged.h" #include diff --git a/tools/msvc/DarkRadiant.vcxproj b/tools/msvc/DarkRadiant.vcxproj index 4485e6aa77..4b6abe6f4c 100644 --- a/tools/msvc/DarkRadiant.vcxproj +++ b/tools/msvc/DarkRadiant.vcxproj @@ -267,6 +267,7 @@ + @@ -291,7 +292,6 @@ - @@ -473,6 +473,7 @@ + @@ -499,7 +500,6 @@ - diff --git a/tools/msvc/DarkRadiant.vcxproj.filters b/tools/msvc/DarkRadiant.vcxproj.filters index 7a1864e133..97e450684a 100644 --- a/tools/msvc/DarkRadiant.vcxproj.filters +++ b/tools/msvc/DarkRadiant.vcxproj.filters @@ -223,9 +223,6 @@ src\ui\common - - src\ui\common - src\ui\common @@ -709,6 +706,9 @@ src\ui\materials + + src\ui\materials + @@ -741,9 +741,6 @@ src\ui\common - - src\ui\common - src\ui\common @@ -1380,6 +1377,9 @@ src\ui\materials + + src\ui\materials +