Changeset 465 for branches/highdpi/LocalPlayer/Rates.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Rates.pas
r361 r465 5 5 6 6 uses 7 UDpiControls, Protocol, ScreenTools, BaseWin, LCLIntf, LCLType, 8 9 SysUtils, Classes, Graphics, Controls, Forms, 10 ButtonB, ButtonC; 7 UDpiControls, Protocol, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils, Classes, Graphics, 8 Controls, Forms, ButtonB, ButtonC; 11 9 12 10 type … … 23 21 public 24 22 procedure OffscreenPaint; override; 25 procedure ShowNewContent(NewMode: integer); 26 end; 27 28 var 29 RatesDlg: TRatesDlg; 23 procedure ShowNewContent(NewMode: TWindowMode); 24 end; 25 30 26 31 27 implementation … … 47 43 procedure TRatesDlg.OffscreenPaint; 48 44 var 49 p, x, y, current, max, i: integer;50 s, s1: string;45 P, X, Y, current, Max, I: Integer; 46 S, s1: string; 51 47 begin 52 48 if (OffscreenUser <> nil) and (OffscreenUser <> self) then … … 65 61 BtnFrame(Offscreen.Canvas, CloseBtn.BoundsRect, MainTexture); 66 62 Offscreen.Canvas.Font.Assign(UniFont[ftCaption]); 67 s:= Phrases.Lookup('TITLE_RATES');63 S := Phrases.Lookup('TITLE_RATES'); 68 64 RisedTextOut(Offscreen.Canvas, 69 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s)) div 2 - 1, 7, s);70 71 if MyRO.Wonder[woLiberty].EffectiveOwner = me then72 s:= Phrases.Lookup('NORATES')73 else 74 s:= Phrases.Lookup('RATES');65 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2 - 1, 7, S); 66 67 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 68 S := Phrases.Lookup('NORATES') 69 else 70 S := Phrases.Lookup('RATES'); 75 71 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 76 p := pos('\', s);77 if p= 0 then78 RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, s))79 div 2, 114, s)80 else 81 begin 82 s1 := copy(s, 1, p- 1);72 P := Pos('\', S); 73 if P = 0 then 74 RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) 75 div 2, 114, S) 76 else 77 begin 78 s1 := Copy(S, 1, P - 1); 83 79 RisedTextOut(Offscreen.Canvas, 84 80 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2, 85 81 114 - MessageLineSpacing div 2, s1); 86 s1 := copy(s, p+ 1, 255);82 s1 := Copy(S, P + 1, 255); 87 83 RisedTextOut(Offscreen.Canvas, 88 84 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2, … … 91 87 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 92 88 93 if MyRO.Wonder[woLiberty].EffectiveOwner = me then89 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 94 90 begin 95 91 GlowFrame(Offscreen, ClientWidth div 2 - xSizeBig div 2, 52, xSizeBig, 96 ySizeBig, Tribe[ me].Color);97 DpiBit Canvas(Offscreen.Canvas, ClientWidth div 2 - xSizeBig div 2, 52,92 ySizeBig, Tribe[Me].Color); 93 DpiBitBltCanvas(Offscreen.Canvas, ClientWidth div 2 - xSizeBig div 2, 52, 98 94 xSizeBig, ySizeBig, BigImp.Canvas, (woLiberty mod 7) * xSizeBig, 99 95 (woLiberty div 7 + SystemIconLines) * ySizeBig); … … 103 99 // ImageOp_CBC(Offscreen,Templates,260,40,145,112,36,36,$404000,$8B8BEB); 104 100 105 s:= Phrases.Lookup('SCIENCE');106 RisedTextOut(Offscreen.Canvas, 107 16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 44, s);108 s:= Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]);109 RisedTextOut(Offscreen.Canvas, 110 16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 60, s);101 S := Phrases.Lookup('SCIENCE'); 102 RisedTextOut(Offscreen.Canvas, 103 16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 44, S); 104 S := Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]); 105 RisedTextOut(Offscreen.Canvas, 106 16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 60, S); 111 107 // PaintProgressBar(Offscreen.Canvas,2,16,81,(100-MyRO.LuxRate-MyRO.TaxRate)*120 div 100,0,120,MainTexture); 112 108 113 109 // reverse progress bar for science 114 x:= 16;115 y:= 81;110 X := 16; 111 Y := 81; 116 112 current := (100 - MyRO.LuxRate - MyRO.TaxRate) * 120 div 100; 117 max := 120;118 Frame(Offscreen.Canvas, x - 1, y - 1, x + max, y+ 7, $000000, $000000);119 RFrame(Offscreen.Canvas, x - 2, y - 2, x + max + 1, y+ 8,113 Max := 120; 114 Frame(Offscreen.Canvas, X - 1, Y - 1, X + Max, Y + 7, $000000, $000000); 115 RFrame(Offscreen.Canvas, X - 2, Y - 2, X + Max + 1, Y + 8, 120 116 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 121 117 with Offscreen.Canvas do 122 118 begin 123 for i:= 0 to current div 8 - 1 do124 DpiBit Canvas(Offscreen.Canvas, x + max - 8 - i * 8, y, 8, 7,119 for I := 0 to current div 8 - 1 do 120 DpiBitBltCanvas(Offscreen.Canvas, X + Max - 8 - I * 8, Y, 8, 7, 125 121 HGrSystem.Data.Canvas, 104, 9 + 8 * 2); 126 DpiBit Canvas(Offscreen.Canvas, x + max - current, y, current - 8 * (current div 8), 7,122 DpiBitBltCanvas(Offscreen.Canvas, X + Max - current, Y, current - 8 * (current div 8), 7, 127 123 HGrSystem.Data.Canvas, 104, 9 + 8 * 2); 128 124 Brush.Color := $000000; 129 FillRect(Rect( x, y, x + max - current, y+ 7));125 FillRect(Rect(X, Y, X + Max - current, Y + 7)); 130 126 Brush.Style := bsClear; 131 127 end; 132 128 133 129 RisedTextOut(Offscreen.Canvas, 16 + 160, 44, Phrases.Lookup('LUX')); 134 s:= Format('%d%%', [MyRO.LuxRate]);135 RisedTextOut(Offscreen.Canvas, 136 16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, s);130 S := Format('%d%%', [MyRO.LuxRate]); 131 RisedTextOut(Offscreen.Canvas, 132 16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, S); 137 133 PaintProgressBar(Offscreen.Canvas, 5, 16 + 160, 81, 138 134 MyRO.LuxRate * 120 div 100, 0, 120, MainTexture); … … 145 141 MainTexture.ColorBevelLight); 146 142 RisedTextOut(Offscreen.Canvas, 16 + 80, 164, Phrases.Lookup('TAXRATE')); 147 s:= Format('%d%%', [MyRO.TaxRate]);143 S := Format('%d%%', [MyRO.TaxRate]); 148 144 RisedTextOut(Offscreen.Canvas, 149 16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, s);145 16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, S); 150 146 PaintProgressBar(Offscreen.Canvas, 0, 16 + 80, 201, 151 147 MyRO.TaxRate * 120 div 100, 0, 120, MainTexture); … … 157 153 end; 158 154 159 procedure TRatesDlg.ShowNewContent(NewMode: integer);155 procedure TRatesDlg.ShowNewContent(NewMode: TWindowMode); 160 156 begin 161 157 inherited ShowNewContent(NewMode); … … 164 160 procedure TRatesDlg.FormShow(Sender: TObject); 165 161 begin 166 if MyRO.Wonder[woLiberty].EffectiveOwner = me then 167 begin 168 ScienceBtn.Visible := false; 169 LuxBtn.Visible := false; 162 Caption := Phrases.Lookup('TITLE_RATES'); 163 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 164 begin 165 ScienceBtn.Visible := False; 166 LuxBtn.Visible := False; 170 167 end 171 168 else 172 169 begin 173 ScienceBtn.Visible := true;174 LuxBtn.Visible := true;170 ScienceBtn.Visible := True; 171 LuxBtn.Visible := True; 175 172 end; 176 173 OffscreenPaint; … … 184 181 procedure TRatesDlg.TaxLuxBtnClick(Sender: TObject); 185 182 var 186 NewTax, NewLux: integer;183 NewTax, NewLux: Integer; 187 184 begin 188 185 NewTax := MyRO.TaxRate div 10; … … 191 188 begin 192 189 if NewTax < 10 then 193 inc(NewTax);190 Inc(NewTax); 194 191 if NewTax + NewLux > 10 then 195 dec(NewLux);192 Dec(NewLux); 196 193 end 197 194 else if (Sender = TaxDownBtn) and (NewTax > 0) then 198 dec(NewTax)195 Dec(NewTax) 199 196 else if (Sender = ScienceBtn) and (NewLux > 0) then 200 dec(NewLux)197 Dec(NewLux) 201 198 else if (Sender = LuxBtn) and (NewLux + NewTax < 100) then 202 inc(NewLux);203 if Server(sSetRates, me, NewTax + NewLux shl 4, nil^) <> eNotChanged then199 Inc(NewLux); 200 if Server(sSetRates, Me, NewTax + NewLux shl 4, nil^) <> eNotChanged then 204 201 begin 205 202 CityOptimizer_BeginOfTurn; 206 203 SmartUpdateContent; 207 MainScreen.UpdateViews( true);204 MainScreen.UpdateViews(True); 208 205 end; 209 206 end;
Note:
See TracChangeset
for help on using the changeset viewer.