Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonz/preferences.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzLib includes
Toshihiro Shimizu 890ddd
#include "toonz/tscenehandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/toonzscene.h"
Toshihiro Shimizu 890ddd
#include "toonz/toonzfolders.h"
Toshihiro Shimizu 890ddd
#include "toonz/tcamera.h"
Toshihiro Shimizu 890ddd
#include "toonz/txshleveltypes.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzBase includes
Toshihiro Shimizu 890ddd
#include "tenv.h"
Toshihiro Shimizu 890ddd
#include "tunit.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tsystem.h"
Toshihiro Shimizu 890ddd
#include "tconvert.h"
Toshihiro Shimizu 890ddd
#include "tundo.h"
Toshihiro Shimizu 890ddd
#include "tbigmemorymanager.h"
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// Qt includes
Toshihiro Shimizu 890ddd
#include <qsettings></qsettings>
Toshihiro Shimizu 890ddd
#include <qstringlist></qstringlist>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// boost includes
Toshihiro Shimizu 890ddd
#include <boost bind.hpp=""></boost>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
//    Local namespace  stuff
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef Preferences::LevelFormat LevelFormat;
Toshihiro Shimizu 890ddd
typedef std::vector<levelformat> LevelFormatVector;</levelformat>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
const char *s_bool[2] = {"0", "1"};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
const char *s_show0ThickLines = "show0ThickLines",
Toshihiro Shimizu 890ddd
		   *s_regionAntialias = "regionAntialias",
Toshihiro Shimizu 890ddd
		   *s_levelFormats = "levelFormats";
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
const char *s_name = "name",
Toshihiro Shimizu 890ddd
		   *s_regexp = "regexp",
Toshihiro Shimizu 890ddd
		   *s_priority = "priority";
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
const char *s_dpiPolicy = "dpiPolicy",
Toshihiro Shimizu 890ddd
		   *s_dpi = "dpi",
Toshihiro Shimizu 890ddd
		   *s_subsampling = "subsampling",
Toshihiro Shimizu 890ddd
		   *s_antialias = "antialias",
Toshihiro Shimizu 890ddd
		   *s_premultiply = "premultiply",
Toshihiro Shimizu 890ddd
		   *s_whiteTransp = "whiteTransp";
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
inline void getValue(const QSettings &s, const QString &key, bool &ret)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	QString val;
Toshihiro Shimizu 890ddd
	val = s.value(key).toString();
Toshihiro Shimizu 890ddd
	if (val != "")
Toshihiro Shimizu 890ddd
		ret = (val.toInt() != 0);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
inline void getValue(const QSettings &s, const QString &key, int &ret)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	QString val;
Toshihiro Shimizu 890ddd
	val = s.value(key).toString();
Toshihiro Shimizu 890ddd
	if (val != "")
Toshihiro Shimizu 890ddd
		ret = val.toInt();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
inline void getValue(const QSettings &s, const QString &key, double &ret)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	QString val;
Toshihiro Shimizu 890ddd
	val = s.value(key).toString();
Toshihiro Shimizu 890ddd
	if (val != "")
Toshihiro Shimizu 890ddd
		ret = val.toDouble();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
inline void getValue(const QSettings &s, QString key, TPixel32 &ret)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	QString val;
Toshihiro Shimizu 890ddd
	val = s.value(QString(key).append("_R")).toString();
Toshihiro Shimizu 890ddd
	if (val != "")
Toshihiro Shimizu 890ddd
		ret.r = val.toInt();
Toshihiro Shimizu 890ddd
	val = s.value(QString(key).append("_G")).toString();
Toshihiro Shimizu 890ddd
	if (val != "")
Toshihiro Shimizu 890ddd
		ret.g = val.toInt();
Toshihiro Shimizu 890ddd
	val = s.value(QString(key).append("_B")).toString();
Toshihiro Shimizu 890ddd
	if (val != "")
Toshihiro Shimizu 890ddd
		ret.b = val.toInt();
Toshihiro Shimizu 890ddd
	val = s.value(QString(key).append("_M")).toString();
Toshihiro Shimizu 890ddd
	if (val != "")
Toshihiro Shimizu 890ddd
		ret.m = val.toInt();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
inline bool formatLess(const Preferences::LevelFormat &a,
Toshihiro Shimizu 890ddd
					   const Preferences::LevelFormat &b)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return (a.m_priority > b.m_priority		   // Observe '>' used here - we want inverse
Toshihiro Shimizu 890ddd
			|| (!(b.m_priority > a.m_priority) // sorting on priority, higher priorities come first
Toshihiro Shimizu 890ddd
				&& a.m_name < b.m_name));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void getDefaultLevelFormats(LevelFormatVector &lfv)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	lfv.resize(1);
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		LevelFormat &lf = lfv[0];
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		lf.m_name = Preferences::tr("Retas Level Format");
Toshihiro Shimizu 890ddd
		lf.m_pathFormat = QRegExp(".+[0-9]{4,4}\\.tga", Qt::CaseInsensitive);
Toshihiro Shimizu 890ddd
		lf.m_options.m_whiteTransp = true;
