anchor.diff:      376, 377);
   
   
  -{Switch between pages}
  -procedure TKMapEdInterface.SwitchPage(Sender: TObject);
  -begin
  -  //Reset cursor mode
  -  GameCursor.Mode := cmNone;
  -  GameCursor.Tag1 := 0;
  -
  -  //If the user clicks on the tab that is open, it closes it (main buttons only)
  -  if ((Sender = Button_Main[1]) and fGuiTerrain.Visible) or
  -     ((Sender = Button_Main[2]) and fGuiTown.Visible) or
  -     ((Sender = Button_Main[3]) and Panel_Player.Visible) or
  -     ((Sender = Button_Main[4]) and Panel_Mission.Visible) or
  -     ((Sender = Button_Main[5]) and Panel_Menu.Visible) then
  -    Sender := nil;
  -
  -  //Reset shown item if user clicked on any of the main buttons
  -  if (Sender=Button_Main[1])or(Sender=Button_Main[2])or
  -     (Sender=Button_Main[3])or(Sender=Button_Main[4])or
  -     (Sender=Button_Main[5])or
  -     (Sender=Button_Menu_Settings)or(Sender=Button_Menu_Quit) then
  -    MySpectator.Selected := nil;
  -
  -  if (Sender = Button_Main[1]) then
  -  begin
  -    HidePages;
  -    fGuiTerrain.Show;
  -  end
  -  else
  -
  -  if (Sender = Button_Main[2]) then
  -  begin
  -    HidePages;
  -    fGuiTown.Show(ttHouses);
  -  end
  -  else
  -
  -  if (Sender = Button_Main[3])or(Sender = Button_Player[ptGoals]) then
  -    DisplayPage(Panel_Goals)
  -  else
  -  if (Sender = Button_Player[ptColor]) then
  -    DisplayPage(Panel_Color)
  -  else
  -  if (Sender = Button_Player[ptBlockHouse]) then
  -    DisplayPage(Panel_BlockHouse)
  -  else
  -  if (Sender = Button_Player[ptBlockTrade]) then
  -    DisplayPage(Panel_BlockTrade)
  -  else
  -  if (Sender = Button_Player[ptMarkers]) then
  -    DisplayPage(Panel_Markers)
  -  else
  -
  -  if (Sender = Button_Main[4])or(Sender = Button_Mission[1]) then
  -    DisplayPage(Panel_Mode)
  -  else
  -  if (Sender = Button_Mission[2]) then
  -    DisplayPage(Panel_Alliances)
  -  else
  -  if (Sender = Button_Mission[3]) then
  -    DisplayPage(Panel_PlayerTypes)
  -  else
  -
  -  if (Sender = Button_Main[5]) or
  -     (Sender = Button_Quit_No) or
  -     (Sender = Button_LoadCancel) or
  -     (Sender = Button_SaveCancel) then
  -    DisplayPage(Panel_Menu)
  -  else
  -  if Sender = Button_Menu_Quit then
  -    DisplayPage(Panel_Quit)
  -  else
  -  if Sender = Button_Menu_Save then
  -    DisplayPage(Panel_Save)
  -  else
  -  if Sender = Button_Menu_Load then
  -  begin
  -    Menu_LoadUpdate;
  -    DisplayPage(Panel_Load)
  -  end;
  -end;
  -
  -
  -procedure TKMapEdInterface.HidePages;
  -var I,K: Integer;
  -begin
  -  //Hide all existing pages (2 levels)
  -  for I := 0 to Panel_Common.ChildCount - 1 do
  -  if Panel_Common.Childs[I] is TKMPanel then
  -  begin
  -    Panel_Common.Childs[I].Hide;
  -    for K := 0 to TKMPanel(Panel_Common.Childs[I]).ChildCount - 1 do
  -    if TKMPanel(Panel_Common.Childs[I]).Childs[K] is TKMPanel then
  -      TKMPanel(Panel_Common.Childs[I]).Childs[K].Hide;
  -  end;
  -end;
  -
  -
  -procedure TKMapEdInterface.DisplayPage(aPage: TKMPanel);
  -begin
  -  HidePages;
  -
  -  if aPage = Panel_Goals then
  -    Goals_Refresh
  -  else
  -  if aPage = Panel_Color then
  -
  -  else
  -  if aPage = Panel_BlockHouse then
  -    Player_BlockHouseRefresh
  -  else
  -  if aPage = Panel_BlockTrade then
  -    Player_BlockTradeRefresh
  -  else
  -  if aPage = Panel_Markers then
  -    Player_MarkerClick(nil)
  -  else
  -
  -  if aPage = Panel_Mode then
  -    Mission_ModeUpdate
  -  else
  -  if aPage = Panel_Alliances then
  -    Mission_AlliancesChange(nil)
  -  else
  -  if aPage = Panel_PlayerTypes then
  -    Mission_PlayerTypesUpdate
  -  else
  -
  -  if aPage = Panel_Menu then
  -  else
  -  if aPage = Panel_Save then
  -  begin
  -    Edit_SaveName.Text := fGame.GameName;
  -    Menu_SaveClick(Edit_SaveName);
  -  end else
  -  if aPage = Panel_Load then
  -    Panel_Load.Show;
  -
  -  //Display the panel (and its parents)
  -  fActivePage := aPage;
  -  if aPage <> nil then
  -    aPage.Show;
  -
  -  //Update list of visible layers with regard to active page and checkboxes
  -  Layers_UpdateVisibility;
  -end;
  -
  -
  -procedure TKMapEdInterface.DisplayHint(Sender: TObject);
  -begin
  -  if (fPrevHint = Sender) then exit; //Hint didn't changed
  -
  -  if (Sender = nil) or (TKMControl(Sender).Hint = '') then
  -  begin
  -    Label_Hint.Caption := '';
  -    Bevel_HintBG.Hide;
  -  end
  -  else
  -  begin
  -    Label_Hint.Caption := TKMControl(Sender).Hint;
  -    Bevel_HintBG.Show;
  -    Bevel_HintBG.Width := 8 + fResource.Fonts.GetTextSize(Label_Hint.Caption, Label_Hint.Font).X;
  -  end;
  -
  -  fPrevHint := Sender;
  -end;
  -
  -
  -//Update viewport position when user interacts with minimap
  -procedure TKMapEdInterface.Minimap_Update(Sender: TObject; const X,Y: Integer);
  -begin
  -  fGame.Viewport.Position := KMPointF(X,Y);
  -end;
  -
  -
  +{ TKMapEdInterface }
   constructor TKMapEdInterface.Create(aScreenX, aScreenY: Word);
   var
     I: Integer;
  
