equal
deleted
inserted
replaced
247 SetLine(Strs[lastStr], s, false); |
247 SetLine(Strs[lastStr], s, false); |
248 |
248 |
249 inc(visibleCount) |
249 inc(visibleCount) |
250 end; |
250 end; |
251 |
251 |
|
252 procedure CheckPasteBuffer(); forward; |
|
253 |
252 procedure DrawChat; |
254 procedure DrawChat; |
253 var i, t, left, top, cnt: LongInt; |
255 var i, t, left, top, cnt: LongInt; |
254 selRect: TSDL_Rect; |
256 selRect: TSDL_Rect; |
255 begin |
257 begin |
256 ChatReady:= true; // maybe move to somewhere else? |
258 ChatReady:= true; // maybe move to somewhere else? |
263 top := 10 + visibleCount * ClHeight; // we start with input line (if any) |
265 top := 10 + visibleCount * ClHeight; // we start with input line (if any) |
264 |
266 |
265 // draw chat input line first and under all other lines |
267 // draw chat input line first and under all other lines |
266 if (GameState = gsChat) and (InputStr.Tex <> nil) then |
268 if (GameState = gsChat) and (InputStr.Tex <> nil) then |
267 begin |
269 begin |
|
270 CheckPasteBuffer(); |
|
271 |
268 if firstDraw then |
272 if firstDraw then |
269 begin |
273 begin |
270 UpdateCursorCoords(); |
274 UpdateCursorCoords(); |
271 firstDraw:= false; |
275 firstDraw:= false; |
272 end; |
276 end; |
660 end; |
664 end; |
661 end; |
665 end; |
662 end; |
666 end; |
663 end; |
667 end; |
664 |
668 |
665 var clipboardBuffer: shortstring; |
|
666 |
|
667 procedure CopyToClipboard(var newContent: shortstring); |
669 procedure CopyToClipboard(var newContent: shortstring); |
668 begin |
670 begin |
669 clipboardBuffer:= newContent; |
671 SendIPC(_S'Y' + copy(newContent, 1, 253) + #0); |
670 end; |
672 end; |
671 |
673 |
672 procedure CopySelectionToClipboard(); |
674 procedure CopySelectionToClipboard(); |
673 var selection: shortstring; |
675 var selection: shortstring; |
674 begin |
676 begin |
708 UpdateCursorCoords(); |
710 UpdateCursorCoords(); |
709 end; |
711 end; |
710 |
712 |
711 procedure PasteFromClipboard(); |
713 procedure PasteFromClipboard(); |
712 begin |
714 begin |
713 DeleteSelected(); |
715 SendIPC(_S'P'); |
714 InsertIntoInputStr(clipboardBuffer); |
716 end; |
|
717 |
|
718 procedure CheckPasteBuffer(); |
|
719 begin |
|
720 if Length(ChatPasteBuffer) > 0 then |
|
721 begin |
|
722 InsertIntoInputStr(ChatPasteBuffer); |
|
723 ChatPasteBuffer:= ''; |
|
724 end; |
715 end; |
725 end; |
716 |
726 |
717 procedure KeyPressChat(Key, Sym: Longword; Modifier: Word); |
727 procedure KeyPressChat(Key, Sym: Longword; Modifier: Word); |
718 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
728 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
719 var i, btw, index: integer; |
729 var i, btw, index: integer; |
721 action, selMode, ctrl: boolean; |
731 action, selMode, ctrl: boolean; |
722 skip: TCharSkip; |
732 skip: TCharSkip; |
723 begin |
733 begin |
724 LastKeyPressTick:= RealTicks; |
734 LastKeyPressTick:= RealTicks; |
725 action:= true; |
735 action:= true; |
|
736 |
|
737 CheckPasteBuffer(); |
726 |
738 |
727 selMode:= (modifier and (KMOD_LSHIFT or KMOD_RSHIFT)) <> 0; |
739 selMode:= (modifier and (KMOD_LSHIFT or KMOD_RSHIFT)) <> 0; |
728 ctrl:= (modifier and (KMOD_LCTRL or KMOD_RCTRL)) <> 0; |
740 ctrl:= (modifier and (KMOD_LCTRL or KMOD_RCTRL)) <> 0; |
729 skip:= none; |
741 skip:= none; |
730 |
742 |
1067 |
1079 |
1068 FillChar(InputStrL, sizeof(InputStrL), InputStrLNoPred); |
1080 FillChar(InputStrL, sizeof(InputStrL), InputStrLNoPred); |
1069 |
1081 |
1070 LastKeyPressTick:= 0; |
1082 LastKeyPressTick:= 0; |
1071 ResetCursor(); |
1083 ResetCursor(); |
1072 |
|
1073 clipboardBuffer:= ''; |
|
1074 end; |
1084 end; |
1075 |
1085 |
1076 procedure freeModule; |
1086 procedure freeModule; |
1077 var i: ShortInt; |
1087 var i: ShortInt; |
1078 begin |
1088 begin |