Skip to content

Commit

Permalink
#5623: Start working on a merge control dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed May 29, 2021
1 parent 756bdda commit c0ab4db
Show file tree
Hide file tree
Showing 9 changed files with 1,178 additions and 0 deletions.
Binary file added install/bitmaps/merge_path.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
917 changes: 917 additions & 0 deletions install/ui/mergecontroldialog.fbp

Large diffs are not rendered by default.

152 changes: 152 additions & 0 deletions install/ui/mergecontroldialog.xrc
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<resource xmlns="http://www.wxwindows.org/wxxrc" version="2.3.0.1">
<object class="wxPanel" name="MergeControlDialogMainPanel">
<style>wxTAB_TRAVERSAL</style>
<size>391,366</size>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<border>12</border>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<border>0</border>
<object class="wxPanel" name="MapFileSelectors">
<style>wxTAB_TRAVERSAL</style>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND</flag>
<border>5</border>
<object class="wxFlexGridSizer">
<rows>2</rows>
<cols>2</cols>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>0,1</growablecols>
<growablerows></growablerows>
<object class="sizeritem">
<option>0</option>
<flag>wxBOTTOM|wxRIGHT</flag>
<border>6</border>
<object class="wxStaticText" name="TargetMapLabel">
<label>Merge Target</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxBOTTOM</flag>
<border>6</border>
<object class="wxStaticText" name="MergeMapSelector">
<tooltip>The map file to merge into the base map</tooltip>
<label>Map to be merged</label>
<wrap>-1</wrap>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND|wxRIGHT</flag>
<border>6</border>
<object class="wxTextCtrl" name="BaseMapFilename">
<value></value>
</object>
</object>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND</flag>
<border>0</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND</flag>
<border>0</border>
<object class="wxTextCtrl" name="MergeMapFilename">
<value></value>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<border>0</border>
<object class="wxButton" name="MergeMapBrowseButton">
<size>20,-1</size>
<label>...</label>
<default>0</default>
<markup>0</markup>
<bitmap />
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER</flag>
<border>0</border>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER|wxALL</flag>
<border>0</border>
<object class="wxStaticBitmap" name="m_bitmap1">
<bitmap stock_id="darkradiant:merge_path.png" stock_client="">undefined.png</bitmap>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxBOTTOM|wxEXPAND</flag>
<border>6</border>
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<option>1</option>
<flag>wxEXPAND</flag>
<border>0</border>
<object class="wxTextCtrl" name="BaseMapFilename">
<tooltip>A common base map both maps have started from</tooltip>
<value></value>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxEXPAND</flag>
<border>0</border>
<object class="wxButton" name="BaseMapBrowseButton">
<size>20,-1</size>
<label>...</label>
<default>0</default>
<markup>0</markup>
<bitmap />
</object>
</object>
</object>
</object>
<object class="sizeritem">
<option>0</option>
<flag>wxALIGN_CENTER</flag>
<border>6</border>
<object class="wxStaticText" name="BaseMapLabel">
<tooltip>A common base map both maps have started from</tooltip>
<label>Base Map (optional)</label>
<wrap>-1</wrap>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</resource>
1 change: 1 addition & 0 deletions radiant/CMakeLists.txt
Expand Up @@ -108,6 +108,7 @@ add_executable(darkradiant
ui/materials/editor/MaterialPreview.cpp
ui/materials/MaterialPopulator.cpp
ui/materials/MaterialTreeView.cpp
ui/merge/MergeControlDialog.cpp
ui/animationpreview/AnimationPreview.cpp
ui/animationpreview/MD5AnimationChooser.cpp
ui/animationpreview/MD5AnimationViewer.cpp
Expand Down
2 changes: 2 additions & 0 deletions radiant/ui/UserInterfaceModule.cpp
Expand Up @@ -61,6 +61,7 @@
#include "ui/brush/FindBrush.h"
#include "ui/mousetool/RegistrationHelper.h"
#include "ui/mapselector/MapSelector.h"
#include "ui/merge/MergeControlDialog.h"

#include <wx/version.h>

Expand Down Expand Up @@ -363,6 +364,7 @@ void UserInterfaceModule::registerUICommands()
GlobalCommandSystem().addCommand("ToggleLightInspector", LightInspector::toggleInspector);
GlobalCommandSystem().addCommand("SurfaceInspector", SurfaceInspector::toggle);
GlobalCommandSystem().addCommand("PatchInspector", PatchInspector::toggle);
GlobalCommandSystem().addCommand("MergeControlDialog", MergeControlDialog::Toggle);
GlobalCommandSystem().addCommand("OverlayDialog", OverlayDialog::toggle);
GlobalCommandSystem().addCommand("TransformDialog", TransformDialog::toggle);

Expand Down
67 changes: 67 additions & 0 deletions radiant/ui/merge/MergeControlDialog.cpp
@@ -0,0 +1,67 @@
#include "MergeControlDialog.h"

#include "i18n.h"
#include "itextstream.h"
#include "imainframe.h"

namespace ui
{

namespace
{
const char* const WINDOW_TITLE = N_("Merge Maps");
}

MergeControlDialog::MergeControlDialog() :
TransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getWxTopLevelWindow(), true)
{
SetSizer(new wxBoxSizer(wxVERTICAL));
GetSizer()->Add(loadNamedPanel(this, "MergeControlDialogMainPanel"), 1, wxEXPAND);

SetMinSize(wxSize(300, 300));
}

std::shared_ptr<MergeControlDialog>& MergeControlDialog::InstancePtr()
{
static std::shared_ptr<MergeControlDialog> _instancePtr;
return _instancePtr;
}

MergeControlDialog& MergeControlDialog::Instance()
{
auto& instancePtr = InstancePtr();

if (!instancePtr)
{
// Not yet instantiated, do it now
instancePtr.reset(new MergeControlDialog);

// Pre-destruction cleanup
GlobalMainFrame().signal_MainFrameShuttingDown().connect(
sigc::mem_fun(*instancePtr, &MergeControlDialog::onMainFrameShuttingDown)
);
}

return *instancePtr;
}

void MergeControlDialog::onMainFrameShuttingDown()
{
rMessage() << "MergeControlDialog shutting down." << std::endl;

if (IsShownOnScreen())
{
Hide();
}

// Destroy the window
SendDestroyEvent();
InstancePtr().reset();
}

void MergeControlDialog::Toggle(const cmd::ArgumentList& args)
{
Instance().ToggleVisibility();
}

}
28 changes: 28 additions & 0 deletions radiant/ui/merge/MergeControlDialog.h
@@ -0,0 +1,28 @@
#pragma once

