Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
It'll be really smart using boost::bimap instead of std::map, to be able to
look up both ways. I'm wary of pullilng boost in for this alone though. We
will get the REGEX functionality too, yes that's true, but still. I too, am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that. When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
//
// TODO: Look into std::function
//
// Heavily modified default file. So far it´s an ugly mix of C and C++.
Only excuse is too little time.
//
// TODO: Make file fully C++
//
// [SBT]
pragma once
include "stdafx.h"
using namespace std; // Throw away the std:: syntax from vector and map to
avoid clutter. [SBT]
class CHermesSettings; // Forward declaration [SBT]
typedef enum : unsigned / Force unsigned short type [SBT]/ {
NONE = 0,
THIN,
RESIZABLE,
DLGFRAME
} BORDERVALUE, *PBORDERCVALUE;
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
NEVER = 0,
IASTARTTLS,
RALTERNATEPORT,
RSTARTTLS
} SECURESOCKETSONRECEIVE, *PSECURESOCKETSONRECEIVE;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
typedef map<unsigned short,="" wstring=""> _SECURESOCKETS, *P_SECURESOCKETS;</unsigned>
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
POP = 0,
IMAP
} SERVERCONFIG, *PSERVERCONFIG;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Universal MethodFunc type for auto-mapping and auto-callback [SBT]
CComVariant GetSet3DLook(CComVariant v = nullptr);
CComVariant GetSetCaption(CComVariant v = nullptr);
CComVariant GetSetBorder(CComVariant v = nullptr);
CComVariant GetSetWindowHeight(CComVariant v = nullptr);
CComVariant GetSetWindowWidth(CComVariant v = nullptr);
CComVariant GetSetFont(CComVariant v = nullptr);
CComVariant GetSetUseSystemFont(CComVariant v = nullptr);
CComVariant GetSetName(CComVariant v = nullptr);
CComVariant GetSetWindowColor(CComVariant v = nullptr);
CComVariant GetSetRealName(CComVariant v = nullptr);
CComVariant GetSetEMail(CComVariant v = nullptr);
CComVariant GetSetServerIncoming(CComVariant v = nullptr);
CComVariant GetSetUserName(CComVariant v = nullptr);
CComVariant GetSetSMTPServer(CComVariant v = nullptr);
CComVariant GetSetAllowAuth(CComVariant v = nullptr);
CComVariant GetSetAutoOpenMailDetail(CComVariant v = nullptr);
CComVariant GetSetMailServer(CComVariant v = nullptr);
CComVariant GetSetMailServerUserName(CComVariant v = nullptr);
CComVariant GetSetMailCheckInterval(CComVariant v = nullptr);
CComVariant GetSetCheckWithoutNetworkConnection(CComVariant v = nullptr);
CComVariant GetSetCheckWithoutBattery(CComVariant v = nullptr);
CComVariant GetSetSendOnCheck(CComVariant v = nullptr);
CComVariant GetSetSecureSockets(CComVariant v = nullptr);
CComVariant GetSetServerConfig(CComVariant v = nullptr);
//////////////////////////////////////////////////////////////////////////////////////
// Get the generic accessors [SBT]
PFUNCTIONMAP GetFunctionMap(); // See typedef map at beginning of file.
// Implement class serialization [SBT]
IMPLEMENT_SERIAL(CHermesSettings, CObject, VERSIONABLE_SCHEMA | 2)
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Construction / Destruction [SBT]
//
//
// Adding a new setting. It's a pretty byzantine process but that's the
price for automation. This works flawlessly for the simpler values.
// I have yet to figure out how to store structuresa in CComVariant.
COLORREF is the size of a DWORD, that could maybe be done, but LOGFONT is
another matter...
//
// If not already there, in PropertiesWnd.cpp, void
CPropertiesWnd::InitPropList() add the group to which you want the setting
to belong:
//
// eg.:
//
// CMFCPropertyGridProperty pGroup4 = new
CMFCPropertyGridProperty(_T("Eudora"));
//
// Here, the group "Eudora" has already been created.
//
// to add a new persistent setting to this group first declare the
CComVariant in the CHermesSettings header file, like:
//
// CComVariant m_strServerIncoming;
//
// Make sure it's initialized in the constructor initialization list (or
for more more complicated settingds in the body of the CHermesSettings
constructor.
//
// Add a new value (in this case SERVERINCOMING) in the FUNCTIONPONTERKEYS
enum in the CHmeresSettings header.
//
// Add an accessor for the new setting along with the rest like so.:
//
// CComVariant GetSetServerIncoming(CComVariant v = nullptr);
//
// Implement it in the CHermesSettings source file as:
//
// CComVariant CHermesSettings::GetSetServerIncoming(CComVariant v)
// {
// if (v)
// m_strServerIncoming = v->bstrVal;
// return &m_strServerIncoming;
// }
//
// Add it to the void CHermesSettings::MapFunctionPointers() function as
//
// m_FunctionMap[SERVERINCOMING] = &CHermesSettings::GetSetServerIncominig;
//
//
// Make sure it's addded to the void CHermesSettings::Serialize(CArchive&
archive) function like
//
// m_strServerIncoming.WriteToStream(&pStream);
// and
// m_strServerIncoming.ReadFromStream(&pStream);
//
//
// Back in PropertiesWnd.cpp add the new settings as:
//
// cv = pSettings->GetSetServerIncoming();
// CMFCPropertyGridProperty pServerIncoming = new
CMFCPropertyGridProperty(_T("Server Incoming"), (_variant_t)(cv->bstrVal),
_T("Server incoming"));
// pServerIncoming->SetData(SERVERINCOMING);
// pGroup4->AddSubItem(pServerIncoming);
//
// Because of the pServerIncoming->SetData(SERVERINCOMING); call, the
//
// LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam)
//
// will automatically be able to use the SERVERINCOMING key to get the
pointer to the proper accessor and call it when the value changes.
//
// Settings are automatically loaded on startup and saved on exit.
//
// void CPropertiesWnd::OnProperties2()
//
// corresponds tro the toolbutton with the little lightning on. This will
save all the settings on demand.
//
//
// Make sure to delete the settings file when adding or removing settings
or the Serialiable Write and Read will ofcourse not match.
////////////////////////////////////////////////////////////////////////////////
// Automatic accessors [SBT]
//
// These CAN be called manually but they're really not supposed to be. [SBT]
//
// Oh, wait, I made the settings non-public, so yes. Go ahead.
//
It'll be really smart using boost::bimap instead of std::map, to be able to
look up both ways. I'm wary of pullilng boost in for this alone though. We
will get the REGEX functionality too, yes that's true, but still. I too, am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that. When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Deal?
Regards,
Søren
On Thursday, January 17, 2019, Soren Bro sbrothy@users.sourceforge.net
wrote:
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
I'm working on the persistent settings right now. They need a good cleanup
when I'm done. I just felt a need for showing you that somethig is indeed
going on...
//
// TODO: Look into std::function
//
// Heavily modified default file. So far it´s an ugly mix of C and C++.
Only excuse is too little time.
//
// TODO: Make file fully C++
//
// [SBT]
pragma once include "stdafx.h"
using namespace std; // Throw away the std:: syntax from vector and map to
avoid clutter. [SBT]
class CHermesSettings; // Forward declaration [SBT]
typedef enum : unsigned / Force unsigned short type [SBT]/ {
NONE = 0,
THIN,
RESIZABLE,
DLGFRAME
} BORDERVALUE, *PBORDERCVALUE;
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
NEVER = 0,
IASTARTTLS,
RALTERNATEPORT,
RSTARTTLS
} SECURESOCKETSONRECEIVE, *PSECURESOCKETSONRECEIVE;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
typedef map<unsigned short,="" wstring=""> _SECURESOCKETS,
*P_SECURESOCKETS;</unsigned>
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
POP = 0,
IMAP
} SERVERCONFIG, *PSERVERCONFIG;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Universal MethodFunc type for auto-mapping and auto-callback [SBT]
CComVariant GetSet3DLook(CComVariant v = nullptr);
CComVariant GetSetCaption(CComVariant v = nullptr);
CComVariant GetSetBorder(CComVariant v = nullptr);
CComVariant GetSetWindowHeight(CComVariant v = nullptr);
CComVariant GetSetWindowWidth(CComVariant v = nullptr);
CComVariant GetSetFont(CComVariant v = nullptr);
CComVariant GetSetUseSystemFont(CComVariant v = nullptr);
CComVariant GetSetName(CComVariant v = nullptr);
CComVariant GetSetWindowColor(CComVariant v = nullptr);
CComVariant GetSetRealName(CComVariant v = nullptr);
CComVariant GetSetEMail(CComVariant v = nullptr);
CComVariant GetSetServerIncoming(CComVariant v = nullptr);
CComVariant GetSetUserName(CComVariant v = nullptr);
CComVariant GetSetSMTPServer(CComVariant v = nullptr);
CComVariant GetSetAllowAuth(CComVariant v = nullptr);
CComVariant GetSetAutoOpenMailDetail(CComVariant v = nullptr);
CComVariant GetSetMailServer(CComVariant v = nullptr);
CComVariant GetSetMailServerUserName(CComVariant v = nullptr);
CComVariant GetSetMailCheckInterval(CComVariant v = nullptr);
CComVariant GetSetCheckWithoutNetworkConnection(CComVariant v =
nullptr);
CComVariant GetSetCheckWithoutBattery(CComVariant v = nullptr);
CComVariant GetSetSendOnCheck(CComVariant v = nullptr);
CComVariant GetSetSecureSockets(CComVariant v = nullptr);
CComVariant GetSetServerConfig(CComVariant v = nullptr);
//////////////////////////////////////////////////////////////////////////////////////
// Get the generic accessors [SBT]
PFUNCTIONMAP GetFunctionMap(); // See typedef map at beginning of file.
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Implementation BEF [SBT]
include "stdafx.h" include "HermesSettings.h" include "resource.h"
// Implement class serialization [SBT]
IMPLEMENT_SERIAL(CHermesSettings, CObject, VERSIONABLE_SCHEMA | 2)
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Construction / Destruction [SBT]
//
//
// Adding a new setting. It's a pretty byzantine process but that's the
price for automation. This works flawlessly for the simpler values.
// I have yet to figure out how to store structuresa in CComVariant.
COLORREF is the size of a DWORD, that could maybe be done, but LOGFONT is
another matter...
//
// If not already there, in PropertiesWnd.cpp, void
CPropertiesWnd::InitPropList() add the group to which you want the setting
to belong:
//
// eg.:
//
// CMFCPropertyGridProperty
pGroup4 = new CMFCPropertyGridProperty(_T("Eudora")); // // Here, the
group "Eudora" has already been created. // // to add a new persistent
setting to this group first declare the CComVariant in the CHermesSettings
header file, like: // // CComVariant m_strServerIncoming; // // Make sure
it's initialized in the constructor initialization list (or for more more
complicated settingds in the body of the CHermesSettings constructor. // //
Add a new value (in this case SERVERINCOMING) in the FUNCTIONPONTERKEYS
enum in the CHmeresSettings header. // // Add an accessor for the new
setting along with the rest like so.: // // CComVariant *GetSetServerIncoming(CComVariant
v = nullptr); // // Implement it in the CHermesSettings source file as:
// // CComVariant CHermesSettings::GetSetServerIncoming(CComVariant
v) // { // if (v) // m_strServerIncoming = v->bstrVal; // return
&m_strServerIncoming; // } // // Add it to the void
CHermesSettings::MapFunctionPointers() function as // //
m_FunctionMap[SERVERINCOMING] = &CHermesSettings::GetSetServerIncominig; //
// // Make sure it's addded to the void
CHermesSettings::Serialize(CArchive& archive) function like // //
m_strServerIncoming.WriteToStream(&pStream); // and //
m_strServerIncoming.ReadFromStream(&pStream); // // // Back in
PropertiesWnd.cpp add the new settings as: // // cv =
pSettings->GetSetServerIncoming(); // CMFCPropertyGridProperty pServerIncoming
= new
CMFCPropertyGridProperty(_T("Server Incoming"), (_variant_t)(cv->bstrVal),
_T("Server incoming"));
// pServerIncoming->SetData(SERVERINCOMING);
// pGroup4->AddSubItem(pServerIncoming);
//
// Because of the pServerIncoming->SetData(SERVERINCOMING); call, the
//
// LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam)
//
// will automatically be able to use the SERVERINCOMING key to get the
pointer to the proper accessor and call it when the value changes.
//
// Settings are automatically loaded on startup and saved on exit.
//
// void CPropertiesWnd::OnProperties2()
//
// corresponds tro the toolbutton with the little lightning on. This will
save all the settings on demand.
//
//
// Make sure to delete the settings file when adding or removing settings
or the Serialiable Write and Read will ofcourse not match.
////////////////////////////////////////////////////////////////////////////////
// Automatic accessors [SBT]
//
// These CAN be called manually but they're really not supposed to be. [SBT]
//
// Oh, wait, I made the settings non-public, so yes. Go ahead.
//
On Thu, Jan 17, 2019 at 6:26 PM Soren Bro sbrothy@users.sourceforge.net
wrote:
It'll be really smart using boost::bimap instead of std::map, to be able to
look up both ways. I'm wary of pullilng boost in for this alone though. We
will get the REGEX functionality too, yes that's true, but still. I too, am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that. When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Deal?
Regards,
Søren
On Thursday, January 17, 2019, Soren Bro sbrothy@users.sourceforge.net
wrote:
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
I'm working on the persistent settings right now. They need a good cleanup
when I'm done. I just felt a need for showing you that somethig is indeed
going on...
//
// TODO: Look into std::function
//
// Heavily modified default file. So far it´s an ugly mix of C and C++.
Only excuse is too little time.
//
// TODO: Make file fully C++
//
// [SBT]
pragma once include "stdafx.h"
using namespace std; // Throw away the std:: syntax from vector and map to
avoid clutter. [SBT]
class CHermesSettings; // Forward declaration [SBT]
typedef enum : unsigned / Force unsigned short type [SBT]/ {
NONE = 0,
THIN,
RESIZABLE,
DLGFRAME
} BORDERVALUE, *PBORDERCVALUE;
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
NEVER = 0,
IASTARTTLS,
RALTERNATEPORT,
RSTARTTLS
} SECURESOCKETSONRECEIVE, *PSECURESOCKETSONRECEIVE;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both
ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
typedef map<unsigned short,="" wstring=""> _SECURESOCKETS,
*P_SECURESOCKETS;</unsigned>
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
POP = 0,
IMAP
} SERVERCONFIG, *PSERVERCONFIG;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both
ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Universal MethodFunc type for auto-mapping and auto-callback [SBT]
CComVariant GetSet3DLook(CComVariant v = nullptr);
CComVariant GetSetCaption(CComVariant v = nullptr);
CComVariant GetSetBorder(CComVariant v = nullptr);
CComVariant GetSetWindowHeight(CComVariant v = nullptr);
CComVariant GetSetWindowWidth(CComVariant v = nullptr);
CComVariant GetSetFont(CComVariant v = nullptr);
CComVariant GetSetUseSystemFont(CComVariant v = nullptr);
CComVariant GetSetName(CComVariant v = nullptr);
CComVariant GetSetWindowColor(CComVariant v = nullptr);
CComVariant GetSetRealName(CComVariant v = nullptr);
CComVariant GetSetEMail(CComVariant v = nullptr);
CComVariant GetSetServerIncoming(CComVariant v = nullptr);
CComVariant GetSetUserName(CComVariant v = nullptr);
CComVariant GetSetSMTPServer(CComVariant v = nullptr);
CComVariant GetSetAllowAuth(CComVariant v = nullptr);
CComVariant GetSetAutoOpenMailDetail(CComVariant v = nullptr);
CComVariant GetSetMailServer(CComVariant v = nullptr);
CComVariant GetSetMailServerUserName(CComVariant v = nullptr);
CComVariant GetSetMailCheckInterval(CComVariant v = nullptr);
CComVariant GetSetCheckWithoutNetworkConnection(CComVariant v =
nullptr);
CComVariant GetSetCheckWithoutBattery(CComVariant v = nullptr);
CComVariant GetSetSendOnCheck(CComVariant v = nullptr);
CComVariant GetSetSecureSockets(CComVariant v = nullptr);
CComVariant GetSetServerConfig(CComVariant v = nullptr);
//////////////////////////////////////////////////////////////////////////////////////
// Get the generic accessors [SBT]
PFUNCTIONMAP GetFunctionMap(); // See typedef map at beginning of file.
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Implementation BEF [SBT]
include "stdafx.h" include "HermesSettings.h" include "resource.h"
// Implement class serialization [SBT]
IMPLEMENT_SERIAL(CHermesSettings, CObject, VERSIONABLE_SCHEMA | 2)
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Construction / Destruction [SBT]
//
//
// Adding a new setting. It's a pretty byzantine process but that's the
price for automation. This works flawlessly for the simpler values.
// I have yet to figure out how to store structuresa in CComVariant.
COLORREF is the size of a DWORD, that could maybe be done, but LOGFONT is
another matter...
//
// If not already there, in PropertiesWnd.cpp, void
CPropertiesWnd::InitPropList() add the group to which you want the setting
to belong:
//
// eg.:
//
// CMFCPropertyGridProperty
pGroup4 = new CMFCPropertyGridProperty(_T("Eudora")); // // Here, the
group "Eudora" has already been created. // // to add a new persistent
setting to this group first declare the CComVariant in the CHermesSettings
header file, like: // // CComVariant m_strServerIncoming; // // Make sure
it's initialized in the constructor initialization list (or for more more
complicated settingds in the body of the CHermesSettings constructor. // //
Add a new value (in this case SERVERINCOMING) in the FUNCTIONPONTERKEYS
enum in the CHmeresSettings header. // // Add an accessor for the new
setting along with the rest like so.: // // CComVariant *GetSetServerIncoming(CComVariant
v = nullptr); // // Implement it in the CHermesSettings source file as:
// // CComVariant CHermesSettings::GetSetServerIncoming(CComVariant
v) // { // if (v) // m_strServerIncoming = v->bstrVal; // return
&m_strServerIncoming; // } // // Add it to the void
CHermesSettings::MapFunctionPointers() function as // //
m_FunctionMap[SERVERINCOMING] = &CHermesSettings::GetSetServerIncominig; //
// // Make sure it's addded to the void
CHermesSettings::Serialize(CArchive& archive) function like // //
m_strServerIncoming.WriteToStream(&pStream); // and //
m_strServerIncoming.ReadFromStream(&pStream); // // // Back in
PropertiesWnd.cpp add the new settings as: // // cv =
pSettings->GetSetServerIncoming(); // CMFCPropertyGridProperty pServerIncoming
= new
CMFCPropertyGridProperty(_T("Server Incoming"), (_variant_t)(cv->bstrVal),
_T("Server incoming"));
// pServerIncoming->SetData(SERVERINCOMING);
// pGroup4->AddSubItem(pServerIncoming);
//
// Because of the pServerIncoming->SetData(SERVERINCOMING); call, the
//
// LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam)
//
// will automatically be able to use the SERVERINCOMING key to get the
pointer to the proper accessor and call it when the value changes.
//
// Settings are automatically loaded on startup and saved on exit.
//
// void CPropertiesWnd::OnProperties2()
//
// corresponds tro the toolbutton with the little lightning on. This will
save all the settings on demand.
//
//
// Make sure to delete the settings file when adding or removing settings
or the Serialiable Write and Read will ofcourse not match.
////////////////////////////////////////////////////////////////////////////////
// Automatic accessors [SBT]
//
// These CAN be called manually but they're really not supposed to be. [SBT]
//
// Oh, wait, I made the settings non-public, so yes. Go ahead.
//
On Thu, Jan 17, 2019 at 6:26 PM Soren Bro sbrothy@users.sourceforge.net
wrote:
It'll be really smart using boost::bimap instead of std::map, to be able
to
look up both ways. I'm wary of pullilng boost in for this alone though. We
will get the REGEX functionality too, yes that's true, but still. I too,
am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all
h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that.
When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Deal?
Regards,
Søren
On Thursday, January 17, 2019, Soren Bro sbrothy@users.sourceforge.net
wrote:
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
I'm working on the persistent settings right now. They need a good
cleanup when I'm done. I just felt a need for showing you that somethig is
indeed going on...
//
// TODO: Look into std::function
//
// Heavily modified default file. So far it´s an ugly mix of C and C++.
Only excuse is too little time.
//
// TODO: Make file fully C++
//
// [SBT]
pragma once include "stdafx.h"
using namespace std; // Throw away the std:: syntax from vector and map
to
avoid clutter. [SBT]
class CHermesSettings; // Forward declaration [SBT]
typedef enum : unsigned / Force unsigned short type [SBT]/ {
NONE = 0,
THIN,
RESIZABLE,
DLGFRAME
} BORDERVALUE, *PBORDERCVALUE;
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
NEVER = 0,
IASTARTTLS,
RALTERNATEPORT,
RSTARTTLS
} SECURESOCKETSONRECEIVE, *PSECURESOCKETSONRECEIVE;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both
ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way
around
// TODO: The use of wstring is what forces this application into x64
mode.
This will go away when using CString instead
typedef map<unsigned short,="" wstring=""> _SECURESOCKETS,
*P_SECURESOCKETS;</unsigned>
typedef enum : unsigned short / Force unsigned short type [SBT]/ {
POP = 0,
IMAP
} SERVERCONFIG, *PSERVERCONFIG;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both
ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way
around
// TODO: The use of wstring is what forces this application into x64
mode.
This will go away when using CString instead
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Universal MethodFunc type for auto-mapping and auto-callback [SBT]
CComVariant GetSet3DLook(CComVariant v = nullptr);
CComVariant GetSetCaption(CComVariant v = nullptr);
CComVariant GetSetBorder(CComVariant v = nullptr);
CComVariant GetSetWindowHeight(CComVariant v = nullptr);
CComVariant GetSetWindowWidth(CComVariant v = nullptr);
CComVariant GetSetFont(CComVariant v = nullptr);
CComVariant GetSetUseSystemFont(CComVariant v = nullptr);
CComVariant GetSetName(CComVariant v = nullptr);
CComVariant GetSetWindowColor(CComVariant v = nullptr);
CComVariant GetSetRealName(CComVariant v = nullptr);
CComVariant GetSetEMail(CComVariant v = nullptr);
CComVariant GetSetServerIncoming(CComVariant v = nullptr);
CComVariant GetSetUserName(CComVariant v = nullptr);
CComVariant GetSetSMTPServer(CComVariant v = nullptr);
CComVariant GetSetAllowAuth(CComVariant v = nullptr);
CComVariant GetSetAutoOpenMailDetail(CComVariant v = nullptr);
CComVariant GetSetMailServer(CComVariant v = nullptr);
CComVariant GetSetMailServerUserName(CComVariant v = nullptr);
CComVariant GetSetMailCheckInterval(CComVariant v = nullptr);
CComVariant GetSetCheckWithoutNetworkConnection(CComVariant v =
nullptr);
CComVariant GetSetCheckWithoutBattery(CComVariant v = nullptr);
CComVariant GetSetSendOnCheck(CComVariant v = nullptr);
CComVariant GetSetSecureSockets(CComVariant v = nullptr);
CComVariant GetSetServerConfig(CComVariant v = nullptr);
//////////////////////////////////////////////////////////////////////////////////////
// Get the generic accessors [SBT]
PFUNCTIONMAP GetFunctionMap(); // See typedef map at beginning of file.
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Implementation BEF [SBT]
include "stdafx.h" include "HermesSettings.h" include "resource.h"
// Implement class serialization [SBT]
IMPLEMENT_SERIAL(CHermesSettings, CObject, VERSIONABLE_SCHEMA | 2)
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Construction / Destruction [SBT]
//
//
// Adding a new setting. It's a pretty byzantine process but that's the
price for automation. This works flawlessly for the simpler values.
// I have yet to figure out how to store structuresa in CComVariant.
COLORREF is the size of a DWORD, that could maybe be done, but LOGFONT is
another matter...
//
// If not already there, in PropertiesWnd.cpp, void
CPropertiesWnd::InitPropList() add the group to which you want the
setting
to belong:
//
// eg.:
//
// CMFCPropertyGridProperty
pGroup4 = new CMFCPropertyGridProperty(_T("Eudora")); // // Here, the
group "Eudora" has already been created. // // to add a new persistent
setting to this group first declare the CComVariant in the CHermesSettings
header file, like: // // CComVariant m_strServerIncoming; // // Make sure
it's initialized in the constructor initialization list (or for more more
complicated settingds in the body of the CHermesSettings constructor. // //
Add a new value (in this case SERVERINCOMING) in the FUNCTIONPONTERKEYS
enum in the CHmeresSettings header. // // Add an accessor for the new
setting along with the rest like so.: // // CComVariant *GetSetServerIncoming(CComVariant
v = nullptr); // // Implement it in the CHermesSettings source file as:
// // CComVariant CHermesSettings::GetSetServerIncoming(CComVariant
v) // { // if (v) // m_strServerIncoming = v->bstrVal; // return
&m_strServerIncoming; // } // // Add it to the void
CHermesSettings::MapFunctionPointers() function as // //
m_FunctionMap[SERVERINCOMING] = &CHermesSettings::GetSetServerIncominig; //
// // Make sure it's addded to the void
CHermesSettings::Serialize(CArchive& archive) function like // //
m_strServerIncoming.WriteToStream(&pStream); // and //
m_strServerIncoming.ReadFromStream(&pStream); // // // Back in
PropertiesWnd.cpp add the new settings as: // // cv =
pSettings->GetSetServerIncoming(); // CMFCPropertyGridProperty pServerIncoming
= new
CMFCPropertyGridProperty(_T("Server Incoming"),
(_variant_t)(cv->bstrVal),
_T("Server incoming"));
// pServerIncoming->SetData(SERVERINCOMING);
// pGroup4->AddSubItem(pServerIncoming);
//
// Because of the pServerIncoming->SetData(SERVERINCOMING); call, the
//
// LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM
lParam)
//
// will automatically be able to use the SERVERINCOMING key to get the
pointer to the proper accessor and call it when the value changes.
//
// Settings are automatically loaded on startup and saved on exit.
//
// void CPropertiesWnd::OnProperties2()
//
// corresponds tro the toolbutton with the little lightning on. This will
save all the settings on demand.
//
//
// Make sure to delete the settings file when adding or removing settings
or the Serialiable Write and Read will ofcourse not match.
////////////////////////////////////////////////////////////////////////////////
// Automatic accessors [SBT]
//
// These CAN be called manually but they're really not supposed to be. [SBT]
//
// Oh, wait, I made the settings non-public, so yes. Go ahead.
//
On Thu, Jan 17, 2019 at 6:26 PM Soren Bro sbrothy@users.sourceforge.net
wrote:
It'll be really smart using boost::bimap instead of std::map, to be able
to
look up both ways. I'm wary of pullilng boost in for this alone though.
We
will get the REGEX functionality too, yes that's true, but still. I too,
am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all
h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that.
When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Deal?
Regards,
Søren
On Thursday, January 17, 2019, Soren Bro sbrothy@users.sourceforge.net
wrote:
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
Mate, it's not my judgement you're awaiting, eh? It's the judgement of the
base---our grassroots investors.
Never lose sight of that.
PS - My condolences on the passing of your friend. That is truly sad.
On Thu, 17 Jan 2019, 12:26 Soren Bro <sbrothy@users.sourceforge.net wrote:
It'll be really smart using boost::bimap instead of std::map, to be able to
look up both ways. I'm wary of pullilng boost in for this alone though. We
will get the REGEX functionality too, yes that's true, but still. I too, am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that. When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Deal?
Regards,
Søren
On Thursday, January 17, 2019, Soren Bro sbrothy@users.sourceforge.net
wrote:
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
Mate, it's not my judgement you're awaiting, eh? It's the judgement of the
base---our grassroots investors.
Never lose sight of that.
PS - My condolences on the passing of your friend. That is truly sad.
On Thu, 17 Jan 2019, 12:26 Soren Bro <sbrothy@users.sourceforge.net wrote:
It'll be really smart using boost::bimap instead of std::map, to be able to
look up both ways. I'm wary of pullilng boost in for this alone though. We
will get the REGEX functionality too, yes that's true, but still. I too, am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that. When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Deal?
Regards,
Søren
On Thursday, January 17, 2019, Soren Bro sbrothy@users.sourceforge.net
wrote:
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
Title says it all really. It's temporarary. Once I get them replaced with
CStrings or TCHAR * It'll reverse to x32. It's just because I jump some
pretty ugly hoops from time to time.
To make matters worse, a friend of mine I was supposed to visit but, kept
postponing to work on the app, appearently died before I could speak to
him. So there....
Not The most beautiful day...
Regards,
Søren.
--
Søren Bro Thygesen
It'll be really smart using boost::bimap instead of std::map, to be able to
look up both ways. I'm wary of pullilng boost in for this alone though. We
will get the REGEX functionality too, yes that's true, but still. I too, am
a big fan off of the KISS principle.
Apart from that, I'm sure it's annoying, not to say frustrating as all h...
to hear me talking about an application you have never seen and, have no
evidence actually exists,: outside my, admittedly, vivid imagination.
I was promised a deadline to February and I intend to stick with that. When
we get there, what I have to show for myself will go into a proper online
repository, and you can pass judgement there. Where it goes is not so
importantbto me.
Deal?
Regards,
Søren
On Thursday, January 17, 2019, Soren Bro sbrothy@users.sourceforge.net
wrote:
--
Søren Bro Thygesen
Some proof that something is at least going on:
[CHermesSettings.h]
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Header BEF [SBT]
//
// TODO: Look into std::function
//
// Heavily modified default file. So far it´s an ugly mix of C and C++.
Only excuse is too little time.
//
// TODO: Make file fully C++
//
// [SBT]
pragma once
include "stdafx.h"
using namespace std; // Throw away the std:: syntax from vector and map to
avoid clutter. [SBT]
class CHermesSettings; // Forward declaration [SBT]
typedef CComVariant (CHermesSettings::MethodPtr)(CComVariant );
typedef map<dword_ptr, methodptr=""> FUNCTIONMAP, </dword_ptr,>PFUNCTIONMAP;
typedef enum : DWORD_PTR / Force DWORD_PTR type into enum [SBT] / {
THREEDLOOK = 0u,
CAPTION,
BORDER,
WINDOWHEIGHT,
WINDOWWIDTH,
FONT,
USESYSTEMFONT,
NAME,
WINDOWCOLOR,
REALNAME,
EMAIL,
SERVERINCOMING,
USERNAME,
SMTPSERVER,
ALLOWAUTH,
AUTOOPENMAILDETAIL,
MAILSERVER,
MAILSERVERUSERNAME,
MAILCHECKINTERVAL,
CHECKWITHOUTNETWORKCONNECTION,
CHECKWITHOUTBATTERY,
SENDONCHECK,
SECURESOCKETS,
_SERVERCONFIG
} FUNCTIONPONTERKEYS, PFUNCTIONPONTERKEYS;
typedef enum : unsigned / Force unsigned short type [SBT] / {
NONE = 0,
THIN,
RESIZABLE,
DLGFRAME
} BORDERVALUE, *PBORDERCVALUE;
typedef enum : unsigned short / Force unsigned short type [SBT] / {
NEVER = 0,
IASTARTTLS,
RALTERNATEPORT,
RSTARTTLS
} SECURESOCKETSONRECEIVE, *PSECURESOCKETSONRECEIVE;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
typedef map<unsigned short,="" wstring=""> _SECURESOCKETS, *P_SECURESOCKETS;</unsigned>
static const _SECURESOCKETS s_SecureSocketNames = {
pair<unsigned short,="" wstring="">(NEVER, L"Never"),
pair<unsigned short,="" wstring="">(IASTARTTLS, L"If available, Start TLS"),
pair<unsigned short,="" wstring="">(RALTERNATEPORT, L"Required, Alternate port"),
pair<unsigned short,="" wstring="">(RSTARTTLS, L"Required, STARTTLS")
};</unsigned></unsigned></unsigned></unsigned>
typedef enum : unsigned short / Force unsigned short type [SBT] / {
POP = 0,
IMAP
} SERVERCONFIG, *PSERVERCONFIG;
// TODO: make this CString. I had to make this work in a hurry and this
does work. CString, for whatever reason, not so much....
// TODO: make this a boost::bimap. We want to be able to look up both ways.
// TODO: Reason for this ridiculous name is that we already have an enum
value above called SECURESOCKETS. It should really be the othre way around
// TODO: The use of wstring is what forces this application into x64 mode.
This will go away when using CString instead
typedef map<unsigned short,="" wstring=""> _SERVERCONFIGS, *P_SERVERCONFIGS;</unsigned>
static const _SERVERCONFIGS s_ServerConfigNames = {
pair<unsigned short,="" wstring="">(POP, L"POP"),
pair<unsigned short,="" wstring="">(IMAP, L"IMAP")
};</unsigned></unsigned>
/*
// Border types
typedef vector<cstring> DIALOGFRAMENAMES, *PDIALOGFRAMENAMES;
static const DIALOGFRAMENAMES s_FramesNames = { _T("None"), _T("Thin"),
_T("Resizable"), _T("Dialog Frame") };</cstring>
*/
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings class declaration [SBT]
class CHermesSettings : public CObject
{
// Declare class serializable [SBT]
DECLARE_SERIAL(CHermesSettings)
public:
CHermesSettings();
virtual ~CHermesSettings();
// Attributes [SBT]
protected:
FUNCTIONMAP m_FunctionMap;
CComVariant m_b3DLook;
CComVariant m_strCaption;
CComVariant m_strBorder;
CComVariant m_uiWindowHeight;
CComVariant m_uiWindowWidth;
LOGFONT m_lf;
CComVariant m_Font;
CComVariant m_bUseSystemFont;
CComVariant m_strName;
CComVariant m_rgbWindowColor;
CComVariant m_strRealName;
CComVariant m_strEMail;
CComVariant m_strServerIncoming;
CComVariant m_strUserName;
CComVariant m_strSMTPServer;
CComVariant m_bAllowAuth;
CComVariant m_bAutoOpenMailDetail;
CComVariant m_strMailServer;
CComVariant m_strMailServerUserName;
CComVariant m_uiMailCheckInterval;
CComVariant m_bCheckWithoutNetworkConnection;
CComVariant m_bCheckWithoutBattery;
CComVariant m_bSendOnCheck;
CComVariant m_uiSecureSockets;
CComVariant m_uiServerConfig;
// Auxililarity implementation [SBT]
protected:
void MapFunctionPointers();
public:
BOOL Save();
BOOL Load();
// MFC declare serialization helper [SBT]
void Serialize(CArchive& archive);
ifdef _DEBUG
virtual void AssertValid() const;
// virtual void Dump(CDumpContext& dc) const;
endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Universal MethodFunc type for auto-mapping and auto-callback [SBT]
CComVariant GetSet3DLook(CComVariant v = nullptr);
CComVariant GetSetCaption(CComVariant v = nullptr);
CComVariant GetSetBorder(CComVariant v = nullptr);
CComVariant GetSetWindowHeight(CComVariant v = nullptr);
CComVariant GetSetWindowWidth(CComVariant v = nullptr);
CComVariant GetSetFont(CComVariant v = nullptr);
CComVariant GetSetUseSystemFont(CComVariant v = nullptr);
CComVariant GetSetName(CComVariant v = nullptr);
CComVariant GetSetWindowColor(CComVariant v = nullptr);
CComVariant GetSetRealName(CComVariant v = nullptr);
CComVariant GetSetEMail(CComVariant v = nullptr);
CComVariant GetSetServerIncoming(CComVariant v = nullptr);
CComVariant GetSetUserName(CComVariant v = nullptr);
CComVariant GetSetSMTPServer(CComVariant v = nullptr);
CComVariant GetSetAllowAuth(CComVariant v = nullptr);
CComVariant GetSetAutoOpenMailDetail(CComVariant v = nullptr);
CComVariant GetSetMailServer(CComVariant v = nullptr);
CComVariant GetSetMailServerUserName(CComVariant v = nullptr);
CComVariant GetSetMailCheckInterval(CComVariant v = nullptr);
CComVariant GetSetCheckWithoutNetworkConnection(CComVariant v = nullptr);
CComVariant GetSetCheckWithoutBattery(CComVariant v = nullptr);
CComVariant GetSetSendOnCheck(CComVariant v = nullptr);
CComVariant GetSetSecureSockets(CComVariant v = nullptr);
CComVariant GetSetServerConfig(CComVariant v = nullptr);
//////////////////////////////////////////////////////////////////////////////////////
// Get the generic accessors [SBT]
PFUNCTIONMAP GetFunctionMap(); // See typedef map at beginning of file.
};
// CHermesSettings Header EOF [SBT]
////////////////////////////////////////////////////////////////////////////////
[/CHermesSettings.h]
[CHermesSetttings.cpp]
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Implementation BEF [SBT]
include "stdafx.h"
include "HermesSettings.h"
include "resource.h"
// Implement class serialization [SBT]
IMPLEMENT_SERIAL(CHermesSettings, CObject, VERSIONABLE_SCHEMA | 2)
////////////////////////////////////////////////////////////////////////////////
// CHermesSettings Construction / Destruction [SBT]
//
//
// Adding a new setting. It's a pretty byzantine process but that's the
price for automation. This works flawlessly for the simpler values.
// I have yet to figure out how to store structuresa in CComVariant.
COLORREF is the size of a DWORD, that could maybe be done, but LOGFONT is
another matter...
//
// If not already there, in PropertiesWnd.cpp, void
CPropertiesWnd::InitPropList() add the group to which you want the setting
to belong:
//
// eg.:
//
// CMFCPropertyGridProperty pGroup4 = new
CMFCPropertyGridProperty(_T("Eudora"));
//
// Here, the group "Eudora" has already been created.
//
// to add a new persistent setting to this group first declare the
CComVariant in the CHermesSettings header file, like:
//
// CComVariant m_strServerIncoming;
//
// Make sure it's initialized in the constructor initialization list (or
for more more complicated settingds in the body of the CHermesSettings
constructor.
//
// Add a new value (in this case SERVERINCOMING) in the FUNCTIONPONTERKEYS
enum in the CHmeresSettings header.
//
// Add an accessor for the new setting along with the rest like so.:
//
// CComVariant GetSetServerIncoming(CComVariant v = nullptr);
//
// Implement it in the CHermesSettings source file as:
//
// CComVariant CHermesSettings::GetSetServerIncoming(CComVariant v)
// {
// if (v)
// m_strServerIncoming = v->bstrVal;
// return &m_strServerIncoming;
// }
//
// Add it to the void CHermesSettings::MapFunctionPointers() function as
//
// m_FunctionMap[SERVERINCOMING] = &CHermesSettings::GetSetServerIncominig;
//
//
// Make sure it's addded to the void CHermesSettings::Serialize(CArchive&
archive) function like
//
// m_strServerIncoming.WriteToStream(&pStream);
// and
// m_strServerIncoming.ReadFromStream(&pStream);
//
//
// Back in PropertiesWnd.cpp add the new settings as:
//
// cv = pSettings->GetSetServerIncoming();
// CMFCPropertyGridProperty pServerIncoming = new
CMFCPropertyGridProperty(_T("Server Incoming"), (_variant_t)(cv->bstrVal),
_T("Server incoming"));
// pServerIncoming->SetData(SERVERINCOMING);
// pGroup4->AddSubItem(pServerIncoming);
//
// Because of the pServerIncoming->SetData(SERVERINCOMING); call, the
//
// LRESULT CPropertiesWnd::OnPropertyChanged(WPARAM wParam, LPARAM lParam)
//
// will automatically be able to use the SERVERINCOMING key to get the
pointer to the proper accessor and call it when the value changes.
//
// Settings are automatically loaded on startup and saved on exit.
//
// void CPropertiesWnd::OnProperties2()
//
// corresponds tro the toolbutton with the little lightning on. This will
save all the settings on demand.
//
//
// Make sure to delete the settings file when adding or removing settings
or the Serialiable Write and Read will ofcourse not match.
CHermesSettings::CHermesSettings()
: m_b3DLook(VARIANT_TRUE),
m_strCaption(_T("Caption")),
m_strBorder(_T("Thin")),
m_uiWindowHeight((unsigned short)250),
m_uiWindowWidth((unsigned short)150),
m_bUseSystemFont(VARIANT_FALSE),
m_strName(_T("Hermes")),
m_strRealName(_T("")),
m_strEMail(_T("")),
m_strServerIncoming(_T("")),
m_strUserName(_T("")),
m_strSMTPServer(_T("")),
m_bAllowAuth(VARIANT_TRUE),
m_bAutoOpenMailDetail(VARIANT_TRUE),
m_strMailServer(_T("")),
m_strMailServerUserName(_T("")),
m_uiMailCheckInterval((unsigned short)3),
m_bCheckWithoutNetworkConnection(VARIANT_FALSE),
m_bCheckWithoutBattery(VARIANT_TRUE),
m_bSendOnCheck(VARIANT_TRUE),
m_uiSecureSockets(RSTARTTLS),
m_uiServerConfig(POP)
// m_rgbWindowColor((unsigned long)RGB(210, 192, 254))
{
TRACE(_T("CHermesSettings::CHermesSettings() >>\n"));
TRACE_VARIANTTYPE(m_rgbWindowColor);
MapFunctionPointers();
CFont* font = CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT));
font->GetLogFont(&m_lf);
_tcscpy_s(m_lf.lfFaceName, _T("Arial"));
m_Font.vt = VT_RECORD | VT_BYREF;
m_Font.pvRecord = &m_lf;
//TVARIANT(m_Font);
TRACE(_T("CHermesSettings::CHermesSettings() <<\n"));
}
CHermesSettings::~CHermesSettings()
{
}
////////////////////////////////////////////////////////////////////////////////
// Auxililarity implementation [SBT]
////////////////////////////////////
// Save Settings [SBT]
BOOL CHermesSettings::Save()
{
TRACE(_T("BOOL CHermesSettings::Save() >>\n"));
CString strFileName;
BOOL bNameValid = strFileName.LoadString(IDS_STRING_SETTINGS_FILE);
ASSERT(bNameValid);
CFile f;
BOOL found = f.Open(strFileName, CFile::modeWrite | CFile::modeCreate);
if (found)
{
try
{
CArchive ar(&f, CArchive::store);
Serialize(ar);
ar.Close();
f.Close();
}
catch (CException e)
{
SYSError(_T("CArchive: "), FALSE);
e->Dump(new CDumpContext(NULL));
e->ReportError();
e->Delete();
return FALSE;
}
}
TRACE(_T("BOOL CHermesSettings::Save() <<\n"));
return TRUE;
}
////////////////////////////////////
// Load Settings [SBT]
BOOL CHermesSettings::Load()
{
TRACE(_T("BOOL CHermesSettings::Load() >>\n"));
// UpdateData();
CString strFileName;
BOOL bNameValid = strFileName.LoadString(IDS_STRING_SETTINGS_FILE);
ASSERT(bNameValid);
CFile f;
BOOL bFound = FALSE;
try
{
bFound = f.Open(strFileName, CFile::modeRead);
}
catch (CException e)
{
SYSError(_T("CArchive: "), FALSE);
e->Dump(new CDumpContext(NULL));
e->ReportError();
e->Delete();
return FALSE;
}
if (bFound)
{
try
{
CArchive ar(&f, CArchive::load);
Serialize(ar);
ar.Close();
f.Close();
}
catch (CException e)
{
SYSError(_T("CArchive: "), FALSE);
e->Dump(new CDumpContext(NULL));
e->ReportError();
e->Delete();
return FALSE;
}
}
TRACE(_T("BOOL CHermesSettings::Load() <<\n"));
return TRUE;
}
////////////////////////////////////
void CHermesSettings::MapFunctionPointers()
{
m_FunctionMap[THREEDLOOK] = &CHermesSettings::GetSet3DLook;
m_FunctionMap[CAPTION] = &CHermesSettings::GetSetCaption;
m_FunctionMap[BORDER] = &CHermesSettings::GetSetBorder;
m_FunctionMap[WINDOWHEIGHT] = &CHermesSettings::GetSetWindowHeight;
m_FunctionMap[WINDOWWIDTH] = &CHermesSettings::GetSetWindowWidth;
m_FunctionMap[FONT] = &CHermesSettings::GetSetFont;
m_FunctionMap[USESYSTEMFONT] = &CHermesSettings::GetSetUseSystemFont;
m_FunctionMap[NAME] = &CHermesSettings::GetSetName;
m_FunctionMap[REALNAME] = &CHermesSettings::GetSetRealName;
m_FunctionMap[EMAIL] = &CHermesSettings::GetSetEMail;
m_FunctionMap[SERVERINCOMING] = &CHermesSettings::GetSetServerIncoming;
m_FunctionMap[USERNAME] = &CHermesSettings::GetSetUserName;
m_FunctionMap[SMTPSERVER] = &CHermesSettings::GetSetSMTPServer;
m_FunctionMap[ALLOWAUTH] = &CHermesSettings::GetSetAllowAuth;
m_FunctionMap[AUTOOPENMAILDETAIL] =
&CHermesSettings::GetSetAutoOpenMailDetail;
m_FunctionMap[MAILSERVER] = &CHermesSettings::GetSetMailServer;
m_FunctionMap[MAILSERVERUSERNAME] =
&CHermesSettings::GetSetMailServerUserName;
m_FunctionMap[MAILCHECKINTERVAL] =
&CHermesSettings::GetSetMailCheckInterval;
m_FunctionMap[CHECKWITHOUTNETWORKCONNECTION] =
&CHermesSettings::GetSetCheckWithoutNetworkConnection;
m_FunctionMap[CHECKWITHOUTBATTERY] =
&CHermesSettings::GetSetCheckWithoutBattery;
m_FunctionMap[SENDONCHECK] = &CHermesSettings::GetSetSendOnCheck;
m_FunctionMap[SECURESOCKETS] = &CHermesSettings::GetSetSecureSockets;
m_FunctionMap[_SERVERCONFIG] = &CHermesSettings::GetSetServerConfig;
}
////////////////////////////////////
PFUNCTIONMAP CHermesSettings::GetFunctionMap()
{
return &m_FunctionMap;
}
////////////////////////////////////
// MFC implement serialization helper [SBT]
void CHermesSettings::Serialize(CArchive& archive)
{
CObject::Serialize(archive);
CArchiveStream pStream(&archive);
if (archive.IsStoring())
{
m_b3DLook.WriteToStream(&pStream);
m_strCaption.WriteToStream(&pStream);
m_strBorder.WriteToStream(&pStream);
m_uiWindowHeight.WriteToStream(&pStream);
m_uiWindowWidth.WriteToStream(&pStream);
// m_Font.WriteToStream(&pStream);
m_bUseSystemFont.WriteToStream(&pStream);
m_strName.WriteToStream(&pStream);
m_strRealName.WriteToStream(&pStream);
m_strEMail.WriteToStream(&pStream);
m_strServerIncoming.WriteToStream(&pStream);
m_strUserName.WriteToStream(&pStream);
m_strSMTPServer.WriteToStream(&pStream);
m_bAllowAuth.WriteToStream(&pStream);
m_bCheckWithoutBattery.WriteToStream(&pStream);
m_strMailServer.WriteToStream(&pStream);
m_strMailServerUserName.WriteToStream(&pStream);
m_uiMailCheckInterval.WriteToStream(&pStream);
m_bCheckWithoutNetworkConnection.WriteToStream(&pStream);
m_bCheckWithoutBattery.WriteToStream(&pStream);
m_bSendOnCheck.WriteToStream(&pStream);
}
else
{
m_b3DLook.ReadFromStream(&pStream);
m_strCaption.ReadFromStream(&pStream);
m_strBorder.ReadFromStream(&pStream);
m_uiWindowHeight.ReadFromStream(&pStream);
m_uiWindowWidth.ReadFromStream(&pStream);
// m_Font.ReadFromStream(&pStream);
m_bUseSystemFont.ReadFromStream(&pStream);
m_strName.ReadFromStream(&pStream);
m_strRealName.ReadFromStream(&pStream);
m_strEMail.ReadFromStream(&pStream);
m_strServerIncoming.ReadFromStream(&pStream);
m_strUserName.ReadFromStream(&pStream);
m_strSMTPServer.ReadFromStream(&pStream);
m_bAllowAuth.ReadFromStream(&pStream);
m_bCheckWithoutBattery.ReadFromStream(&pStream);
m_strMailServer.ReadFromStream(&pStream);
m_strMailServerUserName.ReadFromStream(&pStream);
m_uiMailCheckInterval.ReadFromStream(&pStream);
m_bCheckWithoutNetworkConnection.ReadFromStream(&pStream);
m_bCheckWithoutBattery.ReadFromStream(&pStream);
m_bSendOnCheck.ReadFromStream(&pStream);
}
}
////////////////////////////////////////////////////////////////////////////////
// Automatic accessors [SBT]
//
// These CAN be called manually but they're really not supposed to be. [SBT]
//
// Oh, wait, I made the settings non-public, so yes. Go ahead.
//
CComVariant CHermesSettings::GetSet3DLook(CComVariant v)
{
if (v)
{
TRACE_VARIANTTYPE(*v);
ASSERT(v->vt == VT_BOOL);
m_b3DLook = v->boolVal;
}
return &m_b3DLook;
}
CComVariant CHermesSettings::GetSetCaption(CComVariant v)
{
if (v)
m_strCaption = v->bstrVal;
return &m_strCaption;
}
CComVariant CHermesSettings::GetSetBorder(CComVariant v)
{
if (v)
m_strBorder = v->bstrVal;
return &m_strBorder;
}
CComVariant CHermesSettings::GetSetWindowHeight(CComVariant v)
{
if (v)
m_uiWindowHeight = v->uiVal;
return &m_uiWindowHeight;
}
CComVariant CHermesSettings::GetSetWindowWidth(CComVariant v)
{
if (v)
m_uiWindowWidth = v->uiVal;
return &m_uiWindowWidth;
}
CComVariant CHermesSettings::GetSetFont(CComVariant v)
{
if (v)
m_Font = v->pvRecord;
return &m_Font;
}
CComVariant CHermesSettings::GetSetUseSystemFont(CComVariant v)
{
if (v)
{
TRACE_VARIANTTYPE(*v);
ASSERT(v->vt = VT_BOOL);
m_bUseSystemFont = v->boolVal;
}
return &m_bUseSystemFont;
}
CComVariant CHermesSettings::GetSetName(CComVariant v)
{
if (v)
m_strName = v->bstrVal;
return &m_strName;
}
CComVariant CHermesSettings::GetSetWindowColor(CComVariant v)
{
if (v)
{
m_rgbWindowColor = v->lVal;
}
return &m_rgbWindowColor;
}
CComVariant CHermesSettings::GetSetRealName(CComVariant v)
{
if (v)
m_strRealName = v->bstrVal;
return &m_strRealName;
}
CComVariant CHermesSettings::GetSetEMail(CComVariant v)
{
if (v)
m_strEMail = v->bstrVal;
return &m_strEMail;
}
CComVariant CHermesSettings::GetSetServerIncoming(CComVariant v)
{
if (v)
m_strServerIncoming = v->bstrVal;
return &m_strServerIncoming;
}
CComVariant CHermesSettings::GetSetUserName(CComVariant v)
{
if (v)
m_strUserName = v->bstrVal;
return &m_strUserName;
}
CComVariant CHermesSettings::GetSetSMTPServer(CComVariant v)
{
if (v)
m_strSMTPServer = v->bstrVal;
return &m_strSMTPServer;
}
CComVariant CHermesSettings::GetSetAllowAuth(CComVariant v)
{
if (v)
{
TRACE_VARIANTTYPE(*v);
ASSERT(v->vt == VT_BOOL);
m_bAllowAuth = v->boolVal;
}
return &m_bAllowAuth;
}
CComVariant CHermesSettings::GetSetAutoOpenMailDetail(CComVariant v)
{
if (v)
{
TRACE_VARIANTTYPE(*v);
ASSERT(v->vt == VT_BOOL);
m_bAllowAuth = v->boolVal;
}
return &m_bAllowAuth;
}
CComVariant CHermesSettings::GetSetMailServer(CComVariant v)
{
if (v)
m_strMailServer = v->bstrVal;
return &m_strMailServer;
}
CComVariant CHermesSettings::GetSetMailServerUserName(CComVariant v)
{
if (v)
m_strMailServerUserName = v->bstrVal;
return &m_strMailServerUserName;
}
CComVariant CHermesSettings::GetSetMailCheckInterval(CComVariant v)
{
if (v)
m_uiMailCheckInterval = v->uiVal;
return &m_uiMailCheckInterval;
}
CComVariant CHermesSettings::GetSetCheckWithoutBattery(CComVariant v)
{
if (v)
{
TRACE_VARIANTTYPE(*v);
ASSERT(v->vt == VT_BOOL);
m_bCheckWithoutBattery = v->boolVal;
}
return &m_bCheckWithoutBattery;
}
CComVariant
CHermesSettings::GetSetCheckWithoutNetworkConnection(CComVariant v)
{
if (v)
{
TRACE_VARIANTTYPE(*v);
ASSERT(v->vt == VT_BOOL);
m_bCheckWithoutNetworkConnection = v->boolVal;
}
return &m_bCheckWithoutNetworkConnection;
}
CComVariant CHermesSettings::GetSetSendOnCheck(CComVariant v)
{
if (v)
{
TRACE_VARIANTTYPE(*v);
ASSERT(v->vt == VT_BOOL);
m_bSendOnCheck= v->boolVal;
}
return &m_bSendOnCheck;
}
CComVariant CHermesSettings::GetSetSecureSockets(CComVariant v)
{
if (v)
{
m_uiSecureSockets = v->lVal;
}
return &m_uiSecureSockets;
}
CComVariant CHermesSettings::GetSetServerConfig(CComVariant v)
{
if (v)
{
m_uiServerConfig = v->lVal;
}
return &m_uiServerConfig;
}
ifdef _DEBUG
void CHermesSettings::AssertValid() const
{
CObject::AssertValid();
ASSERT(m_b3DLook.vt == VT_BOOL);
ASSERT(m_strCaption.vt == VT_BSTR);
}
/
void CHermesSettings::Dump(CDumpContext& dc) const
{
dc << _T("m_b3DLook: [") << m_b3DLook << "]\n";
dc << _T("m_strCaption: [") << m_strCaption << "]\n";
}/
endif //_DEBUG
// CHermesSettings Implementation EOF [SBT]
////////////////////////////////////////////////////////////////////////////////
[/CHermesSettings.cpp]
Regards.
On Thu, Jan 17, 2019 at 6:26 PM Soren Bro sbrothy@users.sourceforge.net
wrote:
I'm working on the persistent settings right now. They need a good cleanup
when I'm done. I just felt a need for showing you that somethig is indeed
going on...
Regards.
On Thu, Jan 17, 2019 at 8:08 PM Soren Bro sbrothy@users.sourceforge.net
wrote:
And lo and behold, I found and error there:
typedef enum : unsigned short / Force unsigned short type [SBT] / {
Not that important, but nonetheless......
Regards.
On Thu, Jan 17, 2019 at 8:16 PM sbrothy@gmail.com wrote:
This is how it looks (ATTACHED). All the values are serialized to and from
disk.
Regards.
On Thu, Jan 17, 2019 at 8:19 PM sbrothy@gmail.com wrote:
Mate, it's not my judgement you're awaiting, eh? It's the judgement of the
base---our grassroots investors.
Never lose sight of that.
PS - My condolences on the passing of your friend. That is truly sad.
On Thu, 17 Jan 2019, 12:26 Soren Bro <sbrothy@users.sourceforge.net wrote:
Well at least posting the code online, and then re-reading it, I cathced an
error. Not a serious one but still...
Regards.
On Fri, Jan 18, 2019 at 1:46 AM Ted Matavka nmatavka@users.sourceforge.net
wrote: