Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5200: Move UI-related toggle state code from RadiantSelectionSystem …
…to the UI module. Fix a bug in RadiantSelectionSystem::getManipulatorIdForType.
- Loading branch information
1 parent
60ebd0b
commit 8d17221
Showing
8 changed files
with
140 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#pragma once | ||
|
||
#include "iselection.h" | ||
#include <sigc++/connection.h> | ||
|
||
namespace ui | ||
{ | ||
|
||
// Adaptor class connecting the EventSystem toggles covering the | ||
// various SelectionSystem manipulator mode to the actual state | ||
// of the backend RadiantSelectionSystem. | ||
class ManipulatorToggle | ||
{ | ||
private: | ||
sigc::connection _activeManipulatorChanged; | ||
|
||
public: | ||
ManipulatorToggle() | ||
{ | ||
_activeManipulatorChanged = GlobalSelectionSystem().signal_activeManipulatorChanged() | ||
.connect(sigc::mem_fun(this, &ManipulatorToggle::onActiveManipulatorChanged)); | ||
|
||
GlobalEventManager().addToggle("ToggleClipper", [this](bool) | ||
{ | ||
GlobalCommandSystem().executeCommand("ToggleManipulatorMode", { "Clip" }); | ||
}); | ||
|
||
GlobalEventManager().addToggle("MouseTranslate", [this](bool) | ||
{ | ||
GlobalCommandSystem().executeCommand("ToggleManipulatorMode", { "Translate" }); | ||
}); | ||
|
||
GlobalEventManager().addToggle("MouseRotate", [this](bool) | ||
{ | ||
GlobalCommandSystem().executeCommand("ToggleManipulatorMode", { "Rotate" }); | ||
}); | ||
|
||
GlobalEventManager().addToggle("MouseDrag", [this](bool) | ||
{ | ||
GlobalCommandSystem().executeCommand("ToggleManipulatorMode", { "Drag" }); | ||
}); | ||
|
||
GlobalEventManager().addToggle("ToggleModelScaleManipulator", [this](bool) | ||
{ | ||
GlobalCommandSystem().executeCommand("ToggleManipulatorMode", { "ModelScale" }); | ||
}); | ||
|
||
onActiveManipulatorChanged(GlobalSelectionSystem().getActiveManipulatorType()); | ||
} | ||
|
||
~ManipulatorToggle() | ||
{ | ||
_activeManipulatorChanged.disconnect(); | ||
} | ||
|
||
private: | ||
void onActiveManipulatorChanged(selection::Manipulator::Type type) | ||
{ | ||
GlobalEventManager().setToggled("ToggleClipper", GlobalClipper().clipMode()); | ||
GlobalEventManager().setToggled("MouseTranslate", type == selection::Manipulator::Translate); | ||
GlobalEventManager().setToggled("MouseRotate", type == selection::Manipulator::Rotate); | ||
GlobalEventManager().setToggled("MouseDrag", type == selection::Manipulator::Drag); | ||
GlobalEventManager().setToggled("ToggleModelScaleManipulator", type == selection::Manipulator::ModelScale); | ||
} | ||
}; | ||
|
||
} |
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
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