Merge branch 'dev' of git@github.com:dacap/aseprite.git into dev

This commit is contained in:
David Capello 2012-09-15 12:16:10 -03:00
commit b51530e45d
11 changed files with 199 additions and 41 deletions

View File

@ -187,6 +187,7 @@ add_library(aseprite-library
app/color_utils.cpp
app/data_recovery.cpp
app/file_selector.cpp
app/project.cpp
app/widget_loader.cpp
commands/cmd_about.cpp
commands/cmd_advanced_mode.cpp

33
src/app/project.cpp Normal file
View File

@ -0,0 +1,33 @@
/* ASEPRITE
* Copyright (C) 2001-2012 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "app/project.h"
namespace app {
Project::Project()
{
}
Project::~Project()
{
}
} // namespace app

39
src/app/project.h Normal file
View File

@ -0,0 +1,39 @@
/* ASEPRITE
* Copyright (C) 2001-2012 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef APP_PROJECT_H_INCLUDED
#define APP_PROJECT_H_INCLUDED
#include "app/project_observer.h"
#include "base/disable_copying.h"
#include "observable.h"
namespace app {
class Project : public Observable<ProjectObserver> {
public:
Project();
~Project();
private:
DISABLE_COPYING(Project);
};
} // namespace app
#endif

40
src/app/project_event.h Normal file
View File

@ -0,0 +1,40 @@
/* ASEPRITE
* Copyright (C) 2001-2012 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef APP_PROJECT_EVENT_H_INCLUDED
#define APP_PROJECT_EVENT_H_INCLUDED
class Document;
namespace app {
class ProjectEvent {
public:
ProjectEvent(Document* document)
: m_document(document) {
}
Document* document() const { return m_document; }
private:
Document* m_document;
};
} // namespace app
#endif

View File

@ -0,0 +1,36 @@
/* ASEPRITE
* Copyright (C) 2001-2012 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef APP_PROJECT_OBSERVER_H_INCLUDED
#define APP_PROJECT_OBSERVER_H_INCLUDED
#include "app/project_event.h"
namespace app {
class ProjectObserver {
public:
virtual ~ProjectObserver() { }
virtual void dispose() = 0;
virtual void onAddDocument(ProjectEvent& ev) = 0;
virtual void onRemoveDocument(ProjectEvent& ev) = 0;
};
} // namespace app
#endif

View File

@ -1,21 +1,9 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* The floodfill routine.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
// The floodfill routine.
// By Shawn Hargreaves.
// Adapted to ASEPRITE by David Capello
//
// This source file is ditributed under a Allegro license, please
// read allegro4-LICENSE.txt for more information.
#include "config.h"

View File

@ -1,27 +1,11 @@
/* ASEPRITE
* Copyright (C) 2001-2012 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Most code come from original Allegro rotation code:
* By Shawn Hargreaves.
* Flipping routines by Andrew Geers.
* Optimized by Sven Sandberg.
* To C++ templates by David Capello
*/
// Most code come from original Allegro rotation code:
// By Shawn Hargreaves.
// Flipping routines by Andrew Geers.
// Optimized by Sven Sandberg.
// To C++ templates by David Capello
//
// This source file is ditributed under a Allegro license, please
// read allegro4-LICENSE.txt for more information.
#include "config.h"

20
src/she/event_loop.h Normal file
View File

@ -0,0 +1,20 @@
// SHE library
// Copyright (C) 2012 David Capello
//
// This source file is ditributed under a BSD-like license, please
// read LICENSE.txt for more information.
#ifndef SHE_EVENT_LOOP_H_INCLUDED
#define SHE_EVENT_LOOP_H_INCLUDED
namespace she {
class EventLoop {
public:
virtual ~EventLoop() { }
virtual void dispose() = 0;
};
} // namespace she
#endif

View File

@ -8,6 +8,7 @@
#define SHE_H_INCLUDED
#include "she/display.h"
#include "she/event_loop.h"
#include "she/locked_surface.h"
#include "she/scoped_handle.h"
#include "she/scoped_surface_lock.h"

View File

@ -258,6 +258,16 @@ private:
int m_scale;
};
class Alleg4EventLoop : public EventLoop {
public:
Alleg4EventLoop() {
}
void dispose() {
delete this;
}
};
class Alleg4System : public System {
public:
Alleg4System() {
@ -295,6 +305,10 @@ public:
Alleg4Surface::AutoDestroy);
}
EventLoop* createEventLoop() {
return new Alleg4EventLoop();
}
};
static System* g_instance;

View File

@ -14,6 +14,7 @@ namespace she {
class Surface;
class Display;
class EventLoop;
class DisplayCreationException : std::runtime_error {
public:
@ -29,6 +30,7 @@ namespace she {
virtual Display* createDisplay(int width, int height, int scale) = 0;
virtual Surface* createSurface(int width, int height) = 0;
virtual Surface* createSurfaceFromNativeHandle(void* nativeHandle) = 0;
virtual EventLoop* createEventLoop() = 0;
};
System* CreateSystem();