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

📄 memo.h

📁 BREW 应用
💻 H
字号:
// MEMO.h: interface for the CMEMO class.
//
//////////////////////////////////////////////////////////////////////

#include "MainHandler.h"
#include "TEXTFILE.H"
#include "TAGTEXTFILE.H"

class CAppMainHandler;
class CMEMO
{
	struct CMemoInfo {
		int m_nx, m_ny, m_nWidth, m_nHeight;//screen
		int m_nLineCount;
	};
	struct CMemoTextInfo {
		char* m_pMemoText;		//Real Text
		char* m_pLineText[20];	//Line
		int m_nTextLength;		//Text Length
		char *m_pCurrText, *m_pEndText;
		int m_nStartLine;
	};
public:
	void CloseFile();
	void InitTextLine();
	int GetLength();
	bool Prev();
	bool Next();
	int LoadFromFile(char* szFile);
	int GetText(char* szOut);
	int SetText(char* szIn, int nSize);
	void Size( int x, int y, int width, int height );
	CMEMO(CAppMainHandler *pAppMain);
	virtual ~CMEMO();

private:			
	void DrawLine();
	void MakeTextLine(bool bNext);
	CAppMainHandler *m_pAppMain;
	int m_nFontHeight;		//font
	CMemoInfo m_Mi;
	CMemoTextInfo m_Mti;
	CTEXTFILE  *m_ptxtFile;
	CTAGTEXTFILE *m_ptagFile;

	void Draw(char *pLine, int nY=0 );
	// bool MakeText(char *pLine, bool bNext);
	// bool MakeMemo(char *pLine, bool bNext);
};

//bool CMEMO::MakeText(char *pLine, bool bNext)
//{
//	int nSize = 0;
//	int nOneSize, nCount, nTextCount=0;
//	char chBuf[3];
//	AEEFont font;
//
//	
//	char *m_pTempText = m_Mti.m_pCurrText;
//	MEMSET(pLine, 0, 30);
//	while( m_Mti.m_pCurrText <= m_Mti.m_pEndText ) { //Next
//		if( *m_Mti.m_pCurrText & 0X80 ) {
//			MEMCPY(chBuf, m_Mti.m_pCurrText, 2);
//			chBuf[2] = '\0';
//			nCount = 2;
//		}else{
//			MEMCPY(chBuf, m_Mti.m_pCurrText, 1);
//			if( chBuf[0] == '\r' )
//				break;
//			if( chBuf[0] == '\n' )
//				continue;
//
//			chBuf[1] = '\0';
//			nCount = 1;
//		}
//		int nTemp;
//		nOneSize = IDISPLAY_MeasureTextEx(m_pAppMain->m_pIDisplay, font, (AECHAR*)chBuf, 1, -1,&nTemp );			
//		nSize += nOneSize;
//		if( m_Mi.m_nWidth > nSize ) {
//			nTextCount += nCount;
//		}else			
//			break;		
//		m_Mti.m_pCurrText += nCount;
//	}
//	if( m_Mti.m_pEndText == m_Mti.m_pCurrText || nTextCount == 0 )
//		return false;
//
//	MEMCPY(pLine, m_pTempText, nTextCount);
//	pLine[nTextCount] = '\0';
//	return true;
//}

//bool CMEMO::MakeMemo(char *pLine, bool bNext)
//{
//	int nSize, nOneSize, nTemp;
//	char chBuf[2];
//	AEEFont font;
//
//	nSize = nOneSize = 0;
//
//	while( (chBuf[0] = m_ptxtFile->GetText(bNext)) != '\0' ) {
//		if( chBuf[0] & 0X80 ) {
//			chBuf[1] = m_ptxtFile->GetText(bNext);
//		}
//		else {
//			chBuf[1] = '\0';
//			if( chBuf[0] == '\r' )
//				break;
//			if( chBuf[0] == '\n' )
//				continue;
//		}
//	
//		nOneSize = IDISPLAY_MeasureTextEx( m_pAppMain->m_pIDisplay, font, (AECHAR*)chBuf, 1, -1, &nTemp );
//		nSize += nOneSize;
//		if( m_Mi.m_nWidth < nSize ) {
//			( bNext ) ? (( chBuf[0] & 0X80 ) ? m_ptxtFile->MoveIndex(-2) : m_ptxtFile->MoveIndex(-1)) :
//						(( chBuf[0] & 0X80 ) ? m_ptxtFile->MoveIndex(2) : m_ptxtFile->MoveIndex(1));
//		}
//	}
//	return false;
//}

⌨️ 快捷键说明

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