feat(android): recolour the two native controls, and hide the log by default

Dark.style has no transparent template for an edit or a memo, so a StyleLookup at them fell back silently to the normal one and its grey background - the search field and the log were the last two things clashing with a painted interface. Since the style is vendored anyway, make-style.ps1 rebuilds it from Delphi's with those two backgrounds set to the palette. Reproducible, so a palette change does not quietly lose the patch.

The log is hidden now: it only serves diagnosis and it was taking a third of the screen at every launch. A Journal button beside the server settings brings it back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-08-15 17:43:52 +01:00
parent 5a2774974a
commit e8e305b6fd
3 changed files with 89 additions and 13 deletions
+53
View File
@@ -0,0 +1,53 @@
# Fabrique pm-dark.style depuis le Dark.style livre avec Delphi, en recolorant
# les deux controles dont le fond reste visible.
#
# POURQUOI PATCHER PLUTOT QUE RENDRE TRANSPARENT : Dark.style ne contient aucun
# gabarit 'transparentedit' ni 'transparentmemostyle' - un StyleLookup vers eux
# retombe silencieusement sur le gabarit normal, avec son fond gris. Le champ
# de recherche et le journal juraient donc avec le reste de l'interface, qui
# est peint.
#
# Tout le reste de l'application ne depend plus d'aucun gabarit : ce style ne
# sert qu'aux controles natifs qu'on ne reecrit pas.
#
# A relancer si la palette de PMA.Theme change, puis recompiler la ressource :
# brcc32 theme.rc -fotheme.res
$ErrorActionPreference = 'Stop'
$src = 'C:\Program Files (x86)\Embarcadero\Studio\23.0\Redist\styles\Fmx\Dark.style'
$dst = Join-Path $PSScriptRoot 'pm-dark.style'
# Doivent suivre les constantes de PMA.Theme.
$surface = 'xFF1E293B' # COL_SURFACE
$border = 'xFF334155' # COL_RAISED, en bordure discrete
$text = 'xFFE2E8F0' # COL_TEXT
$lines = Get-Content $src
$patched = 0
foreach ($style in 'editstyle', 'memostyle') {
$at = ($lines | Select-String -Pattern "StyleName = '$style'" | Select-Object -First 1).LineNumber
if (-not $at) { Write-Warning "$style introuvable"; continue }
# La fenetre couvre le bloc 'background' qui suit immediatement le nom.
for ($i = $at; $i -lt [Math]::Min($at + 24, $lines.Count); $i++) {
switch -Regex ($lines[$i]) {
'Fill\.Color = x' { $lines[$i] = $lines[$i] -replace 'x[0-9A-Fa-f]{8}', $surface; $patched++ }
'Stroke\.Color = x' { $lines[$i] = $lines[$i] -replace 'x[0-9A-Fa-f]{8}', $border; $patched++ }
'XRadius = ' { $lines[$i] = $lines[$i] -replace '[\d.]+$', '10.000000000000000000' }
'YRadius = ' { $lines[$i] = $lines[$i] -replace '[\d.]+$', '10.000000000000000000' }
}
}
# Couleur du texte saisi : 'foreground' vient juste apres le fond.
for ($i = $at; $i -lt [Math]::Min($at + 34, $lines.Count); $i++) {
if ($lines[$i] -match "StyleName = 'foreground'") {
$lines[$i+1] = $lines[$i+1] -replace 'x[0-9A-Fa-f]{8}', $text
break
}
}
}
Set-Content $dst $lines -Encoding UTF8
"pm-dark.style ecrit, $patched couleurs remplacees"
+10 -10
View File
@@ -1,4 +1,4 @@
object TLayout object TLayout
Align = Client Align = Client
Height = 715.000000000000000000 Height = 715.000000000000000000
Position.Y = 33.000000000000000000 Position.Y = 33.000000000000000000
@@ -2075,18 +2075,18 @@ object TLayout
object TRectangle object TRectangle
StyleName = 'background' StyleName = 'background'
Align = Contents Align = Contents
Fill.Color = xFF333333 Fill.Color = xFF1E293B
Locked = True Locked = True
Height = 22.000000000000000000 Height = 22.000000000000000000
HitTest = False HitTest = False
Stroke.Color = xFF202020 Stroke.Color = xFF334155
XRadius = 1.000000000000000000 XRadius = 10.000000000000000000
YRadius = 1.000000000000000000 YRadius = 10.000000000000000000
Width = 107.000000000000000000 Width = 107.000000000000000000
end end
object TBrushObject object TBrushObject
StyleName = 'foreground' StyleName = 'foreground'
Brush.Color = xFFEAEAEA Brush.Color = xFFE2E8F0
end end
object TBrushObject object TBrushObject
StyleName = 'selection' StyleName = 'selection'
@@ -2509,7 +2509,7 @@ object TLayout
object TRectangle object TRectangle
StyleName = 'background' StyleName = 'background'
Align = Contents Align = Contents
Fill.Color = xFF333333 Fill.Color = xFF1E293B
Locked = True Locked = True
Height = 131.000000000000000000 Height = 131.000000000000000000
HitTest = False HitTest = False
@@ -2517,9 +2517,9 @@ object TLayout
Padding.Top = 2.000000000000000000 Padding.Top = 2.000000000000000000
Padding.Right = 2.000000000000000000 Padding.Right = 2.000000000000000000
Padding.Bottom = 2.000000000000000000 Padding.Bottom = 2.000000000000000000
Stroke.Color = xFF202020 Stroke.Color = xFF334155
XRadius = 2.000000000000000000 XRadius = 10.000000000000000000
YRadius = 2.000000000000000000 YRadius = 10.000000000000000000
Width = 334.000000000000000000 Width = 334.000000000000000000
object TLayout object TLayout
StyleName = 'content' StyleName = 'content'
+26 -3
View File
@@ -90,7 +90,7 @@ type
// --- ecran 1 : deverrouillage // --- ecran 1 : deverrouillage
FLayUnlock: TLayout; FLayUnlock: TLayout;
FUrl, FToken, FPwd: TEdit; FUrl, FToken, FPwd: TEdit;
FBtnOpen, FBtnSync, FBtnSettings: TRectangle; FBtnOpen, FBtnSync, FBtnSettings, FBtnLog: TRectangle;
FLaySettings: TLayout; FLaySettings: TLayout;
FStatus: TLabel; FStatus: TLabel;
FLog: TMemo; FLog: TMemo;
@@ -176,6 +176,7 @@ type
procedure OnCopyTap(Sender: TObject); procedure OnCopyTap(Sender: TObject);
procedure OnBackTap(Sender: TObject); procedure OnBackTap(Sender: TObject);
procedure OnToggleSettings(Sender: TObject); procedure OnToggleSettings(Sender: TObject);
procedure OnToggleLog(Sender: TObject);
procedure OnClipTimer(Sender: TObject); procedure OnClipTimer(Sender: TObject);
procedure OnHardwareBack(Sender: TObject; var Key: Word; procedure OnHardwareBack(Sender: TObject; var Key: Word;
var KeyChar: WideChar; Shift: TShiftState); var KeyChar: WideChar; Shift: TShiftState);
@@ -298,6 +299,7 @@ end;
procedure TForm8.BuildUnlock; procedure TForm8.BuildUnlock;
var var
LUrl, LToken: string; LUrl, LToken: string;
LRow: TLayout;
begin begin
FLayUnlock := TLayout.Create(Self); FLayUnlock := TLayout.Create(Self);
FLayUnlock.Parent := Self; FLayUnlock.Parent := Self;
@@ -316,6 +318,9 @@ begin
FLog.WordWrap := True; FLog.WordWrap := True;
FLog.TextSettings.Font.Family := 'monospace'; FLog.TextSettings.Font.Family := 'monospace';
FLog.TextSettings.Font.Size := 11; FLog.TextSettings.Font.Size := 11;
// Masque par defaut : il ne sert qu'au diagnostic, et il occupait un tiers
// de l'ecran a chaque lancement. Le bouton Journal le ramene.
FLog.Visible := False;
// --- du bas vers le haut (voir TopButton) // --- du bas vers le haut (voir TopButton)
FLaySettings := TLayout.Create(Self); FLaySettings := TLayout.Create(Self);
@@ -334,8 +339,21 @@ begin
if LToken <> '' then FToken.Text := LToken; if LToken <> '' then FToken.Text := LToken;
end; end;
FBtnSettings := TopButton(FLayUnlock, 'Reglages du serveur', // Deux commandes discretes cote a cote : elles ne servent qu'au reglage et
OnToggleSettings, 40); // au diagnostic, et n'ont pas a peser autant que les actions principales.
LRow := TLayout.Create(Self);
LRow.Parent := FLayUnlock;
LRow.Align := TAlignLayout.Top;
LRow.Height := 48;
LRow.Margins.Rect := RectF(16, 8, 16, 0);
FBtnLog := FlatButton(LRow, 'Journal', OnToggleLog);
FBtnLog.Align := TAlignLayout.Right;
FBtnLog.Width := 120;
FBtnLog.Margins.Left := 8;
FBtnSettings := FlatButton(LRow, 'Reglages du serveur', OnToggleSettings);
FBtnSettings.Align := TAlignLayout.Client;
FBtnSync := TopButton(FLayUnlock, 'Synchroniser', DoSync); FBtnSync := TopButton(FLayUnlock, 'Synchroniser', DoSync);
// Accentue : c'est l'action attendue quand aucun coffre n'est encore la. // Accentue : c'est l'action attendue quand aucun coffre n'est encore la.
@@ -766,6 +784,11 @@ begin
FLaySettings.Visible := not FLaySettings.Visible; FLaySettings.Visible := not FLaySettings.Visible;
end; end;
procedure TForm8.OnToggleLog(Sender: TObject);
begin
FLog.Visible := not FLog.Visible;
end;
{ ---------------------------------------------------------------------------- { ----------------------------------------------------------------------------
Ouverture, synchronisation, verrouillage Ouverture, synchronisation, verrouillage
---------------------------------------------------------------------------- } ---------------------------------------------------------------------------- }