Merge branch 'master' into feature/continuous-cels

This commit is contained in:
David Capello 2015-01-21 11:37:22 -03:00
commit 06628a2ee7
16 changed files with 43 additions and 19 deletions

View File

@ -20,6 +20,7 @@
#define APP_CMD_H_INCLUDED
#pragma once
#include "base/disable_copying.h"
#include "doc/sprite_position.h"
#include "undo/undo_command.h"
@ -55,6 +56,8 @@ namespace app {
enum class State { NotExecuted, Executed, Undone, Redone };
State m_state;
#endif
DISABLE_COPYING(Cmd);
};
} // namespace app

View File

@ -51,7 +51,6 @@ namespace cmd {
}
private:
frame_t m_frame;
std::stringstream m_stream;
};

View File

@ -43,7 +43,6 @@ namespace cmd {
private:
frame_t m_fromFrame;
frame_t m_newFrame;
bool m_firstTime;
};
} // namespace cmd

View File

@ -89,7 +89,9 @@ void CopyRegion::swap()
}
}
std::swap(m_stream, tmp);
// TODO use m_stream.swap(tmp) when clang and gcc support it
m_stream.str(tmp.str());
m_stream.clear();
}
} // namespace cmd

View File

@ -22,6 +22,7 @@
#include "base/serialization.h"
#include "base/unique_ptr.h"
#include "doc/object_id.h"
#include "doc/subobjects_io.h"
namespace doc {

View File

@ -45,13 +45,13 @@ namespace cmd {
}
private:
ObjectId m_oldImageId;
ObjectId m_newImageId;
// Reference used only to keep the copy of the new image from the
// ReplaceImage() ctor until the ReplaceImage::onExecute() call.
// Then the reference is not used anymore.
ImageRef m_newImage;
ObjectId m_oldImageId;
ObjectId m_newImageId;
ImageRef m_copy;
};

View File

@ -17,7 +17,7 @@
*/
#ifndef APP_CMD_SET_CEL_FRAME_H_INCLUDED
#define APP_CMD_SET_CEL_FRAME_CEL_H_INCLUDED
#define APP_CMD_SET_CEL_FRAME_H_INCLUDED
#pragma once
#include "app/cmd.h"

View File

@ -65,8 +65,6 @@ void MaskContentCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Sprite* sprite(writer.sprite());
Layer* layer = writer.layer();
Cel* cel = writer.cel(); // Get current cel (can be NULL)
if (!cel)
return;

View File

@ -61,10 +61,10 @@ public:
, m_doc(editor->document())
, m_sprite(editor->sprite())
, m_pal(m_sprite->palette(editor->frame()))
, m_zoom(editor->zoom())
, m_index_bg_color(-1)
, m_doublebuf(Image::create(IMAGE_RGB, ui::display_w(), ui::display_h()))
, m_doublesur(she::instance()->createRgbaSurface(ui::display_w(), ui::display_h()))
, m_zoom(editor->zoom()) {
, m_doublesur(she::instance()->createRgbaSurface(ui::display_w(), ui::display_h())) {
// Do not use DocumentWriter (do not lock the document) because we
// will call other sub-commands (e.g. previous frame, next frame,
// etc.).

View File

@ -40,6 +40,12 @@ static DocumentRange drop_range_op(
Document* doc, Op op, const DocumentRange& from,
DocumentRangePlace place, const DocumentRange& to)
{
if (place != kDocumentRangeBefore &&
place != kDocumentRangeAfter) {
ASSERT(false);
throw std::invalid_argument("Invalid 'place' argument");
}
Sprite* sprite = doc->sprite();
// Check noop/trivial/do nothing cases, i.e., move a range to the same place.
@ -83,6 +89,9 @@ static DocumentRange drop_range_op(
switch (op) {
case Move: undoLabel = "Move Range"; break;
case Copy: undoLabel = "Copy Range"; break;
default:
ASSERT(false);
throw std::invalid_argument("Invalid 'op' argument");
}
DocumentRange resultRange;

View File

@ -34,7 +34,6 @@ using namespace doc;
Transaction::Transaction(Context* ctx, const std::string& label, Modification modification)
: m_ctx(ctx)
, m_modification(modification)
, m_cmds(NULL)
{
DocumentLocation location = m_ctx->activeLocation();

View File

@ -73,7 +73,6 @@ namespace app {
Context* m_ctx;
DocumentUndo* m_undo;
CmdTransaction* m_cmds;
Modification m_modification;
};
} // namespace app

View File

@ -13,13 +13,14 @@
#include "base/mutex.h"
#include "base/scoped_lock.h"
#include <unordered_map>
#include <map>
namespace doc {
static base::mutex mutex;
static ObjectId newId = 0;
static std::unordered_map<ObjectId, Object*> objects;
// TODO Profile this and see if an unordered_map works best.
static std::map<ObjectId, Object*> objects;
Object::Object(ObjectType type)
: m_type(type)

View File

@ -415,10 +415,6 @@ void Render::renderLayer(
if (!scaled_func)
return;
const LayerImage* background = m_sprite->backgroundLayer();
bool need_checked_bg = (background != NULL ? !background->isVisible(): true);
color_t bg_color = 0;
m_globalOpacity = 255;
renderLayer(layer, dstImage, area,
frame, Zoom(1, 1), scaled_func,

View File

@ -187,6 +187,23 @@ void PopupWindow::onInitTheme(InitThemeEvent& ev)
this->border_width.b = 3 * guiscale();
}
void PopupWindow::onHitTest(HitTestEvent& ev)
{
Widget* picked = getManager()->pick(ev.getPoint());
if (picked) {
WidgetType type = picked->getType();
if ((type == kWindowWidget && picked == this) ||
type == kBoxWidget ||
type == kLabelWidget ||
type == kGridWidget ||
type == kSeparatorWidget) {
ev.setHit(HitTestCaption);
return;
}
}
Window::onHitTest(ev);
}
void PopupWindow::startFilteringMessages()
{
if (!m_filtering) {

View File

@ -34,6 +34,7 @@ namespace ui {
void onPreferredSize(PreferredSizeEvent& ev) override;
void onPaint(PaintEvent& ev) override;
void onInitTheme(InitThemeEvent& ev) override;
void onHitTest(HitTestEvent& ev) override;
private:
void startFilteringMessages();