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

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

?? medit.c

?? microwindows最新源碼
?? 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| 青娱乐精品在线视频| 国产电影精品久久禁18| 欧美高清视频在线高清观看mv色露露十八| 日韩一区二区三区在线| 亚洲天堂av老司机| 国产乱码精品一区二区三区忘忧草 | 亚洲美女偷拍久久| 国产一区二区中文字幕| 欧美日本在线看| 亚洲免费毛片网站| 成熟亚洲日本毛茸茸凸凹| 日韩三级高清在线| 亚洲va中文字幕| 色综合天天综合给合国产| 最好看的中文字幕久久| 寂寞少妇一区二区三区| 欧美精品自拍偷拍| 亚洲午夜视频在线观看| 91丨porny丨中文| 中文字幕中文字幕在线一区| 国产精一品亚洲二区在线视频| 91精品蜜臀在线一区尤物| 亚洲国产人成综合网站| 在线观看av一区| 一区二区高清在线| 色婷婷精品大在线视频| 中文字幕一区二区视频| zzijzzij亚洲日本少妇熟睡| 欧美国产禁国产网站cc| 粉嫩av一区二区三区在线播放 | 日本免费新一区视频| 欧美日本在线播放| 亚洲大片免费看| 欧美日韩在线播| 亚洲成人1区2区| 欧美一区三区二区| 久久精品久久99精品久久| 精品少妇一区二区| 国产一区二区三区日韩| 国产欧美日韩激情| 成人免费va视频| 综合av第一页| 欧美在线观看18| 日本午夜精品视频在线观看| 日韩视频一区二区三区在线播放 | 亚洲柠檬福利资源导航| 日本韩国一区二区三区| 国产在线播放一区二区三区| 日本一区二区三区dvd视频在线| 国产成人精品三级麻豆| 亚洲女人****多毛耸耸8| 欧美日韩国产精品成人| 九九**精品视频免费播放| 久久精品网站免费观看| 91色.com| 免费的国产精品| 欧美激情综合在线| 欧美午夜免费电影| 久久99精品网久久| 亚洲婷婷综合久久一本伊一区| 欧美在线一二三| 麻豆91在线播放| **性色生活片久久毛片| 欧美精品在线观看播放| 国产河南妇女毛片精品久久久 | 99久精品国产| 婷婷久久综合九色综合绿巨人| 久久美女艺术照精彩视频福利播放| 成+人+亚洲+综合天堂| 亚洲123区在线观看| 国产婷婷色一区二区三区| 在线精品国精品国产尤物884a| 精品一区二区三区视频在线观看| 一区视频在线播放| 精品久久免费看| 欧美亚洲国产一区二区三区| 国产剧情一区二区| 午夜影院久久久| 成人欧美一区二区三区白人| 日韩精品自拍偷拍| 精品视频1区2区| av午夜一区麻豆| 国产麻豆视频一区| 日韩高清一区二区| 一区二区三区在线观看动漫| 久久久99久久| 日韩欧美一级特黄在线播放| 色妹子一区二区| 国产成人精品免费| 久久精品久久久精品美女| 亚洲成人精品一区二区| 亚洲品质自拍视频| 欧美国产乱子伦| 精品理论电影在线观看| 欧美日韩mp4| 欧美日韩一区二区欧美激情| 99久久99久久免费精品蜜臀| 国产成人免费视频一区| 久久疯狂做爰流白浆xx| 日本午夜一区二区| 日韩和欧美一区二区| 亚洲国产日韩综合久久精品| 亚洲美女一区二区三区| 亚洲日本成人在线观看| 欧美激情在线观看视频免费| 久久亚洲精精品中文字幕早川悠里| 91精品免费观看| 欧美一区永久视频免费观看| 9191精品国产综合久久久久久| 色婷婷av一区二区| 日本高清不卡aⅴ免费网站| 99精品视频在线播放观看| 粉嫩嫩av羞羞动漫久久久| 国产成人av电影在线播放| 国产精品羞羞答答xxdd| 国产很黄免费观看久久| 国产成人av电影在线播放| 国产成人精品免费网站| 波多野结衣精品在线| av激情综合网| 色综合久久久久久久久久久| 欧美综合天天夜夜久久| 欧美性色欧美a在线播放| 欧美日韩免费电影| 91精选在线观看| 亚洲精品在线三区| 中文字幕久久午夜不卡| 亚洲欧美综合另类在线卡通| 一区二区三区四区av| 亚洲成av人片在线| 免费观看久久久4p| 国产成人精品一区二| 色综合网站在线| 91精品欧美一区二区三区综合在 | 日韩中文字幕1| 捆绑调教美女网站视频一区| 国产精品夜夜嗨| 色综合中文字幕国产| 色噜噜狠狠成人中文综合| 欧美精品777| 久久精品人人爽人人爽| 亚洲男人的天堂在线观看| 日韩电影免费在线看| 国产精品一区在线观看乱码 | 国产成人鲁色资源国产91色综| fc2成人免费人成在线观看播放| 91看片淫黄大片一级在线观看| 欧美日韩精品久久久| 欧美精品一区二区三区在线| 中文字幕一区二区视频| 日韩电影在线一区二区| 国产xxx精品视频大全| 欧美日韩中文精品| 久久久久久免费毛片精品| 亚洲综合无码一区二区| 久久超碰97人人做人人爱| 99免费精品在线| 日韩三级视频在线看| 亚洲精品免费在线观看| 久久99精品国产麻豆婷婷| 91久久香蕉国产日韩欧美9色| 日韩一区二区麻豆国产| 亚洲精品国产视频| 国产毛片精品视频| 5566中文字幕一区二区电影| 欧美国产日韩在线观看| 免费在线看一区| 色综合咪咪久久| 国产亚洲欧美激情| 日本亚洲免费观看| 色婷婷综合在线| 久久久不卡影院| 美女国产一区二区三区| 色综合久久久久| 国产精品女同一区二区三区| 久热成人在线视频| 欧美日本国产视频| 亚洲女与黑人做爰| jvid福利写真一区二区三区| 久久亚洲综合色| 麻豆视频一区二区| 欧美片在线播放| 一区二区在线观看av| youjizz久久| 日本一区二区三区国色天香 | 久久亚洲综合av| 麻豆视频观看网址久久| 欧美高清性hdvideosex| 亚洲一区在线观看网站| 一本色道久久综合亚洲aⅴ蜜桃| 久久久99久久| 国产精品18久久久久| 久久一二三国产| 国产精品一区二区久久不卡| 久久亚洲春色中文字幕久久久| 麻豆精品精品国产自在97香蕉| 欧美一卡二卡在线观看| 日韩va亚洲va欧美va久久|