|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TENV_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define TENV_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//#include "texception.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tgeometry.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TNZCORE_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=========================================================
|
|
Toshihiro Shimizu |
890ddd |
namespace TEnv
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI Variable
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
class Imp;
|
|
Toshihiro Shimizu |
890ddd |
Imp *m_imp;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Variable(string name, string defaultValue);
|
|
Toshihiro Shimizu |
890ddd |
Variable(string name);
|
|
Toshihiro Shimizu |
890ddd |
virtual ~Variable();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string getName() const;
|
|
Toshihiro Shimizu |
890ddd |
string getValue() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void assignValue(string str);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI IntVar : public Variable
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
IntVar(string name, int defValue);
|
|
Toshihiro Shimizu |
890ddd |
IntVar(string name);
|
|
Toshihiro Shimizu |
890ddd |
operator int() const;
|
|
Toshihiro Shimizu |
890ddd |
void operator=(int v);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI DoubleVar : public Variable
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
DoubleVar(string name, double defValue);
|
|
Toshihiro Shimizu |
890ddd |
DoubleVar(string name);
|
|
Toshihiro Shimizu |
890ddd |
operator double() const;
|
|
Toshihiro Shimizu |
890ddd |
void operator=(double v);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI StringVar : public Variable
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
StringVar(string name, const string &defValue);
|
|
Toshihiro Shimizu |
890ddd |
StringVar(string name);
|
|
Toshihiro Shimizu |
890ddd |
operator string() const;
|
|
Toshihiro Shimizu |
890ddd |
void operator=(const string &v);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI FilePathVar : public Variable
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
FilePathVar(string name, const TFilePath &defValue);
|
|
Toshihiro Shimizu |
890ddd |
FilePathVar(string name);
|
|
Toshihiro Shimizu |
890ddd |
operator TFilePath() const;
|
|
Toshihiro Shimizu |
890ddd |
void operator=(const TFilePath &v);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI RectVar : public Variable
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
RectVar(string name, const TRect &defValue);
|
|
Toshihiro Shimizu |
890ddd |
RectVar(string name);
|
|
Toshihiro Shimizu |
890ddd |
operator TRect() const;
|
|
Toshihiro Shimizu |
890ddd |
void operator=(const TRect &v);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// NOTA BENE: bisogna chiamare setApplication() il prima possibile
|
|
Toshihiro Shimizu |
890ddd |
// questa operazione inizializza il registry root (su Windows) e definisce il file dove
|
|
Toshihiro Shimizu |
890ddd |
// vengono lette e scritte le variabili di environment
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// es.: TEnv::setApplication("Toonz","5.0");
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void setApplication(string applicationName, string applicationVersion);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string getApplicationName();
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string getApplicationVersion();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// es.: TEnv::setModuleFullName("Toonz 5.0.1 Harlequin");
|
|
Toshihiro Shimizu |
890ddd |
// (default: "<applicationname> <applicationversion>")</applicationversion></applicationname>
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void setApplicationFullName(string applicationFullName);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string getApplicationFullName();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// es.: TEnv::setModuleName("inknpaint")
|
|
Toshihiro Shimizu |
890ddd |
// (default: "<applicationname>")</applicationname>
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void setModuleName(string moduleName);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string getModuleName();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// es.: TEnv::setRootVarName("TABROOT");
|
|
Toshihiro Shimizu |
890ddd |
// (default: toUpper(<applicationname> + "ROOT"))</applicationname>
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string getRootVarName();
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void setRootVarName(string varName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// es.: TEnv::setRootVarName("Toonz");
|
|
Toshihiro Shimizu |
890ddd |
// (default: <programname>)</programname>
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void setSystemVarPrefix(string prefix);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string getSystemVarPrefix();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// su Windows ritorna
|
|
Toshihiro Shimizu |
890ddd |
// 'SOFTWARE\Digital Video\<applicationname>\<applicationversion>\<rootvar>'</rootvar></applicationversion></applicationname>
|
|
Toshihiro Shimizu |
890ddd |
// su Unix/Linux/MacOsX
|
|
Toshihiro Shimizu |
890ddd |
// '<rootvar>'</rootvar>
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TFilePath getRootVarPath();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// restituisce il valore della variabile di sistema varName
|
|
Toshihiro Shimizu |
890ddd |
// (su window aggiunge "SOFTWARE\Digital Video\....." all'inizio)
|
|
Toshihiro Shimizu |
890ddd |
DVAPI string getSystemVarStringValue(string varName);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TFilePath getSystemVarPathValue(string varName);
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TFilePathSet getSystemVarPathSetValue(string varName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TFilePath getStuffDir();
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TFilePath getConfigDir();
|
|
Toshihiro Shimizu |
890ddd |
//DVAPI TFilePath getProfilesDir();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// per l'utilizzo di ToonzLib senza che sia definita una TOONZROOT
|
|
Toshihiro Shimizu |
890ddd |
// bisogna chiamare TEnv::setStuffDir(stuffdir) prima di ogni altra operazione
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void setStuffDir(const TFilePath &stuffDir);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TFilePath getDllRelativeDir();
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void setDllRelativeDir(const TFilePath &dllRelativeDir);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void saveAllEnvVariables();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum SystemFileId {
|
|
Toshihiro Shimizu |
890ddd |
StuffDir,
|
|
Toshihiro Shimizu |
890ddd |
ConfigDir,
|
|
Toshihiro Shimizu |
890ddd |
ProfilesDir
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// bisogna assegnare (in qualsiasi ordine) tutti i vari nomi dei registry alle varie
|
|
Toshihiro Shimizu |
890ddd |
// directory di sistema.
|
|
Toshihiro Shimizu |
890ddd |
// StuffDir e' obbligatoria, tutte le altre hanno un valore di default relativo a StuffDir
|
|
Toshihiro Shimizu |
890ddd |
DVAPI void defineSystemPath(SystemFileId id, const TFilePath ®istryName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// restituisce il file (non la variabile di registro)
|
|
Toshihiro Shimizu |
890ddd |
DVAPI TFilePath getSystemPath(SystemFileId id);
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=========================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=========================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} // namespace TEnv
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=========================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|