mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-09 18:44:46 +00:00
Merge branch 'dev' of git@github.com:aseprite/aseprite.git into dev
This commit is contained in:
commit
bee4dff5a8
@ -45,7 +45,6 @@ FileList::FileList()
|
|||||||
{
|
{
|
||||||
setFocusStop(true);
|
setFocusStop(true);
|
||||||
setDoubleBuffered(true);
|
setDoubleBuffered(true);
|
||||||
setDoubleClickeable(true);
|
|
||||||
|
|
||||||
m_currentFolder = FileSystemModule::instance()->getRootFileItem();
|
m_currentFolder = FileSystemModule::instance()->getRootFileItem();
|
||||||
m_req_valid = false;
|
m_req_valid = false;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Aseprite
|
/* Aseprite
|
||||||
* Copyright (C) 2001-2013 David Capello
|
* Copyright (C) 2001-2014 David Capello
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -111,6 +111,8 @@ static const char* kTimelineActiveColor = "timeline_active";
|
|||||||
enum {
|
enum {
|
||||||
A_PART_NOTHING,
|
A_PART_NOTHING,
|
||||||
A_PART_SEPARATOR,
|
A_PART_SEPARATOR,
|
||||||
|
A_PART_HEADER_EYE,
|
||||||
|
A_PART_HEADER_PADLOCK,
|
||||||
A_PART_HEADER_GEAR,
|
A_PART_HEADER_GEAR,
|
||||||
A_PART_HEADER_ONIONSKIN,
|
A_PART_HEADER_ONIONSKIN,
|
||||||
A_PART_HEADER_ONIONSKIN_RANGE_LEFT,
|
A_PART_HEADER_ONIONSKIN_RANGE_LEFT,
|
||||||
@ -161,7 +163,6 @@ Timeline::Timeline()
|
|||||||
m_context->addObserver(this);
|
m_context->addObserver(this);
|
||||||
|
|
||||||
setDoubleBuffered(true);
|
setDoubleBuffered(true);
|
||||||
setDoubleClickeable(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timeline::~Timeline()
|
Timeline::~Timeline()
|
||||||
@ -458,7 +459,11 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
}
|
}
|
||||||
// Is the mouse on the headers?
|
// Is the mouse on the headers?
|
||||||
else if (mousePos.y < HDRSIZE) {
|
else if (mousePos.y < HDRSIZE) {
|
||||||
if (getPartBounds(A_PART_HEADER_GEAR).contains(mousePos))
|
if (getPartBounds(A_PART_HEADER_EYE).contains(mousePos))
|
||||||
|
hot_part = A_PART_HEADER_EYE;
|
||||||
|
else if (getPartBounds(A_PART_HEADER_PADLOCK).contains(mousePos))
|
||||||
|
hot_part = A_PART_HEADER_PADLOCK;
|
||||||
|
else if (getPartBounds(A_PART_HEADER_GEAR).contains(mousePos))
|
||||||
hot_part = A_PART_HEADER_GEAR;
|
hot_part = A_PART_HEADER_GEAR;
|
||||||
else if (getPartBounds(A_PART_HEADER_ONIONSKIN).contains(mousePos))
|
else if (getPartBounds(A_PART_HEADER_ONIONSKIN).contains(mousePos))
|
||||||
hot_part = A_PART_HEADER_ONIONSKIN;
|
hot_part = A_PART_HEADER_ONIONSKIN;
|
||||||
@ -568,15 +573,34 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (m_hot_part) {
|
switch (m_hot_part) {
|
||||||
|
|
||||||
case A_PART_NOTHING:
|
case A_PART_NOTHING:
|
||||||
// Do nothing.
|
|
||||||
break;
|
|
||||||
case A_PART_SEPARATOR:
|
case A_PART_SEPARATOR:
|
||||||
|
case A_PART_HEADER_LAYER:
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case A_PART_HEADER_EYE: {
|
||||||
|
bool newReadableState = !allLayersVisible();
|
||||||
|
for (size_t i=0; i<m_layers.size(); i++)
|
||||||
|
m_layers[i]->setReadable(newReadableState);
|
||||||
|
|
||||||
|
// Redraw all views.
|
||||||
|
m_document->notifyGeneralUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case A_PART_HEADER_PADLOCK: {
|
||||||
|
bool newWritableState = !allLayersUnlocked();
|
||||||
|
for (size_t i=0; i<m_layers.size(); i++)
|
||||||
|
m_layers[i]->setWritable(newWritableState);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case A_PART_HEADER_GEAR:
|
case A_PART_HEADER_GEAR:
|
||||||
// Do nothing.
|
// TODO show timeline/onionskin configuration
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case A_PART_HEADER_ONIONSKIN: {
|
case A_PART_HEADER_ONIONSKIN: {
|
||||||
ISettings* m_settings = UIContext::instance()->getSettings();
|
ISettings* m_settings = UIContext::instance()->getSettings();
|
||||||
IDocumentSettings* docSettings =
|
IDocumentSettings* docSettings =
|
||||||
@ -585,9 +609,6 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
docSettings->setUseOnionskin(!docSettings->getUseOnionskin());
|
docSettings->setUseOnionskin(!docSettings->getUseOnionskin());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case A_PART_HEADER_LAYER:
|
|
||||||
// Do nothing.
|
|
||||||
break;
|
|
||||||
case A_PART_HEADER_FRAME:
|
case A_PART_HEADER_FRAME:
|
||||||
// Show the frame pop-up menu.
|
// Show the frame pop-up menu.
|
||||||
if (mouseMsg->right()) {
|
if (mouseMsg->right()) {
|
||||||
@ -686,7 +707,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
->getCommandByName(CommandId::LayerProperties);
|
->getCommandByName(CommandId::LayerProperties);
|
||||||
|
|
||||||
UIContext::instance()->executeCommand(command);
|
UIContext::instance()->executeCommand(command);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case A_PART_HEADER_FRAME: {
|
case A_PART_HEADER_FRAME: {
|
||||||
@ -696,7 +717,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
params.set("frame", "current");
|
params.set("frame", "current");
|
||||||
|
|
||||||
UIContext::instance()->executeCommand(command, ¶ms);
|
UIContext::instance()->executeCommand(command, ¶ms);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case A_PART_CEL: {
|
case A_PART_CEL: {
|
||||||
@ -704,7 +725,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
->getCommandByName(CommandId::CelProperties);
|
->getCommandByName(CommandId::CelProperties);
|
||||||
|
|
||||||
UIContext::instance()->executeCommand(command);
|
UIContext::instance()->executeCommand(command);
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1034,6 +1055,22 @@ void Timeline::drawHeader(ui::Graphics* g)
|
|||||||
{
|
{
|
||||||
ISettings* m_settings = UIContext::instance()->getSettings();
|
ISettings* m_settings = UIContext::instance()->getSettings();
|
||||||
IDocumentSettings* docSettings = m_settings->getDocumentSettings(m_document);
|
IDocumentSettings* docSettings = m_settings->getDocumentSettings(m_document);
|
||||||
|
bool allInvisible = allLayersInvisible();
|
||||||
|
bool allLocked = allLayersLocked();
|
||||||
|
|
||||||
|
drawPart(g, getPartBounds(A_PART_HEADER_EYE),
|
||||||
|
NULL,
|
||||||
|
allInvisible ? m_timelineClosedEyeStyle: m_timelineOpenEyeStyle,
|
||||||
|
m_clk_part == A_PART_HEADER_EYE,
|
||||||
|
m_hot_part == A_PART_HEADER_EYE,
|
||||||
|
m_clk_part == A_PART_HEADER_EYE);
|
||||||
|
|
||||||
|
drawPart(g, getPartBounds(A_PART_HEADER_PADLOCK),
|
||||||
|
NULL,
|
||||||
|
allLocked ? m_timelineClosedPadlockStyle: m_timelineOpenPadlockStyle,
|
||||||
|
m_clk_part == A_PART_HEADER_PADLOCK,
|
||||||
|
m_hot_part == A_PART_HEADER_PADLOCK,
|
||||||
|
m_clk_part == A_PART_HEADER_PADLOCK);
|
||||||
|
|
||||||
drawPart(g, getPartBounds(A_PART_HEADER_GEAR),
|
drawPart(g, getPartBounds(A_PART_HEADER_GEAR),
|
||||||
NULL, m_timelineGearStyle,
|
NULL, m_timelineGearStyle,
|
||||||
@ -1309,18 +1346,20 @@ gfx::Rect Timeline::getPartBounds(int part, int layer, FrameNumber frame) const
|
|||||||
m_separator_x + m_separator_w,
|
m_separator_x + m_separator_w,
|
||||||
bounds.h);
|
bounds.h);
|
||||||
|
|
||||||
|
case A_PART_HEADER_EYE:
|
||||||
|
return gfx::Rect(FRMSIZE*0, 0, FRMSIZE, HDRSIZE);
|
||||||
|
|
||||||
|
case A_PART_HEADER_PADLOCK:
|
||||||
|
return gfx::Rect(FRMSIZE*1, 0, FRMSIZE, HDRSIZE);
|
||||||
|
|
||||||
case A_PART_HEADER_GEAR:
|
case A_PART_HEADER_GEAR:
|
||||||
return gfx::Rect(0, 0,
|
return gfx::Rect(FRMSIZE*2, 0, FRMSIZE, HDRSIZE);
|
||||||
FRMSIZE,
|
|
||||||
HDRSIZE);
|
|
||||||
|
|
||||||
case A_PART_HEADER_ONIONSKIN:
|
case A_PART_HEADER_ONIONSKIN:
|
||||||
return gfx::Rect(FRMSIZE, 0,
|
return gfx::Rect(FRMSIZE*3, 0, FRMSIZE, HDRSIZE);
|
||||||
FRMSIZE,
|
|
||||||
HDRSIZE);
|
|
||||||
|
|
||||||
case A_PART_HEADER_LAYER:
|
case A_PART_HEADER_LAYER:
|
||||||
return gfx::Rect(FRMSIZE*2, 0,
|
return gfx::Rect(FRMSIZE*4, 0,
|
||||||
m_separator_x - FRMSIZE*2,
|
m_separator_x - FRMSIZE*2,
|
||||||
HDRSIZE);
|
HDRSIZE);
|
||||||
|
|
||||||
@ -1612,6 +1651,42 @@ void Timeline::setScroll(int x, int y)
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Timeline::allLayersVisible()
|
||||||
|
{
|
||||||
|
for (size_t i=0; i<m_layers.size(); i++)
|
||||||
|
if (!m_layers[i]->isReadable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Timeline::allLayersInvisible()
|
||||||
|
{
|
||||||
|
for (size_t i=0; i<m_layers.size(); i++)
|
||||||
|
if (m_layers[i]->isReadable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Timeline::allLayersLocked()
|
||||||
|
{
|
||||||
|
for (size_t i=0; i<m_layers.size(); i++)
|
||||||
|
if (m_layers[i]->isWritable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Timeline::allLayersUnlocked()
|
||||||
|
{
|
||||||
|
for (size_t i=0; i<m_layers.size(); i++)
|
||||||
|
if (!m_layers[i]->isWritable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int Timeline::getLayerIndex(const Layer* layer) const
|
int Timeline::getLayerIndex(const Layer* layer) const
|
||||||
{
|
{
|
||||||
for (size_t i=0; i<m_layers.size(); i++)
|
for (size_t i=0; i<m_layers.size(); i++)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Aseprite
|
/* Aseprite
|
||||||
* Copyright (C) 2001-2013 David Capello
|
* Copyright (C) 2001-2014 David Capello
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -151,6 +151,10 @@ namespace app {
|
|||||||
void onLayerChanged(Editor* editor) OVERRIDE;
|
void onLayerChanged(Editor* editor) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool allLayersVisible();
|
||||||
|
bool allLayersInvisible();
|
||||||
|
bool allLayersLocked();
|
||||||
|
bool allLayersUnlocked();
|
||||||
void detachDocument();
|
void detachDocument();
|
||||||
void setCursor(int x, int y);
|
void setCursor(int x, int y);
|
||||||
void getDrawableLayers(ui::Graphics* g, int* first_layer, int* last_layer);
|
void getDrawableLayers(ui::Graphics* g, int* first_layer, int* last_layer);
|
||||||
|
@ -58,7 +58,6 @@ namespace ui {
|
|||||||
#define JI_INITIALIZED 0x0400 // The widget was already initialized by a theme.
|
#define JI_INITIALIZED 0x0400 // The widget was already initialized by a theme.
|
||||||
#define JI_DIRTY 0x0800 // The widget (or one child) is dirty (update_region != empty).
|
#define JI_DIRTY 0x0800 // The widget (or one child) is dirty (update_region != empty).
|
||||||
#define JI_HASTEXT 0x1000 // The widget has text (at least setText() was called one time).
|
#define JI_HASTEXT 0x1000 // The widget has text (at least setText() was called one time).
|
||||||
#define JI_DOUBLECLICKABLE 0x2000 // The widget accepts double-clicks
|
|
||||||
|
|
||||||
class GuiSystem {
|
class GuiSystem {
|
||||||
public:
|
public:
|
||||||
|
@ -62,7 +62,6 @@ Entry::Entry(size_t maxsize, const char *format, ...)
|
|||||||
setText(buf);
|
setText(buf);
|
||||||
|
|
||||||
setFocusStop(true);
|
setFocusStop(true);
|
||||||
setDoubleClickeable(true);
|
|
||||||
initTheme();
|
initTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ ListBox::ListBox()
|
|||||||
: Widget(kListBoxWidget)
|
: Widget(kListBoxWidget)
|
||||||
{
|
{
|
||||||
setFocusStop(true);
|
setFocusStop(true);
|
||||||
setDoubleClickeable(true);
|
|
||||||
initTheme();
|
initTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,13 +580,10 @@ void Manager::handleMouseUp(const gfx::Point& mousePos, MouseButtons mouseButton
|
|||||||
void Manager::handleMouseDoubleClick(const gfx::Point& mousePos, MouseButtons mouseButtons)
|
void Manager::handleMouseDoubleClick(const gfx::Point& mousePos, MouseButtons mouseButtons)
|
||||||
{
|
{
|
||||||
Widget* dst = (capture_widget ? capture_widget: mouse_widget);
|
Widget* dst = (capture_widget ? capture_widget: mouse_widget);
|
||||||
if (dst && dst->isDoubleClickeable()) {
|
if (dst) {
|
||||||
enqueueMessage(newMouseMessage(kDoubleClickMessage,
|
enqueueMessage(newMouseMessage(kDoubleClickMessage,
|
||||||
dst, mousePos, mouseButtons));
|
dst, mousePos, mouseButtons));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
handleMouseDown(mousePos, mouseButtons);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::handleMouseWheel(const gfx::Point& mousePos, MouseButtons mouseButtons, const gfx::Point& wheelDelta)
|
void Manager::handleMouseWheel(const gfx::Point& mousePos, MouseButtons mouseButtons, const gfx::Point& wheelDelta)
|
||||||
|
@ -277,14 +277,6 @@ void Widget::setFocusMagnet(bool state)
|
|||||||
this->flags &= ~JI_FOCUSMAGNET;
|
this->flags &= ~JI_FOCUSMAGNET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setDoubleClickeable(bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
this->flags |= JI_DOUBLECLICKABLE;
|
|
||||||
else
|
|
||||||
this->flags &= ~JI_DOUBLECLICKABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Widget::isVisible() const
|
bool Widget::isVisible() const
|
||||||
{
|
{
|
||||||
const Widget* widget = this;
|
const Widget* widget = this;
|
||||||
@ -338,11 +330,6 @@ bool Widget::isFocusMagnet() const
|
|||||||
return (this->flags & JI_FOCUSMAGNET) ? true: false;
|
return (this->flags & JI_FOCUSMAGNET) ? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Widget::isDoubleClickeable() const
|
|
||||||
{
|
|
||||||
return (this->flags & JI_DOUBLECLICKABLE) ? true: false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
// PARENTS & CHILDREN
|
// PARENTS & CHILDREN
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
@ -1330,9 +1317,21 @@ bool Widget::onProcessMessage(Message* msg)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kDoubleClickMessage:
|
||||||
|
// Convert double clicks into mouse down
|
||||||
|
if (kMouseDownMessage) {
|
||||||
|
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||||
|
MouseMessage mouseMsg2(kMouseDownMessage,
|
||||||
|
mouseMsg->buttons(),
|
||||||
|
mouseMsg->position(),
|
||||||
|
mouseMsg->wheelDelta());
|
||||||
|
|
||||||
|
sendMessage(&mouseMsg2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case kMouseDownMessage:
|
case kMouseDownMessage:
|
||||||
case kMouseUpMessage:
|
case kMouseUpMessage:
|
||||||
case kDoubleClickMessage:
|
|
||||||
case kMouseMoveMessage:
|
case kMouseMoveMessage:
|
||||||
case kMouseWheelMessage:
|
case kMouseWheelMessage:
|
||||||
// Propagate the message to the parent.
|
// Propagate the message to the parent.
|
||||||
|
@ -139,10 +139,6 @@ namespace ui {
|
|||||||
void setFocusMagnet(bool state);
|
void setFocusMagnet(bool state);
|
||||||
bool isFocusMagnet() const;
|
bool isFocusMagnet() const;
|
||||||
|
|
||||||
// True if this widget wants double-clicks.
|
|
||||||
void setDoubleClickeable(bool state);
|
|
||||||
bool isDoubleClickeable() const;
|
|
||||||
|
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
// LOOK & FEEL
|
// LOOK & FEEL
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user