diff --git a/android-client/theme/make-style.ps1 b/android-client/theme/make-style.ps1 new file mode 100644 index 0000000..dc5b7d4 --- /dev/null +++ b/android-client/theme/make-style.ps1 @@ -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" diff --git a/android-client/theme/pm-dark.style b/android-client/theme/pm-dark.style index cdf1d27..b8031cb 100644 --- a/android-client/theme/pm-dark.style +++ b/android-client/theme/pm-dark.style @@ -1,4 +1,4 @@ -object TLayout +object TLayout Align = Client Height = 715.000000000000000000 Position.Y = 33.000000000000000000 @@ -2075,18 +2075,18 @@ object TLayout object TRectangle StyleName = 'background' Align = Contents - Fill.Color = xFF333333 + Fill.Color = xFF1E293B Locked = True Height = 22.000000000000000000 HitTest = False - Stroke.Color = xFF202020 - XRadius = 1.000000000000000000 - YRadius = 1.000000000000000000 + Stroke.Color = xFF334155 + XRadius = 10.000000000000000000 + YRadius = 10.000000000000000000 Width = 107.000000000000000000 end object TBrushObject StyleName = 'foreground' - Brush.Color = xFFEAEAEA + Brush.Color = xFFE2E8F0 end object TBrushObject StyleName = 'selection' @@ -2509,7 +2509,7 @@ object TLayout object TRectangle StyleName = 'background' Align = Contents - Fill.Color = xFF333333 + Fill.Color = xFF1E293B Locked = True Height = 131.000000000000000000 HitTest = False @@ -2517,9 +2517,9 @@ object TLayout Padding.Top = 2.000000000000000000 Padding.Right = 2.000000000000000000 Padding.Bottom = 2.000000000000000000 - Stroke.Color = xFF202020 - XRadius = 2.000000000000000000 - YRadius = 2.000000000000000000 + Stroke.Color = xFF334155 + XRadius = 10.000000000000000000 + YRadius = 10.000000000000000000 Width = 334.000000000000000000 object TLayout StyleName = 'content' diff --git a/mainApk.pas b/mainApk.pas index 6d32920..e5f97f5 100644 --- a/mainApk.pas +++ b/mainApk.pas @@ -90,7 +90,7 @@ type // --- ecran 1 : deverrouillage FLayUnlock: TLayout; FUrl, FToken, FPwd: TEdit; - FBtnOpen, FBtnSync, FBtnSettings: TRectangle; + FBtnOpen, FBtnSync, FBtnSettings, FBtnLog: TRectangle; FLaySettings: TLayout; FStatus: TLabel; FLog: TMemo; @@ -176,6 +176,7 @@ type procedure OnCopyTap(Sender: TObject); procedure OnBackTap(Sender: TObject); procedure OnToggleSettings(Sender: TObject); + procedure OnToggleLog(Sender: TObject); procedure OnClipTimer(Sender: TObject); procedure OnHardwareBack(Sender: TObject; var Key: Word; var KeyChar: WideChar; Shift: TShiftState); @@ -298,6 +299,7 @@ end; procedure TForm8.BuildUnlock; var LUrl, LToken: string; + LRow: TLayout; begin FLayUnlock := TLayout.Create(Self); FLayUnlock.Parent := Self; @@ -316,6 +318,9 @@ begin FLog.WordWrap := True; FLog.TextSettings.Font.Family := 'monospace'; 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) FLaySettings := TLayout.Create(Self); @@ -334,8 +339,21 @@ begin if LToken <> '' then FToken.Text := LToken; end; - FBtnSettings := TopButton(FLayUnlock, 'Reglages du serveur', - OnToggleSettings, 40); + // Deux commandes discretes cote a cote : elles ne servent qu'au reglage et + // 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); // Accentue : c'est l'action attendue quand aucun coffre n'est encore la. @@ -766,6 +784,11 @@ begin FLaySettings.Visible := not FLaySettings.Visible; end; +procedure TForm8.OnToggleLog(Sender: TObject); +begin + FLog.Visible := not FLog.Visible; +end; + { ---------------------------------------------------------------------------- Ouverture, synchronisation, verrouillage ---------------------------------------------------------------------------- }