|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "texception.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpropertytype.h"
|
|
Toshihiro Shimizu |
890ddd |
//#include "timageinfo.h"
|
|
Toshihiro Shimizu |
890ddd |
//#include "tlevel_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tproperty.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tiio.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Rozhuk Ivan |
ac51ab |
#if !defined(x64) && !defined(__LP64__) && !(defined(LINUX) || defined(FREEBSD)) && !(defined(__GNUC__) && defined(_WIN32))
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// 32-bit version
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
|
e280ae |
#ifdef _MSC_VER
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4996)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
fd19c4 |
#define list QuickTime_list
|
|
Shinya Kitaoka |
fd19c4 |
#define map QuickTime_map
|
|
Shinya Kitaoka |
fd19c4 |
#define iterator QuickTime_iterator
|
|
Shinya Kitaoka |
fd19c4 |
#define float_t QuickTime_float_t
|
|
Shinya Kitaoka |
fd19c4 |
#define GetProcessInformation QuickTime_GetProcessInformation
|
|
Shinya Kitaoka |
fd19c4 |
#define int_fast8_t QuickTime_int_fast8_t
|
|
Shinya Kitaoka |
fd19c4 |
#define int_fast16_t QuickTime_int_fast16_t
|
|
Shinya Kitaoka |
fd19c4 |
#define uint_fast16_t QuickTime_uint_fast16_t
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "QTML.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "Movies.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "Script.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "FixMath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "Sound.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "QuickTimeComponents.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tquicktime.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef list
|
|
Toshihiro Shimizu |
890ddd |
#undef map
|
|
Toshihiro Shimizu |
890ddd |
#undef iterator
|
|
Toshihiro Shimizu |
890ddd |
#undef float_t
|
|
Shinya Kitaoka |
fd19c4 |
#undef GetProcessInformation
|
|
Shinya Kitaoka |
fd19c4 |
#undef int_fast8_t
|
|
Shinya Kitaoka |
fd19c4 |
#undef int_fast16_t
|
|
Shinya Kitaoka |
fd19c4 |
#undef uint_fast16_t
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define list List
|
|
Toshihiro Shimizu |
890ddd |
#define map Map
|
|
Toshihiro Shimizu |
890ddd |
#define iterator Iterator
|
|
Toshihiro Shimizu |
890ddd |
#define float_t Float_t
|
|
Toshihiro Shimizu |
890ddd |
#include <carbon carbon.h=""></carbon>
|
|
Toshihiro Shimizu |
890ddd |
#include <quicktime movies.h=""></quicktime>
|
|
Toshihiro Shimizu |
890ddd |
#include <quicktime imagecompression.h=""></quicktime>
|
|
Toshihiro Shimizu |
890ddd |
#include <quicktime quicktimecomponents.h=""></quicktime>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef list
|
|
Toshihiro Shimizu |
890ddd |
#undef map
|
|
Toshihiro Shimizu |
890ddd |
#undef iterator
|
|
Toshihiro Shimizu |
890ddd |
#undef float_t
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Shinya Kitaoka |
120a6e |
questo file gestisce il salvataggio in un .tnz e il caricamento dei setting dei
|
|
Shinya Kitaoka |
120a6e |
mov.
|
|
Shinya Kitaoka |
120a6e |
viene usato il popup fornito da quicktime, con tutti i suoi setting e i sotto
|
|
Shinya Kitaoka |
120a6e |
settings.
|
|
Shinya Kitaoka |
120a6e |
i setting sono memorizzati da quicktime in un componentInstance. Da qui, possono
|
|
Shinya Kitaoka |
120a6e |
essere convertiti in un atomContainer,
|
|
Shinya Kitaoka |
120a6e |
che e' una struttura simile alla nostra propertyGroup, ma con gli atomi
|
|
Shinya Kitaoka |
120a6e |
strutturati ad albero.
|
|
Shinya Kitaoka |
120a6e |
sono state scritte due funzioni di conversione da atomContainer a propertygroup
|
|
Shinya Kitaoka |
120a6e |
e viceversa
|
|
Shinya Kitaoka |
120a6e |
ogni atom ha un type, id, e numero figli. se numero figli=0 allora l'atomo e'una
|
|
Shinya Kitaoka |
120a6e |
foglia,
|
|
Toshihiro Shimizu |
890ddd |
e quindi ha un buffer di dati di valori char.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ogni atomo viene trasformato in una stringProperty. il nome della stringProperty
|
|
Shinya Kitaoka |
120a6e |
e'
|
|
Toshihiro Shimizu |
890ddd |
"type id numeroFigli"
|
|
Shinya Kitaoka |
120a6e |
se numerofigli>0, allora la stringProperty ha un valore nullo, e le prossime
|
|
Shinya Kitaoka |
120a6e |
numerofigli property contengono i figli;
|
|
Shinya Kitaoka |
120a6e |
se numerofigli==0, allora il valore della property contiene il buffer di dati,
|
|
Toshihiro Shimizu |
890ddd |
convertito in stringa.
|
|
Toshihiro Shimizu |
890ddd |
ecco coem viene convertito il buffer in stringa:
|
|
Shinya Kitaoka |
120a6e |
se ad esempio il buffer e' composto di 3 bytes, buf[0] = 13 buf[1]=0 buf[2]=231
|
|
Shinya Kitaoka |
120a6e |
allora la strnga valore sara' "13 0 231"
|
|
Shinya Kitaoka |
120a6e |
se ci sono piu 0 consecutivi, vengono memorizzati per salvare spazio come "z
|
|
Shinya Kitaoka |
120a6e |
count" in cui count e' il numero di 0.
|
|
Toshihiro Shimizu |
890ddd |
esempio: buf[0] = 13 buf[1]=0 buf[2]=0 buf[3]=0 buf[4]=0 buf5]=231
|
|
Toshihiro Shimizu |
890ddd |
allora str = "13 z 4 231"
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "movsettings.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void visitAtoms(const QTAtomContainer &atoms, const QTAtom &parent,
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup &pg) {
|
|
Shinya Kitaoka |
120a6e |
QTAtom curr = 0;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
do {
|
|
Shinya Kitaoka |
120a6e |
if (QTNextChildAnyType(atoms, parent, curr, &curr) != noErr) assert(false);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (curr == 0) break;
|
|
Shinya Kitaoka |
120a6e |
QTAtomType atomType;
|
|
Shinya Kitaoka |
120a6e |
QTAtomID id;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QTGetAtomTypeAndID(atoms, curr, &atomType, &id);
|
|
Shinya Kitaoka |
120a6e |
int sonCount = QTCountChildrenOfType(atoms, curr, 0);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
char buffer[1024];
|
|
Rozhuk Ivan |
823a31 |
snprintf(buffer, sizeof(buffer), "%d %d %d",
|
|
Rozhuk Ivan |
823a31 |
(int)atomType, (int)id, sonCount);
|
|
Shinya Kitaoka |
120a6e |
string str(buffer);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (sonCount > 0) {
|
|
Shinya Kitaoka |
120a6e |
pg.add(new TStringProperty(str, TString()));
|
|
Shinya Kitaoka |
120a6e |
visitAtoms(atoms, curr, pg);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
long size;
|
|
Shinya Kitaoka |
120a6e |
UCHAR *atomData;
|
|
Shinya Kitaoka |
120a6e |
if (QTGetAtomDataPtr(atoms, curr, &size, (char **)&atomData) != noErr)
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
string strapp;
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < size; i++) {
|
|
Shinya Kitaoka |
120a6e |
string num;
|
|
Shinya Kitaoka |
120a6e |
if (atomData[i] == 0) {
|
|
Shinya Kitaoka |
120a6e |
int count = 1;
|
|
Shinya Kitaoka |
120a6e |
while ((i + 1) < size && atomData[i + 1] == 0) i++, count++;
|
|
Shinya Kitaoka |
120a6e |
if (count > 1) {
|
|
Shinya Kitaoka |
120a6e |
num = std::to_string(count);
|
|
Shinya Kitaoka |
120a6e |
strapp = strapp + "z " + num + " ";
|
|
Shinya Kitaoka |
120a6e |
continue;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
num = std::to_string(atomData[i]);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
strapp = strapp + string(num) + " ";
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// unsigned short*buffer = new unsigned short[size];
|
|
Shinya Kitaoka |
120a6e |
// buffer[size]=0;
|
|
Shinya Kitaoka |
120a6e |
// for (i=0; i
|
|
Shinya Kitaoka |
120a6e |
// buffer[i] = atomData[i]+1;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
wstring data = ::to_wstring(strapp);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
pg.add(new TStringProperty(str, data));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} while (curr != 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
namespace {
|
|
Shinya Kitaoka |
120a6e |
void compareAtoms(const QTAtomContainer &atoms1, QTAtom parent1,
|
|
Shinya Kitaoka |
120a6e |
const QTAtomContainer &atoms2, QTAtom parent2) {
|
|
Shinya Kitaoka |
120a6e |
QTAtom curr1 = 0, curr2 = 0;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
assert(QTCountChildrenOfType(atoms1, parent1, 0) ==
|
|
Shinya Kitaoka |
120a6e |
QTCountChildrenOfType(atoms2, parent2, 0));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
do {
|
|
Shinya Kitaoka |
120a6e |
if (QTNextChildAnyType(atoms1, parent1, curr1, &curr1) != noErr)
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (QTNextChildAnyType(atoms2, parent2, curr2, &curr2) != noErr)
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
assert((curr1 != 0 && curr2 != 0) || (curr1 == 0 && curr2 == 0));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
if (curr1 == 0 || curr2 == 0) break;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QTAtomType atomType1, atomType2;
|
|
Shinya Kitaoka |
120a6e |
QTAtomID id1, id2;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QTGetAtomTypeAndID(atoms1, curr1, &atomType1, &id1);
|
|
Shinya Kitaoka |
120a6e |
QTGetAtomTypeAndID(atoms2, curr2, &atomType2, &id2);
|
|
Shinya Kitaoka |
120a6e |
assert(atomType1 == atomType2);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int sonCount1 = QTCountChildrenOfType(atoms1, curr1, 0);
|
|
Shinya Kitaoka |
120a6e |
int sonCount2 = QTCountChildrenOfType(atoms2, curr2, 0);
|
|
Shinya Kitaoka |
120a6e |
assert(sonCount1 == sonCount2);
|
|
Shinya Kitaoka |
120a6e |
if (sonCount1 > 0)
|
|
Shinya Kitaoka |
120a6e |
compareAtoms(atoms1, curr1, atoms2, curr2);
|
|
Shinya Kitaoka |
120a6e |
else {
|
|
Shinya Kitaoka |
120a6e |
long size1;
|
|
Shinya Kitaoka |
120a6e |
UCHAR *atomData1;
|
|
Shinya Kitaoka |
120a6e |
long size2;
|
|
Shinya Kitaoka |
120a6e |
UCHAR *atomData2;
|
|
Shinya Kitaoka |
120a6e |
if (QTGetAtomDataPtr(atoms1, curr1, &size1, (char **)&atomData1) != noErr)
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
if (QTGetAtomDataPtr(atoms2, curr2, &size2, (char **)&atomData2) != noErr)
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
assert(size1 == size2);
|
|
Shinya Kitaoka |
120a6e |
for (int i = 0; i < size1; i++) assert(atomData1[i] == atomData2[i]);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
} while (curr1 != 0 && curr2 != 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void fromAtomsToProperties(const QTAtomContainer &atoms, TPropertyGroup &pg) {
|
|
Shinya Kitaoka |
120a6e |
pg.clear();
|
|
Shinya Kitaoka |
120a6e |
visitAtoms(atoms, kParentAtomIsContainer, pg);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
void visitprops(TPropertyGroup &pg, int &index, QTAtomContainer &atoms,
|
|
Shinya Kitaoka |
120a6e |
QTAtom parent) {
|
|
Shinya Kitaoka |
120a6e |
int count = pg.getPropertyCount();
|
|
Shinya Kitaoka |
120a6e |
while (index < count) {
|
|
Shinya Kitaoka |
120a6e |
TStringProperty *p = (TStringProperty *)pg.getProperty(index++);
|
|
Shinya Kitaoka |
120a6e |
string str0 = p->getName();
|
|
Shinya Kitaoka |
120a6e |
const char *buf = str0.c_str();
|
|
Shinya Kitaoka |
120a6e |
int atomType, id, sonCount;
|
|
Shinya Kitaoka |
120a6e |
sscanf(buf, "%d %d %d", &atomType, &id, &sonCount);
|
|
Shinya Kitaoka |
120a6e |
QTAtom newAtom;
|
|
Shinya Kitaoka |
120a6e |
if (sonCount == 0) {
|
|
Shinya Kitaoka |
120a6e |
wstring appow = p->getValue();
|
|
Shinya Kitaoka |
120a6e |
string appo = ::to_string(appow);
|
|
Shinya Kitaoka |
120a6e |
const char *str = appo.c_str();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
vector<uchar> buf;</uchar>
|
|
Shinya Kitaoka |
120a6e |
while (strlen(str) > 0) {
|
|
Shinya Kitaoka |
120a6e |
if (str[0] == 'z') {
|
|
Shinya Kitaoka |
120a6e |
int count = atoi(str + 1);
|
|
Shinya Kitaoka |
120a6e |
str += (count < 10) ? 4 : ((count < 100) ? 5 : 6);
|
|
Shinya Kitaoka |
120a6e |
while (count--) buf.push_back(0);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
int val = atoi(str);
|
|
Shinya Kitaoka |
120a6e |
assert(val >= 0 && val < 256);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
str += (val < 10) ? 2 : ((val < 100) ? 3 : 4);
|
|
Shinya Kitaoka |
120a6e |
buf.push_back(val);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
// const unsigned short*bufs = str1.c_str();
|
|
Shinya Kitaoka |
120a6e |
// UCHAR *bufc = new UCHAR[size];
|
|
Shinya Kitaoka |
120a6e |
// for (int i=0; i
|
|
Shinya Kitaoka |
120a6e |
// {
|
|
Shinya Kitaoka |
120a6e |
// assert(bufs[i]<257);
|
|
Shinya Kitaoka |
120a6e |
// bufc[i] = (UCHAR)(bufs[i]-1);
|
|
Shinya Kitaoka |
120a6e |
// }
|
|
Shinya Kitaoka |
120a6e |
void *ptr = 0;
|
|
Shinya Kitaoka |
120a6e |
if (buf.size() != 0) {
|
|
Shinya Kitaoka |
120a6e |
ptr = &(buf[0]);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
QTInsertChild(atoms, parent, (QTAtomType)atomType, (QTAtomID)id, 0,
|
|
Shinya Kitaoka |
120a6e |
buf.size(), (void *)ptr, 0);
|
|
Shinya Kitaoka |
120a6e |
} else {
|
|
Shinya Kitaoka |
120a6e |
QTInsertChild(atoms, parent, (QTAtomType)atomType, (QTAtomID)id, 0, 0, 0,
|
|
Shinya Kitaoka |
120a6e |
&newAtom);
|
|
Shinya Kitaoka |
120a6e |
visitprops(pg, index, atoms, newAtom);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void fromPropertiesToAtoms(TPropertyGroup &pg, QTAtomContainer &atoms) {
|
|
Shinya Kitaoka |
120a6e |
int index = 0;
|
|
Shinya Kitaoka |
120a6e |
visitprops(pg, index, atoms, kParentAtomIsContainer);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SCExtendedProcs gProcStruct, ptr;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
static Boolean QTCmpr_FilterProc
|
|
Shinya Kitaoka |
120a6e |
(DialogPtr theDialog, EventRecord *theEvent,
|
|
Toshihiro Shimizu |
890ddd |
short *theItemHit, long theRefCon)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
#pragma unused(theItemHit, theRefCon)
|
|
Toshihiro Shimizu |
890ddd |
Boolean myEventHandled = false;
|
|
Toshihiro Shimizu |
890ddd |
WindowRef myEventWindow = NULL;
|
|
Toshihiro Shimizu |
890ddd |
WindowRef myDialogWindow = NULL;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
myDialogWindow = GetDialogWindow(theDialog);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
switch (theEvent->what) {
|
|
Toshihiro Shimizu |
890ddd |
case updateEvt:
|
|
Toshihiro Shimizu |
890ddd |
myEventWindow = (WindowRef)theEvent->message;
|
|
Shinya Kitaoka |
120a6e |
// Change the window class
|
|
Toshihiro Shimizu |
890ddd |
HIWindowChangeClass(myEventWindow,kUtilityWindowClass);
|
|
Shinya Kitaoka |
120a6e |
// Activate the window scope
|
|
Shinya Kitaoka |
120a6e |
SetWindowActivationScope(myEventWindow,kWindowActivationScopeAll);
|
|
Shinya Kitaoka |
120a6e |
// Set the brushed metal theme on the window
|
|
Shinya Kitaoka |
120a6e |
SetThemeWindowBackground(myEventWindow,kThemeBrushUtilityWindowBackgroundActive,true);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Toshihiro Shimizu |
890ddd |
return(myEventHandled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void openMovSettingsPopup(TPropertyGroup *props, bool macBringToFront) {
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Shinya Kitaoka |
120a6e |
if (InitializeQTML(0) != noErr) return;
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ComponentInstance ci =
|
|
Shinya Kitaoka |
120a6e |
OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QTAtomContainer atoms;
|
|
Shinya Kitaoka |
120a6e |
QTNewAtomContainer(&atoms);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
fromPropertiesToAtoms(*props, atoms);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ComponentResult err;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if ((err = SCSetSettingsFromAtomContainer(ci, atoms)) != noErr) {
|
|
Shinya Kitaoka |
120a6e |
CloseComponent(ci);
|
|
Shinya Kitaoka |
120a6e |
ci = OpenDefaultComponent(StandardCompressionType,
|
|
Shinya Kitaoka |
120a6e |
StandardCompressionSubType);
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QTDisposeAtomContainer(atoms);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Install an external procedure to use a callback filter on the request
|
|
Shinya Kitaoka |
120a6e |
// settings dialog
|
|
Shinya Kitaoka |
120a6e |
// On MACOSX we need to change the dialog appearance in order to pop-up in front
|
|
Shinya Kitaoka |
120a6e |
// of the
|
|
Toshihiro Shimizu |
890ddd |
// toonz main window.
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
gProcStruct.filterProc = NewSCModalFilterUPP(QTCmpr_FilterProc);
|
|
Toshihiro Shimizu |
890ddd |
// I don't install any hook
|
|
Toshihiro Shimizu |
890ddd |
gProcStruct.hookProc = NULL;
|
|
Toshihiro Shimizu |
890ddd |
gProcStruct.customName[0] = 0;
|
|
Shinya Kitaoka |
120a6e |
// I don't use refcon
|
|
Toshihiro Shimizu |
890ddd |
gProcStruct.refcon = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// set the current extended procs
|
|
Toshihiro Shimizu |
890ddd |
SCSetInfo(ci, scExtendedProcsType, &gProcStruct);
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
err = SCRequestSequenceSettings(ci);
|
|
Shinya Kitaoka |
120a6e |
// assert(err==noErr);
|
|
Shinya Kitaoka |
120a6e |
QTAtomContainer atomsOut;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
if (SCGetSettingsAsAtomContainer(ci, &atomsOut) != noErr) assert(false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
fromAtomsToProperties(atomsOut, *props);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QTDisposeAtomContainer(atomsOut);
|
|
Shinya Kitaoka |
120a6e |
CloseComponent(ci);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// int dataSize=0, numChildren = 0, numLevels=0;
|
|
Shinya Kitaoka |
120a6e |
// retrieveData(settings, kParentAtomIsContainer, dataSize, numChildren,
|
|
Shinya Kitaoka |
120a6e |
// numLevels);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool Tiio::isQuicktimeInstalled() {
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Shinya Kitaoka |
120a6e |
return true;
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
static int ret = -1;
|
|
Shinya Kitaoka |
120a6e |
if (ret == -1) ret = (InitializeQTML(0) == noErr) ? 1 : 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
return (ret == 1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#else // x64
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// 64-bit proxied version
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Toonz includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// tipc includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tipc.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "t32bitsrv_wrap.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// MAC-Specific includes
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
#include <applicationservices applicationservices.h=""></applicationservices>
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "movsettings.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Using 32-bit background server correspondence to achieve the same result
|
|
Shinya Kitaoka |
120a6e |
void openMovSettingsPopup(TPropertyGroup *props, bool unused) {
|
|
Shinya Kitaoka |
120a6e |
QLocalSocket socket;
|
|
Shinya Kitaoka |
120a6e |
if (!tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), 3000,
|
|
Shinya Kitaoka |
120a6e |
t32bitsrv::srvCmdline(), "_main"))
|
|
Shinya Kitaoka |
120a6e |
return;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Send the appropriate commands to the server
|
|
Shinya Kitaoka |
120a6e |
tipc::Stream stream(&socket);
|
|
Shinya Kitaoka |
120a6e |
tipc::Message msg;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// We'll communicate through temporary files.
|
|
Shinya Kitaoka |
120a6e |
stream << (msg << QString("$tmpfile_request") << QString("openMovSets"));
|
|
Shinya Kitaoka |
120a6e |
QString res(tipc::readMessage(stream, msg));
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
QString fp;
|
|
Shinya Kitaoka |
120a6e |
msg >> fp;
|
|
Shinya Kitaoka |
120a6e |
assert(res == "ok" && !fp.isEmpty());
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TFilePath tfp(fp.toStdWString());
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
// Save the input props to the temporary file
|
|
Shinya Kitaoka |
120a6e |
TOStream os(tfp);
|
|
Shinya Kitaoka |
120a6e |
props->saveData(os);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Invoke the settings popup
|
|
Shinya Kitaoka |
120a6e |
stream << (msg << tipc::clr << QString("$openMovSettingsPopup") << fp);
|
|
Shinya Kitaoka |
120a6e |
res =
|
|
Shinya Kitaoka |
120a6e |
tipc::readMessageNB(stream, msg, -1, QEventLoop::ExcludeUserInputEvents);
|
|
Shinya Kitaoka |
120a6e |
assert(res == "ok");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Bring this application back to front
|
|
Shinya Kitaoka |
120a6e |
ProcessSerialNumber psn = {0, kCurrentProcess};
|
|
Shinya Kitaoka |
120a6e |
SetFrontProcess(&psn);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // MACOSX
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
props->clear();
|
|
Shinya Kitaoka |
120a6e |
{
|
|
Shinya Kitaoka |
120a6e |
// Save the input props to the temporary file
|
|
Shinya Kitaoka |
120a6e |
TIStream is(tfp);
|
|
Shinya Kitaoka |
120a6e |
props->loadData(is);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Release the temporary file
|
|
Shinya Kitaoka |
120a6e |
stream << (msg << tipc::clr << QString("$tmpfile_release")
|
|
Shinya Kitaoka |
120a6e |
<< QString("openMovSets"));
|
|
Shinya Kitaoka |
120a6e |
res = tipc::readMessage(stream, msg);
|
|
Shinya Kitaoka |
120a6e |
assert(res == "ok");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool Tiio::isQuicktimeInstalled() {
|
|
Shinya Kitaoka |
120a6e |
// NOTE: This is *NOT* the same function as IsQuickTimeInstalled(), which is
|
|
Shinya Kitaoka |
120a6e |
// implemented locally in the image lib and used there. This function here is
|
|
Shinya Kitaoka |
120a6e |
// actually NEVER USED throughout Toonz, so we're placing a dummy
|
|
Shinya Kitaoka |
120a6e |
// implementation here.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
assert(false);
|
|
Shinya Kitaoka |
120a6e |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // else
|