亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? medit.c

?? microWindows的模擬器,VC下
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* * Copyright (C) 1999, 2000, Wei Yongming. * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com> * * Multi Line Edit Control for Microwindows win32 api. *//***  This library is free software; you can redistribute it and/or**  modify it under the terms of the GNU Library General Public**  License as published by the Free Software Foundation; either**  version 2 of the License, or (at your option) any later version.****  This library is distributed in the hope that it will be useful,**  but WITHOUT ANY WARRANTY; without even the implied warranty of**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU**  Library General Public License for more details.****  You should have received a copy of the GNU Library General Public**  License along with this library; if not, write to the Free**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,**  MA 02111-1307, USA*//***  Alternatively, the contents of this file may be used under the terms **  of the Mozilla Public License (the "MPL License") in which case the**  provisions of the MPL License are applicable instead of those above.*//* Note:**  Although there was a version by Zhao Jianghua, this version of**  EDIT control is written by Wei Yongming from scratch.**** Create date: 1999/8/26**** Modify records:****  Who             When        Where       For What                Status**-----------------------------------------------------------------------------**  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished**  Kevin Tseng     2000/08/30  gv          port to microwin        ported****** TODO:**    * Selection.**    * Undo.*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/time.h>#define MWINCLUDECOLORS#include "windows.h"	/* windef.h, winuser.h */#include "wintools.h"#include "device.h" 	/* GdGetTextSize */#if HAVE_HZK_SUPPORT || HAVE_BIG5_SUPPORT#define USE_BIG5#else#define DEFAULT_FONT	DEFAULT_GUI_FONT#endif#define WIDTH_MEDIT_BORDER       2#define MARGIN_MEDIT_LEFT        1#define MARGIN_MEDIT_TOP         1#define MARGIN_MEDIT_RIGHT       2#define MARGIN_MEDIT_BOTTOM      1#define LEN_MLEDIT_BUFFER       3000#define LEN_MLEDIT_UNDOBUFFER   1024#define EST_FOCUSED     0x00000001L#define EST_MODIFY      0x00000002L#define EST_READONLY    0x00000004L#define EST_REPLACE     0x00000008L#define MEDIT_OP_NONE    0x00#define MEDIT_OP_DELETE  0x01#define MEDIT_OP_INSERT  0x02#define MEDIT_OP_REPLACE 0x03typedef struct tagLINEDATA {	int     lineNO;	                  /* 行號 */	int     dataEnd; 	struct  tagLINEDATA *previous;    /* 前一行 */	struct  tagLINEDATA *next;        /* 后一行 */	char    buffer[LEN_MLEDIT_BUFFER+1];}LINEDATA;typedef    LINEDATA*     PLINEDATA;#define ATTENG 0	/* english */#define ATTCHL 1	/* chinese left(1st) byte */#define ATTCHR 2	/* chinese right(2nd) byte */static char attr[LEN_MLEDIT_BUFFER];typedef struct tagMLEDITDATA {    int     totalLen;      /* length of buffer,可能沒有用 */    int     editPos;        /* current edit position */    int     caretPos;       /* caret offset in box */    int     editLine;		/* current eidt line */    int     dispPos;        /* 開始顯示的位置 */    int     StartlineDisp;  /* start line displayed */    int     EndlineDisp;    /* end line displayed */    int     linesDisp;      /* 需要顯示的行數 */    int     lines;		    /* 總的行數` */    int     MaxlinesDisp;    /* 最大顯示的行數. */							    int     selStartPos;    /* selection start position */    int     selStartLine;   /* selection start line */    int     selEndPos;      /* selection end position */    int     selEndLine;     /* selection end line */        int     passwdChar;     /* password character */        int     leftMargin;     /* left margin */    int     topMargin;      /* top margin */     int     rightMargin;    /* right margin */    int     bottomMargin;   /* bottom margin */        int     hardLimit;      /* hard limit */    int     lastOp;         /* last operation */    int     lastPos;        /* last operation position */    int     lastLine;       /* last operation line */    int     affectedLen;    /* affected len of last operation */    int     undoBufferLen;  /* undo buffer len */    char    undoBuffer [LEN_MLEDIT_UNDOBUFFER];                            /* Undo buffer; */    PLINEDATA   head;       /* buffer */    PLINEDATA   tail;       /* 可能不需要 */}MLEDITDATA;typedef MLEDITDATA* PMLEDITDATA;BOOL RegisterMLEditControl (void);int MLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);#define PIXEL_invalid (-1)extern HWND sg_hCaretWnd;extern HWND rootwp;static int GetSysCharHeight (HWND hwnd) {#ifndef USE_BIG5	    	HDC 		hdc;    	int xw, xh, xb;    	hdc = GetDC(hwnd);	SelectObject(hdc, GetStockObject(DEFAULT_FONT));	GdSetFont(hdc->font->pfont);    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);    	ReleaseDC(hwnd,hdc);	return xh;#else	return 12;#endif}static int GetSysCharWidth (HWND hwnd) {#ifndef USE_BIG5	    	HDC 		hdc;    	int xw, xh, xb;    	hdc = GetDC(hwnd);	SelectObject(hdc, GetStockObject(DEFAULT_FONT));	GdSetFont(hdc->font->pfont);    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);    	ReleaseDC(hwnd,hdc);	return xw;#else	return 6;#endif}static int GetSysCCharWidth (HWND hwnd){	return (2*GetSysCharWidth(hwnd));}char* GetWindowCaption (HWND hWnd){    return hWnd->szTitle;}DWORD GetWindowAdditionalData (HWND hWnd){        return hWnd->userdata;}DWORD SetWindowAdditionalData (HWND hWnd, DWORD newData){    DWORD    oldOne = 0L;    oldOne = hWnd->userdata;    hWnd->userdata = newData;        return oldOne;}DWORD GetWindowAdditionalData2 (HWND hWnd){        return hWnd->userdata2;}DWORD SetWindowAdditionalData2 (HWND hWnd, DWORD newData){    DWORD    oldOne = 0L;    oldOne = hWnd->userdata2;    hWnd->userdata2 = newData;        return oldOne;}DWORD GetWindowStyle (HWND hWnd){        return hWnd->style;}BOOL ExcludeWindowStyle (HWND hWnd, DWORD dwStyle){    	if (hWnd == rootwp/*HWND_DESKTOP*/)        	return FALSE;        hWnd->style &= ~dwStyle;        return TRUE;}BOOL IncludeWindowStyle (HWND hWnd, DWORD dwStyle){    	if (hWnd == rootwp/*HWND_DESKTOP*/)        	return FALSE;        hWnd->style |= dwStyle;        return TRUE;}int WINAPI MwRegisterMEditControl(HINSTANCE hInstance){	WNDCLASS	wc;	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;	wc.lpfnWndProc	= (WNDPROC)MLEditCtrlProc;	wc.cbClsExtra	= 0;	wc.cbWndExtra	= 0;	wc.hInstance	= hInstance;	wc.hIcon	= NULL;	wc.hCursor	= 0; 	wc.hbrBackground= GetStockObject(WHITE_BRUSH);	wc.lpszMenuName	= NULL;	wc.lpszClassName= "MEDIT";	return RegisterClass(&wc);}static inline int edtGetOutWidth (HWND hWnd){	PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);	RECT rc;	GetClientRect(hWnd,&rc);    return rc.right - rc.left             - pMLEditData->leftMargin            - pMLEditData->rightMargin;}static int edtGetStartDispPosAtEnd (HWND hWnd,            PLINEDATA pLineData){    int         nOutWidth = edtGetOutWidth (hWnd);    int         endPos  = pLineData->dataEnd;    PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);    int         newStartPos = pMLEditData->dispPos;    const char* buffer = pLineData->buffer;    if(endPos < newStartPos)		return 0;    while (TRUE)     {        if ((endPos - newStartPos) * GetSysCharWidth (hWnd) < nOutWidth)            break;                /* 1st:gb:a1-f7,big5:a1-f9 */        if ((BYTE)buffer [newStartPos] > 0xA0)	{            newStartPos ++;            if (newStartPos < pLineData->dataEnd) 	    {#ifndef USE_BIG5                if ((BYTE)buffer [newStartPos] > 0xA0)#else	/* 2nd:gb:a1-fe,big5:40-7e,a1-fe */                if ( ((BYTE)buffer [newStartPos] >= 0x40 && (BYTE)buffer[newStartPos] <= 0x7e) ||                     ((BYTE)buffer [newStartPos] >= 0xa1 && (BYTE)buffer[newStartPos] <= 0xfe)) #endif                    newStartPos ++;            }        }        else            newStartPos ++;    }    return newStartPos;}static int edtGetDispLen (HWND hWnd,PLINEDATA pLineData){    int i, n = 0;    int nOutWidth = edtGetOutWidth (hWnd);    int nTextWidth = 0;    PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);    const char* buffer = pLineData->buffer;        if(buffer[0]==0||pLineData->dataEnd<pMLEditData->dispPos)		return 0;	    for (i = pMLEditData->dispPos; i < pLineData->dataEnd; i++)     {        /* 1st:gb:a1-f7,big5:a1-f9 */        if ((BYTE)buffer [i] > 0xA0)   	{            i++;            if (i < pLineData->dataEnd) 	    {#ifndef USE_BIG5                if ((BYTE)buffer [i] > 0xA0)	/* 2nd:gb:a1-fe,big5:40-7e,a1-fe */#else	/* 2nd:gb:a1-fe,big5:40-7e,a1-fe */                if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) ||                     ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe))#endif		{                    nTextWidth += GetSysCCharWidth (hWnd);                    n += 2;                }                else                    i--;            }            else 	    {                nTextWidth += GetSysCharWidth (hWnd);                n++;            }        }        else 	{            nTextWidth += GetSysCharWidth (hWnd);            n++;        }        if (nTextWidth > nOutWidth)            break;    }    return n;}static int edtGetOffset (HWND hwnd,const MLEDITDATA* pMLEditData, PLINEDATA pLineData, int x){    int i;    int newOff = 0;    int nTextWidth = 0;    const char* buffer = pLineData->buffer;    if(pLineData->dataEnd<pMLEditData->dispPos)		return pLineData->dataEnd;    x -= pMLEditData->leftMargin;    for (i = pMLEditData->dispPos; i < pLineData->dataEnd; i++) {        if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x)            break;        /* 1st:gb:a1-f7,big5:a1-f9 */        if ((BYTE)buffer [i] > 0xA0)	{            i++;   	    if (nTextWidth + GetSysCCharWidth(hwnd)/2 >= x)		break;            if (i < pLineData->dataEnd) 	    {#ifndef USE_BIG5                if ((BYTE)buffer [i] > 0xA0)	/* 2nd:gb:a1-fe,big5:40-7e,a1-fe */#else	/* 2nd:gb:a1-fe,big5:40-7e,a1-fe */                if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) ||                      ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe))#endif		{                    nTextWidth += GetSysCCharWidth (hwnd);                    newOff += 2;                }                else                    i --;            }            else 	    {                nTextWidth += GetSysCharWidth (hwnd);                newOff ++;            }        }        else 	{            nTextWidth += GetSysCharWidth (hwnd);            newOff ++;        }    }    return newOff;}static int edtGetLineNO (HWND hwnd,const MLEDITDATA* pMLEditData, int x){    int nline = 0;	if(x>=0)	{	    nline = x / GetSysCharHeight(hwnd);		if (nline <= pMLEditData->linesDisp)   			return nline;	}	return -1;}static BOOL edtIsACCharAtPosition (const char* string, int len, int pos){    if (pos > (len - 2))        return FALSE;/* 1st:gb:a1-f7,big5:a1-f9  2nd:gb:a1-fe,big5:40-7e,a1-fe */#ifndef USE_BIG5    if ((BYTE)string [pos] > 0xA0 && (BYTE)string [pos + 1] > 0xA0)        return TRUE;#else    if ((BYTE)string [pos] > 0xA0)    {	if ( ((BYTE)string [pos + 1] >= 0x40 && (BYTE)string [pos + 1] <= 0x7e) ||	     ((BYTE)string [pos + 1] >= 0xa1 && (BYTE)string [pos + 1] <= 0xfe)) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91在线视频在线| 一区二区三区四区精品在线视频| 亚洲影院理伦片| 亚洲成人资源在线| 4hu四虎永久在线影院成人| 欧美精品日韩一本| 美日韩一区二区三区| 男男gaygay亚洲| 中文字幕一区二| 欧美精品99久久久**| 精品亚洲成a人在线观看| 国产精品久久久久久久久免费丝袜| 中文字幕亚洲一区二区va在线| 色偷偷久久一区二区三区| 日韩av在线播放中文字幕| 国产suv精品一区二区三区| 一二三区精品视频| 国产欧美一区二区在线观看| 色综合天天天天做夜夜夜夜做| 日本在线不卡一区| 国产精品日韩成人| 2017欧美狠狠色| 欧美一区二区观看视频| 一本久道久久综合中文字幕| 国产高清在线观看免费不卡| 免费看欧美美女黄的网站| 欧美中文字幕一二三区视频| 天天射综合影视| 国产精品久久久久久久岛一牛影视| 91免费视频大全| 亚洲愉拍自拍另类高清精品| 中文字幕一区二区三区不卡 | 日韩视频永久免费| 一区二区久久久久久| 亚洲自拍偷拍综合| 18成人在线观看| 亚洲aaa精品| 国产精品私人自拍| 日韩国产欧美视频| 欧美午夜精品一区二区蜜桃 | 国产精品乱码人人做人人爱| 久久免费午夜影院| 国产传媒一区在线| 国产一区二区三区| 成人免费视频一区二区| 国产精品美女一区二区| av中文字幕不卡| 亚洲精品水蜜桃| 午夜欧美电影在线观看| 久久97超碰国产精品超碰| 成人晚上爱看视频| 夜夜嗨av一区二区三区网页| 亚洲一区免费观看| 国产在线不卡一卡二卡三卡四卡| 国产精品免费视频网站| 国产精品一二三四| 国产一区 二区| 69堂成人精品免费视频| 国产精品视频麻豆| 亚洲精品老司机| 91精品中文字幕一区二区三区| 欧美一级淫片007| 欧美va亚洲va| 天天色天天爱天天射综合| 成人手机在线视频| 精品成人免费观看| 99久久伊人久久99| 午夜av电影一区| 色吧成人激情小说| 综合电影一区二区三区| 欧美视频一二三区| 亚洲18色成人| 99精品久久只有精品| 欧美一区二区三级| 亚洲人成小说网站色在线| 中文字幕中文字幕一区二区| 亚洲免费色视频| 国产成人免费xxxxxxxx| 在线观看国产一区二区| 欧美日韩夫妻久久| 亚欧色一区w666天堂| 亚洲一区二区影院| 国产女主播一区| 久久久久久久综合日本| 亚洲成人av资源| 一本到不卡精品视频在线观看| 天天av天天翘天天综合网| 91欧美激情一区二区三区成人| 狠狠狠色丁香婷婷综合激情| 五月天网站亚洲| 婷婷久久综合九色综合伊人色| 欧美日韩国产大片| 日韩一级黄色大片| 国产成人综合亚洲91猫咪| **性色生活片久久毛片| 天天影视涩香欲综合网| 岛国一区二区在线观看| 一区二区三区丝袜| 久久久久久9999| 99久久国产综合精品色伊| 日本韩国欧美一区| 日欧美一区二区| 国产精品国产三级国产普通话蜜臀| 91在线国产福利| 国产成人免费视频精品含羞草妖精| 亚洲最大的成人av| 综合婷婷亚洲小说| 精品一区二区三区久久久| 综合色中文字幕| 久久亚洲精品小早川怜子| 中文字幕色av一区二区三区| 91麻豆精品国产自产在线| 亚洲伦理在线免费看| 亚洲精品一线二线三线| 亚洲青青青在线视频| 欧美bbbbb| 麻豆精品一区二区| 精品一区二区三区视频| 国内精品不卡在线| 国产综合久久久久久鬼色| 精品视频一区二区不卡| 色综合久久久久综合体桃花网| 国产一区999| 国产福利精品导航| 国产精品18久久久久久久久| 国产电影一区二区三区| 久久久久久久网| 色综合一区二区| 宅男在线国产精品| 久久精品欧美日韩精品| 国产亚洲精品久| 国产精品黄色在线观看| 亚洲成年人影院| 欧美va亚洲va香蕉在线| 国产精品欧美极品| 婷婷丁香激情综合| av电影天堂一区二区在线| 日本道精品一区二区三区| 一区二区三区.www| 在线观看av不卡| 亚洲国产精品天堂| 国产成人综合亚洲网站| 中文字幕国产一区| 色激情天天射综合网| 久久女同精品一区二区| 欧洲精品一区二区| 日本一区二区高清| 日本在线不卡一区| 欧美日韩一二区| 国产午夜精品美女毛片视频| 亚洲高清免费在线| 欧美午夜宅男影院| 自拍偷在线精品自拍偷无码专区| 激情图片小说一区| 精品久久久久久久久久久久久久久久久 | 樱桃视频在线观看一区| 波多野结衣中文字幕一区| 精品国产91乱码一区二区三区 | 日韩欧美中文一区二区| 91蜜桃婷婷狠狠久久综合9色| 日韩精品一级中文字幕精品视频免费观看 | 91精品在线观看入口| 亚洲h精品动漫在线观看| 色综合视频在线观看| 亚洲国产综合91精品麻豆| 色久综合一二码| 亚洲精品videosex极品| 久久久久久久久久久电影| 久久爱www久久做| 国产欧美精品在线观看| 不卡av电影在线播放| 亚洲激情综合网| 日韩欧美中文字幕公布| 久久―日本道色综合久久| 激情六月婷婷久久| 精品国精品自拍自在线| 国模少妇一区二区三区| 日本一区二区动态图| 亚洲免费观看高清| 天堂一区二区在线| 国产清纯美女被跳蛋高潮一区二区久久w | 亚洲激情自拍偷拍| 亚洲午夜久久久| 国产精品资源网| 亚洲天堂2014| 国产成人免费视频精品含羞草妖精| 97精品国产露脸对白| 日韩影院精彩在线| 播五月开心婷婷综合| 日韩三级高清在线| 欧美日韩亚洲另类| av日韩在线网站| 极品销魂美女一区二区三区| 亚洲综合在线免费观看| 国产剧情一区二区三区| 午夜精品福利一区二区蜜股av | 91女人视频在线观看| 精品一区二区三区在线视频| 色综合久久久久综合体| 成人免费观看av|