Skip to content

Commit

Permalink
Only show PointFileChooser when making trace visible
Browse files Browse the repository at this point in the history
Visibility of current trace is exposed through a new method
isPointTraceVisible() on the IMap interface. This method is now used by
PointFileChooser to avoid showing the dialog when hiding the point trace.
  • Loading branch information
Matthew Mott committed May 26, 2021
1 parent 771a105 commit bd647ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/imap.h
Expand Up @@ -172,11 +172,16 @@ class IMap :
// Exports the current selection to the given output stream, using the given map format
virtual void exportSelected(std::ostream& out, const map::MapFormatPtr& format) = 0;

/* POINTFILE MANAGEMENT */

/// Functor to receive pointfile paths
using PointfileFunctor = std::function<void(const fs::path&)>;

/// Enumerate pointfiles associated with the current map
virtual void forEachPointfile(PointfileFunctor func) const = 0;

/// Return true if a point trace is currently visible
virtual bool isPointTraceVisible() const = 0;
};
typedef std::shared_ptr<IMap> IMapPtr;

Expand Down
2 changes: 1 addition & 1 deletion radiant/ui/PointFileChooser.cpp
Expand Up @@ -43,7 +43,7 @@ void PointFileChooser::chooseAndToggle()
throw cmd::ExecutionFailure("No pointfiles found for current map.");

// If there is a choice to make, show the dialog
if (pointfiles.size() > 1)
if (!GlobalMapModule().isPointTraceVisible() && pointfiles.size() > 1)
{
// Construct list of wxString filenames
wxArrayString filenames;
Expand Down
5 changes: 5 additions & 0 deletions radiantcore/map/Map.cpp
Expand Up @@ -241,6 +241,11 @@ void Map::forEachPointfile(PointfileFunctor func) const
func(p);
}

bool Map::isPointTraceVisible() const
{
return _pointTrace->isVisible();
}

void Map::onSceneNodeErase(const scene::INodePtr& node)
{
// Detect when worldspawn is removed from the map
Expand Down
1 change: 1 addition & 0 deletions radiantcore/map/Map.h
Expand Up @@ -91,6 +91,7 @@ class Map :
std::string getMapName() const override;
sigc::signal<void>& signal_mapNameChanged() override;
void forEachPointfile(PointfileFunctor func) const override;
bool isPointTraceVisible() const override;

/**
* greebo: Saves the current map, doesn't ask for any filenames,
Expand Down

0 comments on commit bd647ef

Please sign in to comment.