mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-03 05:22:23 +00:00
Add new frame menu to status bar button (#4582)
This commit is contained in:
parent
99f1a1ea06
commit
e0ff51947a
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@
|
|||||||
.vs
|
.vs
|
||||||
tests/_test*
|
tests/_test*
|
||||||
build
|
build
|
||||||
|
CMakeSettings.json
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@ -390,6 +390,7 @@
|
|||||||
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
||||||
<part id="icon_aspect_ratio" x="256" y="264" w="10" h="8" />
|
<part id="icon_aspect_ratio" x="256" y="264" w="10" h="8" />
|
||||||
<part id="icon_delta" x="266" y="264" w="6" h="8" />
|
<part id="icon_delta" x="266" y="264" w="6" h="8" />
|
||||||
|
<part id="icon_add" x="184" y="200" w="5" h="5" />
|
||||||
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
||||||
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
||||||
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
||||||
@ -694,7 +695,9 @@
|
|||||||
<background color="check_hot_face" state="selected" />
|
<background color="check_hot_face" state="selected" />
|
||||||
<icon part="pal_options" />
|
<icon part="pal_options" />
|
||||||
</style>
|
</style>
|
||||||
<style id="new_frame_button" extends="mini_button" />
|
<style id="new_frame_button" extends="mini_button" padding-bottom="1">
|
||||||
|
<icon part="icon_add" />
|
||||||
|
</style>
|
||||||
<style id="color_button" extends="mini_button" font="mini" padding-bottom="1" />
|
<style id="color_button" extends="mini_button" font="mini" padding-bottom="1" />
|
||||||
<style id="splitter">
|
<style id="splitter">
|
||||||
<background color="face" />
|
<background color="face" />
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -386,6 +386,7 @@
|
|||||||
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
<part id="icon_slice" x="248" y="264" w="8" h="8" />
|
||||||
<part id="icon_aspect_ratio" x="256" y="264" w="10" h="8" />
|
<part id="icon_aspect_ratio" x="256" y="264" w="10" h="8" />
|
||||||
<part id="icon_delta" x="266" y="264" w="6" h="8" />
|
<part id="icon_delta" x="266" y="264" w="6" h="8" />
|
||||||
|
<part id="icon_add" x="184" y="200" w="5" h="5" />
|
||||||
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
<part id="tool_rectangular_marquee" x="144" y="0" w="16" h="16" />
|
||||||
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
<part id="tool_elliptical_marquee" x="160" y="0" w="16" h="16" />
|
||||||
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
<part id="tool_lasso" x="176" y="0" w="16" h="16" />
|
||||||
@ -687,7 +688,9 @@
|
|||||||
<background color="check_hot_face" state="selected" />
|
<background color="check_hot_face" state="selected" />
|
||||||
<icon part="pal_options" />
|
<icon part="pal_options" />
|
||||||
</style>
|
</style>
|
||||||
<style id="new_frame_button" extends="mini_button" />
|
<style id="new_frame_button" extends="mini_button" padding-bottom="1">
|
||||||
|
<icon part="icon_add" />
|
||||||
|
</style>
|
||||||
<style id="color_button" extends="mini_button" font="mini" padding-bottom="1" />
|
<style id="color_button" extends="mini_button" font="mini" padding-bottom="1" />
|
||||||
<style id="splitter">
|
<style id="splitter">
|
||||||
<background color="face" />
|
<background color="face" />
|
||||||
|
13
data/gui.xml
13
data/gui.xml
@ -1089,6 +1089,19 @@
|
|||||||
</menu>
|
</menu>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
<menu id="new_frame_popup_menu">
|
||||||
|
<item command="NewFrame" text="@main_menu.frame_duplicate_linked_cels">
|
||||||
|
<param name="content" value="cellinked" />
|
||||||
|
</item>
|
||||||
|
<item command="NewFrame" text="@main_menu.frame_duplicate_cels">
|
||||||
|
<param name="content" value="celcopies" />
|
||||||
|
</item>
|
||||||
|
<item command="NewFrame" text="@main_menu.frame_new_empty_frame">
|
||||||
|
<param name="content" value="empty" />
|
||||||
|
</item>
|
||||||
|
<item command="NewFrame" text="@main_menu.frame_new_frame" />
|
||||||
|
</menu>
|
||||||
|
|
||||||
<menu id="tab_popup_menu">
|
<menu id="tab_popup_menu">
|
||||||
<item command="CloseFile" text="@.close" group="tab_close" />
|
<item command="CloseFile" text="@.close" group="tab_close" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -38,7 +38,7 @@ disable_snap_grid = Disable Snap to Grid
|
|||||||
frame = Frame:
|
frame = Frame:
|
||||||
current_frame = Current Frame
|
current_frame = Current Frame
|
||||||
zoom_level = Zoom Level
|
zoom_level = Zoom Level
|
||||||
new_frame = New Frame
|
new_frame = New Frame\nRight-click for more options
|
||||||
locked_layers = There are locked layers
|
locked_layers = There are locked layers
|
||||||
no_active_layers = There is no active layer
|
no_active_layers = There is no active layer
|
||||||
layer_x_is_hidden = Layer "{}" is hidden
|
layer_x_is_hidden = Layer "{}" is hidden
|
||||||
|
@ -382,6 +382,7 @@ void AppMenus::reload()
|
|||||||
m_slicePopupMenu.reset(loadMenuById(handle, "slice_popup_menu"));
|
m_slicePopupMenu.reset(loadMenuById(handle, "slice_popup_menu"));
|
||||||
m_palettePopupMenu.reset(loadMenuById(handle, "palette_popup_menu"));
|
m_palettePopupMenu.reset(loadMenuById(handle, "palette_popup_menu"));
|
||||||
m_inkPopupMenu.reset(loadMenuById(handle, "ink_popup_menu"));
|
m_inkPopupMenu.reset(loadMenuById(handle, "ink_popup_menu"));
|
||||||
|
m_newFramePopupMenu.reset(loadMenuById(handle, "new_frame_popup_menu"));
|
||||||
|
|
||||||
// Add one menu item to run each script from the user scripts/ folder
|
// Add one menu item to run each script from the user scripts/ folder
|
||||||
{
|
{
|
||||||
@ -920,6 +921,7 @@ void AppMenus::updateMenusList()
|
|||||||
m_menus.push_back(m_slicePopupMenu.get());
|
m_menus.push_back(m_slicePopupMenu.get());
|
||||||
m_menus.push_back(m_palettePopupMenu.get());
|
m_menus.push_back(m_palettePopupMenu.get());
|
||||||
m_menus.push_back(m_inkPopupMenu.get());
|
m_menus.push_back(m_inkPopupMenu.get());
|
||||||
|
m_menus.push_back(m_newFramePopupMenu.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMenus::createNativeMenus()
|
void AppMenus::createNativeMenus()
|
||||||
|
@ -57,6 +57,7 @@ namespace app {
|
|||||||
Menu* getPalettePopupMenu() { return m_palettePopupMenu.get(); }
|
Menu* getPalettePopupMenu() { return m_palettePopupMenu.get(); }
|
||||||
Menu* getInkPopupMenu() { return m_inkPopupMenu.get(); }
|
Menu* getInkPopupMenu() { return m_inkPopupMenu.get(); }
|
||||||
Menu* getAnimationMenu();
|
Menu* getAnimationMenu();
|
||||||
|
Menu* getNewFrameMenu() { return m_newFramePopupMenu.get(); }
|
||||||
|
|
||||||
void applyShortcutToMenuitemsWithCommand(Command* command, const Params& params,
|
void applyShortcutToMenuitemsWithCommand(Command* command, const Params& params,
|
||||||
const KeyPtr& key);
|
const KeyPtr& key);
|
||||||
@ -111,6 +112,7 @@ namespace app {
|
|||||||
std::unique_ptr<Menu> m_slicePopupMenu;
|
std::unique_ptr<Menu> m_slicePopupMenu;
|
||||||
std::unique_ptr<Menu> m_palettePopupMenu;
|
std::unique_ptr<Menu> m_palettePopupMenu;
|
||||||
std::unique_ptr<Menu> m_inkPopupMenu;
|
std::unique_ptr<Menu> m_inkPopupMenu;
|
||||||
|
std::unique_ptr<Menu> m_newFramePopupMenu;
|
||||||
obs::scoped_connection m_recentFilesConn;
|
obs::scoped_connection m_recentFilesConn;
|
||||||
std::vector<Menu*> m_menus;
|
std::vector<Menu*> m_menus;
|
||||||
// List of recent menu items pointing to recent files.
|
// List of recent menu items pointing to recent files.
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "app/app_menus.h"
|
||||||
#include "app/commands/commands.h"
|
#include "app/commands/commands.h"
|
||||||
#include "app/commands/params.h"
|
#include "app/commands/params.h"
|
||||||
#include "app/context_access.h"
|
#include "app/context_access.h"
|
||||||
@ -694,13 +695,19 @@ StatusBar::StatusBar(TooltipManager* tooltipManager)
|
|||||||
|
|
||||||
// Construct the commands box
|
// Construct the commands box
|
||||||
{
|
{
|
||||||
|
auto theme = SkinTheme::get(this);
|
||||||
Box* box1 = new Box(HORIZONTAL);
|
Box* box1 = new Box(HORIZONTAL);
|
||||||
Box* box4 = new Box(HORIZONTAL);
|
Box* box4 = new Box(HORIZONTAL);
|
||||||
|
|
||||||
m_frameLabel = new Label(Strings::statusbar_tips_frame());
|
m_frameLabel = new Label(Strings::statusbar_tips_frame());
|
||||||
m_currentFrame = new GotoFrameEntry();
|
m_currentFrame = new GotoFrameEntry();
|
||||||
m_newFrame = new Button("+");
|
m_newFrame = new Button("");
|
||||||
m_newFrame->Click.connect([this]{ newFrame(); });
|
if (!theme->parts.iconAdd())
|
||||||
|
m_newFrame->setText("+"); // Fallback for themes without the icon.
|
||||||
|
|
||||||
|
m_newFrame->Click.connect(&StatusBar::newFrame, this);
|
||||||
|
m_newFrame->RightClick.connect(&StatusBar::showNewFramePopupMenu, this);
|
||||||
|
|
||||||
m_zoomEntry = new ZoomEntry;
|
m_zoomEntry = new ZoomEntry;
|
||||||
m_zoomEntry->ZoomChange.connect(&StatusBar::onChangeZoom, this);
|
m_zoomEntry->ZoomChange.connect(&StatusBar::onChangeZoom, this);
|
||||||
|
|
||||||
@ -922,7 +929,7 @@ void StatusBar::onInitTheme(ui::InitThemeEvent& ev)
|
|||||||
textHeight()+8*guiscale()));
|
textHeight()+8*guiscale()));
|
||||||
|
|
||||||
m_newFrame->setStyle(theme->styles.newFrameButton());
|
m_newFrame->setStyle(theme->styles.newFrameButton());
|
||||||
m_commandsBox->setBorder(gfx::Border(2, 1, 2, 2)*guiscale());
|
m_commandsBox->setBorder(gfx::Border(2, 2, 2, 2)*guiscale());
|
||||||
|
|
||||||
if (m_snapToGridWindow) {
|
if (m_snapToGridWindow) {
|
||||||
m_snapToGridWindow->initTheme();
|
m_snapToGridWindow->initTheme();
|
||||||
@ -996,6 +1003,11 @@ void StatusBar::newFrame()
|
|||||||
UIContext::instance()->executeCommandFromMenuOrShortcut(cmd);
|
UIContext::instance()->executeCommandFromMenuOrShortcut(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StatusBar::showNewFramePopupMenu()
|
||||||
|
{
|
||||||
|
AppMenus::instance()->getNewFrameMenu()->showPopup(mousePosInDisplay(), display());
|
||||||
|
}
|
||||||
|
|
||||||
void StatusBar::onChangeZoom(const render::Zoom& zoom)
|
void StatusBar::onChangeZoom(const render::Zoom& zoom)
|
||||||
{
|
{
|
||||||
if (auto editor = Editor::activeEditor())
|
if (auto editor = Editor::activeEditor())
|
||||||
|
@ -89,6 +89,7 @@ namespace app {
|
|||||||
private:
|
private:
|
||||||
void onCelOpacitySliderChange();
|
void onCelOpacitySliderChange();
|
||||||
void newFrame();
|
void newFrame();
|
||||||
|
void showNewFramePopupMenu();
|
||||||
void onChangeZoom(const render::Zoom& zoom);
|
void onChangeZoom(const render::Zoom& zoom);
|
||||||
void updateSnapToGridWindowPosition();
|
void updateSnapToGridWindowPosition();
|
||||||
void showIndicators();
|
void showIndicators();
|
||||||
|
@ -56,6 +56,11 @@ void ButtonBase::onClick()
|
|||||||
Click();
|
Click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ButtonBase::onRightClick()
|
||||||
|
{
|
||||||
|
RightClick();
|
||||||
|
}
|
||||||
|
|
||||||
bool ButtonBase::onProcessMessage(Message* msg)
|
bool ButtonBase::onProcessMessage(Message* msg)
|
||||||
{
|
{
|
||||||
switch (msg->type()) {
|
switch (msg->type()) {
|
||||||
@ -205,10 +210,17 @@ bool ButtonBase::onProcessMessage(Message* msg)
|
|||||||
releaseMouse();
|
releaseMouse();
|
||||||
|
|
||||||
if (hasMouse()) {
|
if (hasMouse()) {
|
||||||
|
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||||
|
|
||||||
switch (m_behaviorType) {
|
switch (m_behaviorType) {
|
||||||
|
|
||||||
case kButtonWidget:
|
case kButtonWidget:
|
||||||
|
{
|
||||||
|
if (mouseMsg->right())
|
||||||
|
onRightClick();
|
||||||
|
else
|
||||||
generateButtonSelectSignal();
|
generateButtonSelectSignal();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCheckWidget:
|
case kCheckWidget:
|
||||||
|
@ -34,6 +34,7 @@ namespace ui {
|
|||||||
WidgetType behaviorType() const;
|
WidgetType behaviorType() const;
|
||||||
// Signals
|
// Signals
|
||||||
obs::signal<void()> Click;
|
obs::signal<void()> Click;
|
||||||
|
obs::signal<void()> RightClick;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Events
|
// Events
|
||||||
@ -41,6 +42,7 @@ namespace ui {
|
|||||||
|
|
||||||
// New events
|
// New events
|
||||||
virtual void onClick();
|
virtual void onClick();
|
||||||
|
virtual void onRightClick();
|
||||||
virtual void onStartDrag();
|
virtual void onStartDrag();
|
||||||
virtual void onSelectWhenDragging();
|
virtual void onSelectWhenDragging();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user