⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resorgoptions.cpp

📁 一个vc中管理资源文件ID的插件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/************************************************************************
 *
 *                 Resource ID Organiser Utility Library
 *
 *       (c) Copyright 2000 by Andy Metcalfe (andy.metcalfe@lineone.net)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : ResOrgOptions.cpp
 *
 *  Description : CResOrgOptions - class to hold program options
 *                
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or 4
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 98/NT
 *
 *  NOTE:
 *
 *    This software is provided "as is" free for personal use. All
 *    title and copyrights in and to the software, including but not
 *    limited to any images, text, etc. incorporated into it, are
 *    owned by Andy Metcalfe, except where acknowledged otherwise.
 *
 *    Your may freely to use this code in your own products, PROVIDED
 *    this notice is not removed or modified.
 *
 *
 *    Visit http://www.resorg.co.uk for latest updates
 *
 ************************************************************************
 *
 *   MODIFICATION HISTORY:
 *
 *           This is a controlled document. See project configuration
 *           control tool for latest version and full version history.
 *
 *    $Archive: /Projects/AddIns/ResOrg/ResOrgUtils/ResOrgOptions.cpp $
 *   $Revision: 12 $
 *       $Date: 8/07/01 8:35 $
 *     $Author: Andy $
 *
 *    $History: ResOrgOptions.cpp $
 * 
 * *****************  Version 12  *****************
 * User: Andy         Date: 8/07/01    Time: 8:35
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 1.  CResOrgOptions::Configure() now allows the parent window of the
 * Options dialog to be specified
 * 2.  CResOrgOptions::OnVersionCheckCompleted() now passes the HWND of
 * the desktop to ShellExecute() when opening a browser window. This stops
 * a download freezing when the app is closed
 * 
 * *****************  Version 11  *****************
 * User: Andy         Date: 2/07/01    Time: 22:17
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added additional options for web URLs (updated from the version
 * checker)
 * 
 * *****************  Version 10  *****************
 * User: Andy         Date: 26/05/01   Time: 15:14
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added Mailing List prompt option
 * 
 * *****************  Version 9  *****************
 * User: Andy         Date: 22/05/01   Time: 16:02
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 1.  Removed version check code from Initialise () to a new
 * DoVersionCheck() method. This prevents problems with the "nag" screen
 * displayed by the ResOrg app.
 * 2.  Made StartVersionCheck() a bit more fault tolerant
 * 
 * *****************  Version 8  *****************
 * User: Andy         Date: 22/05/01   Time: 6:42
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 1.  Class now derived from CCmdTarget to allow it to receive WM_COMMAND
 * notifications from the MainFrame
 * 2.  StartVersionCheck() now takes an extra parameter to allow dial-up
 * networking prompts to be disabled
 * 3.  OnVersionCheckCompleted() now returns an error code instead of a
 * boolean
 * 4.  Added OnExit()
 * 
 * *****************  Version 7  *****************
 * User: Andy         Date: 16/05/01   Time: 20:56
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added "Updates" page and version checking
 * 
 * *****************  Version 6  *****************
 * User: Andy         Date: 12/05/01   Time: 6:47
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added a registry entry to allow ResOrg to be forced to check a
 * particular version of DevStudio
 * 
 * *****************  Version 5  *****************
 * User: Andy         Date: 4/05/01    Time: 22:35
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Removed the "Apply" button from the Options Property Sheet
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 5/12/00    Time: 20:32
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added web URL to options
 * 
 * *****************  Version 3  *****************
 * User: Andy         Date: 3/12/00    Time: 8:33
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added an option to determine whether to check if the add-in should be
 * loaded by Visual Studio
 * 
 * *****************  Version 2  *****************
 * User: Andy         Date: 29/11/00   Time: 18:38
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 *  Added file banners
 *
 * $Nokeywords: $
 *
 ************************************************************************/

// ResOrgOptions.cpp : implementation file
//

#include "StdAfx.h"
#include <Wininet.h>
#include "ResOrgUtils_Priv.h"

#include "ResOrgOptionsGeneralPage.h"
#include "ResOrgOptionsAddInPage.h"
#include "ResOrgOptionsUpdatesPage.h"
#include "ResOrgVersionCheck.h"
#include "ResOrgVersionUpdatedDlg.h"

#include "ResOrgOptions.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


#define OPTIONS							_T("Options")
#define OPTION_WARN_SYM_CHANGES			_T("Warn On Symbol Changes")
#define OPTION_ADDIN_LOAD_PROMPT		_T("Ask whether Add-In should be loaded")
#define	OPTION_MAILING_LIST_PROMPT		_T("Mailing List Prompt")
#define OPTION_WEB_URL					_T("Web URL")
#define OPTION_FAQ_URL					_T("FAQ URL")
#define OPTION_DISCUSSIONS_URL			_T("Discussion Board URL")
#define OPTION_BUGS_URL					_T("Known Bugs URL")
#define OPTION_MAILING_LIST_URL			_T("Mailing List URL")
#define OPTION_DS_VER					_T("DevStudio Version")
#define OPTION_VERSION_CHECKING			_T("Check for updates")
#define	OPTION_VERSION_CHECK_INTERVAL	_T("Update check interval")
#define	OPTION_LAST_UPDATE_CHECK		_T("Last update check")	


/////////////////////////////////////////////////////////////////////////////
// CResOrgOptions

