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

📄 cedtelement.cpp

📁 Crimson编辑器的英文版,完成从韩文版变成英文版的移植,并且附带可执行文件和注册表文件,无需原先的安装包,是改写编辑器的最理想选择.
💻 CPP
📖 第 1 页 / 共 3 页
字号:
	m_lstAction.RemoveAll();
	m_lstParam.RemoveAll();
	m_lstFlags.RemoveAll();
	m_lstString.RemoveAll();
}

CString CMacroBuffer::GetHotKeyText()
{
	UINT nScanCode = MapVirtualKey( m_wVirtualKeyCode, 0 );
	LPARAM lParam = nScanCode << 16;
	TCHAR szKeyName[1024]; GetKeyNameText( lParam, szKeyName, 1024 );

	CString szHotKeyText = "";
	if( strlen(szKeyName) ) {
		if( m_wModifiers & HOTKEYF_CONTROL ) szHotKeyText += "Ctrl+";
		if( m_wModifiers & HOTKEYF_ALT ) szHotKeyText += "Alt+";
		if( m_wModifiers & HOTKEYF_SHIFT ) szHotKeyText += "Shift+";
		szHotKeyText += szKeyName;
	}
	return szHotKeyText;
}

BOOL CMacroBuffer::StreamSave(ofstream & fout)
{
	INT nLength, nCount; POSITION pos;
	INT nAction; UINT nParam, nFlags; CString szString;

	fout.write((const char *)(& m_wVirtualKeyCode), sizeof(WORD));
	fout.write((const char *)(& m_wModifiers), sizeof(WORD));

	nLength = m_szName.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	if( nLength ) fout.write((const char *)(LPCTSTR)m_szName, nLength);

	nCount = m_lstAction.GetCount(); pos = m_lstAction.GetHeadPosition();
	fout.write((const char *)(& nCount), sizeof(nCount));
	while( pos ) { 
		nAction = m_lstAction.GetNext(pos); 
		fout.write((const char *)(& nAction), sizeof(nAction));
	}

	nCount = m_lstParam.GetCount(); pos = m_lstParam.GetHeadPosition();
	fout.write((const char *)(& nCount), sizeof(nCount));
	while( pos ) { 
		nParam = m_lstParam.GetNext(pos); 
		fout.write((const char *)(& nParam), sizeof(nParam));
	}

	nCount = m_lstFlags.GetCount(); pos = m_lstFlags.GetHeadPosition();
	fout.write((const char *)(& nCount), sizeof(nCount));
	while( pos ) { 
		nFlags = m_lstFlags.GetNext(pos); 
		fout.write((const char *)(& nFlags), sizeof(nFlags));
	}

	nCount = m_lstString.GetCount(); pos = m_lstString.GetHeadPosition();
	fout.write((const char *)(& nCount), sizeof(nCount));
	while( pos ) { 
		szString = m_lstString.GetNext(pos); nLength = szString.GetLength();
		fout.write((const char *)(& nLength), sizeof(nLength));
		fout.write((const char *)(LPCTSTR)szString, nLength);
	}

	return TRUE;
}

BOOL CMacroBuffer::StreamLoad(ifstream & fin)
{
	INT nLength, nCount; TCHAR szBuffer[4096];
	INT nAction; UINT nParam, nFlags; CString szString;

	fin.read((char *)(& m_wVirtualKeyCode), sizeof(WORD));
	fin.read((char *)(& m_wModifiers), sizeof(WORD));

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength ) fin.read((char *)(szBuffer), nLength); 
	szBuffer[nLength] = '\0'; m_szName = szBuffer;

	fin.read((char *)(& nCount), sizeof(nCount));
	m_lstAction.RemoveAll();
	while( nCount-- ) {
		fin.read((char *)(& nAction), sizeof(nAction));
		m_lstAction.AddTail(nAction);
	}

	fin.read((char *)(& nCount), sizeof(nCount));
	m_lstParam.RemoveAll();
	while( nCount-- ) {
		fin.read((char *)(& nParam), sizeof(nParam));
		m_lstParam.AddTail(nParam);
	}

	fin.read((char *)(& nCount), sizeof(nCount));
	m_lstFlags.RemoveAll();
	while( nCount-- ) {
		fin.read((char *)(& nFlags), sizeof(nFlags));
		m_lstFlags.AddTail(nFlags);
	}

	fin.read((char *)(& nCount), sizeof(nCount));
	m_lstString.RemoveAll();
	while( nCount-- ) {
		fin.read((char *)(& nLength), sizeof(nLength));
		fin.read((char *)(szBuffer), nLength); szBuffer[nLength] = '\0';
		m_lstString.AddTail(szBuffer);
	}

	return TRUE;
}

void CMacroBuffer::DeleteContents()
{
	m_wVirtualKeyCode = m_wModifiers = 0x00;
	m_szName = "";
	m_lstAction.RemoveAll();
	m_lstParam.RemoveAll();
	m_lstFlags.RemoveAll();
	m_lstString.RemoveAll();
}

void CMacroBuffer::CopyContents(CMacroBuffer & rBuffer)
{
	m_wVirtualKeyCode = rBuffer.m_wVirtualKeyCode; m_wModifiers = rBuffer.m_wModifiers;
	m_szName = rBuffer.m_szName;
	m_lstAction.RemoveAll(); m_lstAction.AddTail(& rBuffer.m_lstAction);
	m_lstParam.RemoveAll(); m_lstParam.AddTail(& rBuffer.m_lstParam);
	m_lstFlags.RemoveAll(); m_lstFlags.AddTail(& rBuffer.m_lstFlags);
	m_lstString.RemoveAll(); m_lstString.AddTail(& rBuffer.m_lstString);
}


// CFileFilter
CFileFilter::CFileFilter()
{
	m_szDescription = "";
	m_szExtensions = "";
	m_szDefaultExt = "";
}

BOOL CFileFilter::StreamSave(ofstream & fout)
{
	INT nLength;

	nLength = m_szDescription.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	if( nLength ) fout.write((const char *)(LPCTSTR)(m_szDescription), nLength);

	nLength = m_szExtensions.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	if( nLength ) fout.write((const char *)(LPCTSTR)(m_szExtensions), nLength);

	nLength = m_szDefaultExt.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	if( nLength ) fout.write((const char *)(LPCTSTR)(m_szDefaultExt), nLength);

	return TRUE;
}

BOOL CFileFilter::StreamLoad(ifstream & fin)
{
	INT nLength; TCHAR szBuffer[4096];

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength ) fin.read((char *)(szBuffer), nLength);
	szBuffer[nLength] = '\0'; m_szDescription = szBuffer;

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength ) fin.read((char *)(szBuffer), nLength);
	szBuffer[nLength] = '\0'; m_szExtensions = szBuffer;

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength ) fin.read((char *)(szBuffer), nLength);
	szBuffer[nLength] = '\0'; m_szDefaultExt = szBuffer;

	return TRUE;
}

void CFileFilter::AssignContents(LPCTSTR lpszDescription, LPCTSTR lpszExtensions, LPCTSTR lpszDefaultExt)
{
	m_szDescription = lpszDescription;
	m_szExtensions = lpszExtensions;
	m_szDefaultExt = lpszDefaultExt;
}

void CFileFilter::DeleteContents()
{
	m_szDescription = "";
	m_szExtensions = "";
	m_szDefaultExt = "";
}

void CFileFilter::CopyContents(CFileFilter & rFilter)
{
	m_szDescription = rFilter.m_szDescription;
	m_szExtensions = rFilter.m_szExtensions;
	m_szDefaultExt = rFilter.m_szDefaultExt;
}


// CSyntaxType
CSyntaxType::CSyntaxType()
{
	m_szDescription = "";
	m_szLangSpecFile = "";
	m_szKeywordsFile = "";
}

