Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5623: Start working on a merge control dialog
- Loading branch information
1 parent
756bdda
commit c0ab4db
Showing
9 changed files
with
1,178 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
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,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> |
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,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(); | ||
} | ||
|
||
} |
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,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(); | ||
}; | ||
|
||
} |
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