Toshihiro Shimizu 890ddd
		lf.m_options.m_antialias = 70;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void setValue(QSettings &settings, const LevelOptions &lo)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	settings.setValue(s_dpiPolicy, int(lo.m_dpiPolicy));
Toshihiro Shimizu 890ddd
	settings.setValue(s_dpi, lo.m_dpi);
Toshihiro Shimizu 890ddd
	settings.setValue(s_subsampling, lo.m_subsampling);
Toshihiro Shimizu 890ddd
	settings.setValue(s_antialias, lo.m_antialias);
Toshihiro Shimizu 890ddd
	settings.setValue(s_premultiply, int(lo.m_premultiply));
Toshihiro Shimizu 890ddd
	settings.setValue(s_whiteTransp, int(lo.m_whiteTransp));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void getValue(const QSettings &settings, LevelOptions &lo)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	int dpiPolicy = settings.value(s_dpiPolicy, int(lo.m_dpiPolicy)).toInt();
Toshihiro Shimizu 890ddd
	lo.m_dpiPolicy = LevelOptions::DpiPolicy(dpiPolicy);
Toshihiro Shimizu 890ddd
	lo.m_dpi = settings.value(s_dpi, lo.m_dpi).toDouble();
Toshihiro Shimizu 890ddd
	lo.m_subsampling = settings.value(s_subsampling, lo.m_subsampling).toInt();
Toshihiro Shimizu 890ddd
	lo.m_antialias = settings.value(s_antialias, lo.m_antialias).toInt();
Toshihiro Shimizu 890ddd
	lo.m_premultiply = (settings.value(s_premultiply, lo.m_premultiply).toInt() != 0);
Toshihiro Shimizu 890ddd
	lo.m_whiteTransp = (settings.value(s_whiteTransp, lo.m_whiteTransp).toInt() != 0);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void setValue(QSettings &settings, const LevelFormat &lf)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	settings.setValue(s_name, lf.m_name);
Toshihiro Shimizu 890ddd
	settings.setValue(s_regexp, lf.m_pathFormat.pattern());
Toshihiro Shimizu 890ddd
	settings.setValue(s_priority, lf.m_priority);
Toshihiro Shimizu 890ddd
	setValue(settings, lf.m_options);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void getValue(const QSettings &settings, LevelFormat &lf)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	lf.m_name = settings.value(s_name, lf.m_name).toString();
Toshihiro Shimizu 890ddd
	lf.m_pathFormat = QRegExp(settings.value(s_regexp, lf.m_pathFormat).toString(),
Toshihiro Shimizu 890ddd
							  Qt::CaseInsensitive);
Toshihiro Shimizu 890ddd
	lf.m_priority = settings.value(s_priority, lf.m_priority).toInt();
