2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// AEGISUB
|
|
|
|
//
|
|
|
|
// Website: http://aegisub.cellosoft.com
|
|
|
|
// Contact: mailto:zeratul@cellosoft.com
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
///////////
|
|
|
|
// Headers
|
|
|
|
#include <wx/wxprec.h>
|
|
|
|
#include <map>
|
|
|
|
#include "variable_data.h"
|
|
|
|
|
|
|
|
|
2007-01-03 04:47:08 +01:00
|
|
|
//////////////////////
|
|
|
|
// Modification types
|
|
|
|
enum ModType {
|
|
|
|
MOD_OFF = -1,
|
|
|
|
MOD_AUTOMATIC,
|
2007-01-03 22:49:13 +01:00
|
|
|
MOD_RESTART,
|
2007-01-04 00:29:03 +01:00
|
|
|
MOD_EDIT_BOX,
|
|
|
|
MOD_GRID,
|
|
|
|
MOD_VIDEO,
|
2007-04-08 21:27:46 +02:00
|
|
|
MOD_VIDEO_RELOAD,
|
2007-04-10 04:55:23 +02:00
|
|
|
MOD_AUDIO,
|
|
|
|
MOD_AUDIO_RELOAD
|
2007-01-03 04:47:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
/////////////////////////////
|
|
|
|
// Class that stores options
|
|
|
|
class OptionsManager {
|
|
|
|
private:
|
2007-01-03 04:47:08 +01:00
|
|
|
ModType curModType;
|
2006-01-16 22:02:54 +01:00
|
|
|
bool modified;
|
2008-01-21 00:57:03 +01:00
|
|
|
bool overriding;
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString filename;
|
|
|
|
std::map<wxString,VariableData> opt;
|
2007-01-03 04:47:08 +01:00
|
|
|
std::map<wxString,ModType> optType;
|
2008-01-20 05:55:44 +01:00
|
|
|
int lastVersion;
|
2007-01-03 04:47:08 +01:00
|
|
|
|
|
|
|
void SetModificationType(ModType type);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
OptionsManager();
|
|
|
|
~OptionsManager();
|
|
|
|
|
2007-01-15 06:38:32 +01:00
|
|
|
void Clear();
|
2006-01-16 22:02:54 +01:00
|
|
|
void SetFile(wxString file);
|
2009-06-30 07:55:03 +02:00
|
|
|
wxString GetFile() const;
|
2006-01-16 22:02:54 +01:00
|
|
|
void Save();
|
|
|
|
void Load();
|
2008-01-21 00:57:03 +01:00
|
|
|
void LoadDefaults(bool onlyDefaults=false,bool versionOverride=false);
|
2008-07-03 03:53:22 +02:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
void AddToRecentList (wxString entry,wxString list);
|
2008-07-03 03:53:22 +02:00
|
|
|
void RemoveFromRecentList (wxString entry,wxString list);
|
2006-01-16 22:02:54 +01:00
|
|
|
wxArrayString GetRecentList (wxString list);
|
|
|
|
|
2008-01-21 00:57:03 +01:00
|
|
|
void SetInt(wxString key,int param,int ifLastVersion=-1);
|
|
|
|
void SetFloat(wxString key,double param,int ifLastVersion=-1);
|
|
|
|
void SetBool(wxString key,bool param,int ifLastVersion=-1);
|
|
|
|
void SetText(wxString key,wxString param,int ifLastVersion=-1);
|
|
|
|
void SetColour(wxString key,wxColour param,int ifLastVersion=-1);
|
2007-01-03 06:33:17 +01:00
|
|
|
void ResetWith(wxString key,wxString param);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
bool IsDefined(wxString key);
|
|
|
|
int AsInt(wxString key);
|
|
|
|
double AsFloat(wxString key);
|
|
|
|
bool AsBool(wxString key);
|
|
|
|
wxString AsText(wxString key);
|
|
|
|
wxColour AsColour(wxString key);
|
2007-01-03 04:47:08 +01:00
|
|
|
ModType GetModType(wxString key);
|
2006-01-16 22:02:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////
|
|
|
|
// Global instance
|
|
|
|
extern OptionsManager Options;
|