positive.code: end;
  
  
  procedure TKMapEdInterface.Mission_AlliancesChange(Sender: TObject);
  var I,K: Integer;
  begin
  
negative.code:   SHOW_TERRAIN_WIRES := false; //Don't show it in-game if they left it on in MapEd
    SHOW_TERRAIN_PASS := 0; //Don't show it in-game if they left it on in MapEd
    inherited;
  end;
  
  
  {Switch between pages}
  procedure TKMapEdInterface.SwitchPage(Sender: TObject);
  begin
    //Reset cursor mode
    GameCursor.Mode := cmNone;
    GameCursor.Tag1 := 0;
  
    //If the user clicks on the tab that is open, it closes it (main buttons only)
    if ((Sender = Button_Main[1]) and fGuiTerrain.Visible) or
       ((Sender = Button_Main[2]) and fGuiTown.Visible) or
       ((Sender = Button_Main[3]) and Panel_Player.Visible) or
       ((Sender = Button_Main[4]) and Panel_Mission.Visible) or
       ((Sender = Button_Main[5]) and Panel_Menu.Visible) then
      Sender := nil;
  
    //Reset shown item if user clicked on any of the main buttons
    if (Sender=Button_Main[1])or(Sender=Button_Main[2])or
       (Sender=Button_Main[3])or(Sender=Button_Main[4])or
       (Sender=Button_Main[5])or
       (Sender=Button_Menu_Settings)or(Sender=Button_Menu_Quit) then
      MySpectator.Selected := nil;
  
    if (Sender = Button_Main[1]) then
    begin
      HidePages;
      fGuiTerrain.Show;
    end
    else
  
    if (Sender = Button_Main[2]) then
    begin
      HidePages;
      fGuiTown.Show(ttHouses);
    end
    else
  
    if (Sender = Button_Main[3])or(Sender = Button_Player[ptGoals]) then
      DisplayPage(Panel_Goals)
    else
    if (Sender = Button_Player[ptColor]) then
      DisplayPage(Panel_Color)
    else
    if (Sender = Button_Player[ptBlockHouse]) then
      DisplayPage(Panel_BlockHouse)
    else
    if (Sender = Button_Player[ptBlockTrade]) then
      DisplayPage(Panel_BlockTrade)
    else
    if (Sender = Button_Player[ptMarkers]) then
      DisplayPage(Panel_Markers)
    else
  
    if (Sender = Button_Main[4])or(Sender = Button_Mission[1]) then
      DisplayPage(Panel_Mode)
    else
    if (Sender = Button_Mission[2]) then
      DisplayPage(Panel_Alliances)
    else
    if (Sender = Button_Mission[3]) then
      DisplayPage(Panel_PlayerTypes)
    else
  
    if (Sender = Button_Main[5]) or
       (Sender = Button_Quit_No) or
       (Sender = Button_LoadCancel) or
       (Sender = Button_SaveCancel) then
      DisplayPage(Panel_Menu)
    else
    if Sender = Button_Menu_Quit then
      DisplayPage(Panel_Quit)
    else
    if Sender = Button_Menu_Save then
      DisplayPage(Panel_Save)
    else
    if Sender = Button_Menu_Load then
    begin
      Menu_LoadUpdate;
      DisplayPage(Panel_Load)
    end;
  end;
  
  
  procedure TKMapEdInterface.HidePages;
  var I,K: Integer;
  begin
    //Hide all existing pages (2 levels)
    for I := 0 to Panel_Common.ChildCount - 1 do
    if Panel_Common.Childs[I] is TKMPanel then
    begin
      Panel_Common.Childs[I].Hide;
      for K := 0 to TKMPanel(Panel_Common.Childs[I]).ChildCount - 1 do
      if TKMPanel(Panel_Common.Childs[I]).Childs[K] is TKMPanel then
        TKMPanel(Panel_Common.Childs[I]).Childs[K].Hide;
    end;
  end;
  
  
  procedure TKMapEdInterface.DisplayPage(aPage: TKMPanel);
  begin
    HidePages;
  
    if aPage = Panel_Goals then
      Goals_Refresh
    else
    if aPage = Panel_Color then
  
    else
    if aPage = Panel_BlockHouse then
      Player_BlockHouseRefresh
    else
    if aPage = Panel_BlockTrade then
      Player_BlockTradeRefresh
    else
    if aPage = Panel_Markers then
      Player_MarkerClick(nil)
    else
  
    if aPage = Panel_Mode then
      Mission_ModeUpdate
    else
    if aPage = Panel_Alliances then
      Mission_AlliancesChange(nil)
    else
    if aPage = Panel_PlayerTypes then
      Mission_PlayerTypesUpdate
    else
  
    if aPage = Panel_Menu then
    else
    if aPage = Panel_Save then
    begin
      Edit_SaveName.Text := fGame.GameName;
      Menu_SaveClick(Edit_SaveName);
    end else
    if aPage = Panel_Load then
      Panel_Load.Show;
  
    //Display the panel (and its parents)
    fActivePage := aPage;
    if aPage <> nil then
      aPage.Show;
  
    //Update list of visible layers with regard to active page and checkboxes
    Layers_UpdateVisibility;
  end;
  
  
  procedure TKMapEdInterface.DisplayHint(Sender: TObject);
  begin
    if (fPrevHint = Sender) then exit; //Hint didn't changed
  
    if (Sender = nil) or (TKMControl(Sender).Hint = '') then
    begin
      Label_Hint.Caption := '';
      Bevel_HintBG.Hide;
    end
    else
    begin
      Label_Hint.Caption := TKMControl(Sender).Hint;
      Bevel_HintBG.Show;
      Bevel_HintBG.Width := 8 + fResource.Fonts.GetTextSize(Label_Hint.Caption, Label_Hint.Font).X;
    end;
  
    fPrevHint := Sender;
  end;
  
  
  