|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "thumbnail.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorrenderdata.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tlevel_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpalette.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsystem.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsound_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trop.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/mainshell.h"
|
|
Toshihiro Shimizu |
890ddd |
//#include "zapplication.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/dragdrop.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/message.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "pixmapFiletype.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tofflinegl.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Thumbnail::Thumbnail(const TDimension &size)
|
|
Toshihiro Shimizu |
890ddd |
: m_currentFrameIndex(0), m_iconLoaded(false), m_playing(false), m_size(size), m_raster()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_raster = TRaster32P(m_size);
|
|
Toshihiro Shimizu |
890ddd |
m_raster->fill(TPixel32(100, 100, 100));
|
|
Toshihiro Shimizu |
890ddd |
m_raster->extractT(
|
|
Toshihiro Shimizu |
890ddd |
m_raster->getBounds().enlarge(-20))
|
|
Toshihiro Shimizu |
890ddd |
->fill(TPixel32(80, 90, 100));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Thumbnail::~Thumbnail()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_frames);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void Thumbnail::addFrame(const TFrameId &fid)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_frames.push_back(new Frame(fid));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool Thumbnail::gotoFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(m_playing);
|
|
Toshihiro Shimizu |
890ddd |
if (m_currentFrameIndex == index)
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
if (index < 0 || index >= (int)m_frames.size())
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
m_currentFrameIndex = index;
|
|
Toshihiro Shimizu |
890ddd |
m_raster = TRaster32P();
|
|
Toshihiro Shimizu |
890ddd |
if (!m_frames[index]->m_raster)
|
|
Toshihiro Shimizu |
890ddd |
loadFrame(index);
|
|
Toshihiro Shimizu |
890ddd |
m_raster = m_frames[index]->m_raster;
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TAffine Thumbnail::getAffine(const TDimension &cameraSize) const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
double scx = 1 * m_size.lx / (double)cameraSize.lx;
|
|
Toshihiro Shimizu |
890ddd |
double scy = 1 * m_size.ly / (double)cameraSize.ly;
|
|
Toshihiro Shimizu |
890ddd |
double sc = tmin(scx, scy);
|
|
Toshihiro Shimizu |
890ddd |
double dx = (m_size.lx - cameraSize.lx * sc) * 0.5;
|
|
Toshihiro Shimizu |
890ddd |
double dy = (m_size.ly - cameraSize.ly * sc) * 0.5;
|
|
Toshihiro Shimizu |
890ddd |
return TScale(sc) * TTranslation(0.5 * TPointD(cameraSize.lx, cameraSize.ly) + TPointD(dx, dy));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Pli Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class PliThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderP m_lr;
|
|
Toshihiro Shimizu |
890ddd |
TPaletteP m_palette;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
PliThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
PliThumbnail(const PliThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
PliThumbnail &operator=(const PliThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PliThumbnail::PliThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp), m_lr()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PliThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_frames);
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP(m_filepath);
|
|
Toshihiro Shimizu |
890ddd |
TLevelP level = m_lr->loadInfo();
|
|
Toshihiro Shimizu |
890ddd |
m_palette = level->getPalette();
|
|
Toshihiro Shimizu |
890ddd |
for (TLevel::Iterator it = level->begin(); it != level->end(); ++it)
|
|
Toshihiro Shimizu |
890ddd |
addFrame(it->first);
|
|
Toshihiro Shimizu |
890ddd |
loadFrame(0);
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
m_raster = m_frames[0]->m_raster;
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
void doRender(const TVectorImageP &vi, const TVectorRenderData &rd,
|
|
Toshihiro Shimizu |
890ddd |
const TRaster32P &ras)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TOfflineGL *glContext = TOfflineGL::getStock(ras->getSize());
|
|
Toshihiro Shimizu |
890ddd |
glContext->getRaster()->copy(ras);
|
|
Toshihiro Shimizu |
890ddd |
glContext->draw(vi, rd);
|
|
Toshihiro Shimizu |
890ddd |
ras->copy(glContext->getRaster());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
void PliThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(0 <= index && index < (int)m_frames.size());
|
|
Toshihiro Shimizu |
890ddd |
if (!m_lr) {
|
|
Toshihiro Shimizu |
890ddd |
assert(m_playing);
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP(m_filepath);
|
|
Toshihiro Shimizu |
890ddd |
m_lr->loadInfo();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
TVectorImageP vi =
|
|
Toshihiro Shimizu |
890ddd |
m_lr->getFrameReader(m_frames[index]->m_fid)->load();
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P &raster = m_frames[index]->m_raster;
|
|
Toshihiro Shimizu |
890ddd |
raster = TRaster32P(m_size);
|
|
Toshihiro Shimizu |
890ddd |
if (vi) {
|
|
Toshihiro Shimizu |
890ddd |
raster->fill(TPixel32::White);
|
|
Toshihiro Shimizu |
890ddd |
TDimension cameraSize(640, 480);
|
|
Toshihiro Shimizu |
890ddd |
const TVectorRenderData rd(
|
|
Toshihiro Shimizu |
890ddd |
getAffine(cameraSize),
|
|
Toshihiro Shimizu |
890ddd |
TRect(), //raster->getBounds(),
|
|
Toshihiro Shimizu |
890ddd |
m_palette.getPointer(),
|
|
Toshihiro Shimizu |
890ddd |
0);
|
|
Toshihiro Shimizu |
890ddd |
//vi->render(rd,raster);
|
|
Toshihiro Shimizu |
890ddd |
doRender(vi, rd, raster);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
raster->fill(TPixel32(255, 0, 0));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void PliThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
if (!m_playing) {
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
m_palette = TPaletteP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Raster Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class RasterThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderP m_lr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
RasterThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
RasterThumbnail(const RasterThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
RasterThumbnail &operator=(const RasterThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
RasterThumbnail::RasterThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp), m_lr()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RasterThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_frames);
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP(m_filepath);
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
TLevelP level = m_lr->loadInfo();
|
|
Toshihiro Shimizu |
890ddd |
if (level && level->getFrameCount() != 0) {
|
|
Toshihiro Shimizu |
890ddd |
for (TLevel::Iterator it = level->begin(); it != level->end(); ++it)
|
|
Toshihiro Shimizu |
890ddd |
addFrame(it->first);
|
|
Toshihiro Shimizu |
890ddd |
loadFrame(0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_raster = m_frames[0]->m_raster;
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
m_raster = TRaster32P(m_size);
|
|
Toshihiro Shimizu |
890ddd |
m_raster->fill(TPixel32::Red);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} catch (TException &e) {
|
|
Toshihiro Shimizu |
890ddd |
TMessage::error(toString(e.getMessage()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_raster = TRaster32P(m_size);
|
|
Toshihiro Shimizu |
890ddd |
m_raster->fill(TPixel32::Red);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RasterThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(0 <= index && index < (int)m_frames.size());
|
|
Toshihiro Shimizu |
890ddd |
if (!m_lr) {
|
|
Toshihiro Shimizu |
890ddd |
assert(m_playing);
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP(m_filepath);
|
|
Toshihiro Shimizu |
890ddd |
m_lr->loadInfo();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
TRasterImageP ri =
|
|
Toshihiro Shimizu |
890ddd |
m_lr->getFrameReader(m_frames[index]->m_fid)->load();
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P &raster = m_frames[index]->m_raster;
|
|
Toshihiro Shimizu |
890ddd |
raster = TRaster32P(m_size);
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P inputRaster;
|
|
Toshihiro Shimizu |
890ddd |
if (ri)
|
|
Toshihiro Shimizu |
890ddd |
inputRaster = ri->getRaster();
|
|
Toshihiro Shimizu |
890ddd |
if (inputRaster) {
|
|
Toshihiro Shimizu |
890ddd |
raster->fill(TPixel32::White);
|
|
Toshihiro Shimizu |
890ddd |
double sx = (double)(raster->getLx()) / (double)(inputRaster->getLx());
|
|
Toshihiro Shimizu |
890ddd |
double sy = (double)(raster->getLy()) / (double)(inputRaster->getLy());
|
|
Toshihiro Shimizu |
890ddd |
double sc = tmin(sx, sy);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TAffine aff = TScale(sc).place(inputRaster->getCenterD(), raster->getCenterD());
|
|
Toshihiro Shimizu |
890ddd |
TRop::resample(raster, inputRaster, aff);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
raster->fill(TPixel32(255, 0, 0));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void RasterThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
if (!m_playing) {
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Soundtrack Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class SoundtrackThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
SoundtrackThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
SoundtrackThumbnail(const SoundtrackThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
SoundtrackThumbnail &operator=(const SoundtrackThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SoundtrackThumbnail::SoundtrackThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SoundtrackThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SoundtrackThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SoundtrackThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
if(!m_playing)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Casm Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class CasmThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
CasmThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
CasmThumbnail(const CasmThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
CasmThumbnail &operator=(const CasmThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CasmThumbnail::CasmThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P icon = casm_browser_icon;
|
|
Toshihiro Shimizu |
890ddd |
if (!icon)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double sx = (double)(m_raster->getLx()) / (double)(icon->getLx());
|
|
Toshihiro Shimizu |
890ddd |
double sy = (double)(m_raster->getLy()) / (double)(icon->getLy());
|
|
Toshihiro Shimizu |
890ddd |
double sc = tmax(sx, sy);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TAffine aff = TScale(sc).place(icon->getCenterD(), m_raster->getCenterD());
|
|
Toshihiro Shimizu |
890ddd |
TRop::resample(m_raster, icon, aff);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void CasmThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
if(!m_playing)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Setup file Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class SetupThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
SetupThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
SetupThumbnail(const SetupThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
SetupThumbnail &operator=(const SetupThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SetupThumbnail::SetupThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SetupThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P icon = setup_browser_icon;
|
|
Toshihiro Shimizu |
890ddd |
if (!icon)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double sx = (double)(m_raster->getLx()) / (double)(icon->getLx());
|
|
Toshihiro Shimizu |
890ddd |
double sy = (double)(m_raster->getLy()) / (double)(icon->getLy());
|
|
Toshihiro Shimizu |
890ddd |
double sc = tmax(sx, sy);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TAffine aff = TScale(sc).place(icon->getCenterD(), m_raster->getCenterD());
|
|
Toshihiro Shimizu |
890ddd |
TRop::resample(m_raster, icon, aff);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SetupThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SetupThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
if(!m_playing)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Txt Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TxtThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TxtThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
TxtThumbnail(const TxtThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
TxtThumbnail &operator=(const TxtThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TxtThumbnail::TxtThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TxtThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TxtThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TxtThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
if(!m_playing)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Script Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ScriptThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ScriptThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return LEVEL; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
ScriptThumbnail(const ScriptThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
ScriptThumbnail &operator=(const ScriptThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ScriptThumbnail::ScriptThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ScriptThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P icon = script_browser_icon;
|
|
Toshihiro Shimizu |
890ddd |
if (!icon)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double sx = (double)(m_raster->getLx()) / (double)(icon->getLx());
|
|
Toshihiro Shimizu |
890ddd |
double sy = (double)(m_raster->getLy()) / (double)(icon->getLy());
|
|
Toshihiro Shimizu |
890ddd |
double sc = tmax(sx, sy);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TAffine aff = TScale(sc).place(icon->getCenterD(), m_raster->getCenterD());
|
|
Toshihiro Shimizu |
890ddd |
TRop::resample(m_raster, icon, aff);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ScriptThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ScriptThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
if(!m_playing)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_lr = TLevelReaderP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Scene Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ZSceneThumbnail : public FileThumbnail
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ZSceneThumbnail(const TDimension &size, const TFilePath &fp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void loadIcon();
|
|
Toshihiro Shimizu |
890ddd |
void loadFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
void setPlaying(bool on);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setName(string name);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Type getType() const { return SCENE; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
ZSceneThumbnail(const ZSceneThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
ZSceneThumbnail &operator=(const ZSceneThumbnail &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ZSceneThumbnail::ZSceneThumbnail(const TDimension &size, const TFilePath &fp)
|
|
Toshihiro Shimizu |
890ddd |
: FileThumbnail(size, fp)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ZSceneThumbnail::loadIcon()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_iconLoaded = true;
|
|
Toshihiro Shimizu |
890ddd |
clearPointerContainer(m_frames);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string name = m_filepath.getName();
|
|
Toshihiro Shimizu |
890ddd |
TFilePath dir = m_filepath.getParentDir();
|
|
Toshihiro Shimizu |
890ddd |
TFilePath iconPath = dir + TFilePath(name + "_files") + "icon.bmp";
|
|
Toshihiro Shimizu |
890ddd |
if (!TFileStatus(iconPath).isReadable())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRasterP ras;
|
|
Toshihiro Shimizu |
890ddd |
TImageReader::load(iconPath, ras);
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P icon = ras;
|
|
Toshihiro Shimizu |
890ddd |
if (!icon)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double sx = (double)(m_raster->getLx()) / (double)(icon->getLx());
|
|
Toshihiro Shimizu |
890ddd |
double sy = (double)(m_raster->getLy()) / (double)(icon->getLy());
|
|
Toshihiro Shimizu |
890ddd |
double sc = tmax(sx, sy);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TAffine aff = TScale(sc).place(icon->getCenterD(), m_raster->getCenterD());
|
|
Toshihiro Shimizu |
890ddd |
TRop::resample(m_raster, icon, aff);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ZSceneThumbnail::loadFrame(int index)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ZSceneThumbnail::setPlaying(bool on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_playing == on)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_playing = on;
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
if(on)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if(m_frames.empty()) loadXsheet();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_xsh = TXsheetP();
|
|
Toshihiro Shimizu |
890ddd |
m_palette = TPaletteP();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void ZSceneThumbnail::setName(string name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(!m_playing);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath oldPath = m_filepath;
|
|
Toshihiro Shimizu |
890ddd |
TFilePath newPath = m_filepath.withName(name);
|
|
Toshihiro Shimizu |
890ddd |
if (oldPath == newPath)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string oldName = m_filepath.getName();
|
|
Toshihiro Shimizu |
890ddd |
TFilePath oldRepository = oldPath.getParentDir() + (oldName + "_files");
|
|
Toshihiro Shimizu |
890ddd |
TFilePath newRepository = newPath.getParentDir() + (name + "_files");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TSystem::renameFile(newPath, oldPath);
|
|
Toshihiro Shimizu |
890ddd |
TSystem::renameFile(newRepository, oldRepository);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_filepath = newPath;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// File Thumbnail
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//============================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FileThumbnail::FileThumbnail(const TDimension &size, const TFilePath &path)
|
|
Toshihiro Shimizu |
890ddd |
: Thumbnail(size), m_filepath(path)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void FileThumbnail::setName(string name)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(!m_playing);
|
|
Toshihiro Shimizu |
890ddd |
TFilePath fp = m_filepath.withName(name);
|
|
Toshihiro Shimizu |
890ddd |
if (fp != m_filepath) {
|
|
Toshihiro Shimizu |
890ddd |
TSystem::renameFile(fp, m_filepath);
|
|
Toshihiro Shimizu |
890ddd |
m_filepath = fp;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
FileThumbnail *FileThumbnail::create(const TDimension &size, const TFilePath &path)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
vector<string> fileTypes;</string>
|
|
Toshihiro Shimizu |
890ddd |
vector<string> soundTypes;</string>
|
|
Toshihiro Shimizu |
890ddd |
TImageReader::getSupportedFormats(fileTypes);
|
|
Toshihiro Shimizu |
890ddd |
TLevelReader::getSupportedFormats(fileTypes);
|
|
Toshihiro Shimizu |
890ddd |
TSoundTrackReader::getSupportedFormats(soundTypes);
|
|
Toshihiro Shimizu |
890ddd |
string type = path.getType();
|
|
Toshihiro Shimizu |
890ddd |
if (type == "pli")
|
|
Toshihiro Shimizu |
890ddd |
return new PliThumbnail(size, path);
|
|
Toshihiro Shimizu |
890ddd |
if (type == "casm")
|
|
Toshihiro Shimizu |
890ddd |
return new CasmThumbnail(size, path);
|
|
Toshihiro Shimizu |
890ddd |
if (type == "setup")
|
|
Toshihiro Shimizu |
890ddd |
return new SetupThumbnail(size, path);
|
|
Toshihiro Shimizu |
890ddd |
if (type == "txt")
|
|
Toshihiro Shimizu |
890ddd |
return new TxtThumbnail(size, path);
|
|
Toshihiro Shimizu |
890ddd |
if (type == "bat" || type == "sh" || type == "csh" || type == "tcsh")
|
|
Toshihiro Shimizu |
890ddd |
return new ScriptThumbnail(size, path);
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
else if (type == ZComp::getApplication()->getSceneFileExt())
|
|
Toshihiro Shimizu |
890ddd |
return new ZSceneThumbnail(size,path);
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
else if (std::find(soundTypes.begin(), soundTypes.end(), type) != soundTypes.end())
|
|
Toshihiro Shimizu |
890ddd |
return new SoundtrackThumbnail(size, path);
|
|
Toshihiro Shimizu |
890ddd |
else if (std::find(fileTypes.begin(), fileTypes.end(), type) != fileTypes.end())
|
|
Toshihiro Shimizu |
890ddd |
return new RasterThumbnail(size, path);
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool FileThumbnail::startDragDrop()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TDropSource dropSource;
|
|
Toshihiro Shimizu |
890ddd |
std::vector<std::string> v;</std::string>
|
|
Toshihiro Shimizu |
890ddd |
v.push_back(toString(m_filepath.getWideString()));
|
|
Toshihiro Shimizu |
890ddd |
TDataObject data(v);
|
|
Toshihiro Shimizu |
890ddd |
dropSource.doDragDrop(data);
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------------------
|