📄 globals.cpp
字号:
/*********************************************************************
* Author: Simon Wang
* Date: 2000-11-16
* Contact us: inte2000@263.net
* Web Page: http://www.winmsg.com/cn/orbit.htm (for Chinese version)
* http://www.winmsg.com/orbit.htm (for English version)
**********************************************************************/
#include "stdafx.h"
#include "Globals.h"
#include "resource.h"
SnapStates cfg_iSnap = ssMDI;
SnapOrientations cfg_iOrientation;// = soBottom;
AddOrder cfg_iAddOrder;// = aoFront;
int cfg_iShellKey;// = VK_SHIFT;
BOOL cfg_bShowIcons;// = TRUE;
BOOL cfg_bDispRC;// = TRUE;
BOOL cfg_bDispResLang;// = TRUE;
BOOL cfg_bDispResType;// = TRUE;
BOOL cfg_bDispRID;// = TRUE;
BOOL cfg_bNoShellContext;// = TRUE;
BOOL cfg_bUseWindowLimit;// = FALSE;
int cfg_iWindowLimit;// = 10;
TCHAR g_szIniPathName[MAX_PATH];
CString g_strPrjSetFile;
TCHAR g_szHeadType[128];// = _T("h;hpp;hxx;hm;inl");
TCHAR g_szCPPType[128];// = _T("cpp;c;cxx;cc");
CStringArray g_strAFlipPath;
BOOL g_bAddTime;// = FALSE;
BOOL g_bAddUser;// = FALSE;
BOOL g_bAutoSave;
int g_nSaveTimeSpan;// = 10;
TCHAR g_szUser[32];// = _T("");
/*
LPCTSTR g_szEdNames[] =
{
NULL,
_T("Main"),
_T("Text"),
NULL,
_T("Dialog"),
NULL,
NULL,
NULL,
_T("Image")
};
*/
LPCTSTR lpszCommandWnd = _T("Text");
LPCTSTR g_szHotkeyItem[] =
{
_T("sHotKeyFlip"),
_T("sHotKeyCurDir"),
_T("sHotKeyTextMode"),
_T("sHotKeyBlock"),
_T("sHotKeyRemark"),
_T("sHotKeyUnremark"),
_T("sHotKeyFunction"),
_T("sHotKeyDiagram"),
_T("sHotKeyZip"),
_T("sHotKeyUnzip"),
_T("sHotKeyOption")
};
cmd g_toolbar_cmds[] =
{
{ _T("OSHeaderFlip"), IDC_HEADERFLIP },//associate toolbar button
{ _T("OSSetCurrDir"), IDC_SETCURRDIR },
{ _T("OSOpenAsText"), IDC_OPENASTEXT },
{ _T("OSBlockRemark"), IDC_BLOCKREMARK },
{ _T("OSRemark"), IDC_REMARK },
{ _T("OSUnremark"), IDC_UNREMARK },
{ _T("OSFuncDesc"), IDC_FUNCDESCR },
{ _T("OSInsertDiagram"),IDC_INSERTDIAGRAM },
{ _T("OSZipWorkspace"), IDC_ZIPWORKSPACE },
{ _T("OSOpenDswInZip"), IDC_OPENDSWINZIP },
{ _T("OSOptions"), IDC_OPTIONS }
};
//Ini config file section name
LPCTSTR lpszGeneral = _T("GENERAL");
LPCTSTR lpszMainIfo = _T("MAININFO");
LPCTSTR lpszTabbar = _T("TABBARS");
LPCTSTR lpszFlip = _T("FLIP");
LPCTSTR lpszToolbar = _T("TOOLBAR");
LPCTSTR lpszZip = _T("ZIP");
//Ini config file item name
LPCTSTR lpszSaveLog = _T("bSaveLogFile");
LPCTSTR lpszShowIcon = _T("bShowIconOnBar");
LPCTSTR lpszEnableShellMenu = _T("bEnableShellMenu");
LPCTSTR lpszLimitWnd = _T("bLimitOpenWnd");
LPCTSTR lpszShowRcName = _T("bShowRcName");
LPCTSTR lpszShowRcLang = _T("bShowRcLanguage");
LPCTSTR lpszShowRcType = _T("bShowRcType");
LPCTSTR lpszShowRcID = _T("bShowRcID");
LPCTSTR lpszMaxWnd = _T("nMaxOpenWnd");
LPCTSTR lpszOrderBy = _T("nBarOrder");
LPCTSTR lpszInitPos = _T("nInitPosition");
LPCTSTR lpszAddTime = _T("bAutoAddTime");
LPCTSTR lpszAddUser = _T("bAutoAddUser");
LPCTSTR lpszUser = _T("sUser ");
LPCTSTR lpszNull = _T("");
LPCTSTR lpszAutoSave = _T("bAutoSave");
LPCTSTR lpszTimeSpan = _T("nTimeSpan");
LPCTSTR lpszFlipPath = _T("msFlipPath");
LPCTSTR lpszHeadType = _T("sHeadType");
LPCTSTR lpszCppType = _T("sCppType");
LPCTSTR lpszSelectPortion = _T("sSelectPortion");
//message box title
LPCTSTR lpszMsgBoxTitle = _T("Tabbars");
//first flip search folder
#ifdef _VER_CHINESE
LPCTSTR lpszSameDir = _T("<切换文件所在的目录>");
#else
LPCTSTR lpszSameDir = _T("<The same directory of switch file>");
#endif
CString LoadVersionString(LPCTSTR path)
{
DWORD DataLen, Zero;
PVOID pData, pValue;
UINT ValueLen;
CString cRetVal;
DataLen = GetFileVersionInfoSize((char *)path, &Zero);
pData = new char[DataLen];
GetFileVersionInfo((char *)path, NULL, DataLen, pData);
VerQueryValue(pData,
_T("\\StringFileInfo\\040904b0\\ProductVersion"), &pValue,
&ValueLen);
memcpy(cRetVal.GetBuffer(ValueLen), pValue, ValueLen);
cRetVal.ReleaseBuffer();
delete pData;
return cRetVal;
}
void SplitString(CString & strMultiLine,CStringArray & strAMultistr)
{
CString strTmp;
int length = strMultiLine.GetLength();
if(length == 0)
return;
int idx;
while((idx = strMultiLine.Find(_T("\r\n"),0)) != -1)
{
strTmp = strMultiLine.Left(idx);
strAMultistr.Add(strTmp);
strMultiLine = strMultiLine.Right(length - idx - 2);
length = strMultiLine.GetLength();
}
// strAMultistr.Add(strMultiLine);
}
void CombineString(const CStringArray & strAMultistr,CString & strMultiLine)
{
int size = strAMultistr.GetSize();
if(size == 0)
return;
strMultiLine.Empty();
for(int i = 0; i < size; i++)
{
strMultiLine += strAMultistr[i];
// if(i < (size -1))
strMultiLine += _T("\r\n");
}
}
int SplitFileTypeString(LPCTSTR lpszTypeString,CStringArray & arTypes,LPCTSTR lpszSepMark)
{
int nPart = 0;
arTypes.RemoveAll();
if(_tcslen(lpszTypeString) > 0)
{
TCHAR szTemp[256];
_tcscpy(szTemp,lpszTypeString);//copy to a buffer
_tcscat(szTemp,lpszSepMark);//add a end mark
LPTSTR lpStart = szTemp;
LPTSTR lpPoint;
int nCharSetLength = _tcslen(lpszSepMark);
while((*lpStart != 0) && (lpPoint = _tcsstr(lpStart,lpszSepMark)) != NULL)
{
*lpPoint = 0;
arTypes.Add(lpStart);
lpStart = lpPoint + nCharSetLength;
nPart++;
}
}
return nPart;
}
/*********************************************************************
* Function Name : InitGlobalVar
* Explain : call this function when start up
* Parameters :
* Return :
* void --
* Author : orbit
* Time : 2001-03-15 17:28:02
*********************************************************************/
void InitGlobalVar()
{
CIni ini(g_szIniPathName);
ini.GetBoolValue(lpszTabbar,lpszShowIcon,cfg_bShowIcons,TRUE);
ini.GetBoolValue(lpszTabbar,lpszEnableShellMenu,cfg_bNoShellContext,FALSE);
cfg_bNoShellContext = !cfg_bNoShellContext;
ini.GetBoolValue(lpszTabbar,lpszLimitWnd,cfg_bUseWindowLimit,FALSE);
ini.GetBoolValue(lpszTabbar,lpszShowRcName,cfg_bDispRC,TRUE);
ini.GetBoolValue(lpszTabbar,lpszShowRcLang,cfg_bDispResLang,FALSE);
ini.GetBoolValue(lpszTabbar,lpszShowRcType,cfg_bDispResType,TRUE);
ini.GetBoolValue(lpszTabbar,lpszShowRcID,cfg_bDispRID,TRUE);
ini.GetValue(lpszTabbar,lpszMaxWnd,cfg_iWindowLimit,10);
int nTmp;
ini.GetValue(lpszTabbar,lpszOrderBy,nTmp,10);
cfg_iAddOrder = (AddOrder)nTmp;
ini.GetValue(lpszTabbar,lpszInitPos,nTmp,1);
cfg_iOrientation = (SnapOrientations)nTmp;
ini.GetBoolValue(lpszGeneral,lpszAddTime,g_bAddTime,FALSE);
ini.GetBoolValue(lpszGeneral,lpszAddUser,g_bAddUser,FALSE);
ini.GetValue(lpszGeneral,lpszUser,g_szUser,lpszNull);
ini.GetBoolValue(lpszGeneral,lpszAutoSave,g_bAutoSave,FALSE);
ini.GetValue(lpszGeneral,lpszTimeSpan,g_nSaveTimeSpan,10);
CString strTmp;
TCHAR szSelect[16];
ini.GetMultiValue(lpszFlip,lpszFlipPath,strTmp);
ini.GetValue(lpszFlip,lpszHeadType,g_szHeadType,_T(".h;.hpp;.hxx;.hm;.inl"));
ini.GetValue(lpszFlip,lpszCppType,g_szCPPType,_T(".cpp;.c;.cxx;.cc"));
ini.GetValue(lpszFlip,lpszSelectPortion,&(szSelect[1]));//m_szSelect+1);
ini.Clear();
g_strAFlipPath.RemoveAll();
SplitString(strTmp,g_strAFlipPath);
//szSelect[0],g_strAFlipPath[0] is default directory
szSelect[0] = _T('1');
g_strAFlipPath.InsertAt(0,lpszSameDir,1);
int max = g_strAFlipPath.GetSize();
CUIntArray nASelect;
for(int i = 0; i < max; i++)
nASelect.Add((szSelect[i] == _T('1')) ? 1 : 0);
for(i = 0; i < max; i++)
{
if(nASelect[i] != 1)
{
g_strAFlipPath.RemoveAt(i);
nASelect.RemoveAt(i);
i--;
max--;
}
}
nASelect.RemoveAll();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -