section.begin
   Name = ShowCampaign
   Code : struct.begin
      [*] = ;const bupdate = False;
      [*] = ;const currentstatename = 'ShowCampaign';
      [*] = ;var elmname, showstate, eventstate : String;
      [*] = ;_misc_GetGUIShowEventStateNames(currentstatename, elmname, showstate, eventstate);
      [*] = ;
      [*] = ;dbgstatename := showstate;
      [*] = ;
      [*] = ;const cmargin = 6;
      [*] = ;
      [*] = ;const cMinWidth = 300;
      [*] = ;const cMinHeight = 140;
      [*] = ;
      [*] = ;const cTagSelect = 101;
      [*] = ;const cTagBack = 102;
      [*] = ;
      [*] = ;// common variables
      [*] = ;var elmHnd : Integer;
      [*] = ;var nul, text : String;
      [*] = ;var w, h : Integer;
      [*] = ;var color : TColor;
      [*] = ;_gui_SetupTColorInteger(255, 220, 170, 255, 0.9, color);
      [*] = ;var maxwidth : Integer = cMinWidth;
      [*] = ;var maxheight : Integer = cMinHeight;
      [*] = ;
      [*] = ;function ShowButton(const elmName : String; elmHnd, parentHnd : Integer; btnMaterial : String; var text : String; margin, tag : Integer; bEnabled : Boolean) : Integer;
      [*] = ;begin
      [*] = ;   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, color, bupdate);
      [*] = ;end;
      [*] = ;
      [*] = ;var cTextCampaignMenu : String = GetLocaleTableListItemByID('misc', 'campaignmenu.campaignmenu');
      [*] = ;var cTextCampaign : String = GetLocaleTableListItemByID('misc', 'campaignmenu.campaign');
      [*] = ;var cTextMission : String = GetLocaleTableListItemByID('misc', 'campaignmenu.mission');
      [*] = ;var cTextSelectCampaign : String = GetLocaleTableListItemByID('misc', 'campaignmenu.selectcampaign');
      [*] = ;var cTextSelectMission : String = GetLocaleTableListItemByID('misc', 'campaignmenu.selectmission');
      [*] = ;var cTextStartMission : String = GetLocaleTableListItemByID('misc', 'campaignmenu.startmission');
      [*] = ;var cTextBackToMainMenu : String = GetLocaleTableListItemByID('misc', 'campaignmenu.backtomainmenu');
      [*] = ;var cTextBackToCampaign : String = GetLocaleTableListItemByID('misc', 'campaignmenu.backtocampaign');
      [*] = ;var cTextDifficulty : String = GetLocaleTableListItemByID('misc', 'campaignmenu.difficulty');
      [*] = ;
      [*] = ;// restore scroll and list
      [*] = ;var bChooseCampaign : Boolean = (gint_campaign_selectedmission<0) and (gstring_campaign_lastmissionname='') and (gstring_campaign_exittomenu_missname='');
      [*] = ;var listname : String;
      [*] = ;_misc_SwitchString(listname, 'mission', 'campaign', bChooseCampaign);
      [*] = ;var tmpElmList : Integer = GetGUIElementIndexByNameParent(elmname+'.back.'+listname, _gui_GetTop);
      [*] = ;var topIndex, itemIndex : Integer;
      [*] = ;if (tmpElmList<>0) then
      [*] = ;begin
      [*] = ;   topIndex := GetGUIListBoxTopIndex(tmpElmList);
      [*] = ;   itemIndex := GetGUIListBoxItemIndex(tmpElmList);
      [*] = ;end;
      [*] = ;
      [*] = ;// parent
      [*] = ;const cWidth = 1018-160; // 1018
      [*] = ;const cHeight = 750; // 624
      [*] = ;
      [*] = ;var elmParent : Integer = _gui_CreateParent(elmname, 0, gc_halMiddle, gc_valMiddle, 0, 0, cWidth, cHeight, bupdate);
      [*] = ;_gui_AbsScaleByDPI(elmParent);
      [*] = ;var elmBackgroundParent : Integer = _gui_CreateParent('backgroundparent', elmParent, gc_halMiddle, gc_valMiddle, 0, 0, cWidth, cHeight, bupdate);
      [*] = ;SetGUIElementPressState(elmParent, eventstate);
      [*] = ;
      [*] = ;// body
      [*] = ;const cInputboxHeight = 36;
      [*] = ;const cButtonsHeight = 32;
      [*] = ;const cMarginBottom = 64+cInputboxHeight+cButtonsHeight*2+cmargin*8;
      [*] = ;const cMarginTop = 57;
      [*] = ;
      [*] = ;var skinHeadOffset : Integer = GetGUITextureHeight('skin.header.l')+5;
      [*] = ;var rowHeight : Integer = GetGUIElementFontHeight(gUIConst.font[gc_font_serif_12])+4;
      [*] = ;var cCampaignListCount : Integer = 10;
      [*] = ;if (gint_campaign_selectedmission<0) then
      [*] = ;cCampaignListCount := 10
      [*] = ;else
      [*] = ;cCampaignListCount := 5;
      [*] = ;
      [*] = ;var cCampaignListHeight : Integer = rowHeight*cCampaignListCount;
      [*] = ;var cCampaignCountInList : Integer = (GetGUIElementHeight(elmParent)-(cMarginBottom+cMarginTop+skinHeadOffset)) div rowHeight;
      [*] = ;
      [*] = ;var cListWidth : Integer = cWidth-149{-GetGUIElementFontHeight(gUIConst.font[gc_font_serif_12])*cCampaignListCount};
      [*] = ;const cScrollW = 22;
      [*] = ;const cScrollWOff = cScrollW+4;
      [*] = ;const cPadding = cmargin+1;
      [*] = ;
      [*] = ;var elmListBackground : Integer = _gui_CreateSkinWindow('back', elmParent, gc_halParentMiddle, gc_valParentTop, -cScrollWOff div 2, cMarginTop+skinHeadOffset, cListWidth, cCampaignListHeight+cPadding*2, 1, bupdate);
      [*] = ;const cDescrMarginTop = 30;
      [*] = ;const cDescrMarginBottom = 56+100;
      [*] = ;var elmDescriptionBackground : Integer = _gui_CreateSkinWindow('descr', elmParent, gc_halParentMiddle, gc_valParentTop, -cScrollWOff div 2, GetGUIElementPositionY(elmListBackground)+GetGUIElementHeight(elmListBackground)+cDescrMarginTop, cListWidth, cHeight-GetGUIElementPositionY(elmListBackground)-GetGUIElementHeight(elmListBackground)-cDescrMarginTop-cDescrMarginBottom, 1, bupdate);
      [*] = ;
      [*] = ;elmHnd := _gui_CreateSkinHeadWindow('sh_0', elmListBackground, gc_halParentLeft, gc_valParentTop, 0, -skinHeadOffset, GetGUIElementWidth(elmListBackground)+cScrollWOff, bupdate);
      [*] = ;var nickW : Integer = GetGUIElementWidth(elmListBackground)-cPadding-cScrollW;
      [*] = ;var cTextSelectHead : String;
      [*] = ;_misc_SwitchString(cTextSelectHead, cTextMission, cTextCampaign, bChooseCampaign);
      [*] = ;_gui_CreateText('thead', elmHnd, cTextSelectHead, gc_halParentLeft, gc_valParentMiddle, cPadding, 2, GetGUIElementWidth(elmHnd), 0, gc_halLeft, gc_valMiddle, gc_font_serif_13, color, bupdate);
      [*] = ;
      [*] = ;// difficulty
      [*] = ;text := cTextDifficulty;
      [*] = ;var elmList : Integer = _gui_CreateComboBox('difficulty', elmHnd, 4, 0, gc_halParentMiddle, gc_valParentTop, 1+50, 550+4, 256, gc_halLeft, gc_valMiddle, 5, 0, gc_font_serif_12, True, eventstate, False, bupdate);
      [*] = ;//if (not bChooseCampaign) then
      [*] = ;begin
      [*] = ;   var i : Integer;
      [*] = ;   for i:=0 to 3 do
      [*] = ;   begin
      [*] = ;      var itemtext : String = GetLocaleTableListItemByID('gui', 'difficulty.'+IntToStr(i+1));
      [*] = ;      GUIListBoxAddItem(elmList, itemtext, i);
      [*] = ;   end;
      [*] = ;   SetGUIListBoxItemIndexSilent(elmList, gProfileUserStruct.campaign.difficulty);
      [*] = ;   elmHnd := _gui_CreateText('t', elmList, text, gc_halParentLeft, gc_valParentTop, -89, 2, GetGUIElementWidth(elmList), GetGUIElementHeight(elmList), gc_halLeft, gc_valTop, gc_font_serif_12, color, bupdate);
      [*] = ;end;
      [*] = ;//SetGUIElementVisible(elmList, not bChooseCampaign);
      [*] = ;
      [*] = ;elmList := _gui_CreateListBox(listname, elmListBackground, gc_halParentLeft, gc_valParentTop, 2, cmargin, GetGUIElementWidth(elmListBackground)-cPadding*2+cPadding-2+cScrollWOff, GetGUIElementHeight(elmListBackground)-cPadding*2+1, gc_halLeft, gc_valMiddle, 0, 0, gc_font_serif_12, eventstate, False, bupdate);
      [*] = ;AddGUIListBoxTabProperty(elmList, 1, 1, 1, 1, cPadding-2+4, 'tsText');
      [*] = ;AddGUIListBoxTabProperty(elmList, 1, 1, 1, 1, nickW, 'tsText');
      [*] = ;SetGUIListBoxMouseTrack(elmList, 3); // 1 - only text change color on hover, 2 - only material appears, 3 - text and material on hover
      [*] = ;
      [*] = ;//var bScrollToEnd : Boolean = (topIndex=(GetGUIListBoxItemsCount(elmSessionsList)-cSessionsCountInList));
      [*] = ;
      [*] = ;GUIListBoxClearSilent(elmList);
      [*] = ;
      [*] = ;var textDescription : String;
      [*] = ;var selMapPath : String;
      [*] = ;var filename : String = gc_filepath_campaigns;
      [*] = ;var pCampaigns : Integer = _parser_ParserTemporary(True);
      [*] = ;ParserLoadFromFileByHandle(pCampaigns, filename);
      [*] = ;
      [*] = ;const cFontDisableColor = '%color(656060)%';
      [*] = ;const cFontTutorialColor = '%color(FFFFEE)%';
      [*] = ;
      [*] = ;var bfirstselcamp, bfirstselmiss : Boolean;
      [*] = ;var campCount : Integer = ParserGetCountByHandle(pCampaigns);
      [*] = ;var i, j : Integer;
      [*] = ;for i:=0 to campCount-1 do
      [*] = ;begin
      [*] = ;   const cCampLocaleTable = '_campaign';
      [*] = ;   var pCampaign : Integer = ParserSelectByHandleByIndex(pCampaigns, i);
      [*] = ;   var pMissions : Integer = ParserSelectByHandleByKey(pCampaign, 'Missions');
      [*] = ;   var campName : String = ParserGetValueByKeyByHandle(pCampaign, 'Name');
      [*] = ;   var enabled : Boolean = ParserGetBoolValueByKeyByHandle(pCampaign, 'Enabled');
      [*] = ;   var visible : Boolean = ParserGetBoolValueByKeyByHandle(pCampaign, 'Visible');
      [*] = ;   var requireToVisible : String = ParserGetValueByKeyByHandle(pCampaign, 'RequireToVisible');
      [*] = ;   var requireDLC : Integer = ParserGetIntValueByKeyByHandle(pCampaign, 'RequireDLC');
      [*] = ;   var requireUnixTime : Integer = ParserGetIntValueByKeyByHandle(pCampaign, 'RequireUnixTime');
      [*] = ;   var requireFile : String = ParserGetValueByKeyByHandle(pCampaign, 'RequireFile');
      [*] = ;   var localeName : String = ParserGetValueByKeyByHandle(pCampaign, 'LocaleName');
      [*] = ;   var localeDescr : String = ParserGetValueByKeyByHandle(pCampaign, 'LocaleDescr');
      [*] = ;   var localePath : String = ParserGetValueByKeyByHandle(pCampaign, 'LocalePath');
      [*] = ;   var locale : String;
      [*] = ;   _profile_ConvertConfigValueToLocale(gProfile.lang, locale);
      [*] = ;   localePath := StrReplace(localePath, '%lang%', locale);
      [*] = ;   localePath := StrReplace(localePath, '%locale%', locale);
      [*] = ;
      [*] = ;   //if (visible) {or (gProfile.bCheatShowAllMissions)} or (_misc_IsCampaignFinished(requireToVisible)) then
      [*] = ;   if (visible) or (requireToVisible<>'') or (requireFile<>'') then
      [*] = ;   if (requireFile='') or (IsFileExists(requireFile)) then
      [*] = ;   if (requireDLC=0) or ((requireDLC) and (gProfile.lastknowndlcs)<>0) then
      [*] = ;   if (requireUnixTime=0) or ((gProfile.purchaseunixtime<>0) and (gProfile.purchaseunixtime<=requireUnixTime)) then
      [*] = ;   if (enabled) then
      [*] = ;   begin
      [*] = ;      var locInd : Integer = -1;
      [*] = ;      if (IsFileExists(localePath)) then
      [*] = ;      begin
      [*] = ;         locInd := IndexOfLocaleTableListByFile(localePath);
      [*] = ;         if (locInd<0) then
      [*] = ;         locInd := AddLocaleTableList(cCampLocaleTable, localePath);
      [*] = ;      end;
      [*] = ;      if (locInd>=0) then
      [*] = ;      begin
      [*] = ;         if (campName=gstring_campaign_exittomenu_campname) then
      [*] = ;         gint_campaign_selectedcampaign := i;
      [*] = ;         if (bChooseCampaign) then
      [*] = ;         begin
      [*] = ;            if (visible) or (requireFile<>'') or (_misc_IsCampaignFinishedExt(requireToVisible)) or (gProfile.bCheatShowAllMissions) then
      [*] = ;            begin
      [*] = ;               var stext : String;
      [*] = ;               if (i=0) then
      [*] = ;               stext := #9+cFontTutorialColor+GetLocaleTableListItemByIndex(locInd, localeName)+#9
      [*] = ;               else
      [*] = ;               stext := #9+GetLocaleTableListItemByIndex(locInd, localeName)+#9;
      [*] = ;               GUIListBoxAddItem(elmList, stext, i)
      [*] = ;            end
      [*] = ;            else
      [*] = ;            GUIListBoxAddItem(elmList, #9+cFontDisableColor+#151+' '+GetLocaleTableListItemByIndex(locInd, localeName)+#9, i-1000);
      [*] = ;            if (not bfirstselcamp) or (i=gint_campaign_selectedcampaign) or ((i=campCount-1) and (gint_campaign_selectedcampaign>=campCount)) then
      [*] = ;            begin
      [*] = ;               bfirstselcamp := True;
      [*] = ;               SetGUIListBoxItemIndexSilent(elmList, i);
      [*] = ;               gstring_campaign_selcampaignname := campName;
      [*] = ;               textDescription := GetLocaleTableListItemByIndex(locInd, localeDescr);
      [*] = ;            end;
      [*] = ;         end
      [*] = ;         else
      [*] = ;         if (i=gint_campaign_selectedcampaign) then
      [*] = ;         begin
      [*] = ;            var misCount : Integer = ParserGetCountByHandle(pMissions);
      [*] = ;            for j:=0 to misCount-1 do
      [*] = ;            begin
      [*] = ;               var pMission : Integer = ParserSelectByHandleByIndex(pMissions, j);
      [*] = ;               var misEnabled : Boolean = ParserGetBoolValueByKeyByHandle(pMission, 'Enabled');
      [*] = ;               var misVisible : Boolean = ParserGetBoolValueByKeyByHandle(pMission, 'Visible');
      [*] = ;               var misRequireToVisible : String = ParserGetValueByKeyByHandle(pMission, 'RequireToVisible');
      [*] = ;               var misLocaleName : String = ParserGetValueByKeyByHandle(pMission, 'LocaleName');
      [*] = ;               var misLocaleDescr : String = ParserGetValueByKeyByHandle(pMission, 'LocaleDescr');
      [*] = ;               var misMapPath : String = ParserGetValueByKeyByHandle(pMission, 'MapPath');
      [*] = ;               var misName : String = ParserGetValueByKeyByHandle(pMission, 'Name');
      [*] = ;               //var misMapLocalePath : String = ParserGetValueByKeyByHandle(pMission, 'MapLocalePath');
      [*] = ;
      [*] = ;               //if (misVisible) or (gProfile.bCheatShowAllMissions) or (_misc_IsMissionFinished(campName, misRequireToVisible)) then
      [*] = ;               if (misEnabled) then
      [*] = ;               begin
      [*] = ;                  if (misName=gstring_campaign_exittomenu_missname) then
      [*] = ;                  begin
      [*] = ;                     gint_campaign_selectedcampaign := i;
      [*] = ;                     if gint_campaign_exittomenu_status=gc_campaign_exittomenu_status_win then
      [*] = ;                     gint_campaign_selectedmission := Min(j+1, misCount-1)
      [*] = ;                     else
      [*] = ;                     gint_campaign_selectedmission := j;
      [*] = ;                  end;
      [*] = ;
      [*] = ;                  if (i=gint_campaign_selectedcampaign) then
      [*] = ;                  begin
      [*] = ;                     if (misVisible) or (_misc_IsMissionFinished(campName, misRequireToVisible)) or (gProfile.bCheatShowAllMissions) then
      [*] = ;                     GUIListBoxAddItem(elmList, #9+#149+' '+GetLocaleTableListItemByIndex(locInd, misLocaleName)+#9, j)
      [*] = ;                     else
      [*] = ;                     GUIListBoxAddItem(elmList, #9+cFontDisableColor+#149+' '+GetLocaleTableListItemByIndex(locInd, misLocaleName)+#9, j-1000);
      [*] = ;                     if (not bfirstselmiss) or (j=gint_campaign_selectedmission) or ((j=misCount-1) and (gint_campaign_selectedmission>=misCount)) then
      [*] = ;                     begin
      [*] = ;                        bfirstselmiss := True;
      [*] = ;                        SetGUIListBoxItemIndexSilent(elmList, j);
      [*] = ;                        textDescription := GetLocaleTableListItemByIndex(locInd, misLocaleDescr);
      [*] = ;                        selMapPath := misMapPath;
      [*] = ;                        gstring_campaign_selcampaignname := campName;
      [*] = ;                        gstring_campaign_selmissionname := misName;
      [*] = ;                     end;
      [*] = ;                  end;
      [*] = ;               end;
      [*] = ;            end;
      [*] = ;         end;
      [*] = ;      end;
      [*] = ;   end;
      [*] = ;end;
      [*] = ;
      [*] = ;var bNeedScroll : Boolean = _gui_SetListBoxHeight(elmList, cCampaignListCount);
      [*] = ;var scrollHnd : Integer = _gui_AddScroller(elmList, gc_halParentRightWidth, gc_valParentTop, 28-4+5, 14+3-2, 0, GetGUIElementHeight(elmListBackground), bNeedScroll);
      [*] = ;
      [*] = ;//if (bScrollToEnd) then
      [*] = ;//SetGUIListBoxTopIndex(elmSessionsList, GetGUIListBoxItemsCount(elmSessionsList)-1)
      [*] = ;//else
      [*] = ;SetGUIListBoxTopIndex(elmList, topIndex);
      [*] = ;_gui_UpdateListBoxScrollerPos(elmList);
      [*] = ;
      [*] = ;elmHnd := _gui_CreateMetalLine('mft_0', elmListBackground, gc_halParentLeft, gc_valParentTop, -4, -4, GetGUIElementWidth(elmListBackground)+8+cScrollWOff, 0, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mft_1', elmListBackground, gc_halParentLeft, gc_valParentTop, -4, -skinHeadOffset-3, GetGUIElementWidth(elmListBackground)+8+cScrollWOff, 0, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfb_0', elmListBackground, gc_halParentLeft, gc_valParentBottom, -4, 1, GetGUIElementWidth(elmListBackground)+8+cScrollWOff, 0, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfl_0', elmListBackground, gc_halParentLeft, gc_valParentTop, -4, -skinHeadOffset-2, 0, GetGUIElementHeight(elmListBackground)+skinHeadOffset+3, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfr_1', elmListBackground, gc_halParentRight, gc_valParentTop, -0, -3, 0, GetGUIElementHeight(elmListBackground)+4, False, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfr_2', elmListBackground, gc_halParentRight, gc_valParentTop, 3+cScrollWOff, -skinHeadOffset-3, 0, GetGUIElementHeight(elmListBackground)+skinHeadOffset+4, True, bupdate);
      [*] = ;
      [*] = ;var stext : String = GetGUIWrappedTextByFont(gUIConst.font[gc_font_serif_12], textDescription, cListWidth-18);
      [*] = ;GetGUIElementFontTextRect(gUIConst.font[gc_font_serif_12], stext, w, h);
      [*] = ;
      [*] = ;var tmpheight : Integer;
      [*] = ;if (gint_campaign_selectedmission<0) then
      [*] = ;tmpheight := 331-7-126
      [*] = ;else
      [*] = ;tmpheight := 331-7;
      [*] = ;var elmDescrScrollLayer : Integer = _gui_CreateScrollLayer('scrolllayer', elmDescriptionBackground, gc_halParentLeft, gc_valParentTop, 0, 3, 0, tmpheight, 0, 0, 0, 0, False, bupdate);
      [*] = ;SetGUIElementCursorByIndex(elmDescrScrollLayer, 1);
      [*] = ;
      [*] = ;var descrtxthnd : Integer = _gui_CreateText('txt', elmDescrScrollLayer, stext, gc_halParentLeft, gc_valParentTop, cPadding+4, cPadding-2, w, h, gc_halLeft, gc_valTop, gc_font_serif_12, color, bupdate);
      [*] = ;bNeedScroll := (h>(GetGUIElementHeight(elmDescriptionBackground)-cPadding+4));
      [*] = ;scrollHnd := _gui_AddScroller(elmDescrScrollLayer, gc_halParentRightWidth, gc_valParentTop, 27, 20, 0, GetGUIElementHeight(elmDescrScrollLayer), bNeedScroll);
      [*] = ;
      [*] = ;SetGUIElementHeight(elmDescrScrollLayer, Max(GetGUIElementHeight(elmDescrScrollLayer)+1, h+7));
      [*] = ;SetGUIAllowEvents(elmDescrScrollLayer, bNeedScroll, False, False); // to let background take event for mouse wheel scroll
      [*] = ;//SetGUIElementLogicHeight(elmDescrScrollLayer, 300);
      [*] = ;//SetGUIElementVisible(scrollHnd, True);
      [*] = ;
      [*] = ;//SetGUIElementAllPositionRect(elmVScroll, 0, 0, 30, 20);
      [*] = ;//const cMaterialScrollerDown = 'scroller.btn.down';
      [*] = ;//SetGUIElementLogicHeight(scrollHnd, GetGUIElementHeight(scrollHnd)+GetGUITextureHeight(cMaterialScrollerDown)-10);
      [*] = ;
      [*] = ;elmHnd := _gui_CreateMetalLine('mft_0_d', elmDescriptionBackground, gc_halParentLeft, gc_valParentTop, -4, -4, GetGUIElementWidth(elmDescriptionBackground)+8+cScrollWOff, 0, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfb_0_d', elmDescriptionBackground, gc_halParentLeft, gc_valParentBottom, -4, 1, GetGUIElementWidth(elmDescriptionBackground)+8+cScrollWOff, 0, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfl_0_d', elmDescriptionBackground, gc_halParentLeft, gc_valParentTop, -4, -3, 0, GetGUIElementHeight(elmDescriptionBackground)+4, True, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfr_1_d', elmDescriptionBackground, gc_halParentRight, gc_valParentTop, -0, -3, 0, GetGUIElementHeight(elmDescriptionBackground)+4, False, bupdate);
      [*] = ;elmHnd := _gui_CreateMetalLine('mfr_2_d', elmDescriptionBackground, gc_halParentRight, gc_valParentTop, 3+cScrollWOff, -3, 0, GetGUIElementHeight(elmDescriptionBackground)+4, True, bupdate);
      [*] = ;
      [*] = ;//ShowButton
      [*] = ;var cTextSelect : String;
      [*] = ;var cTextBack : String;
      [*] = ;_misc_SwitchString(cTextSelect, cTextStartMission, cTextSelectCampaign, bChooseCampaign);
      [*] = ;_misc_SwitchString(cTextBack, cTextBackToCampaign, cTextBackToMainMenu, bChooseCampaign);
      [*] = ;
      [*] = ;const btnwidth = 268;
      [*] = ;var posX : Integer = -floor(btnwidth/2);
      [*] = ;var posY : Integer = -43-22+16;
      [*] = ;
      [*] = ;elmHnd := _gui_CreateButton('bselect', elmParent, 'btn.medium', gc_halParentMiddle, gc_valParentBottomHeight, posX, posY, 0, 0, eventstate, nul, cTagSelect, bupdate);
      [*] = ;_gui_CreateText('txtbtn', elmHnd, cTextSelect, gc_halParentMiddle, gc_valParentMiddle, 0, 0, 0, 0, gc_halLeft, gc_valMiddle, gc_font_serif_15, color, bupdate);
      [*] = ;SetGUIElementStringTag(elmHnd, selMapPath);
      [*] = ;SetGUIElementEnabled(elmHnd, gint_campaign_selectedcampaign>=0);
      [*] = ;
      [*] = ;elmHnd := _gui_CreateButton('bback', elmParent, 'btn.medium', gc_halParentMiddle, gc_valParentBottomHeight, posX+btnwidth, posY, 0, 0, eventstate, nul, cTagBack, bupdate);
      [*] = ;_gui_CreateText('txtbtn', elmHnd, cTextBack, gc_halParentMiddle, gc_valParentMiddle, 0, 0, 0, 0, gc_halLeft, gc_valMiddle, gc_font_serif_15, color, bupdate);
      [*] = ;// body finish
      [*] = ;
      [*] = ;// background
      [*] = ;maxheight := Max(maxheight, _gui_GetBottomPos(elmHnd)+cmargin*7);
      [*] = ;var elmBackground : Integer = _gui_CreateMainWindow('background', elmBackgroundParent, gc_halParentMiddle, gc_valParentMiddle, 0, 0, cwidth, cheight, 1, bupdate);
      [*] = ;SetGUIElementPositionY(elmBackgroundParent, 0);
      [*] = ;_gui_CreateButton('bback', elmBackground, 'btn.close', gc_halParentRightWidth, gc_valParentTop, 4, -4, 0, 0, eventstate, nul, gc_gui_event_tagClose, bupdate);
      [*] = ;
      [*] = ;// head
      [*] = ;elmHnd := GetGUIElementIndexByNameParent('head.head', elmBackground);
      [*] = ;_gui_ConvertHexToTColor('FFDFAF', color);
      [*] = ;elmHnd := _gui_CreateText('thead', elmHnd, cTextCampaignMenu, gc_halParentMiddle, gc_valParentMiddle, 9, 3, 0, 28, gc_halMiddle, gc_valMiddle, gc_font_serif_16, color, bupdate);
      [*] = ;
      [*] = ;SetGUIEventStateOnKeyDown(eventstate);
   struct.end
section.end