Toshihiro Shimizu 890ddd
	getValue(settings, lf.m_options);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void setValue(QSettings &settings, const LevelFormatVector &lfv)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	int lf, lfCount = int(lfv.size());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	settings.remove(s_levelFormats);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	settings.beginWriteArray(s_levelFormats, lfCount);
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		for (lf = 0; lf != lfCount; ++lf) {
Toshihiro Shimizu 890ddd
			settings.setArrayIndex(lf);
Toshihiro Shimizu 890ddd
			setValue(settings, lfv[lf]);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	settings.endArray();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void getValue(QSettings &settings, LevelFormatVector &lfv) // Why does QSettings' interface require
Toshihiro Shimizu 890ddd
{														   // non-const access on reading arrays/groups?
Toshihiro Shimizu 890ddd
	if (!settings.childGroups().contains(s_levelFormats))
Toshihiro Shimizu 890ddd
		return; // Default is no level formats - use builtins
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int lfCount = settings.beginReadArray(s_levelFormats); // lfCount could be 0
Toshihiro Shimizu 890ddd
	lfv.resize(lfCount);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (int lf = 0; lf != lfCount; ++lf) {
Toshihiro Shimizu 890ddd
		settings.setArrayIndex(lf);
Toshihiro Shimizu 890ddd
		getValue(settings, lfv[lf]);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	settings.endArray();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} // namespace
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
//    Preferences::LevelFormat  implementation
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
bool Preferences::LevelFormat::matches(const TFilePath &fp) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return m_pathFormat.exactMatch(fp.getQString());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
//    Preferences  implementation
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Preferences::Preferences()
shun-iwasawa 0c0a0a
	: m_units("mm"), m_cameraUnits("inch"), m_scanLevelType("tif"), m_defLevelWidth(0.0), m_defLevelHeight(0.0), m_defLevelDpi(0.0), m_iconSize(160, 120), m_blankColor(TPixel32::White), m_frontOnionColor(TPixel::Black), m_backOnionColor(TPixel::Black), m_transpCheckBg(TPixel::White), m_transpCheckInk(TPixel::Black), m_transpCheckPaint(TPixel(127, 127, 127)), m_autosavePeriod(15), m_chunkSize(10), m_rasterOptimizedMemory(0), m_shrink(1), m_step(1), m_blanksCount(0), m_keyframeType(3), m_animationStep(1), m_textureSize(0), m_xsheetStep(10), m_shmmax(-1), m_shmseg(-1), m_shmall(-1), m_shmmni(-1), m_onionPaperThickness(50), m_currentLanguage(0), m_currentStyleSheet(0), m_undoMemorySize(100), m_dragCellsBehaviour(0), m_lineTestFpsCapture(25), m_defLevelType(0), m_autocreationType(1), m_autoExposeEnabled(true), m_autoCreateEnabled(true), m_subsceneFolderEnabled(true), m_generatedMovieViewEnabled(true), m_xsheetAutopanEnabled(true), m_ignoreAlphaonColumn1Enabled(false), m_rewindAfterPlaybackEnabled(true), m_fitToFlipbookEnabled(false), m_previewAlwaysOpenNewFlipEnabled(false), m_autosaveEnabled(false), m_defaultViewerEnabled(false), m_saveUnpaintedInCleanup(true), m_askForOverrideRender(true), m_automaticSVNFolderRefreshEnabled(true), m_SVNEnabled(false), m_minimizeSaveboxAfterEditing(true), m_levelsBackupEnabled(false), m_sceneNumberingEnabled(false), m_animationSheetEnabled(false), m_inksOnly(false), m_fillOnlySavebox(false), m_show0ThickLines(true), m_regionAntialias(false), m_viewerBGColor(128, 128, 128, 255), m_previewBGColor(64, 64, 64, 255), m_chessboardColor1(180, 180, 180), m_chessboardColor2(230, 230, 230), m_showRasterImagesDarkenBlendedInViewer(false), m_actualPixelViewOnSceneEditingMode(false), m_viewerZoomCenter(0), m_initialLoadTlvCachingBehavior(0), m_removeSceneNumberFromLoadedLevelName(false), m_replaceAfterSaveLevelAs(true), m_showFrameNumberWithLetters(false), m_levelNameOnEachMarker(false), m_columnIconLoadingPolicy((int)LoadAtOnce), m_moveCurrentFrameByClickCellArea(true), m_onionSkinEnabled(true), m_multiLayerStylePickerEnabled(false), m_paletteTypeOnLoadRasterImageAsColorModel(0), m_showKeyframesOnXsheetCellArea(true)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TCamera camera;
Toshihiro Shimizu 890ddd
	m_defLevelType = PLI_XSHLEVEL;
Toshihiro Shimizu 890ddd
	m_defLevelWidth = camera.getSize().lx;
Toshihiro Shimizu 890ddd
	m_defLevelHeight = camera.getSize().ly;
Toshihiro Shimizu 890ddd
	m_defLevelDpi = camera.getDpi().x;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFilePath layoutDir = ToonzFolder::getMyModuleDir();
Toshihiro Shimizu 890ddd
	TFilePath savePath = layoutDir + TFilePath("preferences.ini");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_settings.reset(new QSettings(QString::fromStdWString(savePath.getWideString()),
Toshihiro Shimizu 890ddd
								   QSettings::IniFormat));
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "autoExposeEnabled", m_autoExposeEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "autoCreateEnabled", m_autoCreateEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "subsceneFolderEnabled", m_subsceneFolderEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "generatedMovieViewEnabled", m_generatedMovieViewEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "xsheetAutopanEnabled", m_xsheetAutopanEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "ignoreAlphaonColumn1Enabled", m_ignoreAlphaonColumn1Enabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "rewindAfterPlayback", m_rewindAfterPlaybackEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "previewAlwaysOpenNewFlip", m_previewAlwaysOpenNewFlipEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "fitToFlipbook", m_fitToFlipbookEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "automaticSVNFolderRefreshEnabled", m_automaticSVNFolderRefreshEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "SVNEnabled", m_SVNEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "minimizeSaveboxAfterEditing", m_minimizeSaveboxAfterEditing);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "levelsBackupEnabled", m_levelsBackupEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "sceneNumberingEnabled", m_sceneNumberingEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "animationSheetEnabled", m_animationSheetEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "autosaveEnabled", m_autosaveEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "defaultViewerEnabled", m_defaultViewerEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "rasterOptimizedMemory", m_rasterOptimizedMemory);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "saveUnpaintedInCleanup", m_saveUnpaintedInCleanup);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "autosavePeriod", m_autosavePeriod);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "taskchunksize", m_chunkSize);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "xsheetStep", m_xsheetStep);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int r = 0, g = 0, b = 0;
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "frontOnionColor.r", r);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "frontOnionColor.g", g);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "frontOnionColor.b", b);
Toshihiro Shimizu 890ddd
	m_frontOnionColor = TPixel32(r, g, b);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "onionPaperThickness", m_onionPaperThickness);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	r = 0, g = 0, b = 0;
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "backOnionColor.r", r);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "backOnionColor.g", g);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "backOnionColor.b", b);
Toshihiro Shimizu 890ddd
	m_backOnionColor = TPixel32(r, g, b);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	r = m_transpCheckBg.r, g = m_transpCheckBg.g, b = m_transpCheckBg.b;
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckInkOnBlack.r", r);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckInkOnBlack.g", g);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckInkOnBlack.b", b);
Toshihiro Shimizu 890ddd
	m_transpCheckBg = TPixel32(r, g, b);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	r = m_transpCheckInk.r, g = m_transpCheckInk.g, b = m_transpCheckInk.b;
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckInkOnWhite.r", r);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckInkOnWhite.g", g);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckInkOnWhite.b", b);
Toshihiro Shimizu 890ddd
	m_transpCheckInk = TPixel32(r, g, b);
