mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 13:21:34 +00:00
Add some tooltips to context bar
This should be automatic, but that is for a future version. Request: https://community.aseprite.org/t/show-keyboard-shortcuts-on-every-context-bar-tooltip-element/56
This commit is contained in:
parent
81ccbee4a2
commit
2c3c7d7c0b
@ -23,8 +23,8 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_undo.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/document_undo.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -37,6 +37,7 @@
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/hex_color_entry.h"
|
||||
#include "app/ui/input_chain.h"
|
||||
#include "app/ui/keyboard_shortcuts.h"
|
||||
#include "app/ui/palette_popup.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
@ -226,7 +227,13 @@ ColorBar::ColorBar(int align)
|
||||
// Tooltips
|
||||
TooltipManager* tooltipManager = new TooltipManager();
|
||||
addChild(tooltipManager);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::EDIT), "Edit Color", BOTTOM);
|
||||
|
||||
Params params;
|
||||
params.set("switch", "true");
|
||||
tooltipManager->addTooltipFor(
|
||||
m_buttons.getItem((int)PalButton::EDIT),
|
||||
key_tooltip("Edit Color", CommandId::PaletteEditor, params), BOTTOM);
|
||||
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::SORT), "Sort & Gradients", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::PRESETS), "Presets", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::OPTIONS), "Options", BOTTOM);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "app/ui/color_button.h"
|
||||
#include "app/ui/dithering_selector.h"
|
||||
#include "app/ui/icon_button.h"
|
||||
#include "app/ui/keyboard_shortcuts.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/bind.h"
|
||||
@ -1191,10 +1192,14 @@ public:
|
||||
}
|
||||
|
||||
void setupTooltips(TooltipManager* tooltipManager) {
|
||||
// TODO use real shortcuts in tooltips
|
||||
tooltipManager->addTooltipFor(at(0), "Replace selection", BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(1), "Add to selection\n(Shift)", BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(2), "Subtract from selection\n(Shift+Alt)", BOTTOM);
|
||||
tooltipManager->addTooltipFor(
|
||||
at(0), "Replace selection", BOTTOM);
|
||||
|
||||
tooltipManager->addTooltipFor(
|
||||
at(1), key_tooltip("Add to selection", KeyAction::AddSelection), BOTTOM);
|
||||
|
||||
tooltipManager->addTooltipFor(
|
||||
at(2), key_tooltip("Subtract from selection", KeyAction::SubtractSelection), BOTTOM);
|
||||
}
|
||||
|
||||
void setSelectionMode(gen::SelectionMode mode) {
|
||||
@ -1223,8 +1228,9 @@ public:
|
||||
}
|
||||
|
||||
void setupTooltips(TooltipManager* tooltipManager) {
|
||||
tooltipManager->addTooltipFor(at(0), "Drop pixels here", BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(1), "Cancel drag and drop", BOTTOM);
|
||||
// TODO Enter and Esc should be configurable keys
|
||||
tooltipManager->addTooltipFor(at(0), "Drop pixels here (Enter)", BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(1), "Cancel drag and drop (Esc)", BOTTOM);
|
||||
}
|
||||
|
||||
obs::signal<void(ContextBarObserver::DropAction)> DropPixels;
|
||||
@ -1434,8 +1440,14 @@ ContextBar::ContextBar()
|
||||
tooltipManager->addTooltipFor(m_pivot, "Rotation Pivot", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_transparentColor, "Transparent Color", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_rotAlgo, "Rotation Algorithm", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_freehandAlgo, "Freehand trace algorithm", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_paintBucketSettings, "Extra paint bucket options", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_freehandAlgo,
|
||||
key_tooltip("Freehand trace algorithm",
|
||||
CommandId::PixelPerfectMode), BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_contiguous,
|
||||
key_tooltip("Fill contiguous areas color",
|
||||
CommandId::ContiguousFill), BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_paintBucketSettings,
|
||||
"Extra paint bucket options", BOTTOM);
|
||||
|
||||
m_brushType->setupTooltips(tooltipManager);
|
||||
m_selectionMode->setupTooltips(tooltipManager);
|
||||
|
@ -720,4 +720,17 @@ KeyAction KeyboardShortcuts::getCurrentActionModifiers(KeyContext context)
|
||||
return flags;
|
||||
}
|
||||
|
||||
std::string key_tooltip(const char* str, app::Key* key)
|
||||
{
|
||||
std::string res;
|
||||
if (str)
|
||||
res += str;
|
||||
if (key && !key->accels().empty()) {
|
||||
res += " (";
|
||||
res += key->accels().front().toString();
|
||||
res += ")";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -175,6 +175,22 @@ namespace app {
|
||||
DISABLE_COPYING(KeyboardShortcuts);
|
||||
};
|
||||
|
||||
std::string key_tooltip(const char* str, Key* key);
|
||||
|
||||
inline std::string key_tooltip(const char* str,
|
||||
const char* commandName,
|
||||
const Params& params = Params(),
|
||||
KeyContext keyContext = KeyContext::Any) {
|
||||
return key_tooltip(
|
||||
str, KeyboardShortcuts::instance()->command(
|
||||
commandName, params, keyContext));
|
||||
}
|
||||
|
||||
inline std::string key_tooltip(const char* str, KeyAction keyAction) {
|
||||
return key_tooltip(
|
||||
str, KeyboardShortcuts::instance()->action(keyAction));
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
||||
namespace base {
|
||||
|
Loading…
x
Reference in New Issue
Block a user