BOOL CSyntaxType::StreamSave(ofstream & fout)
{
	INT nLength;

	nLength = m_szDescription.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	if( nLength ) fout.write((const char *)(LPCTSTR)m_szDescription, nLength);

	nLength = m_szLangSpecFile.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	if( nLength ) fout.write((const char *)(LPCTSTR)m_szLangSpecFile, nLength);

	nLength = m_szKeywordsFile.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	if( nLength ) fout.write((const char *)(LPCTSTR)m_szKeywordsFile, nLength);

	return TRUE;
}

BOOL CSyntaxType::StreamLoad(ifstream & fin)
{
	INT nLength; TCHAR szBuffer[4096];

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength ) fin.read((char *)(szBuffer), nLength); 
	szBuffer[nLength] = '\0'; m_szDescription = szBuffer;

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength ) fin.read((char *)(szBuffer), nLength); 
	szBuffer[nLength] = '\0'; m_szLangSpecFile = szBuffer;

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength ) fin.read((char *)(szBuffer), nLength); 
	szBuffer[nLength] = '\0'; m_szKeywordsFile = szBuffer;

	return TRUE;
}

void CSyntaxType::AssignContents(LPCTSTR lpszDescription, LPCTSTR lpszLangSpecFile, LPCTSTR lpszKeywordsFile)
{
	m_szDescription = lpszDescription;
	m_szLangSpecFile = lpszLangSpecFile;
	m_szKeywordsFile = lpszKeywordsFile;
}

void CSyntaxType::DeleteContents()
{
	m_szDescription = "";
	m_szLangSpecFile = "";
	m_szKeywordsFile = "";
}

void CSyntaxType::CopyContents(CSyntaxType & rSyntax)
{
	m_szDescription = rSyntax.m_szDescription;
	m_szLangSpecFile = rSyntax.m_szLangSpecFile;
	m_szKeywordsFile = rSyntax.m_szKeywordsFile;
}


// CFtpAccount
CFtpAccount::CFtpAccount()
{
	m_szDescription = m_szServerName = "";
	m_szUserName = m_szPassword = "";
	m_szSubDirectory = "";

	m_bSavePassword = m_bPassiveMode = FALSE;
	m_bUseWinInet = m_bPasswordVerified = FALSE;

	m_nServerType = FTP_SERVER_GENERIC;
	m_nPortNumber = 21;
}

BOOL CFtpAccount::StreamSave(ofstream & fout)
{
	INT nLength;

	nLength = m_szDescription.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	fout.write((const char *)(LPCTSTR)m_szDescription, nLength);

	nLength = m_szServerName.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	fout.write((const char *)(LPCTSTR)m_szServerName, nLength);

	nLength = m_szUserName.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	fout.write((const char *)(LPCTSTR)m_szUserName, nLength);

	CString szEncodedPassword = "";
	if( m_bSavePassword ) szEncodedPassword = map_encode(m_szPassword);

	nLength = szEncodedPassword.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	fout.write((const char *)(LPCTSTR)szEncodedPassword, nLength);

	nLength = m_szSubDirectory.GetLength();
	fout.write((const char *)(& nLength), sizeof(nLength));
	fout.write((const char *)(LPCTSTR)m_szSubDirectory, nLength);

	fout.write((const char *)(& m_bSavePassword), sizeof(m_bSavePassword));
	fout.write((const char *)(& m_bPassiveMode), sizeof(m_bPassiveMode));
	fout.write((const char *)(& m_bUseWinInet), sizeof(m_bUseWinInet));
//	fout.write((const char *)(& m_bPasswordVerified), sizeof(m_bPasswordVerified));

	fout.write((const char *)(& m_nServerType), sizeof(m_nServerType));
	fout.write((const char *)(& m_nPortNumber), sizeof(m_nPortNumber));

	return TRUE;
}

