Changeset 291


Ignore:
Timestamp:
Mar 2, 2021, 10:16:54 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Allow to redefine all action keys.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r290 r291  
    64386438    MapValid := false;
    64396439    PaintAllMaps;
    6440   end
     6440  end;
    64416441end;
    64426442
     
    64606460  mStay.ShortCut := BStay.ShortCut;
    64616461  mNoOrders.ShortCut := BNoOrders.ShortCut;
     6462  mCancel.ShortCut := BCancel.ShortCut;
     6463  mPillage.ShortCut := BPillage.ShortCut;
    64626464  mTechTree.ShortCut := BTechTree.ShortCut;
    64636465  mWait.ShortCut := BWait.ShortCut;
    64646466  mJump.ShortCut := BJump.ShortCut;;
     6467  mDebugMap.ShortCut := BDebugMap.ShortCut;
     6468  mLocCodes.ShortCut := BLocCodes.ShortCut;
     6469  mNames.ShortCut := BNames.ShortCut;
     6470  mRun.ShortCut := BRun.ShortCut;
     6471  mAirBase.ShortCut := BAirBase.ShortCut;
     6472  mCity.ShortCut := BBuildCity.ShortCut;
     6473  mEnhance.ShortCut := BEnhance.ShortCut;
     6474  mGoOn.ShortCut := BGoOn.ShortCut;
     6475  mHome.ShortCut := BHome.ShortCut;
     6476  mFarm.ShortCut := BFarmClearIrrigation.ShortCut;
     6477  mClear.ShortCut := BFarmClearIrrigation.ShortCut;
     6478  mIrrigation.ShortCut := BFarmClearIrrigation.ShortCut;
     6479  mLoad.ShortCut := BLoad.ShortCut;
     6480  mAfforest.ShortCut := BAfforestMine.ShortCut;
     6481  mMine.ShortCut := BAfforestMine.ShortCut;
     6482  mCanal.ShortCut := BCanal.ShortCut;
     6483  MTrans.ShortCut := BTrans.ShortCut;
     6484  mPollution.ShortCut := BPollution.ShortCut;
     6485  mRR.ShortCut := BRailRoad.ShortCut;
     6486  mRoad.ShortCut := BRailRoad.ShortCut;
     6487  mUnload.ShortCut := BUnload.ShortCut;
     6488  mRecover.ShortCut := BRecover.ShortCut;
     6489  mUtilize.ShortCut := BUtilize.ShortCut;
    64656490end;
    64666491
     
    64756500  end;
    64766501
     6502  procedure SetViewpointMe(p: Integer);
     6503  begin
     6504    if p = me then SetViewpoint(p)
     6505      else SetViewpoint(p);
     6506  end;
     6507
     6508  procedure DoMoveUnit(X, Y: Integer);
     6509  begin
     6510    DestinationMarkON := False;
     6511    PaintDestination;
     6512    MyUn[UnFocus].Status := MyUn[UnFocus].Status and
     6513      ($FFFF - usStay - usRecover - usGoto - usEnhance) or usWaiting;
     6514    MoveUnit(X, Y, muAutoNext);
     6515  end;
     6516
    64776517var
    6478   dx, dy: integer;
    6479   time0, time1: TDateTime;
     6518  Time0, Time1: TDateTime;
    64806519  ShortCut: TShortCut;
    64816520begin
    64826521  ShortCut := KeyToShortCut(Key, Shift);
    64836522
    6484   if GameMode = cMovie then
    6485   begin
    6486     case Key of
    6487       VK_F4: MenuClick_Check(StatPopup, mScienceStat);
    6488       VK_F6: MenuClick_Check(StatPopup, mDiagram);
    6489       VK_F7: MenuClick_Check(StatPopup, mWonders);
    6490       VK_F8: MenuClick_Check(StatPopup, mShips);
    6491     end;
    6492     exit;
    6493   end;
    6494 
    6495   if not idle then exit;
     6523  if GameMode = cMovie then begin
     6524    if BScienceStat.Test(ShortCut) then MenuClick_Check(StatPopup, mScienceStat)
     6525    else if BDiagram.Test(ShortCut) then MenuClick_Check(StatPopup, mDiagram)
     6526    else if BWonders.Test(ShortCut) then MenuClick_Check(StatPopup, mWonders)
     6527    else if BShips.Test(ShortCut) then MenuClick_Check(StatPopup, mShips);
     6528    Exit;
     6529  end;
     6530
     6531  if not Idle then Exit;
    64966532
    64976533  if ClientMode = cEditMap then begin
    6498     if ShortCut = BResign.ShortCut then MenuClick(mResign)
    6499     else if ShortCut = BRandomMap.ShortCut then MenuClick(mRandomMap)
    6500     else if ShortCut = BHelp.ShortCut then MenuClick(mHelp);
     6534    if BResign.Test(ShortCut) then MenuClick(mResign)
     6535    else if BRandomMap.Test(ShortCut) then MenuClick(mRandomMap)
     6536    else if BHelp.Test(ShortCut) then MenuClick(mHelp);
    65016537    (*if Shift = [ssCtrl] then
    65026538      case char(Key) of
     
    65166552      end;
    65176553    *)
    6518 
    65196554    Exit;
    65206555  end;
    65216556
    6522   if ShortCut = BEndTurn.ShortCut then EndTurn
    6523   else if ShortCut = BHelp.ShortCut then MenuClick(mHelp)
    6524   else if ShortCut = BUnitStat.ShortCut then MenuClick_Check(StatPopup, mUnitStat)
    6525   else if ShortCut = BCityStat.ShortCut then MenuClick_Check(StatPopup, mCityStat)
    6526   else if ShortCut = BScienceStat.ShortCut then MenuClick_Check(StatPopup, mScienceStat)
    6527   else if ShortCut = BEUnitStat.ShortCut then MenuClick_Check(StatPopup, mEUnitStat)
    6528   else if ShortCut = BDiagram.ShortCut then MenuClick_Check(StatPopup, mDiagram)
    6529   else if ShortCut = BWonders.ShortCut then MenuClick_Check(StatPopup, mWonders)
    6530   else if ShortCut = BShips.ShortCut then MenuClick_Check(StatPopup, mShips)
    6531   else if ShortCut = BNations.ShortCut then MenuClick_Check(StatPopup, mNations)
    6532   else if ShortCut = BEmpire.ShortCut then MenuClick_Check(StatPopup, mEmpire);
    6533 
    6534   if Shift = [ssAlt] then begin
    6535     case char(Key) of
    6536       '0': SetDebugMap(-1);
    6537       '1'..'9': SetDebugMap(ord(Key) - 48);
     6557  if BEndTurn.Test(ShortCut) then EndTurn
     6558  else if BHelp.Test(ShortCut) then MenuClick(mHelp)
     6559  else if BUnitStat.Test(ShortCut) then MenuClick_Check(StatPopup, mUnitStat)
     6560  else if BCityStat.Test(ShortCut) then MenuClick_Check(StatPopup, mCityStat)
     6561  else if BScienceStat.Test(ShortCut) then MenuClick_Check(StatPopup, mScienceStat)
     6562  else if BEUnitStat.Test(ShortCut) then MenuClick_Check(StatPopup, mEUnitStat)
     6563  else if BDiagram.Test(ShortCut) then MenuClick_Check(StatPopup, mDiagram)
     6564  else if BWonders.Test(ShortCut) then MenuClick_Check(StatPopup, mWonders)
     6565  else if BShips.Test(ShortCut) then MenuClick_Check(StatPopup, mShips)
     6566  else if BNations.Test(ShortCut) then MenuClick_Check(StatPopup, mNations)
     6567  else if BEmpire.Test(ShortCut) then MenuClick_Check(StatPopup, mEmpire)
     6568
     6569  else if BSetDebugMap0.Test(ShortCut) then SetDebugMap(-1)
     6570  else if BSetDebugMap1.Test(ShortCut) then SetDebugMap(1)
     6571  else if BSetDebugMap2.Test(ShortCut) then SetDebugMap(2)
     6572  else if BSetDebugMap3.Test(ShortCut) then SetDebugMap(3)
     6573  else if BSetDebugMap4.Test(ShortCut) then SetDebugMap(4)
     6574  else if BSetDebugMap5.Test(ShortCut) then SetDebugMap(5)
     6575  else if BSetDebugMap6.Test(ShortCut) then SetDebugMap(6)
     6576  else if BSetDebugMap7.Test(ShortCut) then SetDebugMap(7)
     6577  else if BSetDebugMap8.Test(ShortCut) then SetDebugMap(8)
     6578  else if BSetDebugMap9.Test(ShortCut) then SetDebugMap(9)
     6579
     6580  else if BJump.Test(ShortCut) then MenuClick(mJump)
     6581  else if BDebugMap.Test(ShortCut) then mShowClick(mDebugMap)
     6582  else if BLocCodes.Test(ShortCut) then mShowClick(mLocCodes)
     6583  else if BLogDlg.Test(ShortCut) then begin
     6584    if LogDlg.Visible then LogDlg.Close
     6585      else LogDlg.Show;
     6586  end
     6587  else if BNames.Test(ShortCut) then mNamesClick(mNames)
     6588  else if BResign.Test(ShortCut) then MenuClick_Check(GamePopup, mResign)
     6589  else if BRun.Test(ShortCut) then MenuClick(mRun)
     6590  else if BTestMapRepaint.Test(ShortCut) then begin // test map repaint time
     6591    Time0 := NowPrecise;
     6592    MapValid := False;
     6593    MainOffscreenPaint;
     6594    Time1 := NowPrecise;
     6595    SimpleMessage(Format('Map repaint time: %.3f ms',
     6596      [(Time1 - Time0) / OneMillisecond]));
     6597  end
     6598  else if BSetViewpoint0.Test(ShortCut) then SetViewpointMe(0)
     6599  else if BSetViewpoint1.Test(ShortCut) then SetViewpointMe(1)
     6600  else if BSetViewpoint2.Test(ShortCut) then SetViewpointMe(2)
     6601  else if BSetViewpoint3.Test(ShortCut) then SetViewpointMe(3)
     6602  else if BSetViewpoint4.Test(ShortCut) then SetViewpointMe(4)
     6603  else if BSetViewpoint5.Test(ShortCut) then SetViewpointMe(5)
     6604  else if BSetViewpoint6.Test(ShortCut) then SetViewpointMe(6)
     6605  else if BSetViewpoint7.Test(ShortCut) then SetViewpointMe(7)
     6606  else if BSetViewpoint8.Test(ShortCut) then SetViewpointMe(8)
     6607  else if BSetViewpoint9.Test(ShortCut) then SetViewpointMe(9)
     6608
     6609  else if BMapBtn0.Test(ShortCut) then MapBtnClick(MapBtn0)
     6610  else if BMapBtn1.Test(ShortCut) then MapBtnClick(MapBtn1)
     6611  else if BMapBtn4.Test(ShortCut) then MapBtnClick(MapBtn4)
     6612  else if BMapBtn5.Test(ShortCut) then MapBtnClick(MapBtn5)
     6613  else if BMapBtn6.Test(ShortCut) then MapBtnClick(MapBtn6)
     6614  else if BTechTree.Test(ShortCut) then MenuClick(mTechTree)
     6615  else if BWait.Test(ShortCut) then MenuClick(mWait);
     6616
     6617  if UnFocus >= 0 then begin
     6618    if BDisbandUnit.Test(ShortCut) then MenuClick(mDisband)
     6619    else if BFortify.Test(ShortCut) then MenuClick_Check(TerrainPopup, mFort)
     6620    else if BCenterUnit.Test(ShortCut) then MenuClick(mCentre)
     6621    else if BStay.Test(ShortCut) then MenuClick(mStay)
     6622    else if BNoOrders.Test(ShortCut) then MenuClick(mNoOrders)
     6623    else if BCancel.Test(ShortCut) then MenuClick_Check(UnitPopup, mCancel)
     6624    else if BPillage.Test(ShortCut) then MenuClick_Check(UnitPopup, mPillage)
     6625    else if BSelectTransport.Test(ShortCut) then MenuClick_Check(UnitPopup, mSelectTransport)
     6626    else if BAirBase.Test(ShortCut) then MenuClick_Check(TerrainPopup, mAirBase)
     6627    else if BBuildCity.Test(ShortCut) then MenuClick_Check(UnitPopup, mCity)
     6628    else if BEnhance.Test(ShortCut) then begin
     6629      InitPopup(TerrainPopup);
     6630      if mEnhance.Visible and mEnhance.Enabled then MenuClick(mEnhance)
     6631        else MenuClick(mEnhanceDef)
    65386632    end
    6539   end else if Shift = [ssCtrl] then begin
    6540     if ShortCut = BJump.ShortCut then MenuClick(mJump);
    6541     case char(Key) of
    6542       'K': mShowClick(mDebugMap);
    6543       'L': mShowClick(mLocCodes);
    6544       'M': if LogDlg.Visible then LogDlg.Close
    6545         else LogDlg.Show;
    6546       'N': mNamesClick(mNames);
    6547       'Q': MenuClick_Check(GamePopup, mResign);
    6548       'R': MenuClick(mRun);
    6549       '0'..'9': begin
    6550           if ord(Key) - 48 = me then SetViewpoint(0)
    6551             else SetViewpoint(ord(Key) - 48);
    6552         end;
    6553       ' ': begin // test map repaint time
    6554           time0 := NowPrecise;
    6555           MapValid := false;
    6556           MainOffscreenPaint;
    6557           time1 := NowPrecise;
    6558           SimpleMessage(Format('Map repaint time: %.3f ms',
    6559             [(time1 - time0) / OneMillisecond]));
    6560         end;
     6633    else if BGoOn.Test(ShortCut) then MenuClick_Check(UnitPopup, mGoOn)
     6634    else if BHome.Test(ShortCut) then MenuClick_Check(UnitPopup, mHome)
     6635    else if BFarmClearIrrigation.Test(ShortCut) then begin
     6636      if JobTest(UnFocus, jFarm, [eTreaty]) then
     6637        MenuClick(mFarm)
     6638      else if JobTest(UnFocus, jClear, [eTreaty]) then
     6639        MenuClick(mClear)
     6640      else MenuClick_Check(TerrainPopup, mIrrigation);
    65616641    end
    6562   end else if Shift = [] then begin
    6563     case char(Key) of
    6564       '1': MapBtnClick(MapBtn0);
    6565       '2': MapBtnClick(MapBtn1);
    6566       '3': MapBtnClick(MapBtn4);
    6567       '4': MapBtnClick(MapBtn5);
    6568       '5': MapBtnClick(MapBtn6);
    6569     end;
    6570     if ShortCut = BTechTree.ShortCut then MenuClick(mTechTree)
    6571     else if ShortCut = BWait.ShortCut then MenuClick(mWait);
    6572   end;
    6573 
    6574   if UnFocus >= 0 then begin
    6575     if ShortCut = BDisbandUnit.ShortCut then MenuClick(mDisband)
    6576     else if ShortCut = BFortify.ShortCut then MenuClick_Check(TerrainPopup, mFort)
    6577     else if ShortCut = BCenterUnit.ShortCut then MenuClick(mCentre)
    6578     else if ShortCut = BStay.ShortCut then MenuClick(mStay)
    6579     else if ShortCut = BNoOrders.ShortCut then MenuClick(mNoOrders);
    6580 
    6581     if Shift = [ssCtrl] then begin
    6582       case char(Key) of
    6583         'C': MenuClick_Check(UnitPopup, mCancel);
    6584         'P': MenuClick_Check(UnitPopup, mPillage);
    6585         'T': MenuClick_Check(UnitPopup, mSelectTransport);
    6586       end;
    6587     end else if Shift = [] then begin
    6588       case char(Key) of
    6589         'A': MenuClick_Check(TerrainPopup, mAirBase);
    6590         'B': MenuClick_Check(UnitPopup, mCity);
    6591         'E': begin
    6592             InitPopup(TerrainPopup);
    6593             if mEnhance.Visible and mEnhance.Enabled then
    6594               MenuClick(mEnhance)
    6595             else MenuClick(mEnhanceDef)
    6596           end;
    6597         'G': MenuClick_Check(UnitPopup, mGoOn);
    6598         'H': MenuClick_Check(UnitPopup, mHome);
    6599         'I': if JobTest(UnFocus, jFarm, [eTreaty]) then
    6600             MenuClick(mFarm)
    6601           else if JobTest(UnFocus, jClear, [eTreaty]) then
    6602             MenuClick(mClear)
    6603           else MenuClick_Check(TerrainPopup, mIrrigation);
    6604         'L': MenuClick_Check(UnitPopup, mLoad);
    6605         'M': if JobTest(UnFocus, jAfforest, [eTreaty]) then
    6606             MenuClick(mAfforest)
    6607           else MenuClick_Check(TerrainPopup, mMine);
    6608         'N': MenuClick_Check(TerrainPopup, mCanal);
    6609         'O': MenuClick_Check(TerrainPopup, MTrans);
    6610         'P': MenuClick_Check(TerrainPopup, mPollution);
    6611         'R': if JobTest(UnFocus, jRR, [eTreaty]) then
    6612             MenuClick(mRR)
    6613           else MenuClick_Check(TerrainPopup, mRoad);
    6614         'U': MenuClick_Check(UnitPopup, mUnload);
    6615         'V': MenuClick_Check(UnitPopup, mRecover);
    6616         'Z': MenuClick_Check(UnitPopup, mUtilize);
    6617         #33 .. #40, #97 .. #100, #102 .. #105:
    6618           begin { arrow keys }
    6619             DestinationMarkON := false;
    6620             PaintDestination;
    6621             MyUn[UnFocus].Status := MyUn[UnFocus].Status and
    6622               ($FFFF - usStay - usRecover - usGoto - usEnhance) or usWaiting;
    6623             case Key of
    6624               VK_NUMPAD1, VK_END:
    6625                 begin
    6626                   dx := -1;
    6627                   dy := 1
    6628                 end;
    6629               VK_NUMPAD2, VK_DOWN:
    6630                 begin
    6631                   dx := 0;
    6632                   dy := 2
    6633                 end;
    6634               VK_NUMPAD3, VK_NEXT:
    6635                 begin
    6636                   dx := 1;
    6637                   dy := 1
    6638                 end;
    6639               VK_NUMPAD4, VK_LEFT:
    6640                 begin
    6641                   dx := -2;
    6642                   dy := 0
    6643                 end;
    6644               VK_NUMPAD6, VK_RIGHT:
    6645                 begin
    6646                   dx := 2;
    6647                   dy := 0
    6648                 end;
    6649               VK_NUMPAD7, VK_HOME:
    6650                 begin
    6651                   dx := -1;
    6652                   dy := -1
    6653                 end;
    6654               VK_NUMPAD8, VK_UP:
    6655                 begin
    6656                   dx := 0;
    6657                   dy := -2
    6658                 end;
    6659               VK_NUMPAD9, VK_PRIOR:
    6660                 begin
    6661                   dx := 1;
    6662                   dy := -1
    6663                 end;
    6664             end;
    6665             MoveUnit(dx, dy, muAutoNext)
    6666           end;
    6667       end;
    6668     end;
     6642    else if BLoad.Test(ShortCut) then MenuClick_Check(UnitPopup, mLoad)
     6643    else if BAfforestMine.Test(ShortCut) then begin
     6644      if JobTest(UnFocus, jAfforest, [eTreaty]) then MenuClick(mAfforest)
     6645        else MenuClick_Check(TerrainPopup, mMine);
     6646    end
     6647    else if BCanal.Test(ShortCut) then MenuClick_Check(TerrainPopup, mCanal)
     6648    else if BTrans.Test(ShortCut) then MenuClick_Check(TerrainPopup, MTrans)
     6649    else if BPollution.Test(ShortCut) then MenuClick_Check(TerrainPopup, mPollution)
     6650    else if BRailRoad.Test(ShortCut) then begin
     6651      if JobTest(UnFocus, jRR, [eTreaty]) then MenuClick(mRR)
     6652        else MenuClick_Check(TerrainPopup, mRoad);
     6653    end
     6654    else if BUnload.Test(ShortCut) then MenuClick_Check(UnitPopup, mUnload)
     6655    else if BRecover.Test(ShortCut) then MenuClick_Check(UnitPopup, mRecover)
     6656    else if BUtilize.Test(ShortCut) then MenuClick_Check(UnitPopup, mUtilize)
     6657    else if BMoveLeftDown.Test(ShortCut) then DoMoveUnit(-1, 1)
     6658    else if BMoveDown.Test(ShortCut) then DoMoveUnit(0, 2)
     6659    else if BMoveRightDown.Test(ShortCut) then DoMoveUnit(1, 1)
     6660    else if BMoveLeft.Test(ShortCut) then DoMoveUnit(-2, 0)
     6661    else if BMoveRight.Test(ShortCut) then DoMoveUnit(2, 0)
     6662    else if BMoveLeftUp.Test(ShortCut) then DoMoveUnit(-1, -1)
     6663    else if BMoveUp.Test(ShortCut) then  DoMoveUnit(0, -2)
     6664    else if BMoveRightUp.Test(ShortCut) then DoMoveUnit(1, -1);
    66696665  end;
    66706666end;
  • trunk/UKeyBindings.pas

    r290 r291  
    99
    1010type
     11
     12  { TKeyBinding }
     13
    1114  TKeyBinding = class
    1215    ShortName: string;
    1316    FullName: string;
    1417    ShortCut: TShortCut;
     18    ShortCut2: TShortCut;
     19    function Test(AShortCut: TShortCut): Boolean;
    1520  end;
    1621
     
    1823
    1924  TKeyBindings = class(TFPGObjectList<TKeyBinding>)
    20     function AddItem(const ShortName, FullName: string; ShortCut: TShortCut): TKeyBinding; overload;
    21     function AddItem(const ShortName, FullName: string; ShortCutText: string): TKeyBinding; overload;
     25    function AddItem(const ShortName, FullName: string; ShortCut: TShortCut; ShortCut2: TShortCut = 0): TKeyBinding; overload;
     26    function AddItem(const ShortName, FullName: string; ShortCutText: string; ShortCutText2: string = ''): TKeyBinding; overload;
    2227    function Search(ShortName: string): TKeyBinding;
    2328    procedure LoadFromFile(FileName: string);
     
    4550  BStay: TKeyBinding;
    4651  BNoOrders: TKeyBinding;
     52  BCancel: TKeyBinding;
     53  BPillage: TKeyBinding;
     54  BSelectTransport: TKeyBinding;
    4755  BTechTree: TKeyBinding;
    4856  BWait: TKeyBinding;
    4957  BJump: TKeyBinding;
     58  BMapBtn0: TKeyBinding;
     59  BMapBtn1: TKeyBinding;
     60  BMapBtn4: TKeyBinding;
     61  BMapBtn5: TKeyBinding;
     62  BMapBtn6: TKeyBinding;
     63  BSetDebugMap0: TKeyBinding;
     64  BSetDebugMap1: TKeyBinding;
     65  BSetDebugMap2: TKeyBinding;
     66  BSetDebugMap3: TKeyBinding;
     67  BSetDebugMap4: TKeyBinding;
     68  BSetDebugMap5: TKeyBinding;
     69  BSetDebugMap6: TKeyBinding;
     70  BSetDebugMap7: TKeyBinding;
     71  BSetDebugMap8: TKeyBinding;
     72  BSetDebugMap9: TKeyBinding;
     73  BDebugMap: TKeyBinding;
     74  BLocCodes: TKeyBinding;
     75  BLogDlg: TKeyBinding;
     76  BNames: TKeyBinding;
     77  BRun: TKeyBinding;
     78  BTestMapRepaint: TKeyBinding;
     79  BSetViewpoint0: TKeyBinding;
     80  BSetViewpoint1: TKeyBinding;
     81  BSetViewpoint2: TKeyBinding;
     82  BSetViewpoint3: TKeyBinding;
     83  BSetViewpoint4: TKeyBinding;
     84  BSetViewpoint5: TKeyBinding;
     85  BSetViewpoint6: TKeyBinding;
     86  BSetViewpoint7: TKeyBinding;
     87  BSetViewpoint8: TKeyBinding;
     88  BSetViewpoint9: TKeyBinding;
     89  BAirBase: TKeyBinding;
     90  BBuildCity: TKeyBinding;
     91  BEnhance: TKeyBinding;
     92  BGoOn: TKeyBinding;
     93  BHome: TKeyBinding;
     94  BFarmClearIrrigation: TKeyBinding;
     95  BLoad: TKeyBinding;
     96  BAfforestMine: TKeyBinding;
     97  BCanal: TKeyBinding;
     98  BTrans: TKeyBinding;
     99  BPollution: TKeyBinding;
     100  BRailRoad: TKeyBinding;
     101  BUnload: TKeyBinding;
     102  BRecover: TKeyBinding;
     103  BUtilize: TKeyBinding;
     104  BMoveLeftDown: TKeyBinding;
     105  BMoveDown: TKeyBinding;
     106  BMoveRightDown: TKeyBinding;
     107  BMoveRight: TKeyBinding;
     108  BMoveRightUp: TKeyBinding;
     109  BMoveUp: TKeyBinding;
     110  BMoveLeftUp: TKeyBinding;
     111  BMoveLeft: TKeyBinding;
    50112
    51113
    52114implementation
    53115
     116{ TKeyBinding }
     117
     118function TKeyBinding.Test(AShortCut: TShortCut): Boolean;
     119begin
     120  Result := (AShortCut = ShortCut) or (AShortCut = ShortCut2);
     121end;
     122
    54123{ TKeyBindings }
    55124
    56 function TKeyBindings.AddItem(const ShortName, FullName: string; ShortCut: TShortCut
    57   ): TKeyBinding;
     125function TKeyBindings.AddItem(const ShortName, FullName: string; ShortCut: TShortCut;
     126  ShortCut2: TShortCut = 0): TKeyBinding;
    58127begin
    59128  Result := TKeyBinding.Create;
     
    61130  Result.FullName := FullName;
    62131  Result.ShortCut := ShortCut;
     132  Result.ShortCut2 := ShortCut2;
    63133  Add(Result);
    64134end;
    65135
    66136function TKeyBindings.AddItem(const ShortName, FullName: string;
    67   ShortCutText: string): TKeyBinding;
    68 begin
    69   Result := AddItem(ShortName, FullName, TextToShortCut(ShortCutText));
     137  ShortCutText: string; ShortCutText2: string = ''): TKeyBinding;
     138begin
     139  Result := AddItem(ShortName, FullName, TextToShortCut(ShortCutText),
     140    TextToShortCut(ShortCutText2));
    70141end;
    71142
     
    141212  BStay := AddItem('Stay', 'Stay', 'S');
    142213  BNoOrders := AddItem('NoOrders', 'No orders', 'Space');
     214  BCancel := AddItem('Cancel', 'Cancel', 'Ctrl+C');
     215  BPillage := AddItem('Pillage', 'Pillage', 'Ctrl+P');
     216  BSelectTransport := AddItem('SelectTransport', 'Select transport', 'Ctrl+T');
    143217  BTechTree := AddItem('TechTree', 'Tech tree', 'T');
    144218  BWait := AddItem('Wait', 'Wait', 'W');
    145219  BJump := AddItem('Jump', 'Jump 20 turns', 'Ctrl+J');
     220  BMapBtn0 := AddItem('MapButton1', 'Map button 1', '1');
     221  BMapBtn1 := AddItem('MapButton2', 'Map button 2', '2');
     222  BMapBtn4 := AddItem('MapButton3', 'Map button 3', '3');
     223  BMapBtn5 := AddItem('MapButton4', 'Map button 4', '4');
     224  BMapBtn6 := AddItem('MapButton5', 'Map button 5', '5');
     225  BSetDebugMap0 := AddItem('SetDebugMap0', 'Set debug map 0', '0');
     226  BSetDebugMap1 := AddItem('SetDebugMap1', 'Set debug map 1', '1');
     227  BSetDebugMap2 := AddItem('SetDebugMap2', 'Set debug map 2', '2');
     228  BSetDebugMap3 := AddItem('SetDebugMap3', 'Set debug map 3', '3');
     229  BSetDebugMap4 := AddItem('SetDebugMap4', 'Set debug map 4', '4');
     230  BSetDebugMap5 := AddItem('SetDebugMap5', 'Set debug map 5', '5');
     231  BSetDebugMap6 := AddItem('SetDebugMap6', 'Set debug map 6', '6');
     232  BSetDebugMap7 := AddItem('SetDebugMap7', 'Set debug map 7', '7');
     233  BSetDebugMap8 := AddItem('SetDebugMap8', 'Set debug map 8', '8');
     234  BSetDebugMap9 := AddItem('SetDebugMap9', 'Set debug map 9', '9');
     235  BDebugMap := AddItem('DebugMap', 'Debug map', 'Ctrl+K');
     236  BLocCodes := AddItem('LocCodes', 'Location codes', 'Ctrl+L');
     237  BLogDlg := AddItem('LogDlg', 'Log dialog', 'Ctrl+M');
     238  BNames := AddItem('ShowNames', 'Show names', 'Ctrl+N');
     239  BRun := AddItem('Run', 'Run', 'Ctrl+R');
     240  BTestMapRepaint := AddItem('TestMapRepaint', 'Test map reapaint', 'Ctrl+Space');
     241  BSetViewpoint0 := AddItem('SetViewpoint0', 'Set viewpoint 0', 'Ctrl+0');
     242  BSetViewpoint1 := AddItem('SetViewpoint1', 'Set viewpoint 1', 'Ctrl+1');
     243  BSetViewpoint2 := AddItem('SetViewpoint2', 'Set viewpoint 2', 'Ctrl+2');
     244  BSetViewpoint3 := AddItem('SetViewpoint3', 'Set viewpoint 3', 'Ctrl+3');
     245  BSetViewpoint4 := AddItem('SetViewpoint4', 'Set viewpoint', 'Ctrl+4');
     246  BSetViewpoint5 := AddItem('SetViewpoint0', 'Set viewpoint', 'Ctrl+5');
     247  BSetViewpoint6 := AddItem('SetViewpoint1', 'Set viewpoint', 'Ctrl+6');
     248  BSetViewpoint7 := AddItem('SetViewpoint2', 'Set viewpoint', 'Ctrl+7');
     249  BSetViewpoint8 := AddItem('SetViewpoint3', 'Set viewpoint', 'Ctrl+8');
     250  BSetViewpoint9 := AddItem('SetViewpoint4', 'Set viewpoint', 'Ctrl+9');
     251  BAirBase := AddItem('AirBase', 'Air base', 'A');
     252  BBuildCity := AddItem('BuildCity', 'Build city', 'B');
     253  BEnhance := AddItem('Enhance', 'Enhance', 'E');
     254  BGoOn := AddItem('GoOn', 'Go on', 'G');
     255  BHome := AddItem('Home', 'Home', 'H');
     256  BFarmClearIrrigation := AddItem('FarmClearIrrigation', 'Farm/Clear/Irrigation', 'I');
     257  BLoad := AddItem('Load', 'Load', 'L');
     258  BAfforestMine := AddItem('AfforestMine', 'Afforest/Mine', 'M');
     259  BCanal := AddItem('Canal', 'Canal', 'N');
     260  BTrans := AddItem('Trans', 'Trans', 'O');
     261  BPollution := AddItem('Pollution', 'Pollution', 'P');
     262  BRailRoad := AddItem('RailRoad', 'Rails/Road', 'R');
     263  BUnload := AddItem('Unload', 'Unload', 'U');
     264  BRecover := AddItem('Recover', 'Recover', 'V');
     265  BUtilize := AddItem('Utilize', 'Utilize', 'Z');
     266  BMoveLeftDown := AddItem('MoveLeftDown', 'Move unit left-down', 'Num1', 'End');
     267  BMoveDown := AddItem('MoveDown', 'Move unit down', 'Num2', 'Down');
     268  BMoveRightDown := AddItem('MoveRightDown', 'Move unit right-down', 'Num3', 'PgDn');
     269  BMoveRight := AddItem('MoveRight', 'Move unit right', 'Num6', 'Right');
     270  BMoveRightUp := AddItem('MoveRightUp', 'Move unit right-up', 'Num9', 'PgUp');
     271  BMoveUp := AddItem('MoveUp', 'Move unit up', 'Num8', 'Up');
     272  BMoveLeftUp := AddItem('MoveLeftUp', 'Move unit left-up', 'Num7', 'Home');
     273  BMoveLeft := AddItem('MoveLeft', 'Move unit left', 'Num4', 'Left');
    146274end;
    147275
Note: See TracChangeset for help on using the changeset viewer.