_variant_t Get(const std::_tstring & section, const std::_tstring & label, const _variant_t & defaultVal) { clib::recursive_mutex::scoped_lock proc(m_mutex); SectionLabelDefault sl(SectionLabel(section, label), defaultVal); ConfigCacheT::const_iterator found = m_cache.find(sl.first); if(sl == GLOBAL_USER && found != m_cache.end()) if (!CString(m_cache[sl.first]).IsEmpty()) return m_cache[sl.first]; if(sl == GLOBAL_PASSWORD && found != m_cache.end()) if (!CString(m_cache[sl.first]).IsEmpty()) return m_cache[sl.first]; if (!m_CfgPath.empty()) { if (found != m_cache.end()) return found->second; CString _defaultVal = defaultVal, _val; if (!m_Cfg.GetString(section.c_str(), label.c_str(), _val, _defaultVal)) { //ATLTRACE(_T("GetString(%s,%s,Err=%x)\r\n"), section, label, ::GetLastError() ); _val = _defaultVal; } SectionLabel id(section, label); if (CString(m_cache[id]).CompareNoCase(_val) != 0) { m_cache[id] = _val; _variant_t retVal = m_cache[sl.first]; proc.unlock(); on_refresh(&id); return retVal; } } return m_cache[sl.first]; }
void Set(const std::_tstring & section, const std::_tstring & label, const _variant_t & val) { clib::recursive_mutex::scoped_lock proc(m_mutex); SectionLabelDefault sl(SectionLabel(section, label), _T("")); if(sl == GLOBAL_USER) { InitConfigPath(m_CfgName, _T("cfg")); } SectionLabel id(section, label); if (m_cache.find(id) == m_cache.end() || CString(m_cache[id]).CompareNoCase(CString(val)) != 0) { if (!m_CfgPath.empty() && sl != GLOBAL_PASSWORD) { CString _val = val; if ( !m_Cfg.PutString(section.c_str(), label.c_str(), _val) ) { ATLTRACE(_T("PutString(%s,%s,Err=%x)\r\n"), section, label, ::GetLastError() ); } } m_cache[id] = val; proc.unlock(); on_refresh(&id); } }
#include "StdAfx.h" #include "..\en_us\resource.h" #include "logindlg.h" #include "account.h" #include <SMC.h> //comms #include "file_ver.h" #include "thread.h" #include "PreferenceDlg.h" #include "EclCC.h" #include <CustomMessages.h> #include <AutoUpdate.h> #include <UtilFilesystem.h> static const SectionLabelDefault GLOBAL_LASTCONFIG(SectionLabel(_T("General"), _T("LastConfig")), _T("default")); static const SectionLabelDefault GLOBAL_LASTCONFIG_LHS(SectionLabel(_T("General"), _T("LastConfigLHS")), _T("default")); static const SectionLabelDefault GLOBAL_LASTCONFIG_RHS(SectionLabel(_T("General"), _T("LastConfigRHS")), _T("default")); static const SectionLabelDefault GLOBAL_LASTFOLDER_LHS(SectionLabel(_T("General"), _T("LastPathLHS")), _T("")); static const SectionLabelDefault GLOBAL_LASTFOLDER_RHS(SectionLabel(_T("General"), _T("LastPathRHS")), _T("")); static const SectionLabelDefault GLOBAL_LASTMODFILE_LHS(SectionLabel(_T("General"), _T("LastModFileLHS")), _T("")); static const SectionLabelDefault GLOBAL_LASTMODFILE_RHS(SectionLabel(_T("General"), _T("LastModFileRHS")), _T("")); static const SectionLabelDefault GLOBAL_LASTMODE_LHS(SectionLabel(_T("General"), _T("LastModeLHS")), 1); static const SectionLabelDefault GLOBAL_LASTMODE_RHS(SectionLabel(_T("General"), _T("LastModeRHS")), 1); enum UM { UM_FIRST = CWM_LAST + 1, UM_AUTOUPDATEFINISHED, UM_LAST };
#include "StdAfx.h" #include "..\en_us\resource.h" #include "SyntaxView.h" #include "RecursiveMutex.h" static const SectionLabelDefault GLOBAL_SYNTAX_SHOWERRORS(SectionLabel(_T("Syntax"), _T("Errors")), true); static const SectionLabelDefault GLOBAL_SYNTAX_SHOWWARNINGS(SectionLabel(_T("Syntax"), _T("Warnings")), true); static const SectionLabelDefault GLOBAL_SYNTAX_SHOWINFORMATION(SectionLabel(_T("Syntax"), _T("Information")), false); // =========================================================================== CSyntaxView::CSyntaxView() { m_prevSyntaxMarker = NULL; } CSyntaxView::~CSyntaxView() { } void CSyntaxView::Init(ISyntaxSlot *owner) { m_Owner = owner; } BOOL CSyntaxView::PreTranslateMessage(MSG* pMsg) { if((pMsg->message < WM_KEYFIRST || pMsg->message > WM_KEYLAST) && (pMsg->message < WM_MOUSEFIRST || pMsg->message > WM_MOUSELAST)) return FALSE; HWND hWndCtl = ::GetFocus();
#include "StdAfx.h" #include "..\en_us\resource.h" #include "BookmarksView.h" #include "XmlWriter.h" #include "mainfrm.h" const TCHAR * const BOOKMARKS_FILE = _T("bookmarks.xml"); static const SectionLabelDefault GLOBAL_BOOKMARKS_SHOWMINE(SectionLabel(_T("Bookmarks"), _T("Mine")), true); static const SectionLabelDefault GLOBAL_BOOKMARKS_SHOWTODOS(SectionLabel(_T("Bookmarks"), _T("Todos")), true); static const SectionLabelDefault GLOBAL_BOOKMARKS_SHOWHACKS(SectionLabel(_T("Bookmarks"), _T("Hacks")), false); static const SectionLabelDefault GLOBAL_BOOKMARKS_SORTCOLUMN(SectionLabel(_T("Bookmarks"), _T("SortColumn")), false); static const SectionLabelDefault GLOBAL_BOOKMARKS_SORTASCENDING(SectionLabel(_T("Bookmarks"), _T("SortAscending")), false); // =========================================================================== CBookmarksView::CBookmarksView() { m_prevBookmarksMarker = NULL; } CBookmarksView::~CBookmarksView() { } void CBookmarksView::Init(IBookmarksSlot *owner) { m_Owner = owner; } BOOL CBookmarksView::PreTranslateMessage(MSG* pMsg)