version 1.7, 2002/08/14 00:47:51 |
version 1.8, 2002/09/12 03:12:56 |
Line 168 CAsir32guiDoc* CAsir32guiView::GetDocument() // 非デバ |
|
Line 168 CAsir32guiDoc* CAsir32guiView::GetDocument() // 非デバ |
|
|
|
void CAsir32guiView::PutChar(int c) |
void CAsir32guiView::PutChar(int c) |
{ |
{ |
int i; |
int i,len; |
char buf[2]; |
char buf[2]; |
|
|
|
if ( EndPos >= sizeof(Buffer)-1 ) { |
|
Beep(); return; |
|
} |
for ( i = EndPos-1; i >= CurrentPos; i-- ) |
for ( i = EndPos-1; i >= CurrentPos; i-- ) |
Buffer[i+1] = Buffer[i]; |
Buffer[i+1] = Buffer[i]; |
Buffer[CurrentPos] = (char)c; |
Buffer[CurrentPos] = (char)c; |
buf[0] = (char)c; buf[1] = 0; |
// buf[0] = (char)c; buf[1] = 0; |
Insert(buf,FALSE); |
// Insert(buf,FALSE); |
|
len = GetWindowTextLength(); |
|
if ( len+1 >= TextBufferSize ) |
|
DeleteTop(); |
|
CEditView::OnChar(c, 1, 0); |
CurrentPos++; |
CurrentPos++; |
EndPos++; |
EndPos++; |
} |
} |
Line 283 void CAsir32guiView::Beep(void) { |
|
Line 290 void CAsir32guiView::Beep(void) { |
|
} |
} |
|
|
void CAsir32guiView::Paste(void) { |
void CAsir32guiView::Paste(void) { |
char buf[2*BUFSIZ]; |
char buf[2*BUFSIZ]; |
const char *src; |
const char *src; |
char c; |
char c; |
int i,j,l; |
int i,j,l; |
HGLOBAL hClip; |
HGLOBAL hClip; |
|
|
if ( asirgui_kind == ASIRGUI_MESSAGE ) { |
if ( asirgui_kind == ASIRGUI_MESSAGE ) { |
Beep(); return; |
Beep(); return; |
} |
} |
|
|
if ( OpenClipboard() == FALSE ) { |
if ( OpenClipboard() == FALSE ) { |
Beep(); return; |
Beep(); return; |
} |
} |
hClip = GetClipboardData(CF_TEXT); |
hClip = GetClipboardData(CF_TEXT); |
src = (const char *)::GlobalLock(hClip); |
src = (const char *)::GlobalLock(hClip); |
if ( !src || (l = strlen(src)) >= 2*BUFSIZ ) { |
if ( !src || (l = strlen(src)) >= sizeof(Buffer) ) { |
::CloseClipboard(); |
::CloseClipboard(); |
Beep(); return; |
Beep(); return; |
} |
} |
for ( i = j = 0; i < l; i++ ) |
for ( i = j = 0; i < l; i++ ) |
if ( (c = src[i]) != '\n' && c != '\r' ) |
if ( (c = src[i]) != '\n' && c != '\r' ) |
buf[j++] = c; |
buf[j++] = c; |
buf[j] = 0; |
buf[j] = 0; |
::GlobalUnlock(hClip); |
::GlobalUnlock(hClip); |
::CloseClipboard(); |
::CloseClipboard(); |
|
if ( EndPos+j >= sizeof(Buffer)-1 ) { |
|
Beep(); return; |
|
} |
GetEditCtrl().ReplaceSel(buf); |
GetEditCtrl().ReplaceSel(buf); |
strncpy(Buffer+EndPos,buf,j); |
strncpy(Buffer+EndPos,buf,j); |
EndPos += j; CurrentPos = EndPos; |
EndPos += j; CurrentPos = EndPos; |
} |
} |
|
|
#define CTRL(c) (c)&0x1f |
#define CTRL(c) (c)&0x1f |