BOOL CFtpAccount::StreamLoad(ifstream & fin)
{
	INT nLength; TCHAR szBuffer[4096];

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength < 0 || nLength > 2048 ) return FALSE;
	fin.read((char *)(szBuffer), nLength); szBuffer[nLength] = '\0';
	m_szDescription = szBuffer;

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength < 0 || nLength > 2048 ) return FALSE;
	fin.read((char *)(szBuffer), nLength); szBuffer[nLength] = '\0';
	m_szServerName = szBuffer;

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength < 0 || nLength > 2048 ) return FALSE;
	fin.read((char *)(szBuffer), nLength); szBuffer[nLength] = '\0';
	m_szUserName = szBuffer;

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength < 0 || nLength > 2048 ) return FALSE;
	fin.read((char *)(szBuffer), nLength); szBuffer[nLength] = '\0';

	CString szEncodedPassword = szBuffer;
	m_szPassword = map_decode(szEncodedPassword);

	fin.read((char *)(& nLength), sizeof(nLength));
	if( nLength < 0 || nLength > 2048 ) return FALSE;
	fin.read((char *)(szBuffer), nLength); szBuffer[nLength] = '\0';
	m_szSubDirectory = szBuffer;

	fin.read((char *)(& m_bSavePassword), sizeof(m_bSavePassword));
	fin.read((char *)(& m_bPassiveMode), sizeof(m_bPassiveMode));
	fin.read((char *)(& m_bUseWinInet), sizeof(m_bUseWinInet));
//	fin.read((char *)(& m_bPasswordVerified), sizeof(m_bPasswordVerified));

	fin.read((char *)(& m_nServerType), sizeof(m_nServerType));
	fin.read((char *)(& m_nPortNumber), sizeof(m_nPortNumber));

	return TRUE;
}

CString CFtpAccount::GetDisplayName()
{
	CString szDisplayName;
	if( m_szDescription.GetLength() ) {
		if( m_szServerName.GetLength() ) {
			if( m_szUserName.GetLength() ) szDisplayName.Format("%s [ftp://%s@%s]", m_szDescription, m_szUserName, m_szServerName);
			else szDisplayName.Format("%s [ftp://%s]", m_szDescription, m_szServerName);
		} else szDisplayName = m_szDescription;
	} else szDisplayName = "- Empty -";
	return szDisplayName;
}

CString CFtpAccount::GetFullAccountName()
{
	CString szAccountName;
	if( m_szServerName.GetLength() ) {
		if( m_szUserName.GetLength() ) szAccountName.Format("ftp://%s@%s", m_szUserName, m_szServerName);
		else szAccountName.Format("ftp://%s", m_szServerName);
	} else szAccountName = "";
	return szAccountName;
}

CString CFtpAccount::GetShortAccountName()
{
	CString szAccountName;
	if( m_szServerName.GetLength() ) {
		if( m_szUserName.GetLength() ) szAccountName.Format("%s@%s", m_szUserName, m_szServerName);
		else szAccountName.Format("%s", m_szServerName);
	} else szAccountName = "";
	return szAccountName;
}

void CFtpAccount::DeleteContents()
{
	m_szDescription = m_szServerName = "";
	m_szUserName = m_szPassword = "";
	m_szSubDirectory = "";

	m_bSavePassword = m_bPassiveMode = FALSE;
	m_bUseWinInet = m_bPasswordVerified = FALSE;

	m_nServerType = FTP_SERVER_GENERIC;
	m_nPortNumber = 21;
}

void CFtpAccount::CopyContents(CFtpAccount & rAccount)
{
	m_szDescription = rAccount.m_szDescription;		m_szServerName = rAccount.m_szServerName;
	m_szUserName = rAccount.m_szUserName;			m_szPassword = rAccount.m_szPassword;
	m_szSubDirectory = rAccount.m_szSubDirectory;

	m_bSavePassword = rAccount.m_bSavePassword;		m_bPassiveMode = rAccount.m_bPassiveMode;
	m_bUseWinInet = rAccount.m_bUseWinInet;			m_bPasswordVerified = rAccount.m_bPasswordVerified;
	m_nServerType = rAccount.m_nServerType;			m_nPortNumber = rAccount.m_nPortNumber;
}

⌨️ 快捷键说明

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