|
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 |
|
|
Toshihiro Shimizu |
890ddd |
#if !(defined(x64) || defined(__LP64__))
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// 32-bit version
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4996)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
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 |
|
|
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
|
|
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 |
/*
|
|
Toshihiro Shimizu |
890ddd |
questo file gestisce il salvataggio in un .tnz e il caricamento dei setting dei mov.
|
|
Toshihiro Shimizu |
890ddd |
viene usato il popup fornito da quicktime, con tutti i suoi setting e i sotto settings.
|
|
Toshihiro Shimizu |
890ddd |
i setting sono memorizzati da quicktime in un componentInstance. Da qui, possono essere convertiti in un atomContainer,
|
|
Toshihiro Shimizu |
890ddd |
che e' una struttura simile alla nostra propertyGroup, ma con gli atomi strutturati ad albero.
|
|
Toshihiro Shimizu |
890ddd |
sono state scritte due funzioni di conversione da atomContainer a propertygroup e viceversa
|
|
Toshihiro Shimizu |
890ddd |
ogni atom ha un type, id, e numero figli. se numero figli=0 allora l'atomo e'una foglia,
|
|
Toshihiro Shimizu |
890ddd |
e quindi ha un buffer di dati di valori char.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ogni atomo viene trasformato in una stringProperty. il nome della stringProperty e'
|
|
Toshihiro Shimizu |
890ddd |
"type id numeroFigli"
|
|
Toshihiro Shimizu |
890ddd |
se numerofigli>0, allora la stringProperty ha un valore nullo, e le prossime
|
|
Toshihiro Shimizu |
890ddd |
numerofigli property contengono i figli;
|
|
Toshihiro Shimizu |
890ddd |
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:
|
|
Toshihiro Shimizu |
890ddd |
se ad esempio il buffer e' composto di 3 bytes, buf[0] = 13 buf[1]=0 buf[2]=231 allora la strnga valore sara' "13 0 231"
|
|
Toshihiro Shimizu |
890ddd |
se ci sono piu 0 consecutivi, vengono memorizzati per salvare spazio come "z 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 |
|
|
Toshihiro Shimizu |
890ddd |
void visitAtoms(const QTAtomContainer &atoms, const QTAtom &parent, TPropertyGroup &pg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QTAtom curr = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
do {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (QTNextChildAnyType(atoms, parent, curr, &curr) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (curr == 0)
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
QTAtomType atomType;
|
|
Toshihiro Shimizu |
890ddd |
QTAtomID id;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QTGetAtomTypeAndID(atoms, curr, &atomType, &id);
|
|
Toshihiro Shimizu |
890ddd |
int sonCount = QTCountChildrenOfType(atoms, curr, 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
char buffer[1024];
|
|
Toshihiro Shimizu |
890ddd |
sprintf(buffer, "%d %d %d", (int)atomType, (int)id, sonCount);
|
|
Toshihiro Shimizu |
890ddd |
string str(buffer);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (sonCount > 0) {
|
|
Toshihiro Shimizu |
890ddd |
pg.add(new TStringProperty(str, TString()));
|
|
Toshihiro Shimizu |
890ddd |
visitAtoms(atoms, curr, pg);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
else {
|
|
Toshihiro Shimizu |
890ddd |
long size;
|
|
Toshihiro Shimizu |
890ddd |
UCHAR *atomData;
|
|
Toshihiro Shimizu |
890ddd |
if (QTGetAtomDataPtr(atoms, curr, &size, (char **)&atomData) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string strapp;
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < size; i++) {
|
|
Toshihiro Shimizu |
890ddd |
string num;
|
|
Toshihiro Shimizu |
890ddd |
if (atomData[i] == 0) {
|
|
Toshihiro Shimizu |
890ddd |
int count = 1;
|
|
Toshihiro Shimizu |
890ddd |
while ((i + 1) < size && atomData[i + 1] == 0)
|
|
Toshihiro Shimizu |
890ddd |
i++, count++;
|
|
Toshihiro Shimizu |
890ddd |
if (count > 1) {
|
|
Toshihiro Shimizu |
890ddd |
num = toString(count);
|
|
Toshihiro Shimizu |
890ddd |
strapp = strapp + "z " + num + " ";
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
num = toString(atomData[i]);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
strapp = strapp + string(num) + " ";
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//unsigned short*buffer = new unsigned short[size];
|
|
Toshihiro Shimizu |
890ddd |
//buffer[size]=0;
|
|
Toshihiro Shimizu |
890ddd |
//for (i=0; i
|
|
Toshihiro Shimizu |
890ddd |
// buffer[i] = atomData[i]+1;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
wstring data = toWideString(strapp);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
pg.add(new TStringProperty(str, data));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} while (curr != 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
void compareAtoms(const QTAtomContainer &atoms1, QTAtom parent1, const QTAtomContainer &atoms2, QTAtom parent2)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QTAtom curr1 = 0, curr2 = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(QTCountChildrenOfType(atoms1, parent1, 0) == QTCountChildrenOfType(atoms2, parent2, 0));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
do {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (QTNextChildAnyType(atoms1, parent1, curr1, &curr1) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (QTNextChildAnyType(atoms2, parent2, curr2, &curr2) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
assert((curr1 != 0 && curr2 != 0) || (curr1 == 0 && curr2 == 0));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (curr1 == 0 || curr2 == 0)
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QTAtomType atomType1, atomType2;
|
|
Toshihiro Shimizu |
890ddd |
QTAtomID id1, id2;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QTGetAtomTypeAndID(atoms1, curr1, &atomType1, &id1);
|
|
Toshihiro Shimizu |
890ddd |
QTGetAtomTypeAndID(atoms2, curr2, &atomType2, &id2);
|
|
Toshihiro Shimizu |
890ddd |
assert(atomType1 == atomType2);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int sonCount1 = QTCountChildrenOfType(atoms1, curr1, 0);
|
|
Toshihiro Shimizu |
890ddd |
int sonCount2 = QTCountChildrenOfType(atoms2, curr2, 0);
|
|
Toshihiro Shimizu |
890ddd |
assert(sonCount1 == sonCount2);
|
|
Toshihiro Shimizu |
890ddd |
if (sonCount1 > 0)
|
|
Toshihiro Shimizu |
890ddd |
compareAtoms(atoms1, curr1, atoms2, curr2);
|
|
Toshihiro Shimizu |
890ddd |
else {
|
|
Toshihiro Shimizu |
890ddd |
long size1;
|
|
Toshihiro Shimizu |
890ddd |
UCHAR *atomData1;
|
|
Toshihiro Shimizu |
890ddd |
long size2;
|
|
Toshihiro Shimizu |
890ddd |
UCHAR *atomData2;
|
|
Toshihiro Shimizu |
890ddd |
if (QTGetAtomDataPtr(atoms1, curr1, &size1, (char **)&atomData1) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
if (QTGetAtomDataPtr(atoms2, curr2, &size2, (char **)&atomData2) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
assert(size1 == size2);
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < size1; i++)
|
|
Toshihiro Shimizu |
890ddd |
assert(atomData1[i] == atomData2[i]);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} while (curr1 != 0 && curr2 != 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void fromAtomsToProperties(const QTAtomContainer &atoms, TPropertyGroup &pg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
pg.clear();
|
|
Toshihiro Shimizu |
890ddd |
visitAtoms(atoms, kParentAtomIsContainer, pg);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
void visitprops(TPropertyGroup &pg, int &index, QTAtomContainer &atoms, QTAtom parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int count = pg.getPropertyCount();
|
|
Toshihiro Shimizu |
890ddd |
while (index < count) {
|
|
Toshihiro Shimizu |
890ddd |
TStringProperty *p = (TStringProperty *)pg.getProperty(index++);
|
|
Toshihiro Shimizu |
890ddd |
string str0 = p->getName();
|
|
Toshihiro Shimizu |
890ddd |
const char *buf = str0.c_str();
|
|
Toshihiro Shimizu |
890ddd |
int atomType, id, sonCount;
|
|
Toshihiro Shimizu |
890ddd |
sscanf(buf, "%d %d %d", &atomType, &id, &sonCount);
|
|
Toshihiro Shimizu |
890ddd |
QTAtom newAtom;
|
|
Toshihiro Shimizu |
890ddd |
if (sonCount == 0) {
|
|
Toshihiro Shimizu |
890ddd |
wstring appow = p->getValue();
|
|
Toshihiro Shimizu |
890ddd |
string appo = toString(appow);
|
|
Toshihiro Shimizu |
890ddd |
const char *str = appo.c_str();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
vector<uchar> buf;</uchar>
|
|
Toshihiro Shimizu |
890ddd |
while (strlen(str) > 0) {
|
|
Toshihiro Shimizu |
890ddd |
if (str[0] == 'z') {
|
|
Toshihiro Shimizu |
890ddd |
int count = atoi(str + 1);
|
|
Toshihiro Shimizu |
890ddd |
str += (count < 10) ? 4 : ((count < 100) ? 5 : 6);
|
|
Toshihiro Shimizu |
890ddd |
while (count--)
|
|
Toshihiro Shimizu |
890ddd |
buf.push_back(0);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
int val = atoi(str);
|
|
Toshihiro Shimizu |
890ddd |
assert(val >= 0 && val < 256);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
str += (val < 10) ? 2 : ((val < 100) ? 3 : 4);
|
|
Toshihiro Shimizu |
890ddd |
buf.push_back(val);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
//const unsigned short*bufs = str1.c_str();
|
|
Toshihiro Shimizu |
890ddd |
//UCHAR *bufc = new UCHAR[size];
|
|
Toshihiro Shimizu |
890ddd |
//for (int i=0; i
|
|
Toshihiro Shimizu |
890ddd |
// {
|
|
Toshihiro Shimizu |
890ddd |
// assert(bufs[i]<257);
|
|
Toshihiro Shimizu |
890ddd |
// bufc[i] = (UCHAR)(bufs[i]-1);
|
|
Toshihiro Shimizu |
890ddd |
// }
|
|
Toshihiro Shimizu |
890ddd |
void *ptr = 0;
|
|
Toshihiro Shimizu |
890ddd |
if (buf.size() != 0) {
|
|
Toshihiro Shimizu |
890ddd |
ptr = &(buf[0]);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
QTInsertChild(atoms, parent, (QTAtomType)atomType, (QTAtomID)id, 0,
|
|
Toshihiro Shimizu |
890ddd |
buf.size(), (void *)ptr, 0);
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
QTInsertChild(atoms, parent, (QTAtomType)atomType, (QTAtomID)id,
|
|
Toshihiro Shimizu |
890ddd |
0, 0, 0, &newAtom);
|
|
Toshihiro Shimizu |
890ddd |
visitprops(pg, index, atoms, newAtom);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void fromPropertiesToAtoms(TPropertyGroup &pg, QTAtomContainer &atoms)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int index = 0;
|
|
Toshihiro Shimizu |
890ddd |
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 |
|
|
Toshihiro Shimizu |
890ddd |
static Boolean QTCmpr_FilterProc
|
|
Toshihiro Shimizu |
890ddd |
(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;
|
|
Toshihiro Shimizu |
890ddd |
// Change the window class
|
|
Toshihiro Shimizu |
890ddd |
HIWindowChangeClass(myEventWindow,kUtilityWindowClass);
|
|
Toshihiro Shimizu |
890ddd |
// Activate the window scope
|
|
Toshihiro Shimizu |
890ddd |
SetWindowActivationScope(myEventWindow,kWindowActivationScopeAll);
|
|
Toshihiro Shimizu |
890ddd |
// Set the brushed metal theme on the window
|
|
Toshihiro Shimizu |
890ddd |
SetThemeWindowBackground(myEventWindow,kThemeBrushUtilityWindowBackgroundActive,true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return(myEventHandled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void openMovSettingsPopup(TPropertyGroup *props, bool macBringToFront)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
#ifdef WIN32
|
|
Toshihiro Shimizu |
890ddd |
if (InitializeQTML(0) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ComponentInstance ci = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QTAtomContainer atoms;
|
|
Toshihiro Shimizu |
890ddd |
QTNewAtomContainer(&atoms);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
fromPropertiesToAtoms(*props, atoms);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ComponentResult err;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if ((err = SCSetSettingsFromAtomContainer(ci, atoms)) != noErr) {
|
|
Toshihiro Shimizu |
890ddd |
CloseComponent(ci);
|
|
Toshihiro Shimizu |
890ddd |
ci = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QTDisposeAtomContainer(atoms);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Install an external procedure to use a callback filter on the request settings dialog
|
|
Toshihiro Shimizu |
890ddd |
// On MACOSX we need to change the dialog appearance in order to pop-up in front 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;
|
|
Toshihiro Shimizu |
890ddd |
// 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 |
|
|
Toshihiro Shimizu |
890ddd |
err = SCRequestSequenceSettings(ci);
|
|
Toshihiro Shimizu |
890ddd |
//assert(err==noErr);
|
|
Toshihiro Shimizu |
890ddd |
QTAtomContainer atomsOut;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (SCGetSettingsAsAtomContainer(ci, &atomsOut) != noErr)
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
fromAtomsToProperties(atomsOut, *props);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QTDisposeAtomContainer(atomsOut);
|
|
Toshihiro Shimizu |
890ddd |
CloseComponent(ci);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//int dataSize=0, numChildren = 0, numLevels=0;
|
|
Toshihiro Shimizu |
890ddd |
//retrieveData(settings, kParentAtomIsContainer, dataSize, numChildren, numLevels);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool Tiio::isQuicktimeInstalled()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static int ret = -1;
|
|
Toshihiro Shimizu |
890ddd |
if (ret == -1)
|
|
Toshihiro Shimizu |
890ddd |
ret = (InitializeQTML(0) == noErr) ? 1 : 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return (ret == 1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#else //x64
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// 64-bit proxied version
|
|
Toshihiro Shimizu |
890ddd |
//*******************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Toonz includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//tipc includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tipc.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "t32bitsrv_wrap.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//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 |
|
|
Toshihiro Shimizu |
890ddd |
//Using 32-bit background server correspondence to achieve the same result
|
|
Toshihiro Shimizu |
890ddd |
void openMovSettingsPopup(TPropertyGroup *props, bool unused)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
if (!tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), 3000, t32bitsrv::srvCmdline(), "_main"))
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Send the appropriate commands to the server
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//We'll communicate through temporary files.
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$tmpfile_request") << QString("openMovSets"));
|
|
Toshihiro Shimizu |
890ddd |
QString res(tipc::readMessage(stream, msg));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString fp;
|
|
Toshihiro Shimizu |
890ddd |
msg >> fp;
|
|
Toshihiro Shimizu |
890ddd |
assert(res == "ok" && !fp.isEmpty());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath tfp(fp.toStdWString());
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Save the input props to the temporary file
|
|
Toshihiro Shimizu |
890ddd |
TOStream os(tfp);
|
|
Toshihiro Shimizu |
890ddd |
props->saveData(os);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Invoke the settings popup
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << tipc::clr << QString("$openMovSettingsPopup") << fp);
|
|
Toshihiro Shimizu |
890ddd |
res = tipc::readMessageNB(stream, msg, -1, QEventLoop::ExcludeUserInputEvents);
|
|
Toshihiro Shimizu |
890ddd |
assert(res == "ok");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef MACOSX
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Bring this application back to front
|
|
Toshihiro Shimizu |
890ddd |
ProcessSerialNumber psn = {0, kCurrentProcess};
|
|
Toshihiro Shimizu |
890ddd |
SetFrontProcess(&psn);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //MACOSX
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
props->clear();
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Save the input props to the temporary file
|
|
Toshihiro Shimizu |
890ddd |
TIStream is(tfp);
|
|
Toshihiro Shimizu |
890ddd |
props->loadData(is);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Release the temporary file
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << tipc::clr << QString("$tmpfile_release") << QString("openMovSets"));
|
|
Toshihiro Shimizu |
890ddd |
res = tipc::readMessage(stream, msg);
|
|
Toshihiro Shimizu |
890ddd |
assert(res == "ok");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//---------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool Tiio::isQuicktimeInstalled()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//NOTE: This is *NOT* the same function as IsQuickTimeInstalled(), which is
|
|
Toshihiro Shimizu |
890ddd |
//implemented locally in the image lib and used there. This function here is
|
|
Toshihiro Shimizu |
890ddd |
//actually NEVER USED throughout Toonz, so we're placing a dummy
|
|
Toshihiro Shimizu |
890ddd |
//implementation here.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif //else
|