mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +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);
|
||||
setDoubleBuffered(true);
|
||||
setDoubleClickeable(true);
|
||||
|
||||
m_currentFolder = FileSystemModule::instance()->getRootFileItem();
|
||||
m_req_valid = false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -111,6 +111,8 @@ static const char* kTimelineActiveColor = "timeline_active";
|
||||
enum {
|
||||
A_PART_NOTHING,
|
||||
A_PART_SEPARATOR,
|
||||
A_PART_HEADER_EYE,
|
||||
A_PART_HEADER_PADLOCK,
|
||||
A_PART_HEADER_GEAR,
|
||||
A_PART_HEADER_ONIONSKIN,
|
||||
A_PART_HEADER_ONIONSKIN_RANGE_LEFT,
|
||||
@ -161,7 +163,6 @@ Timeline::Timeline()
|
||||
m_context->addObserver(this);
|
||||
|
||||
setDoubleBuffered(true);
|
||||
setDoubleClickeable(true);
|
||||
}
|
||||
|
||||
Timeline::~Timeline()
|
||||
@ -458,7 +459,11 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
}
|
||||
// Is the mouse on the headers?
|
||||
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;
|
||||
else if (getPartBounds(A_PART_HEADER_ONIONSKIN).contains(mousePos))
|
||||
hot_part = A_PART_HEADER_ONIONSKIN;
|
||||
@ -568,15 +573,34 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
}
|
||||
|
||||
switch (m_hot_part) {
|
||||
|
||||
case A_PART_NOTHING:
|
||||
// Do nothing.
|
||||
break;
|
||||
case A_PART_SEPARATOR:
|
||||
case A_PART_HEADER_LAYER:
|
||||
// Do nothing.
|
||||
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:
|
||||
// Do nothing.
|
||||
// TODO show timeline/onionskin configuration
|
||||
break;
|
||||
|
||||
case A_PART_HEADER_ONIONSKIN: {
|
||||
ISettings* m_settings = UIContext::instance()->getSettings();
|
||||
IDocumentSettings* docSettings =
|
||||
@ -585,9 +609,6 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
docSettings->setUseOnionskin(!docSettings->getUseOnionskin());
|
||||
break;
|
||||
}
|
||||
case A_PART_HEADER_LAYER:
|
||||
// Do nothing.
|
||||
break;
|
||||
case A_PART_HEADER_FRAME:
|
||||
// Show the frame pop-up menu.
|
||||
if (mouseMsg->right()) {
|
||||
@ -686,7 +707,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
->getCommandByName(CommandId::LayerProperties);
|
||||
|
||||
UIContext::instance()->executeCommand(command);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
case A_PART_HEADER_FRAME: {
|
||||
@ -696,7 +717,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
params.set("frame", "current");
|
||||
|
||||
UIContext::instance()->executeCommand(command, ¶ms);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
case A_PART_CEL: {
|
||||
@ -704,7 +725,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
||||
->getCommandByName(CommandId::CelProperties);
|
||||
|
||||
UIContext::instance()->executeCommand(command);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1034,6 +1055,22 @@ void Timeline::drawHeader(ui::Graphics* g)
|
||||
{
|
||||
ISettings* m_settings = UIContext::instance()->getSettings();
|
||||
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),
|
||||
NULL, m_timelineGearStyle,
|
||||
@ -1309,18 +1346,20 @@ gfx::Rect Timeline::getPartBounds(int part, int layer, FrameNumber frame) const
|
||||
m_separator_x + m_separator_w,
|
||||
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:
|
||||
return gfx::Rect(0, 0,
|
||||
FRMSIZE,
|
||||
HDRSIZE);
|
||||
return gfx::Rect(FRMSIZE*2, 0, FRMSIZE, HDRSIZE);
|
||||
|
||||
case A_PART_HEADER_ONIONSKIN:
|
||||
return gfx::Rect(FRMSIZE, 0,
|
||||
FRMSIZE,
|
||||
HDRSIZE);
|
||||
return gfx::Rect(FRMSIZE*3, 0, FRMSIZE, HDRSIZE);
|
||||
|
||||
case A_PART_HEADER_LAYER:
|
||||
return gfx::Rect(FRMSIZE*2, 0,
|
||||
return gfx::Rect(FRMSIZE*4, 0,
|
||||
m_separator_x - FRMSIZE*2,
|
||||
HDRSIZE);
|
||||
|
||||
@ -1612,6 +1651,42 @@ void Timeline::setScroll(int x, int y)
|
||||
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
|
||||
{
|
||||
for (size_t i=0; i<m_layers.size(); i++)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -151,6 +151,10 @@ namespace app {
|
||||
void onLayerChanged(Editor* editor) OVERRIDE;
|
||||
|
||||
private:
|
||||
bool allLayersVisible();
|
||||
bool allLayersInvisible();
|
||||
bool allLayersLocked();
|
||||
bool allLayersUnlocked();
|
||||
void detachDocument();
|
||||
void setCursor(int x, int y);
|
||||
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_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_DOUBLECLICKABLE 0x2000 // The widget accepts double-clicks
|
||||
|
||||
class GuiSystem {
|
||||
public:
|
||||
|
@ -62,7 +62,6 @@ Entry::Entry(size_t maxsize, const char *format, ...)
|
||||
setText(buf);
|
||||
|
||||
setFocusStop(true);
|
||||
setDoubleClickeable(true);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,6 @@ ListBox::ListBox()
|
||||
: Widget(kListBoxWidget)
|
||||
{
|
||||
setFocusStop(true);
|
||||
setDoubleClickeable(true);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
|
@ -580,13 +580,10 @@ void Manager::handleMouseUp(const gfx::Point& mousePos, MouseButtons mouseButton
|
||||
void Manager::handleMouseDoubleClick(const gfx::Point& mousePos, MouseButtons mouseButtons)
|
||||
{
|
||||
Widget* dst = (capture_widget ? capture_widget: mouse_widget);
|
||||
if (dst && dst->isDoubleClickeable()) {
|
||||
if (dst) {
|
||||
enqueueMessage(newMouseMessage(kDoubleClickMessage,
|
||||
dst, mousePos, mouseButtons));
|
||||
}
|
||||
else {
|
||||
handleMouseDown(mousePos, mouseButtons);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void Widget::setDoubleClickeable(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_DOUBLECLICKABLE;
|
||||
else
|
||||
this->flags &= ~JI_DOUBLECLICKABLE;
|
||||
}
|
||||
|
||||
bool Widget::isVisible() const
|
||||
{
|
||||
const Widget* widget = this;
|
||||
@ -338,11 +330,6 @@ bool Widget::isFocusMagnet() const
|
||||
return (this->flags & JI_FOCUSMAGNET) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isDoubleClickeable() const
|
||||
{
|
||||
return (this->flags & JI_DOUBLECLICKABLE) ? true: false;
|
||||
}
|
||||
|
||||
// ===============================================================
|
||||
// PARENTS & CHILDREN
|
||||
// ===============================================================
|
||||
@ -1330,9 +1317,21 @@ bool Widget::onProcessMessage(Message* msg)
|
||||
else
|
||||
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 kMouseUpMessage:
|
||||
case kDoubleClickMessage:
|
||||
case kMouseMoveMessage:
|
||||
case kMouseWheelMessage:
|
||||
// Propagate the message to the parent.
|
||||
|
@ -139,10 +139,6 @@ namespace ui {
|
||||
void setFocusMagnet(bool state);
|
||||
bool isFocusMagnet() const;
|
||||
|
||||
// True if this widget wants double-clicks.
|
||||
void setDoubleClickeable(bool state);
|
||||
bool isDoubleClickeable() const;
|
||||
|
||||
// ===============================================================
|
||||
// LOOK & FEEL
|
||||
// ===============================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user