Toshihiro Shimizu 890ddd
	r = m_transpCheckPaint.r, g = m_transpCheckPaint.g, b = m_transpCheckPaint.b;
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckPaint.r", r);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckPaint.g", g);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "transpCheckPaint.b", b);
Toshihiro Shimizu 890ddd
	m_transpCheckPaint = TPixel32(r, g, b);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "onionInksOnly", m_inksOnly);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "iconSizeX", m_iconSize.lx);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "iconSizeY", m_iconSize.ly);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, s_show0ThickLines, m_show0ThickLines);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, s_regionAntialias, m_regionAntialias);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "viewShrink", m_shrink);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "viewStep", m_step);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "blanksCount", m_blanksCount);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "askForOverrideRender", m_askForOverrideRender);
Toshihiro Shimizu 890ddd
	r = 255, g = 255, b = 255;
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "blankColor.r", r);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "blankColor.g", g);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "blankColor.b", b);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "undoMemorySize", m_undoMemorySize);
Toshihiro Shimizu 890ddd
	setUndoMemorySize(m_undoMemorySize);
Toshihiro Shimizu 890ddd
	m_blankColor = TPixel32(r, g, b);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	QString units;
Toshihiro Shimizu 890ddd
	units = m_settings->value("linearUnits").toString();
Toshihiro Shimizu 890ddd
	if (units != "")
Toshihiro Shimizu 890ddd
		m_units = units;
Toshihiro Shimizu 890ddd
	setUnits(m_units.toStdString());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	units = m_settings->value("cameraUnits").toString();
Toshihiro Shimizu 890ddd
	if (units != "")
Toshihiro Shimizu 890ddd
		m_cameraUnits = units;
Toshihiro Shimizu 890ddd
	setCameraUnits(m_cameraUnits.toStdString());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "keyframeType", m_keyframeType);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "animationStep", m_animationStep);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "textureSize", m_textureSize);
Toshihiro Shimizu 890ddd
	QString scanLevelType;
Toshihiro Shimizu 890ddd
	scanLevelType = m_settings->value("scanLevelType").toString();
Toshihiro Shimizu 890ddd
	if (scanLevelType != "")
Toshihiro Shimizu 890ddd
		m_scanLevelType = scanLevelType;
Toshihiro Shimizu 890ddd
	setScanLevelType(m_scanLevelType.toStdString());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "shmmax", m_shmmax);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "shmseg", m_shmseg);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "shmall", m_shmall);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "shmmni", m_shmmni);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// Load level formats
Toshihiro Shimizu 890ddd
	getDefaultLevelFormats(m_levelFormats);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, m_levelFormats);
Toshihiro Shimizu 890ddd
	std::sort(m_levelFormats.begin(), m_levelFormats.end(), // Format sorting must be
Toshihiro Shimizu 890ddd
			  formatLess);									// enforced
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFilePath lang_path = TEnv::getConfigDir() + "loc";
Toshihiro Shimizu 890ddd
	TFilePathSet lang_fpset;
Shinya Kitaoka 822411
	m_languageMaps[0] = "English";
Toshihiro Shimizu 890ddd
	//m_currentLanguage=0;
