feat(fillbar): option fond transparent (cle de couleur), l'opacite reste sur les boutons
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -174,6 +174,8 @@ type
|
||||
// Barrette en icones (police Segoe MDL2 Assets) plutot qu'en mots, et sa
|
||||
// largeur reelle - elle depend des boutons choisis dans les reglages.
|
||||
FLazyIcons: Boolean;
|
||||
// Fond de la barrette retire (cle de couleur) : seuls les boutons restent.
|
||||
FLazyClear: Boolean;
|
||||
FLazyW: Integer;
|
||||
procedure LazyWindowHandler(var AMsg: TMessage);
|
||||
// Corps extraits des raccourcis Ctrl+Shift+A et Ctrl+Shift+Q : la barrette
|
||||
@@ -446,6 +448,7 @@ const
|
||||
LAZY_ID_SETTINGS = 108; // reglages, onglet Fill bar
|
||||
LAZY_MENU_ICONS = 1; // hors des valeurs d'opacite (25..100) du meme menu
|
||||
LAZY_MENU_SETTINGS = 2;
|
||||
LAZY_MENU_CLEAR = 3;
|
||||
// LE SONDAGE PLUTOT QUE TrackMouseEvent. La barrette a quatre fenetres
|
||||
// enfants : passer d'elle a un bouton envoie deja un WM_MOUSELEAVE au parent,
|
||||
// et il faudrait donc suivre la souris sur les cinq fenetres pour recoller
|
||||
@@ -469,6 +472,12 @@ const
|
||||
LAZY_BTNS_KEY = 'lazyButtons';
|
||||
LAZY_BTNS_DEFAULT = 'full,pwd,totp,add,search,open,settings';
|
||||
LAZY_ICONS_KEY = 'lazyIcons';
|
||||
// FOND TRANSPARENT : peint dans une couleur qu'aucun theme n'emploie, puis
|
||||
// declaree cle (LWA_COLORKEY) - ces pixels ne sont plus dessines du tout, et
|
||||
// les clics y TRAVERSENT. On traine donc la barrette par ses boutons
|
||||
// (DragDetect), le fond n'etant plus la pour etre saisi.
|
||||
LAZY_CLEAR_KEY = 'lazyClear';
|
||||
LAZY_KEY_COLOR = $00FF00FF;
|
||||
LAZY_H = 40;
|
||||
|
||||
// Palette de la barrette, en COLORREF ($00BBGGRR - les octets sont INVERSES
|
||||
@@ -1267,15 +1276,22 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPMBridge.ApplyLazyAlpha(AHover: Boolean);
|
||||
var
|
||||
LAlpha: Byte;
|
||||
begin
|
||||
if FLazyWnd = 0 then Exit;
|
||||
// TRANSPARENTE N'EST PAS TRAVERSANTE : la barrette continue d'avaler les
|
||||
// clics sur toute sa surface. C'est un allegement du regard, pas un passage.
|
||||
// Le pourcentage s'applique toujours aux boutons, fond retire ou non.
|
||||
if AHover or (FLazyAlphaPct >= 100) then
|
||||
SetLayeredWindowAttributes(FLazyWnd, 0, 255, LWA_ALPHA)
|
||||
LAlpha := 255
|
||||
else
|
||||
SetLayeredWindowAttributes(FLazyWnd, 0,
|
||||
MulDiv(255, FLazyAlphaPct, 100), LWA_ALPHA);
|
||||
LAlpha := MulDiv(255, FLazyAlphaPct, 100);
|
||||
if FLazyClear then
|
||||
SetLayeredWindowAttributes(FLazyWnd, LAZY_KEY_COLOR, LAlpha,
|
||||
LWA_ALPHA or LWA_COLORKEY)
|
||||
else
|
||||
SetLayeredWindowAttributes(FLazyWnd, 0, LAlpha, LWA_ALPHA);
|
||||
end;
|
||||
|
||||
procedure TPMBridge.ShowLazyMenu;
|
||||
@@ -1298,6 +1314,8 @@ begin
|
||||
if FLazyIcons then LIconsLabel := 'Show text' else LIconsLabel := 'Show icons';
|
||||
AppendMenu(LMenu, MF_SEPARATOR, 0, nil);
|
||||
AppendMenu(LMenu, MF_STRING, LAZY_MENU_ICONS, PChar(LIconsLabel));
|
||||
AppendMenu(LMenu, MF_STRING or IfThen(FLazyClear, MF_CHECKED, MF_UNCHECKED),
|
||||
LAZY_MENU_CLEAR, 'Transparent background');
|
||||
AppendMenu(LMenu, MF_STRING, LAZY_MENU_SETTINGS, 'Fill bar settings...');
|
||||
|
||||
// LE BATTEMENT DOIT S'ARRETER PENDANT LE MENU. Il repose la barrette en
|
||||
@@ -1321,6 +1339,11 @@ begin
|
||||
if Assigned(FOnTrayRestore) then FOnTrayRestore();
|
||||
if Assigned(FOnFillBarSettings) then FOnFillBarSettings();
|
||||
end
|
||||
else if LCmd = LAZY_MENU_CLEAR then
|
||||
begin
|
||||
if FLazyClear then SetPref(LAZY_CLEAR_KEY, '0') else SetPref(LAZY_CLEAR_KEY, '1');
|
||||
ReloadLazyBar;
|
||||
end
|
||||
else if LCmd = LAZY_MENU_ICONS then
|
||||
begin
|
||||
if FLazyIcons then SetPref(LAZY_ICONS_KEY, '0') else SetPref(LAZY_ICONS_KEY, '1');
|
||||
@@ -1403,6 +1426,14 @@ begin
|
||||
WM_ERASEBKGND:
|
||||
begin
|
||||
GetClientRect(FLazyWnd, LRect);
|
||||
if FLazyClear then
|
||||
begin
|
||||
LBrush := CreateSolidBrush(LAZY_KEY_COLOR);
|
||||
FillRect(HDC(AMsg.WParam), LRect, LBrush);
|
||||
DeleteObject(LBrush);
|
||||
AMsg.Result := 1;
|
||||
Exit;
|
||||
end;
|
||||
LBrush := CreateSolidBrush(IfThen(FDarkTheme, LAZY_DARK_BG, LAZY_LITE_BG));
|
||||
FillRect(HDC(AMsg.WParam), LRect, LBrush);
|
||||
DeleteObject(LBrush);
|
||||
@@ -1580,6 +1611,7 @@ begin
|
||||
FLazyAlphaPct := LAZY_ALPHA_DEFAULT;
|
||||
|
||||
FLazyIcons := GetPref(LAZY_ICONS_KEY) = '1';
|
||||
FLazyClear := GetPref(LAZY_CLEAR_KEY) = '1';
|
||||
LList := GetPref(LAZY_BTNS_KEY);
|
||||
if LList = '' then LList := LAZY_BTNS_DEFAULT;
|
||||
InitCommonControls;
|
||||
|
||||
Reference in New Issue
Block a user