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
|
// Barrette en icones (police Segoe MDL2 Assets) plutot qu'en mots, et sa
|
||||||
// largeur reelle - elle depend des boutons choisis dans les reglages.
|
// largeur reelle - elle depend des boutons choisis dans les reglages.
|
||||||
FLazyIcons: Boolean;
|
FLazyIcons: Boolean;
|
||||||
|
// Fond de la barrette retire (cle de couleur) : seuls les boutons restent.
|
||||||
|
FLazyClear: Boolean;
|
||||||
FLazyW: Integer;
|
FLazyW: Integer;
|
||||||
procedure LazyWindowHandler(var AMsg: TMessage);
|
procedure LazyWindowHandler(var AMsg: TMessage);
|
||||||
// Corps extraits des raccourcis Ctrl+Shift+A et Ctrl+Shift+Q : la barrette
|
// 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_ID_SETTINGS = 108; // reglages, onglet Fill bar
|
||||||
LAZY_MENU_ICONS = 1; // hors des valeurs d'opacite (25..100) du meme menu
|
LAZY_MENU_ICONS = 1; // hors des valeurs d'opacite (25..100) du meme menu
|
||||||
LAZY_MENU_SETTINGS = 2;
|
LAZY_MENU_SETTINGS = 2;
|
||||||
|
LAZY_MENU_CLEAR = 3;
|
||||||
// LE SONDAGE PLUTOT QUE TrackMouseEvent. La barrette a quatre fenetres
|
// LE SONDAGE PLUTOT QUE TrackMouseEvent. La barrette a quatre fenetres
|
||||||
// enfants : passer d'elle a un bouton envoie deja un WM_MOUSELEAVE au parent,
|
// 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
|
// et il faudrait donc suivre la souris sur les cinq fenetres pour recoller
|
||||||
@@ -469,6 +472,12 @@ const
|
|||||||
LAZY_BTNS_KEY = 'lazyButtons';
|
LAZY_BTNS_KEY = 'lazyButtons';
|
||||||
LAZY_BTNS_DEFAULT = 'full,pwd,totp,add,search,open,settings';
|
LAZY_BTNS_DEFAULT = 'full,pwd,totp,add,search,open,settings';
|
||||||
LAZY_ICONS_KEY = 'lazyIcons';
|
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;
|
LAZY_H = 40;
|
||||||
|
|
||||||
// Palette de la barrette, en COLORREF ($00BBGGRR - les octets sont INVERSES
|
// Palette de la barrette, en COLORREF ($00BBGGRR - les octets sont INVERSES
|
||||||
@@ -1267,15 +1276,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPMBridge.ApplyLazyAlpha(AHover: Boolean);
|
procedure TPMBridge.ApplyLazyAlpha(AHover: Boolean);
|
||||||
|
var
|
||||||
|
LAlpha: Byte;
|
||||||
begin
|
begin
|
||||||
if FLazyWnd = 0 then Exit;
|
if FLazyWnd = 0 then Exit;
|
||||||
// TRANSPARENTE N'EST PAS TRAVERSANTE : la barrette continue d'avaler les
|
// 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.
|
// 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
|
if AHover or (FLazyAlphaPct >= 100) then
|
||||||
SetLayeredWindowAttributes(FLazyWnd, 0, 255, LWA_ALPHA)
|
LAlpha := 255
|
||||||
else
|
else
|
||||||
SetLayeredWindowAttributes(FLazyWnd, 0,
|
LAlpha := MulDiv(255, FLazyAlphaPct, 100);
|
||||||
MulDiv(255, FLazyAlphaPct, 100), LWA_ALPHA);
|
if FLazyClear then
|
||||||
|
SetLayeredWindowAttributes(FLazyWnd, LAZY_KEY_COLOR, LAlpha,
|
||||||
|
LWA_ALPHA or LWA_COLORKEY)
|
||||||
|
else
|
||||||
|
SetLayeredWindowAttributes(FLazyWnd, 0, LAlpha, LWA_ALPHA);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPMBridge.ShowLazyMenu;
|
procedure TPMBridge.ShowLazyMenu;
|
||||||
@@ -1298,6 +1314,8 @@ begin
|
|||||||
if FLazyIcons then LIconsLabel := 'Show text' else LIconsLabel := 'Show icons';
|
if FLazyIcons then LIconsLabel := 'Show text' else LIconsLabel := 'Show icons';
|
||||||
AppendMenu(LMenu, MF_SEPARATOR, 0, nil);
|
AppendMenu(LMenu, MF_SEPARATOR, 0, nil);
|
||||||
AppendMenu(LMenu, MF_STRING, LAZY_MENU_ICONS, PChar(LIconsLabel));
|
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...');
|
AppendMenu(LMenu, MF_STRING, LAZY_MENU_SETTINGS, 'Fill bar settings...');
|
||||||
|
|
||||||
// LE BATTEMENT DOIT S'ARRETER PENDANT LE MENU. Il repose la barrette en
|
// 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(FOnTrayRestore) then FOnTrayRestore();
|
||||||
if Assigned(FOnFillBarSettings) then FOnFillBarSettings();
|
if Assigned(FOnFillBarSettings) then FOnFillBarSettings();
|
||||||
end
|
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
|
else if LCmd = LAZY_MENU_ICONS then
|
||||||
begin
|
begin
|
||||||
if FLazyIcons then SetPref(LAZY_ICONS_KEY, '0') else SetPref(LAZY_ICONS_KEY, '1');
|
if FLazyIcons then SetPref(LAZY_ICONS_KEY, '0') else SetPref(LAZY_ICONS_KEY, '1');
|
||||||
@@ -1403,6 +1426,14 @@ begin
|
|||||||
WM_ERASEBKGND:
|
WM_ERASEBKGND:
|
||||||
begin
|
begin
|
||||||
GetClientRect(FLazyWnd, LRect);
|
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));
|
LBrush := CreateSolidBrush(IfThen(FDarkTheme, LAZY_DARK_BG, LAZY_LITE_BG));
|
||||||
FillRect(HDC(AMsg.WParam), LRect, LBrush);
|
FillRect(HDC(AMsg.WParam), LRect, LBrush);
|
||||||
DeleteObject(LBrush);
|
DeleteObject(LBrush);
|
||||||
@@ -1580,6 +1611,7 @@ begin
|
|||||||
FLazyAlphaPct := LAZY_ALPHA_DEFAULT;
|
FLazyAlphaPct := LAZY_ALPHA_DEFAULT;
|
||||||
|
|
||||||
FLazyIcons := GetPref(LAZY_ICONS_KEY) = '1';
|
FLazyIcons := GetPref(LAZY_ICONS_KEY) = '1';
|
||||||
|
FLazyClear := GetPref(LAZY_CLEAR_KEY) = '1';
|
||||||
LList := GetPref(LAZY_BTNS_KEY);
|
LList := GetPref(LAZY_BTNS_KEY);
|
||||||
if LList = '' then LList := LAZY_BTNS_DEFAULT;
|
if LList = '' then LList := LAZY_BTNS_DEFAULT;
|
||||||
InitCommonControls;
|
InitCommonControls;
|
||||||
|
|||||||
@@ -1347,6 +1347,7 @@ begin
|
|||||||
LFb.AddPair('buttons', PM.UserPrefs.GetPref('lazyButtons'));
|
LFb.AddPair('buttons', PM.UserPrefs.GetPref('lazyButtons'));
|
||||||
LFb.AddPair('icons', TJSONBool.Create(PM.UserPrefs.GetPref('lazyIcons') = '1'));
|
LFb.AddPair('icons', TJSONBool.Create(PM.UserPrefs.GetPref('lazyIcons') = '1'));
|
||||||
LFb.AddPair('alpha', PM.UserPrefs.GetPref('lazyAlphaPct'));
|
LFb.AddPair('alpha', PM.UserPrefs.GetPref('lazyAlphaPct'));
|
||||||
|
LFb.AddPair('clear', TJSONBool.Create(PM.UserPrefs.GetPref('lazyClear') = '1'));
|
||||||
WebBrowser.ExecuteJavaScript(
|
WebBrowser.ExecuteJavaScript(
|
||||||
'if(window.Bridge&&Bridge.onFillBar)Bridge.onFillBar(' + LFb.ToJSON + ')');
|
'if(window.Bridge&&Bridge.onFillBar)Bridge.onFillBar(' + LFb.ToJSON + ')');
|
||||||
finally
|
finally
|
||||||
@@ -1359,6 +1360,8 @@ begin
|
|||||||
PM.UserPrefs.SetPref('lazyButtons', GetParam('buttons'));
|
PM.UserPrefs.SetPref('lazyButtons', GetParam('buttons'));
|
||||||
if GetParam('icons') = '1' then PM.UserPrefs.SetPref('lazyIcons', '1')
|
if GetParam('icons') = '1' then PM.UserPrefs.SetPref('lazyIcons', '1')
|
||||||
else PM.UserPrefs.SetPref('lazyIcons', '0');
|
else PM.UserPrefs.SetPref('lazyIcons', '0');
|
||||||
|
if GetParam('clear') = '1' then PM.UserPrefs.SetPref('lazyClear', '1')
|
||||||
|
else PM.UserPrefs.SetPref('lazyClear', '0');
|
||||||
var LAlpha := StrToIntDef(GetParam('alpha'), 60);
|
var LAlpha := StrToIntDef(GetParam('alpha'), 60);
|
||||||
if (LAlpha >= 25) and (LAlpha <= 100) then
|
if (LAlpha >= 25) and (LAlpha <= 100) then
|
||||||
PM.UserPrefs.SetPref('lazyAlphaPct', IntToStr(LAlpha));
|
PM.UserPrefs.SetPref('lazyAlphaPct', IntToStr(LAlpha));
|
||||||
|
|||||||
+10
@@ -785,6 +785,16 @@
|
|||||||
<option value="25">25%</option>
|
<option value="25">25%</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="setting-row">
|
||||||
|
<span>
|
||||||
|
Transparent background
|
||||||
|
<small class="setting-hint">Only the buttons stay visible. Drag the bar by a button.</small>
|
||||||
|
</span>
|
||||||
|
<label class="toggle">
|
||||||
|
<input type="checkbox" id="fbClear">
|
||||||
|
<span class="toggle-slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="slideover-field">
|
<div class="slideover-field">
|
||||||
|
|||||||
@@ -6710,6 +6710,7 @@ Bridge.onFillBar = function (st) {
|
|||||||
$$('.fb-btn').forEach(c => { c.checked = keys.includes(c.dataset.key); });
|
$$('.fb-btn').forEach(c => { c.checked = keys.includes(c.dataset.key); });
|
||||||
$('#fbStyle').value = st.icons ? 'icons' : 'text';
|
$('#fbStyle').value = st.icons ? 'icons' : 'text';
|
||||||
$('#fbAlpha').value = String(parseInt(st.alpha, 10) || 60);
|
$('#fbAlpha').value = String(parseInt(st.alpha, 10) || 60);
|
||||||
|
$('#fbClear').checked = !!st.clear;
|
||||||
};
|
};
|
||||||
// Clic droit sur la barrette -> "Fill bar settings..." : l'exe a deja ramene la
|
// Clic droit sur la barrette -> "Fill bar settings..." : l'exe a deja ramene la
|
||||||
// fenetre. Les reglages s'ouvrent PAR-DESSUS une entree en cours d'edition,
|
// fenetre. Les reglages s'ouvrent PAR-DESSUS une entree en cours d'edition,
|
||||||
@@ -6728,7 +6729,8 @@ function fillBarPush() {
|
|||||||
+ '?on=' + ($('#fbOn').checked ? '1' : '0')
|
+ '?on=' + ($('#fbOn').checked ? '1' : '0')
|
||||||
+ '&buttons=' + encodeURIComponent(keys.join(',') || 'none')
|
+ '&buttons=' + encodeURIComponent(keys.join(',') || 'none')
|
||||||
+ '&icons=' + ($('#fbStyle').value === 'icons' ? '1' : '0')
|
+ '&icons=' + ($('#fbStyle').value === 'icons' ? '1' : '0')
|
||||||
+ '&alpha=' + encodeURIComponent($('#fbAlpha').value);
|
+ '&alpha=' + encodeURIComponent($('#fbAlpha').value)
|
||||||
|
+ '&clear=' + ($('#fbClear').checked ? '1' : '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
function openSettings() {
|
function openSettings() {
|
||||||
@@ -8242,7 +8244,7 @@ async function init() {
|
|||||||
if (syncTest) syncTest.addEventListener('click', syncTestConnection);
|
if (syncTest) syncTest.addEventListener('click', syncTestConnection);
|
||||||
const syncQr = document.getElementById('syncQrBtn');
|
const syncQr = document.getElementById('syncQrBtn');
|
||||||
if (syncQr) syncQr.addEventListener('click', syncQrToggle);
|
if (syncQr) syncQr.addEventListener('click', syncQrToggle);
|
||||||
['#fbOn', '#fbStyle', '#fbAlpha'].forEach(sel => {
|
['#fbOn', '#fbStyle', '#fbAlpha', '#fbClear'].forEach(sel => {
|
||||||
const el = $(sel);
|
const el = $(sel);
|
||||||
if (el) el.addEventListener('change', fillBarPush);
|
if (el) el.addEventListener('change', fillBarPush);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user