#include "wxutil/window/TransientWindow.h"
#include "wxutil/XmlResourceBasedWidget.h"

namespace ui
{


class MergeControlDialog :
public wxutil::TransientWindow,
private wxutil::XmlResourceBasedWidget,
public sigc::trackable
{
public:
MergeControlDialog();

static MergeControlDialog& Instance();

// The command target
static void Toggle(const cmd::ArgumentList& args);

private:
void onMainFrameShuttingDown();
static std::shared_ptr<MergeControlDialog>& InstancePtr();
};

}
2 changes: 2 additions & 0 deletions tools/msvc/DarkRadiant.vcxproj
Expand Up @@ -277,6 +277,7 @@
<ClCompile Include="..\..\radiant\ui\menu\MenuItem.cpp" />
<ClCompile Include="..\..\radiant\ui\menu\MenuManager.cpp" />
<ClCompile Include="..\..\radiant\ui\menu\MenuSeparator.cpp" />
<ClCompile Include="..\..\radiant\ui\merge\MergeControlDialog.cpp" />
<ClCompile Include="..\..\radiant\ui\modelexport\ExportAsModelDialog.cpp" />
<ClCompile Include="..\..\radiant\ui\modelexport\ExportCollisionModelDialog.cpp" />
<ClCompile Include="..\..\radiant\ui\modelselector\MaterialsList.cpp" />
Expand Down Expand Up @@ -481,6 +482,7 @@
<ClInclude Include="..\..\radiant\ui\menu\MenuManager.h" />
<ClInclude Include="..\..\radiant\ui\menu\MenuRootElement.h" />
<ClInclude Include="..\..\radiant\ui\menu\MenuSeparator.h" />
<ClInclude Include="..\..\radiant\ui\merge\MergeControlDialog.h" />
<ClInclude Include="..\..\radiant\ui\modelexport\ExportAsModelDialog.h" />
<ClInclude Include="..\..\radiant\ui\modelexport\ExportCollisionModelDialog.h" />
<ClInclude Include="..\..\radiant\ui\modelselector\MaterialsList.h" />
Expand Down
9 changes: 9 additions & 0 deletions tools/msvc/DarkRadiant.vcxproj.filters
Expand Up @@ -185,6 +185,9 @@
<Filter Include="src\ui\materials\editor">
<UniqueIdentifier>{d374722a-7ea0-4a6e-9954-69e32a7cbec8}</UniqueIdentifier>
</Filter>
<Filter Include="src\ui\merge">
<UniqueIdentifier>{dcd24411-0e8c-45d3-8f5d-8b4f7faab72b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\radiant\main.cpp">
Expand Down Expand Up @@ -715,6 +718,9 @@
<ClCompile Include="..\..\radiant\ui\materials\editor\MaterialPreview.cpp">
<Filter>src\ui\materials\editor</Filter>
</ClCompile>
<ClCompile Include="..\..\radiant\ui\merge\MergeControlDialog.cpp">
<Filter>src\ui\merge</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\radiant\camera\CameraSettings.h">
Expand Down Expand Up @@ -1386,6 +1392,9 @@
<ClInclude Include="..\..\radiant\ui\materials\editor\TexturePreview.h">
<Filter>src\ui\materials\editor</Filter>
</ClInclude>
<ClInclude Include="..\..\radiant\ui\merge\MergeControlDialog.h">
<Filter>src\ui\merge</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\radiant\darkradiant.rc" />
Expand Down

0 comments on commit c0ab4db

Please sign in to comment.