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

📄 asix_ed.h

📁 国家ASIC工程中心使用的嵌入式操作系统
💻 H
字号:
/* asixwin.h must be included  in source file */
#ifndef	_ASIX_ED_H
#define	_ASIX_ED_H

#include "keydef.h"

#define	ASIX_EDITOR_VERSION			0x01000001		// v1.0	build 1

//#define EDITOR_MAX_WIDTH			ASIX_PLCD_W
#define EDITOR_MIN_WIDTH			(ENGLISH_CHAR_WIDTH + 4)
//#define EDITOR_MAX_HEIGHT			ASIX_PLCD_H
#define EDITOR_MIN_HEIGHT			(ENGLISH_CHAR_HEIGHT + 4)

#define EDITOR_SCROLLBAR_WIDTH		16

// editor color scheme
#define EDITOR_BACKGROUND_COLOR		ColorTheme.form_client
#define EDITOR_FRAME_COLOR			ColorTheme.form_board
#define EDITOR_TEXT_COLOR			ColorTheme.form_text
#define EDITOR_DISABLE_COLOR		ColorTheme.form_disabletext

#define EDITOR_CURSOR_FREQUENCE		500				// blink once per 500 ms

// edit function key value
#define ESCAPE						ASIX_KEY_CANCEL
#define MOVE_LEFT					ASIX_KEY_LEFT
#define MOVE_RIGHT					ASIX_KEY_RIGHT
#define MOVE_UP						ASIX_KEY_UP
#define MOVE_DOWN					ASIX_KEY_DOWN
#define DELETE						ASIX_KEY_DONE						
#define BACKSPACE					ASIX_KEY_DROP

// input area display region character column map
struct char_pos
{
	U16		x;					// cursor x position (pixel)
	U16		index;				// character position (byte)
};

// input area display region matrix structure
struct char_matrix
{
	U16		x;					// line x position (pixel)
	U16		y;					// line y position (pixel)
	U16		len;				// current column number
	U16		w;					// line width (pixel)
	S8		*lineHead;			// point to first character of current line
	struct char_pos		*vector;// point to character column map 
};

// editor control block structure
struct ed_ctrl
{
	U32		classid;			// editor control class name, must be WNDCLASS_EDITOR
	U32		windowid;			// editor window ID
	U32		editorid;			// editor input area ID
	U32 	style;				// editor style

	// Editor Control Styles ( defined in asixwin.h )
	//
	// Group 1
	// ES_SINGLELINE
	// ES_MULTILINE	
	//
	// Group 2
	// ES_LEFT
	// ES_CENTER
	// ES_RIGHT
	//
	// Group 3
	// ES_NOBORDER
	// ES_NUMBER
	// ES_READONLY
	//
	// Compose Group
	// ES_SINGLE_REGULAR	( ES_SINGLELINE | ES_LEFT )
	// ES_MULTI_REGULAR		( ES_MULTILINE | ES_LEFT )

	U16		x, y;					// left-top coordinate of editor input area 
	U16		width, height;			// width and height of editor input area 

//	U16		dispx, dispy;			// left-top coordinate of display region in editor input area  
//	U16		dispWidth, dispHeight;	// width and height of display region in editor input area
	U16		lineHeight;				// 行高
	U16		maxLine;				// 缓冲区可容纳的最大行数

	U16		pageColumn;
	U16		pageLine;
	
	U16		penx, peny;				// pen coordinate in editor input area

	S8		*pbuf;					// internal buffer for storing user input characters
	U32		bufSize;				// internal buffer size
	U32		strLen;					// length of string stored in internal buffer 
	
	struct char_matrix	*pmatrix;	// display region matrix pointer
	struct char_pos		*vector;	// display region matrix line vector

	S8		*curCursorPos;			// current cursor position (character pointer form)
//	S8		*curLineHead;			// current line head (character pointer form)
	
	U16		curLine;				// 当前光标所在行
	U16		curColumn;				// 当前光标所在列
	U16		curPage;				// 当前页页首所在行
	
//	U16		endLine;				// 最后一行
	U16		maxPage;				// 最大页号
//	U16		reserved;				// uesed for fitting structure memory border

	U32		sbid;					// scroll bar id (only for mutiline editor)
};

#define isChinese( key )			( (key) & 0xff00 )	// key must be 2 bytes

extern STATUS ed_create(char *caption, U32 style, U16 x, U16 y, U16 width, U16 hight,
				 U32 wndid, U32 menu, void **ctrl_str, void *exdata);
extern STATUS ed_destroy(void *ctrl_str);
extern STATUS ed_msgproc(U32 win_id, U16 asix_msg, U32 lparam, void *data, U16 wparam, void *reserved);
extern STATUS ed_msgtrans(void *ctrl_str, U16 msg_type, U32 areaId, P_U16 data, U32 size, PMSG trans_msg);


extern STATUS ed_repaint(void *ctrl_str, U32 lparam);
extern STATUS ed_caption(void *ctrl_str, char *caption, void *exdata);
extern STATUS ed_enable(void *ctrl_str, U8 enable);

extern S8 *GetEditorStr( U32 windid, S8 *userBuf, U32 bufSize );

#ifndef DEBUG_ASIX_EDITOR
#define DEBUG_ASIX_EDITOR

#include <stdio.h>
#include "sysdebug.h"
#include "asixdbg.h"

#if ENABLE_ASIX_EDITOR_DEBUG_OUT


#define asix_edprintf(str)	dbgprintf( str )
#define asix_edoutput(str, var)	dbgoutput(str, var)
#define _asix_eddbgout(str)	_dbgout(#str)
#define asix_edassert(p)	((p) ? 	(void)0 : \
								(void) _asix_eddbgout(Assertion failed:  ##p##, file ##__FILE__## , line  ##__LINE__## \n ))

// mem debug			
#define asix_ed_memdbgprintf(str)	dbgprintf( str )
#define asix_ed_memdbgoutput(str, var)	dbgoutput(str, var)

#else // disable asix editor debug

#define asix_edprintf(str)
#define asix_edoutput(str, var)
#define asix_edassert(p)

#define asix_ed_memdbgprintf(str)	
#define asix_ed_memdbgoutput(str, var)	

#endif	// ENABLE/DISABLE ASIX_EDITOR_DEBUG_OUT


#endif // DEBUG_ASIX_EDITOR

#endif	// _ASIX_EDITOR_H

⌨️ 快捷键说明

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