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
[commands]
ShowPaletteSortOptions = Show Palette Sort Options
ShowPalettePresets = Show Palette Presets
ShowBrushes = Show Brushes
ShowPaletteOptions = Show Palette Options
ShowPalettePresets = Show Palette Presets
ShowPaletteSortOptions = Show Palette Sort Options
[document_tab_popup_menu]
duplicate_view = Duplicate &View

View File

@ -15,6 +15,7 @@
#include "app/app_menus.h"
#include "app/color_utils.h"
#include "app/commands/commands.h"
#include "app/commands/quick_command.h"
#include "app/document.h"
#include "app/ini_file.h"
#include "app/modules/gfx.h"
@ -165,7 +166,12 @@ public:
m_popupWindow.setupTooltips(tooltipManager);
}
void showPopup() {
openPopup();
}
void showPopupAndHighlightSlot(int slot) {
// TODO use slot?
openPopup();
}
@ -1468,6 +1474,7 @@ ContextBar::ContextBar()
setActiveBrush(createBrushFromPreferences());
initTheme();
registerCommands();
}
ContextBar::~ContextBar()
@ -2066,4 +2073,18 @@ void ContextBar::setupTooltips(TooltipManager* 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

View File

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