Toshihiro Shimizu 890ddd
	try {
Toshihiro Shimizu 890ddd
		TFileStatus langPathFs(lang_path);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		if (langPathFs.doesExist() && langPathFs.isDirectory()) {
Toshihiro Shimizu 890ddd
			TSystem::readDirectory(lang_fpset, lang_path, true, false);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3fa3e1
		int i = 0;
Shinya Kitaoka 3fa3e1
		for (auto const& newPath : lang_fpset) {
Shinya Kitaoka 3fa3e1
			++i;
Toshihiro Shimizu 890ddd
			if (newPath == lang_path)
Toshihiro Shimizu 890ddd
				continue;
Toshihiro Shimizu 890ddd
			if (TFileStatus(newPath).isDirectory()) {
Toshihiro Shimizu 890ddd
				QString string = QString::fromStdWString(newPath.getWideName());
Toshihiro Shimizu 890ddd
				m_languageMaps[i] = string;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	} catch (...) {
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TFilePath path(TEnv::getConfigDir() + "qss");
Toshihiro Shimizu 890ddd
	TFilePathSet fpset;
Toshihiro Shimizu 890ddd
	try {
Toshihiro Shimizu 890ddd
		TSystem::readDirectory(fpset, path, true, false);
Shinya Kitaoka 3fa3e1
		int i = -1;
Shinya Kitaoka 3fa3e1
		for (auto const& newPath : fpset) {
Shinya Kitaoka 3fa3e1
			++i;
Toshihiro Shimizu 890ddd
			if (newPath == path)
Toshihiro Shimizu 890ddd
				continue;
Toshihiro Shimizu 890ddd
			QString fpName = QString::fromStdWString(newPath.getWideName());
Toshihiro Shimizu 890ddd
#ifdef MACOSX
Toshihiro Shimizu 890ddd
			QString string = fpName + QString("/") + fpName + QString("_mac.qss");
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
			QString string = fpName + QString("/") + fpName + QString(".qss");
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
			if (fpName == QString("standard"))
Toshihiro Shimizu 890ddd
				m_currentStyleSheet = i;
shun_iwasawa 6c7e74
			m_styleSheetMaps[i] = "file:///" + path.getQString() + "/" + string;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	} catch (...) {
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "CurrentLanguage", m_currentLanguage);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "CurrentStyleSheet", m_currentStyleSheet);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "DragCellsBehaviour", m_dragCellsBehaviour);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "LineTestFpsCapture", m_lineTestFpsCapture);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "FillOnlysavebox", m_fillOnlySavebox);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "AutocreationType", m_autocreationType);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "DefLevelType", m_defLevelType);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "DefLevelWidth", m_defLevelWidth);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "DefLevelHeight", m_defLevelHeight);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "DefLevelDpi", m_defLevelDpi);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "viewerBGColor", m_viewerBGColor);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "previewBGColor", m_previewBGColor);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "chessboardColor1", m_chessboardColor1);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "chessboardColor2", m_chessboardColor2);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "showRasterImagesDarkenBlendedInViewer", m_showRasterImagesDarkenBlendedInViewer);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "actualPixelViewOnSceneEditingMode", m_actualPixelViewOnSceneEditingMode);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "viewerZoomCenter", m_viewerZoomCenter);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "initialLoadTlvCachingBehavior", m_initialLoadTlvCachingBehavior);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "removeSceneNumberFromLoadedLevelName", m_removeSceneNumberFromLoadedLevelName);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "replaceAfterSaveLevelAs", m_replaceAfterSaveLevelAs);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "showFrameNumberWithLetters", m_showFrameNumberWithLetters);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "levelNameOnEachMarkerEnabled", m_levelNameOnEachMarker);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "columnIconLoadingPolicy", m_columnIconLoadingPolicy);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "moveCurrentFrameByClickCellArea", m_moveCurrentFrameByClickCellArea);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "onionSkinEnabled", m_onionSkinEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "multiLayerStylePickerEnabled", m_multiLayerStylePickerEnabled);
Toshihiro Shimizu 890ddd
	getValue(*m_settings, "paletteTypeOnLoadRasterImageAsColorModel", m_paletteTypeOnLoadRasterImageAsColorModel);
