section.begin
   Name = ShowMultiplayerChat
   Code : struct.begin
      [*] = ;const bupdate = True;
      [*] = ;const currentstatename = 'ShowMultiplayerChat';
      [*] = ;var elmname, showstate, eventstate : String;
      [*] = ;_misc_GetGUIShowEventStateNames(currentstatename, elmname, showstate, eventstate);
      [*] = ;
      [*] = ;dbgstatename := showstate;
      [*] = ;
      [*] = ;const cmargin = 6;
      [*] = ;const cPadding = cmargin+1;
      [*] = ;const cScrollWOff = 26;
      [*] = ;
      [*] = ;const cTagCleanRecipient = 108;
      [*] = ;const cTagShowFriendsChannel = 109;
      [*] = ;
      [*] = ;var cChatFont : Integer = gc_font_serif_11;
      [*] = ;var elmParent : Integer = IntRegister0;
      [*] = ;var chatW : Integer = IntRegister1;
      [*] = ;var rowHeight : Integer = GetGUIElementFontHeight(gUIConst.font[cChatFont])+4;
      [*] = ;
      [*] = ;var elmHnd : Integer;
      [*] = ;var nul : String;
      [*] = ;var cTextChatFilter : String = GetLocaleTableListItemByID('gui', 'internet.chat.chatfilter');
      [*] = ;var cTextClean : String = GetLocaleTableListItemByID('gui', 'internet.chat.clearinput');
      [*] = ;
      [*] = ;var btncolor : TColor;
      [*] = ;_gui_SetupTColorInteger(255, 220, 170, 255, 0.9, btncolor);
      [*] = ;
      [*] = ;function ShowButton(const elmName : String; elmHnd, parentHnd : Integer; btnMaterial : String; var text : String; margin, tag : Integer; bEnabled : Boolean) : Integer;
      [*] = ;begin
      [*] = ;   _gui_HighlightTextHotkey(text, eventstate, elmName, text, False);
      [*] = ;   Result := _gui_CreateButton(elmName, parentHnd, btnMaterial, gc_halParentMiddle, gc_valParentTop, 0, _gui_GetBottomPos(elmHnd)+margin, 0, 0, eventstate, nul, tag, bupdate);
      [*] = ;   SetGUIElementEnabled(Result, bEnabled);
      [*] = ;   _gui_CreateText('txtbtn', Result, text, gc_halParentMiddle, gc_valParentMiddle, 0, 0, 0, 0, gc_halLeft, gc_valMiddle, gc_font_serif_15, btncolor, bupdate);
      [*] = ;end;
      [*] = ;
      [*] = ;if (elmParent=0) then
      [*] = ;begin
      [*] = ;   elmParent := GetGUIElementIndexByNameParent('InternetShell.chatplace', _gui_GetTop);
      [*] = ;   if elmParent=0 then
      [*] = ;   elmParent := _gui_CreateParent(elmname, 0, gc_halParentLeft, gc_valParentTop, 0, 0, 0, 0, bupdate);
      [*] = ;end;
      [*] = ;
      [*] = ;var chatlinescount : Integer = gc_gui_chat_linescount;
      [*] = ;if (gInternetShell.bshowroom) then
      [*] = ;chatlinescount := chatlinescount-2;
      [*] = ;
      [*] = ;var elmChat : Integer = _gui_CreateSkinWindow('chatback', elmParent, gc_halParentLeft, gc_valParentBottomHeight, 0, 0, chatW, rowHeight*chatlinescount+cPadding*2, 1, bupdate);
      [*] = ;
      [*] = ;elmHnd := _gui_CreateMetalLine('mft_0', elmChat, gc_halParentLeft, gc_valParentTop, -4, -4, GetGUIElementWidth(elmChat)+8+cScrollWOff, 0, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfb_0', elmChat, gc_halParentLeft, gc_valParentBottom, -4, 1, GetGUIElementWidth(elmChat)+8+cScrollWOff, 0, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfl_0', elmChat, gc_halParentLeft, gc_valParentTop, -4, -3, 0, GetGUIElementHeight(elmChat)+4, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfr_0', elmChat, gc_halParentRight, gc_valParentTop, 0, -3, 0, GetGUIElementHeight(elmChat)+4, False, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfr_1', elmChat, gc_halParentRight, gc_valParentTop, 3+cScrollWOff, -3, 0, GetGUIElementHeight(elmChat)+4, True, bupdate);
      [*] = ;var elmBtnCleanRecipient, elmCbFriendsChannel : Integer;
      [*] = ;elmBtnCleanRecipient := ShowButton('bcleanrecipient', elmHnd, elmChat, 'btn.nodecor', cTextClean, 41, cTagCleanRecipient, True);
      [*] = ;if ((not gInternetShell.bshowroom) and (not gInternetShell.bhistoricalbattle)) then
      [*] = ;begin
      [*] = ;   elmCbFriendsChannel := _gui_CreateCheckBox('bshowfriendchannel', elmChat, False, gc_halParentLeft, gc_valParentTop, 46+60+300+1, -27, eventstate, nul, cTagShowFriendsChannel, bupdate);
      [*] = ;   SetGUIElementChecked(elmCbFriendsChannel, gbool_internetshell_friendschannel);
      [*] = ;   _gui_CreateText('txtmsgplayer', elmCbFriendsChannel, cTextChatFilter, gc_halParentLeft, gc_valParentMiddle, 30, 0, 0, 0, gc_halLeft, gc_valMiddle, gc_font_serif_12, btncolor, bupdate);
      [*] = ;   SetGUIElementLogicWidth(elmCbFriendsChannel, _gui_GetFontTextWidth(cTextChatFilter, gc_font_serif_12)+32);
      [*] = ;end;
      [*] = ;{
      [*] = ;if(gint_internetshell_msgplid<>0)then
      [*] = ;begin
      [*] = ;   var text : String = TInternetShellClient(gInternetShell.clients.GetByLanID(gint_internetshell_msgplid)).nick;
      [*] = ;   var btncolor : TColor;
      [*] = ;   _gui_SetupTColorInteger(255, 220, 170, 255, 0.9, btncolor);
      [*] = ;   _gui_CreateText('txtmsgplayer', elmChat, text, gc_halParentRight, gc_valParentTop, -150, -25, 0, 0, gc_halLeft, gc_valMiddle, gc_font_serif_14, btncolor, bupdate);
      [*] = ;end;
      [*] = ;}
      [*] = ;var inputhnd : Integer = GetGUIElementIndexByNameParent('chatback.chatinput.text', elmParent);
      [*] = ;var curinputtext : String;
      [*] = ;if (inputhnd<>0) then
      [*] = ;curinputtext := GetGUIElementText(inputhnd);
      [*] = ;
      [*] = ;var elmChatList : Integer = _gui_CreateListBox('chat', elmChat, gc_halParentLeft, gc_valParentTop, 1, cmargin, GetGUIElementWidth(elmChat)-cPadding*2+cPadding-1+cScrollWOff, GetGUIElementHeight(elmChat)-cPadding*2+1, gc_halLeft, gc_valMiddle{gc_valTop}, cPadding, 0, cChatFont, eventstate, False, bupdate);
      [*] = ;if ((curinputtext='') or (gInternetShell.bshowroom) or (gInternetShell.bhistoricalbattle)) then
      [*] = ;begin
      [*] = ;   {if (gbool_internetshell_clearchat) then
      [*] = ;   begin
      [*] = ;      gInternetShell.ClearChat(not gInternetShell.bshowroom, gInternetShell.bshowroom);
      [*] = ;      gbool_internetshell_clearchat := False;
      [*] = ;   end;}
      [*] = ;   SetGUIElementVisible(elmBtnCleanRecipient, False);
      [*] = ;   _misc_FillChatList(False);
      [*] = ;end
      [*] = ;else
      [*] = ;begin
      [*] = ;   {if (gbool_internetshell_clearchat) then
      [*] = ;   begin
      [*] = ;      gInternetShell.ClearChat(not gInternetShell.bshowroom, gInternetShell.bshowroom);
      [*] = ;      gbool_internetshell_clearchat := False;
      [*] = ;   end;}
      [*] = ;   SetGUIElementVisible(elmBtnCleanRecipient, True);
      [*] = ;   _misc_FillChatList(False);
      [*] = ;end;
      [*] = ;
      [*] = ;var elmChatInputBox : Integer = _gui_CreateInputBox('chatinput', elmChat, curinputtext, gc_halParentLeft, gc_valParentBottom, -cPadding, 0, GetGUIElementWidth(elmChat)+cPadding*2+cScrollWOff, 255, eventstate, nul, True, 12, 0, gc_halLeft, gc_valMiddle, gc_font_serif_12, 1, 1, 1, 1, bupdate);
      [*] = ;
      [*] = ;IntRegister2 := elmChat;
      [*] = ;
      [*] = ;if (inputhnd=0) then
      [*] = ;inputhnd := GetGUIElementIndexByNameParent('chatback.chatinput.text', elmParent);
   struct.end
section.end

