From ff99f698b2c0eac6cad6ceda93da84e1aeb3780f Mon Sep 17 00:00:00 2001 From: joshholtrop Date: Wed, 19 Aug 2009 18:03:26 +0000 Subject: [PATCH] PPPC creating a Config object now, added parsing of pin entry field git-svn-id: http://apu.dw.local/svnusers/JoshHoltrop/pppc/trunk@55 8131a0b2-b21c-1c47-bd6a-f003126495bd --- Config.cc | 6 +++++- pppc.cc | 5 +++++ pppc.h | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Config.cc b/Config.cc index 499cce8..d20d517 100644 --- a/Config.cc +++ b/Config.cc @@ -66,7 +66,11 @@ void Config::read(const char * file) } else { - if (parts.first == "on_start") + if (parts.first == "pin") + { + entries[entry_num].pin = atoi(parts.second.c_str()); + } + else if (parts.first == "on_start") { entries[entry_num].on_start = parseAction(parts.second); } diff --git a/pppc.cc b/pppc.cc index afab653..1849bc4 100644 --- a/pppc.cc +++ b/pppc.cc @@ -91,6 +91,11 @@ void addMenuItem(HMENU hMenu, CHAR * itemstr, WORD id) PPPC::PPPC(HINSTANCE hInstance, const char * config_file) { + if (config_file != NULL) + { + m_config.read(config_file); + } + /* Load the application icon */ HICON icon = ::LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); if (icon == 0) diff --git a/pppc.h b/pppc.h index 7132532..f2bafca 100644 --- a/pppc.h +++ b/pppc.h @@ -2,6 +2,8 @@ #ifndef PPPC_H #define PPPC_H +#include "Config.h" + #define APP_NAME "Parallel Port Power Controller" #define WM_ICON_NOTIFY (WM_APP + 42) @@ -13,6 +15,7 @@ class PPPC BOOL mainLoop(); protected: + Config m_config; HWND m_hWnd; NOTIFYICONDATA m_nid; };