Changeset 460 for trunk


Ignore:
Timestamp:
Nov 28, 2023, 3:16:24 PM (12 months ago)
Author:
chronos
Message:
  • Modified: Do not initialize all local player windows at the start of the game but later when they are really opened. This also fixes window initialization under Qt5 widgetset.
Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Integrated.lpi

    r456 r460  
    2525      <EnableI18N LFM="False"/>
    2626    </i18n>
     27    <MacroValues Count="1">
     28      <Macro3 Name="LCLWidgetType" Value="gtk2"/>
     29    </MacroValues>
    2730    <BuildModes Count="2">
    2831      <Item1 Name="Debug" Default="True"/>
    2932      <Item2 Name="Release">
     33        <MacroValues Count="1">
     34          <Macro3 Name="LCLWidgetType" Value="gtk2"/>
     35        </MacroValues>
    3036        <CompilerOptions>
    3137          <Version Value="11"/>
     
    7379        </CompilerOptions>
    7480      </Item2>
    75       <SharedMatrixOptions Count="2">
     81      <SharedMatrixOptions Count="3">
    7682        <Item1 ID="151739052537" Targets="CevoComponents,Common" Modes="Debug" Value="-g -gl -gh -CirotR -O1"/>
    7783        <Item2 ID="186701832267" Targets="CevoComponents,Common" Modes="Release" Value="-CX -XX -O3"/>
     84        <Item3 ID="754733391748" Modes="Debug,Release" Type="IDEMacro" MacroName="LCLWidgetType" Value="gtk2"/>
    7885      </SharedMatrixOptions>
    7986    </BuildModes>
  • trunk/LocalPlayer/Battle.pas

    r447 r460  
    3535  end;
    3636
    37 var
    38   BattleDlg: TBattleDlg;
    39 
    4037
    4138implementation
  • trunk/LocalPlayer/CityScreen.pas

    r456 r460  
    66uses
    77  {$IFDEF UNIX}LMessages,{$ENDIF}
    8   Protocol, ClientTools, Term, ScreenTools, IsoEngine, BaseWin,
    9   LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls,
    10   ButtonA, ButtonC, Area, GraphType, Texture;
     8  Protocol, ClientTools, ScreenTools, IsoEngine, BaseWin, LCLIntf, LCLType,
     9  Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, ButtonA,
     10  ButtonC, Area, GraphType, Texture;
    1111
    1212const
     
    4949    procedure PrevCityBtnClick(Sender: TObject);
    5050    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    51     // procedure AdviceBtnClick(Sender: TObject);
    5251    procedure PageUpBtnClick(Sender: TObject);
    5352    procedure PageDownBtnClick(Sender: TObject);
     
    101100  end;
    102101
    103 var
    104   CityDlg: TCityDlg;
    105 
    106102
    107103implementation
    108104
    109105uses
    110   Select, Messg, MessgEx, Help, Tribes, Directories, Math, Sound;
     106  Select, Messg, MessgEx, Help, Tribes, Directories, Math, Sound, Term;
    111107
    112108{$R *.lfm}
     
    205201  AreaMap.SetPaintBounds(xmArea - 192, ymArea - 96 - 32, xmArea + 192,
    206202    ymArea + 96);
    207   SmallMapMode := smImprovements;
    208   ZoomArea := 1;
     203  Reset;
    209204  ProdHint := False;
    210205  RestoreUnFocus := -1;
     
    11711166      (X < xView + 73) and (Y < yView + 50) then
    11721167      if cGov = gAnarchy then
    1173         with MessgExDlg do
     1168        with MainScreen.MessgExDlg do
    11741169        begin
    11751170          { MessgText:=Phrases.Lookup('OUTOFCONTROL');
     
    12041199        if iix >= 0 then
    12051200          if ssShift in Shift then
    1206             HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, iix)
     1201            MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, iix)
    12071202          else if (ClientMode < scContact) then
    1208             with MessgExDlg do
     1203            with MainScreen.MessgExDlg do
    12091204            begin
    12101205              IconKind := mikImp;
     
    13431338          if C.Status and csResourceWeightsMask <> 0 then
    13441339          begin
    1345             with MessgExDlg do
     1340            with MainScreen.MessgExDlg do
    13461341            begin
    13471342              MessgText := Phrases.Lookup('CITYMANAGEOFF');
     
    13511346              ShowModal;
    13521347            end;
    1353             if MessgExDlg.ModalResult = mrOK then
     1348            if MainScreen.MessgExDlg.ModalResult = mrOK then
    13541349            begin
    13551350              MyCity[cix].Status := MyCity[cix].Status and
     
    14501445begin
    14511446  Assert(not Supervising);
    1452   ModalSelectDlg.ShowNewContent_CityProject(wmModal, cix);
    1453   if ModalSelectDlg.Result <> -1 then
    1454   begin
    1455     if ModalSelectDlg.Result and cpType <> 0 then
     1447  MainScreen.ModalSelectDlg.ShowNewContent_CityProject(wmModal, cix);
     1448  if MainScreen.ModalSelectDlg.Result <> -1 then
     1449  begin
     1450    if MainScreen.ModalSelectDlg.Result and cpType <> 0 then
    14561451    begin
    14571452      MyCity[cix].Status := MyCity[cix].Status and not 7 or
    1458         (1 + ModalSelectDlg.Result and cpIndex);
    1459       AutoBuild(cix, MyData.ImpOrder[ModalSelectDlg.Result and cpIndex]);
     1453        (1 + MainScreen.ModalSelectDlg.Result and cpIndex);
     1454      AutoBuild(cix, MyData.ImpOrder[MainScreen.ModalSelectDlg.Result and cpIndex]);
    14601455    end
    14611456    else
    14621457    begin
    1463       NewProject := ModalSelectDlg.Result;
     1458      NewProject := MainScreen.ModalSelectDlg.Result;
    14641459      QueryOk := True;
    14651460      if (NewProject and cpImp <> 0) and (NewProject and cpIndex >= 28) and
    14661461        (MyRO.NatBuilt[NewProject and cpIndex] > 0) then
    1467         with MessgExDlg do
     1462        with MainScreen.MessgExDlg do
    14681463        begin
    14691464          cix1 := MyRO.nCity - 1;
     
    15421537  if (cix < 0) or (ClientMode >= scContact) then
    15431538    Exit;
    1544   with MyCity[cix], MessgExDlg do
     1539  with MyCity[cix], MainScreen.MessgExDlg do
    15451540  begin
    15461541    Cost := Report.ProjectCost;
     
    17431738end;
    17441739
    1745 { procedure TCityDlg.AdviceBtnClick(Sender: TObject);
    1746   begin
    1747   AdvisorDlg.GiveCityAdvice(cix);
    1748   end; }
    1749 
    17501740procedure TCityDlg.PageUpBtnClick(Sender: TObject);
    17511741begin
  • trunk/LocalPlayer/CityType.pas

    r447 r460  
    55
    66uses
    7   Protocol, ClientTools, Term, ScreenTools, BaseWin, LCLIntf, LCLType,
    8   SysUtils, Classes, Graphics, Controls, Forms,
    9   ButtonB, ExtCtrls;
     7  Protocol, ClientTools, ScreenTools, BaseWin, LCLIntf, LCLType,
     8  SysUtils, Classes, Graphics, Controls, Forms, ButtonB, ExtCtrls;
    109
    1110type
     
    3635  end;
    3736
    38 var
    39   CityTypeDlg: TCityTypeDlg;
    4037
    4138implementation
    4239
    43 uses Help;
     40uses
     41  Help, Term;
    4442
    4543{$R *.lfm}
     
    246244  begin
    247245    if ssShift in Shift then
    248       HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp,
     246      MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp,
    249247        MyData.ImpOrder[ctype, I])
    250248    else
     
    263261  begin
    264262    if ssShift in Shift then
    265       HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Pooliix[I])
     263      MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Pooliix[I])
    266264    else
    267265    begin
  • trunk/LocalPlayer/Diagram.pas

    r447 r460  
    99
    1010type
     11  TDiagramKind = (dkChart, dkShip);
     12
    1113  TDiaDlg = class(TFramedDlg)
    1214    CloseBtn: TButtonB;
     
    2022    procedure PlayerClick(Sender: TObject);
    2123    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    22 
    2324  public
    2425    procedure OffscreenPaint; override;
    2526    procedure ShowNewContent_Charts(NewMode: TWindowMode);
    2627    procedure ShowNewContent_Ship(NewMode: TWindowMode; P: Integer = -1);
    27 
    2828  private
    29     Kind: (dkChart, dkShip);
    30     Player, Mode: Integer;
    31   end;
    32 
    33 var
    34   DiaDlg: TDiaDlg;
     29    Kind: TDiagramKind;
     30    Player: Integer;
     31    Mode: Integer;
     32  end;
    3533
    3634procedure PaintColonyShip(Canvas: TCanvas; Player, Left, Width, Top: Integer);
     35
    3736
    3837implementation
  • trunk/LocalPlayer/Draft.pas

    r447 r460  
    55
    66uses
    7   Protocol, ClientTools, Term, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils,
     7  Protocol, ClientTools, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils,
    88  Classes, Graphics, Controls, Forms, ExtCtrls, ButtonA, ButtonB, Area;
    99
     
    3737  end;
    3838
    39 var
    40   DraftDlg: TDraftDlg;
    41 
    4239
    4340implementation
    4441
    4542uses
    46   Help, Tribes, Directories;
     43  Term, Help, Tribes, Directories;
    4744
    4845{$R *.lfm}
     
    531528      I := (Y - yFeature) div LinePitch;
    532529      if (X >= xFeature - 21) and (X < ClientWidth) and (ssShift in Shift) then
    533         HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkFeature, Code[I])
     530        MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkFeature, Code[I])
    534531      else if not(Code[I] in AutoFeature) then
    535532      begin
  • trunk/LocalPlayer/Enhance.pas

    r457 r460  
    55
    66uses
    7   ScreenTools, BaseWin, Protocol, ClientTools, Term, LCLIntf, LCLType, SysUtils,
     7  ScreenTools, BaseWin, Protocol, ClientTools, LCLIntf, LCLType, SysUtils,
    88  Classes, Graphics, Controls, Forms, IsoEngine, ButtonB, ButtonC, Menus;
    99
     
    4343  end;
    4444
    45 var
    46   EnhanceDlg: TEnhanceDlg;
    47 
    4845
    4946implementation
    5047
    5148uses
    52   Help, KeyBindings;
     49  Help, KeyBindings, Term;
    5350
    5451{$R *.lfm}
     
    382379  ShortCut := KeyToShortCut(Key, Shift);
    383380  if BHelp.Test(ShortCut) then
    384     HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkText,
    385       HelpDlg.TextIndex('MACRO'))
     381    MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkText,
     382      MainScreen.HelpDlg.TextIndex('MACRO'))
    386383end;
    387384
  • trunk/LocalPlayer/Help.pas

    r457 r460  
    147147  end;
    148148
    149 var
    150   HelpDlg: THelpDlg;
    151 
    152149
    153150implementation
     
    315312  HelpContext: string);
    316313begin
    317   HelpDlg.ShowNewContent(NewMode, hkText,
    318     HelpDlg.TextIndex(HelpContext))
     314  ShowNewContent(NewMode, hkText, TextIndex(HelpContext));
    319315end;
    320316
  • trunk/LocalPlayer/LocalPlayer.pas

    r447 r460  
    1010
    1111uses
    12   Term, CityScreen, Draft, MessgEx, Select, CityType, Help, UnitStat, Diagram,
    13   NatStat, Wonders, Nego, Enhance, BaseWin, Battle, Rates, TechTree, Forms;
     12  Term, CityScreen, Nego, BaseWin, Forms;
    1413
    1514var
     
    2423//    Application.MainForm := MainScreen;
    2524    Application.CreateForm(TMainScreen, MainScreen);
    26     Application.CreateForm(TCityDlg, CityDlg);
    27     Application.CreateForm(TModalSelectDlg, ModalSelectDlg);
    28     Application.CreateForm(TListDlg, ListDlg);
    29     Application.CreateForm(TMessgExDlg, MessgExDlg);
    30     Application.CreateForm(TDraftDlg, DraftDlg);
    31     Application.CreateForm(TCityTypeDlg, CityTypeDlg);
    32     Application.CreateForm(THelpDlg, HelpDlg);
    33     Application.CreateForm(TUnitStatDlg, UnitStatDlg);
    34     Application.CreateForm(TDiaDlg, DiaDlg);
    35     Application.CreateForm(TNatStatDlg, NatStatDlg);
    36     Application.CreateForm(TWondersDlg, WondersDlg);
    37     Application.CreateForm(TNegoDlg, NegoDlg);
    38     Application.CreateForm(TEnhanceDlg, EnhanceDlg);
    39     Application.CreateForm(TBattleDlg, BattleDlg);
    40     // Application.CreateForm(TAdvisorDlg, AdvisorDlg);
    41     Application.CreateForm(TRatesDlg, RatesDlg);
    42     Application.CreateForm(TTechTreeDlg, TechTreeDlg);
    4325  end;
    4426  MainScreen.Client(Command, Player, Data);
  • trunk/LocalPlayer/MessgEx.pas

    r457 r460  
    4949  end;
    5050
    51 var
    52   MessgExDlg: TMessgExDlg;
    5351
    5452procedure SoundMessageEx(SimpleText, SoundItem: string);
     
    458456begin
    459457  if Kind = mkOkHelp then
    460     HelpDlg.ShowNewContent(wmSubmodal, HelpKind, HelpNo)
     458    MainScreen.HelpDlg.ShowNewContent(wmSubmodal, HelpKind, HelpNo)
    461459  else if Kind = mkModel then
    462     UnitStatDlg.ShowNewContent_OwnModel(wmSubmodal, IconIndex)
     460    MainScreen.UnitStatDlg.ShowNewContent_OwnModel(wmSubmodal, IconIndex)
    463461  else
    464462    ModalResult := mrIgnore;
     
    489487// because Messg.SoundMessage not capable of movie mode
    490488begin
    491   with MessgExDlg do
     489  with MainScreen.MessgExDlg do
    492490  begin
    493491    MessgText := SimpleText;
     
    500498procedure TribeMessage(P: Integer; SimpleText, SoundItem: string);
    501499begin
    502   with MessgExDlg do
     500  with MainScreen.MessgExDlg do
    503501  begin
    504502    OpenSound := SoundItem;
     
    514512  : Integer;
    515513begin
    516   with MessgExDlg do
     514  with MainScreen.MessgExDlg do
    517515  begin
    518516    MessgText := SimpleText;
     
    527525  ContextKind: TLinkCategory; ContextNo: Integer);
    528526begin
    529   with MessgExDlg do
     527  with MainScreen.MessgExDlg do
    530528  begin
    531529    MessgText := SimpleText;
  • trunk/LocalPlayer/NatStat.pas

    r447 r460  
    55
    66uses
    7   Protocol, ClientTools, Term, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils,
     7  Protocol, ClientTools, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils,
    88  Classes, Graphics, Controls, Forms, ButtonB, ButtonC, Menus, EOTButton;
    99
     
    3737    procedure OffscreenPaint; override;
    3838  private
    39     pView, AgePrepared, LinesDown: Integer;
    40     SelfReport, CurrentReport: PEnemyReport;
    41     ShowContact, ContactEnabled: Boolean;
    42     Back, Template: TBitmap;
     39    pView: Integer;
     40    AgePrepared: Integer;
     41    LinesDown: Integer;
     42    SelfReport: PEnemyReport;
     43    CurrentReport: PEnemyReport;
     44    ShowContact: Boolean;
     45    ContactEnabled: Boolean;
     46    Back: TBitmap;
     47    Template: TBitmap;
    4348    ReportText: TStringList;
    4449    procedure GenerateReportText;
    4550  end;
    4651
    47 var
    48   NatStatDlg: TNatStatDlg;
    49 
    5052
    5153implementation
     
    5456
    5557uses
    56   Messg, Tribes, Directories;
     58  Term, Messg, Tribes, Directories;
    5759
    5860const
     
    193195            [I * 100 div (G.lx * G.ly)]);
    194196      end;
    195     end
     197    end;
    196198  end;
    197199
     
    254256  ps: PChar;
    255257  Extinct: Boolean;
    256 
    257258begin
    258259  inherited;
     
    279280        1 + Tribe[pView].facepix mod 10 * 65,
    280281        1 + Tribe[pView].facepix div 10 * 49);
    281       frame(Offscreen.Canvas, 18 - 1, yIcon - 4 - 1, 18 + 64, yIcon - 4 + 48,
     282      Frame(Offscreen.Canvas, 18 - 1, yIcon - 4 - 1, 18 + 64, yIcon - 4 + 48,
    282283        $000000, $000000);
    283284    end;
     
    392393        Phrases2.Lookup('MENU_TELLAI'));
    393394  end;
     395
    394396  ContactBtn.SetBack(Offscreen.Canvas, ContactBtn.Left, ContactBtn.Top);
    395397
  • trunk/LocalPlayer/Nego.pas

    r457 r460  
    55
    66uses
    7   ScreenTools, BaseWin, Protocol, Term, LCLType, SysUtils, Classes, Graphics,
     7  ScreenTools, BaseWin, Protocol, LCLType, SysUtils, Classes, Graphics,
    88  Controls, Forms, ButtonA, ButtonB, ButtonN;
    99
     
    2020
    2121  TCommandAllowedEnum = scDipNoticeStart..scDipBreakStart;
     22  TPriceSet = set of $00..$FF;
    2223
    2324  { TNegoDlg }
     
    6970    procedure OfferClick(Sender: TObject);
    7071    procedure FastBtnClick(Sender: TObject);
    71 
    7272  public
    7373    procedure Initiate; // first turn of negotiation, initiate
     
    7676    procedure OffscreenPaint; override;
    7777    procedure ShowNewContent(NewMode: TWindowMode);
    78 
    7978  private
    8079    Page, DipCommand: Integer;
     
    9392  end;
    9493
    95 var
    96   NegoDlg: TNegoDlg;
    97 
    9894
    9995implementation
    10096
    10197uses
    102   Messg, ClientTools, Diplomacy, Inp, Select, NatStat, Tribes, MessgEx;
     98  Messg, ClientTools, Diplomacy, Inp, Select, NatStat, Tribes, MessgEx, Term;
    10399
    104100{$R *.lfm}
     
    392388  else
    393389  begin
    394     if ModalSelectDlg.OnlyChoice(kChooseModel) <> mixAll then
     390    if MainScreen.ModalSelectDlg.OnlyChoice(kChooseModel) <> mixAll then
    395391      MyAllowed := MyAllowed + [opAllModel shr 24];
    396     if ModalSelectDlg.OnlyChoice(kChooseEModel) <> mixAll then
     392    if MainScreen.ModalSelectDlg.OnlyChoice(kChooseEModel) <> mixAll then
    397393      OppoAllowed := OppoAllowed + [opAllModel shr 24];
    398394  end;
     
    649645  if (X >= xNationPicture0) and (X < xNationPicture0 + 64) and
    650646    (Y >= yNationPicture) and (Y < yNationPicture + 48) then
    651     NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), DipMem[Me].pContact)
     647    MainScreen.NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), DipMem[Me].pContact)
    652648  else if (X >= xNationPicture1) and (X < xNationPicture1 + 64) and
    653649    (Y >= yNationPicture) and (Y < yNationPicture + 48) then
    654     NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), Me)
     650    MainScreen.NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), Me)
    655651end;
    656652
     
    756752        begin // choose type and number
    757753          if MyRO.NatBuilt[imSpacePort] = 0 then
    758             with MessgExDlg do
     754            with MainScreen.MessgExDlg do
    759755            begin
    760756              OpenSound := 'WARNING_LOWSUPPORT';
     
    767763                Exit;
    768764            end;
    769           ModalSelectDlg.ShowNewContent(wmModal, kEShipPart);
    770           if ModalSelectDlg.Result < 0 then
    771             Exit;
    772           Inc(Price, ModalSelectDlg.Result shl 16);
    773           Max := MyRO.Ship[DipMem[Me].pContact].Parts[ModalSelectDlg.Result];
     765          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kEShipPart);
     766          if MainScreen.ModalSelectDlg.Result < 0 then
     767            Exit;
     768          Inc(Price, MainScreen.ModalSelectDlg.Result shl 16);
     769          Max := MyRO.Ship[DipMem[Me].pContact].Parts[MainScreen.ModalSelectDlg.Result];
    774770          InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER');
    775771          InputDlg.EInput.Text := '';
     
    789785      opAllTech:
    790786        begin // choose technology
    791           ModalSelectDlg.ShowNewContent(wmModal, kChooseETech);
    792           if ModalSelectDlg.Result < 0 then
    793             Exit;
    794           if ModalSelectDlg.Result = adAll then
     787          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseETech);
     788          if MainScreen.ModalSelectDlg.Result < 0 then
     789            Exit;
     790          if MainScreen.ModalSelectDlg.Result = adAll then
    795791            Price := opAllTech
    796792          else
    797             Price := OpTech + ModalSelectDlg.Result;
     793            Price := OpTech + MainScreen.ModalSelectDlg.Result;
    798794        end;
    799795      opAllModel:
    800796        begin // choose model
    801           ModalSelectDlg.ShowNewContent(wmModal, kChooseEModel);
    802           if ModalSelectDlg.Result < 0 then
    803             Exit;
    804           if ModalSelectDlg.Result = mixAll then
     797          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseEModel);
     798          if MainScreen.ModalSelectDlg.Result < 0 then
     799            Exit;
     800          if MainScreen.ModalSelectDlg.Result = mixAll then
    805801            Price := opAllModel
    806802          else
    807             Price := OpModel + MyRO.EnemyModel[ModalSelectDlg.Result].mix;
     803            Price := OpModel + MyRO.EnemyModel[MainScreen.ModalSelectDlg.Result].mix;
    808804        end;
    809805      opTreaty:
     
    869865      opShipParts:
    870866        begin // choose type and number
    871           ModalSelectDlg.ShowNewContent(wmModal, kShipPart);
    872           if ModalSelectDlg.Result < 0 then
    873             Exit;
    874           Inc(Price, ModalSelectDlg.Result shl 16);
    875           Max := MyRO.Ship[Me].Parts[ModalSelectDlg.Result];
     867          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kShipPart);
     868          if MainScreen.ModalSelectDlg.Result < 0 then
     869            Exit;
     870          Inc(Price, MainScreen.ModalSelectDlg.Result shl 16);
     871          Max := MyRO.Ship[Me].Parts[MainScreen.ModalSelectDlg.Result];
    876872          InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER');
    877873          InputDlg.EInput.Text := '';
     
    891887      opAllTech:
    892888        begin // choose technology
    893           ModalSelectDlg.ShowNewContent(wmModal, kChooseTech);
    894           if ModalSelectDlg.Result < 0 then
    895             Exit;
    896           if ModalSelectDlg.Result = adAll then
     889          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseTech);
     890          if MainScreen.ModalSelectDlg.Result < 0 then
     891            Exit;
     892          if MainScreen.ModalSelectDlg.Result = adAll then
    897893            Price := opAllTech
    898894          else
    899             Price := OpTech + ModalSelectDlg.Result;
     895            Price := OpTech + MainScreen.ModalSelectDlg.Result;
    900896        end;
    901897      opAllModel:
    902898        begin // choose model
    903           ModalSelectDlg.ShowNewContent(wmModal, kChooseModel);
    904           if ModalSelectDlg.Result < 0 then
    905             Exit;
    906           if ModalSelectDlg.Result = mixAll then
     899          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseModel);
     900          if MainScreen.ModalSelectDlg.Result < 0 then
     901            Exit;
     902          if MainScreen.ModalSelectDlg.Result = mixAll then
    907903            Price := opAllModel
    908904          else
    909             Price := OpModel + ModalSelectDlg.Result;
     905            Price := OpModel + MainScreen.ModalSelectDlg.Result;
    910906        end;
    911907      opTreaty:
  • trunk/LocalPlayer/Rates.pas

    r447 r460  
    2323    procedure ShowNewContent(NewMode: TWindowMode);
    2424  end;
    25 
    26 var
    27   RatesDlg: TRatesDlg;
    2825
    2926
  • trunk/LocalPlayer/Select.pas

    r457 r460  
    55
    66uses
    7   Protocol, ClientTools, Term, ScreenTools, PVSB, BaseWin,
     7  Protocol, ClientTools, ScreenTools, PVSB, BaseWin,
    88  LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms,
    99  ExtCtrls, ButtonB, ButtonBase, Menus, Types;
     
    9292  adAll = $10000;
    9393
    94 var
    95   ListDlg: TListDlg;
    96   ModalSelectDlg: TModalSelectDlg;
    97 
    9894
    9995implementation
    10096
    10197uses
    102   CityScreen, Help, UnitStat, Tribes, Inp, CmdList;
     98  Term, CityScreen, Help, UnitStat, Tribes, Inp, CmdList;
    10399
    104100{$R *.lfm}
     
    871867    Server(CommandWithData(cSetCityName, CityNameInfo.GetCommandDataSize),
    872868      Me, 0, CityNameInfo);
    873     if CityDlg.Visible then
     869    if MainScreen.CityDlg.Visible then
    874870    begin
    875       CityDlg.FormShow(nil);
    876       CityDlg.Invalidate;
     871      MainScreen.CityDlg.FormShow(nil);
     872      MainScreen.CityDlg.Invalidate;
    877873    end;
    878874    Result := True;
     
    900896    Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize),
    901897      Me, 0, ModelNameInfo);
    902     if UnitStatDlg.Visible then
     898    if MainScreen.UnitStatDlg.Visible then
    903899    begin
    904       UnitStatDlg.FormShow(nil);
    905       UnitStatDlg.Invalidate;
     900      MainScreen.UnitStatDlg.FormShow(nil);
     901      MainScreen.UnitStatDlg.Invalidate;
    906902    end;
    907903    Result := True;
     
    941937        kModels, kChooseModel:
    942938          if lix <> mixAll then
    943             UnitStatDlg.ShowNewContent_OwnModel(wmPersistent, lix);
     939            MainScreen.UnitStatDlg.ShowNewContent_OwnModel(wmPersistent, lix);
    944940        kEModels:
    945           UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent,
     941          MainScreen.UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent,
    946942            Code[1, ScrollBar.Position + Selected]);
    947943        kAllEModels, kChooseEModel:
    948944          if lix <> mixAll then
    949             UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent, lix);
     945            MainScreen.UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent, lix);
    950946        kAdvance, kFarAdvance, kScience, kChooseTech, kChooseETech, kStealTech:
    951947          if lix = adMilitary then
    952             HelpDlg.ShowNewContent(wmPersistent, hkText,
    953               HelpDlg.TextIndex('MILRES'))
     948            MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkText,
     949              MainScreen.HelpDlg.TextIndex('MILRES'))
    954950          else if lix < adMilitary then
    955             HelpDlg.ShowNewContent(wmPersistent, hkAdv, lix);
     951            MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkAdv, lix);
    956952        kProject:
    957953          if lix = cpImp + imTrGoods then
    958             HelpDlg.ShowNewContent(wmPersistent, hkText,
    959               HelpDlg.TextIndex('TRADINGGOODS'))
     954            MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkText,
     955              MainScreen.HelpDlg.TextIndex('TRADINGGOODS'))
    960956          else if lix and (cpImp + cpType) = 0 then
    961             UnitStatDlg.ShowNewContent_OwnModel(wmPersistent,
     957            MainScreen.UnitStatDlg.ShowNewContent_OwnModel(wmPersistent,
    962958              lix and cpIndex)
    963959          else if (lix and cpType = 0) and (lix <> cpImp + imTrGoods) then
    964             HelpDlg.ShowNewContent(wmPersistent, hkImp,
     960            MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkImp,
    965961              lix and cpIndex);
    966962        kGov:
    967           HelpDlg.ShowNewContent(wmPersistent, hkMisc,
     963          MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkMisc,
    968964            Integer(miscGovList));
    969965        kShipPart, kEShipPart:
     
    18871883procedure TListDlg.RemoveUnit;
    18881884begin
    1889   if ListDlg.Visible and (Kind = kModels) then
     1885  if Visible and (Kind = kModels) then
    18901886    SmartUpdateContent;
    18911887end;
  • trunk/LocalPlayer/TechTree.pas

    r457 r460  
    2929    Dragging: Boolean;
    3030  end;
    31 
    32 var
    33   TechTreeDlg: TTechTreeDlg;
    3431
    3532
  • trunk/LocalPlayer/Term.pas

    r457 r460  
    1414  LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, DrawDlg, Types,
    1515  Forms, Menus, ExtCtrls, dateutils, Platform, ButtonB, ButtonC, EOTButton, Area,
    16   GraphicSet, MiniMap, IsoEngine;
     16  GraphicSet, MiniMap, IsoEngine, Wonders, TechTree, Enhance, Nego, CityType,
     17  Diagram, CityScreen, Rates, Battle, NatStat, UnitStat, Draft, Select, MessgEx,
     18  Help;
    1719
    1820const
     
    324326    NoMap: TIsoMap;
    325327    NoMapPanel: TIsoMap;
     328    // Forms
     329    FWondersDlg: TWondersDlg;
     330    FTechTreeDlg: TTechTreeDlg;
     331    FEnhanceDlg: TEnhanceDlg;
     332    FNegoDlg: TNegoDlg;
     333    FCityTypeDlg: TCityTypeDlg;
     334    FDiaDlg: TDiaDlg;
     335    FCityDlg: TCityDlg;
     336    FRatesDlg: TRatesDlg;
     337    FBattleDlg: TBattleDlg;
     338    FNatStatDlg: TNatStatDlg;
     339    FUnitStatDlg: TUnitStatDlg;
     340    FDraftDlg: TDraftDlg;
     341    FModalSelectDlg: TModalSelectDlg;
     342    FListDlg: TListDlg;
     343    FMessgExDlg: TMessgExDlg;
     344    FHelpDlg: THelpDlg;
     345    procedure ArrangeDialogs;
     346    procedure ArrangeDialog(Form: TBufferedDrawDlg);
    326347    function ChooseUnusedTribe: Integer;
    327348    function DoJob(j0: Integer): Integer;
     349    function GetBattleDlg: TBattleDlg;
     350    function GetCityDlg: TCityDlg;
     351    function GetCityTypeDlg: TCityTypeDlg;
     352    function GetDiaDlg: TDiaDlg;
     353    function GetDraftDlg: TDraftDlg;
     354    function GetEnhanceDlg: TEnhanceDlg;
     355    function GetHelpDlg: THelpDlg;
     356    function GetListDlg: TListDlg;
     357    function GetMessgExDlg: TMessgExDlg;
     358    function GetModalSelectDlg: TModalSelectDlg;
     359    function GetNatStatDlg: TNatStatDlg;
     360    function GetNegoDlg: TNegoDlg;
     361    function GetRatesDlg: TRatesDlg;
     362    function GetTechTreeDlg: TTechTreeDlg;
    328363    procedure GetTribeList;
     364    function GetUnitStatDlg: TUnitStatDlg;
     365    function GetWondersDlg: TWondersDlg;
    329366    procedure InitModule;
    330367    procedure DoneModule;
     
    397434    procedure UpdateViews(UpdateCityScreen: Boolean = False);
    398435    function ContactRefused(P: Integer; Item: String): Boolean;
     436    // Forms
     437    property WondersDlg: TWondersDlg read GetWondersDlg;
     438    property TechTreeDlg: TTechTreeDlg read GetTechTreeDlg;
     439    property EnhanceDlg: TEnhanceDlg read GetEnhanceDlg;
     440    property NegoDlg: TNegoDlg read GetNegoDlg;
     441    property CityTypeDlg: TCityTypeDlg read GetCityTypeDlg;
     442    property DiaDlg: TDiaDlg read GetDiaDlg;
     443    property CityDlg: TCityDlg read GetCityDlg;
     444    property RatesDlg: TRatesDlg read GetRatesDlg;
     445    property BattleDlg: TBattleDlg read GetBattleDlg;
     446    property NatStatDlg: TNatStatDlg read GetNatStatDlg;
     447    property UnitStatDlg: TUnitStatDlg read GetUnitStatDlg;
     448    property DraftDlg: TDraftDlg read GetDraftDlg;
     449    property ModalSelectDlg: TModalSelectDlg read GetModalSelectDlg;
     450    property ListDlg: TListDlg read GetListDlg;
     451    property MessgExDlg: TMessgExDlg read GetMessgExDlg;
     452    property HelpDlg: THelpDlg read GetHelpDlg;
    399453  end;
    400454
     
    428482  end;
    429483
    430   TPriceSet = set of $00 .. $FF;
    431484  TFormAction = (faClose, faEnable, faDisable, faUpdate, faSmartUpdateContent);
    432485
     
    579632function InitEnemyModel(emix: Integer): Boolean;
    580633procedure InitAllEnemyModels;
    581 procedure InitMyModel(mix: Integer; final: Boolean);
     634procedure InitMyModel(Mix: Integer; Final: Boolean);
    582635
    583636procedure ImpImage(ca: TCanvas; X, Y, iix: Integer; Government: Integer = -1;
     
    590643
    591644uses
    592   Directories, CityScreen, Draft, MessgEx, Select, CityType, Help,
    593   UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, PixelPointer, Sound,
    594   Battle, Rates, TechTree, Registry, Global, KeyBindings, CmdList;
     645  Directories, Log, PixelPointer, Sound, Registry, Global, KeyBindings, CmdList;
    595646
    596647{$R *.lfm}
     
    762813begin
    763814  if MyMap[Loc] and fDeadLands <> 0 then
    764     HelpDlg.ShowNewContent(NewMode, hkTer, 3 * 12)
     815    MainScreen.HelpDlg.ShowNewContent(NewMode, hkTer, 3 * 12)
    765816  else if (MyMap[Loc] and fTerrain = fForest) and IsJungle(Loc div G.lx) then
    766     HelpDlg.ShowNewContent(NewMode, hkTer,
     817    MainScreen.HelpDlg.ShowNewContent(NewMode, hkTer,
    767818      fJungle + (MyMap[Loc] shr 5 and 3) * 12)
    768819  else
    769     HelpDlg.ShowNewContent(NewMode, hkTer, MyMap[Loc] and fTerrain +
     820    MainScreen.HelpDlg.ShowNewContent(NewMode, hkTer, MyMap[Loc] and fTerrain +
    770821      (MyMap[Loc] shr 5 and 3) * 12);
    771822end;
     
    864915end;
    865916
    866 procedure InitMyModel(mix: Integer; final: Boolean);
     917procedure InitMyModel(Mix: Integer; Final: Boolean);
    867918var
    868919  mi: TModelInfo;
     
    871922    Exit;
    872923  // don't exit for special units because cSetModelPicture comes after TellNewModels
    873   MakeModelInfo(Me, mix, MyModel[mix], mi);
    874   ChooseModelPicture(Me, mix, ModelCode(mi), ModelHash(mi), MyRO.Turn,
    875     False, final);
     924  MakeModelInfo(Me, Mix, MyModel[mix], mi);
     925  ChooseModelPicture(Me, Mix, ModelCode(mi), ModelHash(mi), MyRO.Turn,
     926    False, Final);
    876927end;
    877928
     
    9531004        InitMyModel(MyData.ToldModels, True);
    9541005      { only run if no researched model }
    955       with MessgExDlg do
     1006      with MainScreen.MessgExDlg do
    9561007      begin
    9571008        { MakeModelInfo(me,MyData.ToldModels,MyModel[MyData.ToldModels],mi);
     
    11571208    { research complete -- select new }
    11581209    repeat
    1159       ModalSelectDlg.ShowNewContent(wmModal, kAdvance);
    1160       if ModalSelectDlg.Result < 0 then
     1210      MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kAdvance);
     1211      if MainScreen.ModalSelectDlg.Result < 0 then
    11611212      begin
    11621213        Result := False;
    11631214        Exit;
    11641215      end;
    1165       ChosenResearch := ModalSelectDlg.Result;
     1216      ChosenResearch := MainScreen.ModalSelectDlg.Result;
    11661217      if ChosenResearch = adMilitary then
    11671218      begin
    1168         DraftDlg.ShowNewContent(wmModal);
    1169         if DraftDlg.ModalResult <> mrOK then
     1219        MainScreen.DraftDlg.ShowNewContent(wmModal);
     1220        if MainScreen.DraftDlg.ModalResult <> mrOK then
    11701221          Tribe[Me].ModelPicture[MyRO.nModel].HGr := nil;
    11711222      end;
    1172     until (ChosenResearch <> adMilitary) or (DraftDlg.ModalResult = mrOK);
     1223    until (ChosenResearch <> adMilitary) or (MainScreen.DraftDlg.ModalResult = mrOK);
    11731224
    11741225    if ChosenResearch = adMilitary then
     
    11761227    else if ChosenResearch = adFar then
    11771228    begin
    1178       ModalSelectDlg.ShowNewContent(wmModal, kFarAdvance);
    1179       if ModalSelectDlg.Result >= 0 then
    1180         if (ModalSelectDlg.Result = adNone) or
    1181           (Server(sSetResearch - sExecute, Me, ModalSelectDlg.Result, nil^) <
     1229      MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kFarAdvance);
     1230      if MainScreen.ModalSelectDlg.Result >= 0 then
     1231        if (MainScreen.ModalSelectDlg.Result = adNone) or
     1232          (Server(sSetResearch - sExecute, Me, MainScreen.ModalSelectDlg.Result, nil^) <
    11821233          rExecuted) then
    1183           MyData.FarTech := ModalSelectDlg.Result
     1234          MyData.FarTech := MainScreen.ModalSelectDlg.Result
    11841235        else
    11851236        begin
    1186           ChosenResearch := ModalSelectDlg.Result;
     1237          ChosenResearch := MainScreen.ModalSelectDlg.Result;
    11871238          // can be researched immediately
    11881239          MyData.FarTech := adNone;
     
    11941245  else
    11951246    Server(sSetResearch, Me, ChosenResearch, nil^);
    1196   ListDlg.TechChange;
     1247  MainScreen.ListDlg.TechChange;
    11971248  Result := True;
    11981249end;
     
    15651616    until FindNext(SearchRec) <> 0;
    15661617  FindClose(SearchRec);
     1618end;
     1619
     1620function TMainScreen.GetUnitStatDlg: TUnitStatDlg;
     1621begin
     1622  if not Assigned(FUnitStatDlg) then begin
     1623    FUnitStatDlg := TUnitStatDlg.Create(nil);
     1624    ArrangeDialog(FUnitStatDlg);
     1625    FUnitStatDlg.CheckAge;
     1626  end;
     1627  Result := FUnitStatDlg;
     1628end;
     1629
     1630function TMainScreen.GetWondersDlg: TWondersDlg;
     1631begin
     1632  if not Assigned(FWondersDlg) then FWondersDlg := TWondersDlg.Create(nil);
     1633  Result := FWondersDlg;
    15671634end;
    15681635
     
    17581825  FreeAndNil(UnusedTribeFiles);
    17591826  FreeAndNil(TribeNames);
    1760   // AdvisorDlg.DeInit;
    17611827end;
    17621828
     
    18661932  end;
    18671933  InitCityMark(MainTexture);
    1868   CityDlg.CheckAge;
    1869   NatStatDlg.CheckAge;
    1870   UnitStatDlg.CheckAge;
    1871   HelpDlg.Difficulty := G.Difficulty[Me];
     1934  if Assigned(FCityDlg) then FCityDlg.CheckAge;
     1935  if Assigned(FNatStatDlg) then FNatStatDlg.CheckAge;
     1936  if Assigned(FUnitStatDlg) then FUnitStatDlg.CheckAge;
     1937  if Assigned(FHelpDlg) then FHelpDlg.Difficulty := G.Difficulty[Me];
    18721938
    18731939  UnFocus := -1;
     
    25212587
    25222588  HaveStrategyAdvice := False;
    2523   // (GameMode<>cMovie) and not supervising
    2524   // and AdvisorDlg.HaveStrategyAdvice;
    25252589  GoOnPhase := True;
    25262590  if Supervising or (GameMode = cMovie) then
     
    26282692      begin
    26292693        Server := TInitModuleData(Data).Server;
    2630         // AdvisorDlg.Init;
    26312694        InitModule;
    26322695        TInitModuleData(Data).DataSize := SizeOf(TPersistentData);
     
    26422705          MainTexture.Age := -1;
    26432706        Tribes.Init;
    2644         HelpDlg.UserLeft := (Screen.width - HelpDlg.width) div 2;
    2645         HelpDlg.UserTop := (Screen.height - HelpDlg.height) div 2;
     2707        HelpDlg.UserLeft := (Screen.Width - HelpDlg.Width) div 2;
     2708        HelpDlg.UserTop := (Screen.Height - HelpDlg.Height) div 2;
    26462709        HelpDlg.Difficulty := 0;
    26472710        if Command = cStartCredits then
     
    26542717    cNewGame, cLoadGame, cMovie, cNewMap:
    26552718      begin
    2656         { if (Command=cNewGame) or (Command=cLoadGame) then
    2657           AdvisorDlg.NewGame(Data); }
    26582719        GenerateNames := mNames.Checked;
    26592720        GameOK := True;
     
    26952756                begin
    26962757                  CityID := -1;
    2697                   EffectiveOwner := -1
     2758                  EffectiveOwner := -1;
    26982759                end;
    26992760              FillChar(ToldTech, SizeOf(ToldTech), Byte(tsNA));
     
    27022763            end;
    27032764
    2704         // arrange dialogs
    2705         ListDlg.UserLeft := 8;
    2706         ListDlg.UserTop := TopBarHeight + 8;
    2707         HelpDlg.UserLeft := Screen.width - HelpDlg.width - 8;
    2708         HelpDlg.UserTop := TopBarHeight + 8;
    2709         UnitStatDlg.UserLeft := 397;
    2710         UnitStatDlg.UserTop := TopBarHeight + 64;
    2711         DiaDlg.UserLeft := (Screen.width - DiaDlg.width) div 2;
    2712         DiaDlg.UserTop := (Screen.height - DiaDlg.height) div 2;
    2713         NatStatDlg.UserLeft := Screen.width - NatStatDlg.width - 8;
    2714         NatStatDlg.UserTop := Screen.height - PanelHeight -
    2715           NatStatDlg.height - 8;
    2716         if NatStatDlg.UserTop < 8 then
    2717           NatStatDlg.UserTop := 8;
     2765        ArrangeDialogs;
    27182766
    27192767        Age := 0;
    27202768        MovieSpeed := 1;
    27212769        LogDlg.mSlot.Visible := True;
    2722         LogDlg.Host := self;
    2723         HelpDlg.ClearHistory;
    2724         CityDlg.Reset;
     2770        LogDlg.Host := Self;
     2771        if Assigned(FHelpDlg) then FHelpDlg.ClearHistory;
     2772        if Assigned(FCityDlg) then FCityDlg.Reset;
    27252773
    27262774        MiniMap.Size := Point(G.lx, G.ly);
     
    28312879        Closable := True;
    28322880        Close;
    2833         { if (GameMode=cNewGame) or (GameMode=cLoadGame) then
    2834           AdvisorDlg.BreakGame; }
    28352881      end;
    28362882
     
    28582904        begin
    28592905          StayOnTop_Ensured := True;
    2860           CityDlg.StayOnTop_Workaround;
    2861           CityTypeDlg.StayOnTop_Workaround;
    2862           DiaDlg.StayOnTop_Workaround;
    2863           DraftDlg.StayOnTop_Workaround;
    2864           EnhanceDlg.StayOnTop_Workaround;
    2865           HelpDlg.StayOnTop_Workaround;
    2866           NatStatDlg.StayOnTop_Workaround;
    2867           NegoDlg.StayOnTop_Workaround;
    2868           ModalSelectDlg.StayOnTop_Workaround;
    2869           ListDlg.StayOnTop_Workaround;
    2870           UnitStatDlg.StayOnTop_Workaround;
    2871           WondersDlg.StayOnTop_Workaround;
    2872           RatesDlg.StayOnTop_Workaround;
     2906          //CityDlg.StayOnTop_Workaround;
     2907          //CityTypeDlg.StayOnTop_Workaround;
     2908          //DiaDlg.StayOnTop_Workaround;
     2909          //DraftDlg.StayOnTop_Workaround;
     2910          //EnhanceDlg.StayOnTop_Workaround;
     2911          //HelpDlg.StayOnTop_Workaround;
     2912          //NatStatDlg.StayOnTop_Workaround;
     2913          //NegoDlg.StayOnTop_Workaround;
     2914          //ModalSelectDlg.StayOnTop_Workaround;
     2915          //ListDlg.StayOnTop_Workaround;
     2916          //UnitStatDlg.StayOnTop_Workaround;
     2917          //WondersDlg.StayOnTop_Workaround;
     2918          //RatesDlg.StayOnTop_Workaround;
    28732919        end;
    28742920      end;
     
    29342980            NegoDlg.Visible then
    29352981            NegoDlg.Close;
    2936           skipped := False; // always show my moves during my turn
     2982          Skipped := False; // always show my moves during my turn
    29372983          Idle := True;
    29382984          InitTurn(NewPlayer);
     
    29532999        pTurn := NewPlayer;
    29543000        pLogo := -1;
    2955         skipped := False; // always show my moves during my turn
     3001        Skipped := False; // always show my moves during my turn
    29563002        Idle := True;
    29573003        if FirstMovieTurn then
     
    29783024        ClientMode := -1;
    29793025        Idle := False;
    2980         skipped := False;
     3026        Skipped := False;
    29813027      end;
    29823028
     
    36323678  I: Integer;
    36333679begin
     3680  if Assigned(FWondersDlg) then FreeAndNil(FWondersDlg);
     3681  if Assigned(FTechTreeDlg) then FreeAndNil(FTechTreeDlg);
     3682  if Assigned(FEnhanceDlg) then FreeAndNil(FEnhanceDlg);
     3683  if Assigned(FNegoDlg) then FreeAndNil(FNegoDlg);
     3684  if Assigned(FCityTypeDlg) then FreeAndNil(FCityTypeDlg);
     3685  if Assigned(FDiaDlg) then FreeAndNil(FDiaDlg);
     3686  if Assigned(FCityDlg) then FreeAndNil(FCityDlg);
     3687  if Assigned(FRatesDlg) then FreeAndNil(FRatesDlg);
     3688  if Assigned(FBattleDlg) then FreeAndNil(FBattleDlg);
     3689  if Assigned(FNatStatDlg) then FreeAndNil(FNatStatDlg);
     3690  if Assigned(FUnitStatDlg) then FreeAndNil(FUnitStatDlg);
     3691  if Assigned(FDraftDlg) then FreeAndNil(FDraftDlg);
     3692  if Assigned(FModalSelectDlg) then FreeAndNil(FModalSelectDlg);
     3693  if Assigned(FListDlg) then FreeAndNil(FListDlg);
     3694  if Assigned(FMessgExDlg) then FreeAndNil(FMessgExDlg);
     3695  if Assigned(FHelpDlg) then FreeAndNil(FHelpDlg);
     3696
    36343697  MainFormKeyDown := nil;
    36353698  FreeAndNil(sb);
     
    43404403  end
    43414404  else if ClientMode < 0 then
    4342     skipped := True
     4405    Skipped := True
    43434406  else if ClientMode >= scContact then
    43444407    NegoDlg.ShowNewContent(wmPersistent)
     
    45904653    ClientMode := -1;
    45914654    Idle := False;
    4592     skipped := WasSkipped;
     4655    Skipped := WasSkipped;
    45934656    for p1 := 1 to nPl - 1 do
    45944657      if G.RO[p1] <> nil then
    4595         skipped := True; // don't show enemy moves in hotseat mode
     4658        Skipped := True; // don't show enemy moves in hotseat mode
    45964659  end
    45974660  else
     
    46044667    NegoDlg.Close;
    46054668  HaveStrategyAdvice := False;
    4606   // AdvisorDlg.HaveStrategyAdvice;
    4607   // negotiation might have changed advices
    46084669  EOT.ButtonIndex := eotCancel;
    46094670  EOT.Visible := True;
     
    58165877    Exit;
    58175878
    5818   if CityDlg.Visible then
     5879  if Assigned(FCityDlg) and CityDlg.Visible then
    58195880    CityDlg.Close;
    5820   if UnitStatDlg.Visible then
     5881  if Assigned(FUnitStatDlg) and UnitStatDlg.Visible then
    58215882    UnitStatDlg.Close;
    58225883  MouseLoc := LocationOfScreenPixel(X, Y);
     
    73817442end;
    73827443
     7444function TMainScreen.GetBattleDlg: TBattleDlg;
     7445begin
     7446  if not Assigned(FBattleDlg) then FBattleDlg := TBattleDlg.Create(nil);
     7447  Result := FBattleDlg;
     7448end;
     7449
     7450function TMainScreen.GetCityDlg: TCityDlg;
     7451begin
     7452  if not Assigned(FCityDlg) then begin
     7453    FCityDlg := TCityDlg.Create(nil);
     7454    FCityDlg.CheckAge;
     7455  end;
     7456  Result := FCityDlg;
     7457end;
     7458
     7459function TMainScreen.GetCityTypeDlg: TCityTypeDlg;
     7460begin
     7461  if not Assigned(FCityTypeDlg) then FCityTypeDlg := TCityTypeDlg.Create(nil);
     7462  Result := FCityTypeDlg;
     7463end;
     7464
     7465function TMainScreen.GetDiaDlg: TDiaDlg;
     7466begin
     7467  if not Assigned(FDiaDlg) then begin
     7468    FDiaDlg := TDiaDlg.Create(nil);
     7469    ArrangeDialog(FDiaDlg);
     7470  end;
     7471  Result := FDiaDlg;
     7472end;
     7473
     7474function TMainScreen.GetDraftDlg: TDraftDlg;
     7475begin
     7476  if not Assigned(FDraftDlg) then FDraftDlg := TDraftDlg.Create(nil);
     7477  Result := FDraftDlg;
     7478end;
     7479
     7480function TMainScreen.GetEnhanceDlg: TEnhanceDlg;
     7481begin
     7482  if not Assigned(FEnhanceDlg) then FEnhanceDlg := TEnhanceDlg.Create(nil);
     7483  Result := FEnhanceDlg;
     7484end;
     7485
     7486function TMainScreen.GetHelpDlg: THelpDlg;
     7487begin
     7488  if not Assigned(FHelpDlg) then begin
     7489    FHelpDlg := THelpDlg.Create(nil);
     7490    ArrangeDialog(FHelpDlg);
     7491    FHelpDlg.Difficulty := G.Difficulty[Me];
     7492  end;
     7493  Result := FHelpDlg;
     7494end;
     7495
     7496function TMainScreen.GetListDlg: TListDlg;
     7497begin
     7498  if not Assigned(FListDlg) then begin
     7499    FListDlg := TListDlg.Create(nil);
     7500    ArrangeDialog(FListDlg);
     7501  end;
     7502  Result := FListDlg;
     7503end;
     7504
     7505function TMainScreen.GetMessgExDlg: TMessgExDlg;
     7506begin
     7507  if not Assigned(FMessgExDlg) then FMessgExDlg := TMessgExDlg.Create(nil);
     7508    Result := FMessgExDlg;
     7509end;
     7510
     7511function TMainScreen.GetModalSelectDlg: TModalSelectDlg;
     7512begin
     7513  if not Assigned(FModalSelectDlg) then FModalSelectDlg := TModalSelectDlg.Create(nil);
     7514  Result := FModalSelectDlg;
     7515end;
     7516
     7517function TMainScreen.GetNatStatDlg: TNatStatDlg;
     7518begin
     7519  if not Assigned(FNatStatDlg) then begin
     7520    FNatStatDlg := TNatStatDlg.Create(nil);
     7521    ArrangeDialog(FNatStatDlg);
     7522    FNatStatDlg.CheckAge;
     7523  end;
     7524  Result := FNatStatDlg;
     7525end;
     7526
     7527function TMainScreen.GetNegoDlg: TNegoDlg;
     7528begin
     7529  if not Assigned(FNegoDlg) then FNegoDlg := TNegoDlg.Create(nil);
     7530  Result := FNegoDlg;
     7531end;
     7532
     7533function TMainScreen.GetRatesDlg: TRatesDlg;
     7534begin
     7535  if not Assigned(FRatesDlg) then FRatesDlg := TRatesDlg.Create(nil);
     7536  Result := FRatesDlg;
     7537end;
     7538
     7539function TMainScreen.GetTechTreeDlg: TTechTreeDlg;
     7540begin
     7541  if not Assigned(FTechTreeDlg) then FTechTreeDlg := TTechTreeDlg.Create(nil);
     7542  Result := FTechTreeDlg;
     7543end;
     7544
    73837545procedure TMainScreen.mDisbandOrUtilizeClick(Sender: TObject);
    73847546var
     
    81778339end;
    81788340
    8179 { procedure TMainScreen.AdviceBtnClick;
    8180   var
    8181   OldAdviceLoc: Integer;
    8182   begin
    8183   DestinationMarkON:=False;
    8184   PaintDestination;
    8185   AdvisorDlg.GiveStrategyAdvice;
    8186   OldAdviceLoc:=MainMap.AdviceLoc;
    8187   MainMap.AdviceLoc:=-1;
    8188   PaintLoc(OldAdviceLoc);
    8189   end; }
    8190 
    8191 { procedure TMainScreen.SetAdviceLoc(Loc: integer; AvoidRect: TRect);
    8192   var
    8193   OldAdviceLoc,X,Y: Integer;
    8194   begin
    8195   if Loc<>MainMap.AdviceLoc then
    8196   begin
    8197   if Loc>=0 then
    8198   begin // center
    8199   Y:=Loc div G.lx;
    8200   X:=(Loc+G.lx - AvoidRect.Right div (2*66)) mod G.lx;
    8201   Centre(Y*G.lx+X);
    8202   PaintAllMaps;
    8203   end;
    8204   OldAdviceLoc:=MainMap.AdviceLoc;
    8205   MainMap.AdviceLoc:=Loc;
    8206   PaintLoc(OldAdviceLoc);
    8207   PaintLoc(MainMap.AdviceLoc);
    8208   end;
    8209   end; }
    8210 
    82118341procedure TMainScreen.UnitInfoBtnClick(Sender: TObject);
    82128342begin
     
    82948424end;
    82958425
     8426procedure TMainScreen.ArrangeDialogs;
     8427begin
     8428  ArrangeDialog(FListDlg);
     8429  ArrangeDialog(FHelpDlg);
     8430  ArrangeDialog(FUnitStatDlg);
     8431  ArrangeDialog(FDiaDlg);
     8432  ArrangeDialog(FNatStatDlg);
     8433end;
     8434
     8435procedure TMainScreen.ArrangeDialog(Form: TBufferedDrawDlg);
     8436begin
     8437  if not Assigned(Form) then Exit;
     8438
     8439  if Form is TListDlg then begin;
     8440    ListDlg.UserLeft := 8;
     8441    ListDlg.UserTop := TopBarHeight + 8;
     8442  end;
     8443  if Form is THelpDlg then begin
     8444   HelpDlg.UserLeft := Screen.Width - HelpDlg.Width - 8;
     8445    HelpDlg.UserTop := TopBarHeight + 8;
     8446  end;
     8447  if Form is TUnitStatDlg then begin
     8448    UnitStatDlg.UserLeft := 397;
     8449    UnitStatDlg.UserTop := TopBarHeight + 64;
     8450  end;
     8451  if Form is TDiaDlg then begin
     8452    DiaDlg.UserLeft := (Screen.Width - DiaDlg.Width) div 2;
     8453    DiaDlg.UserTop := (Screen.Height - DiaDlg.Height) div 2;
     8454  end;
     8455  if Form is TNatStatDlg then begin
     8456    NatStatDlg.UserLeft := Screen.Width - NatStatDlg.Width - 8;
     8457    NatStatDlg.UserTop := Screen.Height - PanelHeight - NatStatDlg.Height - 8;
     8458    if NatStatDlg.UserTop < 8 then
     8459      NatStatDlg.UserTop := 8;
     8460  end;
     8461end;
     8462
    82968463procedure TMainScreen.ScrollBarUpdate(Sender: TObject);
    82978464begin
  • trunk/LocalPlayer/UnitStat.pas

    r456 r460  
    55
    66uses
    7   Protocol, ClientTools, Term, ScreenTools, BaseWin,
    8   LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms,
    9   ButtonB, ButtonC, IsoEngine;
     7  Protocol, ClientTools, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils,
     8  Classes, Graphics, Controls, Forms, ButtonB, ButtonC, IsoEngine;
    109
    1110type
     11  TUnitStatDialogKind = (dkOwnModel, dkOwnUnit, dkEnemyModel, dkEnemyUnit,
     12    dkEnemyCityDefense, dkEnemyCity);
     13
    1214  TUnitStatDlg = class(TBufferedDrawDlg)
    1315    SwitchBtn: TButtonB;
     
    2628  private
    2729    NoMap: TIsoMap;
     30  protected
     31    mixShow, // for dkOwnModel
     32    uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: Integer;
     33    // for dkEnemyUnit, euixShow=-1 ->
     34    mox: ^TModelInfo; // for dkEnemyModel
     35    Kind: TUnitStatDialogKind;
     36    Back: TBitmap;
     37    Template: TBitmap;
     38    procedure OffscreenPaint; override;
    2839  public
    2940    procedure CheckAge;
     
    3445    procedure ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: Integer);
    3546    procedure ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: Integer);
    36 
    37   protected
    38     mixShow, // for dkOwnModel
    39     uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: Integer;
    40     // for dkEnemyUnit, euixShow=-1 ->
    41     mox: ^TModelInfo; // for dkEnemyModel
    42     Kind: (dkOwnModel, dkOwnUnit, dkEnemyModel, dkEnemyUnit, dkEnemyCityDefense,
    43       dkEnemyCity);
    44     Back, Template: TBitmap;
    45     procedure OffscreenPaint; override;
    46   end;
    47 
    48 var
    49   UnitStatDlg: TUnitStatDlg;
     47  end;
     48
    5049
    5150implementation
    5251
    5352uses
    54   Tribes, Help, Directories, Texture;
     53  Term, Tribes, Help, Directories, Texture;
    5554
    5655{$R *.lfm}
     
    8281  Back.PixelFormat := pf24bit;
    8382  Back.SetSize(5 * wCommon, hMax);
    84   Back.Canvas.FillRect(0, 0, Back.Width,Back.Height);
     83  Back.Canvas.FillRect(0, 0, Back.Width, Back.Height);
    8584  Template := TBitmap.Create;
    8685  Template.PixelFormat := pf24bit;
     
    121120procedure TUnitStatDlg.FormShow(Sender: TObject);
    122121var
    123   owner, mix: Integer;
     122  Owner, mix: Integer;
    124123  IsSpecialUnit: Boolean;
    125124begin
     
    138137      begin
    139138        mox := @MyRO.EnemyModel[emix];
    140         if not Assigned(Tribe[owner].ModelPicture[mix].HGr) then
     139        if not Assigned(Tribe[Owner].ModelPicture[mix].HGr) then
    141140          InitEnemyModel(emix);
    142       end
     141      end;
    143142    end
    144143    else
     
    153152  end;
    154153  case Kind of
    155     dkOwnModel:
    156       ClientHeight := hOwnModel;
    157     dkOwnUnit:
    158       ClientHeight := hEnemyUnit;
    159     dkEnemyModel:
    160       ClientHeight := hEnemyModel;
    161     dkEnemyUnit:
    162       ClientHeight := hEnemyUnit;
    163     dkEnemyCityDefense:
    164       ClientHeight := hEnemyCityDefense;
    165     dkEnemyCity:
    166       ClientHeight := hEnemyCity;
     154    dkOwnModel: ClientHeight := hOwnModel;
     155    dkOwnUnit: ClientHeight := hEnemyUnit;
     156    dkEnemyModel: ClientHeight := hEnemyModel;
     157    dkEnemyUnit: ClientHeight := hEnemyUnit;
     158    dkEnemyCityDefense: ClientHeight := hEnemyCityDefense;
     159    dkEnemyCity: ClientHeight := hEnemyCity;
    167160  end;
    168161
     
    171164    Left := UserLeft;
    172165    Top := UserTop;
    173   end
    174   else
    175   begin
     166  end else begin
    176167    Left := (Screen.Width - Width) div 2;
    177168    Top := (Screen.Height - Height) div 2;
     
    188179  begin
    189180    case Kind of
    190       dkOwnModel:
    191         begin
    192           owner := Me;
    193           mix := mixShow;
    194           IsSpecialUnit := MyModel[mix].Kind >= $10;
    195         end;
    196       dkOwnUnit:
    197         begin
    198           owner := Me;
    199           mix := MyUn[uixShow].mix;
    200           IsSpecialUnit := MyModel[mix].Kind >= $10;
    201         end
    202     else
    203       begin
    204         owner := mox.owner;
     181      dkOwnModel: begin
     182        Owner := Me;
     183        mix := mixShow;
     184        IsSpecialUnit := MyModel[mix].Kind >= $10;
     185      end;
     186      dkOwnUnit: begin
     187        Owner := Me;
     188        mix := MyUn[uixShow].mix;
     189        IsSpecialUnit := MyModel[mix].Kind >= $10;
     190      end;
     191      else begin
     192        Owner := mox.Owner;
    205193        mix := mox.mix;
    206194        IsSpecialUnit := mox.Kind >= $10;
     
    271259  begin
    272260    UserLeft := Left;
    273     UserTop := Top
    274   end;
    275   if OffscreenUser = self then
     261    UserTop := Top;
     262  end;
     263  if OffscreenUser = Self then
    276264    OffscreenUser := nil;
    277265end;
     
    343331            mcFirstNonCap .. nFeature - 1:
    344332              if mi.Cap and (1 shl (I - mcFirstNonCap)) <> 0 then
    345                 num := 1
     333                num := 1;
    346334          end;
    347335          if (num > 0) and
     
    357345              Brush.Style := bsClear;
    358346              Textout(X - 3 + dx + 1, Y, S);
    359               Inc(dx, W + 1)
     347              Inc(dx, W + 1);
    360348            end;
    361349            Brush.Color := $C0C0C0;
     
    364352            Sprite(dst, HGrSystem, X - 1 + dx, Y + 4, 10, 10,
    365353              66 + I mod 11 * 11, 137 + I div 11 * 11);
    366             Inc(dx, 15)
     354            Inc(dx, 15);
    367355          end;
    368356        end;
    369357      end;
    370   end; { featurebar }
     358  end;
    371359
    372360  procedure NumberBarS(dst: TBitmap; X, Y: Integer; Cap, S: string; T: TTexture);
     
    387375
    388376  case Kind of
    389     dkOwnModel:
    390       begin
    391         BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hOwnModel,
    392           Back.Canvas, 0, 0);
    393         yView := 13;
    394         yTotal := 92;
    395       end;
    396     dkEnemyModel:
    397       begin
    398         BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyModel,
    399           Back.Canvas, wCommon, 0);
    400         yView := 13;
    401         yTotal := 92;
    402       end;
    403     dkEnemyUnit, dkOwnUnit:
    404       begin
    405         BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyUnit,
    406           Back.Canvas, 2 * wCommon, 0);
    407         yView := 13;
    408         yTotal := 123;
    409       end;
    410     dkEnemyCityDefense:
    411       begin
    412         BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense,
    413           Back.Canvas, 3 * wCommon, 0);
    414         yView := 171;
    415         yTotal := 231;
    416       end;
    417     dkEnemyCity:
    418       begin
    419         BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCity,
    420           Back.Canvas, 4 * wCommon, 0);
    421       end;
     377    dkOwnModel: begin
     378      BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hOwnModel,
     379        Back.Canvas, 0, 0);
     380      yView := 13;
     381      yTotal := 92;
     382    end;
     383    dkEnemyModel: begin
     384      BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyModel,
     385        Back.Canvas, wCommon, 0);
     386      yView := 13;
     387      yTotal := 92;
     388    end;
     389    dkEnemyUnit, dkOwnUnit: begin
     390      BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyUnit,
     391        Back.Canvas, 2 * wCommon, 0);
     392      yView := 13;
     393      yTotal := 123;
     394    end;
     395    dkEnemyCityDefense: begin
     396      BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense,
     397        Back.Canvas, 3 * wCommon, 0);
     398      yView := 171;
     399      yTotal := 231;
     400    end;
     401    dkEnemyCity: begin
     402      BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCity,
     403        Back.Canvas, 4 * wCommon, 0);
     404    end;
    422405  end;
    423406  MarkUsedOffscreen(ClientWidth, ClientHeight);
     
    438421          1: J := imCoastalFort;
    439422          2: J := imMissileBat;
    440           3: J := imBunker
     423          3: J := imBunker;
    441424        end;
    442425        Frame(Offscreen.Canvas, X - 1, yImp - 1, X + xSizeSmall,
     
    734717procedure TUnitStatDlg.HelpBtnClick(Sender: TObject);
    735718begin
    736   HelpDlg.ShowNewContent(wmPersistent, hkModel, 0);
     719  MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkModel, 0);
    737720end;
    738721
  • trunk/LocalPlayer/Wonders.pas

    r456 r460  
    3030    procedure ShowNewContent(NewMode: TWindowMode);
    3131  end;
    32 
    33 var
    34   WondersDlg: TWondersDlg;
    3532
    3633
     
    351348begin
    352349  if Selection >= 0 then
    353     HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Selection);
     350    MainScreen.HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Selection);
    354351end;
    355352
  • trunk/Packages/CevoComponents/BaseWin.pas

    r447 r460  
    1414
    1515  TBufferedDrawDlg = class(TDrawDlg)
    16   public
    17     UserLeft: Integer;
    18     UserTop: Integer;
    19     constructor Create(AOwner: TComponent); override;
    20     destructor Destroy; override;
    21     procedure FormClose(Sender: TObject; var Action: TCloseAction);
    22     procedure FormPaint(Sender: TObject);
    23     procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    24     procedure FormDeactivate(Sender: TObject);
    25     procedure SmartUpdateContent(ImmUpdate: Boolean = False);
    26     procedure StayOnTop_Workaround;
    2716  protected
    2817    FWindowMode: TWindowMode;
     
    3423    procedure VPaint; virtual;
    3524  public
     25    UserLeft: Integer;
     26    UserTop: Integer;
    3627    UsedOffscreenWidth: Integer;
    3728    UsedOffscreenHeight: Integer;
    3829    Offscreen: TBitmap;
    3930    OffscreenUser: TForm;
     31    constructor Create(AOwner: TComponent); override;
     32    destructor Destroy; override;
     33    procedure FormClose(Sender: TObject; var Action: TCloseAction);
     34    procedure FormPaint(Sender: TObject);
     35    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
     36    procedure FormDeactivate(Sender: TObject);
     37    procedure SmartUpdateContent(ImmUpdate: Boolean = False);
     38    procedure StayOnTop_Workaround;
    4039    property WindowMode: TWindowMode read FWindowMode;
    4140  end;
    4241
    4342  TFramedDlg = class(TBufferedDrawDlg)
    44   public
    45     constructor Create(AOwner: TComponent); override;
    46     procedure FormCreate(Sender: TObject);
    47     procedure SmartInvalidate; override;
    4843  protected
    4944    CaptionLeft: Integer;
     
    5853    procedure VPaint; override;
    5954    procedure FillOffscreen(Left, Top, Width, Height: Integer);
     55  public
     56    constructor Create(AOwner: TComponent); override;
     57    procedure FormCreate(Sender: TObject);
     58    procedure SmartInvalidate; override;
    6059  end;
    6160
     
    120119    UserTop := Top;
    121120  end;
    122   if OffscreenUser = self then
     121  if OffscreenUser = Self then
    123122    OffscreenUser := nil;
    124123end;
     
    126125procedure TBufferedDrawDlg.FormPaint(Sender: TObject);
    127126begin
    128   if OffscreenUser <> self then
     127  if OffscreenUser <> Self then
    129128    OffscreenPaint;
    130129  VPaint;
  • trunk/Packages/CevoComponents/DrawDlg.pas

    r447 r460  
    4646    Lines: Integer;
    4747    TopSpace: Integer;
    48     procedure SplitText(preview: boolean);
     48    procedure SplitText(Preview: Boolean);
    4949    procedure CorrectHeight;
    5050  end;
     
    206206procedure TDrawDlg.InitButtons;
    207207var
    208   cix: integer;
     208  cix: Integer;
    209209  // ButtonDownSound, ButtonUpSound: string;
    210210begin
     
    228228procedure TDrawDlg.SmartInvalidate;
    229229var
    230   i: integer;
     230  i: Integer;
    231231  r0, r1: HRgn;
    232232begin
     
    240240      DeleteObject(r1);
    241241    end;
    242   InvalidateRgn(Handle, r0, false);
     242  InvalidateRgn(Handle, r0, False);
    243243  DeleteObject(r0);
    244244end;
     
    260260procedure TBaseMessgDlg.FormPaint(Sender: TObject);
    261261var
    262   i, cix: integer;
     262  i, cix: Integer;
    263263begin
    264264  if csDesigning in ComponentState then Exit;
    265   PaintBackground(self, 3 + Border, 3 + Border, ClientWidth - (6 + 2 * Border),
     265  PaintBackground(Self, 3 + Border, 3 + Border, ClientWidth - (6 + 2 * Border),
    266266    ClientHeight - (6 + 2 * Border));
    267267  for i := 0 to Border do
     
    274274    ClientHeight - (3 + Border), MainTexture.ColorBevelLight,
    275275    MainTexture.ColorBevelShade);
    276   SplitText(false);
     276  SplitText(False);
    277277
    278278  for cix := 0 to ControlCount - 1 do
     
    281281end;
    282282
    283 procedure TBaseMessgDlg.SplitText(preview: boolean);
    284 var
    285   Start, Stop, OrdinaryStop, LinesCount: integer;
     283procedure TBaseMessgDlg.SplitText(Preview: Boolean);
     284var
     285  Start, Stop, OrdinaryStop, LinesCount: Integer;
    286286  s: string;
    287287begin
     
    294294      (BiColorTextWidth(Canvas, Copy(MessgText, Start, Stop - Start + 1)) <
    295295      ClientWidth - 56) do
    296       inc(Stop);
     296      Inc(Stop);
    297297    if Stop <> Length(MessgText) then
    298298    begin
     
    303303        (MessgText[OrdinaryStop + 1] = '\');
    304304      if (OrdinaryStop + 1 - Start) * 2 >= Stop - Start then
    305         Stop := OrdinaryStop
    306     end;
    307     if not preview then
     305        Stop := OrdinaryStop;
     306    end;
     307    if not Preview then
    308308    begin
    309309      s := Copy(MessgText, Start, Stop - Start + 1);
     
    313313    end;
    314314    Start := Stop + 2;
    315     inc(LinesCount)
    316   end;
    317   if preview then
     315    inc(LinesCount);
     316  end;
     317  if Preview then
    318318    Lines := LinesCount;
    319319end;
     
    321321procedure TBaseMessgDlg.CorrectHeight;
    322322var
    323   i: integer;
     323  i: Integer;
    324324begin
    325325  ClientHeight := 72 + Border + TopSpace + Lines * MessageLineSpacing;
Note: See TracChangeset for help on using the changeset viewer.