shun_iwasawa 9f6fb4
	getValue(*m_settings, "showKeyframesOnXsheetCellArea", m_showKeyframesOnXsheetCellArea);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Preferences::~Preferences()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	// DO NOT REMOVE
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Preferences *Preferences::instance()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	static Preferences _instance;
Toshihiro Shimizu 890ddd
	return &_instance;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableAutoExpose(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_autoExposeEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("autoExposeEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableSubsceneFolder(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_subsceneFolderEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("subsceneFolderEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableGeneratedMovieView(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_generatedMovieViewEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("generatedMovieViewEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableXsheetAutopan(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_xsheetAutopanEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("xsheetAutopanEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableIgnoreAlphaonColumn1(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_ignoreAlphaonColumn1Enabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("ignoreAlphaonColumn1Enabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
shun_iwasawa 9f6fb4
//------------------------------------------------------------------
shun_iwasawa 9f6fb4
shun_iwasawa 9f6fb4
void Preferences::enableShowKeyframesOnXsheetCellArea(bool on)
shun_iwasawa 9f6fb4
{
shun_iwasawa 9f6fb4
	m_showKeyframesOnXsheetCellArea = on;
shun_iwasawa 9f6fb4
	m_settings->setValue("showKeyframesOnXsheetCellArea", on ? "1" : "0");
shun_iwasawa 9f6fb4
}
shun_iwasawa 9f6fb4
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableRewindAfterPlayback(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_rewindAfterPlaybackEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("rewindAfterPlayback", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableFitToFlipbook(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_fitToFlipbookEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("fitToFlipbook", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enablePreviewAlwaysOpenNewFlip(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_previewAlwaysOpenNewFlipEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("previewAlwaysOpenNewFlip", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableAutosave(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_autosaveEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("autosaveEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (!on)
Toshihiro Shimizu 890ddd
		emit stopAutoSave();
Toshihiro Shimizu 890ddd
	else
Toshihiro Shimizu 890ddd
		emit startAutoSave();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setAskForOverrideRender(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_autosaveEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("askForOverrideRender", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableDefaultViewer(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_defaultViewerEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("defaultViewerEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableRasterOptimizedMemory(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_rasterOptimizedMemory = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("rasterOptimizedMemory", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableSaveUnpaintedInCleanup(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_saveUnpaintedInCleanup = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("saveUnpaintedInCleanup", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableAutomaticSVNFolderRefresh(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_automaticSVNFolderRefreshEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("automaticSVNFolderRefreshEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableSVN(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_SVNEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("SVNEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableMinimizeSaveboxAfterEditing(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_minimizeSaveboxAfterEditing = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("minimizeSaveboxAfterEditing", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setAutosavePeriod(int minutes)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_autosavePeriod = minutes;
Toshihiro Shimizu 890ddd
	m_settings->setValue("autosavePeriod", QString::number(minutes));
Toshihiro Shimizu 890ddd
	emit stopAutoSave();
Toshihiro Shimizu 890ddd
	emit startAutoSave();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setDefaultTaskChunkSize(int chunkSize)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_chunkSize = chunkSize;
Toshihiro Shimizu 890ddd
	m_settings->setValue("taskchunksize", QString::number(chunkSize));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setXsheetStep(int step)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_xsheetStep = step;
Toshihiro Shimizu 890ddd
	m_settings->setValue("xsheetStep", QString::number(m_xsheetStep));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setTranspCheckData(const TPixel &bg, const TPixel &ink, const TPixel &paint)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_transpCheckBg = bg;
Toshihiro Shimizu 890ddd
	m_transpCheckInk = ink;
Toshihiro Shimizu 890ddd
	m_transpCheckPaint = paint;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckInkOnBlack.r", QString::number(m_transpCheckBg.r));
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckInkOnBlack.g", QString::number(m_transpCheckBg.g));
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckInkOnBlack.b", QString::number(m_transpCheckBg.b));
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckInkOnWhite.r", QString::number(m_transpCheckInk.r));
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckInkOnWhite.g", QString::number(m_transpCheckInk.g));
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckInkOnWhite.b", QString::number(m_transpCheckInk.b));
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckPaint.r", QString::number(m_transpCheckPaint.r));
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckPaint.g", QString::number(m_transpCheckPaint.g));
Toshihiro Shimizu 890ddd
	m_settings->setValue("transpCheckPaint.b", QString::number(m_transpCheckPaint.b));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setOnionData(const TPixel &frontOnionColor, const TPixel &backOnionColor, bool inksOnly)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_frontOnionColor = frontOnionColor;
Toshihiro Shimizu 890ddd
	m_backOnionColor = backOnionColor;
Toshihiro Shimizu 890ddd
	m_inksOnly = inksOnly;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_settings->setValue("frontOnionColor.r", QString::number(frontOnionColor.r));
Toshihiro Shimizu 890ddd
	m_settings->setValue("frontOnionColor.g", QString::number(frontOnionColor.g));
Toshihiro Shimizu 890ddd
	m_settings->setValue("frontOnionColor.b", QString::number(frontOnionColor.b));
Toshihiro Shimizu 890ddd
	m_settings->setValue("backOnionColor.r", QString::number(backOnionColor.r));
Toshihiro Shimizu 890ddd
	m_settings->setValue("backOnionColor.g", QString::number(backOnionColor.g));
Toshihiro Shimizu 890ddd
	m_settings->setValue("backOnionColor.b", QString::number(backOnionColor.b));
Toshihiro Shimizu 890ddd
	m_settings->setValue("onionInksOnly", QString::number(m_inksOnly));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setIconSize(const TDimension &dim)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_iconSize = dim;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_settings->setValue("iconSizeX", QString::number(dim.lx));
Toshihiro Shimizu 890ddd
	m_settings->setValue("iconSizeY", QString::number(dim.ly));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setViewerBGColor(const TPixel32 &color, bool isDragging)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_viewerBGColor = color;
Toshihiro Shimizu 890ddd
	if (!isDragging) {
Toshihiro Shimizu 890ddd
		m_settings->setValue("viewerBGColor_R", QString::number((int)color.r));
Toshihiro Shimizu 890ddd
		m_settings->setValue("viewerBGColor_G", QString::number((int)color.g));
Toshihiro Shimizu 890ddd
		m_settings->setValue("viewerBGColor_B", QString::number((int)color.b));
Toshihiro Shimizu 890ddd
		m_settings->setValue("viewerBGColor_M", QString::number((int)color.m));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setPreviewBGColor(const TPixel32 &color, bool isDragging)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_previewBGColor = color;
Toshihiro Shimizu 890ddd
	if (!isDragging) {
Toshihiro Shimizu 890ddd
		m_settings->setValue("previewBGColor_R", QString::number((int)color.r));
Toshihiro Shimizu 890ddd
		m_settings->setValue("previewBGColor_G", QString::number((int)color.g));
Toshihiro Shimizu 890ddd
		m_settings->setValue("previewBGColor_B", QString::number((int)color.b));
Toshihiro Shimizu 890ddd
		m_settings->setValue("previewBGColor_M", QString::number((int)color.m));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setChessboardColor1(const TPixel32 &color, bool isDragging)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_chessboardColor1 = color;
Toshihiro Shimizu 890ddd
	if (!isDragging) {
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor1_R", QString::number((int)color.r));
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor1_G", QString::number((int)color.g));
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor1_B", QString::number((int)color.b));
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor1_M", QString::number((int)color.m));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setChessboardColor2(const TPixel32 &color, bool isDragging)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_chessboardColor2 = color;
Toshihiro Shimizu 890ddd
	if (!isDragging) {
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor2_R", QString::number((int)color.r));
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor2_G", QString::number((int)color.g));
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor2_B", QString::number((int)color.b));
Toshihiro Shimizu 890ddd
		m_settings->setValue("chessboardColor2_M", QString::number((int)color.m));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableShowRasterImagesDarkenBlendedInViewer(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_showRasterImagesDarkenBlendedInViewer = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("showRasterImagesDarkenBlendedInViewer", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableActualPixelViewOnSceneEditingMode(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_actualPixelViewOnSceneEditingMode = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("actualPixelViewOnSceneEditingMode", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableMultiLayerStylePicker(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_multiLayerStylePickerEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("multiLayerStylePickerEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setViewerZoomCenter(int type)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_viewerZoomCenter = type;
Toshihiro Shimizu 890ddd
	m_settings->setValue("viewerZoomCenter", type);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setInitialLoadTlvCachingBehavior(int type)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_initialLoadTlvCachingBehavior = type;
Toshihiro Shimizu 890ddd
	m_settings->setValue("initialLoadTlvCachingBehavior", type);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableShowFrameNumberWithLetters(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_showFrameNumberWithLetters = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("showFrameNumberWithLetters", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableLevelNameOnEachMarker(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_levelNameOnEachMarker = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("levelNameOnEachMarkerEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setColumnIconLoadingPolicy(ColumnIconLoadingPolicy cilp)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	assert(cilp == LoadAtOnce || cilp == LoadOnDemand);
Toshihiro Shimizu 890ddd
	m_columnIconLoadingPolicy = cilp;
Toshihiro Shimizu 890ddd
	m_settings->setValue("columnIconLoadingPolicy", QString::number((int)cilp));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableMoveCurrent(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_moveCurrentFrameByClickCellArea = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("moveCurrentFrameByClickCellArea", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableRemoveSceneNumberFromLoadedLevelName(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_removeSceneNumberFromLoadedLevelName = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("removeSceneNumberFromLoadedLevelName", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableReplaceAfterSaveLevelAs(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_replaceAfterSaveLevelAs = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("replaceAfterSaveLevelAs", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableOnionSkin(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_onionSkinEnabled = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("onionSkinEnabled", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setShow0ThickLines(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_show0ThickLines = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue(s_show0ThickLines, s_bool[on]);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setRegionAntialias(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_regionAntialias = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue(s_regionAntialias, s_bool[on]);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setBlankValues(int blanksCount, TPixel32 blankColor)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_blanksCount = blanksCount;
Toshihiro Shimizu 890ddd
	m_blankColor = blankColor;
Toshihiro Shimizu 890ddd
	m_settings->setValue("blanksCount", QString::number(blanksCount));
Toshihiro Shimizu 890ddd
	m_settings->setValue("blankColor.r", QString::number(blankColor.r));
Toshihiro Shimizu 890ddd
	m_settings->setValue("blankColor.g", QString::number(blankColor.g));
Toshihiro Shimizu 890ddd
	m_settings->setValue("blankColor.b", QString::number(blankColor.b));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setOnionPaperThickness(int thickness)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_onionPaperThickness = thickness;
Toshihiro Shimizu 890ddd
	m_settings->setValue("onionPaperThickness", QString::number(thickness));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setViewValues(int shrink, int step)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_shrink = shrink;
Toshihiro Shimizu 890ddd
	m_step = step;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_settings->setValue("viewShrink", QString::number(shrink));
Toshihiro Shimizu 890ddd
	m_settings->setValue("viewStep", QString::number(step));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
void setCurrentUnits(std::string measureName, std::string units)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TMeasure *m = TMeasureManager::instance()->get(measureName);
Toshihiro Shimizu 890ddd
	if (!m)
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	TUnit *u = m->getUnit(toWideString(units));
Toshihiro Shimizu 890ddd
	if (!u)
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	m->setCurrentUnit(u);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
void Preferences::setUnits(std::string units)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_units = QString::fromStdString(units);
Toshihiro Shimizu 890ddd
	m_settings->setValue("linearUnits", m_units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("length", units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("length.x", units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("length.y", units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("length.lx", units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("length.ly", units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("fxLength", units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("pippo", units);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
void Preferences::setCameraUnits(std::string units)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_cameraUnits = QString::fromStdString(units);
Toshihiro Shimizu 890ddd
	m_settings->setValue("cameraUnits", m_cameraUnits);
Toshihiro Shimizu 890ddd
	setCurrentUnits("camera.lx", units);
Toshihiro Shimizu 890ddd
	setCurrentUnits("camera.ly", units);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
void Preferences::setScanLevelType(std::string type)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_scanLevelType = QString::fromStdString(type);
Toshihiro Shimizu 890ddd
	m_settings->setValue("scanLevelType", m_scanLevelType);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setKeyframeType(int s)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_keyframeType = s;
Toshihiro Shimizu 890ddd
	m_settings->setValue("keyframeType", s);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setAnimationStep(int s)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_animationStep = s;
Toshihiro Shimizu 890ddd
	m_settings->setValue("animationStep", s);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setUndoMemorySize(int memorySize)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_undoMemorySize = memorySize;
Toshihiro Shimizu 890ddd
	TUndoManager::manager()->setUndoMemorySize(memorySize);
Toshihiro Shimizu 890ddd
	m_settings->setValue("undoMemorySize", memorySize);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
QString Preferences::getCurrentLanguage() const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return m_languageMaps[m_currentLanguage];
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
QString Preferences::getLanguage(int index) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return m_languageMaps[index];
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int Preferences::getLanguageCount() const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return (int)m_languageMaps.size();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setCurrentLanguage(int currentLanguage)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_currentLanguage = currentLanguage;
Toshihiro Shimizu 890ddd
	m_settings->setValue("CurrentLanguage", m_currentLanguage);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
QString Preferences::getCurrentStyleSheet() const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return m_styleSheetMaps[m_currentStyleSheet];
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
QString Preferences::getStyleSheet(int index) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return m_styleSheetMaps[index];
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int Preferences::getStyleSheetCount() const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return (int)m_styleSheetMaps.size();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setCurrentStyleSheet(int currentStyleSheet)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_currentStyleSheet = currentStyleSheet;
Toshihiro Shimizu 890ddd
	m_settings->setValue("CurrentStyleSheet", m_currentStyleSheet);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setAutocreationType(int autocreationType)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_autocreationType = autocreationType;
Toshihiro Shimizu 890ddd
	m_settings->setValue("AutocreationType", m_autocreationType);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setDragCellsBehaviour(int dragCellsBehaviour)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_dragCellsBehaviour = dragCellsBehaviour;
Toshihiro Shimizu 890ddd
	m_settings->setValue("DragCellsBehaviour", m_dragCellsBehaviour);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setLineTestFpsCapture(int lineTestFpsCapture)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_lineTestFpsCapture = lineTestFpsCapture;
Toshihiro Shimizu 890ddd
	m_settings->setValue("LineTestFpsCapture", m_lineTestFpsCapture);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setFillOnlySavebox(bool on)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_fillOnlySavebox = on;
Toshihiro Shimizu 890ddd
	m_settings->setValue("FillOnlysavebox", on ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableLevelsBackup(bool enabled)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_levelsBackupEnabled = enabled;
Toshihiro Shimizu 890ddd
	m_settings->setValue("levelsBackupEnabled", enabled ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::enableSceneNumbering(bool enabled)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_sceneNumberingEnabled = enabled;
Toshihiro Shimizu 890ddd
	m_settings->setValue("sceneNumberingEnabled", enabled ? "1" : "0");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setDefLevelType(int levelType)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_defLevelType = levelType;
Toshihiro Shimizu 890ddd
	m_settings->setValue("DefLevelType", levelType);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setDefLevelWidth(double width)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_defLevelWidth = width;
Toshihiro Shimizu 890ddd
	m_settings->setValue("DefLevelWidth", width);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setDefLevelHeight(double height)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_defLevelHeight = height;
Toshihiro Shimizu 890ddd
	m_settings->setValue("DefLevelHeight", height);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setDefLevelDpi(double dpi)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_defLevelDpi = dpi;
Toshihiro Shimizu 890ddd
	m_settings->setValue("DefLevelDpi", dpi);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::setPaletteTypeOnLoadRasterImageAsColorModel(int type)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_paletteTypeOnLoadRasterImageAsColorModel = type;
Toshihiro Shimizu 890ddd
	m_settings->setValue("paletteTypeOnLoadRasterImageAsColorModel", type);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int Preferences::addLevelFormat(const LevelFormat &format)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	LevelFormatVector::iterator lft = m_levelFormats.insert(
Toshihiro Shimizu 890ddd
		std::upper_bound(m_levelFormats.begin(), m_levelFormats.end(),
Toshihiro Shimizu 890ddd
						 format, formatLess),
Toshihiro Shimizu 890ddd
		format);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int formatIdx = int(lft - m_levelFormats.begin()); // NOTE: Must be disjoint from the instruction
Toshihiro Shimizu 890ddd
													   //       above, since operator-'s param evaluation
Toshihiro Shimizu 890ddd
													   //       order is unspecified
Toshihiro Shimizu 890ddd
	setValue(*m_settings, m_levelFormats);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	return formatIdx;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void Preferences::removeLevelFormat(int formatIdx)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	assert(0 <= formatIdx && formatIdx < int(m_levelFormats.size()));
Toshihiro Shimizu 890ddd
	m_levelFormats.erase(m_levelFormats.begin() + formatIdx);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	setValue(*m_settings, m_levelFormats);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
const Preferences::LevelFormat &Preferences::levelFormat(int formatIdx) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	assert(0 <= formatIdx && formatIdx < int(m_levelFormats.size()));
Toshihiro Shimizu 890ddd
	return m_levelFormats[formatIdx];
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int Preferences::levelFormatsCount() const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return int(m_levelFormats.size());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
int Preferences::matchLevelFormat(const TFilePath &fp) const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	LevelFormatVector::const_iterator lft =
Toshihiro Shimizu 890ddd
		std::find_if(m_levelFormats.begin(), m_levelFormats.end(),
Toshihiro Shimizu 890ddd
					 boost::bind(&LevelFormat::matches, _1, boost::cref(fp)));
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	return (lft != m_levelFormats.end()) ? lft - m_levelFormats.begin() : -1;
Toshihiro Shimizu 890ddd
}