|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef T_THUMBNAIL_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define T_THUMBNAIL_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "traster.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TXshLevel;
|
|
Toshihiro Shimizu |
890ddd |
class TXsheet;
|
|
Toshihiro Shimizu |
890ddd |
class TPalette;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class Thumbnail {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
class Frame {
|
|
Shinya Kitaoka |
120a6e |
public:
|
|
Shinya Kitaoka |
120a6e |
Frame(const TFrameId &fid) : m_fid(fid) {}
|
|
Shinya Kitaoka |
120a6e |
const TFrameId m_fid;
|
|
Shinya Kitaoka |
120a6e |
TRaster32P m_raster;
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
enum Type { LEVEL, SCENE };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
vector m_frames;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_currentFrameIndex;
|
|
Shinya Kitaoka |
120a6e |
bool m_iconLoaded;
|
|
Shinya Kitaoka |
120a6e |
bool m_playing;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDimension m_size;
|
|
Shinya Kitaoka |
120a6e |
TRaster32P m_raster;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
Thumbnail(const TDimension &size);
|
|
Shinya Kitaoka |
120a6e |
virtual ~Thumbnail();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void addFrame(const TFrameId &fid);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool isIconLoaded() const { return m_iconLoaded; }
|
|
Shinya Kitaoka |
120a6e |
bool isPlaying() const { return m_playing; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// post: assert(m_iconLoaded); assert(m_raster);
|
|
Shinya Kitaoka |
120a6e |
virtual void loadIcon() = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// pre: 0<=index && index
|
|
Shinya Kitaoka |
120a6e |
// post: assert(m_frames[index]);
|
|
Shinya Kitaoka |
120a6e |
virtual void loadFrame(int index) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
virtual void setPlaying(bool on) = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
virtual string getName() const { return ""; }
|
|
Shinya Kitaoka |
120a6e |
virtual TFilePath getPath() const { return "__none__"; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
virtual Type getType() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// pre: assert(!m_playing);
|
|
Shinya Kitaoka |
120a6e |
virtual void setName(string name) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const TRaster32P &getRaster() const { return m_raster; }
|
|
Shinya Kitaoka |
120a6e |
TDimension getSize() const { return m_size; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool nextFrame() { return gotoFrame(m_currentFrameIndex + 1); }
|
|
Shinya Kitaoka |
120a6e |
int getCurrentFrameIndex() { return m_currentFrameIndex; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// pre: assert(m_playing)
|
|
Shinya Kitaoka |
120a6e |
bool gotoFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TAffine getAffine(const TDimension &cameraSize) const;
|
|
Shinya Kitaoka |
120a6e |
virtual bool startDragDrop() { return false; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// not implemented
|
|
Shinya Kitaoka |
120a6e |
Thumbnail(const Thumbnail &);
|
|
Shinya Kitaoka |
120a6e |
Thumbnail &operator=(const Thumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class LevelThumbnail : public Thumbnail {
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
TXshLevel *m_level;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
LevelThumbnail(const TDimension &size, TXshLevel *level);
|
|
Shinya Kitaoka |
120a6e |
~LevelThumbnail();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void loadIcon();
|
|
Shinya Kitaoka |
120a6e |
void loadFrame(int index);
|
|
Shinya Kitaoka |
120a6e |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
string getName() const;
|
|
Shinya Kitaoka |
120a6e |
TFilePath getPath() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setName(string name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// not implemented
|
|
Shinya Kitaoka |
120a6e |
LevelThumbnail(const LevelThumbnail &);
|
|
Shinya Kitaoka |
120a6e |
LevelThumbnail &operator=(const LevelThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class SceneThumbnail : public Thumbnail {
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
string m_name;
|
|
Shinya Kitaoka |
120a6e |
TXsheet *m_xsheet;
|
|
Shinya Kitaoka |
120a6e |
TPalette *m_palette;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SceneThumbnail(const TDimension &size, TXsheet *xsheet, TPalette *palette);
|
|
Shinya Kitaoka |
120a6e |
~SceneThumbnail();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void loadIcon();
|
|
Shinya Kitaoka |
120a6e |
void loadFrame(int index);
|
|
Shinya Kitaoka |
120a6e |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
string getName() const;
|
|
Shinya Kitaoka |
120a6e |
TFilePath getPath() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Type getType() const { return SCENE; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setName(string name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// not implemented
|
|
Shinya Kitaoka |
120a6e |
SceneThumbnail(const LevelThumbnail &);
|
|
Shinya Kitaoka |
120a6e |
SceneThumbnail &operator=(const LevelThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class FileThumbnail : public Thumbnail {
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
TFilePath m_filepath;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
FileThumbnail(const TDimension &size, const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
string getName() const { return m_filepath.getName(); }
|
|
Shinya Kitaoka |
120a6e |
TFilePath getPath() const { return m_filepath; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setName(string name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
static FileThumbnail *create(const TDimension &size, const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool startDragDrop();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// not implemented
|
|
Shinya Kitaoka |
120a6e |
FileThumbnail(const FileThumbnail &);
|
|
Shinya Kitaoka |
120a6e |
FileThumbnail &operator=(const FileThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|