Add command to show the brushes popup

This commit is contained in:
David Capello 2017-11-30 16:23:31 -03:00
parent 264c59bbc1
commit c7c049028b
3 changed files with 26 additions and 2 deletions

View File

@ -164,9 +164,10 @@ unlink = &Unlink
link_cels = &Link Cels link_cels = &Link Cels
[commands] [commands]
ShowPaletteSortOptions = Show Palette Sort Options ShowBrushes = Show Brushes
ShowPalettePresets = Show Palette Presets
ShowPaletteOptions = Show Palette Options ShowPaletteOptions = Show Palette Options
ShowPalettePresets = Show Palette Presets
ShowPaletteSortOptions = Show Palette Sort Options
[document_tab_popup_menu] [document_tab_popup_menu]
duplicate_view = Duplicate &View duplicate_view = Duplicate &View

View File

@ -15,6 +15,7 @@
#include "app/app_menus.h" #include "app/app_menus.h"
#include "app/color_utils.h" #include "app/color_utils.h"
#include "app/commands/commands.h" #include "app/commands/commands.h"
#include "app/commands/quick_command.h"
#include "app/document.h" #include "app/document.h"
#include "app/ini_file.h" #include "app/ini_file.h"
#include "app/modules/gfx.h" #include "app/modules/gfx.h"
@ -165,7 +166,12 @@ public:
m_popupWindow.setupTooltips(tooltipManager); m_popupWindow.setupTooltips(tooltipManager);
} }
void showPopup() {
openPopup();
}
void showPopupAndHighlightSlot(int slot) { void showPopupAndHighlightSlot(int slot) {
// TODO use slot?
openPopup(); openPopup();
} }
@ -1468,6 +1474,7 @@ ContextBar::ContextBar()
setActiveBrush(createBrushFromPreferences()); setActiveBrush(createBrushFromPreferences());
initTheme(); initTheme();
registerCommands();
} }
ContextBar::~ContextBar() ContextBar::~ContextBar()
@ -2066,4 +2073,18 @@ void ContextBar::setupTooltips(TooltipManager* tooltipManager)
m_symmetry->setupTooltips(tooltipManager); m_symmetry->setupTooltips(tooltipManager);
} }
void ContextBar::registerCommands()
{
Commands::instance()
->add(
new QuickCommand(
"ShowBrushes",
[this]{ this->showBrushes(); }));
}
void ContextBar::showBrushes()
{
m_brushType->showPopup();
}
} // namespace app } // namespace app

View File

@ -104,6 +104,8 @@ namespace app {
void onActiveToolChange(tools::Tool* tool) override; void onActiveToolChange(tools::Tool* tool) override;
void setupTooltips(ui::TooltipManager* tooltipManager); void setupTooltips(ui::TooltipManager* tooltipManager);
void registerCommands();
void showBrushes();
class ZoomButtons; class ZoomButtons;
class BrushBackField; class BrushBackField;