Changeset 465 for branches/highdpi/Direct.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Direct.pas
r405 r465 7 7 UDpiControls, Messg, 8 8 9 LCLIntf, LCLType, {$IFDEF Linux}LMessages, {$ENDIF}Messages, SysUtils, Classes,9 LCLIntf, LCLType, {$IFDEF UNIX}LMessages, {$ENDIF}Messages, SysUtils, Classes, 10 10 Graphics, Controls, Forms, DrawDlg, GameServer; 11 11 … … 29 29 Gone: Boolean; 30 30 Quick: Boolean; 31 procedure SetInfo( x: string);32 procedure SetState( x: integer);31 procedure SetInfo(X: string); 32 procedure SetState(X: Integer); 33 33 procedure OnGo(var Msg: TMessage); message WM_GO; 34 34 procedure OnChangeClient(var Msg: TMessage); message WM_CHANGECLIENT; … … 40 40 DirectDlg: TDirectDlg; 41 41 42 42 43 implementation 43 44 44 45 uses 45 ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global, UNetworkServer,46 UNetworkClient;46 ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global, NetworkServer, 47 NetworkClient; 47 48 48 49 {$R *.lfm} … … 57 58 // hMem: Cardinal; 58 59 // p: pointer; 59 s: string;60 S: string; 60 61 Begin 61 62 case ID of … … 72 73 if visible then 73 74 begin 74 s:= Format(Phrases.Lookup('BUSY_MOD'), [Brains[Index].Name]);75 while BiColorTextWidth(Canvas, s) + 64 > ClientWidth do76 Delete( s, Length(s), 1);77 SetInfo( s);75 S := Format(Phrases.Lookup('BUSY_MOD'), [Brains[Index].Name]); 76 while BiColorTextWidth(Canvas, S) + 64 > ClientWidth do 77 Delete(S, Length(S), 1); 78 SetInfo(S); 78 79 end; 79 80 ntCreateWorld: … … 111 112 hMem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, 112 113 Length(NotifyMessage)); 113 p:= GlobalLock(hMem);114 if p<> nil then115 move(NotifyMessage[1], p^, Length(NotifyMessage));114 P := GlobalLock(hMem); 115 if P <> nil then 116 Move(NotifyMessage[1], P^, Length(NotifyMessage)); 116 117 GlobalUnlock(hMem); 117 118 SetClipboardData(CF_TEXT, hMem); … … 153 154 State := -1; 154 155 Show; 155 {$IFDEF LINUX} 156 // Force shown window repaint on Gtk2 widgetset 157 Sleep(1); 158 DpiApplication.ProcessMessages; 159 {$ENDIF} 156 Gtk2Fix; 160 157 Invalidate; 161 158 Update; … … 183 180 BrainTerm.Name := Phrases.Lookup('HUMAN'); 184 181 if NetworkEnabled then begin 185 BrainNetworkServer.Client := UNetworkServer.Client;182 BrainNetworkServer.Client := NetworkServer.Client; 186 183 BrainNetworkServer.Name := Phrases.Lookup('NETWORK_SERVER'); 187 BrainNetworkClient.Client := UNetworkClient.Client;184 BrainNetworkClient.Client := NetworkClient.Client; 188 185 BrainNetworkClient.Name := Phrases.Lookup('NETWORK_CLIENT'); 189 186 end; … … 198 195 begin 199 196 PostMessage(Handle, WM_GO, 0, 0); 200 Gone := true;197 Gone := True; 201 198 end; 202 199 end; … … 209 206 procedure TDirectDlg.OnGo(var Msg: TMessage); 210 207 var 211 i: integer;212 s: string;208 I: Integer; 209 S: string; 213 210 FileName: string; 214 211 begin … … 220 217 Exit; 221 218 end; 222 Quick := false;219 Quick := False; 223 220 if ParamCount > 0 then 224 221 begin 225 s:= ParamStr(1);226 if ( s[1] = '-') {$IFDEF WINDOWS}or (s[1] = '/'){$ENDIF} then222 S := ParamStr(1); 223 if (S[1] = '-') {$IFDEF WINDOWS}or (S[1] = '/'){$ENDIF} then 227 224 begin // special mode 228 Delete( s, 1, 1);229 for i := 1 to Length(s) do230 if s[i] in ['a' .. 'z'] then231 dec(s[i], 32);232 if s= 'MAN' then225 Delete(S, 1, 1); 226 for I := 1 to Length(S) do 227 if S[I] in ['a' .. 'z'] then 228 Dec(S[I], 32); 229 if S = 'MAN' then 233 230 begin 234 Quick := true;231 Quick := True; 235 232 DirectHelp(cHelpOnly); 236 233 Close; … … 242 239 Quick := True; 243 240 if not LoadGame(ExtractFilePath(ParamStr(1)), ExtractFileName(ParamStr(1) 244 ), -1, false) then begin241 ), -1, False) then begin 245 242 SimpleMessage(Phrases.Lookup('LOADERR')); 246 243 Close; … … 280 277 procedure TDirectDlg.FormPaint(Sender: TObject); 281 278 begin 282 PaintBackground( self, 3, 3, ClientWidth - 6, ClientHeight - 6);279 PaintBackground(Self, 3, 3, ClientWidth - 6, ClientHeight - 6); 283 280 Frame(Canvas, 0, 0, ClientWidth - 1, ClientHeight - 1, 0, 0); 284 281 Frame(Canvas, 1, 1, ClientWidth - 2, ClientHeight - 2, … … 297 294 end; 298 295 299 procedure TDirectDlg.SetInfo( x: string);300 begin 301 Info := x;296 procedure TDirectDlg.SetInfo(X: string); 297 begin 298 Info := X; 302 299 Invalidate; 303 300 Update; 304 {$IFDEF LINUX}301 {$IFDEF UNIX} 305 302 DpiApplication.ProcessMessages; 306 303 {$ENDIF} 307 304 end; 308 305 309 procedure TDirectDlg.SetState( x: integer);310 begin 311 if ( x< 0) <> (State < 0) then begin312 State := x;306 procedure TDirectDlg.SetState(X: Integer); 307 begin 308 if (X < 0) <> (State < 0) then begin 309 State := X; 313 310 Invalidate; 314 311 Update; 315 312 end 316 else if x<> State then begin317 State := x;313 else if X <> State then begin 314 State := X; 318 315 PaintProgressBar(Canvas, 6, ClientWidth div 2 - 64, 40, State, 128 - State, 319 316 128, MainTexture);
Note:
See TracChangeset
for help on using the changeset viewer.