Skip to content

Commit

Permalink
#5731: Add icons and toggle events
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 27, 2021
1 parent 2cd3a94 commit 910037c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
Binary file added install/bitmaps/bulb_lit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added install/bitmaps/bulb_unlit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions install/user.xml
Expand Up @@ -313,6 +313,9 @@
<toolbutton name="texflips" action="TexToolFlipS" tooltip="Flip Selection Horiz (S-Axis)" icon="tex_flips.png"/>
<toolbutton name="texflipt" action="TexToolFlipT" tooltip="Flip Selection Vertical (T-Axis)" icon="tex_flipt.png"/>
<toolbutton name="selectrelated" action="TexToolSelectRelated" tooltip="Select Related Items" icon="textool_select_related.png"/>
<separator/>
<toggletoolbutton name="uselighttheme" action="TextureToolUseLightTheme" tooltip="Use Light Colour Theme" icon="bulb_lit.png" />
<toggletoolbutton name="usedarktheme" action="TextureToolUseDarkTheme" tooltip="Use Dark Colour Theme" icon="bulb_unlit.png" />
</toolbar>
<userGuideUrl value="https://www.darkradiant.net/userguide" />
<vcs>
Expand Down
22 changes: 22 additions & 0 deletions radiant/textool/TexTool.cpp
Expand Up @@ -779,6 +779,28 @@ void TexTool::registerCommands()
{
GlobalCommandSystem().addCommand("TextureTool", TexTool::toggle);
GlobalEventManager().addRegistryToggle("TexToolToggleGrid", RKEY_GRID_STATE);

GlobalEventManager().addToggle("TextureToolUseLightTheme", [](bool toggled)
{
if (toggled)
{
GlobalTextureToolColourSchemeManager().setActiveScheme(textool::ColourScheme::Light);
GlobalEventManager().setToggled("TextureToolUseDarkTheme", false);
Instance().queueDraw();
}
});

GlobalEventManager().addToggle("TextureToolUseDarkTheme", [](bool toggled)
{
if (toggled)
{
GlobalTextureToolColourSchemeManager().setActiveScheme(textool::ColourScheme::Dark);
GlobalEventManager().setToggled("TextureToolUseLightTheme", false);
Instance().queueDraw();
}
});

GlobalEventManager().setToggled("TextureToolUseLightTheme", true);
}

MouseTool::Result TexTool::processMouseDownEvent(const MouseToolPtr& tool, const Vector2& point)
Expand Down

0 comments on commit 910037c

Please sign in to comment.