anchor.diff:    BufPtr: Pointer;
     BufferStream: TKMemoryStream;
   begin
  -  {$IFDEF MSWindows}
  +  BufferStream := TKMemoryStream.Create;
  +  {$IFDEF WDC}
     hMem := Clipboard.GetAsHandle(CF_MAPDATA);
     if hMem = 0 then Exit;
     BufPtr := GlobalLock(hMem);
     if BufPtr = nil then Exit;
  -  BufferStream := TKMemoryStream.Create;
     BufferStream.WriteBuffer(BufPtr^, GlobalSize(hMem));
  +  GlobalUnlock(hMem);
  +  {$ENDIF}
  +  {$IFDEF FPC}
  +  if not Clipboard.GetFormat(CF_MAPDATA, BufferStream) then Exit;
  +  {$ENDIF}
     BufferStream.Position := 0;
     BufferStream.Read(Sx);
     BufferStream.Read(Sy);
  
positive.code: 
    if Sx*Sy <> 0 then
    begin
      {$IFDEF MSWindows}
      hMem := GlobalAlloc(GMEM_DDESHARE or GMEM_MOVEABLE, BufferStream.Size);
      BufPtr := GlobalLock(hMem);
      Move(BufferStream.Memory^, BufPtr^, BufferStream.Size);
      Clipboard.SetAsHandle(CF_MAPDATA, hMem);
      GlobalUnlock(hMem);
      {$ENDIF}
    end;
    BufferStream.Free;
  end;
  
negative.code:   for I:=0 to Sy-1 do
      for K:=0 to Sx-1 do
        BufferStream.Read(fSelectionBuffer[I,K], SizeOf(fSelectionBuffer[I,K]));
    BufferStream.Free;
  
  
    //Mapmaker could have changed selection rect, sync it with Buffer size
  