equal
deleted
inserted
replaced
268 SetLine(Strs[lastStr], s, false); |
268 SetLine(Strs[lastStr], s, false); |
269 |
269 |
270 inc(visibleCount) |
270 inc(visibleCount) |
271 end; |
271 end; |
272 |
272 |
273 procedure CheckPasteBuffer(); forward; |
|
274 |
|
275 procedure UpdateInputLinePrefix(); |
273 procedure UpdateInputLinePrefix(); |
276 begin |
274 begin |
277 if liveLua then |
275 if liveLua then |
278 begin |
276 begin |
279 InputLinePrefix.color:= colors[#1]; |
277 InputLinePrefix.color:= colors[#1]; |
303 top := 10 + visibleCount * ClHeight; // we start with input line (if any) |
301 top := 10 + visibleCount * ClHeight; // we start with input line (if any) |
304 |
302 |
305 // draw chat input line first and under all other lines |
303 // draw chat input line first and under all other lines |
306 if (GameState = gsChat) and (InputStr.Tex <> nil) then |
304 if (GameState = gsChat) and (InputStr.Tex <> nil) then |
307 begin |
305 begin |
308 CheckPasteBuffer(); |
|
309 |
306 |
310 if InputLinePrefix.Tex = nil then |
307 if InputLinePrefix.Tex = nil then |
311 RenderChatLineTex(InputLinePrefix, InputLinePrefix.s); |
308 RenderChatLineTex(InputLinePrefix, InputLinePrefix.s); |
312 |
309 |
313 DrawTexture(left, top, InputLinePrefix.Tex); |
310 DrawTexture(left, top, InputLinePrefix.Tex); |
800 |
797 |
801 InsertIntoInputStr(s); |
798 InsertIntoInputStr(s); |
802 end; |
799 end; |
803 |
800 |
804 procedure PasteFromClipboard(); |
801 procedure PasteFromClipboard(); |
805 begin |
802 var clip: PChar; |
806 SendIPC(_S'Y'); |
803 begin |
807 end; |
804 // use SDL2 clipboard functions |
808 |
805 if SDL_HasClipboardText() then |
809 procedure CheckPasteBuffer(); |
806 begin |
810 begin |
807 clip:= SDL_GetClipboardText(); |
811 if Length(ChatPasteBuffer) > 0 then |
808 // returns NULL if not enough memory for a copy of clipboard content |
812 begin |
809 if clip <> nil then |
813 InsertIntoInputStr(ChatPasteBuffer); |
810 begin |
814 ChatPasteBuffer:= ''; |
811 InsertIntoInputStr(shortstring(clip)); |
|
812 SDL_free(Pointer(clip)); |
|
813 end; |
815 end; |
814 end; |
816 end; |
815 end; |
817 |
816 |
818 procedure KeyPressChat(Key, Sym: Longword; Modifier: Word); |
817 procedure KeyPressChat(Key, Sym: Longword; Modifier: Word); |
819 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
818 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
823 action, selMode, ctrl, ctrlonly: boolean; |
822 action, selMode, ctrl, ctrlonly: boolean; |
824 skip: TCharSkip; |
823 skip: TCharSkip; |
825 begin |
824 begin |
826 LastKeyPressTick:= RealTicks; |
825 LastKeyPressTick:= RealTicks; |
827 action:= true; |
826 action:= true; |
828 |
|
829 CheckPasteBuffer(); |
|
830 |
827 |
831 selMode:= (modifier and (KMOD_LSHIFT or KMOD_RSHIFT)) <> 0; |
828 selMode:= (modifier and (KMOD_LSHIFT or KMOD_RSHIFT)) <> 0; |
832 ctrl:= (modifier and (KMOD_LCTRL or KMOD_RCTRL)) <> 0; |
829 ctrl:= (modifier and (KMOD_LCTRL or KMOD_RCTRL)) <> 0; |
833 ctrlonly:= ctrl and ((modifier and nonStateMask and (not (KMOD_LCTRL or KMOD_RCTRL))) = 0); |
830 ctrlonly:= ctrl and ((modifier and nonStateMask and (not (KMOD_LCTRL or KMOD_RCTRL))) = 0); |
834 skip:= none; |
831 skip:= none; |