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