Merge branch 'master' into beta

This commit is contained in:
David Capello 2016-11-07 18:17:42 -03:00
commit 5c3f75c64b
80 changed files with 324 additions and 105 deletions

View File

@ -435,7 +435,7 @@ add_subdirectory(third_party)
include_directories(src)
add_definitions(-DHAVE_CONFIG_H)
if(ENABLE_MEMLEAK)
add_definitions(-DMEMLEAK)
add_definitions(-DLAF_MEMLEAK)
endif()
set(LAF_WITH_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable LAF tests")

View File

@ -100,9 +100,11 @@ This program is distributed under three different licenses:
our [End-User License Agreement for Aseprite (EULA)](EULA.txt). Please check
that there are [modules/libraries in the source code](src/README.md) that
are distributed under the MIT license
(e.g. [base](https://github.com/aseprite/aseprite/tree/master/src/base),
(e.g. [laf](https://github.com/aseprite/laf),
[clip](https://github.com/aseprite/clip),
[she](https://github.com/aseprite/aseprite/tree/master/src/she),
[clip](https://github.com/aseprite/clip), etc.).
[gfx](https://github.com/aseprite/gfx),
[ui](https://github.com/aseprite/ui), etc.).
2. You can request a special
[educational license](http://www.aseprite.org/faq/#is-there-an-educational-license)
in case you are a teacher in an educational institution and want to

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -418,6 +418,8 @@
<part id="icon_key" x="208" y="264" w="8" h="8" />
<part id="icon_distance" x="216" y="264" w="8" h="8" />
<part id="icon_grid" x="224" y="264" w="8" h="8" />
<part id="icon_save" x="232" y="264" w="8" h="8" />
<part id="icon_save_small" x="240" y="264" w="8" h="8" />
</parts>
<stylesheet>

2
laf

@ -1 +1 @@
Subproject commit 266312171630996d2823958d598514a6a5638060
Subproject commit 11274341a6390f9dda085256f98567156aa21cc9

View File

@ -14,12 +14,12 @@ These libraries are easy to be used and embedded in other software
because they don't depend on any other component.
* [allegro](allegro/): Modified version of [Allegro](http://alleg.sourceforge.net/) library, used for keyboard/mouse input, and drawing 2D graphics on screen.
* [base](base/): Core/basic stuff, multithreading, utf8, sha1, file system, memory, etc.
* [clip](https://github.com/aseprite/clip): Clipboard library.
* [css](css/): Pseudo-style sheet library.
* [fixmath](fixmath/): Fixed point operations (original code from Allegro code by Shawn Hargreaves).
* [flic](https://github.com/aseprite/flic): Library to load/save FLI/FLC files.
* [gfx](gfx/): Abstract graphics structures like point, size, rectangle, region, color, etc.
* [laf](https://github.com/aseprite/laf): Core/basic stuff, multithreading, utf8, sha1, file system, memory, etc.
* [observable](https://github.com/dacap/observable): Signal/slot functions.
* [scripting](scripting/): JavaScript engine.
* [steam](steam/): Steam API wrapper to avoid static linking to the .lib file.
@ -59,6 +59,9 @@ because they don't depend on any other component.
# Debugging Tricks
On Windows, you can use F5 to show the amount of used memory. Also
`Ctrl+Shift+Q` crashes the application in case that you want to test
the anticrash feature or your need a memory dump file.
* On Windows, you can use F5 to show the amount of used memory.
* On debug mode (when `_DEBUG` is defined), `Ctrl+Alt+Shift+Q` crashes
the application in case that you want to test the anticrash feature
or your need a memory dump file.
* On debug mode, you can use `Ctrl+Alt+Shift+R` to recover the active
document from the data recovery store.

View File

@ -357,6 +357,7 @@ add_library(app-lib
transformation.cpp
ui/ani_controls.cpp
ui/app_menuitem.cpp
ui/backup_indicator.cpp
ui/brush_popup.cpp
ui/button_set.cpp
ui/color_bar.cpp

View File

@ -37,6 +37,7 @@
#include "app/shell.h"
#include "app/tools/active_tool.h"
#include "app/tools/tool_box.h"
#include "app/ui/backup_indicator.h"
#include "app/ui/color_bar.h"
#include "app/ui/document_view.h"
#include "app/ui/editor/editor.h"
@ -52,7 +53,8 @@
#include "app/webserver.h"
#include "base/exception.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/scoped_lock.h"
#include "base/split_string.h"
#include "base/unique_ptr.h"
#include "doc/site.h"
#include "doc/sprite.h"
@ -116,6 +118,7 @@ public:
void deleteDataRecovery() {
#ifdef ENABLE_DATA_RECOVERY
delete m_recovery;
m_recovery = nullptr;
#endif
}
@ -129,6 +132,7 @@ App::App()
, m_legacy(NULL)
, m_isGui(false)
, m_isShell(false)
, m_backupIndicator(nullptr)
{
ASSERT(m_instance == NULL);
m_instance = this;
@ -312,6 +316,11 @@ App::~App()
// Save brushes
m_brushes.reset(nullptr);
if (m_backupIndicator) {
delete m_backupIndicator;
m_backupIndicator = nullptr;
}
delete m_legacy;
delete m_modules;
delete m_coreModules;
@ -399,11 +408,30 @@ Preferences& App::preferences() const
return m_coreModules->m_preferences;
}
crash::DataRecovery* App::dataRecovery() const
{
return m_modules->recovery();
}
void App::showNotification(INotificationDelegate* del)
{
m_mainWindow->showNotification(del);
}
void App::showBackupNotification(bool state)
{
base::scoped_lock lock(m_backupIndicatorMutex);
if (state) {
if (!m_backupIndicator)
m_backupIndicator = new BackupIndicator;
m_backupIndicator->start();
}
else {
if (m_backupIndicator)
m_backupIndicator->stop();
}
}
void App::updateDisplayTitleBar()
{
std::string defaultTitle = PACKAGE " v" VERSION;

View File

@ -9,6 +9,7 @@
#pragma once
#include "app/app_brushes.h"
#include "base/mutex.h"
#include "base/unique_ptr.h"
#include "doc/pixel_format.h"
#include "obs/signal.h"
@ -27,6 +28,7 @@ namespace ui {
namespace app {
class AppOptions;
class BackupIndicator;
class ContextBar;
class Document;
class INotificationDelegate;
@ -39,6 +41,10 @@ namespace app {
class Timeline;
class Workspace;
namespace crash {
class DataRecovery;
}
namespace tools {
class ActiveToolManager;
class Tool;
@ -75,6 +81,7 @@ namespace app {
ContextBar* contextBar() const;
Timeline* timeline() const;
Preferences& preferences() const;
crash::DataRecovery* dataRecovery() const;
AppBrushes& brushes() {
ASSERT(m_brushes.get());
@ -82,6 +89,8 @@ namespace app {
}
void showNotification(INotificationDelegate* del);
// This can be called from a non-UI thread.
void showBackupNotification(bool state);
void updateDisplayTitleBar();
InputChain& inputChain();
@ -106,6 +115,8 @@ namespace app {
base::UniquePtr<MainWindow> m_mainWindow;
FileList m_files;
base::UniquePtr<AppBrushes> m_brushes;
BackupIndicator* m_backupIndicator;
base::mutex m_backupIndicatorMutex;
};
void app_refresh_screen();

View File

@ -16,7 +16,6 @@
#include "base/base64.h"
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/serialization.h"
#include "doc/brush.h"
#include "doc/color.h"

View File

@ -26,7 +26,6 @@
#include "app/util/filetoks.h"
#include "base/bind.h"
#include "base/fs.h"
#include "base/path.h"
#include "ui/ui.h"
#include "tinyxml.h"

View File

@ -10,7 +10,7 @@
#include "app/cli/app_options.h"
#include "base/path.h"
#include "base/fs.h"
#include <iostream>

View File

@ -24,7 +24,7 @@
#include "app/restore_visible_layers.h"
#include "app/ui_context.h"
#include "base/convert_to.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/split_string.h"
#include "doc/frame_tag.h"
#include "doc/frame_tags.h"

View File

@ -58,12 +58,12 @@ void CropCel::cropImage(const gfx::Point& origin,
image->setVersion(ver);
image->incrementVersion();
cel->data()->setImage(image);
cel->incrementVersion();
cel->data()->incrementVersion();
}
if (cel->data()->position() != origin) {
cel->data()->setPosition(origin);
cel->incrementVersion();
cel->data()->incrementVersion();
}
}

View File

@ -29,13 +29,13 @@ SetCelOpacity::SetCelOpacity(Cel* cel, int opacity)
void SetCelOpacity::onExecute()
{
cel()->setOpacity(m_newOpacity);
cel()->incrementVersion();
cel()->data()->incrementVersion();
}
void SetCelOpacity::onUndo()
{
cel()->setOpacity(m_oldOpacity);
cel()->incrementVersion();
cel()->data()->incrementVersion();
}
void SetCelOpacity::onFireNotifications()

View File

@ -30,14 +30,14 @@ SetCelPosition::SetCelPosition(Cel* cel, int x, int y)
void SetCelPosition::onExecute()
{
cel()->setPosition(m_newX, m_newY);
cel()->incrementVersion();
cel()->data()->setPosition(gfx::Point(m_newX, m_newY));
cel()->data()->incrementVersion();
}
void SetCelPosition::onUndo()
{
cel()->setPosition(m_oldX, m_oldY);
cel()->incrementVersion();
cel()->data()->setPosition(gfx::Point(m_oldX, m_oldY));
cel()->data()->incrementVersion();
}
void SetCelPosition::onFireNotifications()

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -14,7 +14,7 @@
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/ui_context.h"
#include "base/path.h"
#include "base/fs.h"
#include "doc/sprite.h"
#include "ui/ui.h"

View File

@ -26,7 +26,6 @@
#include "base/bind.h"
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/string.h"
#include "doc/frame_tag.h"
#include "doc/layer.h"

View File

@ -22,7 +22,6 @@
#include "app/ui/skin/skin_theme.h"
#include "base/bind.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/scoped_value.h"
#include "base/split_string.h"
#include "base/string.h"

View File

@ -12,7 +12,7 @@
#include "app/context.h"
#include "app/document.h"
#include "app/util/new_image_from_mask.h"
#include "base/path.h"
#include "base/fs.h"
#include "doc/cel.h"
#include "doc/mask.h"
#include "doc/palette.h"

View File

@ -22,7 +22,7 @@
#include "app/ui/status_bar.h"
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/thread.h"
#include "base/unique_ptr.h"
#include "doc/sprite.h"

View File

@ -20,7 +20,6 @@
#include "base/bind.h"
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/path.h"
#include "doc/image.h"
#include "render/render.h"
#include "she/display.h"

View File

@ -36,7 +36,6 @@
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/fs.h"
#include "base/path.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/sprite.h"

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -20,7 +20,7 @@
#include "app/ui/font_popup.h"
#include "app/util/freetype_utils.h"
#include "base/bind.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/string.h"
#include "base/unique_ptr.h"
#include "doc/image.h"

View File

@ -13,7 +13,7 @@
#include "app/console.h"
#include "app/resource_finder.h"
#include "app/script/app_scripting.h"
#include "base/path.h"
#include "base/fs.h"
#include "script/engine_delegate.h"
#include "ui/manager.h"

View File

@ -28,7 +28,6 @@
#include "base/bind.h"
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/thread.h"
#include "base/unique_ptr.h"
#include "doc/frame_tag.h"

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -13,7 +13,6 @@
#include "app/file_selector.h"
#include "app/util/msk_file.h"
#include "base/fs.h"
#include "base/path.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/alert.h"

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -16,7 +16,6 @@
#include "app/file_selector.h"
#include "app/modules/palettes.h"
#include "base/fs.h"
#include "base/path.h"
#include "doc/palette.h"
#include "ui/alert.h"

View File

@ -23,6 +23,24 @@
namespace app {
namespace crash {
namespace {
class SwitchBackupIcon {
public:
SwitchBackupIcon() {
App* app = App::instance();
if (app)
app->showBackupNotification(true);
}
~SwitchBackupIcon() {
App* app = App::instance();
if (app)
app->showBackupNotification(false);
}
};
}
BackupObserver::BackupObserver(Session* session, doc::Context* ctx)
: m_session(session)
, m_ctx(ctx)
@ -79,6 +97,7 @@ void BackupObserver::backgroundThread()
if (seconds >= waitUntil) {
TRACE("RECO: Start backup process for %d documents\n", m_documents.size());
SwitchBackupIcon icon;
base::scoped_lock hold(m_mutex);
base::Chrono chrono;
bool somethingLocked = false;

View File

@ -14,7 +14,6 @@
#include "app/crash/session.h"
#include "app/resource_finder.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/time.h"
namespace app {

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -28,6 +28,8 @@ namespace crash {
DataRecovery(doc::Context* context);
~DataRecovery();
Session* activeSession() { return m_inProgress.get(); }
// Returns the list of sessions that can be recovered.
const Sessions& sessions() { return m_sessions; }

View File

@ -17,7 +17,6 @@
#include "base/exception.h"
#include "base/fs.h"
#include "base/fstream_path.h"
#include "base/path.h"
#include "base/serialization.h"
#include "base/string.h"
#include "base/unique_ptr.h"

View File

@ -22,10 +22,10 @@
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/fstream_path.h"
#include "base/path.h"
#include "base/process.h"
#include "base/split_string.h"
#include "base/string.h"
#include "base/unique_ptr.h"
namespace app {
namespace crash {
@ -187,6 +187,17 @@ void Session::restoreBackup(Backup* backup)
}
}
void Session::restoreBackupById(const ObjectId id)
{
std::string docDir = base::join_path(m_path, base::convert_to<std::string>(int(id)));
if (!base::is_directory(docDir))
return;
base::UniquePtr<Backup> backup(new Backup(docDir));
if (backup)
restoreBackup(backup.get());
}
void Session::restoreRawImages(Backup* backup, RawImagesAs as)
{
Console console;

View File

@ -12,6 +12,7 @@
#include "base/disable_copying.h"
#include "base/process.h"
#include "base/shared_ptr.h"
#include "doc/object_id.h"
#include <fstream>
#include <string>
@ -53,6 +54,7 @@ namespace crash {
void removeDocument(app::Document* doc);
void restoreBackup(Backup* backup);
void restoreBackupById(const doc::ObjectId id);
void restoreRawImages(Backup* backup, RawImagesAs as);
void deleteBackup(Backup* backup);

View File

@ -15,7 +15,6 @@
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/fstream_path.h"
#include "base/path.h"
#include "base/serialization.h"
#include "base/string.h"
#include "base/unique_ptr.h"

View File

@ -18,8 +18,8 @@
#include "app/restore_visible_layers.h"
#include "app/ui_context.h"
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/fstream_path.h"
#include "base/path.h"
#include "base/replace_string.h"
#include "base/shared_ptr.h"
#include "base/string.h"

View File

@ -16,7 +16,7 @@
#include "base/cfile.h"
#include "base/exception.h"
#include "base/file_handle.h"
#include "base/path.h"
#include "base/fs.h"
#include "doc/doc.h"
#include "fixmath/fixmath.h"
#include "ui/alert.h"

View File

@ -23,7 +23,6 @@
#include "app/ui/status_bar.h"
#include "base/fs.h"
#include "base/mutex.h"
#include "base/path.h"
#include "base/scoped_lock.h"
#include "base/shared_ptr.h"
#include "base/string.h"

View File

@ -13,7 +13,7 @@
#include "app/file/file.h"
#include "app/file/file_format.h"
#include "app/file/file_formats_manager.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/string.h"
#include "doc/cel.h"
#include "doc/file/col_file.h"

View File

@ -16,9 +16,9 @@
#include "app/xml_document.h"
#include "base/convert_to.h"
#include "base/file_handle.h"
#include "base/path.h"
#include "doc/doc.h"
#include "base/fs.h"
#include "doc/algorithm/shrink_bounds.h"
#include "doc/doc.h"
#include "doc/primitives.h"
#include <cmath>

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -10,7 +10,7 @@
#include "app/file/split_filename.h"
#include "base/convert_to.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/string.h"
#include <cstring>

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -8,7 +8,7 @@
#include "app/file/split_filename.h"
#include "base/path.h"
#include "base/fs.h"
using namespace app;

View File

@ -17,7 +17,6 @@
#include "app/file_system.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/string.h"
#include "she/display.h"
#include "she/surface.h"

View File

@ -13,7 +13,7 @@
#include "app/file/file.h"
#include "app/file/split_filename.h"
#include "base/convert_to.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/replace_string.h"
#include <cstdlib>

View File

@ -8,7 +8,7 @@
#include "app/filename_formatter.h"
#include "base/path.h"
#include "base/fs.h"
using namespace app;

View File

@ -11,7 +11,7 @@
#include "app/ini_file.h"
#include "app/resource_finder.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/split_string.h"
#include "base/string.h"
#include "cfg/cfg.h"

View File

@ -15,7 +15,6 @@
#include "app/console.h"
#include "app/document.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gfx.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
@ -47,6 +46,11 @@
#include <list>
#include <vector>
#if defined(_DEBUG) && defined(ENABLE_DATA_RECOVERY)
#include "app/crash/data_recovery.h"
#include "app/modules/editors.h"
#endif
namespace app {
using namespace gfx;
@ -372,14 +376,30 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
case kKeyDownMessage: {
#ifdef _DEBUG
// Left Shift+Ctrl+Q generates a crash (useful to test the anticrash feature)
// Ctrl+Shift+Q generates a crash (useful to test the anticrash feature)
if (msg->ctrlPressed() &&
msg->shiftPressed() &&
static_cast<KeyMessage*>(msg)->scancode() == kKeyQ) {
int* p = nullptr;
*p = 0;
}
#endif
#ifdef ENABLE_DATA_RECOVERY
// Ctrl+Shift+R recover active sprite from the backup store
if (msg->ctrlPressed() &&
msg->shiftPressed() &&
static_cast<KeyMessage*>(msg)->scancode() == kKeyR &&
App::instance()->dataRecovery() &&
App::instance()->dataRecovery()->activeSession() &&
current_editor &&
current_editor->document()) {
App::instance()
->dataRecovery()
->activeSession()
->restoreBackupById(current_editor->document()->id());
}
#endif // ENABLE_DATA_RECOVERY
#endif // _DEBUG
// Call base impl to check if there is a foreground window as
// top level that needs keys. (In this way we just do not

View File

@ -14,7 +14,6 @@
#include "app/file/palette_file.h"
#include "app/resource_finder.h"
#include "base/fs.h"
#include "base/path.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/sprite.h"

View File

@ -12,7 +12,6 @@
#include "app/ini_file.h"
#include "base/fs.h"
#include "base/path.h"
#include <cstdio>
#include <cstring>

View File

@ -13,7 +13,6 @@
#include "base/bind.h"
#include "base/fs.h"
#include "base/fstream_path.h"
#include "base/path.h"
#include "base/replace_string.h"
#include "base/scoped_value.h"
#include "base/string.h"

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -16,7 +16,6 @@
#include "app/resource_finder.h"
#include "base/bind.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/scoped_value.h"
#include "doc/palette.h"

View File

@ -16,7 +16,6 @@
#include "app/resource_finder.h"
#include "base/bind.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/scoped_value.h"
namespace app {

View File

@ -12,7 +12,6 @@
#include "app/app.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/string.h"
#include <cstdio>

View File

@ -0,0 +1,58 @@
// Aseprite
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/ui/backup_indicator.h"
#include "app/ui/status_bar.h"
#include "base/bind.h"
#include "ui/manager.h"
namespace app {
BackupIndicator::BackupIndicator()
: m_timer(100)
, m_small(false)
, m_running(false)
{
m_timer.Tick.connect(base::Bind<void>(&BackupIndicator::onTick, this));
}
BackupIndicator::~BackupIndicator()
{
m_timer.stop();
}
void BackupIndicator::start()
{
m_running = true;
m_timer.start();
}
void BackupIndicator::stop()
{
m_running = false;
}
void BackupIndicator::onTick()
{
if (!m_running) {
StatusBar::instance()->showBackupIcon(StatusBar::BackupIcon::None);
m_timer.stop();
return;
}
StatusBar::instance()->showBackupIcon(
m_small ? StatusBar::BackupIcon::Small:
StatusBar::BackupIcon::Normal);
m_small = !m_small;
}
} // namespace app

View File

@ -0,0 +1,33 @@
// Aseprite
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef APP_UI_BACKUP_INDICATOR_H_INCLUDED
#define APP_UI_BACKUP_INDICATOR_H_INCLUDED
#pragma once
#include "ui/timer.h"
namespace app {
class BackupIndicator {
public:
BackupIndicator();
~BackupIndicator();
void start();
void stop();
private:
void onTick();
ui::Timer m_timer;
bool m_small;
bool m_running;
};
} // namespace app
#endif

View File

@ -32,7 +32,7 @@
#include "app/ui/workspace.h"
#include "app/ui_context.h"
#include "app/util/clipboard.h"
#include "base/path.h"
#include "base/fs.h"
#include "doc/document_event.h"
#include "doc/layer.h"
#include "doc/sprite.h"

View File

@ -44,7 +44,7 @@ MovingCelState::MovingCelState(Editor* editor,
, m_scaled(false)
, m_handle(handle)
{
ContextWriter writer(m_reader);
ContextWriter writer(m_reader, 500);
Document* document = editor->document();
auto range = App::instance()->timeline()->range();
LayerImage* layer = static_cast<LayerImage*>(editor->layer());
@ -108,7 +108,7 @@ bool MovingCelState::onMouseUp(Editor* editor, MouseMessage* msg)
// If the user didn't cancel the operation...
if (!m_canceled) {
ContextWriter writer(m_reader);
ContextWriter writer(m_reader, 1000);
Transaction transaction(writer.context(), "Cel Movement", ModifyDocument);
DocumentApi api = document->getApi(transaction);

View File

@ -177,7 +177,8 @@ void PixelsMovement::trim()
{
ContextWriter writer(m_reader, 1000);
ASSERT(writer.cel());
// writer.cel() can be nullptr when we paste in an empty cel
// (Ctrl+V) and cut (Ctrl+X) the floating pixels.
if (writer.cel() &&
writer.cel()->layer()->isTransparent())
m_transaction.execute(new cmd::TrimCel(writer.cel()));

View File

@ -223,12 +223,20 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
"Cel is empty, nothing to move");
}
else {
// Change to MovingCelState
HandleType handle = MoveHandle;
if (resizeCelBounds(editor).contains(msg->position()))
handle = ScaleSEHandle;
try {
// Change to MovingCelState
HandleType handle = MoveHandle;
if (resizeCelBounds(editor).contains(msg->position()))
handle = ScaleSEHandle;
editor->setState(EditorStatePtr(new MovingCelState(editor, msg, handle)));
MovingCelState* newState = new MovingCelState(editor, msg, handle);
editor->setState(EditorStatePtr(newState));
}
catch (const LockedDocumentException& ex) {
// TODO break the background task that is locking this sprite
StatusBar::instance()->showTip(1000,
"Sprite is used by a backup/data recovery task");
}
}
}

View File

@ -26,7 +26,6 @@
#include "base/bind.h"
#include "base/convert_to.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/split_string.h"
#include "base/unique_ptr.h"
#include "ui/ui.h"

View File

@ -18,7 +18,6 @@
#include "app/util/freetype_utils.h"
#include "base/bind.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/string.h"
#include "base/unique_ptr.h"
#include "doc/conversion_she.h"

View File

@ -36,7 +36,7 @@
#include "app/ui/workspace_tabs.h"
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/path.h"
#include "base/fs.h"
#include "she/display.h"
#include "ui/message.h"
#include "ui/splitter.h"

View File

@ -19,7 +19,7 @@
#include "app/ui/skin/style.h"
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/path.h"
#include "base/fs.h"
#include "ui/graphics.h"
#include "ui/link_label.h"
#include "ui/listitem.h"

View File

@ -182,7 +182,16 @@ class StatusBar::Indicators : public HBox {
public:
Indicators() {
Indicators() : m_backupIcon(BackupIcon::None) {
m_leftArea.setBorder(gfx::Border(0));
m_leftArea.setVisible(true);
m_leftArea.setExpansive(true);
m_rightArea.setBorder(gfx::Border(0));
m_rightArea.setVisible(false);
addChild(&m_leftArea);
addChild(&m_rightArea);
}
void startIndicators() {
@ -210,7 +219,7 @@ public:
auto indicator = new TextIndicator(text);
m_indicators.push_back(indicator);
m_iterator = m_indicators.end();
addChild(indicator);
m_leftArea.addChild(indicator);
}
void addIconIndicator(she::Surface* icon, bool colored) {
@ -228,7 +237,7 @@ public:
auto indicator = new IconIndicator(icon, colored);
m_indicators.push_back(indicator);
m_iterator = m_indicators.end();
addChild(indicator);
m_leftArea.addChild(indicator);
}
void addColorIndicator(const app::Color& color) {
@ -246,7 +255,29 @@ public:
auto indicator = new ColorIndicator(color);
m_indicators.push_back(indicator);
m_iterator = m_indicators.end();
addChild(indicator);
m_leftArea.addChild(indicator);
}
void showBackupIcon(BackupIcon icon) {
m_backupIcon = icon;
if (m_backupIcon != BackupIcon::None) {
she::Surface* icon =
(m_backupIcon == BackupIcon::Normal ?
SkinTheme::instance()->parts.iconSave()->bitmap(0):
SkinTheme::instance()->parts.iconSaveSmall()->bitmap(0));
m_rightArea.setVisible(true);
if (m_rightArea.children().empty()) {
m_rightArea.addChild(new IconIndicator(icon, true));
}
else {
((IconIndicator*)m_rightArea.lastChild())->updateIndicator(icon, true);
}
}
else {
m_rightArea.setVisible(false);
}
layout();
}
private:
@ -255,7 +286,7 @@ private:
auto end = m_indicators.end();
for (; it != end; ++it) {
auto indicator = *it;
removeChild(indicator);
m_leftArea.removeChild(indicator);
delete indicator;
}
m_indicators.erase(m_iterator, end);
@ -263,6 +294,9 @@ private:
std::vector<Indicator*> m_indicators;
std::vector<Indicator*>::iterator m_iterator;
BackupIcon m_backupIcon;
HBox m_leftArea;
HBox m_rightArea;
};
class StatusBar::IndicatorsGeneration {
@ -572,6 +606,11 @@ void StatusBar::updateFromEditor(Editor* editor)
m_zoomEntry->setZoom(editor->zoom());
}
void StatusBar::showBackupIcon(BackupIcon icon)
{
m_indicators->showBackupIcon(icon);
}
bool StatusBar::setStatusText(int msecs, const char *format, ...)
{
if ((base::current_tick() > m_timeout) || (msecs > 0)) {

View File

@ -50,6 +50,8 @@ namespace app {
public:
static StatusBar* instance() { return m_instance; }
enum BackupIcon { None, Normal, Small };
StatusBar();
~StatusBar();
@ -64,6 +66,8 @@ namespace app {
// Used by AppEditor to update the zoom level in the status bar.
void updateFromEditor(Editor* editor);
void showBackupIcon(BackupIcon icon);
protected:
void onResize(ui::ResizeEvent& ev) override;

View File

@ -10,7 +10,7 @@
#include "doc/document.h"
#include "base/path.h"
#include "base/fs.h"
#include "doc/context.h"
#include "doc/sprite.h"

View File

@ -10,8 +10,8 @@
#include "doc/documents.h"
#include "base/fs.h"
#include "base/mutex.h"
#include "base/path.h"
#include "doc/document.h"
#include <algorithm>

View File

@ -7,7 +7,7 @@
#include "docio/detect_format.h"
#include "base/file_handle.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/string.h"
#include "flic/flic_details.h"

View File

@ -5,7 +5,7 @@
// Read LICENSE.txt for more information.
#include "base/file_handle.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/program_options.h"
#include "base/string.h"
#include "gen/pref_types.h"

View File

@ -1,12 +1,12 @@
// Aseprite Code Generator
// Copyright (c) 2014, 2015 David Capello
// Copyright (c) 2014-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#include "base/exception.h"
#include "base/file_handle.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/split_string.h"
#include "base/string.h"
#include "gen/common.h"

View File

@ -1,5 +1,5 @@
// Aseprite Code Generator
// Copyright (c) 2014, 2015 David Capello
// Copyright (c) 2014-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -8,7 +8,7 @@
#include "base/exception.h"
#include "base/file_handle.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/string.h"
#include "gen/common.h"

View File

@ -35,7 +35,7 @@ namespace {
// Memory leak detector wrapper
class MemLeak {
public:
#ifdef MEMLEAK
#ifdef LAF_MEMLEAK
MemLeak() { base_memleak_init(); }
~MemLeak() { base_memleak_exit(); }
#else

@ -1 +1 @@
Subproject commit 83dfe27536785acedb258e55ac762486d95e2ab0
Subproject commit 27fa7f6a4bc7f686da49e6e895ff7dde864b88ad

View File

@ -12,7 +12,7 @@
#include "she/osx/app_delegate.h"
#include "base/path.h"
#include "base/fs.h"
#include "she/event.h"
#include "she/event_queue.h"
#include "she/osx/app.h"

View File

@ -8,7 +8,7 @@
#define SHE_OSX_APP_GENERATE_DROP_FILES_H_INCLUDED
#pragma once
#include "base/path.h"
#include "base/fs.h"
inline void generate_drop_files_from_nsarray(NSArray* filenames)
{

View File

@ -1,5 +1,5 @@
// SHE library
// Copyright (C) 2012-2015 David Capello
// Copyright (C) 2012-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -7,13 +7,12 @@
#include <Cocoa/Cocoa.h>
#include <vector>
#include "base/fs.h"
#include "she/display.h"
#include "she/keys.h"
#include "she/native_cursor.h"
#include "she/osx/native_dialogs.h"
#include "base/path.h"
@interface OpenSaveHelper : NSObject {
@private
NSSavePanel* panel;

View File

@ -1,5 +1,5 @@
// SHE library
// Copyright (C) 2015 David Capello
// Copyright (C) 2015-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -10,7 +10,7 @@
#include "she/win/native_dialogs.h"
#include "base/path.h"
#include "base/fs.h"
#include "base/string.h"
#include "she/display.h"
#include "she/error.h"

View File

@ -13,7 +13,6 @@
#include "base/debug.h"
#include "base/fs.h"
#include "base/log.h"
#include "base/path.h"
#include "base/string.h"
#include <iostream>

View File

@ -13,7 +13,6 @@
#include "base/dll.h"
#include "base/fs.h"
#include "base/log.h"
#include "base/path.h"
#include "base/string.h"
namespace steam {

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -10,7 +10,7 @@
#include "ui/listbox.h"
#include "base/path.h"
#include "base/fs.h"
#include "ui/listitem.h"
#include "ui/message.h"
#include "ui/size_hint_event.h"