CResOrgOptions::CResOrgOptions(void)
{
	m_bWarnOnSymbolChanges		= TRUE;
	m_bAskAboutLoading			= TRUE;
	m_bAskAboutMailingList		= TRUE;
	m_sWebURL					= _T("http://www.resorg.co.uk");
	m_sFaqURL					= m_sWebURL + _T("/faq.html");
	m_sDiscussionBoardURL		= m_sWebURL + _T("/discussion.html");
	m_sKnownBugsURL				= m_sWebURL + _T("/known_bugs.html");
	m_sMailingListURL			= m_sWebURL + _T("/mailing_list.html");

	m_sDevStudioVer				= _T("");
	m_bEnableVersionChecking	= TRUE;
	m_nVersionCheckInterval		= 7;
	m_timeLastUpdateCheck		= CTime::GetCurrentTime();

	m_pVersionChecker			= NULL;
}


CResOrgOptions::~CResOrgOptions(void)
{
	if (NULL != m_pVersionChecker)
	{
		delete m_pVersionChecker;
	}
}


BEGIN_MESSAGE_MAP(CResOrgOptions, CResOrgOptions_BASE)
	//{{AFX_MSG_MAP(CResOrgOptions)
	ON_COMMAND(				ID_RESORG_VERSION_CHECK,	OnCmdResOrgUpdateCheckCompleted)
	//}}AFX_MSG_MAP

END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// Virtual Overrides

BOOL CResOrgOptions::Initialise(void)
{
	m_bWarnOnSymbolChanges		= AfxGetApp()->GetProfileInt(	OPTIONS,
																OPTION_WARN_SYM_CHANGES,
																TRUE);

	m_bAskAboutLoading			= AfxGetApp()->GetProfileInt(	OPTIONS,
																OPTION_ADDIN_LOAD_PROMPT,
																TRUE);

	m_sWebURL					= AfxGetApp()->GetProfileString(OPTIONS,
																OPTION_WEB_URL,
																m_sWebURL);

	m_sFaqURL					= AfxGetApp()->GetProfileString(OPTIONS,
																OPTION_FAQ_URL,
																m_sFaqURL);

	m_sDiscussionBoardURL		= AfxGetApp()->GetProfileString(OPTIONS,
																OPTION_DISCUSSIONS_URL,
																m_sDiscussionBoardURL);

	m_sKnownBugsURL				= AfxGetApp()->GetProfileString(OPTIONS,
																OPTION_BUGS_URL,
																m_sKnownBugsURL);

	m_sMailingListURL			= AfxGetApp()->GetProfileString(OPTIONS,
																OPTION_MAILING_LIST_URL,
																m_sMailingListURL);

	m_sDevStudioVer				= AfxGetApp()->GetProfileString(OPTIONS,
																OPTION_DS_VER);

	m_bEnableVersionChecking	= AfxGetApp()->GetProfileInt(	OPTIONS,
																OPTION_VERSION_CHECKING,
																m_bEnableVersionChecking);

	m_nVersionCheckInterval		= AfxGetApp()->GetProfileInt(	OPTIONS,
																OPTION_VERSION_CHECK_INTERVAL,
																m_nVersionCheckInterval);

	m_timeLastUpdateCheck		= (time_t)AfxGetApp()->GetProfileInt(
																OPTIONS,
																OPTION_LAST_UPDATE_CHECK,
																0);

	m_bAskAboutMailingList		= AfxGetApp()->GetProfileInt(	OPTIONS,
																OPTION_MAILING_LIST_PROMPT,
																TRUE);

	return TRUE;
}


int CResOrgOptions::Configure(CWnd* pParentWnd /*= NULL*/)
{
	CNGPropertySheet dlg(IDS_RESORG_OPTIONS, pParentWnd);

	dlg.m_psh.dwFlags |= PSH_NOAPPLYNOW;		// Remove the "Apply" button

	CResOrgOptionsGeneralPage	GeneralPage;
	CResOrgOptionsAddInPage		AddInPage;
	CResOrgOptionsUpdatesPage	UpdatesPage;

	GeneralPage.m_bWarnOnSymbolChanges	= m_bWarnOnSymbolChanges;
	AddInPage.m_bAskAboutLoading		= m_bAskAboutLoading;
	UpdatesPage.m_bEnableVersionCheck	= m_bEnableVersionChecking;
	UpdatesPage.m_nVersionCheckInterval	= m_nVersionCheckInterval;

	dlg.AddPage(&GeneralPage);
	dlg.AddPage(&AddInPage);
	dlg.AddPage(&UpdatesPage);

	int nResult = dlg.DoModal();

	if (IDOK == nResult)
	{
		m_bWarnOnSymbolChanges		= GeneralPage.m_bWarnOnSymbolChanges;

		m_bAskAboutLoading			= AddInPage.m_bAskAboutLoading;

		m_bEnableVersionChecking	= UpdatesPage.m_bEnableVersionCheck;;
		m_nVersionCheckInterval		= UpdatesPage.m_nVersionCheckInterval;

		AfxGetApp()->WriteProfileInt(	OPTIONS,
										OPTION_WARN_SYM_CHANGES,
										m_bWarnOnSymbolChanges);

		AfxGetApp()->WriteProfileInt(	OPTIONS,
										OPTION_ADDIN_LOAD_PROMPT,
										m_bAskAboutLoading);

		AfxGetApp()->WriteProfileInt(	OPTIONS,
										OPTION_VERSION_CHECKING,
										m_bEnableVersionChecking);

		AfxGetApp()->WriteProfileInt(	OPTIONS,
										OPTION_VERSION_CHECK_INTERVAL,
										m_nVersionCheckInterval);
	}
	return nResult;
}


/////////////////////////////////////////////////////////////////////////////
// Operations

BOOL CResOrgOptions::SetWebURL(const CString& sWebURL)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -