forked from bruderstein/PythonScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigFile.h
More file actions
69 lines (47 loc) · 1.87 KB
/
ConfigFile.h
File metadata and controls
69 lines (47 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef _CONFIGFILE_H
#define _CONFIGFILE_H
class ConfigFile
{
public:
typedef std::vector< tstring > MenuItemsTD;
typedef std::vector< std::pair<tstring, std::pair<HBITMAP, tstring> > > ToolbarItemsTD;
typedef std::map< tstring, tstring > SettingsTD;
ConfigFile(const TCHAR *configDir, const TCHAR *pluginDir, HINSTANCE hInst);
virtual ~ConfigFile();
static ConfigFile* create(const TCHAR *configDir, const TCHAR *pluginDir, HINSTANCE hInst);
static ConfigFile* getInstance() { return s_instance; };
// TODO: Need to make these pointers
MenuItemsTD getMenuItems() { return m_menuItems; };
ToolbarItemsTD getToolbarItems() { return m_toolbarItems; };
const std::string& getMenuScript(idx_t index) const;
void addMenuItem(const tstring scriptPath);
void addToolbarItem(const tstring scriptPath, const tstring iconPath);
void setSetting(const tstring& settingName, const tstring settingValue);
const tstring& getSetting(const TCHAR* settingName);
void clearItems();
void save();
void refresh() { clearItems(); readConfig(); };
const tstring& getMachineScriptsDir() { return m_machineScriptsDir; };
const tstring& getUserScriptsDir() { return m_userScriptsDir; };
const tstring& getConfigDir() { return m_configDir; };
protected:
void readConfig();
private:
ConfigFile(); // default constructor disabled
HINSTANCE m_hInst;
static ConfigFile* s_instance;
tstring m_configFilename;
tstring m_pluginDir;
tstring m_machineScriptsDir;
tstring m_userScriptsDir;
tstring m_configDir;
MenuItemsTD m_menuItems;
std::vector< std::string > m_menuScripts;
// Used in case an invalid script number is requested
// so we can return a reference to this puppy instead.
std::string m_emptyString;
ToolbarItemsTD m_toolbarItems;
std::map< tstring, HICON > m_icons;
SettingsTD m_settings;
};
#endif