Skip to content

armgit / WacOS

Public Imported from GitHub
0

A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.

Rust

Golden Gate theme, no more 32-bit host exe, Finder compress without PowerShell

Eternity07062835c1534551af
diff --git a/.gitignore b/.gitignore
index aa01833..f484ecb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,8 @@ docs/nativo-fontes-*.zip
# macOS 27 icons (Apple, exported by zagnut531): personal use, rebuilt by tools/icones-goldengate.py
icones/goldengate/
+
+# Mac OS X Leopard icons ("Leopard Icons" pack, downloaded by the user): personal use, rebuilt by tools/icones-leopard.py
+icones/leopard/
+# Mac OS X cursor pack (RaZcaLinSIDe), downloaded by the user: personal use, rebuilt by tools/cursor-leopard.py
+cursor/Leopard/
diff --git a/build.cmd b/build.cmd
index e7f46cc..9ac40e0 100644
--- a/build.cmd
+++ b/build.cmd
@@ -29,7 +29,7 @@ if not exist bin\ferramentas mkdir bin\ferramentas
rem icones e descricoes (VERSIONINFO) de cada programa
set "RES=bin\obj\res"
powershell -NoProfile -ExecutionPolicy Bypass -File tools\recursos.ps1 -Out %RES% >nul || exit /b 1
-for %%n in (WacOSShell WacOSFinder WacOSSettings WacOSActivityMonitor WacOSTerminal WacOSCalculator WacOSNotes WacOSScreenshot WacOSPreview WacOSReminders WacOSCalendar WacOSTextEdit WacOSClock WacOSWeather WacOSContacts WacOSPhotos WacOSTimeMachine WacOSMusic WacOSQuickTime WacOSForceQuit WacOSWindow32Host WacOSWindow WacOSWindow32) do (
+for %%n in (WacOSShell WacOSFinder WacOSSettings WacOSActivityMonitor WacOSTerminal WacOSCalculator WacOSNotes WacOSScreenshot WacOSPreview WacOSReminders WacOSCalendar WacOSTextEdit WacOSClock WacOSWeather WacOSContacts WacOSPhotos WacOSTimeMachine WacOSMusic WacOSQuickTime WacOSForceQuit WacOSWindow WacOSWindow32) do (
rc /nologo /fo %RES%\%%n.res %RES%\%%n.rc >nul || exit /b 1
)
@@ -44,12 +44,11 @@ if /i "%1"=="dialogo" (
)
if /i "%1"=="janelas" (
- rem barra de titulo do Mac nas janelas dos outros programas: DLL de 64 bits, e DLL + host de 32 bits
+ rem barra de titulo do Mac nas janelas dos outros programas: DLL de 64 bits e de 32 (esta roda no rundll32 de 32 bits do Windows)
cl %CFLAGS% /LD src\janelas\macjanela.cpp src\janelas\controles.cpp %RES%\WacOSWindow.res /Fe:bin\WacOSWindow.dll /link /IMPLIB:bin\obj\WacOSWindow.lib %LIBS% || exit /b 1
call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86 >nul || exit /b 1
if not exist bin\obj32 mkdir bin\obj32
cl /nologo /EHsc /O2 /W3 /std:c++20 /utf-8 /DUNICODE /D_UNICODE /Fo:bin\obj32\ /LD src\janelas\macjanela.cpp src\janelas\controles.cpp %RES%\WacOSWindow32.res /Fe:bin\WacOSWindow32.dll /link /IMPLIB:bin\obj32\WacOSWindow32.lib %LIBS% || exit /b 1
- cl /nologo /EHsc /O2 /W3 /std:c++20 /utf-8 /DUNICODE /D_UNICODE /Fo:bin\obj32\ src\janelas\host32.cpp %RES%\WacOSWindow32Host.res /Fe:bin\WacOSWindow32Host.exe /link /SUBSYSTEM:WINDOWS user32.lib || exit /b 1
exit /b 0
)
diff --git a/docs/BRIEFING.md b/docs/BRIEFING.md
index f70d08b..58e1b18 100644
--- a/docs/BRIEFING.md
+++ b/docs/BRIEFING.md
@@ -111,7 +111,7 @@ início automático (tarefa agendada `SequoiaShell`), abrir agora. `desinstalar.
| `SequoiaCalculator.exe` | `src/calculadora` | Calculadora (Básica/Científica/Programador) |
| `SequoiaNotes.exe` | `src/notas` | Notas (texto rico, `%APPDATA%\Shell\Notas`) |
| `SequoiaScreenshot.exe` | `src/captura` | Captura de Tela (Win+Shift+3/4/5) |
-| `SequoiaWindow.dll` / `SequoiaWindow32.dll` / `SequoiaWindow32Host.exe` | `src/janelas` | barra de título do Mac e controles nas janelas dos outros programas (gancho em 64 e 32 bits) |
+| `WacOSWindow.dll` / `WacOSWindow32.dll` | `src/janelas` | barra de título do Mac e controles nas janelas dos outros programas (gancho em 64 bits pelo Shell; 32 bits pela própria DLL dentro do rundll32 de 32 bits do Windows, entrada WacOSHost) |
| `DialogoMac.dll` / `DialogoMac32.dll` | `src/dialogo` | troca IFileOpenDialog/IFileSaveDialog pelo Finder (HKCU CLSID, `tools/dialogo-ligar.ps1`) |
| `ferramentas\MenuTeste.exe` | `src/tools/menu_teste.cpp` | bancada do menu de contexto (`--dump`, `--demo`, `--demo <pasta> --quente`) |
@@ -162,6 +162,29 @@ verde), widgets (widgets da mesa).
borda especular (`vidro::Borda`), metaballs no Spotlight (`vidro::Gosma`). Menus de contexto: vidro
**tingido e bem menos transparente**. Central de Controle: só desfoque (sem véu escuro), módulos de vidro
claro.
+- **Tema Mac OS X Leopard** (`leopard=1` sem `liquid_glass`): o Sequoia por baixo e, por cima, o Aqua de 2007 —
+ barra de menus de 22 pt clara e translúcida (Lucida, maçã grafite) e destaque azul; menus brancos com destaque azul de ponta a ponta (`menubar.cpp`), Dock em prateleira de vidro
+ em perspectiva com reflexo e a luz azul do app aberto (`dock.cpp`, sem o vidro de fundo), botões de gel
+ (`semaforo::DrawGel`) e o metal cinza das janelas "unified" (`comum/leopard.h`: DLL das janelas, Finder, Ajustes).
+ Finder e Ajustes ficam sempre claros (o 10.5 não tinha modo escuro). Ícones em `icones\leopard`
+ (`tools/icones-leopard.py`, do pacote "Leopard Icons" do usuário; o que faltar vem do Sequoia). O papel de parede
+ Aurora é só sugestão (botão em Aparência); trocar de tema nunca muda o papel de parede.
+ Cursor: ao entrar no Leopard o Shell aplica o esquema "Mac OS X Leopard" em HKCU (seta clássica e o cata-vento
+ colorido; `cursor\Leopard`, `tools/cursor-leopard.py`) e guarda o anterior em `%APPDATA%\Shell\cursor-antes.txt`,
+ que volta ao sair do tema (`ponteiro::TemaLeopard`). Finder: barra de 55 px (título centralizado na linha de 22,
+ botões com moldura metálica), pastas azuis do pacote, seleção azul em degradê e barra de rolagem Aqua. Ajustes:
+ caixas de seleção, pop-ups e botões em gel Aqua, fundo cinza 232. Medidas tiradas de capturas do 10.5 a 1x.
+ Regra do usuário: o Leopard tem desenho PRÓPRIO (nada reaproveitado do visual dos outros temas). Peças:
+ Ajustes = Preferências do Sistema do 10.5 (`RenderLeopard` em `ajustes/main.cpp`: sem barra lateral, "Mostrar Todos"
+ em faixas por categoria com os ícones `icones\leopard\pref <id>.png`, painéis em formulário com rótulo à direita);
+ Aparência própria (`AparenciaLeopard`: Azul/Grafite, Cor de realce, barra de menus translúcida); Finder = barra de
+ 55 px com ◀▶/arrumar/modos/engrenagem/busca, barra lateral FAVORITOS/DISPOSITIVOS/COMPARTILHADO/BUSCAR POR
+ (`search::Smart` no índice), Cover Flow (4ª visão: lista + capas em perspectiva 3D com reflexo, `DrawCoverFlow`),
+ Quick Look em HUD escuro; Shell = Spotlight preso na lupa (`spotlight.cpp PaintLeopard`), Exposé sem a faixa de
+ Mesas, alertas do 10.5 (`alertas.cpp`), Sobre Este Mac do 10.5 (dados reais do PC), Pilha em Grade escura e a pasta
+ Aplicativos à direita da Dock abrindo como pilha (`pilhas::ShowApps`, atalhos do Menu Iniciar), Quick Look da mesa
+ em HUD. Ícones dos apps sem equivalente no pacote: o ícone moderno "aquificado" (`tools/aqua_icone.py`).
+ Teste sem clicar: `ShellAbrirPainel` 2 Exposé, 7 Spotlight, 8 Sobre, 11 Quick Look, 12 pilha Aplicativos.
- **Vidro real** (`vidro_real=1`): o fundo do vidro é montado das janelas que estão atrás (captura de
janelas do Windows), então as peças aparecem nas gravações. Desenha só as áreas das peças e só remonta
quando a **região alterada** de um quadro (Windows 11 24H2, `DirtyRegionMode::ReportOnly`) passa atrás
@@ -190,7 +213,7 @@ Chaves (padrão): `ajustes_pagina=geral` `ampliacao=0` `ampliacao_tamanho=128` `
`clique_mostra_mesa=1` `destaque=azul` `dialogo_por_fora=1` `dock_clique_oculta=1` `estilo_icones=padrao`
(padrao/escuro/transparente/tingido) `explorer` (1 / 0 / fundo) `finder_padrao=1` `finder_reserva=1`
`genio=1` `genio_motor=composicao` `idioma=pt` (pt/en) `indicadores=1` `janelas_mac=1`
-`launchpad_motor=composicao` `launchpad_ocultos` `limitar_janelas=1` `liquid_estilo=nitido`
+`launchpad_motor=composicao` `launchpad_ocultos` `leopard` (tema Mac OS X Leopard; só vale com `liquid_glass=0`) `limitar_janelas=1` `liquid_estilo=nitido`
`liquid_glass` `liquid_refracao=0.6` `mc_motor=composicao` `menus_do_windows=1` `menus_fade=1` `ocultar=0`
`pilha_ordem=adicao` `pilha_ver=auto` `pilhas=1` `progresso_mac=1` `pulo_notificacao=1`
`reduzir_transparencia=0` `relogio_curto=0` `revelar_motor=composicao` `sacudir_ponteiro=1` `sombras_mac=1`
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txt
index 79b4a6f..8883526 100644
--- a/docs/registro-mudancas.txt
+++ b/docs/registro-mudancas.txt
@@ -571,3 +571,7 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem
[2026-11-17 14:40 PC] (1) Win+E abria o Explorador: com explorer=fundo quem atendia era o Explorador (página "Início", que não é pasta de disco e o Finder não troca; a chave HKCU CLSID\{52205fd8...}\opennewwindow estava certa, mas o Win+E do Windows 11 não passa por ela). main.cpp: o gancho do teclado atende o Win+E (sem Shift/Ctrl) em qualquer modo; mesa::WinKey abre o Finder, ou o Explorador se "Abrir pastas no Finder" estiver desligado. (2) Transparência do vidro no mínimo = totalmente transparente (o usuário): backdrop.cpp AdjustAlpha a *= 2*tintK abaixo de 0,5 (antes sobrava 35 %), véu branco de 5 % some junto; painéis com texto e menus mantêm no mínimo 25 % para dar para ler. Conferido numa foto do Dock com vidro_tinta=0.00 (o ajuste do usuário). Os apps (Finder, Ajustes) usam outro vidro, fora desse controle. Instalado e reiniciado; Win+E não testado (sem simular teclas).
[2026-11-19 PC] TEMA macOS GOLDEN GATE (liquid_glass=1 + golden_gate=1). Registro só ao usar Ajustes > Aparência > Cor do realce do texto: grava HKCU\Control Panel\Colors\Hilight ("R G B") e chama SetSysColors(COLOR_HIGHLIGHT); o valor anterior fica em realce_original no ajustes.txt e volta ao escolher "Automática" (desfazer). Nada mais no registro. Cor das pastas (cor_pastas) e Escuro automático (estilo_escuro_auto) só no ajustes.txt.
+
+[2026-11-19 PC] TEMA MAC OS X LEOPARD (leopard=1, só com liquid_glass=0). CURSOR: ao entrar no Leopard o Shell (ponteiro.cpp, ponteiro::TemaLeopard) grava em HKCU\Control Panel\Cursors o esquema "Mac OS X Leopard" (15 papéis apontando para <instalação>\cursor\Leopard, do pacote Mac OS X Cursors de RaZcaLinSIDe; tools\cursor-leopard.py) e chama SPI_SETCURSORS. VALOR ANTIGO: guardado em %APPDATA%\Shell\cursor-antes.txt (antes era o cursor macOS Tahoe em ...\Programs\SequoiaShell\cursor\MacOS Tahoe Cursor (With Shadow)\). DESFAZER: escolher outro tema em Ajustes > Aparência (o Shell devolve o esquema guardado, só se o cursor ainda for o do Leopard, e apaga o arquivo); ou à mão, com os valores do cursor-antes.txt. Nada vai para C:\Windows\Cursors (o .inf do pacote copiaria para lá; não usado). Ícones: icones\leopard (tools\icones-leopard.py). Nada mais no registro.
+
+[2026-11-19 PC] HOSPEDEIRO DE 32 BITS SEM EXE PRÓPRIO. O WacOSWindow32Host.exe dava 18/71 no VirusTotal (heurística Gen:Trojan.Heur3.LPT etc.: exe pequeno que copia DLL e põe gancho em outros programas). Agora a WacOSWindow32.dll roda no rundll32.exe de 32 bits do Windows (SysWOW64), entrada WacOSHost (macjanela.cpp); o Shell (janelas.cpp, OwnCopy) faz a cópia em bin\obj\mj e abre "rundll32 <cópia>,WacOSHost". VirusTotal: WacOSWindow32.dll 1/71 (só SecureAge), WacOSWindow.dll 0/71. host32.cpp apagado; fora do build, do pacote e dos recursos; instalar.ps1 apaga o exe antigo de quem atualiza. VERSIONINFO de todos os programas: CompanyName "WacOS (open source)", ProductName "WacOS", Comments com o link do GitHub. Nada no registro.
diff --git a/instalador/instalar.ps1 b/instalador/instalar.ps1
index 6afd184..a3dfd1d 100644
--- a/instalador/instalar.ps1
+++ b/instalador/instalar.ps1
@@ -74,6 +74,8 @@ foreach ($pasta in 'bin', 'icones', 'sons', 'tools') {
}
}
Get-ChildItem $dest -Recurse -File | Unblock-File # veio da internet/zip: sem o aviso de "arquivo baixado"
+# o hospedeiro de 32 bits virou o rundll32 do Windows (build-12): o exe antigo sai
+Remove-Item "$dest\bin\WacOSWindow32Host.exe" -Force -ErrorAction SilentlyContinue
Write-Host "Programas copiados para $dest"
# 1b. Instalação com o nome antigo (Sequoia Shell): a tarefa do login e o atalho passam para o WacOS e a pasta velha
diff --git a/src/ajustes/main.cpp b/src/ajustes/main.cpp
index 1502866..b9a40f6 100644
--- a/src/ajustes/main.cpp
+++ b/src/ajustes/main.cpp
@@ -16,6 +16,7 @@
#include <cstdarg>
#include "../comum/ampliacao.h" // botão verde com a animação do ampliar do Shell
#include "../comum/semaforo.h"
+#include "../comum/leopard.h" // tema Mac OS X Leopard: barra metálica de ponta a ponta
namespace {
@@ -24,7 +25,7 @@ namespace {
// (Ajustes do Sistema do macOS 26 medido com Acessibilidade): janela 801 × 625, barra lateral de 239 com 8 de
// recuo, linhas de 32, conteúdo com 20 de margem (grupos de 514) e linhas de 42 dentro dos grupos
float SIDE_W = 215;
-const float TOOL_H = 52;
+float TOOL_H = 52; // Leopard: 56 (a barra "unified" do 10.5, ApplyWindowTheme)
float SIDE_ROW = 28;
const float SIDE_GAP = 12;
// SEARCH_Y e ACCOUNT_Y mudam no Golden Gate (ApplyWindowTheme): busca com o centro a 75 e a conta 6 mais abaixo (captura)
@@ -45,6 +46,26 @@ bool g_tahoe; // tema macOS Tahoe (liquid_glass=1): janela de cantos grandes, b
// barra lateral de 231 pt que vai até a borda (cor cheia 236,235,236; sem painel flutuante), linhas de 32 pt com a
// seleção na cor de destaque pura, 10 pt de recuo e raio 8; conteúdo branco com caixas (247) a ~20 pt das bordas
bool Golden() { return g_tahoe && tahoe::Golden(); }
+bool g_leoAll = true; // Leopard: "Mostrar Todos" (a grade de painéis); um painel aberto põe false
+// Mac OS X Leopard (leopard=1 sem o Liquid Glass): os controles Aqua do 10.5 (caixas de seleção e pop-ups de gel azul,
+// botões em pílula), o fundo cinza 232 das janelas e a seleção azul em degradê na barra lateral
+bool Leo() { return !g_tahoe && tahoe::Leopard(); }
+// degradê vertical com cantos (rad) — usado pelos controles Aqua
+void LeoFill(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, std::initializer_list<D2D1_GRADIENT_STOP> st) {
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st.begin(), (UINT32)st.size(), &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))
+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+}
+// gel do Aqua: claro em cima, a quebra do brilho no meio e a luz de baixo (azul) ou o branco perolado (pílula comum)
+void LeoGel(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, bool blue) {
+ if (blue) LeoFill(dc, r, rad, { { 0, D2D1::ColorF(0.66f, 0.80f, 0.98f, 1) }, { 0.5f, D2D1::ColorF(0.38f, 0.60f, 0.93f, 1) },
+ { 0.5f, D2D1::ColorF(0.24f, 0.47f, 0.87f, 1) }, { 1, D2D1::ColorF(0.58f, 0.82f, 1.0f, 1) } });
+ else LeoFill(dc, r, rad, { { 0, D2D1::ColorF(1, 1, 1, 1) }, { 0.5f, D2D1::ColorF(0.95f, 0.95f, 0.95f, 1) },
+ { 0.5f, D2D1::ColorF(0.88f, 0.88f, 0.88f, 1) }, { 1, D2D1::ColorF(0.98f, 0.98f, 0.98f, 1) } });
+}
float GroupR() { return g_tahoe ? 11.f : GROUP_R; } // caixas mais redondas no Tahoe (guia: group_radius 11)
// Tahoe: estilo de ícones "transparente" (Aparência > Estilo de ícones): símbolos na cor do texto, sem o
// quadradinho colorido; na barra lateral, só o símbolo (como nas capturas do Ajustes do macOS 26)
@@ -113,6 +134,7 @@ D2D1_SIZE_F ClientDip() { RECT rc; GetClientRect(g_hwnd, &rc); return { rc.right
D2D1_COLOR_F Rgb(UINT32 c, float a = 1) { return D2D1::ColorF(((c >> 16) & 255) / 255.f, ((c >> 8) & 255) / 255.f, (c & 255) / 255.f, a); }
bool ReadDark() {
+ if (tahoe::Leopard()) return false; // Leopard: sempre claro (o 10.5 não tinha modo escuro)
std::wstring t = aj::Setting(L"tema", L"auto");
if (t == L"claro") return false;
if (t == L"escuro") return true;
@@ -496,6 +518,14 @@ Pal Colors() { // Tahoe: o fundo da janela leva 10 % da cor do papel de parede
return p;
}
if (g_tahoe) p.content = tahoe::Tint(p.content);
+ if (!g_tahoe && tahoe::Leopard()) { // Leopard: barra lateral azul-acinzentada, janela cinza 232, caixas gravadas
+ p.side = leopard::Sidebar(g_winActive, g_dark);
+ p.content = D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1);
+ p.group = D2D1::ColorF(0, 0, 0, 0.04f);
+ p.groupLine = D2D1::ColorF(0, 0, 0, 0.14f);
+ p.line = D2D1::ColorF(0, 0, 0, 0.10f);
+ p.sideSelText = D2D1::ColorF(1, 1, 1, 1);
+ }
return p;
}
Pal ColorsBase() {
@@ -529,6 +559,7 @@ void ShowPage() {
void SelectSide(int i) {
auto& items = SidebarItems();
if (i < 0 || i >= (int)items.size()) return;
+ if (g_leoAll) { g_leoAll = false; g_search.SetText(L"", false); g_searchFocus = false; Invalidate(); } // Leopard: abriu um painel
if (g_histAt >= 0 && g_hist[g_histAt].side == i && g_hist[g_histAt].stack.empty()) return;
g_hist.resize(g_histAt + 1);
g_hist.push_back({ i, {} });
@@ -588,6 +619,22 @@ float HeaderHeight(const aj::Group& g, float w) {
// ================= Desenho dos controles
void DrawToggle(aj::Ctx& c, D2D1_RECT_F r, bool on, float t /*0..1 animação*/, bool enabled) {
+ if (Leo()) { // Leopard: caixa de seleção Aqua de 14 px (gel azul com o visto branco ligada; perolada desligada)
+ (void)t;
+ float x = r.right - 10 - 14, y = (r.top + r.bottom) / 2 - 7;
+ D2D1_RECT_F b = D2D1::RectF(x, y, x + 14, y + 14);
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left, b.top + 1, b.right, b.bottom + 1), 3, 3), c.br);
+ LeoGel(c.dc, b, 3, on);
+ c.br->SetColor(on ? D2D1::ColorF(0.12f, 0.27f, 0.58f, enabled ? 0.9f : 0.4f) : D2D1::ColorF(0, 0, 0, enabled ? 0.42f : 0.2f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left + 0.5f, b.top + 0.5f, b.right - 0.5f, b.bottom - 0.5f), 2.5f, 2.5f), c.br, 1);
+ if (on) {
+ c.br->SetColor(D2D1::ColorF(0.05f, 0.08f, 0.15f, enabled ? 0.95f : 0.4f)); // o visto preto do Aqua
+ Line(c.dc, c.br, x + 3.2f, y + 7.2f, x + 6, y + 10.5f, 2.0f);
+ Line(c.dc, c.br, x + 6, y + 10.5f, x + 11.5f, y + 2.8f, 2.0f);
+ }
+ return;
+ }
if (g_tahoe) { // Tahoe (guia macOS26-Theme-Reference, seção 43): switch pequeno de 36 × 16, o pino uma pílula branca
const float TW = 36, TH = 16;
float x = r.right - 10 - TW, y = (r.top + r.bottom) / 2 - TH / 2;
@@ -646,6 +693,16 @@ D2D1_RECT_F ButtonRect(const std::wstring& label, float right, float cy) {
}
void DrawButton(aj::Ctx& c, D2D1_RECT_F b, const std::wstring& label, bool enabled, bool primary = false) {
+ if (Leo()) { // Leopard: pílula Aqua perolada (o botão padrão em gel azul), contorno cinza e o relevo branco embaixo
+ float rad = (b.bottom - b.top) / 2;
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left, b.top + 1, b.right, b.bottom + 1), rad, rad), c.br);
+ LeoGel(c.dc, b, rad, primary);
+ c.br->SetColor(primary ? D2D1::ColorF(0.12f, 0.27f, 0.58f, 0.9f) : D2D1::ColorF(0, 0, 0, 0.40f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left + 0.5f, b.top + 0.5f, b.right - 0.5f, b.bottom - 0.5f), rad - 0.5f, rad - 0.5f), c.br, 1);
+ aj::Text(c, label, b, g_tfCenter, D2D1::ColorF(0, 0, 0, enabled ? 0.9f : 0.35f));
+ return;
+ }
if (g_tahoe && primary) { // Tahoe: o botão padrão também é cápsula, na cor de destaque
float rad = (b.bottom - b.top) / 2;
c.br->SetColor(c.accent);
@@ -709,6 +766,22 @@ float SliderDefault(const aj::Row& r) { return std::clamp((r.def - r.min) / std:
void DrawSlider(aj::Ctx& c, const aj::Row& r, D2D1_RECT_F row) {
D2D1_RECT_F t = SliderTrack(r, row);
float v = SliderValue(r);
+ if (Leo()) {
+ // Leopard: trilho fino afundado (cinza com sombra por dentro) e o botão redondo de gel perolado do Aqua
+ float cy = (t.top + t.bottom) / 2;
+ D2D1_RECT_F tr = D2D1::RectF(t.left, cy - 2.5f, t.right, cy + 2.5f);
+ LeoFill(c.dc, tr, 2.5f, { { 0, D2D1::ColorF(0.55f, 0.55f, 0.55f, 1) }, { 1, D2D1::ColorF(0.80f, 0.80f, 0.80f, 1) } });
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(tr, 2.5f, 2.5f), c.br, 0.8f);
+ float kx = t.left + v * (t.right - t.left);
+ D2D1_RECT_F kb = D2D1::RectF(kx - 8, cy - 8, kx + 8, cy + 8);
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.22f));
+ c.dc->FillEllipse(D2D1::Ellipse({ kx, cy + 1.2f }, 8.2f, 8.2f), c.br);
+ LeoGel(c.dc, kb, 8, false);
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.42f));
+ c.dc->DrawEllipse(D2D1::Ellipse({ kx, cy }, 7.5f, 7.5f), c.br, 1);
+ return;
+ }
if (r.gg) {
// macOS 27: trilho arredondado (cinza claro / azul), botão em cápsula branca de 20 × 16 com sombra, os dois
// pontinhos embaixo das pontas e, nas pontas, os ícones de "transparente" (contorno) e "opaco" (cheio)
@@ -825,7 +898,7 @@ void DrawRow(aj::Ctx& c, const aj::Row& r, D2D1_RECT_F rr, int gi, int ri) {
}
case aj::Kind::Popup: {
std::wstring v = r.value ? r.value() : (r.getIdx && r.getIdx() >= 0 && r.getIdx() < (int)r.options.size() ? r.options[r.getIdx()] : L"");
- if (r.gg) {
+ if (r.gg && !Leo()) { // (Leopard: o pop-up Aqua, mais abaixo)
// macOS 27 (Ajustes > Aparência, 2x): botão redondo de 19,5 a 13,5 da borda da caixa, o valor a 13 dele e a
// bolinha de 16 a 8,5 do texto
float sx = rr.right - 13.5f - 9.75f;
@@ -851,6 +924,26 @@ void DrawRow(aj::Ctx& c, const aj::Row& r, D2D1_RECT_F rr, int gi, int ri) {
right = dx - 16;
break;
}
+ if (Leo()) {
+ float w = std::min(TextWidth(v, g_tfBody), 260.f);
+ D2D1_RECT_F b = D2D1::RectF(right - w - 40, cy - 10, right + 6, cy + 10);
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left, b.top + 1, b.right, b.bottom + 1), 4, 4), c.br);
+ LeoGel(c.dc, b, 4, false);
+ D2D1_RECT_F cap = D2D1::RectF(b.right - 19, b.top, b.right, b.bottom);
+ c.dc->PushAxisAlignedClip(cap, D2D1_ANTIALIAS_MODE_ALIASED);
+ LeoGel(c.dc, b, 4, true);
+ c.dc->PopAxisAlignedClip();
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.40f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left + 0.5f, b.top + 0.5f, b.right - 0.5f, b.bottom - 0.5f), 3.5f, 3.5f), c.br, 1);
+ c.br->SetColor(D2D1::ColorF(0.12f, 0.27f, 0.58f, 0.7f));
+ c.dc->DrawLine({ cap.left + 0.5f, b.top + 1 }, { cap.left + 0.5f, b.bottom - 1 }, c.br, 1);
+ DrawUpDown(c, (cap.left + cap.right) / 2, cy, D2D1::ColorF(1, 1, 1, 1));
+ aj::Text(c, v, D2D1::RectF(b.left + 9, b.top, cap.left - 4, b.bottom), g_tfBody, D2D1::ColorF(0, 0, 0, 0.9f));
+ g_hits.push_back({ H_POPUP, b, gi, ri });
+ right = b.left - 4;
+ break;
+ }
if (g_tahoe) { // Tahoe: ⌃⌄ num círculo cinza
c.br->SetColor(g_dark ? D2D1::ColorF(1, 1, 1, 0.10f) : D2D1::ColorF(0, 0, 0, 0.06f));
c.dc->FillEllipse(D2D1::Ellipse({ right - 4, cy }, 10, 10), c.br);
@@ -1023,6 +1116,13 @@ void DrawSidebar(aj::Ctx& c, const Pal& pal, float H) {
D2D1_RECT_F rr = g_tahoe && !Golden() ? D2D1::RectF(13, y, SIDE_W - 8, y + SIDE_ROW) : D2D1::RectF(10, y, SIDE_W - 10, y + SIDE_ROW);
bool sel = i == cur;
float selR = Golden() ? 8.f : g_tahoe ? 9.f : 6.f;
+ if (sel && Leo()) {
+ D2D1_RECT_F full = D2D1::RectF(0, rr.top, SIDE_W, rr.bottom);
+ LeoFill(c.dc, full, 0, { { 0, g_winActive ? D2D1::ColorF(0.43f, 0.60f, 0.85f, 1) : D2D1::ColorF(0.68f, 0.68f, 0.70f, 1) },
+ { 1, g_winActive ? D2D1::ColorF(0.24f, 0.44f, 0.76f, 1) : D2D1::ColorF(0.53f, 0.53f, 0.55f, 1) } });
+ c.br->SetColor(g_winActive ? D2D1::ColorF(0.33f, 0.52f, 0.80f, 1) : D2D1::ColorF(0.60f, 0.60f, 0.62f, 1));
+ c.dc->FillRectangle(D2D1::RectF(0, full.top, SIDE_W, full.top + 1), c.br);
+ } else
if (sel) { c.br->SetColor(pal.sideSel); c.dc->FillRoundedRectangle(D2D1::RoundedRect(rr, selR, selR), c.br); }
g_tileBare = true;
@@ -1095,8 +1195,372 @@ void DrawSheet(aj::Ctx& c, const Pal& pal) {
g_hits.push_back({ H_SHEET_OK, ok });
}
+// ================= Mac OS X Leopard: as Preferências do Sistema do 10.5
+// Desenho próprio do tema (nada do Sequoia/Tahoe): janela cinza 232 sem barra lateral; barra "unified" de metal com
+// o título na linha de cima e, embaixo, ◀ ▶ segmentados, "Mostrar Todos" e a busca em pílula. "Mostrar Todos" é a
+// grade de painéis em faixas por categoria (Pessoal, Hardware, Internet e Rede, Sistema) com os ícones do 10.5
+// (icones\leopard\pref <id>.png); cada painel é um formulário: rótulo alinhado à direita com dois-pontos, o controle à
+// direita dele (pop-up Aqua, caixa de seleção à esquerda do texto, botão em pílula) e linhas gravadas entre os grupos.
+// Os dados (páginas, linhas, o que cada controle faz) são os mesmos de sempre (paginas.cpp).
+const int H_SHOWALL = 1000; // acerto do botão "Mostrar Todos" (fora do enum para não mexer nos outros temas)
+struct LeoCat { const wchar_t* name; std::vector<std::wstring> ids; };
+const std::vector<LeoCat>& LeoCats() {
+ static const std::vector<LeoCat> cats = {
+ { L"Pessoal", { L"aparencia", L"fundo", L"protetor", L"dock", L"central", L"geral", L"spotlight" } },
+ { L"Hardware", { L"telas", L"som", L"energia", L"teclado", L"mouse", L"trackpad", L"impressoras", L"bluetooth" } },
+ { L"Internet e Rede", { L"rede", L"wifi", L"contas", L"nuvem", L"jogos" } },
+ { L"Sistema", { L"usuarios", L"privacidade", L"senha", L"bloqueio", L"acessibilidade", L"inteligencia", L"notificacoes", L"foco", L"tempo" } },
+ };
+ return cats;
+}
+IDWriteTextFormat* LeoFmt(float size, bool bold, DWRITE_TEXT_ALIGNMENT a, bool wrap = false) {
+ // Lucida Grande no Mac; no Windows a Lucida Sans Unicode (o mesmo desenho de origem)
+ IDWriteTextFormat* f = Format(L"Lucida Sans Unicode", size, bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL, a);
+ if (f && wrap) { f->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP); f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR); }
+ return f;
+}
+IDWriteTextFormat *g_lf, *g_lfR, *g_lfB, *g_lfS, *g_lfSC, *g_lfT;
+void LeoFormats() {
+ if (g_lf) return;
+ g_lf = LeoFmt(13, false, DWRITE_TEXT_ALIGNMENT_LEADING);
+ g_lfR = LeoFmt(13, false, DWRITE_TEXT_ALIGNMENT_TRAILING);
+ g_lfB = LeoFmt(12, true, DWRITE_TEXT_ALIGNMENT_LEADING);
+ g_lfS = LeoFmt(11, false, DWRITE_TEXT_ALIGNMENT_LEADING, true);
+ g_lfSC = LeoFmt(11, false, DWRITE_TEXT_ALIGNMENT_CENTER, true);
+ g_lfT = LeoFmt(13, false, DWRITE_TEXT_ALIGNMENT_CENTER);
+}
+std::wstring LeoIconPath(const std::wstring& id) {
+ static std::wstring dir;
+ if (dir.empty()) {
+ wchar_t exe[MAX_PATH] = {}; GetModuleFileNameW(nullptr, exe, MAX_PATH);
+ std::wstring p = exe; p = p.substr(0, p.find_last_of(L'\\')); p = p.substr(0, p.find_last_of(L'\\')); // bin\ -> instalação
+ dir = p + L"\\icones\\leopard\\pref ";
+ }
+ std::wstring f = dir + id + L".png";
+ return GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES ? f : dir + L"geral.png";
+}
+// texto com relevo branco 1 px abaixo (os textos sobre o metal e o cinza do 10.5)
+void LeoText(aj::Ctx& c, const std::wstring& s, D2D1_RECT_F r, IDWriteTextFormat* f, D2D1_COLOR_F col, bool emboss = true) {
+ if (emboss) aj::Text(c, s, D2D1::RectF(r.left, r.top + 1, r.right, r.bottom + 1), f, D2D1::ColorF(1, 1, 1, 0.55f));
+ aj::Text(c, s, r, f, col);
+}
+// pílula Aqua (botão comum perolado; padrão/apertado em gel azul)
+void LeoPill(aj::Ctx& c, D2D1_RECT_F b, const std::wstring& label, bool enabled, bool blue = false) {
+ float rad = (b.bottom - b.top) / 2;
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left, b.top + 1, b.right, b.bottom + 1), rad, rad), c.br);
+ LeoGel(c.dc, b, rad, blue);
+ c.br->SetColor(blue ? D2D1::ColorF(0.12f, 0.27f, 0.58f, 0.9f) : D2D1::ColorF(0, 0, 0, 0.42f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left + 0.5f, b.top + 0.5f, b.right - 0.5f, b.bottom - 0.5f), rad - 0.5f, rad - 0.5f), c.br, 1);
+ g_lfT->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
+ aj::Text(c, label, b, g_lfT, D2D1::ColorF(0, 0, 0, enabled ? 0.9f : 0.35f));
+}
+float LeoDetailH(const aj::Row& r, float w) { return r.detail.empty() ? 0 : TextHeight(r.detail, g_lfS, w) + 6; }
+float LeoRowH(const aj::Row& r, float colW) {
+ if (r.kind == aj::Kind::Custom) return r.height > 0 ? r.height : 40;
+ float base = r.kind == aj::Kind::Toggle ? 24.f : 30.f;
+ return base + LeoDetailH(r, colW - (r.kind == aj::Kind::Toggle ? 20 : 0));
+}
+void LeoRow(aj::Ctx& c, const aj::Row& r, D2D1_RECT_F rr, float x0, float colX, int gi, int ri) {
+ D2D1_COLOR_F ink = D2D1::ColorF(0, 0, 0, r.enabled ? 0.88f : 0.35f), gray = D2D1::ColorF(0, 0, 0, r.enabled ? 0.55f : 0.30f);
+ if (r.kind == aj::Kind::Custom) { if (r.draw) r.draw(c, rr); g_hits.push_back({ H_CUSTOM, rr, gi, ri }); return; }
+ float cy = rr.top + 13;
+ auto rightLabel = [&] {
+ if (r.label.empty()) return;
+ LeoText(c, Tr(r.label) + L":", D2D1::RectF(x0, cy - 10, colX - 6, cy + 10), g_lfR, ink, false);
+ };
+ auto detail = [&](float dx) {
+ if (r.detail.empty()) return;
+ float h = LeoDetailH(r, rr.right - dx);
+ aj::Text(c, r.detail, D2D1::RectF(dx, rr.top + 25, rr.right, rr.top + 25 + h), g_lfS, gray);
+ };
+ switch (r.kind) {
+ case aj::Kind::Toggle: {
+ bool on = r.get ? r.get() : false;
+ D2D1_RECT_F b = D2D1::RectF(colX, cy - 7, colX + 14, cy + 7);
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left, b.top + 1, b.right, b.bottom + 1), 3, 3), c.br);
+ LeoGel(c.dc, b, 3, on);
+ c.br->SetColor(on ? D2D1::ColorF(0.12f, 0.27f, 0.58f, r.enabled ? 0.9f : 0.4f) : D2D1::ColorF(0, 0, 0, r.enabled ? 0.45f : 0.2f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left + 0.5f, b.top + 0.5f, b.right - 0.5f, b.bottom - 0.5f), 2.5f, 2.5f), c.br, 1);
+ if (on) {
+ c.br->SetColor(D2D1::ColorF(0.05f, 0.08f, 0.15f, r.enabled ? 0.95f : 0.4f));
+ Line(c.dc, c.br, colX + 3.2f, cy + 0.2f, colX + 6, cy + 3.5f, 2.0f);
+ Line(c.dc, c.br, colX + 6, cy + 3.5f, colX + 11.5f, cy - 4.2f, 2.0f);
+ }
+ LeoText(c, Tr(r.label), D2D1::RectF(colX + 20, cy - 10, rr.right, cy + 10), g_lf, ink, false);
+ detail(colX + 20);
+ g_hits.push_back({ H_TOGGLE, D2D1::RectF(colX - 4, rr.top, std::min(rr.right, colX + 30 + TextWidth(Tr(r.label), g_lf)), rr.top + 26), gi, ri });
+ return;
+ }
+ case aj::Kind::Popup: {
+ rightLabel();
+ std::wstring v = r.value ? r.value() : (r.getIdx && r.getIdx() >= 0 && r.getIdx() < (int)r.options.size() ? r.options[r.getIdx()] : L"");
+ if (!v.empty() && v[0] == L'!') v = v.substr(1);
+ v = Tr(v);
+ float w = std::max(120.f, std::min(TextWidth(v, g_lf), 300.f) + 46);
+ D2D1_RECT_F b = D2D1::RectF(colX, cy - 10, colX + w, cy + 10);
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left, b.top + 1, b.right, b.bottom + 1), 4, 4), c.br);
+ LeoGel(c.dc, b, 4, false);
+ D2D1_RECT_F cap = D2D1::RectF(b.right - 19, b.top, b.right, b.bottom);
+ c.dc->PushAxisAlignedClip(cap, D2D1_ANTIALIAS_MODE_ALIASED);
+ LeoGel(c.dc, b, 4, true);
+ c.dc->PopAxisAlignedClip();
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.42f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(b.left + 0.5f, b.top + 0.5f, b.right - 0.5f, b.bottom - 0.5f), 3.5f, 3.5f), c.br, 1);
+ c.br->SetColor(D2D1::ColorF(0.12f, 0.27f, 0.58f, 0.7f));
+ c.dc->DrawLine({ cap.left + 0.5f, b.top + 1 }, { cap.left + 0.5f, b.bottom - 1 }, c.br, 1);
+ float ax = (cap.left + cap.right) / 2; // as setinhas brancas ▲▼
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 1));
+ ID2D1Factory* fac = nullptr; c.dc->GetFactory(&fac);
+ for (int k = 0; k < 2 && fac; k++) {
+ ID2D1PathGeometry* g = nullptr;
+ if (FAILED(fac->CreatePathGeometry(&g))) break;
+ ID2D1GeometrySink* sk = nullptr;
+ if (SUCCEEDED(g->Open(&sk))) {
+ float sgn = k ? 1.f : -1.f, ty = cy + sgn * 1.5f;
+ sk->BeginFigure({ ax - 3.5f, ty }, D2D1_FIGURE_BEGIN_FILLED);
+ sk->AddLine({ ax + 3.5f, ty }); sk->AddLine({ ax, ty + sgn * 4 });
+ sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();
+ c.dc->FillGeometry(g, c.br);
+ }
+ g->Release();
+ }
+ if (fac) fac->Release();
+ aj::Text(c, v, D2D1::RectF(b.left + 9, b.top, cap.left - 4, b.bottom), g_lf, ink);
+ detail(colX);
+ g_hits.push_back({ H_POPUP, b, gi, ri });
+ return;
+ }
+ case aj::Kind::Button: {
+ rightLabel();
+ float w = std::max(80.f, TextWidth(Tr(r.button), g_lfT) + 30);
+ D2D1_RECT_F b = D2D1::RectF(colX, cy - 10, colX + w, cy + 10);
+ LeoPill(c, b, Tr(r.button), r.enabled);
+ detail(colX);
+ g_hits.push_back({ H_BUTTON, b, gi, ri });
+ return;
+ }
+ case aj::Kind::Link: { // abre um painel/folha: botão "Nome…"
+ std::wstring t = Tr(r.label) + L"…";
+ float w = std::max(80.f, TextWidth(t, g_lfT) + 30);
+ D2D1_RECT_F b = D2D1::RectF(colX, cy - 10, colX + w, cy + 10);
+ LeoPill(c, b, t, r.enabled);
+ std::wstring v = r.value ? r.value() : L"";
+ if (!v.empty()) aj::Text(c, v, D2D1::RectF(b.right + 10, cy - 10, rr.right, cy + 10), g_lf, gray);
+ g_hits.push_back({ H_LINK, b, gi, ri });
+ return;
+ }
+ case aj::Kind::Value: {
+ rightLabel();
+ std::wstring v = r.value ? r.value() : L"";
+ aj::Text(c, v, D2D1::RectF(colX, cy - 10, rr.right, cy + 10), g_lf, ink);
+ detail(colX);
+ if (r.click) g_hits.push_back({ H_ROW, rr, gi, ri });
+ return;
+ }
+ case aj::Kind::Slider: {
+ rightLabel();
+ float v = SliderValue(r);
+ D2D1_RECT_F tr = D2D1::RectF(colX + 8, cy - 2.5f, std::min(rr.right - 20, colX + 268), cy + 2.5f);
+ LeoFill(c.dc, tr, 2.5f, { { 0, D2D1::ColorF(0.55f, 0.55f, 0.55f, 1) }, { 1, D2D1::ColorF(0.82f, 0.82f, 0.82f, 1) } });
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f));
+ c.dc->DrawRoundedRectangle(D2D1::RoundedRect(tr, 2.5f, 2.5f), c.br, 0.8f);
+ float kx = tr.left + v * (tr.right - tr.left);
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.22f));
+ c.dc->FillEllipse(D2D1::Ellipse({ kx, cy + 1.2f }, 8.2f, 8.2f), c.br);
+ LeoGel(c.dc, D2D1::RectF(kx - 8, cy - 8, kx + 8, cy + 8), 8, false);
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.42f));
+ c.dc->DrawEllipse(D2D1::Ellipse({ kx, cy }, 7.5f, 7.5f), c.br, 1);
+ if (!r.minGlyph.empty() && r.minGlyph[0] < 0xE000) aj::Text(c, r.minGlyph, D2D1::RectF(colX - 60, cy + 6, colX + 60, cy + 20), g_lfSC, gray);
+ detail(colX);
+ g_hits.push_back({ H_SLIDER, D2D1::RectF(tr.left - 10, cy - 10, tr.right + 10, cy + 10), gi, ri }); // SliderTo tira 10 de cada lado
+ return;
+ }
+ default:
+ rightLabel();
+ return;
+ }
+}
+
+void LeoShowAll(aj::Ctx& c, D2D1_SIZE_F s, float top) {
+ auto& items = SidebarItems();
+ std::wstring q = g_search.text;
+ float y = top - g_scroll;
+ int band = 0;
+ for (auto& cat : LeoCats()) {
+ std::vector<int> idx;
+ for (auto& id : cat.ids) {
+ int i = SidebarIndexFor(id);
+ if (i < 0) continue;
+ if (!q.empty() && std::find(g_sideVisible.begin(), g_sideVisible.end(), i) == g_sideVisible.end()) continue;
+ idx.push_back(i);
+ }
+ if (idx.empty()) continue;
+ const float PITCH = 84, ROWH = 82;
+ int perRow = std::max(1, (int)((s.width - 24) / PITCH));
+ int rows = ((int)idx.size() + perRow - 1) / perRow;
+ float h = 24 + rows * ROWH + 6;
+ // faixas alternadas (cinza claro / cinza do 10.5) com a linha fina entre elas
+ c.br->SetColor(band % 2 == 0 ? D2D1::ColorF(0.93f, 0.93f, 0.93f, 1) : D2D1::ColorF(0.87f, 0.87f, 0.87f, 1));
+ c.dc->FillRectangle(D2D1::RectF(0, y, s.width, y + h), c.br);
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.12f));
+ c.dc->FillRectangle(D2D1::RectF(0, y + h - 1, s.width, y + h), c.br);
+ LeoText(c, Tr(cat.name), D2D1::RectF(12, y + 4, s.width, y + 22), g_lfB, D2D1::ColorF(0, 0, 0, 0.75f));
+ for (int k = 0; k < (int)idx.size(); k++) {
+ int i = idx[k];
+ float x = 14 + (k % perRow) * PITCH, iy = y + 24 + (k / perRow) * ROWH;
+ if (ID2D1Bitmap* b = aj::BitmapFromFile(LeoIconPath(items[i].id), 64)) // o PNG tem 10 % de margem: 40 para 32 de desenho
+ c.dc->DrawBitmap(b, D2D1::RectF(x + PITCH / 2 - 20, iy, x + PITCH / 2 + 20, iy + 40), 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR);
+ aj::Text(c, Tr(items[i].name), D2D1::RectF(x + 2, iy + 42, x + PITCH - 2, iy + ROWH), g_lfSC, D2D1::ColorF(0, 0, 0, 0.85f));
+ g_hits.push_back({ H_SIDE, D2D1::RectF(x, iy, x + PITCH, iy + ROWH), i });
+ }
+ y += h;
+ band++;
+ }
+ g_contentH = y + g_scroll - top + 8;
+}
+
+void LeoPage(aj::Ctx& c, D2D1_SIZE_F s, float top) {
+ float x0 = 20, x1 = s.width - 20, w = x1 - x0;
+ float colX = x0 + std::max(170.f, w * 0.38f);
+ float y = top + 18 - g_scroll;
+ for (int gi = 0; gi < (int)g_page.groups.size(); gi++) {
+ auto& g = g_page.groups[gi];
+ if (g.rows.empty() && g.title.empty()) continue;
+ if (gi > 0) { // a linha gravada entre os grupos (escura e o fio branco embaixo)
+ y += 8;
+ c.br->SetColor(D2D1::ColorF(0, 0, 0, 0.14f));
+ c.dc->FillRectangle(D2D1::RectF(x0, y, x1, y + 1), c.br);
+ c.br->SetColor(D2D1::ColorF(1, 1, 1, 0.7f));
+ c.dc->FillRectangle(D2D1::RectF(x0, y + 1, x1, y + 2), c.br);
+ y += 12;
+ }
+ if (!g.title.empty()) { LeoText(c, Tr(g.title), D2D1::RectF(x0, y, x1, y + 18), g_lfB, D2D1::ColorF(0, 0, 0, 0.8f)); y += 22; }
+ if (!g.subtitle.empty()) {
+ float th = TextHeight(g.subtitle, g_lfS, w);
+ aj::Text(c, g.subtitle, D2D1::RectF(x0, y, x1, y + th + 2), g_lfS, D2D1::ColorF(0, 0, 0, 0.55f));
+ y += th + 8;
+ }
+ for (int ri = 0; ri < (int)g.rows.size(); ri++) {
+ auto& r = g.rows[ri];
+ float rh = LeoRowH(r, x1 - colX);
+ D2D1_RECT_F rr = D2D1::RectF(r.kind == aj::Kind::Custom ? x0 : x0, y, x1, y + rh);
+ if (rr.bottom > top - 60 && rr.top < s.height + 60) LeoRow(c, r, rr, x0, colX, gi, ri);
+ y += rh;
+ }
+ }
+ g_contentH = y + g_scroll - top + 20;
+}
+
+void RenderLeopard() {
+ auto* dc = gfx::Begin(g_dpi);
+ if (!dc) return;
+ if (!g_round) {
+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);
+ f->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_LINE_JOIN_ROUND), nullptr, 0, &g_round);
+ f->Release();
+ }
+ LeoFormats();
+ dc->Clear(D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1));
+ Pal pal = Colors();
+ ID2D1SolidColorBrush* br = nullptr;
+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);
+ aj::Ctx c{ dc, br, false, D2D1::ColorF(0, 0, 0, 0.88f), D2D1::ColorF(0, 0, 0, 0.55f), D2D1::ColorF(0, 0, 0, 0.30f), aj::Accent(),
+ D2D1::ColorF(0, 0, 0, 0.12f), D2D1::ColorF(0, 0, 0, 0.04f), D2D1::ColorF(1, 1, 1, 1),
+ g_lf, g_lfS, g_lfB, g_lfB, g_tfGlyph, g_tfGlyphSmall, g_lfT, g_lfSC, g_lfSC };
+ g_hits.clear();
+ auto s = ClientDip();
+ const bool all = g_leoAll || !g_search.text.empty();
+ dc->PushAxisAlignedClip(D2D1::RectF(0, TOOL_H, s.width, s.height), D2D1_ANTIALIAS_MODE_ALIASED);
+ if (all) LeoShowAll(c, s, TOOL_H); else LeoPage(c, s, TOOL_H);
+ dc->PopAxisAlignedClip();
+
+ // barra "unified": metal, título, botões da janela e a linha de ferramentas
+ leopard::Metal(dc, D2D1::RectF(0, 0, s.width, TOOL_H), g_winActive, false, true);
+ std::wstring title = all ? Tr(L"Preferências do Sistema") : Tr(g_page.title);
+ LeoText(c, title, D2D1::RectF(80, 0, s.width - 80, 22), g_lfT, D2D1::ColorF(0, 0, 0, g_winActive ? 0.85f : 0.45f));
+ for (int k = 0; k < 3; k++) {
+ static const D2D1_COLOR_F on_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
+ const D2D1_COLOR_F* on = semaforo::Pick(on_c, semaforo::FILL);
+ D2D1_POINT_2F p{ 14.5f + k * 21.f, 11 };
+ br->SetColor(g_winActive || g_hoverLights ? on[k] : D2D1::ColorF(0.75f, 0.75f, 0.75f, 1));
+ dc->FillEllipse(D2D1::Ellipse(p, 7, 7), br);
+ semaforo::Gloss(dc, p, 7, br);
+ g_hits.push_back({ H_LIGHT, D2D1::RectF(p.x - 9, p.y - 9, p.x + 9, p.y + 9), k });
+ if (!g_hoverLights) continue;
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.6f));
+ float a = 2.6f;
+ if (k == 0) { Line(dc, br, p.x - a, p.y - a, p.x + a, p.y + a, 1.2f); Line(dc, br, p.x - a, p.y + a, p.x + a, p.y - a, 1.2f); }
+ else if (k == 1) Line(dc, br, p.x - 3.2f, p.y, p.x + 3.2f, p.y, 1.3f);
+ else { Line(dc, br, p.x - 3.2f, p.y, p.x + 3.2f, p.y, 1.3f); Line(dc, br, p.x, p.y - 3.2f, p.x, p.y + 3.2f, 1.3f); }
+ }
+ // ◀ ▶ segmentados (moldura de metal claro)
+ bool canBack = !all || g_histAt > 0, canFwd = g_histAt + 1 < (int)g_hist.size();
+ D2D1_RECT_F seg = D2D1::RectF(10, 30, 62, 52);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.45f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(seg.left, seg.top + 1, seg.right, seg.bottom + 1), 4, 4), br);
+ LeoFill(dc, seg, 4, { { 0, D2D1::ColorF(0.99f, 0.99f, 0.99f, 1) }, { 1, D2D1::ColorF(0.84f, 0.84f, 0.84f, 1) } });
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.42f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(seg.left + 0.5f, seg.top + 0.5f, seg.right - 0.5f, seg.bottom - 0.5f), 3.5f, 3.5f), br, 1);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f));
+ dc->DrawLine({ 36.5f, seg.top + 1 }, { 36.5f, seg.bottom - 1 }, br, 1);
+ ID2D1Factory* fac = nullptr; dc->GetFactory(&fac);
+ auto tri = [&](float cx, bool left, bool on) {
+ ID2D1PathGeometry* g = nullptr;
+ if (!fac || FAILED(fac->CreatePathGeometry(&g))) return;
+ ID2D1GeometrySink* sk = nullptr;
+ if (SUCCEEDED(g->Open(&sk))) {
+ float d = left ? -1.f : 1.f, cy = 41;
+ sk->BeginFigure({ cx + d * 3.5f, cy }, D2D1_FIGURE_BEGIN_FILLED);
+ sk->AddLine({ cx - d * 3, cy - 4.5f }); sk->AddLine({ cx - d * 3, cy + 4.5f });
+ sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();
+ br->SetColor(D2D1::ColorF(0.18f, 0.18f, 0.19f, on ? 0.9f : 0.3f));
+ dc->FillGeometry(g, br);
+ }
+ g->Release();
+ };
+ tri(23, true, canBack); tri(49, false, canFwd);
+ if (fac) fac->Release();
+ g_hits.push_back({ H_BACK, D2D1::RectF(10, 30, 36, 52) });
+ g_hits.push_back({ H_FWD, D2D1::RectF(36, 30, 62, 52) });
+ std::wstring sa = Tr(L"Mostrar Todos");
+ D2D1_RECT_F sb = D2D1::RectF(70, 30, 70 + std::max(84.f, TextWidth(sa, g_lfT) + 26), 52);
+ LeoPill(c, sb, sa, true);
+ g_hits.push_back({ (HitKind)H_SHOWALL, sb });
+ // busca: pílula branca afundada com a lupa; com o foco, o anel azul
+ D2D1_RECT_F sr = D2D1::RectF(s.width - 180, 31, s.width - 12, 51);
+ float srR = (sr.bottom - sr.top) / 2;
+ if (g_searchFocus) {
+ br->SetColor(D2D1::ColorF(0.36f, 0.60f, 0.95f, 0.75f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(sr.left - 1.5f, sr.top - 1.5f, sr.right + 1.5f, sr.bottom + 1.5f), srR + 1.5f, srR + 1.5f), br, 3);
+ }
+ br->SetColor(D2D1::ColorF(1, 1, 1, 1));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(sr, srR, srR), br);
+ LeoFill(dc, D2D1::RectF(sr.left + 1, sr.top + 1, sr.right - 1, sr.top + 5), 2, { { 0, D2D1::ColorF(0, 0, 0, 0.14f) }, { 1, D2D1::ColorF(0, 0, 0, 0) } });
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(sr.left + 0.5f, sr.top + 0.5f, sr.right - 0.5f, sr.bottom - 0.5f), srR - 0.5f, srR - 0.5f), br, 1);
+ br->SetColor(D2D1::ColorF(0.25f, 0.25f, 0.27f, 1));
+ dc->DrawEllipse(D2D1::Ellipse({ sr.left + 13, (sr.top + sr.bottom) / 2 - 1 }, 4, 4), br, 1.5f);
+ Line(dc, br, sr.left + 16, (sr.top + sr.bottom) / 2 + 2, sr.left + 19, (sr.top + sr.bottom) / 2 + 5, 1.8f);
+ D2D1_RECT_F tr = D2D1::RectF(sr.left + 24, sr.top, sr.right - 8, sr.bottom);
+ if (!g_search.text.empty() || g_searchFocus) {
+ ID2D1SolidColorBrush* sel = nullptr; dc->CreateSolidColorBrush(D2D1::ColorF(0.36f, 0.60f, 0.95f, 0.35f), &sel);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.9f));
+ bool caret = g_searchFocus && ((GetTickCount() - g_caretAt) / 530) % 2 == 0;
+ g_search.Draw(dc, g_lf, tr, br, sel, br, caret, false);
+ if (sel) sel->Release();
+ }
+ g_hits.push_back({ H_SEARCH, sr });
+ if (g_sheet.open) { g_hits.clear(); DrawSheet(c, pal); }
+ br->Release();
+ gfx::End();
+}
+
// ================= Quadro
void Render() {
+ if (Leo()) { RenderLeopard(); return; } // Mac OS X Leopard: as Preferências do Sistema do 10.5 (desenho próprio)
auto* dc = gfx::Begin(g_dpi);
if (!dc) return;
if (!g_round) {
@@ -1155,6 +1619,8 @@ void Render() {
br->SetColor(pal.divider);
dc->FillRectangle(D2D1::RectF(SIDE_W - 0.5f, 0, SIDE_W + 0.5f, s.height), br);
}
+ // Leopard: a barra de cima é o metal "unified" do 10.5, de ponta a ponta (os três botões e o título por cima)
+ if (!g_tahoe && tahoe::Leopard()) leopard::Metal(dc, D2D1::RectF(0, 0, s.width, TOOL_H), g_winActive, g_dark, true);
// conteúdo
// Golden Gate (Aparência do macOS 27, 2x): caixas a 21 da barra lateral e 20,5 da direita, a primeira a 64,5 do alto
@@ -1330,6 +1796,11 @@ LRESULT HitTestNC(HWND h, LPARAM l) {
}
D2D1_POINT_2F d = ToDip(p.x, p.y);
if (g_sheet.open) return HTCLIENT;
+ if (Leo()) { // Leopard: a barra inteira arrasta, menos os botões, a busca e os três botões da janela
+ if (d.y >= TOOL_H) return HTCLIENT;
+ for (auto& hh : g_hits) if (d.x >= hh.r.left && d.x < hh.r.right && d.y >= hh.r.top && d.y < hh.r.bottom) return HTCLIENT;
+ return HTCAPTION;
+ }
bool lights = d.x >= 10 && d.x < 76 && d.y < 40;
bool arrows = d.x >= SIDE_W + 10 && d.x < SIDE_W + 84 && d.y < TOOL_H;
if (!lights && !arrows && (d.y < TOOL_H - 4 && (d.x >= SIDE_W || d.y < SEARCH_Y - 4))) return HTCAPTION;
@@ -1337,7 +1808,9 @@ LRESULT HitTestNC(HWND h, LPARAM l) {
}
void ApplyWindowTheme() {
- SIDE_W = g_tahoe ? (Golden() ? 231.f : 247.f) : 215.f; // Tahoe: 8 de recuo + 239 do painel; Golden Gate: 231 até a borda
+ SIDE_W = g_tahoe ? (Golden() ? 231.f : 247.f) : 215.f;
+ TOOL_H = Leo() ? 56.f : 52.f;
+ if (Leo()) SIDE_W = 0; // Leopard: as Preferências do Sistema não têm barra lateral (Mostrar Todos) // Tahoe: 8 de recuo + 239 do painel; Golden Gate: 231 até a borda
SIDE_ROW = g_tahoe ? 32.f : 28.f;
ROW_H = g_tahoe ? (Golden() ? 37.5f : 42.f) : 38.f; // macOS 27: linhas de 37,5 (as com ícone, 49)
SEARCH_Y = Golden() ? 62.f : 52.f;
@@ -1366,6 +1839,10 @@ void Click(D2D1_POINT_2F p, bool right) {
if (!hp) { if (g_searchFocus) { g_searchFocus = false; Invalidate(); } return; }
Hit h = *hp;
if (h.kind != H_SEARCH && g_searchFocus) { g_searchFocus = false; }
+ if ((int)h.kind == H_SHOWALL) { // Leopard: "Mostrar Todos" (a grade de painéis)
+ g_leoAll = true; g_search.SetText(L"", false); UpdateSideVisible(); g_scroll = g_scrollTarget = 0; Invalidate(); return;
+ }
+ if (h.kind == H_BACK && Leo() && !g_leoAll && g_histAt <= 0) { g_leoAll = true; g_scroll = g_scrollTarget = 0; Invalidate(); return; }
switch (h.kind) {
case H_LIGHT:
if (h.a == 0) PostMessageW(g_hwnd, WM_CLOSE, 0, 0);
@@ -1516,7 +1993,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
return 0;
}
if (w == T_REFRESH) {
- if (tahoe::Reload()) { g_tahoe = tahoe::On(); ApplyWindowTheme(); shadow::Update(); Invalidate(); }
+ if (tahoe::Reload()) { g_tahoe = tahoe::On(); g_dark = ReadDark(); ApplyWindowTheme(); shadow::Update(); Invalidate(); }
if (!g_sheet.open && g_drag.g < 0 && !ctxmenu::IsOpen()) {
bool d = ReadDark();
if (d != g_dark) { g_dark = d; ApplyWindowTheme(); }
@@ -1587,7 +2064,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
return TRUE;
}
case WM_APP_REBUILD:
- if (tahoe::Reload()) { g_tahoe = tahoe::On(); ApplyWindowTheme(); shadow::Update(); } // Tema trocado aqui mesmo
+ if (tahoe::Reload()) { g_tahoe = tahoe::On(); g_dark = ReadDark(); ApplyWindowTheme(); shadow::Update(); } // Tema trocado aqui mesmo
if (g_drag.g < 0 && !ctxmenu::IsOpen()) ShowPage();
Invalidate();
return 0;
@@ -1719,6 +2196,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, LPWSTR, int) {
g_hist.push_back({ std::max(start, 0), {} });
g_histAt = 0;
ShowPage();
+ g_leoAll = page.empty(); // Leopard: abre no Mostrar Todos, a não ser que tenham pedido um painel
if (page == L"atualizacao") OpenUpdatePage();
// escondida (cloak) até o primeiro quadro estar pronto: sem isso a janela aparecia com a área da
diff --git a/src/ajustes/paginas.cpp b/src/ajustes/paginas.cpp
index 5687011..323d70c 100644
--- a/src/ajustes/paginas.cpp
+++ b/src/ajustes/paginas.cpp
@@ -648,12 +648,25 @@ Row TemaRow() {
// Aqua de vidro, um canto só e menor em todas as janelas e o controle de transparência). Golden Gate =
// liquid_glass=1 + golden_gate=1, então tudo o que só conhece o Tahoe continua funcionando. Detalhes do vidro em
// Transparência e Efeitos.
- return Popup(L"Tema", { L"macOS Sequoia", L"macOS Tahoe", L"macOS Golden Gate" },
- [] { return Setting(L"liquid_glass", L"0") != L"1" ? 0 : Setting(L"golden_gate", L"0") == L"1" ? 2 : 1; },
+ // Mac OS X Leopard (10.5, 2007) = leopard=1 SEM o liquid_glass: o Sequoia por baixo (tudo o que não conhece o
+ // Leopard continua no visual do Sequoia) e, por cima, o Aqua de 2007: barra de menus clara com a maçã grafite, Dock
+ // em prateleira espelhada, botões de gel e barras cinza metálico. Ligar o Liquid Glass em outro lugar desliga o
+ // Leopard sozinho (leopard só vale com liquid_glass=0).
+ // O Leopard ainda não saiu (fora do build-12): só aparece com leopard_previa=1 no ajustes.txt, ou para quem já
+ // está nele (para conseguir sair). Sem a opção, o pacote também não leva icones\leopard nem cursor\Leopard.
+ bool leopardOn = Setting(L"leopard_previa", L"0") == L"1" || Setting(L"leopard", L"0") == L"1";
+ std::vector<std::wstring> temas = { L"macOS Sequoia", L"macOS Tahoe", L"macOS Golden Gate" };
+ if (leopardOn) temas.push_back(L"Mac OS X Leopard");
+ return Popup(L"Tema", temas,
+ [] {
+ if (Setting(L"liquid_glass", L"0") != L"1") return Setting(L"leopard", L"0") == L"1" ? 3 : 0;
+ return Setting(L"golden_gate", L"0") == L"1" ? 2 : 1;
+ },
[](int i) {
if (i == 2) SetSetting(L"liquid_estilo", L"nitido"); // o vidro do Golden Gate é o controle deslizante
+ SetSetting(L"leopard", i == 3 ? L"1" : L"0");
SetSetting(L"golden_gate", i == 2 ? L"1" : L"0");
- SetSetting(L"liquid_glass", i >= 1 ? L"1" : L"0");
+ SetSetting(L"liquid_glass", i == 1 || i == 2 ? L"1" : L"0");
// o papel de parede do usuário nunca muda ao trocar de tema (o usuário pediu)
Rebuild();
});
@@ -695,7 +708,10 @@ Row GlassEstiloRow(bool title = true) { // title = false: embaixo da foto da p
}
Page AparenciaGolden();
+Page AparenciaLeopard();
Page Aparencia() {
+ // Mac OS X Leopard: o painel Aparência do 10.5 (pop-ups Aqua em vez das miniaturas do macOS moderno)
+ if (Setting(L"leopard", L"0") == L"1" && Setting(L"liquid_glass", L"0") != L"1") return AparenciaLeopard();
// a página do macOS 27 vale para os três temas (o usuário pediu): no Tahoe a foto ganha a escolha Transparente /
// Tingido no lugar do controle; no Sequoia (sem Liquid Glass) só Aparência, Tema e o resto. A antiga fica de reserva.
if (true) return AparenciaGolden();
@@ -1168,7 +1184,54 @@ Page AparenciaGolden() {
p.groups.push_back(G({ Link(L"Transparência e Efeitos", [] { Push(L"Transparência e Efeitos", TransparenciaEfeitos); }, 0xE790, C_BLUE) }));
Row tema = TemaRow();
tema.label = L"Estilo do WacOS";
- p.groups.push_back(G({ tema }));
+ if (Setting(L"leopard", L"0") == L"1" && Setting(L"liquid_glass", L"0") != L"1") {
+ // Leopard: o Aurora (o papel de parede padrão do 10.5) só como sugestão; trocar de tema nunca muda o papel de
+ // parede do usuário (pedido dele), quem troca é este botão
+ Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", [] {
+ wchar_t prof[MAX_PATH] = {};
+ if (!GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) return;
+ std::wstring f = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";
+ if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) sys::SetWallpaper(f);
+ Rebuild();
+ }, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");
+ p.groups.push_back(G({ tema, aurora }));
+ } else p.groups.push_back(G({ tema }));
+ return p;
+}
+
+// ================= Aparência no Mac OS X Leopard
+// O painel "Aparência" das Preferências do Sistema do 10.5: Aparência (Azul / Grafite: botões, menus e janelas), Cor
+// de realce (a seleção do texto), barras de rolagem, a barra de menus translúcida (10.5.2) e o tema do WacOS.
+Page AparenciaLeopard() {
+ Page p;
+ p.groups.push_back(G({
+ Popup(L"Aparência", { L"Azul", L"Grafite" }, [] { return Setting(L"destaque", L"azul") == L"grafite" ? 1 : 0; },
+ [](int i) { SetSetting(L"destaque", i == 1 ? L"grafite" : L"azul"); Rebuild(); }),
+ Popup(L"Cor de realce", { L"Automática", L"Azul", L"Roxo", L"Rosa", L"Vermelho", L"Laranja", L"Amarelo", L"Verde", L"Grafite" },
+ [] { return std::clamp(_wtoi(Setting(L"realce_texto", L"0").c_str()), 0, 8); }, [](int i) { GGAplicaRealce(i); Rebuild(); }),
+ Note(L"A aparência vale para os botões, menus e janelas."),
+ }));
+ p.groups.push_back(G({
+ Popup(L"Mostrar barras de rolagem", { L"Ao rolar", L"Sempre" },
+ [] { DWORD v = 1, cb = sizeof(v); RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_REG_DWORD, nullptr, &v, &cb); return v ? 0 : 1; },
+ [](int i) {
+ DWORD v = i == 0 ? 1 : 0;
+ RegSetKeyValueW(HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", REG_DWORD, &v, sizeof(v));
+ SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)L"Accessibility", SMTO_ABORTIFHUNG, 200, nullptr);
+ }),
+ Toggle(L"Barra de menus translúcida", [] { return Setting(L"barra_translucida", L"1") == L"1"; },
+ [](bool v) { SetSetting(L"barra_translucida", v ? L"1" : L"0"); Rebuild(); }),
+ }));
+ Row tema = TemaRow();
+ tema.label = L"Estilo do WacOS";
+ Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", [] {
+ wchar_t prof[MAX_PATH] = {};
+ if (!GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) return;
+ std::wstring f = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";
+ if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) sys::SetWallpaper(f);
+ Rebuild();
+ }, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");
+ p.groups.push_back(G({ tema, aurora }));
return p;
}
@@ -1243,13 +1306,13 @@ Page TransparenciaEfeitos() {
float w = 92, gap = 16, x = rr.right - 10 - 3 * w - 2 * gap;
for (int k = 0; k < 3; k++, x += w + gap) {
if (pt.x < x - 6 || pt.x > x + w + 6) continue;
- if (k == 0) { SetSetting(L"liquid_glass", L"0"); SetSetting(L"golden_gate", L"0"); } // Sequoia: sai do Golden Gate também
+ if (k == 0) { SetSetting(L"liquid_glass", L"0"); SetSetting(L"golden_gate", L"0"); SetSetting(L"leopard", L"0"); } // Sequoia: sai do Golden Gate e do Leopard também
else { SetSetting(L"liquid_estilo", k == 1 ? L"nitido" : L"tingido"); SetSetting(L"liquid_glass", L"1"); }
Rebuild();
}
};
Row lg = Toggle(L"Liquid Glass", [] { return Setting(L"liquid_glass", L"0") == L"1"; },
- [](bool v) { SetSetting(L"liquid_glass", v ? L"1" : L"0"); if (!v) SetSetting(L"golden_gate", L"0"); Rebuild(); },
+ [](bool v) { SetSetting(L"liquid_glass", v ? L"1" : L"0"); if (!v) SetSetting(L"golden_gate", L"0"); else SetSetting(L"leopard", L"0"); Rebuild(); },
L"O vidro do macOS Tahoe: pouco fosco e mais vivo, com brilho nas bordas e cantos mais redondos.");
lg.enabled = !reduce;
// vidro real: a tela por baixo, com refração de verdade na borda (como o Tahoe); desligado, o vidro
diff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.inc
index b676796..c80b579 100644
--- a/src/comum/idioma_en.inc
+++ b/src/comum/idioma_en.inc
@@ -1423,3 +1423,23 @@
{ L"Ocultar Ícones da Mesa", L"Hide Desktop Icons" },
{ L"Mostrar Ícones na Mesa", L"Show Desktop Icons" },
{ L"Mostrar ícones na mesa", L"Show icons on desktop" },
+{ L"Papel de parede do Leopard", L"Leopard wallpaper" },
+{ L"Usar o Aurora", L"Use Aurora" },
+{ L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.", L"Aurora, the original Mac OS X Leopard wallpaper. Changing the theme never changes your wallpaper." },
+{ L"Versão 10.5.8", L"Version 10.5.8" },
+{ L"Atualização de Software…", L"Software Update…" },
+{ L"Disco de Inicialização", L"Startup Disk" },
+{ L"™ e © 1983-2009 Apple Inc.", L"TM & © 1983-2009 Apple Inc." },
+{ L"Cor de realce", L"Highlight color" },
+{ L"A aparência vale para os botões, menus e janelas.", L"Appearance applies to buttons, menus and windows." },
+{ L"Barra de menus translúcida", L"Translucent Menu Bar" },
+{ L"Compartilhado", L"Shared" },
+{ L"Buscar Por", L"Search For" },
+{ L"Semana Passada", L"Past Week" },
+{ L"Todas as Imagens", L"All Images" },
+{ L"Todos os Filmes", L"All Movies" },
+{ L"Todos os Documentos", L"All Documents" },
+{ L"Preferências do Sistema", L"System Preferences" },
+{ L"Mostrar Todos", L"Show All" },
+{ L"Hardware", L"Hardware" },
+{ L"Internet e Rede", L"Internet & Network" },
diff --git a/src/comum/leopard.h b/src/comum/leopard.h
new file mode 100644
index 0000000..59c572b
--- /dev/null
+++ b/src/comum/leopard.h
@@ -0,0 +1,82 @@
+#pragma once
+// Tema Mac OS X Leopard (10.5, 2007): leopard=1 no %APPDATA%\Shell\ajustes.txt, só sem o liquid_glass (o Sequoia
+// fica por baixo; o Leopard troca a barra de menus, a Dock, os botões da janela e as barras das janelas).
+// Aqui o desenho comum a todos os programas: o cinza metálico das janelas "unified" do Leopard (barra de título e
+// barra de ferramentas numa peça só, com um degradê de cima para baixo) e a barra de baixo das janelas.
+// Cores medidas pixel a pixel em capturas do 10.5 a 1x (galeria do toastytech.com: Font Book na frente, Finder e
+// iCal atrás). A barra "unified" (título + ferramentas) tem 55 px:
+// na frente: fio de luz 220, depois 197 em cima -> 150 embaixo, fio escuro 64 embaixo
+// atrás: fio de luz 241, depois 233 em cima -> 207 embaixo, fio 135 embaixo
+// barra de baixo (atrás): fio 238, 228 -> 207
+// O Leopard não tinha modo escuro: no escuro do Windows o metal vira grafite (o texto e os ícones dos apps seguem
+// claros, então continuam legíveis).
+#include <d2d1.h>
+#include "semaforo.h"
+
+namespace leopard {
+
+inline bool On() { return semaforo::Leopard(); }
+
+// o degradê metálico em r (DIP). top = true: barra de cima (fio escuro embaixo); false: barra de baixo (fio escuro
+// em cima). rTop: canto arredondado de cima (barra de título de uma janela com cantos redondos), 0 = reto.
+inline void Metal(ID2D1RenderTarget* rt, D2D1_RECT_F r, bool active, bool dark, bool top = true, float rTop = 0) {
+ if (!rt || r.bottom <= r.top || r.right <= r.left) return;
+ auto G = [](float v, float a = 1) { return D2D1::ColorF(v, v, v, a); };
+ D2D1_COLOR_F c0, c1, edge;
+ float hl = active ? 220 / 255.f : 241 / 255.f; // o fio de luz do alto
+ if (dark) { c0 = G(active ? 0.36f : 0.30f); c1 = G(active ? 0.22f : 0.24f); edge = G(0.06f); hl = 0.42f; }
+ else if (active) { c0 = G(197 / 255.f); c1 = G(150 / 255.f); edge = G(64 / 255.f); }
+ else { c0 = G(233 / 255.f); c1 = G(207 / 255.f); edge = G(135 / 255.f); }
+ if (!top && !dark) { // barra de baixo: o mesmo metal (atrás: 228 -> 207, fio 238; na frente proporcional)
+ c0 = G(active ? 190 / 255.f : 228 / 255.f); c1 = G(active ? 150 / 255.f : 207 / 255.f); hl = active ? 214 / 255.f : 238 / 255.f;
+ }
+ ID2D1Factory* f = nullptr; rt->GetFactory(&f);
+ ID2D1Geometry* shape = nullptr;
+ if (rTop > 0.5f && f) { // só os cantos de cima arredondados
+ ID2D1PathGeometry* g = nullptr;
+ if (SUCCEEDED(f->CreatePathGeometry(&g))) {
+ ID2D1GeometrySink* sk = nullptr;
+ if (SUCCEEDED(g->Open(&sk))) {
+ float R = rTop;
+ sk->BeginFigure({ r.left, r.bottom }, D2D1_FIGURE_BEGIN_FILLED);
+ sk->AddLine({ r.left, r.top + R });
+ sk->AddArc(D2D1::ArcSegment({ r.left + R, r.top }, { R, R }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
+ sk->AddLine({ r.right - R, r.top });
+ sk->AddArc(D2D1::ArcSegment({ r.right, r.top + R }, { R, R }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
+ sk->AddLine({ r.right, r.bottom });
+ sk->EndFigure(D2D1_FIGURE_END_CLOSED);
+ sk->Close(); sk->Release();
+ shape = g;
+ } else g->Release();
+ }
+ }
+ D2D1_GRADIENT_STOP st[2] = { { 0, c0 }, { 1, c1 } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb))) {
+ if (shape) rt->FillGeometry(shape, lb); else rt->FillRectangle(r, lb);
+ }
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ float dpx = 96, dpy = 96; rt->GetDpi(&dpx, &dpy);
+ float px = 96.f / dpx; // um pixel da tela, em DIP
+ ID2D1SolidColorBrush* b = nullptr;
+ if (SUCCEEDED(rt->CreateSolidColorBrush(G(hl), &b))) {
+ // o fio de luz: no alto da barra de cima (abaixo do canto) e no alto da barra de baixo
+ rt->FillRectangle(D2D1::RectF(r.left + (top ? rTop * 0.7f : 0), r.top + (top ? 0 : px), r.right - (top ? rTop * 0.7f : 0), r.top + (top ? px : 2 * px)), b);
+ b->SetColor(edge);
+ if (top) rt->FillRectangle(D2D1::RectF(r.left, r.bottom - px, r.right, r.bottom), b);
+ else rt->FillRectangle(D2D1::RectF(r.left, r.top, r.right, r.top + px), b);
+ b->Release();
+ }
+ if (shape) shape->Release();
+ if (f) f->Release();
+}
+
+// cor da barra lateral do Finder/Ajustes do Leopard (o azul-acinzentado do iTunes 7): na frente / atrás
+inline D2D1_COLOR_F Sidebar(bool active, bool dark) {
+ if (dark) return D2D1::ColorF(0.17f, 0.18f, 0.20f, 1);
+ return active ? D2D1::ColorF(214 / 255.f, 221 / 255.f, 229 / 255.f, 1) : D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1);
+}
+
+} // namespace leopard
diff --git a/src/comum/nomes.h b/src/comum/nomes.h
index a4ad0e3..c569030 100644
--- a/src/comum/nomes.h
+++ b/src/comum/nomes.h
@@ -1,27 +1,27 @@
-#pragma once
-// Nomes dos executáveis do projeto (em inglês, prefixo Sequoia). O Gerenciador de Tarefas mostra a
-// descrição e o ícone de cada um (recursos gerados por tools\recursos.ps1 no build.cmd).
-// Os nomes antigos (Shell.exe, Arquivos.exe...) só aparecem onde é preciso reconhecer processos velhos.
-#define EXE_SHELL L"WacOSShell.exe" // antes Shell.exe
-#define EXE_FINDER L"WacOSFinder.exe" // antes Arquivos.exe
-#define EXE_SETTINGS L"WacOSSettings.exe" // antes Ajustes.exe
-#define EXE_MONITOR L"WacOSActivityMonitor.exe" // antes MonitorAtividade.exe
-#define EXE_TERMINAL L"WacOSTerminal.exe" // antes Terminal.exe
-#define EXE_CALCULATOR L"WacOSCalculator.exe" // antes Calculadora.exe
-#define EXE_NOTES L"WacOSNotes.exe" // antes Notas.exe
-#define EXE_SCREENSHOT L"WacOSScreenshot.exe" // Captura de Tela (Win+Shift+3/4/5)
-#define EXE_PREVIEW L"WacOSPreview.exe" // Pré-Visualização (imagens e PDF)
-#define EXE_REMINDERS L"WacOSReminders.exe" // Lembretes
-#define EXE_CALENDAR L"WacOSCalendar.exe" // Calendário
-#define EXE_TEXTEDIT L"WacOSTextEdit.exe" // TextEdit
-#define EXE_CLOCK L"WacOSClock.exe" // Relógio
-#define EXE_WEATHER L"WacOSWeather.exe" // Clima
-#define EXE_CONTACTS L"WacOSContacts.exe" // Contatos
-#define EXE_PHOTOS L"WacOSPhotos.exe" // Fotos
-#define EXE_TIMEMACHINE L"WacOSTimeMachine.exe" // Time Machine
-#define EXE_MUSIC L"WacOSMusic.exe" // Música
-#define EXE_QUICKTIME L"WacOSQuickTime.exe" // QuickTime Player
-#define EXE_FORCEQUIT L"WacOSForceQuit.exe" // Forçar Encerrar Aplicativos (Ctrl+Alt+Esc)
-#define DLL_WINDOW L"WacOSWindow.dll" // antes MacJanela.dll
-#define DLL_WINDOW32 L"WacOSWindow32.dll" // antes MacJanela32.dll
-#define EXE_WINDOW32HOST L"WacOSWindow32Host.exe" // antes MacJanela32Host.exe
+#pragma once
+// Nomes dos executáveis do projeto (em inglês, prefixo Sequoia). O Gerenciador de Tarefas mostra a
+// descrição e o ícone de cada um (recursos gerados por tools\recursos.ps1 no build.cmd).
+// Os nomes antigos (Shell.exe, Arquivos.exe...) só aparecem onde é preciso reconhecer processos velhos.
+#define EXE_SHELL L"WacOSShell.exe" // antes Shell.exe
+#define EXE_FINDER L"WacOSFinder.exe" // antes Arquivos.exe
+#define EXE_SETTINGS L"WacOSSettings.exe" // antes Ajustes.exe
+#define EXE_MONITOR L"WacOSActivityMonitor.exe" // antes MonitorAtividade.exe
+#define EXE_TERMINAL L"WacOSTerminal.exe" // antes Terminal.exe
+#define EXE_CALCULATOR L"WacOSCalculator.exe" // antes Calculadora.exe
+#define EXE_NOTES L"WacOSNotes.exe" // antes Notas.exe
+#define EXE_SCREENSHOT L"WacOSScreenshot.exe" // Captura de Tela (Win+Shift+3/4/5)
+#define EXE_PREVIEW L"WacOSPreview.exe" // Pré-Visualização (imagens e PDF)
+#define EXE_REMINDERS L"WacOSReminders.exe" // Lembretes
+#define EXE_CALENDAR L"WacOSCalendar.exe" // Calendário
+#define EXE_TEXTEDIT L"WacOSTextEdit.exe" // TextEdit
+#define EXE_CLOCK L"WacOSClock.exe" // Relógio
+#define EXE_WEATHER L"WacOSWeather.exe" // Clima
+#define EXE_CONTACTS L"WacOSContacts.exe" // Contatos
+#define EXE_PHOTOS L"WacOSPhotos.exe" // Fotos
+#define EXE_TIMEMACHINE L"WacOSTimeMachine.exe" // Time Machine
+#define EXE_MUSIC L"WacOSMusic.exe" // Música
+#define EXE_QUICKTIME L"WacOSQuickTime.exe" // QuickTime Player
+#define EXE_FORCEQUIT L"WacOSForceQuit.exe" // Forçar Encerrar Aplicativos (Ctrl+Alt+Esc)
+#define DLL_WINDOW L"WacOSWindow.dll" // antes MacJanela.dll
+#define DLL_WINDOW32 L"WacOSWindow32.dll" // antes MacJanela32.dll
+// (WacOSWindow32Host.exe saiu no build-12: o hospedeiro de 32 bits agora é o rundll32 do Windows)
diff --git a/src/comum/semaforo.h b/src/comum/semaforo.h
index bf57309..d0df2bb 100644
--- a/src/comum/semaforo.h
+++ b/src/comum/semaforo.h
@@ -16,13 +16,13 @@ namespace semaforo {
enum Kind { FILL, RING, GLYPH };
// lê destaque= e o tema (golden_gate=1 junto com liquid_glass=1 = macOS Golden Gate) do ajustes.txt
-struct Estado { bool grafite = false, aqua = false, liquid = false; };
-inline const Estado& Ler() {
+struct Estado { bool grafite = false, aqua = false, liquid = false, leopard = false; };
+inline const Estado& Ler(bool force = false) { // force: relê já (o Shell avisou que os ajustes mudaram)
static Estado st;
static DWORD lastCheck = 0;
static FILETIME lastWrite{};
DWORD now = GetTickCount();
- if (lastCheck && now - lastCheck < 500) return st;
+ if (lastCheck && now - lastCheck < 500 && !force) return st;
lastCheck = now;
wchar_t ad[MAX_PATH];
DWORD n = GetEnvironmentVariableW(L"APPDATA", ad, MAX_PATH);
@@ -34,17 +34,19 @@ inline const Estado& Ler() {
lastWrite = fa.ftLastWriteTime;
FILE* f = nullptr;
if (_wfopen_s(&f, path.c_str(), L"r, ccs=UTF-8") || !f) return st;
- bool g = false, liquid = false, golden = false;
+ bool g = false, liquid = false, golden = false, leo = false;
wchar_t line[512];
while (fgetws(line, 512, f)) {
if (wcsncmp(line, L"destaque=", 9) == 0) g = wcsncmp(line + 9, L"grafite", 7) == 0;
if (wcsncmp(line, L"liquid_glass=", 13) == 0) liquid = line[13] == L'1';
if (wcsncmp(line, L"golden_gate=", 12) == 0) golden = line[12] == L'1';
+ if (wcsncmp(line, L"leopard=", 8) == 0) leo = line[8] == L'1';
}
fclose(f);
st.grafite = g;
st.aqua = liquid && golden;
st.liquid = liquid;
+ st.leopard = leo && !liquid; // Mac OS X Leopard: só sem o Liquid Glass (o Sequoia por baixo)
return st;
}
@@ -59,6 +61,59 @@ inline bool Grafite() { return Ler().grafite; }
// zoom (96,208,40) -> (152,218,120); aro (9,85,9)
inline bool Aqua() { return Ler().aqua; }
inline bool Liquid() { return Ler().liquid; } // Tahoe ou Golden Gate (cantos de 16)
+inline bool Leopard() { return Ler().leopard; } // tema Mac OS X Leopard (leopard=1, sem liquid_glass)
+
+// Mac OS X Leopard (10.5): os botões de gel do Aqua. Cada um é uma bolha de vidro colorido: o miolo mais claro
+// embaixo (a luz que atravessa o gel e sai por baixo), a borda saturada e escura, um aro fino ainda mais escuro e o
+// reflexo branco em meia-lua na metade de cima. Cores medidas no Font Book ativo de uma captura do 10.5 a 1x (botão
+// de 14 px, 21 px entre centros; borda -> miolo; aro):
+// fechar (184,43,44) -> (253,93,93); aro (140,42,44)
+// minim. (207,131,59) -> (252,212,106); aro (165,83,34)
+// zoom (99,153,62) -> (167,217,100); aro (53,88,35)
+// inativo (190,190,190)-> (209,209,209); aro (163,163,163) (Finder atrás)
+inline void DrawGel(ID2D1RenderTarget* rt, int k, D2D1_POINT_2F c, float r, float dark) {
+ auto C = [](int R, int G, int B, float a = 1) { return D2D1::ColorF(R / 255.f, G / 255.f, B / 255.f, a); };
+ static const int edge[4][3] = { { 184, 43, 44 }, { 207, 131, 59 }, { 99, 153, 62 }, { 190, 190, 190 } };
+ static const int core[4][3] = { { 255, 128, 126 }, { 255, 226, 130 }, { 190, 232, 128 }, { 222, 222, 222 } };
+ static const int ring[4][3] = { { 140, 42, 44 }, { 165, 83, 34 }, { 53, 88, 35 }, { 163, 163, 163 } };
+ k = (std::max)(0, (std::min)(3, k));
+ float d = 1 - (std::max)(0.f, (std::min)(0.6f, dark)); // apertado: o gel inteiro escurece
+ auto M = [&](const int* v, float a = 1) { return C((int)(v[0] * d), (int)(v[1] * d), (int)(v[2] * d), a); };
+ D2D1_ELLIPSE disc = D2D1::Ellipse(c, r, r);
+ { // o corpo: degradê radial com o centro embaixo (o brilho de dentro do gel)
+ D2D1_GRADIENT_STOP st[3] = { { 0, M(core[k]) }, { 0.55f, M(core[k]) }, { 1, M(edge[k]) } };
+ st[1].color.r = (st[0].color.r + st[2].color.r) / 2; st[1].color.g = (st[0].color.g + st[2].color.g) / 2; st[1].color.b = (st[0].color.b + st[2].color.b) / 2;
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1RadialGradientBrush* rb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 3, &gs)) &&
+ SUCCEEDED(rt->CreateRadialGradientBrush(D2D1::RadialGradientBrushProperties({ c.x, c.y + r * 0.55f }, { 0, 0 }, r * 1.05f, r * 1.15f), gs, &rb)))
+ rt->FillEllipse(disc, rb);
+ if (rb) rb->Release();
+ if (gs) gs->Release();
+ }
+ { // aro escuro fino em volta
+ ID2D1SolidColorBrush* b = nullptr;
+ if (SUCCEEDED(rt->CreateSolidColorBrush(M(ring[k], 0.95f), &b))) { rt->DrawEllipse(D2D1::Ellipse(c, r - 0.35f, r - 0.35f), b, 0.7f); b->Release(); }
+ }
+ { // o reflexo em meia-lua: branco forte em cima que some antes do meio
+ D2D1_ELLIPSE hl = D2D1::Ellipse({ c.x, c.y - r * 0.50f }, r * 0.55f, r * 0.36f); // o brilho é pequeno e bem no alto
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1, 0.95f * d) }, { 1, D2D1::ColorF(1, 1, 1, 0.08f) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ c.x, c.y - r * 0.88f }, { c.x, c.y + r * 0.02f }), gs, &lb)))
+ rt->FillEllipse(hl, lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ }
+ { // o fio de luz na borda de baixo (a luz saindo do gel)
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1, 0) }, { 1, D2D1::ColorF(1, 1, 1, 0.45f) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ c.x, c.y + r * 0.3f }, { c.x, c.y + r }), gs, &lb)))
+ rt->DrawEllipse(D2D1::Ellipse(c, r - 1.1f, r - 1.1f), lb, 0.8f);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ }
+}
#include "semaforo_mac27.inc" // os três botões do macOS 27 tirados da captura 2x (tools/semaforo-mac27.py)
@@ -92,8 +147,20 @@ inline void DrawMac27(ID2D1RenderTarget* rt, int k, D2D1_POINT_2F c, float r, fl
// do Golden Gate, escolhidos pela cor que está no pincel (vermelho, amarelo, verde; cinza/apagado fica com um degradê
// leve da própria cor). Não mexe na cor do pincel. Fora do Golden Gate não faz nada.
inline void Gloss(ID2D1RenderTarget* rt, D2D1_POINT_2F c, float r, ID2D1SolidColorBrush* fillBrush) {
- if (!rt || !fillBrush || !Aqua()) return;
+ if (!rt || !fillBrush || !(Aqua() || Leopard())) return;
D2D1_COLOR_F base = fillBrush->GetColor();
+ if (Leopard()) { // Leopard: o gel do Aqua, pela cor do pincel (vermelho, amarelo, verde; o resto fica cinza)
+ bool solid = base.a >= 0.9f;
+ float mx = (std::max)(base.r, (std::max)(base.g, base.b));
+ if (solid && mx > 0.5f) {
+ float nr = base.r / mx, ng = base.g / mx, nb = base.b / mx;
+ int k = nr > 0.9f && ng < 0.5f ? 0 : nr > 0.9f && ng >= 0.5f && nb < 0.5f ? 1 : ng > 0.9f && nr < 0.45f ? 2 : -1;
+ static const float ref[3] = { 1.0f, 0.996f, 0.784f };
+ if (k >= 0) { DrawGel(rt, k, c, r, (std::min)(0.6f, (std::max)(0.f, 1 - mx / ref[k]))); return; }
+ }
+ DrawGel(rt, 3, c, r, 0);
+ return;
+ }
auto C = [](int R, int G, int B, float a = 1) { return D2D1::ColorF(R / 255.f, G / 255.f, B / 255.f, a); };
D2D1_COLOR_F top, bot, rim;
bool solid = base.a >= 0.9f;
@@ -179,7 +246,7 @@ inline void Gloss(ID2D1RenderTarget* rt, D2D1_POINT_2F c, float r, ID2D1SolidCol
inline const D2D1_COLOR_F* Pick(const D2D1_COLOR_F* normal, Kind k) {
// Golden Gate: o aro é o do Gloss (escuro só dos lados); o contorno claro antigo some
static const D2D1_COLOR_F none[3] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };
- if (k == RING && Aqua()) return none;
+ if (k == RING && (Aqua() || Leopard())) return none; // Leopard: o aro é o do gel
if (!Grafite()) return normal;
static const D2D1_COLOR_F fill[3] = { { 0.58f, 0.58f, 0.59f, 1 }, { 0.58f, 0.58f, 0.59f, 1 }, { 0.58f, 0.58f, 0.59f, 1 } };
static const D2D1_COLOR_F ring[3] = { { 0.47f, 0.47f, 0.48f, 1 }, { 0.47f, 0.47f, 0.48f, 1 }, { 0.47f, 0.47f, 0.48f, 1 } };
diff --git a/src/finder/finder.h b/src/finder/finder.h
index 7faa319..fe9b5c5 100644
--- a/src/finder/finder.h
+++ b/src/finder/finder.h
@@ -99,6 +99,7 @@ namespace tahoe {
float WindowR(); // cantos das janelas: 26 pt no Tahoe, 16 pt no Golden Gate (um raio só para todas)
int FolderColor(); // Aparência > Cor das pastas (índice de pastacor::colors; -1 = automática)
bool Golden(); // tema macOS Golden Gate (liquid_glass=1 e golden_gate=1): o Tahoe com os ajustes do macOS 27
+bool Leopard(); // tema Mac OS X Leopard (leopard=1 sem liquid_glass): o Sequoia com o metal e o Aqua de 2007
bool On(); // tema Tahoe (liquid_glass=1)
bool Reduced(); // reduzir_transparencia=1: o vidro fica opaco
D2D1_COLOR_F Tint(D2D1_COLOR_F base); // 10 % da cor do papel de parede (tingir_janelas), só no Tahoe
@@ -147,6 +148,9 @@ int Index(const std::wstring& q, const std::wstring& folder, int max, const std:
int Walk(const std::wstring& q, const std::wstring& folder, int max, const std::function<bool(const std::wstring&)>& onPath);
// o índice do Spotlight do Shell (nomes de tudo, instantâneo); -1 se não houver índice
int Spotlight(const std::wstring& q, const std::wstring& folder, int max, const std::function<bool(const std::wstring&)>& onPath);
+// "Buscar por" do Finder do Leopard (buscas prontas no índice, dentro da pasta do usuário, as mais novas primeiro):
+// 0 Hoje, 1 Ontem, 2 Semana Passada, 3 Todas as Imagens, 4 Todos os Filmes, 5 Todos os Documentos
+int Smart(int kind, int max, const std::function<bool(const std::wstring&)>& onPath);
}
// Arquivos como padrão para abrir pastas (HKCU, reversível; ver padrao.cpp).
diff --git a/src/finder/main.cpp b/src/finder/main.cpp
index 7c05421..a3343f1 100644
--- a/src/finder/main.cpp
+++ b/src/finder/main.cpp
@@ -5,6 +5,8 @@
// Arquivos.exe [pasta]
#include "finder.h"
+#include <d2d1effects.h> // Leopard: a perspectiva 3D do Cover Flow
+#pragma comment(lib, "dxguid.lib")
#include <windowsx.h>
#include <shlobj.h>
#include <shlwapi.h>
@@ -40,6 +42,7 @@
#include "pastacor.h" // Personalizar Pasta: cor e símbolo
#include "../comum/abrircom.h" // áudio abre no Música
#include "../comum/semaforo.h"
+#include "../comum/leopard.h" // tema Mac OS X Leopard: barra metálica unificada
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
@@ -59,7 +62,7 @@ inline float SIDEBAR_W = 142; // padrão do vídeo do Sequoia (166 px); arrasta
const float SIDEBAR_MIN = 120, SIDEBAR_MAX = 360;
inline float TOOLBAR_H = 53; // Tahoe: 52 (ApplyWindowTheme; guia macOS26-Theme-Reference, seção 42)
const float PATH_H = 26;
-const float TOOL_CY = 26.3f; // centro dos botões de cima (vídeo do Sequoia: 30 px de 61 na barra de 52 pt)
+inline float TOOL_CY = 26.3f; // centro dos botões de cima (vídeo do Sequoia: 30 px de 61 na barra de 52 pt); Leopard: 38 (ApplyWindowTheme)
inline float STATUS_H = 26, FOOTER_H = 26; // maiores no modo escolher (barra de Abrir/Salvar); + PATH_H com a barra de caminho
// medidas do Finder no vídeo do Sequoia (1 pt = 1,17 px): grade de 102 × 120,5 com ícones de 64,
// alinhada à esquerda com 15,5 dos lados; barra lateral com linhas de 28, texto em 40, ícone em 24,7
@@ -67,7 +70,7 @@ const float GRID_PAD = 20, GRID_PAD_X = 15.5f, LABEL_H = 32;
// linhas e cabeçalhos mudam com o tema (ApplyWindowTheme): Tahoe = guia macOS26-Theme-Reference, seção 42
// (Finder do macOS 26 medido com Acessibilidade): linhas de 32, cabeçalhos de 19 com 13 de espaço antes
inline float SIDE_ROW_H = 28.7f, SIDE_HDR_H = 23.5f;
-const float SIDE_TOP = 47;
+inline float SIDE_TOP = 47; // Leopard: abaixo da barra metálica (ApplyWindowTheme)
const float SEARCH_W = 190, BTN = 28;
const float ICON_MIN = 32, ICON_MAX = 160, SLIDER_W = 70; // só o trilho, como no Finder
}
@@ -138,7 +141,12 @@ static std::wstring g_folder; // vazio quando a "pasta" aberta é uma etiqueta
static int g_tagView = -1; // etiqueta aberta pela barra lateral (-1 = pasta de verdade)
const int VIEW_COMPUTER = tags::COUNT; // g_tagView especial: "Este Computador" (os discos)
const int VIEW_TRASH = tags::COUNT + 1; // g_tagView especial: a Lixeira (do Windows), dentro do Finder
-static std::wstring VirtualName(int v) { return v == VIEW_COMPUTER ? Tr(L"Este Computador") : v == VIEW_TRASH ? Tr(L"Lixeira") : Tr(tags::names[v]); }
+const int VIEW_SMART = tags::COUNT + 2; // Leopard, "Buscar por": VIEW_SMART + 0..5 (search::Smart)
+const wchar_t* SMART_NAMES[6] = { L"Hoje", L"Ontem", L"Semana Passada", L"Todas as Imagens", L"Todos os Filmes", L"Todos os Documentos" };
+static std::wstring VirtualName(int v) {
+ if (v >= VIEW_SMART && v < VIEW_SMART + 6) return Tr(SMART_NAMES[v - VIEW_SMART]);
+ return v == VIEW_COMPUTER ? Tr(L"Este Computador") : v == VIEW_TRASH ? Tr(L"Lixeira") : Tr(tags::names[v]);
+}
static std::vector<Entry> g_all; // conteúdo da pasta
static std::vector<Entry> g_items; // o que aparece (filtrado pela busca)
static std::unordered_map<std::wstring, ID2D1Bitmap*> g_images;
@@ -289,6 +297,7 @@ static std::vector<std::wstring> SameFolderAs(const std::vector<std::wstring>& p
}
static bool IsDarkMode() {
+ if (tahoe::Leopard()) return false; // Leopard: o 10.5 não tinha modo escuro; o metal e a barra lateral são sempre claros
DWORD v = 1, sz = sizeof(v);
RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
L"AppsUseLightTheme", RRF_RT_REG_DWORD, nullptr, &v, &sz);
@@ -359,7 +368,10 @@ const float TAB_H = 30;
static float TabBarH() { return g_tabs.size() > 1 ? TAB_H : 0.f; } // a barra só aparece com 2+ abas
const float TRASH_BAR_H = 38;
static float TrashBarH() { return g_tagView == VIEW_TRASH ? TRASH_BAR_H : 0.f; } // faixa "Lixeira [Esvaziar]"
-static float TopH() { return Lay::TOOLBAR_H + TabBarH() + ScopeBarH() + TrashBarH(); } // fim das barras de cima
+// Leopard: o Cover Flow do 10.5 é a lista com um painel de capas em perspectiva em cima (a 4ª visão do Finder)
+static bool g_coverFlow;
+static float CoverFlowH();
+static float TopH() { return Lay::TOOLBAR_H + TabBarH() + ScopeBarH() + TrashBarH() + CoverFlowH(); } // fim das barras de cima
namespace ListLay {
const float HEADER_H = 28, GROUP_H = 40, SIZE_W = 90, KIND_W = 160, DATE_W = 190;
@@ -379,8 +391,9 @@ static int g_pickView = -1; // visão usada na janela de Abrir/Salvar (-1: list
static bool g_sideWidthSet;
static bool g_pathBarUser; // a barra de caminho das janelas normais (o Abrir/Salvar liga a dele sem mexer nesta) // largura da barra lateral escolhida (arrastando); senão cabe o nome mais longo
static bool g_pathBar = false; // barra de caminho embaixo: desligada, como no Finder (Ctrl+Alt+P liga) // tamanho do texto: ícones / lista e colunas
-static float ListRowH() { return g_listLarge ? 36.f : 24.f; }
-static float ListIcon() { return g_listLarge ? 32.f : 16.f; }
+// Leopard: a lista do 10.5 tem linhas de 19 com o ícone de 16 (sem o tamanho grande do Finder novo)
+static float ListRowH() { return tahoe::Leopard() ? 19.f : g_listLarge ? 36.f : 24.f; }
+static float ListIcon() { return tahoe::Leopard() ? 16.f : g_listLarge ? 32.f : 16.f; }
static std::wstring ExtOf(const Entry& e) {
if (e.dir) return L"";
@@ -404,6 +417,8 @@ static std::wstring KindName(const Entry& e) {
}
// Grupo de um item: (ordem, título). Os títulos seguem o Finder em português.
+// Leopard: o Finder do 10.5 não tinha grupos (a preferência do usuário fica guardada para os outros temas)
+#define g_groupBy (tahoe::Leopard() ? GROUP_NONE : g_groupBy)
static std::pair<int, std::wstring> GroupOf(const Entry& e) {
if (g_groupBy == GROUP_KIND) {
if (e.dir) return { 0, Tr(L"Pastas") };
@@ -486,6 +501,7 @@ static void BuildRows() {
g_rowOfItem[i] = (int)g_rows.size();
g_rows.push_back({ i, L"", y, ListRowH() });
y += ListRowH();
+#undef g_groupBy
}
g_rowsDirty = false;
}
@@ -766,7 +782,7 @@ static void ToggleSection(int header) {
// Barra de ferramentas, como no Sequoia:
// ‹ › [pasta] Título ...... [⊞|☰|▥|▭] [agrupar⌄] [compartilhar] [etiqueta] [⋯⌄] [busca]
-static bool SearchExpanded() { return g_searchFocus || !g_search.text.empty(); }
+static bool SearchExpanded() { return g_searchFocus || !g_search.text.empty() || (!g_tahoe && tahoe::Leopard()); } // Leopard: o campo fica sempre aberto
// Tahoe: um botão só para a visão (ícone da atual + ⌃⌄), como no macOS 26
static bool Golden();
@@ -776,6 +792,24 @@ static bool WideToolbar() { return Golden() ? ClientDip().width - Lay::SIDEBAR_W
static D2D1_RECT_F ToolRect(int k) {
auto s = ClientDip();
float cy = Lay::TOOL_CY, h = Lay::BTN / 2;
+ if (!g_tahoe && tahoe::Leopard()) {
+ // Leopard (Finder do 10.5, foto de referência): ◀ ▶ na ponta esquerda (a barra vai de ponta a ponta), o pop-up
+ // de arrumar ao lado, os quatro modos no meio, a engrenagem ▾ depois deles e o campo de busca na direita.
+ // Compartilhar e Etiquetas não existiam.
+ const float H = 11;
+ if (k == TB_BACK) return { 10, cy - H, 37, cy + H };
+ if (k == TB_FWD) return { 37, cy - H, 64, cy + H };
+ if (k == TB_GROUP) return { 72, cy - H, 114, cy + H };
+ if (k == TB_SEARCH) return { s.width - 12 - std::min(200.f, s.width * 0.22f), cy - 10, s.width - 12, cy + 10 };
+ float vl = std::max(124.f, s.width / 2 - 70);
+ if (k >= TB_V_ICONS && k <= TB_V_GALLERY) {
+ if (!WideToolbar()) return k == TB_V_ICONS ? D2D1_RECT_F{ vl, cy - H, vl + 40, cy + H } : D2D1_RECT_F{ 0, 0, 0, 0 };
+ float x = vl + (k - TB_V_ICONS) * 29.f;
+ return { x, cy - H, x + 29, cy + H };
+ }
+ if (k == TB_ACTION) { float x = vl + (WideToolbar() ? 4 * 29.f : 40.f) + 10; return { x, cy - H, x + 42, cy + H }; }
+ return { 0, 0, 0, 0 }; // Compartilhar, Etiquetas, Lixeira
+ }
if (Golden()) {
// macOS 27 (captura 2x do 512 Pixels): tudo a 8 de distância; Voltar/Avançar 73 × 36; os quatro modos numa
// cápsula de 160 (pílula de 33 × 26 a cada 39,17, a primeira a 4,5 da borda); Agrupar 47; Compartilhar,
@@ -869,7 +903,10 @@ static void SetIconSizeFromSlider(float x);
// Botões da janela (fechar, minimizar, maximizar), no canto superior esquerdo
bool g_tahoeLay; // g_tahoe já aplicado às medidas (ApplyWindowTheme)
// padrão do projeto: 14 pt, 23 entre centros; Tahoe (guia, seção 42): áreas de 16 × 16 em x 18 / 41 / 64 (centros 26, 49, 72)
-static D2D1_POINT_2F LightCenter(int k) { return { (g_tahoeLay ? 26.f : 23.f) + k * 23.f, Lay::TOOL_CY }; }
+static D2D1_POINT_2F LightCenter(int k) {
+ if (!g_tahoeLay && tahoe::Leopard()) return { 14.5f + k * 21.f, 12.f }; // Leopard: na linha do título (22 px), 21 entre centros
+ return { (g_tahoeLay ? 26.f : 23.f) + k * 23.f, Lay::TOOL_CY };
+}
static int HitLight(D2D1_POINT_2F p) {
for (int k = 0; k < 3; k++) {
@@ -879,7 +916,7 @@ static int HitLight(D2D1_POINT_2F p) {
return -1;
}
-static bool OverLightsArea(D2D1_POINT_2F p) { return p.x >= 10 && p.x < LightCenter(2).x + 15 && std::fabs(p.y - Lay::TOOL_CY) <= 10; }
+static bool OverLightsArea(D2D1_POINT_2F p) { return p.x >= 5 && p.x < LightCenter(2).x + 15 && std::fabs(p.y - LightCenter(0).y) <= 10; }
// borda da barra lateral (abaixo da barra de cima): arrastar muda a largura
static bool OverSideEdge(D2D1_POINT_2F p) { return p.y >= Lay::TOOLBAR_H && std::fabs(p.x - Lay::SIDEBAR_W) <= 4; }
static bool g_sideResize;
@@ -1196,6 +1233,15 @@ static void EmptyTrash() {
static void LoadTagItems() {
g_all.clear();
if (g_tagView == VIEW_TRASH) { LoadTrash(); return; }
+ if (g_tagView >= VIEW_SMART && g_tagView < VIEW_SMART + 6) { // Leopard, "Buscar por": a busca pronta no índice
+ int got = search::Smart(g_tagView - VIEW_SMART, 400, [](const std::wstring& p) {
+ Entry e;
+ if (EntryFromPath(p, e)) g_all.push_back(std::move(e));
+ return true;
+ });
+ Log(L"buscar por %ls: %d itens", SMART_NAMES[g_tagView - VIEW_SMART], got);
+ return;
+ }
if (g_tagView == VIEW_COMPUTER) { // discos fixos, removíveis e de rede, na ordem das letras
DWORD drives = GetLogicalDrives();
for (int d = 0; d < 26; d++) {
@@ -1720,6 +1766,7 @@ static Palette Colors() { // Tahoe: o fundo da janela leva 10 % da cor do papel
if (g_tahoe && tahoe::Golden()) p.content = g_dark ? D2D1::ColorF(30 / 255.f, 30 / 255.f, 30 / 255.f, 1) : D2D1::ColorF(1, 1, 1, 1); // Golden Gate: branco puro (medido)
else if (g_tahoe) p.content = tahoe::Tint(p.content);
p.accent = tahoe::Accent(false); // Ajustes > Aparência > Cor de destaque (seleção, ícones da barra lateral...)
+ if (!g_tahoe && tahoe::Leopard()) p.side = leopard::Sidebar(g_winActive, g_dark); // Leopard: barra lateral azul-acinzentada, opaca
return p;
}
static Palette ColorsBase() {
@@ -1824,7 +1871,18 @@ static void DrawToolIcon(ID2D1DeviceContext* dc, int k, D2D1_RECT_F r, ID2D1Brus
Line(dc, b, cx, cy + 3, cx, cy - 9);
Line(dc, b, cx - 3.5f, cy - 5.5f, cx, cy - 9); Line(dc, b, cx, cy - 9, cx + 3.5f, cy - 5.5f);
break;
- case TB_ACTION: { // círculo com reticências + seta
+ case TB_ACTION: { // círculo com reticências + seta (Leopard: a engrenagem ▾)
+ if (!g_tahoe && tahoe::Leopard()) {
+ float gx = cx - 6, gr = 5.2f;
+ for (int i = 0; i < 8; i++) { // os dentes
+ float a = i * 3.14159265f / 4;
+ Line(dc, b, gx + std::cos(a) * gr, cy + std::sin(a) * gr, gx + std::cos(a) * (gr + 2.6f), cy + std::sin(a) * (gr + 2.6f), 2.2f);
+ }
+ dc->DrawEllipse(D2D1::Ellipse({ gx, cy }, gr - 0.6f, gr - 0.6f), b, 2.0f);
+ float ax = r.right - 10;
+ Line(dc, b, ax - 3, cy - 1.5f, ax, cy + 1.5f, 1.4f); Line(dc, b, ax, cy + 1.5f, ax + 3, cy - 1.5f, 1.4f);
+ break;
+ }
float ox = cx - 7.5f;
dc->DrawEllipse(D2D1::Ellipse({ ox, cy }, 8.2f, 8.2f), b, 1.4f);
for (int i = -1; i <= 1; i++) dc->FillEllipse(D2D1::Ellipse({ ox + i * 4.f, cy }, 1.3f, 1.3f), b);
@@ -1864,14 +1922,67 @@ static bool PngPixels(const std::wstring& file, std::vector<BYTE>& out, UINT& w,
// Tahoe: as pastas são os PNG do tema MacTahoe em icones\tahoe (tools\icones-mactahoe.ps1), um por pasta
// especial (o mesmo símbolo que o desenho do Sequoia grava na pasta). Sem o arquivo, segue o desenho.
-static bool DrawTahoeFolder(ID2D1DeviceContext* dc, D2D1_RECT_F box, wchar_t emblem) {
- static std::map<std::wstring, ID2D1Bitmap*> cache; // nome -> bitmap (nullptr: não existe)
+// Leopard: desenha icones\leopard\<nome>.png (tools\icones-leopard.py) em `box`. Os PNGs têm 10 % de margem de cada
+// lado (o formato do pacote): amplia para o desenho ocupar a caixa. false se o arquivo não existe.
+static bool DrawLeoPng(ID2D1DeviceContext* dc, const std::wstring& name, D2D1_RECT_F box) {
+ static std::map<std::wstring, ID2D1Bitmap*> cache;
static std::wstring dir;
if (dir.empty()) {
+ wchar_t exe[MAX_PATH]; ExePath(exe, MAX_PATH);
+ PathRemoveFileSpecW(exe); PathRemoveFileSpecW(exe);
+ dir = std::wstring(exe) + L"\\icones\\leopard\\";
+ }
+ auto it = cache.find(name);
+ if (it == cache.end()) {
+ std::vector<BYTE> px; UINT w = 0, h = 0;
+ ID2D1Bitmap* b = PngPixels(dir + name + L".png", px, w, h) ? gfx::CreateBitmapBGRA(w, h, px.data(), w * 4) : nullptr;
+ it = cache.emplace(name, b).first;
+ }
+ if (!it->second) return false;
+ float S = box.right - box.left, g = S * 0.125f;
+ dc->DrawBitmap(it->second, D2D1::RectF(box.left - g, box.top - g, box.right + g, box.bottom + g), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
+ return true;
+}
+// Leopard: o ícone de documento do 10.5 pela extensão ("" = deixa a miniatura do Windows: fotos, vídeos, apps)
+static std::wstring LeoDocIcon(const std::wstring& name) {
+ const wchar_t* d = wcsrchr(name.c_str(), L'.');
+ std::wstring x = d ? d + 1 : L"";
+ for (auto& c : x) c = towlower(c);
+ static const std::map<std::wstring, const wchar_t*> m = {
+ { L"txt", L"doc texto" }, { L"md", L"doc texto" }, { L"ini", L"doc texto" }, { L"cfg", L"doc texto" }, { L"toml", L"doc texto" },
+ { L"json", L"doc texto" }, { L"yaml", L"doc texto" }, { L"yml", L"doc texto" }, { L"csv", L"doc planilha" }, { L"log", L"doc log" },
+ { L"pdf", L"doc pdf" }, { L"doc", L"doc word" }, { L"docx", L"doc word" }, { L"rtf", L"doc rich" }, { L"odt", L"doc word" },
+ { L"xls", L"doc planilha" }, { L"xlsx", L"doc planilha" }, { L"ods", L"doc planilha" },
+ { L"ppt", L"doc apresentacao" }, { L"pptx", L"doc apresentacao" }, { L"key", L"doc apresentacao" },
+ { L"zip", L"doc zip" }, { L"rar", L"doc zip" }, { L"7z", L"doc zip" }, { L"tar", L"doc zip" }, { L"gz", L"doc zip" },
+ { L"mp3", L"doc audio" }, { L"wav", L"doc audio" }, { L"flac", L"doc audio" }, { L"m4a", L"doc audio" }, { L"ogg", L"doc audio" },
+ { L"aif", L"doc audio" }, { L"aiff", L"doc audio" }, { L"mid", L"doc audio" }, { L"midi", L"doc audio" },
+ { L"html", L"doc html" }, { L"htm", L"doc html" }, { L"xml", L"doc xml" }, { L"js", L"doc script" }, { L"ps1", L"doc script" },
+ { L"sh", L"doc script" }, { L"bat", L"doc script" }, { L"cmd", L"doc script" }, { L"py", L"doc python" }, { L"c", L"doc c" },
+ { L"h", L"doc c" }, { L"cpp", L"doc cpp" }, { L"hpp", L"doc cpp" }, { L"cs", L"doc cpp" }, { L"java", L"doc java" },
+ { L"iso", L"doc disco" }, { L"img", L"doc disco" }, { L"ttf", L"doc fonte" }, { L"otf", L"doc fonte" },
+ { L"dll", L"doc exe" }, { L"sys", L"doc exe" },
+ };
+ auto it = m.find(x);
+ if (it != m.end()) return it->second;
+ static const wchar_t* media[] = { L"png", L"jpg", L"jpeg", L"gif", L"bmp", L"webp", L"heic", L"tif", L"tiff", L"ico", L"svg",
+ L"mp4", L"mov", L"mkv", L"avi", L"wmv", L"webm", L"m4v", L"exe", L"msi", L"lnk", L"url", L"appref-ms" };
+ for (auto* mm : media) if (x == mm) return L"";
+ return L"doc generico";
+}
+
+// Leopard (leo = true): as pastas azuis do 10.5 em icones\leopard (tools\icones-leopard.py), com os mesmos nomes.
+static bool DrawTahoeFolder(ID2D1DeviceContext* dc, D2D1_RECT_F box, wchar_t emblem, bool leo = false) {
+ static std::map<std::wstring, ID2D1Bitmap*> cacheT, cacheL; // nome -> bitmap (nullptr: não existe)
+ auto& cache = leo ? cacheL : cacheT;
+ static std::wstring dirT, dirL;
+ if (dirT.empty()) {
wchar_t exe[MAX_PATH]; ExePath(exe, MAX_PATH);
PathRemoveFileSpecW(exe); PathRemoveFileSpecW(exe); // bin\ -> pasta do projeto
- dir = std::wstring(exe) + L"\\icones\\tahoe\\";
+ dirT = std::wstring(exe) + L"\\icones\\tahoe\\";
+ dirL = std::wstring(exe) + L"\\icones\\leopard\\";
}
+ const std::wstring& dir = leo ? dirL : dirT;
const wchar_t* name = L"folder default";
switch (emblem) {
case 0xE7F4: name = L"folder desktop"; break;
@@ -1890,19 +2001,21 @@ static bool DrawTahoeFolder(ID2D1DeviceContext* dc, D2D1_RECT_F box, wchar_t emb
if (!b && wcscmp(name, L"folder default")) { // pasta especial sem PNG: a padrão
if (PngPixels(dir + L"folder default.png", px, w, h)) b = gfx::CreateBitmapBGRA(w, h, px.data(), w * 4);
}
- if (!b) Log(L"pasta tahoe: sem %ls%ls.png (fica o desenho do Sequoia)", dir.c_str(), name);
+ if (!b) Log(L"pasta do tema: sem %ls%ls.png (fica o desenho do Sequoia)", dir.c_str(), name);
it = cache.emplace(name, b).first;
}
if (!it->second) return false;
// o desenho do tema tem ~6% de margem em volta: amplia um pouco para ocupar o mesmo espaço da pasta do Sequoia
- float S = box.right - box.left, g = S * 0.05f;
+ // (as do Leopard têm 10 % de margem de cada lado, a margem dos ícones do Mac: amplia mais)
+ float S = box.right - box.left, g = S * (leo ? 0.10f : 0.05f);
dc->DrawBitmap(it->second, D2D1::RectF(box.left - g, box.top - g, box.right + g, box.bottom + g), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
return true;
}
static void DrawFolder(ID2D1DeviceContext* dc, D2D1_RECT_F box, wchar_t emblem, ID2D1SolidColorBrush* br) {
if (g_tahoe && DrawTahoeFolder(dc, box, emblem)) return;
+ if (!g_tahoe && tahoe::Leopard() && DrawTahoeFolder(dc, box, emblem, true)) return; // Leopard: as pastas azuis do 10.5
float S = box.right - box.left, x0 = box.left, y0 = box.top;
auto R = [&](float a, float b, float c, float d) { return D2D1::RectF(x0 + a * S, y0 + b * S, x0 + c * S, y0 + d * S); };
@@ -2149,6 +2262,28 @@ static void DrawSidebar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
float y = SideRowTop(k);
if (s.header) {
br->SetColor(g_dark ? D2D1::ColorF(1, 1, 1, 0.32f) : D2D1::ColorF(0, 0, 0, 0.30f));
+ if (!g_tahoe && tahoe::Leopard()) { // Leopard: "DISPOSITIVOS", "LOCAIS" em maiúsculas, negrito azul-acinzentado
+ std::wstring up = s.label;
+ for (auto& ch : up) ch = towupper(ch);
+ br->SetColor(D2D1::ColorF(96 / 255.f, 110 / 255.f, 128 / 255.f, 1));
+ dc->DrawTextW(up.c_str(), (UINT32)up.size(), g_tfSideHdr, D2D1::RectF(21 + dx, y + 8 + SideHeaderGap(k), Lay::SIDEBAR_W - 30, y + SideRowH(k)), br);
+ float tcx = 13 + dx, tcy = y + 14 + SideHeaderGap(k);
+ ID2D1Factory* fac = nullptr; dc->GetFactory(&fac);
+ ID2D1PathGeometry* tri = nullptr;
+ if (fac && SUCCEEDED(fac->CreatePathGeometry(&tri))) {
+ ID2D1GeometrySink* sk = nullptr;
+ if (SUCCEEDED(tri->Open(&sk))) {
+ if (s.collapsed) { sk->BeginFigure({ tcx - 2, tcy - 4 }, D2D1_FIGURE_BEGIN_FILLED); sk->AddLine({ tcx + 3, tcy }); sk->AddLine({ tcx - 2, tcy + 4 }); }
+ else { sk->BeginFigure({ tcx - 4, tcy - 2 }, D2D1_FIGURE_BEGIN_FILLED); sk->AddLine({ tcx + 4, tcy - 2 }); sk->AddLine({ tcx, tcy + 3 }); }
+ sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();
+ br->SetColor(D2D1::ColorF(0.42f, 0.45f, 0.50f, 1));
+ dc->FillGeometry(tri, br);
+ }
+ tri->Release();
+ }
+ if (fac) fac->Release();
+ continue; // Leopard: sem a seta da direita (o triângulo é este)
+ } else
dc->DrawTextW(s.label.c_str(), (UINT32)s.label.size(), g_tfSideHdr, D2D1::RectF(16 + dx, y + 8 + SideHeaderGap(k), Lay::SIDEBAR_W - 30, y + SideRowH(k)), br);
if (k == g_hoverSide) { // seta para recolher/expandir, só ao passar o mouse
float cx = Lay::SIDEBAR_W - 20, cy = y + 14 + SideHeaderGap(k);
@@ -2161,6 +2296,20 @@ static void DrawSidebar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
: D2D1_RECT_F{ 9.5f, y + 1.2f, Lay::SIDEBAR_W - 11, y + Lay::SIDE_ROW_H - 1.2f };
const float rowR = g_tahoe ? 8.f : 6.f;
bool cur = (!s.path.empty() && g_tagView < 0 && SamePath(s.path, g_folder)) || (s.tag >= 0 && s.tag == g_tagView);
+ const bool leoSide = !g_tahoe && tahoe::Leopard();
+ if (leoSide && cur) {
+ D2D1_GRADIENT_STOP st[2] = { { 0, g_winActive ? D2D1::ColorF(0.43f, 0.60f, 0.85f, 1) : D2D1::ColorF(0.68f, 0.68f, 0.70f, 1) },
+ { 1, g_winActive ? D2D1::ColorF(0.24f, 0.44f, 0.76f, 1) : D2D1::ColorF(0.53f, 0.53f, 0.55f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ D2D1_RECT_F full = D2D1::RectF(0, row.top, Lay::SIDEBAR_W, row.bottom);
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, full.top }, { 0, full.bottom }), gs, &lb)))
+ dc->FillRectangle(full, lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ br->SetColor(g_winActive ? D2D1::ColorF(0.33f, 0.52f, 0.80f, 1) : D2D1::ColorF(0.60f, 0.60f, 0.62f, 1)); // o fio de cima
+ dc->FillRectangle(D2D1::RectF(0, full.top, Lay::SIDEBAR_W, full.top + 1), br);
+ } else
if (cur || k == g_hoverSide) {
br->SetColor(cur ? (g_tahoe ? (g_dark ? D2D1::ColorF(1, 1, 1, 0.09f) : D2D1::ColorF(0, 0, 0, 0.07f))
: (g_dark ? D2D1::ColorF(1, 1, 1, 0.14f) : D2D1::ColorF(0, 0, 0, 0.10f))) : pal.hover);
@@ -2181,20 +2330,87 @@ static void DrawSidebar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
} else {
// os ícones da barra lateral na cor de destaque (Ajustes > Aparência), mais clara no escuro, como no Mac
br->SetColor(tahoe::Accent(g_dark));
-
- DrawGlyph(dc, s.glyph, D2D1::RectF(15.7f + dx, y, 33.7f + dx, y + Lay::SIDE_ROW_H), br);
+ // Leopard: as pastinhas azuis coloridas do 10.5 (16 px); o resto em cinza-azulado
+ bool pasta = s.glyph == 0xE7F4 || s.glyph == 0xE8A5 || s.glyph == 0xE896 || s.glyph == 0xE91B || s.glyph == 0xE8D6 ||
+ s.glyph == 0xE714 || s.glyph == 0xE80F || s.glyph == 0xE8B7;
+ float cy = y + Lay::SIDE_ROW_H / 2;
+ const wchar_t* leoIcon = nullptr; // Leopard: o ícone colorido do item, como na barra lateral do 10.5
+ if (leoSide) {
+ if (s.tag == VIEW_COMPUTER) leoIcon = L"side computador";
+ else if (s.tag >= VIEW_SMART && s.tag < VIEW_SMART + 6) leoIcon = s.tag < VIEW_SMART + 3 ? L"side recentes" : L"side inteligente";
+ else switch (s.glyph) {
+ case 0xE823: leoIcon = L"side recentes"; break; case 0xE71D: leoIcon = L"side aplicativos"; break;
+ case 0xE7F4: leoIcon = L"side mesa"; break; case 0xE8A5: leoIcon = L"side documentos"; break;
+ case 0xE896: leoIcon = L"side downloads"; break; case 0xE91B: leoIcon = L"side imagens"; break;
+ case 0xE8D6: leoIcon = L"side musica"; break; case 0xE714: leoIcon = L"side videos"; break;
+ case 0xE80F: leoIcon = L"side casa"; break; case 0xE753: leoIcon = L"side rede"; break;
+ case 0xEDA2: leoIcon = L"side disco"; break; case 0xE88E: leoIcon = L"side removivel"; break;
+ default: leoIcon = L"side pasta"; break;
+ }
+ }
+ if (leoIcon && DrawLeoPng(dc, leoIcon, D2D1::RectF(16.7f + dx, cy - 8, 32.7f + dx, cy + 8))) {}
+ else if (leoSide && pasta) DrawFolder(dc, D2D1::RectF(16.7f + dx, cy - 8, 32.7f + dx, cy + 8), s.glyph == 0xE8B7 ? 0 : s.glyph, br);
+ else {
+ if (leoSide) br->SetColor(cur ? D2D1::ColorF(1, 1, 1, 1) : D2D1::ColorF(96 / 255.f, 110 / 255.f, 128 / 255.f, 1));
+ DrawGlyph(dc, s.glyph, D2D1::RectF(15.7f + dx, y, 33.7f + dx, y + Lay::SIDE_ROW_H), br);
+ }
}
- br->SetColor(g_tahoe && cur ? tahoe::Accent(g_dark) : pal.text);
+ br->SetColor(g_tahoe && cur ? tahoe::Accent(g_dark) : leoSide && cur ? D2D1::ColorF(1, 1, 1, 1) : pal.text);
dc->DrawTextW(s.label.c_str(), (UINT32)s.label.size(), g_tfSide, D2D1::RectF(40 + dx
, y, Lay::SIDEBAR_W - 12, y + Lay::SIDE_ROW_H), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
}
}
+static float TextWidth(const std::wstring& s, IDWriteTextFormat* tf); // mais abaixo
static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidColorBrush* br) {
D2D1_COLOR_F dim = g_dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.18f);
D2D1_COLOR_F icon = g_dark ? D2D1::ColorF(1, 1, 1, 0.78f) : D2D1::ColorF(0, 0, 0, 0.68f);
int selCount = SelCount();
+ const bool leo = !g_tahoe && tahoe::Leopard();
+ if (leo) {
+ // Leopard: botões com moldura de metal claro (degradê branco -> cinza, contorno escuro e fio branco embaixo);
+ // Voltar/Avançar e os quatro modos são segmentados (divisórias finas) e o modo atual fica afundado em cinza
+ auto U = [](D2D1_RECT_F a, D2D1_RECT_F b) { return D2D1_RECT_F{ std::min(a.left, b.left), 0, std::max(a.right, b.right), 0 }; };
+ auto bezel = [&](D2D1_RECT_F r) {
+ if (r.right <= r.left) return;
+ r.top = Lay::TOOL_CY - 11; r.bottom = Lay::TOOL_CY + 11;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.45f)); // o fio branco de baixo (relevo)
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, r.top + 1, r.right, r.bottom + 1), 4, 4), br);
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.99f, 0.99f, 0.99f, 1) }, { 1, D2D1::ColorF(0.84f, 0.84f, 0.84f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))
+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, 4, 4), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.42f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 3.5f, 3.5f), br, 1);
+ };
+ auto divide = [&](D2D1_RECT_F a) { // divisória entre dois segmentos (à direita de a)
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f));
+ dc->DrawLine({ std::floor(a.right) + 0.5f, Lay::TOOL_CY - 10.5f }, { std::floor(a.right) + 0.5f, Lay::TOOL_CY + 10.5f }, br, 1);
+ };
+ bezel(U(ToolRect(TB_BACK), ToolRect(TB_FWD))); divide(ToolRect(TB_BACK));
+ if (WideToolbar()) {
+ bezel(U(ToolRect(TB_V_ICONS), ToolRect(TB_V_GALLERY)));
+ int cur = g_view == View::Icons ? 0 : g_view == View::List ? (g_coverFlow ? 3 : 1) : g_view == View::Columns ? 2 : 3;
+ D2D1_RECT_F c = ToolRect(TB_V_ICONS + cur);
+ if (c.right > c.left) { // o modo atual: afundado (cinza escuro com sombra por dentro)
+ D2D1_RECT_F q{ c.left + 0.5f, Lay::TOOL_CY - 10.5f, c.right - 0.5f, Lay::TOOL_CY + 10.5f };
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.42f, 0.42f, 0.42f, 1) }, { 1, D2D1::ColorF(0.56f, 0.56f, 0.56f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, q.top }, { 0, q.bottom }), gs, &lb)))
+ dc->FillRoundedRectangle(D2D1::RoundedRect(q, cur == 0 || cur == 3 ? 3.f : 0.f, cur == 0 || cur == 3 ? 3.f : 0.f), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ }
+ for (int i = 0; i < 3; i++) divide(ToolRect(TB_V_ICONS + i));
+ } else bezel(ToolRect(TB_V_ICONS));
+ bezel(ToolRect(TB_GROUP));
+ bezel(ToolRect(TB_SHARE)); bezel(ToolRect(TB_TAG)); bezel(ToolRect(TB_ACTION));
+ }
if (g_tahoe) {
// Tahoe: os botões ficam em cápsulas de vidro soltas sobre o conteúdo
auto U = [](D2D1_RECT_F a, D2D1_RECT_F b) { return D2D1_RECT_F{ std::min(a.left, b.left), 0, std::max(a.right, b.right), 0 }; };
@@ -2230,6 +2446,14 @@ static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
: (k == TB_SHARE || k == TB_TRASH || k == TB_TAG) ? selCount > 0 : true; // pedem seleção
bool current = WideToolbar() && ((k == TB_V_ICONS && g_view == View::Icons) || (k == TB_V_LIST && g_view == View::List) ||
(k == TB_V_COLS && g_view == View::Columns) || (k == TB_V_GALLERY && g_view == View::Gallery)); // visão atual destacada
+ if (leo) current = WideToolbar() && ((k == TB_V_ICONS && g_view == View::Icons) || (k == TB_V_LIST && g_view == View::List && !g_coverFlow) ||
+ (k == TB_V_COLS && g_view == View::Columns) || (k == TB_V_GALLERY && (g_view == View::Gallery || g_coverFlow)));
+ if (leo) { // Leopard: a moldura já foi desenhada; o ícone escuro (branco no modo atual), apertado escurece
+ if (enabled && g_pressTool == k) { br->SetColor(D2D1::ColorF(0, 0, 0, 0.18f)); dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, Lay::TOOL_CY - 10, r.right - 1, Lay::TOOL_CY + 10), 3, 3), br); }
+ br->SetColor(current ? D2D1::ColorF(1, 1, 1, 0.95f) : enabled ? D2D1::ColorF(0.15f, 0.15f, 0.15f, 0.9f) : D2D1::ColorF(0, 0, 0, 0.28f));
+ DrawToolIcon(dc, k, r, br);
+ continue;
+ }
if (current || (enabled && g_hoverTool == k)) {
float a = current ? (g_dark ? 0.06f : 0.06f) : pal.hover.a * (g_pressTool == k ? 2 : 1);
if (g_tahoe && current) a = g_dark ? 0.14f : 0.08f; // segmento escolhido: pílula dentro da cápsula
@@ -2241,7 +2465,7 @@ static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
br->SetColor(enabled ? icon : dim);
DrawToolIcon(dc, k, r, br);
}
- if (WideToolbar() && (!g_tahoe || Golden())) { // divisória fina entre dois botões de visão quando nenhum dos dois é o atual
+ if (WideToolbar() && (!g_tahoe || Golden()) && !leo) { // divisória fina entre dois botões de visão quando nenhum dos dois é o atual
int cur = g_view == View::Icons ? 0 : g_view == View::List ? 1 : g_view == View::Columns ? 2 : 3;
br->SetColor(g_dark ? D2D1::ColorF(1, 1, 1, 0.07f) : D2D1::ColorF(0, 0, 0, 0.10f));
for (int i = 0; i < 3; i++) {
@@ -2252,6 +2476,17 @@ static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
dc->DrawLine({ x, Lay::TOOL_CY - 8 }, { x, Lay::TOOL_CY + 8 }, br, 1);
}
}
+ if (leo) { // Leopard: a pastinha e o nome centralizados na linha do título (22 px), com relevo branco
+ std::wstring title = CurrentTitle();
+ auto s = ClientDip();
+ float tw = std::min(s.width - 200, TextWidth(title, g_tfTitle));
+ float x0 = (s.width - tw - 20) / 2;
+ DrawFolder(dc, D2D1::RectF(x0, 3.5f, x0 + 15, 18.5f), 0, br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.5f));
+ dc->DrawTextW(title.c_str(), (UINT32)title.size(), g_tfTitle, D2D1::RectF(x0 + 20, 1, x0 + 20 + tw + 4, 23), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ br->SetColor(D2D1::ColorF(0, 0, 0, g_winActive ? 0.85f : 0.45f));
+ dc->DrawTextW(title.c_str(), (UINT32)title.size(), g_tfTitle, D2D1::RectF(x0 + 20, 0, x0 + 20 + tw + 4, 22), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ } else {
// título; a pastinha só aparece com o mouse em cima (como no Sequoia) e empurra o nome
float tx = ToolRect(TB_FWD).right + 12;
if (g_hoverTitle) DrawFolder(dc, D2D1::RectF(tx, Lay::TOOL_CY - 9, tx + 18, Lay::TOOL_CY + 9), 0, br);
@@ -2259,6 +2494,7 @@ static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
float titleRight = ToolRect(TB_V_ICONS).left - 12;
br->SetColor(pal.text);
dc->DrawTextW(title.c_str(), (UINT32)title.size(), g_tfTitle, D2D1::RectF(tx + (g_hoverTitle ? 25 : 0), Lay::TOOL_CY - 13, titleRight, Lay::TOOL_CY + 13), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ }
if (!SearchExpanded()) return;
auto sr = ToolRect(TB_SEARCH); // campo de busca aberto
@@ -2270,11 +2506,24 @@ static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo
dc->DrawRoundedRectangle(D2D1::RoundedRect(Inflate(cr, 1.5f), 19.5f, 19.5f), br, 3);
}
sr.left += 4;
+ } else if (leo) {
+ // Leopard: a pílula branca afundada (sombra por dentro em cima e o contorno cinza), anel azul com o foco
+ float rr = (sr.bottom - sr.top) / 2;
+ if (g_searchFocus) {
+ br->SetColor(D2D1::ColorF(0.36f, 0.60f, 0.95f, 0.75f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(Inflate(sr, 1.5f), rr + 1.5f, rr + 1.5f), br, 3);
+ }
+ br->SetColor(D2D1::ColorF(1, 1, 1, 1));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(sr, rr, rr), br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.10f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(sr.left + 2, sr.top + 1, sr.right - 2, sr.top + 3), 1, 1), br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(sr.left + 0.5f, sr.top + 0.5f, sr.right - 0.5f, sr.bottom - 0.5f), rr - 0.5f, rr - 0.5f), br, 1);
} else {
br->SetColor(pal.field);
dc->FillRoundedRectangle(D2D1::RoundedRect(sr, 7, 7), br);
}
- if (g_searchFocus && !g_tahoe) {
+ if (g_searchFocus && !g_tahoe && !leo) {
br->SetColor(D2D1::ColorF(pal.accent.r, pal.accent.g, pal.accent.b, 0.55f));
dc->DrawRoundedRectangle(D2D1::RoundedRect(Inflate(sr, 1.5f), 8.5f, 8.5f), br, 3);
@@ -2338,6 +2587,13 @@ static float ThumbAlpha(const std::wstring& key) {
}
static void DrawEntryIcon(ID2D1DeviceContext* dc, const Entry& e, D2D1_RECT_F ir, ID2D1SolidColorBrush* br) {
+ if (!g_tahoe && tahoe::Leopard()) { // Leopard: discos e documentos com os ícones do 10.5
+ if (e.dir && e.path.size() == 3 && e.path[1] == L':') {
+ bool rem = GetDriveTypeW(e.path.c_str()) == DRIVE_REMOVABLE;
+ if (DrawLeoPng(dc, rem ? L"side removivel" : L"side disco", ir)) return;
+ }
+ if (!e.dir) { std::wstring n = LeoDocIcon(e.name); if (!n.empty() && DrawLeoPng(dc, n, ir)) return; }
+ }
if (e.dir && e.path.size() == 3 && e.path[1] == L':') { DrawDrive(dc, ir, br); return; }
if (e.dir && pastacor::Draw(dc, e.path, ir, g_tahoe)) return; // cor e símbolo escolhidos (Personalizar Pasta)
if (e.dir && !e.emblem && g_tahoe && pastacor::DrawColor(dc, tahoe::FolderColor(), ir, g_tahoe)) return; // Aparência > Cor das pastas
@@ -2505,6 +2761,8 @@ static void DrawListRows(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidC
float dy = c.top - g_scroll;
// linhas alternadas também abaixo do último item, como no Finder
D2D1_COLOR_F stripe = g_dark ? D2D1::ColorF(1, 1, 1, 0.035f) : D2D1::ColorF(0, 0, 0, 0.03f);
+ const bool leo = tahoe::Leopard();
+ if (leo) stripe = D2D1::ColorF(237 / 255.f, 243 / 255.f, 254 / 255.f); // Leopard: as listras azul-claras do 10.5
int n = 0;
float lastBottom = 0;
for (auto& row : g_rows) {
@@ -2521,7 +2779,10 @@ static void DrawListRows(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidC
const Entry& e = g_items[i];
D2D1_RECT_F rr{ c.left + 8, top, c.right - 8, bottom };
bool selActive = e.sel && g_winActive;
- if (e.sel) {
+ if (e.sel && leo) { // Leopard: a faixa azul de ponta a ponta (cinza com a janela inativa)
+ br->SetColor(g_winActive ? D2D1::ColorF(56 / 255.f, 117 / 255.f, 215 / 255.f) : D2D1::ColorF(212 / 255.f, 212 / 255.f, 212 / 255.f));
+ dc->FillRectangle(D2D1::RectF(c.left, top, c.right, bottom), br);
+ } else if (e.sel) {
br->SetColor(g_winActive ? pal.accent : pal.inactiveSel);
dc->FillRoundedRectangle(D2D1::RoundedRect(rr, 5, 5), br);
} else if (n % 2 == 1) {
@@ -2652,6 +2913,126 @@ static void DrawColumnsView(ID2D1DeviceContext* dc, const Palette& pal, ID2D1Sol
// ---- Galeria
+// ---- Cover Flow (Leopard): fundo preto, a capa escolhida de frente no meio, as outras giradas ~70° para os lados
+// (perspectiva de verdade: efeito 3D do Direct2D sobre o desenho do ícone/miniatura), reflexo no chão que some,
+// o nome e o tipo em branco embaixo e a barra de rolagem escura. Clicar numa capa escolhe o item.
+static IDWriteTextFormat* Format(const wchar_t* family, float size, DWRITE_FONT_WEIGHT weight, DWRITE_TEXT_ALIGNMENT align, DWRITE_PARAGRAPH_ALIGNMENT para, bool wrap); // mais abaixo
+static float CoverFlowH() {
+ if (!g_coverFlow || g_view != View::List || g_tahoe || !tahoe::Leopard()) return 0;
+ auto s = ClientDip();
+ return std::max(170.f, std::floor((s.height - Lay::TOOLBAR_H - Lay::FOOTER_H) * 0.5f));
+}
+static std::vector<std::pair<int, D2D1_RECT_F>> g_cfHits; // capas na tela (a de cima por último)
+static D2D1_RECT_F CoverFlowRect() { auto s = ClientDip(); float t = TopH() - CoverFlowH(); return { Lay::SIDEBAR_W, t, s.width, t + CoverFlowH() }; }
+static void DrawCoverFlow(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br) {
+ g_cfHits.clear();
+ D2D1_RECT_F pr = CoverFlowRect();
+ if (pr.bottom - pr.top < 10) return;
+ int n = (int)g_items.size();
+ int f = g_focus >= 0 && g_focus < n ? g_focus : (n ? 0 : -1);
+ float ph = pr.bottom - pr.top, cx = (pr.left + pr.right) / 2;
+ float S = std::floor(ph * 0.52f), floorY = pr.top + ph * 0.10f + S;
+ auto coverX = [&](int k) { return k == 0 ? cx : cx + (k > 0 ? 1.f : -1.f) * (S * 0.62f + (std::abs(k) - 1) * S * 0.20f); };
+ std::vector<int> order;
+ if (f >= 0) {
+ int span = (int)((pr.right - pr.left) / 2 / (S * 0.20f)) + 2;
+ for (int d = span; d >= 1; d--) { if (f - d >= 0) order.push_back(f - d); if (f + d < n) order.push_back(f + d); }
+ order.push_back(f);
+ }
+ // 1º as capas (desenho do ícone numa lista de comandos: trocar o alvo só pode sem recorte empilhado)
+ struct Cover { int i, k; float x; ID2D1CommandList* cl; };
+ std::vector<Cover> covers;
+ for (int i : order) {
+ int k = i - f;
+ float x = coverX(k);
+ if (x + S < pr.left || x - S > pr.right) continue;
+ ID2D1CommandList* cl = nullptr;
+ if (FAILED(dc->CreateCommandList(&cl))) continue;
+ ID2D1Image* old = nullptr; dc->GetTarget(&old);
+ D2D1_MATRIX_3X2_F oldT; dc->GetTransform(&oldT);
+ dc->SetTarget(cl);
+ dc->SetTransform(D2D1::Matrix3x2F::Identity());
+ DrawItemIcon(dc, i, D2D1::RectF(0, 0, S, S), br);
+ dc->SetTarget(old); if (old) old->Release();
+ dc->SetTransform(oldT);
+ cl->Close();
+ covers.push_back({ i, k, x, cl });
+ }
+ dc->PushAxisAlignedClip(pr, D2D1_ANTIALIAS_MODE_ALIASED);
+ { // preto com um véu cinza bem leve embaixo
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0, 0, 0, 1) }, { 1, D2D1::ColorF(0.10f, 0.10f, 0.11f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) && SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, pr.top }, { 0, pr.bottom }), gs, &lb)))
+ dc->FillRectangle(pr, lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ }
+ ID2D1Effect* fx = nullptr;
+ dc->CreateEffect(CLSID_D2D13DPerspectiveTransform, &fx);
+ D2D1_MATRIX_3X2_F oldT; dc->GetTransform(&oldT);
+ for (auto& cv : covers) {
+ int i = cv.i, k = cv.k; float x = cv.x; ID2D1CommandList* cl = cv.cl;
+ float ang = k == 0 ? 0.f : (k < 0 ? -70.f : 70.f); // a borda voltada para o meio fica mais perto
+ ID2D1Image* img = cl;
+ if (fx && k != 0) {
+ fx->SetInput(0, cl);
+ fx->SetValue(D2D1_3DPERSPECTIVETRANSFORM_PROP_ROTATION, D2D1::Vector3F(0, ang, 0));
+ fx->SetValue(D2D1_3DPERSPECTIVETRANSFORM_PROP_ROTATION_ORIGIN, D2D1::Vector3F(S / 2, S / 2, 0));
+ fx->SetValue(D2D1_3DPERSPECTIVETRANSFORM_PROP_PERSPECTIVE_ORIGIN, D2D1::Vector2F(S / 2, S / 2));
+ fx->SetValue(D2D1_3DPERSPECTIVETRANSFORM_PROP_DEPTH, S * 1.6f);
+ fx->GetOutput(&img);
+ } else img->AddRef();
+ D2D1_POINT_2F at{ x - S / 2, floorY - S };
+ dc->DrawImage(img, at, D2D1_INTERPOLATION_MODE_LINEAR);
+ { // reflexo: espelhado no chão, sumindo para baixo
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1, 0.38f) }, { 1, D2D1::ColorF(1, 1, 1, 0) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, floorY }, { 0, floorY + S * 0.45f }), gs, &lb))) {
+ dc->PushLayer(D2D1::LayerParameters(D2D1::RectF(pr.left, floorY, pr.right, pr.bottom), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), 1, lb), nullptr);
+ dc->SetTransform(D2D1::Matrix3x2F::Scale(1, -1, { 0, floorY }) * oldT);
+ dc->DrawImage(img, at, D2D1_INTERPOLATION_MODE_LINEAR);
+ dc->SetTransform(oldT);
+ dc->PopLayer();
+ }
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ }
+ float w2 = k == 0 ? S : S * 0.34f;
+ g_cfHits.push_back({ i, D2D1::RectF(x - w2 / 2, floorY - S, x + w2 / 2, floorY) });
+ img->Release();
+ cl->Release();
+ }
+ if (fx) fx->Release();
+ if (f >= 0) { // nome e tipo da capa do meio
+ const Entry& e = g_items[f];
+ static IDWriteTextFormat* tfN = Format(L"Lucida Sans Unicode", 12, DWRITE_FONT_WEIGHT_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, false);
+ static IDWriteTextFormat* tfK = Format(L"Lucida Sans Unicode", 11, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, false);
+ float ty = pr.bottom - 52;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ dc->DrawTextW(e.label.c_str(), (UINT32)e.label.size(), tfN, D2D1::RectF(pr.left + 20, ty, pr.right - 20, ty + 16), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ std::wstring kind = KindName(e);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.55f));
+ dc->DrawTextW(kind.c_str(), (UINT32)kind.size(), tfK, D2D1::RectF(pr.left + 20, ty + 15, pr.right - 20, ty + 30), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ // a barra de rolagem escura do Cover Flow (trilho cinza e o polegar claro)
+ float bw = std::min(pr.right - pr.left - 80, 420.f), bl = cx - bw / 2, by = pr.bottom - 14;
+ br->SetColor(D2D1::ColorF(0.22f, 0.22f, 0.24f, 1));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(bl, by - 5, bl + bw, by + 5), 5, 5), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.25f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(bl + 0.5f, by - 4.5f, bl + bw - 0.5f, by + 4.5f), 4.5f, 4.5f), br, 1);
+ float tw = std::max(30.f, bw / std::max(1, n) * 6), tx = bl + (bw - tw) * (n > 1 ? (float)f / (n - 1) : 0);
+ br->SetColor(D2D1::ColorF(0.62f, 0.62f, 0.64f, 1));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(tx, by - 4, tx + tw, by + 4), 4, 4), br);
+ }
+ dc->PopAxisAlignedClip();
+}
+static bool CoverFlowClick(D2D1_POINT_2F p) {
+ if (CoverFlowH() <= 0 || !In(CoverFlowRect(), p)) return false;
+ for (int k = (int)g_cfHits.size() - 1; k >= 0; k--)
+ if (In(g_cfHits[k].second, p)) { SelectOnly(g_cfHits[k].first); EnsureVisible(g_cfHits[k].first); Invalidate(); break; }
+ return true;
+}
+
static void DrawGalleryView(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidColorBrush* br) {
auto c = ContentRect();
int f = g_focus >= 0 && g_focus < (int)g_items.size() ? g_focus : (g_items.empty() ? -1 : 0);
@@ -2780,6 +3161,33 @@ static void ScrollToThumbY(float top) { // top: posição desejada do polegar
}
static void DrawScrollbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidColorBrush* br) {
+ if (!g_tahoe && tahoe::Leopard()) {
+ D2D1_RECT_F thumb, track;
+ if (!ScrollThumb(thumb, track)) return;
+ auto lin = [&](D2D1_RECT_F r, std::initializer_list<D2D1_GRADIENT_STOP> st, float rad) {
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st.begin(), (UINT32)st.size(), &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ r.left, 0 }, { r.right, 0 }), gs, &lb)))
+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ };
+ D2D1_RECT_F tr = D2D1::RectF(track.right - 15, track.top, track.right, track.bottom);
+ lin(tr, { { 0, D2D1::ColorF(0.80f, 0.80f, 0.80f, 1) }, { 0.35f, D2D1::ColorF(0.95f, 0.95f, 0.95f, 1) }, { 1, D2D1::ColorF(0.99f, 0.99f, 0.99f, 1) } }, 0);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.18f));
+ dc->FillRectangle(D2D1::RectF(tr.left, tr.top, tr.left + 1, tr.bottom), br);
+ D2D1_RECT_F th = D2D1::RectF(tr.left + 1.5f, thumb.top + 1, tr.right - 1.5f, thumb.bottom - 1);
+ bool on = g_winActive; // atrás: polegar cinza (como no Mac)
+ lin(th, { { 0, on ? D2D1::ColorF(0.30f, 0.50f, 0.84f, 1) : D2D1::ColorF(0.62f, 0.62f, 0.64f, 1) },
+ { 0.5f, on ? D2D1::ColorF(0.70f, 0.84f, 0.99f, 1) : D2D1::ColorF(0.90f, 0.90f, 0.91f, 1) },
+ { 1, on ? D2D1::ColorF(0.36f, 0.57f, 0.88f, 1) : D2D1::ColorF(0.66f, 0.66f, 0.68f, 1) } }, (th.right - th.left) / 2);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.55f)); // o brilho de gel do lado esquerdo
+ float w3 = (th.right - th.left) * 0.30f;
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(th.left + 1.5f, th.top + 4, th.left + 1.5f + w3, th.bottom - 4), w3 / 2, w3 / 2), br);
+ br->SetColor(on ? D2D1::ColorF(0.15f, 0.30f, 0.60f, 0.85f) : D2D1::ColorF(0.40f, 0.40f, 0.42f, 0.85f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(th, (th.right - th.left) / 2, (th.right - th.left) / 2), br, 0.8f);
+ return;
+ }
DWORD since = g_scrollDrag || g_scrollHover ? 0 : GetTickCount() - g_scrollShownAt;
D2D1_RECT_F thumb, track;
if (!ScrollThumb(thumb, track) || since >= 1200) return;
@@ -2982,7 +3390,7 @@ static std::wstring DefaultAppName(const Entry& e) {
// macOS 27 (captura Finder-Quick-Look, 2x): barra de título de 38, moldura clara de 5 em volta da prévia, cantos 16 na
// janela e 12 na foto; fechar = círculo escuro de 16 a 9 da borda, título em negrito de 15 à esquerda, "Abrir com…"
// numa cápsula de 26 a 7 da borda
-#define QL_TITLE_H (semaforo::Aqua() ? 38.f : 40.f)
+#define QL_TITLE_H (semaforo::Aqua() ? 38.f : (!g_tahoe && tahoe::Leopard()) ? 24.f : 40.f) // Leopard: a faixa de 24 do HUD
static void RunVerb(const char* verb);
static ID2D1Bitmap* QlImage(const Entry& e) { // miniatura grande, se já chegou (senão a pequena)
@@ -3074,16 +3482,22 @@ static D2D1_RECT_F QlPanel() {
float cx = s.width / 2, cy = s.height / 2 + 8;
return { cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2 };
}
-static D2D1_RECT_F QlCloseRect() { auto r = QlPanel(); if (semaforo::Aqua()) return { r.left + 9, r.top + 11, r.left + 25, r.top + 27 }; return { r.left + 10, r.top + 10, r.left + 30, r.top + 30 }; }
+static D2D1_RECT_F QlCloseRect() {
+ auto r = QlPanel();
+ if (!g_tahoe && tahoe::Leopard()) return { r.left + 5, r.top + 4, r.left + 21, r.top + 20 }; // Leopard: o X redondo do HUD
+ if (semaforo::Aqua()) return { r.left + 9, r.top + 11, r.left + 25, r.top + 27 };
+ return { r.left + 10, r.top + 10, r.left + 30, r.top + 30 };
+}
static D2D1_RECT_F QlOpenRect() {
auto r = QlPanel();
+ if (!g_tahoe && tahoe::Leopard()) return { 0, 0, 0, 0 }; // o Quick Look do 10.5 não tinha "Abrir com" nem Compartilhar
int i = QlItem();
std::wstring app = i >= 0 ? DefaultAppName(g_items[i]) : L"";
float w = std::clamp(TextWidth(app.empty() ? Tr(L"Abrir") : Tr(L"Abrir com ") + app, g_tfQlButton) + 22, 60.f, 220.f);
if (semaforo::Aqua()) return { r.right - 7 - w - 8, r.top + 6, r.right - 7, r.top + 32 };
return { r.right - 12 - w, r.top + 8, r.right - 12, r.top + 32 };
}
-static D2D1_RECT_F QlShareRect() { auto o = QlOpenRect(); return { o.left - 36, o.top, o.left - 8, o.bottom }; }
+static D2D1_RECT_F QlShareRect() { auto o = QlOpenRect(); if (o.right <= o.left) return { 0, 0, 0, 0 }; return { o.left - 36, o.top, o.left - 8, o.bottom }; }
static D2D1_RECT_F QlCtlBar() {
auto r = QlPanel();
float w = std::min(r.right - r.left - 32, 560.f), cx = (r.left + r.right) / 2;
@@ -3179,6 +3593,132 @@ static void QlToggle() {
}
static IDWriteTextFormat* Format(const wchar_t* family, float size, DWRITE_FONT_WEIGHT weight, DWRITE_TEXT_ALIGNMENT align, DWRITE_PARAGRAPH_ALIGNMENT para, bool wrap);
+// Mac OS X Leopard: o Quick Look do 10.5 — um HUD preto translúcido de cantos redondos com o fio claro, o título branco
+// no meio da faixa de cima, o X branco num círculo cinza à esquerda, a prévia no corpo e, nos vídeos, a barra escura com
+// ⏵ e a linha do tempo brancos. Desenho próprio (nada do Quick Look dos outros temas).
+static void DrawQuickLookLeopard(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Entry& e, D2D1_RECT_F r) {
+ for (int k = 1; k <= 8; k++) { // sombra
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.035f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left - k * 2.f, r.top - k + 8, r.right + k * 2.f, r.bottom + k * 2.5f + 8), 10 + k * 2.f, 10 + k * 2.f), br);
+ }
+ const float RR = 10;
+ br->SetColor(D2D1::ColorF(0.07f, 0.07f, 0.08f, 0.88f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, RR, RR), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.30f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), RR - 0.5f, RR - 0.5f), br, 1);
+ static IDWriteTextFormat* tfT = Format(L"Lucida Sans Unicode", 12, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, false);
+ static IDWriteTextFormat* tfI = Format(L"Lucida Sans Unicode", 11, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, false);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.92f));
+ dc->DrawTextW(e.label.c_str(), (UINT32)e.label.size(), tfT, D2D1::RectF(r.left + 30, r.top, r.right - 30, r.top + QL_TITLE_H), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ auto cr = QlCloseRect();
+ float ccx = (cr.left + cr.right) / 2, ccy = (cr.top + cr.bottom) / 2;
+ br->SetColor(D2D1::ColorF(0.42f, 0.42f, 0.44f, 1));
+ dc->FillEllipse(D2D1::Ellipse({ ccx, ccy }, 6.5f, 6.5f), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.55f));
+ dc->DrawEllipse(D2D1::Ellipse({ ccx, ccy }, 6.5f, 6.5f), br, 0.8f);
+ br->SetColor(D2D1::ColorF(0.07f, 0.07f, 0.08f, 1));
+ Line(dc, br, ccx - 2.4f, ccy - 2.4f, ccx + 2.4f, ccy + 2.4f, 1.5f);
+ Line(dc, br, ccx - 2.4f, ccy + 2.4f, ccx + 2.4f, ccy - 2.4f, 1.5f);
+ D2D1_RECT_F body{ r.left + 8, r.top + QL_TITLE_H, r.right - 8, r.bottom - 8 };
+ ID2D1Bitmap* bmp = QlImage(e);
+ bool text = !e.dir && IsTextFile(e);
+ bool video = QlVideoOn(e), audio = !video && QlAudioOn(e);
+ auto fit = [&](float vw, float vh) {
+ float k = std::min((body.right - body.left) / vw, (body.bottom - body.top) / vh);
+ float w = vw * k, h = vh * k, cx = (body.left + body.right) / 2, cy = (body.top + body.bottom) / 2;
+ return D2D1::RectF(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2);
+ };
+ if (video) {
+ D2D1_RECT_F vr = fit((float)std::max(1, (int)media::VideoW()), (float)std::max(1, (int)media::VideoH()));
+ if (auto* fr = media::Frame()) dc->DrawBitmap(fr, vr, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR);
+ else if (bmp) dc->DrawBitmap(bmp, vr, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR);
+ } else if (bmp && !audio) {
+ auto sz = bmp->GetPixelSize();
+ DrawBigIcon(dc, e, fit((float)sz.width, (float)sz.height), br);
+ } else if (text) {
+ LoadQlText(e.path);
+ D2D1_RECT_F page{ body.left + 6, body.top + 2, body.right - 6, body.bottom - 2 };
+ br->SetColor(D2D1::ColorF(1, 1, 1, 1));
+ dc->FillRectangle(page, br);
+ dc->PushAxisAlignedClip(Inflate(page, -8), D2D1_ANTIALIAS_MODE_ALIASED);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.9f));
+ float y = page.top + 10;
+ for (auto& ln : g_qlLines) {
+ if (y > page.bottom) break;
+ dc->DrawTextW(ln.c_str(), (UINT32)ln.size(), g_tfMono, D2D1::RectF(page.left + 12, y, page.right - 10, y + 17), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ y += 17;
+ }
+ dc->PopAxisAlignedClip();
+ } else { // ícone grande e, embaixo, o nome e as informações em branco
+ float size = std::min(200.f, (body.bottom - body.top) - 110);
+ float cx = (body.left + body.right) / 2, top = body.top + std::max(8.f, ((body.bottom - body.top) - size - 90) / 2);
+ if (bmp && audio) {
+ auto sz = bmp->GetPixelSize();
+ float k = std::min(size / sz.width, size / sz.height), w = sz.width * k, h = sz.height * k;
+ dc->DrawBitmap(bmp, D2D1::RectF(cx - w / 2, top + (size - h) / 2, cx + w / 2, top + (size + h) / 2), 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR);
+ } else DrawBigIcon(dc, e, D2D1::RectF(cx - size / 2, top, cx + size / 2, top + size), br);
+ float y = top + size + 14;
+ std::wstring name = audio && !g_qlMediaTitle.empty() ? g_qlMediaTitle : e.label;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ dc->DrawTextW(name.c_str(), (UINT32)name.size(), tfT, D2D1::RectF(body.left + 10, y, body.right - 10, y + 20), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ std::wstring info = audio ? g_qlMediaArtist : KindName(e);
+ if (!audio) {
+ if (e.dir) { size_t n = ChildItems(e.path).size(); info += L" · " + std::to_wstring(n) + (n == 1 ? Tr(L" item") : Tr(L" itens")); }
+ else info += L" · " + SizeText(e);
+ }
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ dc->DrawTextW(info.c_str(), (UINT32)info.size(), tfI, D2D1::RectF(body.left, y + 22, body.right, y + 38), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ if (!audio) {
+ std::wstring date = Tr(L"Modificado: ") + DateText(e.mtime);
+ dc->DrawTextW(date.c_str(), (UINT32)date.size(), tfI, D2D1::RectF(body.left, y + 38, body.right, y + 54), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ }
+ }
+ if ((video && QlControlsVisible()) || audio) { // os controles: barra escura com ⏵/⏸, tempos, linha do tempo e o som
+ auto b = QlCtlBar();
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.62f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(b, 8, 8), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.25f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(Inflate(b, -0.5f), 7.5f, 7.5f), br, 1);
+ auto pr = QlPlayRect();
+ float pcx = (pr.left + pr.right) / 2, pcy = (pr.top + pr.bottom) / 2;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ if (media::Paused()) {
+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);
+ ID2D1PathGeometry* g = nullptr;
+ if (f && SUCCEEDED(f->CreatePathGeometry(&g))) {
+ ID2D1GeometrySink* sk = nullptr;
+ if (SUCCEEDED(g->Open(&sk))) {
+ sk->BeginFigure({ pcx - 4, pcy - 6 }, D2D1_FIGURE_BEGIN_FILLED); sk->AddLine({ pcx + 6, pcy }); sk->AddLine({ pcx - 4, pcy + 6 });
+ sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();
+ dc->FillGeometry(g, br);
+ }
+ g->Release();
+ }
+ if (f) f->Release();
+ } else {
+ dc->FillRectangle(D2D1::RectF(pcx - 5, pcy - 6, pcx - 1.5f, pcy + 6), br);
+ dc->FillRectangle(D2D1::RectF(pcx + 1.5f, pcy - 6, pcx + 5, pcy + 6), br);
+ }
+ auto mr = QlMuteRect();
+ float mcx = (mr.left + mr.right) / 2, mcy = (mr.top + mr.bottom) / 2; // alto-falante
+ dc->FillRectangle(D2D1::RectF(mcx - 6, mcy - 2.5f, mcx - 3, mcy + 2.5f), br);
+ Line(dc, br, mcx - 3, mcy - 2.5f, mcx + 1, mcy - 6, 1.6f); Line(dc, br, mcx + 1, mcy - 6, mcx + 1, mcy + 6, 1.6f); Line(dc, br, mcx + 1, mcy + 6, mcx - 3, mcy + 2.5f, 1.6f);
+ if (!media::Muted()) dc->DrawEllipse(D2D1::Ellipse({ mcx + 2, mcy }, 4.5f, 4.5f), br, 1.2f);
+ double d = media::Duration(), t = media::Ended() ? d : media::Time();
+ auto tr = QlTrackRect();
+ float ty = (tr.top + tr.bottom) / 2, f = d > 0 ? (float)std::clamp(t / d, 0.0, 1.0) : 0;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.28f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(tr.left, ty - 2, tr.right, ty + 2), 2, 2), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(tr.left, ty - 2, tr.left + (tr.right - tr.left) * f, ty + 2), 2, 2), br);
+ dc->FillEllipse(D2D1::Ellipse({ tr.left + (tr.right - tr.left) * f, ty }, 4.5f, 4.5f), br);
+ auto hms = [](double sec) { int x = (int)std::max(0.0, sec); wchar_t b2[16]; swprintf_s(b2, L"%d:%02d", x / 60, x % 60); return std::wstring(b2); };
+ std::wstring a = hms(t), z = L"-" + hms(d - t);
+ dc->DrawTextW(a.c_str(), (UINT32)a.size(), tfI, D2D1::RectF(pr.right, tr.top, tr.left - 4, tr.bottom), br);
+ dc->DrawTextW(z.c_str(), (UINT32)z.size(), tfI, D2D1::RectF(tr.right + 4, tr.top, mr.left, tr.bottom), br);
+ }
+}
+
static void DrawQuickLook(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidColorBrush* br) {
int i = QlItem();
if (i < 0) { g_ql = false; return; }
@@ -3215,6 +3755,12 @@ static void DrawQuickLook(ID2D1DeviceContext* dc, const Palette& pal, ID2D1Solid
dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), ease), layer);
}
+ if (!g_tahoe && tahoe::Leopard()) { // Leopard: o HUD do 10.5 (desenho próprio)
+ DrawQuickLookLeopard(dc, br, e, r);
+ if (layer) { dc->PopLayer(); layer->Release(); }
+ dc->SetTransform(old);
+ return;
+ }
for (int k = 1; k <= 10; k++) { // sombra grande e suave, como as janelas do Mac
br->SetColor(D2D1::ColorF(0, 0, 0, 0.03f));
dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left - k * 2.5f, r.top - k * 1.5f + 10, r.right + k * 2.5f, r.bottom + k * 3.f + 10), 12 + k * 2.f, 12 + k * 2.f), br);
@@ -3635,9 +4181,17 @@ static void Render() {
br->SetColor(pal.bar); // tema escuro: barra um tom mais clara que a lista
dc->FillRectangle(top, br);
}
+ const bool leo = !g_tahoe && tahoe::Leopard();
br->SetColor(pal.bar); // status também um tom mais claro; a barra de caminho fica na cor da lista
dc->FillRectangle(D2D1::RectF(Lay::SIDEBAR_W, s.height - Lay::STATUS_H, s.width, s.height), br);
- if (Golden()) {
+ if (leo) {
+ // Leopard: a janela "unified" do 10.5 — barra de título e de ferramentas numa peça só de metal, de ponta a
+ // ponta (por cima da barra lateral também), e o rodapé no mesmo metal
+ leopard::Metal(dc, D2D1::RectF(0, 0, s.width, Lay::TOOLBAR_H), g_winActive, g_dark, true);
+ leopard::Metal(dc, D2D1::RectF(Lay::SIDEBAR_W, s.height - Lay::STATUS_H, s.width, s.height), g_winActive, g_dark, false);
+ br->SetColor(g_dark ? D2D1::ColorF(0, 0, 0, 0.6f) : D2D1::ColorF(0.55f, 0.58f, 0.62f, 1)); // divisa da barra lateral
+ dc->DrawLine({ Lay::SIDEBAR_W + 0.5f, Lay::TOOLBAR_H }, { Lay::SIDEBAR_W + 0.5f, s.height }, br, 1);
+ } else if (Golden()) {
} else if (g_tahoe) {
tahoe::Panel(dc, br, SidePanelRect(), SidePanelR(), g_dark);
} else {
@@ -3659,6 +4213,7 @@ static void Render() {
DrawLights(dc, br);
DrawSidebar(dc, pal, br);
}
+ if (CoverFlowH() > 0) DrawCoverFlow(dc, br); // Leopard: o painel de capas em cima da lista
DrawToolbar(dc, pal, br);
DrawScrollbar(dc, pal, br);
DrawRenameField(dc, pal, br);
@@ -3887,34 +4442,24 @@ static IShellItemArray* ItemArray(const std::vector<std::wstring>& paths) {
// "Projeto" -> "Projeto.zip"); vários itens, "Arquivo.zip"; nome ocupado, "… 2.zip".
// Antes era a pasta compactada do Windows (zip vazio + IFileOperation): com um .zip entre os itens ela abria o
// .zip como pasta ("…zip\ is not accessible. The directory name is invalid", 12/11/2026), e travava o Finder
-// durante a cópia. Agora o zip é montado pelo .NET do Windows (System.IO.Compression: nomes com acento em
-// UTF-8, qualquer tipo de arquivo) num PowerShell escondido, numa thread; no fim o Finder seleciona o .zip.
+// durante a cópia. Depois foi um PowerShell escondido com -EncodedCommand, que antivírus leem como "dropper"
+// (Kaspersky Trojan-Dropper.Scrop, 19/11/2026). Agora o zip é montado pelo tar.exe do próprio Windows
+// (System32, libarchive): nomes com acento em UTF-8, pastas inteiras, numa thread; no fim o Finder seleciona o .zip.
static const UINT WM_APP_ZIPDONE = WM_APP + 30; // lParam: std::wstring* (o .zip), wParam: 1 = deu certo
static void CompressItems(const std::vector<std::wstring>& paths) {
if (paths.empty()) return;
std::wstring folder = Parent(paths[0]);
std::wstring base = paths.size() == 1 ? paths[0].substr(paths[0].find_last_of(L'\\') + 1) : Tr(L"Arquivo");
std::wstring zip = Join(folder, FreeName(folder, base, L".zip"));
- auto q = [](const std::wstring& s) { std::wstring o = L"'"; for (wchar_t c : s) { o += c; if (c == L'\'') o += L'\''; } return o + L"'"; };
- std::wstring itens;
- for (auto& p : paths) itens += (itens.empty() ? L"" : L",") + q(p);
- // pastas: cada arquivo com o caminho a partir da pasta-mãe (a pasta entra no zip); pastas vazias também
- std::wstring ps =
- L"$ErrorActionPreference='Stop';Add-Type -AssemblyName System.IO.Compression,System.IO.Compression.FileSystem;"
- L"$z=[IO.Compression.ZipFile]::Open(" + q(zip) + L",'Create');try{foreach($p in @(" + itens + L")){"
- L"$i=Get-Item -LiteralPath $p -Force;$b=$i.Parent;if(-not $b){$b=$i.Directory};$r=$b.FullName.TrimEnd('\\').Length+1;"
- L"if($i.PSIsContainer){$all=@($i)+@(Get-ChildItem -LiteralPath $p -Recurse -Force);foreach($f in $all){$n=$f.FullName.Substring($r).Replace('\\','/');"
- L"if($f.PSIsContainer){if(-not(Get-ChildItem -LiteralPath $f.FullName -Force|Select-Object -First 1)){[void]$z.CreateEntry($n+'/')}}"
- L"else{[void][IO.Compression.ZipFileExtensions]::CreateEntryFromFile($z,$f.FullName,$n,'Optimal')}}}"
- L"else{[void][IO.Compression.ZipFileExtensions]::CreateEntryFromFile($z,$i.FullName,$i.Name,'Optimal')}}}finally{$z.Dispose()}";
- std::wstring cmd = L"powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -EncodedCommand ";
- { // -EncodedCommand: UTF-16 em base64 (caminhos com aspas e acentos chegam intactos)
- const BYTE* b = (const BYTE*)ps.data(); DWORD n = (DWORD)(ps.size() * sizeof(wchar_t)), out = 0;
- CryptBinaryToStringW(b, n, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, nullptr, &out);
- std::wstring b64(out, L'\0');
- CryptBinaryToStringW(b, n, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, b64.data(), &out);
- b64.resize(out);
- cmd += b64;
+ wchar_t sys[MAX_PATH]{};
+ GetSystemDirectoryW(sys, MAX_PATH);
+ // "C:\" entre aspas viraria \" (aspas escapadas): a pasta-mãe sempre sem a barra no fim ("C:\." na raiz)
+ auto dirArg = [](std::wstring d) { if (!d.empty() && d.back() == L'\\') d += L'.'; return L"\"" + d + L"\""; };
+ std::wstring cmd = L"\"" + std::wstring(sys) + L"\\tar.exe\" -a -c --options hdrcharset=UTF-8 -f \"" + zip + L"\"";
+ for (auto& p : paths) { // cada item entra com o nome a partir da pasta-mãe dele (a pasta entra inteira)
+ size_t s = p.find_last_of(L'\\');
+ if (s == std::wstring::npos) continue;
+ cmd += L" -C " + dirArg(p.substr(0, s + 1)) + L" \"" + p.substr(s + 1) + L"\"";
}
Log(L"comprimir: %zu item(ns) -> %ls", paths.size(), zip.c_str());
Flash(Tr(L"Comprimindo…"));
@@ -4261,6 +4806,11 @@ static void ResortImpl() {
static View g_defaultView = View::Icons; // visão de abertura (a última usada)
static void SetView(View v) {
+ if (!g_tahoe && tahoe::Leopard()) { // Leopard: a 4ª visão é o Cover Flow (lista + capas em cima)
+ bool cf = v == View::Gallery;
+ if (cf) v = View::List;
+ if (cf != g_coverFlow) { g_coverFlow = cf; g_rowsDirty = true; Invalidate(); }
+ } else g_coverFlow = false;
if (g_view == v) return;
if (g_renameIdx >= 0) EndRename(true);
g_view = v;
@@ -5261,6 +5811,16 @@ static void ApplyWindowTheme() {
Lay::SIDE_HDR_H = g_tahoe ? 19.f : 23.5f;
Lay::TOOLBAR_H = g_tahoe ? 52.f : 53.f;
}
+ // Leopard: a barra "unified" do 10.5 tem 55 px (22 do título + a linha de ferramentas, medido numa captura a 1x);
+ // os botões descem para a segunda linha e a barra lateral começa abaixo dela (a barra vai de ponta a ponta)
+ const bool leoLay = !g_tahoe && tahoe::Leopard();
+ // Leopard: a Galeria vira o Cover Flow (lista + capas); saindo do Leopard, o Cover Flow volta a ser a Galeria
+ if (leoLay) { if (g_view == View::Gallery) { g_view = View::List; g_coverFlow = true; g_rowsDirty = true; } }
+ else if (g_coverFlow) { g_coverFlow = false; g_view = View::Gallery; g_rowsDirty = true; }
+ Lay::TOOLBAR_H = g_tahoe ? 52.f : leoLay ? 56.f : 53.f;
+ Lay::TOOL_CY = leoLay ? 38.5f : 26.3f;
+ Lay::SIDE_TOP = leoLay ? Lay::TOOLBAR_H + 8 : 47.f;
+ g_sideClipTop = Lay::SIDE_TOP;
BOOL dark = g_dark;
tags::Tema(g_tahoe, g_dark);
DwmSetWindowAttribute(g_hwnd, 20 /*DWMWA_USE_IMMERSIVE_DARK_MODE*/, &dark, sizeof(dark));
@@ -5462,6 +6022,7 @@ static LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
D2D1_POINT_2F p = ToDip(GET_X_LPARAM(l), GET_Y_LPARAM(l));
if (GoClick(p)) return 0; // Ir para a Pasta
if (QlClick(p)) return 0; // clique no painel do Quick Look
+ if (CoverFlowClick(p)) return 0; // Leopard: clique numa capa do Cover Flow
if (ViewOptsClick(p)) return 0; // clique no painel de Opções de Visualização
if (PickerClick(p)) return 0; // barra de Abrir/Salvar
if (g_renameIdx >= 0) {
@@ -5698,7 +6259,7 @@ static LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
case WM_TIMER:
switch (w) {
case T_TAHOE: // Tema mudou nos Ajustes do Sistema: troca Sequoia/Tahoe sem reabrir
- if (tahoe::Reload()) { g_tahoe = tahoe::On(); ApplyWindowTheme(); shadow::Update(); Invalidate(); }
+ if (tahoe::Reload()) { g_tahoe = tahoe::On(); g_dark = IsDarkMode(); ApplyWindowTheme(); shadow::Update(); Invalidate(); }
return 0;
case T_SLOWRENAME:
KillTimer(h, T_SLOWRENAME);
@@ -5907,6 +6468,40 @@ static void BuildSidebar() {
{ &FOLDERID_Music, 0xE8D6 }, { &FOLDERID_Videos, 0xE714 }, { &FOLDERID_Profile, 0xE80F }, { &FOLDERID_SkyDrive, 0xE753 } };
for (auto& k : special) { std::wstring p = KnownFolder(*k.id); if (!p.empty()) g_emblems.push_back({ p, k.glyph }); }
+ const bool leoSide = !g_tahoe && tahoe::Leopard();
+ auto devices = [&](const std::wstring& title) {
+ g_side.push_back({ title, L"", 0, true });
+ { SideEntry pc{ Tr(L"Este Computador"), L"", 0xE7F4, false }; pc.tag = VIEW_COMPUTER; g_side.push_back(pc); }
+ DWORD drives = GetLogicalDrives();
+ for (int d = 0; d < 26; d++) {
+ if (!(drives & (1u << d))) continue;
+ std::wstring root = std::wstring(1, (wchar_t)(L'A' + d)) + L":\\";
+ UINT type = GetDriveTypeW(root.c_str());
+ if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE && type != DRIVE_REMOTE) continue;
+ SHFILEINFOW sfi{};
+ std::wstring label = SHGetFileInfoW(root.c_str(), 0, &sfi, sizeof(sfi), SHGFI_DISPLAYNAME) ? sfi.szDisplayName : root;
+ g_side.push_back({ label, root, (wchar_t)(type == DRIVE_REMOVABLE ? 0xE88E : 0xEDA2), false });
+ }
+ };
+ if (leoSide) {
+ // Leopard (como na foto de referência do usuário): FAVORITOS, DISPOSITIVOS, COMPARTILHADO e BUSCAR POR (o do
+ // Finder do 10.5), sem Etiquetas
+ g_side.push_back({ Tr(L"Favoritos"), L"", 0, true });
+ for (int i = 0; i < (int)g_favs.size(); i++) {
+ SideEntry e{ g_favs[i].label, g_favs[i].path, g_favs[i].glyph, false };
+ e.fav = i;
+ g_side.push_back(e);
+ }
+ devices(Tr(L"Dispositivos"));
+ std::wstring cl = KnownFolder(FOLDERID_SkyDrive);
+ if (!cl.empty() && GetFileAttributesW(cl.c_str()) != INVALID_FILE_ATTRIBUTES) {
+ g_side.push_back({ Tr(L"Compartilhado"), L"", 0, true });
+ g_side.push_back({ L"OneDrive", cl, 0xE753, false });
+ }
+ g_side.push_back({ Tr(L"Buscar Por"), L"", 0, true });
+ const wchar_t smartGlyph[6] = { 0xE823, 0xE823, 0xE823, 0xE91B, 0xE714, 0xE8A5 }; // relógio ×3, imagem, filme, documento
+ for (int k = 0; k < 6; k++) { SideEntry e{ Tr(SMART_NAMES[k]), L"", smartGlyph[k], false }; e.tag = VIEW_SMART + k; g_side.push_back(e); }
+ } else {
g_side.push_back({ Tr(L"Favoritos"), L"", 0, true });
for (int i = 0; i < (int)g_favs.size(); i++) {
SideEntry e{ g_favs[i].label, g_favs[i].path, g_favs[i].glyph, false };
@@ -5941,6 +6536,7 @@ static void BuildSidebar() {
e.tag = t;
g_side.push_back(e);
}
+ } // (não Leopard)
for (int k = 0; k < (int)g_side.size(); k++)
if (g_side[k].header && std::find(collapsed.begin(), collapsed.end(), g_side[k].label) != collapsed.end()) ToggleSection(k);
diff --git a/src/finder/search.cpp b/src/finder/search.cpp
index 68071be..3f6af3a 100644
--- a/src/finder/search.cpp
+++ b/src/finder/search.cpp
@@ -26,6 +26,68 @@ static std::wstring ContainsTerm(const std::wstring& q) {
return o;
}
+// data local -> texto UTC para o SQL do índice ('AAAA-MM-DD HH:MM:SS')
+static std::wstring UtcText(SYSTEMTIME local) {
+ SYSTEMTIME u{};
+ TzSpecificLocalTimeToSystemTime(nullptr, &local, &u);
+ wchar_t b[32]; swprintf_s(b, L"%04d-%02d-%02d %02d:%02d:%02d", u.wYear, u.wMonth, u.wDay, u.wHour, u.wMinute, u.wSecond);
+ return b;
+}
+static SYSTEMTIME DaysAgo(int d) { // meia-noite (hora local) de d dias atrás
+ SYSTEMTIME st; GetLocalTime(&st);
+ st.wHour = st.wMinute = st.wSecond = st.wMilliseconds = 0;
+ FILETIME ft; SystemTimeToFileTime(&st, &ft);
+ ULARGE_INTEGER u{ { ft.dwLowDateTime, ft.dwHighDateTime } };
+ u.QuadPart -= (ULONGLONG)d * 24 * 3600 * 10000000ULL;
+ ft.dwLowDateTime = u.LowPart; ft.dwHighDateTime = u.HighPart;
+ FileTimeToSystemTime(&ft, &st);
+ return st;
+}
+
+int Smart(int kind, int max, const std::function<bool(const std::wstring&)>& onPath) {
+ int n = 0;
+ wchar_t prof[MAX_PATH] = {};
+ if (!GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) return -1;
+ std::wstring scope = prof;
+ for (auto& c : scope) if (c == L'\\') c = L'/';
+ if (scope.back() != L'/') scope += L'/';
+ std::wstring cond;
+ switch (kind) {
+ case 0: cond = L"System.DateModified >= '" + UtcText(DaysAgo(0)) + L"'"; break;
+ case 1: cond = L"System.DateModified >= '" + UtcText(DaysAgo(1)) + L"' AND System.DateModified < '" + UtcText(DaysAgo(0)) + L"'"; break;
+ case 2: cond = L"System.DateModified >= '" + UtcText(DaysAgo(7)) + L"'"; break;
+ case 3: cond = L"System.Kind = 'picture'"; break;
+ case 4: cond = L"System.Kind = 'video'"; break;
+ default: cond = L"System.Kind = 'document'"; break;
+ }
+ try {
+ _ConnectionPtr con;
+ if (FAILED(con.CreateInstance(__uuidof(Connection)))) return -1;
+ con->Open(L"Provider=Search.CollatorDSO;Extended Properties='Application=Windows';", L"", L"", adConnectUnspecified);
+ std::wstring sql = L"SELECT TOP " + std::to_wstring(max) + L" System.ItemUrl FROM SystemIndex WHERE SCOPE='file:" + scope + L"' AND " + cond +
+ L" AND System.ItemType <> 'Directory' AND System.FileAttributes <> 2 ORDER BY System.DateModified DESC";
+ _RecordsetPtr rs;
+ rs.CreateInstance(__uuidof(Recordset));
+ rs->Open(sql.c_str(), _variant_t((IDispatch*)con, true), adOpenForwardOnly, adLockReadOnly, adCmdText);
+ while (!rs->AdoEOF) {
+ _variant_t v = rs->Fields->GetItem(0L)->Value;
+ if (v.vt == VT_BSTR) {
+ std::wstring url = v.bstrVal;
+ if (url.rfind(L"file:", 0) == 0) {
+ std::wstring p = url.substr(5);
+ for (auto& c : p) if (c == L'/') c = L'\\';
+ n++;
+ if (!onPath(p)) break;
+ }
+ }
+ rs->MoveNext();
+ }
+ rs->Close();
+ con->Close();
+ } catch (...) { return n ? n : -1; }
+ return n;
+}
+
int Index(const std::wstring& q, const std::wstring& folder, int max, const std::function<bool(const std::wstring&)>& onPath) {
int n = 0;
try {
diff --git a/src/finder/tahoe.cpp b/src/finder/tahoe.cpp
index 2bcc959..25a451d 100644
--- a/src/finder/tahoe.cpp
+++ b/src/finder/tahoe.cpp
@@ -59,7 +59,7 @@ struct Fx : winrt::implements<Fx, IGraphicsEffect, IGraphicsEffectSource, abifx:
HRESULT __stdcall GetSourceCount(UINT* c) noexcept override { *c = 1; return S_OK; }
};
-bool g_on = false, g_reduce = false, g_tint = true, g_golden = false;
+bool g_on = false, g_reduce = false, g_tint = true, g_golden = false, g_leopard = false;
int g_folderColor = -1; // Aparência > Cor das pastas (cor_pastas; -1 = automática)
std::wstring g_accent = L"azul"; // Ajustes > Aparência > Cor de destaque (destaque=)
FILETIME g_stamp{};
@@ -85,7 +85,7 @@ std::wstring Path() {
bool ReadOn() {
FILE* fp = nullptr;
if (_wfopen_s(&fp, Path().c_str(), L"r, ccs=UTF-8") || !fp) return false;
- bool liquid = false, reduce = false, golden = false;
+ bool liquid = false, reduce = false, golden = false, leo = false;
int folder = -1;
wchar_t line[512];
while (fgetws(line, 512, fp)) {
@@ -94,6 +94,7 @@ bool ReadOn() {
if (s == L"liquid_glass=1") liquid = true;
if (s == L"reduzir_transparencia=1") reduce = true;
if (s == L"golden_gate=1") golden = true;
+ if (s == L"leopard=1") leo = true;
if (s.rfind(L"cor_pastas=", 0) == 0) folder = _wtoi(s.c_str() + 11);
if (s.rfind(L"destaque=", 0) == 0) g_accent = s.substr(9);
if (s == L"tingir_janelas=0") g_tint = false;
@@ -102,6 +103,7 @@ bool ReadOn() {
fclose(fp);
g_reduce = reduce;
g_golden = liquid && golden;
+ g_leopard = !liquid && leo; // Mac OS X Leopard: só sem o Liquid Glass
g_folderColor = folder;
return liquid;
}
@@ -217,12 +219,12 @@ bool tahoe::Reload() {
if (g_read && !CompareFileTime(&fa.ftLastWriteTime, &g_stamp)) return false;
g_stamp = fa.ftLastWriteTime;
std::wstring accWas = g_accent;
- bool was = g_on, goldWas = g_golden, first = !g_read;
+ bool was = g_on, goldWas = g_golden, leoWas = g_leopard, first = !g_read;
int folderWas = g_folderColor;
g_read = true;
g_on = ReadOn();
- if (first || was != g_on || goldWas != g_golden) Log(L"tema: liquid_glass=%d golden_gate=%d reduzir=%d (%ls)", (int)g_on, (int)g_golden, (int)g_reduce, Path().c_str());
- return !first && (was != g_on || goldWas != g_golden || accWas != g_accent || folderWas != g_folderColor); // a cor de destaque também redesenha
+ if (first || was != g_on || goldWas != g_golden || leoWas != g_leopard) Log(L"tema: liquid_glass=%d golden_gate=%d leopard=%d reduzir=%d (%ls)", (int)g_on, (int)g_golden, (int)g_leopard, (int)g_reduce, Path().c_str());
+ return !first && (was != g_on || goldWas != g_golden || leoWas != g_leopard || accWas != g_accent || folderWas != g_folderColor); // a cor de destaque também redesenha
}
void tahoe::Frame(HWND h, bool on) {
@@ -313,6 +315,7 @@ float tahoe::Radius(HWND h) { return IsZoomed(h) ? 0 : WindowR(); }
// macOS 27 Golden Gate: todas as janelas com o mesmo canto, 16 pt (medido nas capturas do 512 Pixels), bem menos redondo que os 26 pt do Tahoe
float tahoe::WindowR() { if (!g_read) Reload(); return g_golden ? 16.f : 26.f; }
bool tahoe::Golden() { if (!g_read) Reload(); return g_golden; }
+bool tahoe::Leopard() { if (!g_read) Reload(); return g_leopard; }
int tahoe::FolderColor() { if (!g_read) Reload(); return g_on ? g_folderColor : -1; }
// Cápsula de vidro desenhada em D2D (botões da barra de ferramentas, campos, painéis): corpo claro
diff --git a/src/janelas/controles.cpp b/src/janelas/controles.cpp
index a188756..c3fa533 100644
--- a/src/janelas/controles.cpp
+++ b/src/janelas/controles.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <cmath>
#include <map>
+#include "../comum/leopard.h" // tema Mac OS X Leopard: botões em pílula Aqua (o padrão em gel azul), fundo cinza 232
#include <string>
#include <vector>
@@ -72,6 +73,9 @@ struct Pal {
COLORREF bg, box, boxBorder, text, text2, field, fieldBorder, button, buttonTop, buttonBorder, accent, track;
};
Pal Colors() {
+ // Leopard: o cinza 232 das janelas do 10.5 (sempre claro: o 10.5 não tinha modo escuro), destaque azul do Aqua
+ if (leopard::On()) return { RGB(232, 232, 232), RGB(222, 222, 222), RGB(190, 190, 190), RGB(0, 0, 0), RGB(110, 110, 110),
+ RGB(255, 255, 255), RGB(150, 150, 150), RGB(255, 255, 255), RGB(255, 255, 255), RGB(140, 140, 140), RGB(56, 117, 215), RGB(200, 200, 200) };
if (Dark()) return { RGB(36, 36, 38), RGB(48, 48, 50), RGB(62, 62, 64), RGB(223, 223, 225), RGB(150, 150, 155),
RGB(30, 30, 31), RGB(70, 70, 72), RGB(88, 88, 90), RGB(100, 100, 102), RGB(28, 28, 30), RGB(10, 132, 255), RGB(70, 70, 72) };
return { RGB(236, 236, 236), RGB(226, 226, 226), RGB(210, 210, 210), RGB(30, 30, 30), RGB(120, 120, 124),
@@ -278,6 +282,30 @@ void PaintButton(HWND h, HDC dc) {
}
// botão de apertar (e caixas "como botão")
bool def = type == BS_DEFPUSHBUTTON;
+ if (leopard::On()) { // Leopard: pílula Aqua de 21 (perolada; o padrão e o apertado em gel azul), texto preto
+ bool on2 = (st & BS_PUSHLIKE) && SendMessageW(h, BM_GETCHECK, 0, 0) == BST_CHECKED;
+ float hh = std::min<float>((float)(rc.bottom - rc.top) - 3 * s, 21 * s), yc = (rc.top + rc.bottom) / 2.f;
+ D2D1_RECT_F r = D2D1::RectF(rc.left + 2 * s, yc - hh / 2, rc.right - 2 * s, yc + hh / 2);
+ float rd = hh / 2;
+ bool blue = def || on2 || pressed;
+ cv.Fill(D2D1::RectF(r.left, r.top + 1 * s, r.right, r.bottom + 1 * s), rd, D2D1::ColorF(1, 1, 1, 0.6f * a));
+ D2D1_GRADIENT_STOP gst[4] = { { 0, blue ? D2D1::ColorF(0.66f, 0.80f, 0.98f, a) : D2D1::ColorF(1, 1, 1, a) },
+ { 0.5f, blue ? D2D1::ColorF(0.38f, 0.60f, 0.93f, a) : D2D1::ColorF(0.95f, 0.95f, 0.95f, a) },
+ { 0.5f, blue ? D2D1::ColorF(0.24f, 0.47f, 0.87f, a) : D2D1::ColorF(0.88f, 0.88f, 0.88f, a) },
+ { 1, blue ? D2D1::ColorF(0.58f, 0.82f, 1.0f, a) : D2D1::ColorF(0.98f, 0.98f, 0.98f, a) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(cv.rt->CreateGradientStopCollection(gst, 4, &gs)) &&
+ SUCCEEDED(cv.rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))
+ cv.rt->FillRoundedRectangle(D2D1::RoundedRect(r, rd, rd), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ cv.Stroke(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), rd - 0.5f,
+ blue ? D2D1::ColorF(0.12f, 0.27f, 0.58f, 0.9f * a) : D2D1::ColorF(0, 0, 0, 0.42f * a));
+ if (focused && !hideFocus && !def)
+ cv.Stroke(D2D1::RectF(r.left - 1.5f * s, r.top - 1.5f * s, r.right + 1.5f * s, r.bottom + 1.5f * s), rd + 1.5f * s, D2D1::ColorF(0.36f, 0.60f, 0.95f, 0.75f), 3 * s);
+ cv.Text(text, D2D1::RectF(r.left + 8 * s, r.top, r.right - 8 * s, r.bottom), fs, D2D1::ColorF(0, 0, 0, 0.9f * a), DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_FONT_WEIGHT_NORMAL, (st & BS_MULTILINE) != 0);
+ return;
+ }
bool on = (st & BS_PUSHLIKE) && SendMessageW(h, BM_GETCHECK, 0, 0) == BST_CHECKED;
float hgt = std::min<float>((float)(rc.bottom - rc.top) - 2 * s, 22 * s + fs * 0.3f), cy = (rc.top + rc.bottom) / 2.f;
D2D1_RECT_F r = D2D1::RectF(rc.left + 2 * s, cy - hgt / 2, rc.right - 2 * s, cy + hgt / 2);
@@ -549,6 +577,18 @@ struct Alert {
std::map<HWND, Alert> g_alerts;
const float AW = 260, APAD = 20, AICON = 64, ABTN = 28, AGAP = 8;
+// Leopard (alerta do 10.5): 420 de largura, ícone de 64 em (24, 15), o texto a 104 da borda (negrito 13 e 11 embaixo),
+// botões em pílula de 21 embaixo à direita, o padrão na ponta direita
+const float LW = 420, LTX = 104, LTOP = 15, LBTN = 21;
+float TextWidthD(const std::wstring& s, float size) {
+ if (s.empty() || !g_dw) return 0;
+ IDWriteTextFormat* tf = nullptr; IDWriteTextLayout* lay = nullptr; float w = 0;
+ if (SUCCEEDED(g_dw->CreateTextFormat(g_face.c_str(), nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, size, L"pt-br", &tf))) {
+ if (SUCCEEDED(g_dw->CreateTextLayout(s.c_str(), (UINT32)s.size(), tf, 4000, 400, &lay))) { DWRITE_TEXT_METRICS m; lay->GetMetrics(&m); w = m.widthIncludingTrailingWhitespace; lay->Release(); }
+ tf->Release();
+ }
+ return w;
+}
// caixa de mensagem: diálogo de cima com o texto (id 0xFFFF), ícone (id 20) e só botões de apertar
bool IsMessageBox(HWND dlg) {
@@ -609,7 +649,8 @@ void MakeAlert(HWND dlg) {
ShowWindow(ic, SW_HIDE);
}
ShowWindow(text, SW_HIDE);
- float inner = (AW - 2 * APAD) * s1;
+ const bool leo = leopard::On();
+ float inner = leo ? (LW - LTX - 20) * s1 : (AW - 2 * APAD) * s1;
a.titleH = TextHeight(a.title, 13 * s1, DWRITE_FONT_WEIGHT_BOLD, inner);
a.infoH = TextHeight(a.info, 11 * s1, DWRITE_FONT_WEIGHT_NORMAL, inner);
RECT cr; GetClientRect(dlg, &cr);
@@ -621,6 +662,21 @@ void MakeAlert(HWND dlg) {
auto isDef = [](HWND b) { return (GetWindowLongW(b, GWL_STYLE) & BS_TYPEMASK) == BS_DEFPUSHBUTTON; };
float y = APAD * s1 + AICON * s1 + 12 * s1 + a.titleH + (a.infoH > 0 ? 6 * s1 + a.infoH : 0) + 16 * s1;
int W = (int)std::lround(AW * s1), pad = (int)std::lround(APAD * s1), bh = (int)std::lround(ABTN * s1), gap = (int)std::lround(AGAP * s1);
+ if (leo) { // Leopard: botões lado a lado embaixo à direita, o padrão por último (na ponta)
+ W = (int)std::lround(LW * s1);
+ y = std::max(LTOP + AICON, LTOP + 2 + a.titleH / s1 + (a.infoH > 0 ? 8 + a.infoH / s1 : 0)) * s1 + 18 * s1;
+ std::stable_partition(btns.begin(), btns.end(), [&](HWND b) { return !isDef(b); });
+ int x = W - (int)std::lround(20 * s1);
+ bh = (int)std::lround(LBTN * s1);
+ for (int k = (int)btns.size() - 1; k >= 0; k--) {
+ wchar_t t[128] = {}; GetWindowTextW(btns[k], t, 128);
+ std::wstring lab = t; lab.erase(std::remove(lab.begin(), lab.end(), L'&'), lab.end());
+ int bw = (int)std::lround(std::max(82.f, TextWidthD(lab, 13) + 32) * s1);
+ SetWindowPos(btns[k], nullptr, x - bw, (int)y, bw, bh + (int)std::lround(4 * s1), SWP_NOZORDER | SWP_NOACTIVATE);
+ x -= bw + (int)std::lround(12 * s1);
+ }
+ y += bh + 4 * s1;
+ } else
if (btns.size() <= 2) {
if (btns.size() == 2 && isDef(btns[0])) std::swap(btns[0], btns[1]);
int bw = (W - 2 * pad - gap * ((int)btns.size() - 1)) / (int)btns.size();
@@ -649,6 +705,21 @@ void PaintAlert(HWND dlg, HDC dc) {
RECT rc; GetClientRect(dlg, &rc);
Pal p = Colors();
float s = Scale(dlg), pad = APAD * s, ic = AICON * s;
+ if (leopard::On()) { // Leopard: o ícone à esquerda e o texto ao lado, alinhado à esquerda (alerta do 10.5)
+ {
+ Canvas cv(dc, rc);
+ if (!cv.rt) return;
+ cv.Fill(RF(rc), 0, C(p.bg));
+ float y = LTOP * s + 2 * s;
+ cv.Text(a.title, D2D1::RectF(LTX * s, y, rc.right - 20 * s, y + a.titleH), 13 * s, C(p.text), DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_FONT_WEIGHT_BOLD, true);
+ y += a.titleH + 8 * s;
+ if (a.infoH > 0) cv.Text(a.info, D2D1::RectF(LTX * s, y, rc.right - 20 * s, y + a.infoH), 11 * s, C(p.text), DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_FONT_WEIGHT_NORMAL, true);
+ }
+ int n = (int)std::lround(ic), x = (int)std::lround(24 * s), y = (int)std::lround(LTOP * s);
+ if (a.app) DrawIconEx(dc, x, y, a.app, n, n, 0, nullptr, DI_NORMAL);
+ if (a.badge) { int m = n * 45 / 100; DrawIconEx(dc, x + n - m, y + n - m, a.badge, m, m, 0, nullptr, DI_NORMAL); } // o aviso no canto do ícone do app, como no 10.5
+ return;
+ }
{
Canvas cv(dc, rc);
if (!cv.rt) return;
diff --git a/src/janelas/host32.cpp b/src/janelas/host32.cpp
deleted file mode 100644
index 89ebd64..0000000
--- a/src/janelas/host32.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// MacJanela32Host.exe (32 bits): põe o gancho da MacJanela32.dll nas threads de programas de 32 bits
-// que o Shell (64 bits) indicar. Um gancho só pode carregar uma DLL da mesma arquitetura.
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <map>
-#include <string>
-
-static std::map<DWORD, HHOOK> g_hooks;
-static HMODULE g_dll;
-static HOOKPROC g_proc;
-const UINT HOST_HOOK = WM_APP + 1, HOST_QUIT = WM_APP + 2;
-
-static LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
- if (m == HOST_HOOK) {
- DWORD tid = (DWORD)w;
- if (g_proc && !g_hooks.count(tid))
- if (HHOOK hk = SetWindowsHookExW(WH_GETMESSAGE, g_proc, g_dll, tid)) g_hooks[tid] = hk;
- if (l) PostMessageW((HWND)l, WM_NULL, 0, 0);
- return 0;
- }
- if (m == HOST_QUIT) { DestroyWindow(h); return 0; }
- if (m == WM_DESTROY) {
- for (auto& [t, hk] : g_hooks) UnhookWindowsHookEx(hk);
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProcW(h, m, w, l);
-}
-
-int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, LPWSTR, int) {
- wchar_t exe[MAX_PATH]; GetModuleFileNameW(nullptr, exe, MAX_PATH);
- std::wstring dir = exe; dir = dir.substr(0, dir.find_last_of(L'\\'));
- // cópia com nome próprio: os apps que já têm uma versão antiga presa carregam esta como outro módulo
- std::wstring copies = dir + L"\\obj\\mj";
- CreateDirectoryW((dir + L"\\obj").c_str(), nullptr);
- CreateDirectoryW(copies.c_str(), nullptr);
- // nome pela data do arquivo (como no Shell): reabrir reaproveita a cópia; cada nome novo ocupa um dos
- // 32 lugares de DLL de gancho do Windows até os programas que a carregaram fecharem
- std::wstring src = dir + L"\\WacOSWindow32.dll", name;
- WIN32_FILE_ATTRIBUTE_DATA fa{};
- if (GetFileAttributesExW(src.c_str(), GetFileExInfoStandard, &fa)) {
- wchar_t b[40]; swprintf_s(b, L"WacOSWindow32-%08lx%08lx.dll", fa.ftLastWriteTime.dwHighDateTime, fa.ftLastWriteTime.dwLowDateTime);
- name = b;
- }
- if (name.empty()) return 1; // sem cópia própria não põe gancho (mesmo caminho com outra versão trava o programa)
- WIN32_FIND_DATAW fd;
- HANDLE f = FindFirstFileW((copies + L"\\WacOSWindow32-*.dll").c_str(), &fd);
- if (f != INVALID_HANDLE_VALUE) {
- do if (_wcsicmp(fd.cFileName, name.c_str())) DeleteFileW((copies + L"\\" + fd.cFileName).c_str()); while (FindNextFileW(f, &fd)); // as em uso ficam
- FindClose(f);
- }
- std::wstring copy = copies + L"\\" + name;
- if (GetFileAttributesW(copy.c_str()) == INVALID_FILE_ATTRIBUTES && !CopyFileW(src.c_str(), copy.c_str(), TRUE)) return 1;
- g_dll = LoadLibraryW(copy.c_str());
- g_proc = g_dll ? (HOOKPROC)GetProcAddress(g_dll, "GetMsgProc") : nullptr;
- if (!g_proc) return 1;
- WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"MacJanela32Host";
- RegisterClassW(&wc);
- if (!CreateWindowExW(0, wc.lpszClassName, L"", 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, hi, nullptr)) return 1;
- MSG m;
- while (GetMessageW(&m, nullptr, 0, 0) > 0) DispatchMessageW(&m);
- return 0;
-}
diff --git a/src/janelas/macjanela.cpp b/src/janelas/macjanela.cpp
index 24eb99b..5d8edfc 100644
--- a/src/janelas/macjanela.cpp
+++ b/src/janelas/macjanela.cpp
@@ -19,6 +19,7 @@
#include <map>
#include "../comum/sombra.h"
#include "../comum/semaforo.h"
+#include "../comum/leopard.h" // tema Mac OS X Leopard: barra de título cinza metálico e botões de gel
#pragma comment(lib, "comctl32.lib")
#pragma comment(lib, "uxtheme.lib")
@@ -27,6 +28,7 @@
#pragma comment(lib, "dwrite.lib")
#if defined(_M_IX86)
#pragma comment(linker, "/EXPORT:GetMsgProc=_GetMsgProc@12")
+#pragma comment(linker, "/EXPORT:WacOSHostW=_WacOSHostW@16")
#endif
void StopShowHook();
@@ -49,6 +51,7 @@ UINT g_msgUndo, g_msgZoom; // Zoom: "MacJanelaAmpliar" (o Shell manda no Win+
ID2D1Factory* g_d2d;
IDWriteFactory* g_dw;
IDWriteTextFormat* g_tf;
+IDWriteTextFormat* g_tfLeo; // Leopard: o título em Lucida (Grande no Mac; Sans Unicode no Windows) 13 normal
IDWriteTextFormat* g_tfTool; // título das janelas de plug-in (menor, normal)
struct Info {
@@ -151,7 +154,8 @@ RECT FrameRect(HWND h) {
return r;
}
-bool TemaTahoe(); // mais abaixo: tema Tahoe ligado no ajustes.txt do Shell
+bool TemaTahoe(bool force = false); // mais abaixo: tema Tahoe ligado no ajustes.txt do Shell
+int CornerRadius(HWND h); // mais abaixo: o canto da janela (px)
bool OwnApp(); // mais abaixo: um dos apps do WacOS
const float PATCH_L = 80, PATCH_R = 3 * 46 + 6; // pt: botões do Mac / os três botões do app (46 pt cada no Windows)
@@ -220,6 +224,10 @@ void Paint(Info* in) {
fill(in->leftColor, D2D1::RectF(0, 0, PATCH_L, H), true);
fill(in->rightColor, D2D1::RectF(W - PATCH_R, 0, W, H), false);
}
+ // Leopard: a barra de título padrão vira o metal cinza do 10.5 de ponta a ponta (com os cantos de cima da
+ // janela); a barra própria dos apps (Chromium e afins) e as janelas de plug-in ficam como estão
+ const bool leo = leopard::On() && !in->custom && !in->tool && !UnifiedBar(in->owner);
+ if (leo) leopard::Metal(rt, D2D1::RectF(0, 0, W, H), in->active, in->dark, true, IsZoomed(in->owner) ? 0.f : CornerRadius(in->owner) / sc);
// os três botões no tamanho padrão do projeto (o do Monitor de Atividade): 14 pt, 23 pt entre centros
static const D2D1_COLOR_F on_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* on = semaforo::Pick(on_c, semaforo::FILL);
LONG st = in->style;
@@ -229,6 +237,7 @@ void Paint(Info* in) {
// 23 entre eles; painel utilitário = 10×10 em x 8 (centro 13), 17 entre eles
if (TemaTahoe()) { lx0 = in->tool ? 13.f : 16.f; lpitch = in->tool ? 17.f : 23.f; lr = in->tool ? 5.f : 7.f; }
if (int u = UnifiedBar(in->owner)) { lx0 = u > 40 ? 26.f : 16.f; lpitch = 23; lr = 7; } // macOS 27: com barra de ferramentas 26, 49, 72; só título 16, 39, 62
+ if (leopard::On() && !in->tool && !UnifiedBar(in->owner)) { lx0 = 14.5f; lpitch = 21; lr = 7; } // Leopard (medido: 14 px, 21 entre centros)
for (int k = 0; k < 3; k++) {
D2D1_POINT_2F c{ lx0 + k * lpitch, H / 2 };
bool lit = (in->active || in->hoverLights) && can[k];
@@ -268,8 +277,12 @@ void Paint(Info* in) {
b->SetColor(D2D1::ColorF(1, 1, 1, in->active ? 0.62f : 0.38f));
rt->DrawTextW(t, (UINT32)wcslen(t), g_tfTool, D2D1::RectF(70, 0, W - 70, H), b);
} else if (g_tf && t[0] && !in->custom && !(semaforo::Aqua() && OwnApp())) { // macOS 27: os apps do sistema não mostram o título
+ if (leo && !in->dark) { // Leopard: o título em relevo (sombra branca 1 pt abaixo)
+ b->SetColor(D2D1::ColorF(1, 1, 1, in->active ? 0.55f : 0.35f));
+ rt->DrawTextW(t, (UINT32)wcslen(t), g_tfLeo ? g_tfLeo : g_tf, D2D1::RectF(80, 1, W - 80, H + 1), b);
+ }
b->SetColor(in->dark ? D2D1::ColorF(1, 1, 1, in->active ? 0.86f : 0.42f) : D2D1::ColorF(0, 0, 0, in->active ? 0.85f : 0.40f));
- rt->DrawTextW(t, (UINT32)wcslen(t), g_tf, D2D1::RectF(80, 0, W - 80, H), b);
+ rt->DrawTextW(t, (UINT32)wcslen(t), leo && g_tfLeo ? g_tfLeo : g_tf, D2D1::RectF(80, 0, W - 80, H), b);
}
b->Release();
rt->EndDraw();
@@ -293,6 +306,7 @@ int HitLight(Info* in, POINT clientPt) {
float lx0 = in->tool ? 14.f : 19.f, lpitch = in->tool ? 20.f : 23.f;
if (TemaTahoe()) { lx0 = in->tool ? 13.f : 16.f; lpitch = in->tool ? 17.f : 23.f; } // mesmas posições do desenho
if (int u = UnifiedBar(in->owner)) { lx0 = u > 40 ? 26.f : 16.f; lpitch = 23; }
+ if (leopard::On() && !in->tool && !UnifiedBar(in->owner)) { lx0 = 14.5f; lpitch = 21; } // mesmas posições do desenho
for (int k = 0; k < 3; k++) if (std::fabs(x - (lx0 + k * lpitch)) <= 9 && std::fabs(y - H / 2) <= 8) return k;
return -1;
}
@@ -410,10 +424,10 @@ bool OwnApp() {
if (own < 0) { wchar_t p[MAX_PATH] = {}; GetModuleFileNameW(nullptr, p, MAX_PATH); const wchar_t* n = wcsrchr(p, L'\\'); own = n && !_wcsnicmp(n + 1, L"WacOS", 5) ? 1 : 0; }
return own == 1;
}
-bool TemaTahoe() {
+bool TemaTahoe(bool force) {
static DWORD at; static bool on;
DWORD now = GetTickCount();
- if (at && now - at < 3000) return on;
+ if (at && now - at < 3000 && !force) return on;
at = now ? now : 1;
wchar_t path[MAX_PATH];
if (!GetEnvironmentVariableW(L"APPDATA", path, MAX_PATH)) return on;
@@ -1055,6 +1069,25 @@ LRESULT CALLBACK OwnerProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_P
SetTimer(h, 0x4D50, 34, UncloakShown);
}
if (m == g_msgUndo) { StopShowHook(); Detach(h, in); return 1; }
+ static UINT msgSettings = RegisterWindowMessageW(L"ShellAjustesMudaram"); // tema trocado (Leopard, Tahoe…): redesenha já
+ if (m == msgSettings && msgSettings) {
+ semaforo::Ler(true); TemaTahoe(true); ApplyColors(in);
+ if (!in->custom) { DWORD c2 = leopard::On() ? 3 : 2; DwmSetWindowAttribute(h, 33, &c2, sizeof(c2)); }
+ // o tema pode ter mudado a altura da barra (Leopard: 22): refaz a moldura e reposiciona a faixa
+ SetWindowPos(h, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+ Paint(in);
+ }
+ // Leopard: a barra de título do 10.5 tem 22 pt (a do Windows, 31): a área do programa sobe para começar 22 pt
+ // abaixo do topo visível; a faixa da DLL (CaptionRect) acompanha. Só janelas com a barra padrão e no estado normal.
+ if (m == WM_NCCALCSIZE && w && leopard::On() && !in->custom && !in->tool && !IsZoomed(h) && !controles::IsAlert(h) &&
+ (GetWindowLongW(h, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) {
+ auto* p = (NCCALCSIZE_PARAMS*)l;
+ LONG wtop = p->rgrc[0].top; // o topo da janela proposto
+ LRESULT r = DefSubclassProc(h, m, w, l);
+ LONG want = wtop + (LONG)std::lround(22 * GetDpiForWindow(h) / 96.f);
+ if (p->rgrc[0].top > want) p->rgrc[0].top = want;
+ return r;
+ }
static UINT msgShow = RegisterWindowMessageW(L"MacJanelaMostrar"); // o Shell terminou a animação do ampliar
if (m == msgShow && msgShow) { ZoomShow(h); return 1; }
static UINT msgMove = RegisterWindowMessageW(L"MacJanelaMover"); // o Shell: volta para a área (limites.cpp)
@@ -1271,6 +1304,11 @@ void Attach(HWND h, int mode) {
}
if (fc) fc->Release();
g_dw->CreateTextFormat(fam, nullptr, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 13, L"pt-br", &g_tf);
+ if (g_dw->CreateTextFormat(L"Lucida Sans Unicode", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 13, L"pt-br", &g_tfLeo) == S_OK && g_tfLeo) {
+ g_tfLeo->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);
+ g_tfLeo->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
+ g_tfLeo->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
+ }
if (g_tf) {
g_tf->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);
g_tf->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
@@ -1318,7 +1356,7 @@ void Attach(HWND h, int mode) {
if (!in->custom)
in->overlay = CreateWindowExW(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, L"MacJanelaBarra", L"", WS_POPUP, 0, 0, 1, 1, h, nullptr, g_mod, nullptr);
if (in->overlay) { SetWindowLongPtrW(in->overlay, GWLP_USERDATA, (LONG_PTR)in); in->fastUntil = GetTickCount() + 900; SetTimer(in->overlay, 1, 16, nullptr); }
- DWORD corner = 2; // DWMWCP_ROUND: cantos arredondados mesmo em apps que pedem cantos retos
+ DWORD corner = leopard::On() ? 3 : 2; // DWMWCP_ROUND (Leopard: ROUNDSMALL, o canto pequeno do 10.5); mesmo em apps que pedem cantos retos
DwmSetWindowAttribute(h, 33 /*DWMWA_WINDOW_CORNER_PREFERENCE*/, &corner, sizeof(corner));
// A sombra antiga do Windows (CS_DROPSHADOW, comum em diálogos) é do retângulo inteiro da janela:
// aparecia como um retângulo escuro de bordas retas em volta do recorte. Fica só a nossa.
@@ -1704,6 +1742,41 @@ extern "C" __declspec(dllexport) LRESULT CALLBACK GetMsgProc(int code, WPARAM w,
return CallNextHookEx(nullptr, code, w, l);
}
+// Programas de 32 bits: o Shell é de 64 bits e um gancho só carrega DLL da mesma arquitetura. Então o Shell
+// abre o rundll32.exe de 32 bits do próprio Windows (SysWOW64) com esta DLL, entrada WacOSHost: ela fica lá
+// esperando os pedidos do Shell ("ponha a barra de título do Mac na thread X") e sai quando o Shell manda.
+namespace {
+std::map<DWORD, HHOOK> g_hostHooks;
+const UINT HOST_HOOK = WM_APP + 1, HOST_QUIT = WM_APP + 2;
+
+LRESULT CALLBACK HostProc(HWND h, UINT m, WPARAM w, LPARAM l) {
+ if (m == HOST_HOOK) {
+ DWORD tid = (DWORD)w;
+ if (!g_hostHooks.count(tid))
+ if (HHOOK hk = SetWindowsHookExW(WH_GETMESSAGE, GetMsgProc, g_mod, tid)) g_hostHooks[tid] = hk;
+ if (l) PostMessageW((HWND)l, WM_NULL, 0, 0); // a thread processa uma mensagem e a DLL entra
+ return 0;
+ }
+ if (m == HOST_QUIT) { DestroyWindow(h); return 0; }
+ if (m == WM_DESTROY) {
+ for (auto& [t, hk] : g_hostHooks) UnhookWindowsHookEx(hk);
+ g_hostHooks.clear();
+ PostQuitMessage(0);
+ return 0;
+ }
+ return DefWindowProcW(h, m, w, l);
+}
+} // namespace
+
+extern "C" __declspec(dllexport) void CALLBACK WacOSHostW(HWND, HINSTANCE, LPWSTR, int) {
+ if (FindWindowExW(HWND_MESSAGE, nullptr, L"MacJanela32Host", nullptr)) return; // já tem um
+ WNDCLASSW wc{}; wc.lpfnWndProc = HostProc; wc.hInstance = g_mod; wc.lpszClassName = L"MacJanela32Host";
+ RegisterClassW(&wc);
+ if (!CreateWindowExW(0, wc.lpszClassName, L"", 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, g_mod, nullptr)) return;
+ MSG m;
+ while (GetMessageW(&m, nullptr, 0, 0) > 0) DispatchMessageW(&m);
+}
+
BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, LPVOID) {
if (reason == DLL_PROCESS_ATTACH) {
g_mod = h;
diff --git a/src/menu/context_menu.cpp b/src/menu/context_menu.cpp
index a1079f6..9e2f7c1 100644
--- a/src/menu/context_menu.cpp
+++ b/src/menu/context_menu.cpp
@@ -425,6 +425,7 @@ void ctxmenu::SetGlass(const Glass& g) { g_glass = g; g_glassSet = true; }
// Tema Tahoe ligado (Ajustes > Aparência: liquid_glass=1 em %APPDATA%\Shell\ajustes.txt). O Shell avisa
// pelo SetGlass; os outros apps (Finder, Notas...) leem o arquivo, no máximo a cada 2 s.
static bool g_fileGolden; // golden_gate=1 lido do arquivo (apps fora do Shell)
+static bool g_fileLeopard; // leopard=1 lido do arquivo (apps fora do Shell)
static bool Tahoe() {
if (g_glassSet) return g_glass.liquid;
static DWORD last; static bool on;
@@ -442,6 +443,8 @@ static bool Tahoe() {
if (l == L"liquid_glass=0") on = false;
if (l == L"golden_gate=1") g_fileGolden = true;
if (l == L"golden_gate=0") g_fileGolden = false;
+ if (l == L"leopard=1") g_fileLeopard = true;
+ if (l == L"leopard=0") g_fileLeopard = false;
}
fclose(f);
return on;
@@ -449,6 +452,9 @@ static bool Tahoe() {
// macOS 27 Golden Gate (menu Go do Finder, captura 2x): linhas de 24, separador de 11, 5,5 de folga e de recuo do
// destaque, destaque com canto 7, menu com canto 11, texto a 16 da borda (41 com símbolo) e símbolo só em Ajustes…
static bool Golden() { bool t = Tahoe(); return t && (g_glassSet ? g_glass.golden : g_fileGolden); }
+// Mac OS X Leopard (leopard=1 sem o Liquid Glass): menus brancos translúcidos e o item escolhido num degradê azul que
+// vai de uma borda à outra, sem cantos (como no 10.5)
+static bool Leopard() { bool t = Tahoe(); return !t && (g_glassSet ? g_glass.leopard : g_fileLeopard); }
static bool GoldenIcon(const std::wstring& l) {
for (const wchar_t* k : { L"Ajustes", L"Settings", L"System Settings", L"Preferências", L"Preferences", L"Sobre Este", L"About This", L"App Store", L"Microsoft Store" }) // macOS 27: o menu da Apple tem símbolo nestes if (l.rfind(k, 0) == 0) return true;
return false;
@@ -1004,11 +1010,14 @@ static void DrawLevel(Session& s, int li) {
if (g_glass.alpha) bg.a = g_glass.alpha(bg.a);
// macOS 27 Golden Gate: o menu de contexto é vidro fosco (leitoso), não o Liquid Glass transparente do Dock
if (Golden()) { bg = dk ? D2D1::ColorF(0.17f, 0.165f, 0.165f, 0.88f) : D2D1::ColorF(0.95f, 0.945f, 0.94f, 0.84f); }
+ const bool leo = Leopard();
+ if (leo) bg = D2D1::ColorF(1, 1, 1, 0.94f); // Leopard: sempre claro (o 10.5 não tinha modo escuro)
ID2D1SolidColorBrush *text, *dim, *sep, *hdr, *accent, *white;
- rt->CreateSolidColorBrush(dk ? D2D1::ColorF(1, 1, 1, 0.92f) : D2D1::ColorF(0, 0, 0, 0.88f), &text);
- rt->CreateSolidColorBrush(dk ? D2D1::ColorF(1, 1, 1, 0.30f) : D2D1::ColorF(0, 0, 0, 0.30f), &dim);
- rt->CreateSolidColorBrush(dk ? D2D1::ColorF(1, 1, 1, 0.12f) : D2D1::ColorF(0, 0, 0, 0.10f), &sep);
- rt->CreateSolidColorBrush(dk ? D2D1::ColorF(1, 1, 1, 0.45f) : D2D1::ColorF(0, 0, 0, 0.45f), &hdr);
+ const bool dkT = dk && !leo; // cores do texto: o Leopard é sempre claro
+ rt->CreateSolidColorBrush(dkT ? D2D1::ColorF(1, 1, 1, 0.92f) : D2D1::ColorF(0, 0, 0, leo ? 1.f : 0.88f), &text);
+ rt->CreateSolidColorBrush(dkT ? D2D1::ColorF(1, 1, 1, 0.30f) : D2D1::ColorF(0, 0, 0, 0.30f), &dim);
+ rt->CreateSolidColorBrush(dkT ? D2D1::ColorF(1, 1, 1, 0.12f) : D2D1::ColorF(0, 0, 0, leo ? 0.14f : 0.10f), &sep);
+ rt->CreateSolidColorBrush(dkT ? D2D1::ColorF(1, 1, 1, 0.45f) : D2D1::ColorF(0, 0, 0, 0.45f), &hdr);
rt->CreateSolidColorBrush(D2D1::ColorF(0.0f, 0.39f, 0.88f, 1.0f), &accent);
rt->CreateSolidColorBrush(D2D1::ColorF(1, 1, 1, 1), &white);
@@ -1053,6 +1062,18 @@ static void DrawLevel(Session& s, int li) {
continue;
}
bool hot = (int)i == L.hover || ((int)i == L.openChild && L.hover < 0);
+ if (hot && !m.disabled && leo) { // Leopard: degradê azul de ponta a ponta, com o fio claro em cima
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.39f, 0.56f, 0.96f, 1) }, { 1, D2D1::ColorF(0.13f, 0.35f, 0.88f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))
+ rt->FillRectangle(D2D1::RectF(0, r.top, W, r.bottom), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ white->SetOpacity(0.35f);
+ rt->FillRectangle(D2D1::RectF(0, r.top, W, r.top + sc), white);
+ white->SetOpacity(1);
+ } else
if (hot && !m.disabled) {
D2D1_ROUNDED_RECT rr{ D2D1::RectF(Inset() * sc, r.top, W - Inset() * sc, r.bottom), HotR() * sc, HotR() * sc };
rt->FillRoundedRectangle(rr, accent);
@@ -1249,7 +1270,7 @@ static LRESULT CALLBACK PopupProc(HWND h, UINT m, WPARAM w, LPARAM l) {
// Mostra o menu e devolve o item escolhido (ou nullptr). Loop modal próprio, como o TrackPopupMenu.
static MItem* RunMenu(HWND owner, std::vector<MItem>& items, POINT pt) {
- Session s; s.owner = owner; s.dark = IsDarkMode();
+ Session s; s.owner = owner; s.dark = IsDarkMode() && !Leopard(); // Leopard: menus sempre claros
g_plain = g_plainNext; g_plainNext = false;
g_ses = &s;
OpenLevel(s, &items, pt, nullptr, 0);
diff --git a/src/menu/context_menu.h b/src/menu/context_menu.h
index a3c7ef2..471bfe5 100644
--- a/src/menu/context_menu.h
+++ b/src/menu/context_menu.h
@@ -30,6 +30,7 @@ void WarmupAsync(const std::wstring& folder, const std::wstring& file); // o me
struct Glass {
bool liquid = false; // Liquid Glass (Tahoe): reflexo e contorno especular
bool golden = false; // macOS 27 Golden Gate: medidas do menu do macOS 27 e quase sem símbolos
+ bool leopard = false; // Mac OS X Leopard: branco translúcido e destaque azul em degradê de ponta a ponta
float (*alpha)(float) = nullptr;
};
void SetGlass(const Glass& g);
diff --git a/src/shell/alertas.cpp b/src/shell/alertas.cpp
index 1d9a64b..c651399 100644
--- a/src/shell/alertas.cpp
+++ b/src/shell/alertas.cpp
@@ -66,6 +66,17 @@ void SetIcon(const std::wstring& exe) {
} else if (exe.empty()) {
std::wstring png = ui::PackIcon(L"trashfull@2x");
if (png.empty() || !ui::LoadPng(png, g.iw, g.ih, g.px)) ui::ShellImage(L"shell:RecycleBinFolder", 128, g.iw, g.ih, g.px, true);
+ } else if (liquid::Leopard()) {
+ // Leopard: o ícone do app no tema (pacote/aquificado); sem ele, o "Alert Note" do 10.5 (o balão com a exclamação)
+ // em vez do ícone pequeno do .exe ampliado num quadro
+ std::wstring nm = exe.substr(exe.find_last_of(L'\\') + 1);
+ if (nm.size() > 4) nm.resize(nm.size() - 4);
+ std::wstring png = apps::PackIconByName(nm, exe);
+ if (png.empty() || !ui::LoadPng(png, g.iw, g.ih, g.px)) {
+ png = ui::PackIcon(L"Alert Note");
+ if (png.empty() || !ui::LoadPng(png, g.iw, g.ih, g.px))
+ if (ui::ShellImage(exe, 128, g.iw, g.ih, g.px, true)) ui::TrimToSquare(g.iw, g.ih, g.px);
+ }
} else if (ui::ShellImage(exe, 128, g.iw, g.ih, g.px, true)) ui::TrimToSquare(g.iw, g.ih, g.px);
}
@@ -110,9 +121,15 @@ bool GoldenAlert() { return liquid::Golden(); }
// janela, o ícone de 32 a 20 / 36, o texto normal de 13 a 62 da borda e, embaixo à direita, três botões cinza de
// 85,5 × 19,5 lado a lado (8,5 entre eles, 12,5 da borda e 13 de baixo): o terceiro, Cancelar e o de confirmar
bool GoldenWide() { return GoldenAlert() && g.idThird; }
-float AlertWidth() { return GoldenWide() ? 404.f : AW0; }
-float AlertR() { return GoldenWide() ? 16.f : TahoeAlert() ? 26.f : RADIUS; }
+// Mac OS X Leopard (alerta do 10.5): janela cinza 232 de 420 de largura, cantos quase retos; ícone de 64 em (24, 15);
+// a mensagem em negrito 13 e o texto 11 a 104 da borda; botões em pílula Aqua de 20 embaixo à direita (o padrão em gel
+// azul, à direita; Cancelar à esquerda dele; o terceiro na ponta esquerda do texto)
+bool LeoAlert() { return liquid::Leopard(); }
+const float L_W = 420, L_TX = 104, L_TOP = 15;
+float AlertWidth() { return LeoAlert() ? L_W : GoldenWide() ? 404.f : AW0; }
+float AlertR() { return LeoAlert() ? 6.f : GoldenWide() ? 16.f : TahoeAlert() ? 26.f : RADIUS; }
float PanelH() {
+ if (LeoAlert()) return std::max(L_TOP + 64.f, L_TOP + 2 + g.titleH + (g.infoH > 0 ? 8 + g.infoH : 0)) + 18 + 20 + 18;
if (GoldenWide()) return std::max(120.f, 34 + g.titleH + (g.infoH > 0 ? 2 + g.infoH : 0) + 14 + 19.5f + 13);
if (GoldenAlert()) { int n = Buttons(); int rows = n == 3 ? 3 : 1; return G_IY + G_ICON + 19 + g.titleH + (g.infoH > 0 ? 10 + g.infoH : 0) + 17 + rows * G_BTN + (rows - 1) * G_GAP + G_BM; }
if (TahoeAlert()) { int n = Buttons(); return T_TOP + T_ICON + 12 + g.titleH + (g.infoH > 0 ? 6 + g.infoH : 0) + 18 + n * T_BTN + (n - 1) * T_GAP + T_BM; }
@@ -170,6 +187,64 @@ void Paint() {
dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);
float H = PanelH();
const float R = AlertR();
+ if (LeoAlert()) { // Leopard: desenho próprio do alerta do 10.5
+ if (!g.icon && !g.px.empty()) g.icon = ui::Bitmap(dc, g.iw, g.ih, g.px);
+ br->SetColor(D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0, 0, AW, H), R, R), br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.40f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0.5f, 0.5f, AW - 0.5f, H - 0.5f), R - 0.5f, R - 0.5f), br, 1);
+ if (g.icon) dc->DrawBitmap(g.icon, D2D1::RectF(24, L_TOP, 24 + 64, L_TOP + 64), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
+ IDWriteTextFormat* tb = ui::FormatFace(L"Lucida Sans Unicode", 13, DWRITE_FONT_WEIGHT_BOLD);
+ IDWriteTextFormat* ti = ui::FormatFace(L"Lucida Sans Unicode", 11, DWRITE_FONT_WEIGHT_NORMAL);
+ for (auto* f : { tb, ti }) if (f) { f->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP); f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR); }
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.9f));
+ float y = L_TOP + 2;
+ if (tb) dc->DrawTextW(g.title.c_str(), (UINT32)g.title.size(), tb, D2D1::RectF(L_TX, y, AW - 20, y + g.titleH + 4), br);
+ y += g.titleH + 8;
+ if (ti && g.infoH > 0) dc->DrawTextW(g.info.c_str(), (UINT32)g.info.size(), ti, D2D1::RectF(L_TX, y, AW - 20, y + g.infoH + 4), br);
+ IDWriteTextFormat* tbtn = ui::FormatFace(L"Lucida Sans Unicode", 13, DWRITE_FONT_WEIGHT_NORMAL);
+ if (tbtn) tbtn->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);
+ auto pill = [&](int i, D2D1_RECT_F r, bool blue) {
+ g.btn[i] = r;
+ bool down = g.press == i && g.hover == i;
+ float rad = (r.bottom - r.top) / 2;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, r.top + 1, r.right, r.bottom + 1), rad, rad), br);
+ bool b = blue || down;
+ D2D1_GRADIENT_STOP st[4] = { { 0, b ? D2D1::ColorF(0.66f, 0.80f, 0.98f, 1) : D2D1::ColorF(1, 1, 1, 1) },
+ { 0.5f, b ? D2D1::ColorF(0.38f, 0.60f, 0.93f, 1) : D2D1::ColorF(0.95f, 0.95f, 0.95f, 1) },
+ { 0.5f, b ? D2D1::ColorF(0.24f, 0.47f, 0.87f, 1) : D2D1::ColorF(0.88f, 0.88f, 0.88f, 1) },
+ { 1, b ? D2D1::ColorF(0.58f, 0.82f, 1.0f, 1) : D2D1::ColorF(0.98f, 0.98f, 0.98f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 4, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))
+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ br->SetColor(b ? D2D1::ColorF(0.12f, 0.27f, 0.58f, 0.9f) : D2D1::ColorF(0, 0, 0, 0.42f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), rad - 0.5f, rad - 0.5f), br, 1);
+ const std::wstring& lab = i == 0 ? g.no : i == 1 ? g.yes : g.third;
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.9f));
+ if (tbtn) dc->DrawTextW(lab.c_str(), (UINT32)lab.size(), tbtn, r, br);
+ };
+ auto bw = [&](const std::wstring& t) { return std::max(82.f, (tbtn ? ui::TextWidth(tbtn, t) : 60) + 32); };
+ for (int i = 0; i < 3; i++) g.btn[i] = D2D1::RectF(0, 0, 0, 0);
+ float by = H - 18 - 20, x = AW - 20;
+ float w1 = bw(g.yes);
+ pill(1, D2D1::RectF(x - w1, by, x, by + 20), true); // o padrão (gel azul) na direita
+ x -= w1 + 12;
+ if (!g.single) { float w0 = bw(g.no); pill(0, D2D1::RectF(x - w0, by, x, by + 20), false); }
+ if (g.idThird) { float w2 = bw(g.third); pill(2, D2D1::RectF(L_TX, by, L_TX + w2, by + 20), false); }
+ for (auto* f : { tb, ti, tbtn }) if (f) f->Release();
+ br->Release();
+ ui::GpuEnd(g_s);
+ if (g_glass) backdrop::SetPieces(g_back, (float)wpx, (float)hpx, { { D2D1::RectF(0, 0, (float)wpx, (float)hpx), R * sc } },
+ D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1), 0.f); // opaca
+ anim::Panel mo = anim::PanelIn(anim::Now() - g_openAt);
+ ui::GpuMotion(g_s, mo.scale, wpx / 2.f, hpx / 2.f, mo.fade);
+ if (g_glass) backdrop::Fade(g_back, mo.fade, mo.scale, wpx / 2.f, hpx / 2.f);
+ return;
+ }
if (!backdrop::Liquid() || !backdrop::Real()) { // com o Liquid Glass (vidro real) o próprio vidro desenha o contorno (duas bordas viravam um aro)
if (liquid::On()) liquid::Rim(dc, D2D1::RectF(0, 0, AW, H), R, dark);
else {
@@ -624,6 +699,10 @@ void TakeMessage(HWND dlg) {
size_t br = texto.find(L"\n\n");
size_t skip = 2;
if (br == std::wstring::npos) { br = texto.find(L"\r\n\r\n"); skip = 4; }
+ if (br == std::wstring::npos && LeoAlert()) { // Leopard: a 1ª linha é o texto em negrito, o resto o informativo (10.5)
+ br = texto.find(L'\n'); skip = 1;
+ if (br != std::wstring::npos && br > 0 && texto[br - 1] == L'\r') { br--; skip = 2; }
+ }
if (br != std::wstring::npos) { g.title = texto.substr(0, br); g.info = texto.substr(br + skip); }
else if (texto.size() > 140 && cap[0]) { g.title = cap; g.info = texto; }
else { g.title = texto; g.info = L""; }
@@ -657,7 +736,7 @@ void TakeMessage(HWND dlg) {
}
void Show(int cx, int cy) {
- float inner = GoldenWide() ? AW - 62 - 14 : GoldenAlert() ? AW - 2 * G_PAD : TahoeAlert() ? AW - 2 * T_PAD : AW - 2 * APAD;
+ float inner = LeoAlert() ? L_W - L_TX - 20 : GoldenWide() ? AW - 62 - 14 : GoldenAlert() ? AW - 2 * G_PAD : TahoeAlert() ? AW - 2 * T_PAD : AW - 2 * APAD;
g.titleH = TextH(g.title, 13, GoldenWide() ? DWRITE_FONT_WEIGHT_NORMAL : DWRITE_FONT_WEIGHT_BOLD, inner);
g.infoH = TextH(g.info, GoldenAlert() ? 13.f : 11.f, DWRITE_FONT_WEIGHT_NORMAL, inner);
g.hover = g.press = -1;
diff --git a/src/shell/apps.cpp b/src/shell/apps.cpp
index 38f8b67..614d74e 100644
--- a/src/shell/apps.cpp
+++ b/src/shell/apps.cpp
@@ -399,7 +399,7 @@ static std::wstring Norm(const std::wstring& s) {
static std::wstring PackIconFor(const App& a) {
static std::map<std::wstring, std::wstring> pack; // nome normalizado -> arquivo
static int loaded = -1; // tema com que a lista foi montada (Tahoe usa icones\tahoe antes do Sequoia)
- int tema = liquid::Golden() ? 2 : liquid::On() ? 1 : 0; // Golden Gate usa icones\goldengate antes do Tahoe
+ int tema = liquid::Leopard() ? 3 : liquid::Golden() ? 2 : liquid::On() ? 1 : 0; // Golden Gate usa icones\goldengate antes do Tahoe; Leopard, icones\leopard antes do Sequoia
if (loaded != tema) {
loaded = tema;
pack.clear();
@@ -407,7 +407,8 @@ static std::wstring PackIconFor(const App& a) {
// sobre o pacote do Sequoia; o nome do arquivo é o nome do app ("Discord.png", "Steam.png").
// Tema Tahoe: icones\tahoe (tools\baixar-icones.ps1) vem antes do Sequoia; o que faltar, segue o Sequoia
std::wstring root = shell::dir.substr(0, shell::dir.find_last_of(L'\\')) + L"\\icones";
- for (const wchar_t* sub : { L"\\extra", loaded == 2 ? L"\\goldengate" : L"", loaded ? L"\\tahoe" : L"", L"\\sequoia" }) {
+ // Leopard: icones\leopard vem ANTES do extra (o extra tem os ícones modernos; o Leopard tem a versão Aqua deles)
+ for (const wchar_t* sub : { loaded == 3 ? L"\\leopard" : L"", L"\\extra", loaded == 2 ? L"\\goldengate" : L"", loaded == 1 || loaded == 2 ? L"\\tahoe" : L"", L"\\sequoia" }) {
if (!*sub) continue;
std::wstring dir = root + sub;
if (std::wstring custom = shell::Setting(L"icones", L""); !custom.empty() && !wcscmp(sub, L"\\sequoia")) dir = custom;
diff --git a/src/shell/backdrop.cpp b/src/shell/backdrop.cpp
index b8c3a47..f08a85c 100644
--- a/src/shell/backdrop.cpp
+++ b/src/shell/backdrop.cpp
@@ -1373,6 +1373,7 @@ void backdrop::Reload() {
s.liquid = shell::Setting(L"liquid_glass", L"0") == L"1";
s.tinted = shell::Setting(L"liquid_estilo", L"nitido") == L"tingido";
s.golden = s.liquid && shell::Setting(L"golden_gate", L"0") == L"1";
+ s.leopard = !s.liquid && shell::Setting(L"leopard", L"0") == L"1";
s.refraction = (float)_wtof(shell::Setting(L"liquid_refracao", L"0.6").c_str());
s.reduce = shell::Setting(L"reduzir_transparencia", L"0") == L"1";
s.tintK = (float)_wtof(shell::Setting(L"vidro_tinta", L"0.5").c_str());
@@ -1385,6 +1386,7 @@ void backdrop::Reload() {
ctxmenu::Glass mg;
mg.liquid = s.liquid && !s.reduce;
mg.golden = s.golden;
+ mg.leopard = s.leopard;
mg.alpha = [](float a) {
const auto& st = g_style;
if (st.tintK < 0.5f) a *= 0.25f + 1.5f * st.tintK; // menus: no mínimo 25 % (texto legível); Golden Gate 60 %
diff --git a/src/shell/dock.cpp b/src/shell/dock.cpp
index cc2d89c..266cc0c 100644
--- a/src/shell/dock.cpp
+++ b/src/shell/dock.cpp
@@ -38,17 +38,24 @@ const DWORD ACR_DARK = 0x401E1C1C, ACR_LIGHT = 0x40F6F6F6; // AABBGGRR
// (vídeo 1080p do macOS 26, A = 67 px) 0,32 A em cima, 0,31 A embaixo e dos lados, passo 1,35 A,
// canto de 0,5 A; o ponto de app aberto tem 0,07 A e fica com o centro a 0,11 A da borda de baixo
#define TAHOE_DOCK (liquid::On())
-#define PAD_TOP (g_tile * (TAHOE_DOCK ? 0.156f : 0.099f))
-#define PAD_BOTTOM (g_tile * (TAHOE_DOCK ? 0.148f : 0.196f))
+// Mac OS X Leopard: a Dock é uma prateleira de vidro em perspectiva encostada no pé da tela; os ícones ficam em pé
+// sobre ela, refletidos no tampo, e o app aberto ganha a luz azul na frente da prateleira (desenho em Paint)
+#define LEO_DOCK (liquid::Leopard())
+#define PAD_TOP (g_tile * (TAHOE_DOCK ? 0.156f : LEO_DOCK ? 0.06f : 0.099f))
+#define PAD_BOTTOM (g_tile * (TAHOE_DOCK ? 0.148f : LEO_DOCK ? 0.48f : 0.196f))
// Tahoe, guia macOS26-Theme-Reference (seção 36, medido com ícone de 64): cada ícone ocupa 68 × 84 (passo
// 1,0625), 8 de margem antes do primeiro, separador de 31 (0,484); a altura reservada dá os 90 medidos
-#define PAD_X (g_tile * (TAHOE_DOCK ? 0.125f : 0.041f))
-#define MARGIN (g_tile * 0.10f)
+#define PAD_X (g_tile * (TAHOE_DOCK ? 0.125f : LEO_DOCK ? 0.55f : 0.041f))
+#define MARGIN (g_tile * (LEO_DOCK ? 0.f : 0.10f)) // Leopard: a prateleira encosta no pé da tela
#define SEP_W (g_tile * (TAHOE_DOCK ? 0.484f : 0.40f))
-#define SLOT (g_tile * (TAHOE_DOCK ? 1.0625f : 1.076f))
+// Leopard (comparado com a Dock do 10.5): os ícones ocupam o espaço inteiro e quase se encostam (passo de 1,06 ícone)
+#define SLOT (g_tile * (TAHOE_DOCK ? 1.0625f : LEO_DOCK ? 1.06f : 1.076f))
#define DOCK_RADIUS (g_tile * (TAHOE_DOCK ? 0.40f : 0.28f)) // Tahoe: 0,5 A (medido); Sequoia: 0,3 A
-const float ART_PACK = 1.0f; // PNGs do pacote: já têm a margem do Mac (desenho = 80%)
-const float ART_WIN = 0.80f; // ícones do Windows (recortados): mesmo corpo visual
+const float ART_PACK_0 = 1.0f; // PNGs do pacote: já têm a margem do Mac (desenho = 80%)
+const float ART_WIN_0 = 0.80f; // ícones do Windows (recortados): mesmo corpo visual
+// Leopard: o desenho do ícone ocupa o espaço inteiro (no 10.5 os ícones quase se encostam, sem a margem de hoje)
+#define ART_PACK (LEO_DOCK ? 1.25f : ART_PACK_0)
+#define ART_WIN (LEO_DOCK ? 1.0f : ART_WIN_0)
HWND g_back, g_icons, g_owner;
// Janelas minimizadas (como no Mac: miniatura da janela entre Downloads e a Lixeira, com o ícone do app
@@ -174,7 +181,7 @@ void BuildItems() {
auto& a = apps::list[i];
// sem divisória entre fixos e abertos: uma só, antes de Downloads e Lixeira
g_items.push_back({ I_APP, i });
- if (a.finder) g_items.push_back({ I_LAUNCHPAD, -1 }); // como no Mac: Launchpad logo depois do Finder
+ if (a.finder && !LEO_DOCK) g_items.push_back({ I_LAUNCHPAD, -1 }); // como no Mac: Launchpad logo depois do Finder
}
{ // quem entrou e quem saiu desde a última vez
double now0 = anim::Now();
@@ -208,6 +215,9 @@ void BuildItems() {
}
}
g_items.push_back({ I_SEP, -1 });
+ // Leopard: a pasta Aplicativos (que abre o Launchpad) fica à direita, depois da divisória, junto de Downloads e da
+ // Lixeira, como as Pilhas do 10.5
+ if (LEO_DOCK) g_items.push_back({ I_LAUNCHPAD, -1 });
// Ajustes > Mesa e Dock > "Mostrar a pasta Downloads no Dock" (dock_downloads=0 tira)
if (shell::Setting(L"dock_downloads", L"1") != L"0") g_items.push_back({ I_DOWNLOADS, -1 });
// minimizadas: as que continuam minimizadas ficam na ordem; as novas entram no fim
@@ -515,7 +525,7 @@ std::wstring Label(const Item& it) {
if (it.kind == I_APP) return apps::list[it.app].name;
if (it.kind == I_MINWIN) { wchar_t t[200] = {}; GetWindowTextW(it.win, t, 200); return t[0] ? t : apps::list[it.app].name; }
if (it.kind == I_DOWNLOADS) return L"Downloads";
- if (it.kind == I_LAUNCHPAD) return L"Launchpad";
+ if (it.kind == I_LAUNCHPAD) return LEO_DOCK ? Tr(L"Aplicativos") : L"Launchpad"; // Leopard: a pasta Aplicativos
if (it.kind == I_TRASH) return Tr(L"Lixeira");
return L"";
}
@@ -526,7 +536,7 @@ void PaintBack() {
RECT mon = Monitor();
int x = mon.left + (int)std::lround(g_bg.left * sc), y = mon.bottom - (int)std::lround((WinH() - g_bg.top) * sc);
int w = (int)std::lround((g_bg.right - g_bg.left) * sc), h = (int)std::lround((g_bg.bottom - g_bg.top) * sc);
- if (g_reveal <= 0.01f) { ShowWindow(g_back, SW_HIDE); g_lastBg = {}; return; }
+ if (g_reveal <= 0.01f || LEO_DOCK) { ShowWindow(g_back, SW_HIDE); g_lastBg = {}; return; } // Leopard: sem vidro atrás (a prateleira é desenhada com os ícones)
if (!memcmp(&g_bg, &g_lastBg, sizeof(g_bg)) && IsWindowVisible(g_back)) return; // nada mudou
g_lastBg = g_bg;
float rad = DOCK_RADIUS;
@@ -714,7 +724,67 @@ void Paint() {
float px = 1 / sc;
// bordas do vidro (como no Sequoia): 1 px escuro por fora, 1 px claro logo por dentro
// (com o Liquid Glass quem desenha o contorno especular é o próprio vidro, em backdrop.cpp)
- if (!(g_glass && backdrop::Liquid())) {
+ // Leopard: a prateleira de vidro em perspectiva. O tampo vai do fundo (mais estreito, acima do pé dos ícones) até a
+ // borda da frente; a frente é uma faixa mais escura. Medidas tiradas das capturas do 10.5 (ícone de 48): tampo de
+ // ~0,43 ícone de fundo, frente de ~0,07, os lados recolhem ~0,9 da profundidade.
+ const bool leo = LEO_DOCK;
+ float leoBack = 0, leoFront = 0, leoIn = 0;
+ ID2D1PathGeometry* shelf = nullptr;
+ auto lin = [&](D2D1_POINT_2F a, D2D1_POINT_2F b, std::initializer_list<D2D1_GRADIENT_STOP> st, auto draw) {
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st.begin(), (UINT32)st.size(), &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties(a, b), gs, &lb))) draw(lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ };
+ if (leo) {
+ float base = g_bg.top + PAD_TOP + g_tile;
+ leoBack = base - g_tile * 0.42f; leoFront = g_bg.bottom - std::max(2.f, g_tile * 0.04f); leoIn = (leoFront - leoBack) * 0.95f;
+ ID2D1Factory* fac = nullptr; rt->GetFactory(&fac);
+ if (fac && SUCCEEDED(fac->CreatePathGeometry(&shelf))) {
+ ID2D1GeometrySink* sk = nullptr;
+ if (SUCCEEDED(shelf->Open(&sk))) {
+ sk->BeginFigure({ g_bg.left + leoIn, leoBack }, D2D1_FIGURE_BEGIN_FILLED);
+ sk->AddLine({ g_bg.right - leoIn, leoBack }); sk->AddLine({ g_bg.right, leoFront }); sk->AddLine({ g_bg.left, leoFront });
+ sk->EndFigure(D2D1_FIGURE_END_CLOSED);
+ sk->Close(); sk->Release();
+ }
+ }
+ if (fac) fac->Release();
+ // tampo (comparado com a Dock do 10.5): vidro prateado claro e mais opaco — o fundo escuro aparece pouco —, mais
+ // claro atrás, com a faixa de brilho junto da borda de trás
+ if (shelf) lin({ 0, leoBack }, { 0, leoFront }, { { 0, D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.70f) }, { 0.10f, D2D1::ColorF(0.90f, 0.90f, 0.92f, 0.62f) }, { 0.35f, D2D1::ColorF(0.82f, 0.83f, 0.85f, 0.56f) }, { 1, D2D1::ColorF(0.74f, 0.75f, 0.78f, 0.58f) } },
+ [&](ID2D1Brush* b) { rt->FillGeometry(shelf, b); });
+ // frente: a borda fina do vidro — um fio escuro e, embaixo, o fio claro
+ br->SetColor(D2D1::ColorF(0.55f, 0.56f, 0.58f, 0.95f)); // a borda da frente: um fio médio e o fio claro embaixo
+ rt->FillRectangle(D2D1::RectF(g_bg.left, leoFront, g_bg.right, leoFront + px), br);
+ br->SetColor(D2D1::ColorF(0.92f, 0.92f, 0.93f, 0.98f));
+ rt->FillRectangle(D2D1::RectF(g_bg.left, leoFront + px, g_bg.right, g_bg.bottom), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.55f)); // a borda do fundo e os lados
+ rt->DrawLine({ g_bg.left + leoIn, leoBack }, { g_bg.right - leoIn, leoBack }, br, px);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.35f));
+ rt->DrawLine({ g_bg.left + leoIn, leoBack }, { g_bg.left, leoFront }, br, px);
+ rt->DrawLine({ g_bg.right - leoIn, leoBack }, { g_bg.right, leoFront }, br, px);
+ }
+ // reflexo no tampo da prateleira (Leopard): o desenho do ícone espelhado no pé dele, recortado pelo tampo e sumindo
+ // para a frente
+ auto reflect = [&](float baseY, auto draw) {
+ if (!leo || !shelf) return;
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1, 0.55f) }, { 1, D2D1::ColorF(1, 1, 1, 0) } }; // reflexo forte, como no 10.5
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, baseY }, { 0, baseY + g_tile * 0.60f }), gs, &lb))) {
+ rt->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), shelf, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), 1, lb), nullptr);
+ D2D1_MATRIX_3X2_F old; rt->GetTransform(&old);
+ rt->SetTransform(D2D1::Matrix3x2F::Scale(1, -1, { 0, baseY }) * old);
+ draw();
+ rt->SetTransform(old);
+ rt->PopLayer();
+ }
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ };
+ if (!leo && !(g_glass && backdrop::Liquid())) {
br->SetColor(dark ? D2D1::ColorF(0, 0, 0, 0.40f) : D2D1::ColorF(0, 0, 0, 0.10f));
rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(g_bg.left + px / 2, g_bg.top + px / 2, g_bg.right - px / 2, g_bg.bottom - px / 2), rad - px / 2, rad - px / 2), br, px);
br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(1, 1, 1, 0.55f));
@@ -724,6 +794,17 @@ void Paint() {
float baseline = g_bg.top + PAD_TOP + g_tile; // pé dos ícones
for (int i = 0; i < (int)g_items.size(); i++) {
auto& it = g_items[i];
+ if (it.kind == I_SEP && leo) {
+ // Leopard: a faixa tracejada branca que atravessa o tampo em perspectiva (do fundo para a frente)
+ float w = g_bg.right - g_bg.left, t = w > 0 ? (it.cx - g_bg.left) / w : 0.5f;
+ float bx = g_bg.left + leoIn + t * (w - 2 * leoIn);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.85f));
+ for (int d = 0; d < 5; d++) {
+ float a = d / 5.f, b2 = (d + 0.55f) / 5.f;
+ rt->DrawLine({ bx + (it.cx - bx) * a, leoBack + (leoFront - leoBack) * a }, { bx + (it.cx - bx) * b2, leoBack + (leoFront - leoBack) * b2 }, br, 1.3f + a);
+ }
+ continue;
+ }
if (it.kind == I_SEP) {
br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.22f) : D2D1::ColorF(0, 0, 0, 0.18f));
float h = g_tile * 0.93f, cy = (g_bg.top + g_bg.bottom) / 2;
@@ -765,6 +846,7 @@ void Paint() {
RefreshStack((int)std::lround(std::min(256.f, g_large * Sc())));
float art = s * ART_WIN;
D2D1_RECT_F sr{ it.cx - art / 2, baseline - (s + art) / 2, it.cx + art / 2, baseline - (s - art) / 2 };
+ reflect(sr.bottom, [&] { DrawStack(rt, sr); }); // Leopard: a pilha também se reflete na prateleira
if (DrawStack(rt, sr)) continue;
b = PackBitmap(rt, L"folder downloads"); mac = b != nullptr;
}
@@ -772,6 +854,8 @@ void Paint() {
// ícones do pacote do Sequoia já têm a margem do Mac; os do Windows (recortados) ficam com o mesmo corpo visual
float art = s * (mac ? ART_PACK : ART_WIN);
D2D1_RECT_F ir{ it.cx - art / 2, baseline - (s + art) / 2 + dy, it.cx + art / 2, baseline - (s - art) / 2 + dy };
+ if (b) reflect(baseline + dy, [&] { // espelha no pé do desenho (o PNG do pacote tem margem embaixo)
+ rt->DrawBitmap(b, ir, 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC); });
if (b) rt->DrawBitmap(b, ir, 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC); // reduz 256 px sem serrilhar
else if (it.kind == I_APP) { if (apps::list[it.app].finder) ui::DrawFolder(rt, ir, 0xE8B7); }
else if (it.kind == I_DOWNLOADS) ui::DrawFolder(rt, ir, 0xE896);
@@ -782,11 +866,26 @@ void Paint() {
}
// ponto de app aberto; o Finder, como no Mac, está sempre aberto
if (it.kind == I_APP && (!apps::list[it.app].wins.empty() || apps::list[it.app].finder) && shell::Setting(L"indicadores", L"1") == L"1") {
+ if (leo) {
+ // Leopard: a luz azul do app aberto, acesa no tampo junto da borda da frente (miolo branco e o brilho
+ // azul-ciano espalhado para os lados)
+ // medido: miolo (247,252,255) de ~2 px, halo (141,173,223) de ~6 px, a ~0,13 ícone da borda de baixo
+ D2D1_POINT_2F lc{ it.cx, g_bg.bottom - g_tile * 0.13f };
+ float rx = std::max(3.f, g_tile * 0.14f), ry = std::max(1.5f, g_tile * 0.06f);
+ D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(1, 1, 1, 1) }, { 0.32f, D2D1::ColorF(0.72f, 0.87f, 1, 0.95f) }, { 1, D2D1::ColorF(0.40f, 0.58f, 0.92f, 0) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1RadialGradientBrush* rb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 3, &gs)) &&
+ SUCCEEDED(rt->CreateRadialGradientBrush(D2D1::RadialGradientBrushProperties(lc, { 0, 0 }, rx, ry), gs, &rb)))
+ rt->FillEllipse(D2D1::Ellipse(lc, rx, ry), rb);
+ if (rb) rb->Release();
+ if (gs) gs->Release();
+ } else {
bool tahoe = TAHOE_DOCK; // Tahoe: ponto pequeno, um pouco acima da borda; escuro no claro, claro no escuro
if (tahoe) br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.85f) : D2D1::ColorF(0.05f, 0.07f, 0.20f, 0.85f));
else br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.55f) : D2D1::ColorF(0, 0, 0, 0.50f));
float dr = std::max(1.25f, g_tile * (tahoe ? 0.028f : 0.034f));
rt->FillEllipse(D2D1::Ellipse({ it.cx, g_bg.bottom - g_tile * (tahoe ? 0.088f : 0.068f) }, dr, dr), br);
+ }
}
if ((i == g_press && !g_dragging && GetKeyState(VK_LBUTTON) < 0) || i == g_dropHit) { // pressionado: escurece
br->SetColor(D2D1::ColorF(0, 0, 0, i == g_dropHit ? 0.25f : 0.35f));
@@ -818,6 +917,16 @@ void Paint() {
float tw = ui::TextWidth(g_tfLabel, t) + 22, th = 26;
float top = baseline - g_items[lab].size - 14 - th;
D2D1_RECT_F r{ g_items[lab].cx - tw / 2, top, g_items[lab].cx + tw / 2, top + th };
+ if (leo) { // Leopard: o nome numa pílula preta translúcida com texto branco, sem setinha
+ float rr2 = th / 2 - 2;
+ D2D1_RECT_F q{ r.left, r.top + 2, r.right, r.bottom - 2 };
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.62f));
+ rt->FillRoundedRectangle(D2D1::RoundedRect(q, rr2, rr2), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.20f));
+ rt->DrawRoundedRectangle(D2D1::RoundedRect(q, rr2, rr2), br, 0.8f);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.97f));
+ rt->DrawTextW(t.c_str(), (UINT32)t.size(), g_tfLabel, r, br);
+ } else {
br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 0.92f) : D2D1::ColorF(0.94f, 0.94f, 0.95f, 0.95f));
rt->FillRoundedRectangle(D2D1::RoundedRect(r, 6, 6), br);
float cx = g_items[lab].cx, ab = r.bottom - 0.5f; // setinha apontando para o ícone, como no Mac
@@ -835,6 +944,7 @@ void Paint() {
tri->Release(); f->Release();
br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.92f) : D2D1::ColorF(0, 0, 0, 0.85f));
rt->DrawTextW(t.c_str(), (UINT32)t.size(), g_tfLabel, r, br);
+ }
}
// ícone sendo arrastado
if (g_dragging && g_press >= 0 && g_items[g_press].kind == I_APP) {
@@ -856,6 +966,7 @@ void Paint() {
}
}
br->Release();
+ if (shelf) shelf->Release();
ui::GpuEnd(g_gi);
if (moved) {
// A janela fica sempre com a faixa inteira e o desenho sem deslocar; só a região (onde ela recebe o
@@ -1096,6 +1207,7 @@ void LeftClick(int i) {
apps::Activate(a); ui::FrameClock(g_icons, WM_DOCKFRAME, true); return;
}
if (it.kind == I_TRASH) { OpenFinder(L"shell:RecycleBinFolder"); return; } // a Lixeira no Finder, não no Explorador
+ if (it.kind == I_LAUNCHPAD && LEO_DOCK) { dock::OpenAppsStack(); return; } // Leopard: a pasta Aplicativos como Pilha em Grade (10.5)
if (it.kind == I_LAUNCHPAD) { launchpad::Toggle(); return; }
if (it.kind == I_DOWNLOADS && shell::Setting(L"pilhas", L"1") == L"1") { // Pilha em grade, como no Mac
float sc = Sc(); RECT mon = Monitor(); int H = (int)std::lround(WinH() * sc);
@@ -1467,6 +1579,17 @@ void dock::ApplyTheme() {
Paint();
}
+// Leopard: abre a pasta Aplicativos (o item do Launchpad, à direita) como Pilha em Grade, saindo do ícone dela
+void dock::OpenAppsStack() {
+ for (auto& it : g_items) {
+ if (it.kind != I_LAUNCHPAD) continue;
+ float sc = Sc(); RECT mon = Monitor(); int H = (int)std::lround(WinH() * sc);
+ POINT a{ mon.left + (LONG)std::lround(it.cx * sc), mon.bottom - H + (LONG)std::lround((g_bg.top - 4) * sc) };
+ pilhas::ShowApps(a);
+ return;
+ }
+}
+
void dock::Raise() { // por cima de janelas de tela inteira nossas (Launchpad)
if (!g_icons) return;
SetWindowPos(g_back, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
diff --git a/src/shell/janelas.cpp b/src/shell/janelas.cpp
index c2d633b..d75db41 100644
--- a/src/shell/janelas.cpp
+++ b/src/shell/janelas.cpp
@@ -159,31 +159,37 @@ void CALLBACK OnCreate(HWINEVENTHOOK, DWORD, HWND h, LONG obj, LONG, DWORD, DWOR
PostMessageW(h, WM_NULL, 0, 0); // a thread processa uma mensagem e a DLL entra antes de mostrar
}
-} // namespace
-
-void janelas::Start() {
- if (shell::Setting(L"janelas_mac", L"1") != L"1" || g_dll) return;
- // cópia com nome próprio: os apps que já têm uma versão antiga presa carregam esta como outro módulo
+// Cópia com nome próprio em bin\obj\mj: os apps que já têm uma versão antiga presa carregam esta como outro
+// módulo. O nome vem da data do arquivo: reabrir o Shell reaproveita a mesma cópia (cada nome novo ocupa um
+// dos 32 lugares de DLL de gancho do Windows até os apps fecharem); só uma compilação nova gera outro.
+// Vale para a DLL de 64 bits e para a de 32 (o hospedeiro de 32 bits recebe o caminho pronto).
+std::wstring OwnCopy(const std::wstring& file, const wchar_t* prefix) {
std::wstring copies = shell::dir + L"\\obj\\mj";
CreateDirectoryW((shell::dir + L"\\obj").c_str(), nullptr);
CreateDirectoryW(copies.c_str(), nullptr);
- // o nome vem da data do arquivo: reabrir o Shell reaproveita a mesma cópia (cada nome novo ocupa um
- // dos 32 lugares de DLL de gancho do Windows até os apps fecharem); só uma compilação nova gera outro
- std::wstring src = shell::dir + L"\\" DLL_WINDOW, name;
+ std::wstring src = shell::dir + L"\\" + file, name;
WIN32_FILE_ATTRIBUTE_DATA fa{};
- if (GetFileAttributesExW(src.c_str(), GetFileExInfoStandard, &fa)) {
- wchar_t b[40]; swprintf_s(b, L"WacOSWindow-%08lx%08lx.dll", fa.ftLastWriteTime.dwHighDateTime, fa.ftLastWriteTime.dwLowDateTime);
- name = b;
- }
+ if (!GetFileAttributesExW(src.c_str(), GetFileExInfoStandard, &fa)) return L"";
+ wchar_t b[64]; swprintf_s(b, L"%s-%08lx%08lx.dll", prefix, fa.ftLastWriteTime.dwHighDateTime, fa.ftLastWriteTime.dwLowDateTime);
+ name = b;
WIN32_FIND_DATAW fd;
- HANDLE f = FindFirstFileW((copies + L"\\WacOSWindow-*.dll").c_str(), &fd);
+ HANDLE f = FindFirstFileW((copies + L"\\" + prefix + L"-*.dll").c_str(), &fd);
if (f != INVALID_HANDLE_VALUE) {
do if (_wcsicmp(fd.cFileName, name.c_str())) DeleteFileW((copies + L"\\" + fd.cFileName).c_str()); while (FindNextFileW(f, &fd)); // as em uso ficam
FindClose(f);
}
std::wstring copy = copies + L"\\" + name;
+ if (GetFileAttributesW(copy.c_str()) == INVALID_FILE_ATTRIBUTES && !CopyFileW(src.c_str(), copy.c_str(), TRUE)) return L"";
+ return copy;
+}
+
+} // namespace
+
+void janelas::Start() {
+ if (shell::Setting(L"janelas_mac", L"1") != L"1" || g_dll) return;
+ std::wstring copy = OwnCopy(DLL_WINDOW, L"WacOSWindow");
// sem cópia própria, nada de gancho: o mesmo caminho com outra versão trava os programas (ver Consider)
- if (name.empty() || (GetFileAttributesW(copy.c_str()) == INVALID_FILE_ATTRIBUTES && !CopyFileW(src.c_str(), copy.c_str(), TRUE))) {
+ if (copy.empty()) {
Log(L"janelas: não deu para copiar " DLL_WINDOW);
return;
}
@@ -191,10 +197,14 @@ void janelas::Start() {
g_proc = g_dll ? (HOOKPROC)GetProcAddress(g_dll, "GetMsgProc") : nullptr;
if (!g_proc) { Log(L"janelas: " DLL_WINDOW L" não encontrada"); return; }
LoadExtra();
- std::wstring host = shell::dir + L"\\" EXE_WINDOW32HOST;
- if (GetFileAttributesW(host.c_str()) != INVALID_FILE_ATTRIBUTES && !FindWindowExW(HWND_MESSAGE, nullptr, L"MacJanela32Host", nullptr)) {
+ // programas de 32 bits: a DLL de 32 bits fica no rundll32.exe de 32 bits do Windows (entrada WacOSHost, ver
+ // macjanela.cpp), que recebe os pedidos de gancho pela janela "MacJanela32Host"
+ wchar_t wow[MAX_PATH]{};
+ std::wstring copy32;
+ if (GetSystemWow64DirectoryW(wow, MAX_PATH) && !FindWindowExW(HWND_MESSAGE, nullptr, L"MacJanela32Host", nullptr) &&
+ !(copy32 = OwnCopy(DLL_WINDOW32, L"WacOSWindow32")).empty()) {
STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};
- std::wstring cmd = L"\"" + host + L"\"";
+ std::wstring cmd = L"\"" + std::wstring(wow) + L"\\rundll32.exe\" \"" + copy32 + L"\",WacOSHost";
if (CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {
WaitForInputIdle(pi.hProcess, 2000);
CloseHandle(pi.hProcess); CloseHandle(pi.hThread);
diff --git a/src/shell/liquid.cpp b/src/shell/liquid.cpp
index ac17350..8182684 100644
--- a/src/shell/liquid.cpp
+++ b/src/shell/liquid.cpp
@@ -8,6 +8,7 @@
bool liquid::On() { return backdrop::Current().liquid; }
bool liquid::Golden() { return backdrop::Current().golden; }
+bool liquid::Leopard() { return backdrop::Current().leopard; }
// Contorno do Liquid Glass: a borda escurecida e o brilho especular (comum/vidro.h, o mesmo dos menus)
void liquid::Rim(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, bool dark, float strength, float spec, float lx, float ly) {
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index de9c29c..e68f79e 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -587,7 +587,7 @@ static void PreloadApps() {
std::thread([] {
SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN);
Sleep(3000);
- static const wchar_t* files[] = { EXE_SETTINGS, EXE_NOTES, EXE_CALCULATOR, EXE_TERMINAL, EXE_MONITOR, EXE_WINDOW32HOST, DLL_WINDOW32 };
+ static const wchar_t* files[] = { EXE_SETTINGS, EXE_NOTES, EXE_CALCULATOR, EXE_TERMINAL, EXE_MONITOR, DLL_WINDOW32 };
std::vector<char> buf(1 << 20);
size_t total = 0;
for (auto* f : files) {
@@ -720,6 +720,9 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {
else if (w == 8) sobre::Show(); // Sobre Este Mac
else if (w == 9) central::Toggle(); // Central de Controle (testes)
else if (w == 10) notificacoes::Toggle(); // Central de Notificações (testes)
+ else if (w == 12) dock::OpenAppsStack(); // Leopard: a pilha Aplicativos (testes)
+ else if (w == 13) seletor::Step(1); // o seletor de apps sem segurar o Alt (testes; 14 fecha)
+ else if (w == 14) seletor::Key(VK_ESCAPE);
else if (w == 11) { // Quick Look de uma foto do macOS 27 (testes)
wchar_t p[MAX_PATH] = {}; GetEnvironmentVariableW(L"USERPROFILE", p, MAX_PATH);
quicklook::Toggle(std::wstring(p) + L"\\Pictures\\Wallpapers macOS\\macOS 27\\macos-27-golden-4096x2160-27635.jpg");
@@ -796,7 +799,10 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (m == reload && reload) { // o Ajustes do Sistema gravou ajustes.txt
g_macKeys = shell::Setting(L"atalhos_mac", L"1") == L"1";
static int lastLiquid = -1;
- if (lastLiquid < 0) lastLiquid = liquid::Golden() ? 2 : liquid::On();
+ if (lastLiquid < 0) lastLiquid = liquid::Leopard() ? 3 : liquid::Golden() ? 2 : liquid::On();
+ static int lastTheme = -1; // 0 Sequoia, 1 Tahoe, 2 Golden Gate, 3 Leopard
+ auto themeNow = [] { return liquid::Leopard() ? 3 : liquid::Golden() ? 2 : (int)liquid::On(); };
+ if (lastTheme < 0) lastTheme = themeNow();
LoadSettings();
static int lastEn = -1;
if (lastEn < 0) lastEn = idioma::En();
@@ -807,13 +813,24 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {
dock::IconsChanged();
Log(L"idioma: %ls", en ? L"en" : L"pt");
}
- if ((liquid::Golden() ? 2 : (int)liquid::On()) != lastLiquid) { // tema Sequoia/Tahoe/Golden Gate: outro pacote de ícones
- lastLiquid = liquid::Golden() ? 2 : liquid::On();
+ if ((liquid::Leopard() ? 3 : liquid::Golden() ? 2 : (int)liquid::On()) != lastLiquid) { // tema Sequoia/Tahoe/Golden Gate/Leopard: outro pacote de ícones
+ lastLiquid = liquid::Leopard() ? 3 : liquid::Golden() ? 2 : liquid::On();
for (auto& a : apps::list) { a.icon.clear(); a.iw = a.ih = 0; a.mac = false; }
dock::IconsChanged();
seletor::IconsChanged();
Log(L"tema mudou: ícones do Dock e do seletor recarregados");
}
+ if (themeNow() != lastTheme) {
+ // tema trocado: as janelas com a barra do Mac (WacOSWindow.dll) redesenham já (barra metálica e botões de gel
+ // do Leopard, ou de volta) em vez de esperar a próxima ativação
+ lastTheme = themeNow();
+ EnumWindows([](HWND w, LPARAM msg) -> BOOL {
+ if (GetPropW(w, L"MacJanela")) PostMessageW(w, (UINT)msg, 0, 0);
+ return TRUE;
+ }, (LPARAM)reload);
+ Log(L"tema: %d (janelas avisadas)", lastTheme);
+ ponteiro::TemaLeopard(lastTheme == 3); // Leopard: cursor do Mac OS X; saindo, o cursor de antes
+ }
dock::ReloadSettings();
dock::ApplyTheme();
menubar::ApplyTheme();
@@ -1040,6 +1057,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int) {
indice::Start(); // índice de arquivos do Spotlight (thread de fundo)
revelar::Start(); // clique no vazio da área de trabalho mostra a mesa
ponteiro::Start(); // sacudir o mouse: o ponteiro cresce para achar
+ ponteiro::TemaLeopard(liquid::Leopard()); // tema Leopard: o cursor do Mac OS X (ou devolve o de antes)
genio::Create(hi); // efeito gênio ao minimizar
palco::Sync(); // Organizador Visual (Stage Manager), se ligado
widgets::Create(hi); // widgets na mesa (abaixo de todas as janelas)
@@ -1130,6 +1148,7 @@ int shell::RodarNativo(HINSTANCE hi, const std::wstring& dirBin, const std::wstr
indice::Start();
revelar::Start();
ponteiro::Start();
+ ponteiro::TemaLeopard(liquid::Leopard());
genio::Create(hi);
widgets::Create(hi);
notificacoes::Create(hi);
diff --git a/src/shell/menubar.cpp b/src/shell/menubar.cpp
index 7985932..89d37a7 100644
--- a/src/shell/menubar.cpp
+++ b/src/shell/menubar.cpp
@@ -27,7 +27,8 @@ namespace {
const float BAR_PT_SEQUOIA = 26; // altura da barra (telas sem entalhe; um pouco maior que os 24 pt do Mac, para telas grandes)
// Tahoe: 30 pt, medido no macOS 26 (guia macOS26-Theme-Reference, seções 13 e 35: frame.maxY − visibleFrame.maxY)
-#define BAR_PT (liquid::On() ? 30.f : BAR_PT_SEQUOIA)
+// Leopard: 22 pt, a barra do Mac OS X 10.5
+#define BAR_PT (liquid::On() ? 30.f : liquid::Leopard() ? 22.f : BAR_PT_SEQUOIA)
const float PAD_SEQUOIA = 10; // espaço de cada lado de um ícone de status (Mac: ~10 pt, um item a cada ~38 pt)
// Tahoe (guia, seção 35): cada item da direita = o ícone + ~8 pt de respiro de cada lado (31–42 pt por item)
#define PAD (liquid::On() ? 8.f : PAD_SEQUOIA)
@@ -420,6 +421,16 @@ std::wstring ClockText() {
if (!idioma::En() && !d.empty() && d.back() != L'.') d += L'.';
if (!idioma::En() && !m.empty() && m.back() != L'.') m += L'.';
wchar_t buf[64];
+ if (liquid::Leopard()) {
+ // Leopard: só o dia da semana e a hora ("Mon 6:45 PM" na captura do 10.5), no formato de hora do usuário
+ wchar_t tm[32] = {};
+ GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, tm, 32);
+ std::wstring dd = day;
+ if (!dd.empty() && dd.back() == L'.') dd.pop_back();
+ if (!dd.empty()) dd[0] = towupper(dd[0]);
+ swprintf_s(buf, L"%ls %ls", dd.c_str(), tm);
+ return buf;
+ }
if (shell::Setting(L"relogio_curto", L"0") == L"1") swprintf_s(buf, L"%02d:%02d", st.wHour, st.wMinute);
else if (idioma::En()) swprintf_s(buf, L"%ls %ls %d %02d:%02d", d.c_str(), m.c_str(), st.wDay, st.wHour, st.wMinute); // Tue Nov 10
else swprintf_s(buf, L"%ls %d de %ls %02d:%02d", d.c_str(), st.wDay, m.c_str(), st.wHour, st.wMinute);
@@ -499,13 +510,17 @@ void DrawCC(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, float cx, float cy)
// Ajustes > Transparência e Efeitos > "Mostrar fundo da barra de menus" (desligado: como no Tahoe)
// No Tahoe (Liquid Glass) a barra de menus não tem fundo nenhum, como no macOS 26: só o papel de parede atrás.
bool BarBackground() {
- if (backdrop::Current().reduce) return true;
+ if (backdrop::Current().reduce || liquid::Leopard()) return true; // Leopard: a barra translúcida clara sempre tem fundo
if (backdrop::Liquid()) return false;
return shell::Setting(L"barra_fundo", L"1") != L"0";
}
void BarGlass(HWND bar) {
if (!bar) return;
+ if (liquid::Leopard()) { // Leopard: o degradê branco translúcido vem do Render (opaca: acrílico cheio por baixo)
+ ui::Acrylic(bar, shell::Setting(L"barra_translucida", L"1") == L"1" ? 0x30F2F2F2u : 0xFFE6E6E6u);
+ return;
+ }
if (BarBackground()) { ui::Acrylic(bar, ui::Dark() ? 0x40141414u : 0x55F4F4F4u); return; } // vidro bem claro: o papel de parede aparece, como no Mac
// sem fundo: o DWM só respeita o alfa do que a barra desenha (nada de desfoque)
struct ACCENT_POLICY { int state, flags; DWORD gradient; int anim; };
@@ -608,6 +623,13 @@ void Render() {
// a cor do texto e dos ícones segue o papel de parede atrás
const bool bgOn0 = BarBackground();
if (!bgOn0 || liquid::On()) dark = WallpaperTopDark(dark);
+ const bool leo = liquid::Leopard();
+ // Leopard: Lucida Grande 14 px no Mac; no Windows, a Lucida Sans Unicode (o mesmo desenho de origem)
+ static IDWriteTextFormat* tfLeo = ui::FormatFace(L"Lucida Sans Unicode", 14, DWRITE_FONT_WEIGHT_NORMAL);
+ static IDWriteTextFormat* tfLeoB = ui::FormatFace(L"Lucida Sans Unicode", 14, DWRITE_FONT_WEIGHT_BOLD);
+ IDWriteTextFormat* tfN = leo ? tfLeo : g_tf;
+ IDWriteTextFormat* tfB = leo ? tfLeoB : g_tfBold;
+ if (leo) dark = false; // Leopard: a barra é sempre clara, com texto preto (o 10.5 não tinha modo escuro)
// Menubar Image do macOS 26 (guia, seção 31: catálogos Aqua/DarkAqua): branco 90 % no escuro, preto 85 % no claro
D2D1_COLOR_F fgc = dark ? D2D1::ColorF(1, 1, 1, liquid::On() ? 0.90f : 0.92f) : D2D1::ColorF(0, 0, 0, 0.85f);
// Liquid Glass sem fundo: só branco ou preto, mais firmes. Antes puxava a cor do papel de parede saturada 3×
@@ -620,13 +642,44 @@ void Render() {
if (!bgOn) veil.a = 0; // sem fundo (Tahoe): só o papel de parede atrás
rt->CreateSolidColorBrush(veil, &br);
rt->FillRectangle(D2D1::RectF(0, 0, W, H), br); // tinta leve por cima do acrílico
+ if (leo) {
+ // Leopard: a barra de menus translúcida do 10.5 — branco leitoso que deixa o papel de parede passar um pouco,
+ // um tom mais cinza embaixo, o fio de luz no alto e a linha escura embaixo (a "sombra" da barra)
+ float px = 1 / sc;
+ // medido numa captura do 10.5 a 1x: 248 no alto -> 204 embaixo, a linha de baixo quase preta
+ // Aparência > "Barra de menus translúcida" desligada (o 10.5.2 trouxe a opção): opaca
+ const float op = shell::Setting(L"barra_translucida", L"1") == L"1" ? 1.f : 1.12f;
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(248 / 255.f, 248 / 255.f, 248 / 255.f, std::min(1.f, 0.90f * op)) }, { 1, D2D1::ColorF(204 / 255.f, 204 / 255.f, 204 / 255.f, std::min(1.f, 0.88f * op)) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, H }), gs, &lb)))
+ rt->FillRectangle(D2D1::RectF(0, 0, W, H), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.75f));
+ rt->FillRectangle(D2D1::RectF(0, 0, W, px), br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.62f));
+ rt->FillRectangle(D2D1::RectF(0, H - px, W, H), br);
+ }
if (liquid && bgOn) { // Liquid Glass: sem degradê branco; só um fio fraco embaixo, como no Tahoe
float px = 1 / sc;
br->SetColor(D2D1::ColorF(1, 1, 1, dark ? 0.08f : 0.18f));
rt->FillRectangle(D2D1::RectF(0, H - px, W, H), br);
}
g_hits.clear();
+ bool litNow = false; // Leopard: o item aceso fica com o texto branco sobre o azul
auto highlight = [&](D2D1_RECT_F r) {
+ if (leo) { // Leopard: o destaque azul do Aqua de ponta a ponta na altura da barra, sem cantos
+ litNow = true;
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.39f, 0.56f, 0.95f, 1) }, { 1, D2D1::ColorF(0.13f, 0.35f, 0.86f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, H }), gs, &lb)))
+ rt->FillRectangle(D2D1::RectF(r.left, 0, r.right, H - 1 / sc), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ return;
+ }
if (liquid::On()) { // Tahoe (vídeo do macOS 26): o item aberto ganha uma cápsula de vidro clara
br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.24f) : D2D1::ColorF(1, 1, 1, 0.55f));
float rad = (H - 4) / 2;
@@ -639,6 +692,7 @@ void Render() {
rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, 2, r.right, H - 2), 4, 4), br);
};
auto add = [&](D2D1_RECT_F r, Kind k, int i) {
+ litNow = false;
g_hits.push_back({ r, k, i });
bool lit = (k == K_SOUND && (som::IsOpen() || som::HudLit())) // menu Som aberto / aviso de volume do Tahoe
|| (k == K_CC && central::IsOpen()) || (k == K_CLOCK && (notificacoes::IsOpen() || (liquid::On() && notificacoes::BannerVisible()))) || (k == K_SPOT && spotlight::IsOpen());
@@ -648,15 +702,29 @@ void Render() {
// esquerda (Tahoe, guia seção 35: o menu Apple fica em x 10, com 34 de largura)
float x = liquid::On() ? 10.f : 8.f;
add(D2D1::RectF(x, 0, x + 34, H), K_LOGO, 0);
- br->SetColor(fgc);
- if (!simbolo::Draw(rt, L"apple.logo", D2D1::RectF(x + 10, H / 2 - 7.5f, x + 24, H / 2 + 6.5f), br)) // a maçã do SF Symbols
+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);
+ if (leo && !litNow) {
+ // Leopard: a maçã grafite brilhante do 10.5 (a azul era a do Tiger): cinza claro em cima, quase preto embaixo;
+ // aberta, fica branca
+ D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(0.62f, 0.62f, 0.63f, 1) }, { 0.45f, D2D1::ColorF(0.36f, 0.36f, 0.37f, 1) }, { 1, D2D1::ColorF(0.16f, 0.16f, 0.17f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ bool ok = SUCCEEDED(rt->CreateGradientStopCollection(st, 3, &gs)) &&
+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, H / 2 - 7.5f }, { 0, H / 2 + 6.5f }), gs, &lb));
+ if (!ok || !simbolo::Draw(rt, L"apple.logo", D2D1::RectF(x + 10, H / 2 - 7.5f, x + 24, H / 2 + 6.5f), lb)) {
+ br->SetColor(D2D1::ColorF(0.30f, 0.30f, 0.31f, 1));
+ DrawLogo(rt, br, x + 17, H / 2);
+ }
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ } else
+ if (!simbolo::Draw(rt, L"apple.logo", D2D1::RectF(x + 10, H / 2 - 7.5f, x + 24, H / 2 + 6.5f), (br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc), br))) // a maçã do SF Symbols
DrawLogo(rt, br, x + 17, H / 2);
x += 34;
{
- float w = ui::TextWidth(g_tfBold, g_appName) + 20;
+ float w = ui::TextWidth(tfB, g_appName) + 20;
add(D2D1::RectF(x, 0, x + w, H), K_APP, 0);
- br->SetColor(fgc);
- rt->DrawTextW(g_appName.c_str(), (UINT32)g_appName.size(), g_tfBold, D2D1::RectF(x + 10, 0, x + w, H), br);
+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);
+ rt->DrawTextW(g_appName.c_str(), (UINT32)g_appName.size(), tfB, D2D1::RectF(x + 10, 0, x + w, H), br);
x += w;
}
float leftEnd = x;
@@ -670,22 +738,28 @@ void Render() {
add(D2D1::RectF(r - w, 0, r, H), k, i);
D2D1_RECT_F box = D2D1::RectF(r - w + PAD, 0, r - PAD, H);
r -= w;
- br->SetColor(fgc);
+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);
return box;
};
auto sym = [&](const wchar_t* name, D2D1_RECT_F box, float h) {
return simbolo::Draw(rt, name, D2D1::RectF(box.left, H / 2 - h / 2, box.right, H / 2 + h / 2), br);
};
+ // Leopard (captura do 10.5): a lupa do Spotlight é o último item, na ponta direita, e o relógio vem antes dela;
+ // (a Central de Controle continua, à esquerda do relógio: o usuário quer o acesso a ela)
+ if (leo && shell::Setting(L"barra_spotlight", L"1") == L"1") {
+ auto bx = slot(15, K_SPOT, 0);
+ if (!sym(L"magnifyingglass", bx, 15)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);
+ }
{
std::wstring t = ClockText();
- float w = ui::TextWidth(g_tf, t) + 2 * PAD;
+ float w = ui::TextWidth(tfN, t) + 2 * PAD;
add(D2D1::RectF(r - w, 0, r, H), K_CLOCK, 0);
- br->SetColor(fgc);
- rt->DrawTextW(t.c_str(), (UINT32)t.size(), g_tf, D2D1::RectF(r - w + PAD, 0, r, H), br);
+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);
+ rt->DrawTextW(t.c_str(), (UINT32)t.size(), tfN, D2D1::RectF(r - w + PAD, 0, r, H), br);
r -= w;
}
{ auto bx = slot(18, K_CC, 0); if (!sym(L"switch.2", bx, 14)) DrawCC(rt, br, (bx.left + bx.right) / 2, H / 2); }
- if (shell::Setting(L"barra_spotlight", L"1") == L"1") {
+ if (!leo && shell::Setting(L"barra_spotlight", L"1") == L"1") {
auto bx = slot(15, K_SPOT, 0);
if (!sym(L"magnifyingglass", bx, 15)) rt->DrawTextW(L"", 1, g_tfIcon, bx, br);
}
@@ -731,7 +805,7 @@ void Render() {
g->Release();
}
}
- br->SetColor(fgc);
+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);
} else {
auto bx = slot(27, K_BATT, 0);
sym(name, bx, 13);
@@ -828,11 +902,11 @@ void Render() {
// menus do app (entre o nome e os ícones)
for (int i = 0; i < (int)g_titles.size(); i++) {
- float w = ui::TextWidth(g_tf, g_titles[i]) + 20;
+ float w = ui::TextWidth(tfN, g_titles[i]) + 20;
if (x + w > r - 8) break;
add(D2D1::RectF(x, 0, x + w, H), K_MENU, i);
- br->SetColor(fgc);
- rt->DrawTextW(g_titles[i].c_str(), (UINT32)g_titles[i].size(), g_tf, D2D1::RectF(x + 10, 0, x + w, H), br);
+ br->SetColor(litNow ? D2D1::ColorF(1, 1, 1) : fgc);
+ rt->DrawTextW(g_titles[i].c_str(), (UINT32)g_titles[i].size(), tfN, D2D1::RectF(x + 10, 0, x + w, H), br);
x += w;
}
br->Release();
diff --git a/src/shell/missioncontrol.cpp b/src/shell/missioncontrol.cpp
index f9463e9..99aca61 100644
--- a/src/shell/missioncontrol.cpp
+++ b/src/shell/missioncontrol.cpp
@@ -72,7 +72,8 @@ std::vector<Desk> g_desks;
int g_cur = 0;
std::wstring g_appId, g_appName; // Exposé do app: só as janelas deste app (vazio = Mission Control)
bool g_appNext; // ToggleApp pediu: a abertura que vem é o Exposé do app
-bool Bar() { return g_appId.empty(); } // a faixa de Mesas (no Exposé do app ela não existe)
+// a faixa de Mesas (no Exposé do app ela não existe; no Leopard também não: o Exposé do 10.5 só espalha as janelas)
+bool Bar() { return g_appId.empty() && !liquid::Leopard(); }
int g_hoverDesk = -1; // Mesa sob o mouse na barra aberta (mostra o X)
bool g_hoverX = false; // mouse em cima do X
HWND g_xWnd, g_xFor, g_xPending; // X de fechar a janela sob o mouse (mais abaixo)
@@ -370,7 +371,7 @@ void Paint() {
D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
} else dc->Clear(D2D1::ColorF(0.08f, 0.12f, 0.28f, 1));
ID2D1SolidColorBrush* br = nullptr;
- dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0, 0.22f * dim), &br);
+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0, (liquid::Leopard() ? 0.45f : 0.22f) * dim), &br); // Leopard: escurece mais (cinza, sem desfoque)
if (!g_comp) dc->FillRectangle(D2D1::RectF(0, 0, Wd, Hd), br);
if (!Bar()) { // Exposé do app: o nome do app no alto, no lugar da faixa de Mesas
@@ -378,7 +379,7 @@ void Paint() {
ID2D1Layer* la = nullptr; dc->CreateLayer(nullptr, &la);
dc->PushLayer(lpa, la);
br->SetColor(D2D1::ColorF(1, 1, 1, 0.92f));
- dc->DrawTextW(g_appName.c_str(), (UINT32)g_appName.size(), g_tfDesk, D2D1::RectF(0, 18, Wd, 50), br);
+ if (!g_appId.empty()) dc->DrawTextW(g_appName.c_str(), (UINT32)g_appName.size(), g_tfDesk, D2D1::RectF(0, 18, Wd, 50), br);
dc->PopLayer(); la->Release();
goto windows;
}
@@ -461,6 +462,18 @@ windows:
if (g_hover >= 0 && g_hover < (int)g_wins.size() && !g_closing && !g_compAnim) {
D2D1_RECT_F c = Current(g_wins[g_hover]);
D2D1_RECT_F d = { c.left / sc, c.top / sc, c.right / sc, c.bottom / sc };
+ if (liquid::Leopard()) { // Leopard: a janela clareia um pouco e o título vem numa pílula escura no meio dela
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.10f));
+ dc->FillRectangle(d, br);
+ std::wstring t2 = g_wins[g_hover].title;
+ float tw = std::min(ui::TextWidth(g_tfTitle, t2) + 30, d.right - d.left + 60), cx = (d.left + d.right) / 2, cy = (d.top + d.bottom) / 2;
+ D2D1_RECT_F tr = { cx - tw / 2, cy - 13, cx + tw / 2, cy + 13 };
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.70f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(tr, 13, 13), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ dc->DrawTextW(t2.c_str(), (UINT32)t2.size(), g_tfTitle, D2D1::RectF(tr.left + 15, tr.top, tr.right - 15, tr.bottom), br);
+ goto hoverDone;
+ }
br->SetColor(D2D1::ColorF(0.04f, 0.52f, 1, 1));
dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(d.left - 3, d.top - 3, d.right + 3, d.bottom + 3), 10, 10), br, 3.5f);
std::wstring t2 = g_wins[g_hover].title;
@@ -473,6 +486,7 @@ windows:
br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
dc->DrawTextW(t2.c_str(), (UINT32)t2.size(), g_tfTitle, D2D1::RectF(tr.left + 12, tr.top, tr.right - 12, tr.bottom), br);
}
+hoverDone:
br->Release();
ui::GpuEnd(g_s);
UpdateThumbs();
diff --git a/src/shell/notificacoes.cpp b/src/shell/notificacoes.cpp
index 978ea74..e859312 100644
--- a/src/shell/notificacoes.cpp
+++ b/src/shell/notificacoes.cpp
@@ -365,6 +365,11 @@ void GlassEnd() {
// ================= cores
struct Pal { D2D1_COLOR_F tint, tintPill, text, text2, line, close, closeGlyph, chip, header; };
Pal Colors() {
+ // Leopard: os avisos da época eram os balões do Growl ("Smoke"): cartão preto translúcido, texto branco
+ if (liquid::Leopard())
+ return { D2D1::ColorF(0.04f, 0.04f, 0.05f, 0.80f), D2D1::ColorF(0.10f, 0.10f, 0.11f, 0.80f), D2D1::ColorF(1, 1, 1, 0.97f),
+ D2D1::ColorF(1, 1, 1, 0.70f), D2D1::ColorF(1, 1, 1, 0.12f), D2D1::ColorF(0.30f, 0.30f, 0.32f, 0.98f),
+ D2D1::ColorF(1, 1, 1, 0.90f), D2D1::ColorF(1, 1, 1, 0.16f), D2D1::ColorF(1, 1, 1, 0.97f) };
if (liquid::On()) { // Tahoe: vidro de verdade, o fundo desfocado aparece (antes a tinta deixava o cartão quase opaco)
Pal p = Dark()
? Pal{ D2D1::ColorF(0.10f, 0.10f, 0.11f, 0.40f), D2D1::ColorF(0.16f, 0.16f, 0.17f, 0.36f), D2D1::ColorF(1, 1, 1, 0.95f),
@@ -750,6 +755,24 @@ void Border(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1
}
void DrawCard(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, const Group& g, const Note& n, D2D1_RECT_F r, const std::wstring& key) {
+ if (liquid::Leopard()) {
+ // Leopard (balão "Smoke" do Growl): preto translúcido de cantos 8 com o fio claro, o ícone à esquerda, o título
+ // em negrito branco e o texto branco embaixo; sem a hora
+ br->SetColor(D2D1::ColorF(0.04f, 0.04f, 0.05f, 0.78f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, 8, 8), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.18f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 7.5f, 7.5f), br, 1);
+ float cy0 = (r.top + r.bottom) / 2;
+ DrawIcon(dc, br, g, D2D1::RectF(r.left + ICON_X, cy0 - ICON / 2, r.left + ICON_X + ICON, cy0 + ICON / 2));
+ float tx0 = r.left + TEXT_X, top0 = r.top + PAD_V;
+ Text(dc, br, n.title, g_tfTitle, D2D1::RectF(tx0, top0, r.right - PAD_R, top0 + TITLE_H), D2D1::ColorF(1, 1, 1, 0.97f));
+ auto& b0 = Body(n);
+ if (b0.first) {
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.92f));
+ dc->DrawTextLayout({ tx0, top0 + TITLE_H }, b0.first, br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ }
+ return;
+ }
Border(dc, br, p, r, CardR());
float cy = (r.top + r.bottom) / 2;
DrawIcon(dc, br, g, D2D1::RectF(r.left + ICON_X, cy - ICON / 2, r.left + ICON_X + ICON, cy + ICON / 2));
@@ -1341,8 +1364,10 @@ void BannerPaint() {
dc->FillRoundedRectangle(D2D1::RoundedRect(pr, CardR(), CardR()), br);
}
}
+ if (!liquid::Leopard()) { // Leopard: o balão do Growl é desenhado pelo DrawCard (sem o vidro)
GlassRect(D2D1::RectF(r.left * sc, r.top * sc, r.right * sc, r.bottom * sc), CardR() * sc, p.tint, 1);
if (!g_hasGlass) { br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 0.97f) : D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.97f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, CardR(), CardR()), br); }
+ }
Group g{ g_bnote.aumid, g_bnote.app, {} };
std::wstring saved = g_hover;
g_hover.clear();
diff --git a/src/shell/pilhas.cpp b/src/shell/pilhas.cpp
index 5cc77c1..2dd2df1 100644
--- a/src/shell/pilhas.cpp
+++ b/src/shell/pilhas.cpp
@@ -14,7 +14,9 @@
namespace {
const UINT WM_PL_ICON = WM_APP + 81, WM_PL_FRAME = WM_APP + 82;
-const int COLS = 6, MAXN = 18;
+const int COLS = 6;
+int MAXN = 18; // Downloads: 18; a pilha Aplicativos do Leopard mostra mais (g_apps)
+bool g_apps; // Leopard: a pasta Aplicativos da Dock como Pilha em Grade (os atalhos do Menu Iniciar)
const float CELL_W = 78, CELL_H = 86, PAD_SEQ = 12, HEAD = 30, FOOT = 30, ICON = 52, R_SEQ = 12, ARROW = 9;
// a pilha em grade é um popover: no Tahoe raio 20 e 13 de margem (guia macOS26-Theme-Reference, seção 31)
#define R (liquid::On() ? 20.f : R_SEQ)
@@ -88,9 +90,90 @@ void Motion() {
else { ui::GpuMotion(g_s, mo.scale, cx, cy, mo.fade); if (g_glass) backdrop::Fade(g_back, mo.fade, mo.scale, cx, cy); }
}
+// Mac OS X Leopard: a Pilha em Grade do 10.5 — painel preto translúcido (sem desfoque) de cantos redondos com o fio
+// claro em volta, o nome da pasta em branco no alto, ícones com o nome em branco e o botão escuro "Abrir no Finder ›"
+void PaintLeopard() {
+ float sc = Sc();
+ int wpx = (int)std::lround(PW() * sc), hpx = (int)std::lround(PH() * sc);
+ if (g_back && IsWindowVisible(g_back)) ShowWindow(g_back, SW_HIDE);
+ g_inGlass = false;
+ auto* dc = ui::GpuBegin(g_s, wpx, hpx, sc);
+ if (!dc) return;
+ ID2D1SolidColorBrush* br = nullptr;
+ dc->CreateSolidColorBrush(D2D1::ColorF(1, 1, 1), &br);
+ if (!br) { ui::GpuEnd(g_s); return; }
+ const float BODY = PH() - ARROW, RR = 12;
+ ID2D1Factory* fac = nullptr; dc->GetFactory(&fac);
+ ID2D1PathGeometry* shape = nullptr; // o corpo e a setinha numa peça só
+ if (fac && SUCCEEDED(fac->CreatePathGeometry(&shape))) {
+ ID2D1GeometrySink* sk = nullptr;
+ if (SUCCEEDED(shape->Open(&sk))) {
+ float ax = std::clamp(g_arrowX, RR + ARROW, PW() - RR - ARROW);
+ sk->BeginFigure({ RR, 0 }, D2D1_FIGURE_BEGIN_FILLED);
+ sk->AddLine({ PW() - RR, 0 }); sk->AddArc(D2D1::ArcSegment({ PW(), RR }, { RR, RR }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
+ sk->AddLine({ PW(), BODY - RR }); sk->AddArc(D2D1::ArcSegment({ PW() - RR, BODY }, { RR, RR }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
+ sk->AddLine({ ax + ARROW, BODY }); sk->AddLine({ ax, BODY + ARROW - 1 }); sk->AddLine({ ax - ARROW, BODY });
+ sk->AddLine({ RR, BODY }); sk->AddArc(D2D1::ArcSegment({ 0, BODY - RR }, { RR, RR }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
+ sk->AddLine({ 0, RR }); sk->AddArc(D2D1::ArcSegment({ RR, 0 }, { RR, RR }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));
+ sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();
+ br->SetColor(D2D1::ColorF(0.11f, 0.11f, 0.12f, 0.92f)); // a grade do 10.5 quase não deixava ver o fundo
+ dc->FillGeometry(shape, br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.28f));
+ dc->DrawGeometry(shape, br, 1.2f);
+ }
+ shape->Release();
+ }
+ if (fac) fac->Release();
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ {
+ std::wstring title = g_apps ? std::wstring(Tr(L"Aplicativos")) : std::wstring(L"Downloads");
+ dc->DrawTextW(title.c_str(), (UINT32)title.size(), g_tfTitle, D2D1::RectF(0, 7, PW(), HEAD), br);
+ }
+ {
+ std::lock_guard<std::mutex> l(g_mx);
+ if (g_files.empty()) {
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ dc->DrawTextW(Tr(L"Nenhum item"), (UINT32)wcslen(Tr(L"Nenhum item")), g_tfName, D2D1::RectF(0, HEAD + 30, PW(), HEAD + 60), br);
+ }
+ for (int i = 0; i < (int)g_files.size(); i++) {
+ auto& f = g_files[i];
+ D2D1_RECT_F c = CellRect(i);
+ float cx = (c.left + c.right) / 2;
+ D2D1_RECT_F ir{ cx - ICON / 2, c.top + 8, cx + ICON / 2, c.top + 8 + ICON };
+ if (i == g_hover) { // o item embaixo do ponteiro: quadro claro translúcido
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.16f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(ir.left - 6, ir.top - 6, ir.right + 6, ir.bottom + 6), 6, 6), br);
+ }
+ if (!f.bmp && !f.px.empty()) { f.bmp = ui::Bitmap(dc, f.w, f.h, f.px); f.px.clear(); f.px.shrink_to_fit(); }
+ if (f.bmp) {
+ D2D1_SIZE_F sz = f.bmp->GetSize();
+ float k = std::min(ICON / sz.width, ICON / sz.height);
+ float w = sz.width * k, hh = sz.height * k, iy = (ir.top + ir.bottom) / 2;
+ dc->DrawBitmap(f.bmp, D2D1::RectF(cx - w / 2, iy - hh / 2, cx + w / 2, iy + hh / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
+ } else ui::DrawFolder(dc, ir, 0);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ dc->DrawTextW(f.name.c_str(), (UINT32)f.name.size(), g_tfName, D2D1::RectF(c.left + 4, ir.bottom + 4, c.right - 4, c.bottom - 2), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ }
+ }
+ D2D1_RECT_F b = BtnRect(); // "Abrir no Finder ›" numa pílula escura com fio claro
+ std::wstring btn = std::wstring(Tr(L"Abrir no Finder")) + L" ›";
+ float tw = ui::TextWidth(g_tfBtn, btn) + 24, bc = (b.left + b.right) / 2;
+ D2D1_RECT_F pill = D2D1::RectF(bc - tw / 2, (b.top + b.bottom) / 2 - 10, bc + tw / 2, (b.top + b.bottom) / 2 + 10);
+ br->SetColor(g_hover == -1 ? D2D1::ColorF(1, 1, 1, 0.22f) : D2D1::ColorF(1, 1, 1, 0.10f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(pill, 10, 10), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.35f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(pill, 10, 10), br, 1);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));
+ dc->DrawTextW(btn.c_str(), (UINT32)btn.size(), g_tfBtn, pill, br);
+ br->Release();
+ ui::GpuEnd(g_s);
+ Motion();
+}
+
void Paint() {
if (!g_open) return;
if (g_fan) { PaintFan(); return; }
+ if (liquid::Leopard()) { PaintLeopard(); return; }
float sc = Sc();
int wpx = (int)std::lround(PW() * sc), hpx = (int)std::lround(PH() * sc);
bool dark = ui::Dark();
@@ -259,7 +342,7 @@ int HitAt(LPARAM l) {
void OpenDownloadsInFinder() {
std::wstring finder = shell::dir + L"\\" EXE_FINDER;
- ShellExecuteW(nullptr, L"open", finder.c_str(), L"shell:Downloads", nullptr, SW_SHOWNORMAL);
+ ShellExecuteW(nullptr, L"open", finder.c_str(), g_apps ? L"shell:Programs" : L"shell:Downloads", nullptr, SW_SHOWNORMAL);
}
LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
@@ -306,6 +389,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
}
return 0;
case WM_ACTIVATE: if (LOWORD(w) == WA_INACTIVE) Hide(); return 0;
+ case WM_CLOSE: Hide(true); return 0; // nunca destruir: a janela é reaproveitada (destruída, os cliques no Dock paravam)
}
return DefWindowProcW(h, m, w, l);
}
@@ -316,7 +400,8 @@ LRESULT CALLBACK BackProc(HWND h, UINT m, WPARAM w, LPARAM l) {
}
bool Ready() {
- if (g_wnd) return true;
+ if (g_wnd && IsWindow(g_wnd)) return true;
+ if (g_wnd) { if (g_back && IsWindow(g_back)) DestroyWindow(g_back); g_wnd = g_back = nullptr; g_open = g_closing = false; } // alguém destruiu: refaz
HINSTANCE hi = shell::inst;
WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"ShellPilha"; wc.hCursor = LoadCursorW(nullptr, IDC_ARROW);
RegisterClassW(&wc);
@@ -324,7 +409,7 @@ bool Ready() {
RegisterClassW(&bc);
g_wnd = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOREDIRECTIONBITMAP, wc.lpszClassName, L"Downloads", WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, hi, nullptr);
g_back = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_NOREDIRECTIONBITMAP, bc.lpszClassName, L"", WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, hi, nullptr);
- if (!g_wnd || !g_back) return false;
+ if (!g_wnd || !g_back) { Log(L"pilha: janela não criada (%lu)", GetLastError()); return false; }
g_glass = backdrop::Attach(g_back);
if (!g_glass) {
DestroyWindow(g_back);
@@ -349,8 +434,47 @@ std::wstring DownloadsDir() {
return d;
}
+// Leopard, pilha Aplicativos: os atalhos dos apps do Menu Iniciar (do usuário e de todos), sem desinstaladores e
+// manuais, em ordem alfabética
+std::vector<std::wstring> ListApps(int max) {
+ std::vector<std::pair<std::wstring, std::wstring>> v; // nome, caminho
+ for (auto* id : { &FOLDERID_Programs, &FOLDERID_CommonPrograms }) {
+ PWSTR p = nullptr;
+ if (FAILED(SHGetKnownFolderPath(*id, 0, nullptr, &p))) continue;
+ std::wstring root = p; CoTaskMemFree(p);
+ std::vector<std::wstring> dirs{ root };
+ for (size_t k = 0; k < dirs.size() && k < 200; k++) {
+ WIN32_FIND_DATAW fd;
+ HANDLE h = FindFirstFileW((dirs[k] + L"\\*").c_str(), &fd);
+ if (h == INVALID_HANDLE_VALUE) continue;
+ do {
+ if (fd.cFileName[0] == L'.') continue;
+ std::wstring full = dirs[k] + L"\\" + fd.cFileName;
+ if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (k == 0) dirs.push_back(full); continue; } // um nível de pastas
+ const wchar_t* x = wcsrchr(fd.cFileName, L'.');
+ if (!x || _wcsicmp(x, L".lnk")) continue;
+ std::wstring name(fd.cFileName, x - fd.cFileName), low = name;
+ for (auto& c : low) c = towlower(c);
+ bool skip = false;
+ for (const wchar_t* w : { L"uninstall", L"desinstal", L"readme", L"leia-me", L"help", L"ajuda", L"manual", L"website", L"license" })
+ if (low.find(w) != std::wstring::npos) skip = true;
+ if (skip) continue;
+ bool dup = false;
+ for (auto& e : v) if (!_wcsicmp(e.first.c_str(), name.c_str())) dup = true;
+ if (!dup) v.push_back({ name, full });
+ } while (FindNextFileW(h, &fd));
+ FindClose(h);
+ }
+ }
+ std::sort(v.begin(), v.end(), [](auto& a, auto& b) { return _wcsicmp(a.first.c_str(), b.first.c_str()) < 0; });
+ std::vector<std::wstring> out;
+ for (size_t i = 0; i < v.size() && (int)i < max; i++) out.push_back(v[i].second);
+ return out;
+}
+
// os arquivos de Downloads na ordem do botão direito (Data de Adição: o mais novo primeiro, como no Mac)
std::vector<std::wstring> List(int max) {
+ if (g_apps) return ListApps(max);
std::wstring d = DownloadsDir(), order = shell::Setting(L"pilha_ordem", L"adicao");
struct E { std::wstring path, name, ext; ULONGLONG made, mod; };
std::vector<E> v;
@@ -425,15 +549,21 @@ void pilhas::Menu(POINT anchor) {
else if (id == 400 || id == 401) shell::SetSetting(L"pilha_exibir", id == 400 ? L"pasta" : L"pilha");
}
-std::vector<std::wstring> pilhas::Recentes(int max) { return List(max); }
+std::vector<std::wstring> pilhas::Recentes(int max) { bool a = g_apps; g_apps = false; auto v = List(max); g_apps = a; return v; }
+void ShowStack(POINT anchor, bool apps);
+void pilhas::Show(POINT anchor) { ShowStack(anchor, false); }
+void pilhas::ShowApps(POINT anchor) { ShowStack(anchor, true); }
bool pilhas::IsOpen() { return g_open && !g_closing; }
-void pilhas::Show(POINT anchor) {
- if (g_open && !g_closing) { Hide(true); return; }
+void ShowStack(POINT anchor, bool apps) {
+ Log(L"pilha: abrir %s (aberta=%d fechando=%d janela=%d)", apps ? L"Aplicativos" : L"Downloads", (int)g_open, (int)g_closing, g_wnd && IsWindow(g_wnd) ? 1 : 0);
+ if (g_open && !g_closing) { bool same = g_apps == apps; Hide(true); if (same) return; HideNow(); }
if (g_closing) HideNow();
if (!Ready()) return;
- std::wstring ver = shell::Setting(L"pilha_ver", L"auto");
+ g_apps = apps;
+ MAXN = apps ? 42 : 18;
+ std::wstring ver = apps ? std::wstring(L"grade") : shell::Setting(L"pilha_ver", L"auto"); // Aplicativos: sempre a Grade
if (ver == L"lista") { ShowList(anchor); return; }
g_fan = ver != L"grade"; // Automático: o Leque, como o Mac faz com Downloads
std::vector<std::wstring> files = List(g_fan ? FAN_MAX : MAXN);
@@ -450,6 +580,7 @@ void pilhas::Show(POINT anchor) {
for (size_t i = 0; i < files.size() && (int)i < MAXN; i++) {
File f; f.path = files[i];
f.name = files[i].substr(files[i].find_last_of(L'\\') + 1);
+ if (g_apps && f.name.size() > 4 && !_wcsicmp(f.name.c_str() + f.name.size() - 4, L".lnk")) f.name.resize(f.name.size() - 4); // Aplicativos: sem o ".lnk"
g_files.push_back(f);
}
}
@@ -457,11 +588,19 @@ void pilhas::Show(POINT anchor) {
float sc = Sc();
int px = (int)std::lround(ICON * sc);
std::vector<std::wstring> paths = files;
- std::thread([paths, px, gen] {
+ const bool appsIcons = g_apps;
+ std::thread([paths, px, gen, appsIcons] {
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
for (size_t i = 0; i < paths.size() && (int)i < MAXN; i++) {
UINT w = 0, h = 0; std::vector<BYTE> bgra;
- if (!ui::FileImage(paths[i], px, w, h, bgra)) continue;
+ bool got = false;
+ if (appsIcons) { // Aplicativos: o ícone do tema (Leopard/aquificado) quando o pacote conhece o app
+ std::wstring nm = paths[i].substr(paths[i].find_last_of(L'\\') + 1);
+ if (nm.size() > 4) nm.resize(nm.size() - 4);
+ std::wstring png = apps::PackIconByName(nm, L"");
+ got = !png.empty() && ui::LoadPng(png, w, h, bgra);
+ }
+ if (!got && !ui::FileImage(paths[i], px, w, h, bgra)) continue;
{
std::lock_guard<std::mutex> l(g_mx);
if (gen != g_gen || i >= g_files.size()) break;
diff --git a/src/shell/ponteiro.cpp b/src/shell/ponteiro.cpp
index de6553c..284cd66 100644
--- a/src/shell/ponteiro.cpp
+++ b/src/shell/ponteiro.cpp
@@ -205,3 +205,78 @@ void ponteiro::Stop() {
if (DWORD t = g_tid) PostThreadMessageW(t, WM_QUIT, 0, 0);
SystemParametersInfoW(SPI_SETCURSORS, 0, nullptr, 0); // o cursor volta mesmo se a thread não chegar a tempo
}
+
+// ---- Cursor do tema Mac OS X Leopard
+// Escolher o Leopard troca o esquema de cursores do usuário (HKCU\Control Panel\Cursors, nada do sistema) pelo do
+// Mac OS X: a seta preta de contorno branco, a mãozinha, o I-beam e o cata-vento colorido ("RainbowSwirl") de espera.
+// Os arquivos ficam em <instalação>\cursor\Leopard (tools\cursor-leopard.py, do pacote que o usuário baixou). O
+// esquema que estava antes é guardado em %APPDATA%\Shell\cursor-antes.txt e volta quando o tema sai do Leopard —
+// só se o cursor ainda for o do Leopard (se o usuário trocou o cursor no meio, o dele fica).
+namespace {
+struct Papel { const wchar_t* reg; const wchar_t* arquivo; };
+const Papel LEO_CURSORES[] = {
+ { L"Arrow", L"Normal Select.cur" }, { L"Help", L"Help Select.cur" }, { L"AppStarting", L"RainbowSwirl-Background.ani" },
+ { L"Wait", L"RainbowSwirl-Busy.ani" }, { L"Crosshair", L"Precision Select.cur" }, { L"IBeam", L"Text Select.cur" },
+ { L"NWPen", L"Handwriting.cur" }, { L"No", L"Unavailable.cur" }, { L"SizeNS", L"Vertical Resize.cur" },
+ { L"SizeWE", L"Horizontal Resize.cur" }, { L"SizeNWSE", L"Diagonal Resize 1.cur" }, { L"SizeNESW", L"Diagonal Resize 2.cur" },
+ { L"SizeAll", L"Move.cur" }, { L"UpArrow", L"Alternate Select.cur" }, { L"Hand", L"Link Select.cur" },
+};
+const wchar_t* CUR_KEY = L"Control Panel\\Cursors";
+std::wstring LeoDir() { return shell::dir.substr(0, shell::dir.find_last_of(L'\\')) + L"\\cursor\\Leopard"; }
+std::wstring AntesPath() {
+ wchar_t ad[MAX_PATH] = {};
+ GetEnvironmentVariableW(L"APPDATA", ad, MAX_PATH);
+ return std::wstring(ad) + L"\\Shell\\cursor-antes.txt";
+}
+std::wstring LerCur(const wchar_t* nome) {
+ wchar_t v[MAX_PATH * 2] = {}; DWORD cb = sizeof(v);
+ if (RegGetValueW(HKEY_CURRENT_USER, CUR_KEY, nome, RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ | RRF_NOEXPAND, nullptr, v, &cb) != ERROR_SUCCESS) return L"";
+ return v;
+}
+void GravarCur(const wchar_t* nome, const std::wstring& v, bool expand = true) {
+ HKEY k;
+ if (RegOpenKeyExW(HKEY_CURRENT_USER, CUR_KEY, 0, KEY_SET_VALUE, &k) != ERROR_SUCCESS) return;
+ RegSetValueExW(k, nome, 0, expand ? REG_EXPAND_SZ : REG_SZ, (const BYTE*)v.c_str(), (DWORD)((v.size() + 1) * sizeof(wchar_t)));
+ RegCloseKey(k);
+}
+}
+
+void ponteiro::TemaLeopard(bool on) {
+ std::wstring dir = LeoDir();
+ std::wstring arrow = dir + L"\\Normal Select.cur";
+ bool ativo = !_wcsicmp(LerCur(L"Arrow").c_str(), arrow.c_str()); // o cursor do Leopard já está aplicado
+ if (on) {
+ if (ativo) return;
+ if (GetFileAttributesW(arrow.c_str()) == INVALID_FILE_ATTRIBUTES) { Log(L"cursor do Leopard: arquivos não encontrados em %ls", dir.c_str()); return; }
+ // guarda o esquema de agora (só se ainda não houver um guardado: trocar de tema duas vezes não perde o original)
+ if (GetFileAttributesW(AntesPath().c_str()) == INVALID_FILE_ATTRIBUTES) {
+ FILE* f = nullptr;
+ if (_wfopen_s(&f, AntesPath().c_str(), L"w, ccs=UTF-8") || !f) { Log(L"cursor do Leopard: não deu para guardar o anterior"); return; }
+ fwprintf(f, L"(Default)=%ls\n", LerCur(nullptr).c_str());
+ for (auto& p : LEO_CURSORES) fwprintf(f, L"%ls=%ls\n", p.reg, LerCur(p.reg).c_str());
+ fclose(f);
+ }
+ GravarCur(nullptr, L"Mac OS X Leopard", false);
+ for (auto& p : LEO_CURSORES) GravarCur(p.reg, dir + L"\\" + p.arquivo);
+ SystemParametersInfoW(SPI_SETCURSORS, 0, nullptr, SPIF_SENDCHANGE);
+ Log(L"cursor do Leopard aplicado (o anterior em %ls)", AntesPath().c_str());
+ return;
+ }
+ FILE* f = nullptr;
+ if (_wfopen_s(&f, AntesPath().c_str(), L"r, ccs=UTF-8") || !f) return; // nada guardado: nada a devolver
+ std::vector<std::pair<std::wstring, std::wstring>> antes;
+ wchar_t line[MAX_PATH * 2 + 64];
+ while (fgetws(line, (int)std::size(line), f)) {
+ std::wstring s = line;
+ while (!s.empty() && (s.back() == L'\n' || s.back() == L'\r')) s.pop_back();
+ size_t eq = s.find(L'=');
+ if (eq != std::wstring::npos) antes.push_back({ s.substr(0, eq), s.substr(eq + 1) });
+ }
+ fclose(f);
+ if (ativo) { // só devolve se o cursor ainda for o do Leopard
+ for (auto& [k, v] : antes) GravarCur(k == L"(Default)" ? nullptr : k.c_str(), v, k != L"(Default)");
+ SystemParametersInfoW(SPI_SETCURSORS, 0, nullptr, SPIF_SENDCHANGE);
+ Log(L"cursor do Leopard: esquema anterior devolvido");
+ }
+ DeleteFileW(AntesPath().c_str());
+}
diff --git a/src/shell/quicklook.cpp b/src/shell/quicklook.cpp
index 745fb4c..66f6bf4 100644
--- a/src/shell/quicklook.cpp
+++ b/src/shell/quicklook.cpp
@@ -585,6 +585,53 @@ void Paint() {
ID2D1SolidColorBrush* br = nullptr;
rt->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);
if (liquid::Golden()) { br->Release(); PaintGolden(rt, wr, wpx, hpx, sc, dark); return; }
+ if (liquid::Leopard()) {
+ // Leopard: o Quick Look do 10.5 — HUD preto translúcido de cantos redondos com o fio claro, o título branco no
+ // meio da faixa de cima (24), o X branco num círculo cinza à esquerda e a prévia no corpo. Sem "Abrir com".
+ const float LB = 24, LR = 10;
+ br->SetColor(D2D1::ColorF(0.07f, 0.07f, 0.08f, 0.90f));
+ rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0.5f, 0.5f, W - 0.5f, H - 0.5f), LR, LR), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.30f));
+ rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0.5f, 0.5f, W - 0.5f, H - 0.5f), LR, LR), br, 1);
+ g_openR = D2D1::RectF(0, 0, 0, 0);
+ g_closeR = D2D1::RectF(5, 4, 21, 20);
+ D2D1_POINT_2F cc{ 13, 12 };
+ br->SetColor(g_hoverClose ? D2D1::ColorF(0.55f, 0.55f, 0.57f, 1) : D2D1::ColorF(0.42f, 0.42f, 0.44f, 1));
+ rt->FillEllipse(D2D1::Ellipse(cc, 6.5f, 6.5f), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.55f));
+ rt->DrawEllipse(D2D1::Ellipse(cc, 6.5f, 6.5f), br, 0.8f);
+ br->SetColor(D2D1::ColorF(0.07f, 0.07f, 0.08f, 1));
+ rt->DrawLine({ cc.x - 2.4f, cc.y - 2.4f }, { cc.x + 2.4f, cc.y + 2.4f }, br, 1.5f);
+ rt->DrawLine({ cc.x - 2.4f, cc.y + 2.4f }, { cc.x + 2.4f, cc.y - 2.4f }, br, 1.5f);
+ static IDWriteTextFormat* tfT = [] { auto* f = ui::FormatFace(L"Lucida Sans Unicode", 12, DWRITE_FONT_WEIGHT_NORMAL); if (f) f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); return f; }();
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.92f));
+ rt->DrawTextW(g_name.c_str(), (UINT32)g_name.size(), tfT, D2D1::RectF(30, 0, W - 30, LB), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ D2D1_RECT_F body = D2D1::RectF(8, LB, W - 8, H - 8);
+ rt->PushAxisAlignedClip(body, D2D1_ANTIALIAS_MODE_ALIASED);
+ if (!g_text.empty()) { // texto: a folha branca
+ br->SetColor(D2D1::ColorF(1, 1, 1, 1));
+ rt->FillRectangle(body, br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.9f));
+ rt->DrawTextW(g_text.c_str(), (UINT32)std::min<size_t>(g_text.size(), 20000), g_tfText, D2D1::RectF(body.left + 14, body.top + 10, body.right - 14, body.bottom), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ } else {
+ if (g_bmpRt != rt && g_bmp) { g_bmp->Release(); g_bmp = nullptr; }
+ if (!g_bmp && !g_px.empty()) { g_bmp = ui::Bitmap(rt, g_iw, g_ih, g_px); g_bmpRt = rt; }
+ if (g_bmp) {
+ float bwid = body.right - body.left, bh = body.bottom - body.top;
+ float k = std::min(bwid / g_iw, bh / g_ih), w = g_iw * k, h = g_ih * k;
+ float x = body.left + (bwid - w) / 2, y = body.top + (bh - h) / 2;
+ rt->DrawBitmap(g_bmp, D2D1::RectF(x, y, x + w, y + h), 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR);
+ } else {
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.55f));
+ const wchar_t* t = g_loading ? Tr(L"Carregando…") : Tr(L"Sem prévia");
+ rt->DrawTextW(t, (UINT32)wcslen(t), tfT, D2D1::RectF(body.left, (body.top + body.bottom) / 2 - 10, body.right, (body.top + body.bottom) / 2 + 10), br);
+ }
+ }
+ rt->PopAxisAlignedClip();
+ br->Release();
+ ui::End(g_s, true, POINT{ wr.left, wr.top });
+ return;
+ }
// corpo e barra
br->SetColor(dark ? D2D1::ColorF(0.12f, 0.12f, 0.13f, 0.97f) : D2D1::ColorF(0.97f, 0.97f, 0.97f, 0.98f));
rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0.5f, 0.5f, W - 0.5f, H - 0.5f), R, R), br);
diff --git a/src/shell/seletor.cpp b/src/shell/seletor.cpp
index 87c2c35..ec45e97 100644
--- a/src/shell/seletor.cpp
+++ b/src/shell/seletor.cpp
@@ -20,6 +20,7 @@ const float RADIUS = 15;
void Metricas() {
// o usuário achou grande na tela dele (2026-11-16): o guia em ~78% (quadro de 100 em vez de 128, painel de 138)
if (liquid::On()) { ICON = 100 * 0.805f; PITCH = 105; TILE = 100; PAD_X = 19; PAD_TOP = 19; PANEL_H = 138; LABEL_CY = 19 + 100 + 10; }
+ else if (liquid::Leopard()) { ICON = 96; PITCH = 118; TILE = 114; PAD_X = 16; PAD_TOP = 14; PANEL_H = 160; LABEL_CY = 14 + 114 + 15; } // Leopard: ícones grandes
else { ICON = 78; PITCH = 101.5f; TILE = 103; PAD_X = 13.5f; PAD_TOP = 18.5f; PANEL_H = 141; LABEL_CY = 132.5f; }
}
const UINT_PTR T_SHOW = 1, T_SHOWNOW = 2;
@@ -68,8 +69,53 @@ void Collect() {
}
}
+// Mac OS X Leopard: o seletor de apps do 10.5 — painel preto translúcido de cantos 18 com o fio claro, ícones grandes,
+// o escolhido num quadrado cinza claro translúcido e o nome dele em branco, negrito, embaixo. Desenho próprio.
+void PaintLeopard() {
+ float sc = Sc(), W = PanelW(), H = PANEL_H;
+ int wpx = (int)std::lround(W * g_k * sc), hpx = (int)std::lround(H * g_k * sc);
+ if (g_back && IsWindowVisible(g_back)) ShowWindow(g_back, SW_HIDE); // sem o vidro desfocado: o 10.5 não desfocava
+ auto* dc = ui::GpuBegin(g_s, wpx, hpx, sc * g_k);
+ if (!dc) return;
+ ID2D1SolidColorBrush* br = nullptr;
+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);
+ const float R = 18;
+ br->SetColor(D2D1::ColorF(0.06f, 0.06f, 0.07f, 0.66f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0, 0, W, H), R, R), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.22f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0.5f, 0.5f, W - 0.5f, H - 0.5f), R - 0.5f, R - 0.5f), br, 1);
+ for (int i = 0; i < (int)g_list.size(); i++) {
+ float x = PAD_X + i * PITCH;
+ D2D1_RECT_F tile{ x, PAD_TOP, x + TILE, PAD_TOP + TILE };
+ if (i == g_sel) {
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.20f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(tile, 10, 10), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.30f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(tile.left + 0.5f, tile.top + 0.5f, tile.right - 0.5f, tile.bottom - 0.5f), 9.5f, 9.5f), br, 1);
+ }
+ auto& e = g_list[i];
+ if (e.bmp) {
+ float s = e.mac ? ICON / 0.8f : ICON;
+ float cx = (tile.left + tile.right) / 2, cy = (tile.top + tile.bottom) / 2;
+ auto sz = e.bmp->GetSize();
+ float k = std::min(s / sz.width, s / sz.height);
+ dc->DrawBitmap(e.bmp, D2D1::RectF(cx - sz.width * k / 2, cy - sz.height * k / 2, cx + sz.width * k / 2, cy + sz.height * k / 2), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);
+ }
+ }
+ if (g_sel >= 0 && g_sel < (int)g_list.size()) {
+ static IDWriteTextFormat* tf = [] { auto* f = ui::FormatFace(L"Lucida Sans Unicode", 13, DWRITE_FONT_WEIGHT_BOLD); if (f) f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); return f; }();
+ float cx = PAD_X + g_sel * PITCH + TILE / 2;
+ const std::wstring& n = g_list[g_sel].name;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.97f));
+ dc->DrawTextW(n.c_str(), (UINT32)n.size(), tf, D2D1::RectF(cx - 140, LABEL_CY - 10, cx + 140, LABEL_CY + 10), br);
+ }
+ br->Release();
+ ui::GpuEnd(g_s);
+}
+
void Paint() {
if (!g_visible) return;
+ if (liquid::Leopard()) { PaintLeopard(); return; }
float sc = Sc(), W = PanelW(), H = PANEL_H;
int wpx = (int)std::lround(W * g_k * sc), hpx = (int)std::lround(H * g_k * sc);
auto* dc = ui::GpuBegin(g_s, wpx, hpx, sc * g_k);
@@ -130,7 +176,7 @@ void Paint() {
void ShowNow() {
KillTimer(g_wnd, T_SHOWNOW);
if (!g_visible || IsWindowVisible(g_wnd)) return;
- SetWindowPos(g_back, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
+ if (!liquid::Leopard()) SetWindowPos(g_back, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); // Leopard: sem o vidro
SetWindowPos(g_wnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
@@ -195,6 +241,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
case WM_TIMER: if (w == T_SHOW) { KillTimer(h, T_SHOW); Show(); } else if (w == T_SHOWNOW) ShowNow(); return 0; // segurança: o aviso não veio
case WM_SHOWNOW: ShowNow(); return 0;
case WM_MOUSEACTIVATE: return MA_NOACTIVATE; // o app de baixo continua com o teclado
+ case WM_CLOSE: if (g_active) Hide(); return 0; // nunca destrói (o seletor vive enquanto o Shell vive)
case WM_MOUSEMOVE: { int i = HitIcon(l); if (i >= 0 && i != g_sel) { g_sel = i; Paint(); } return 0; }
case WM_LBUTTONUP: { int i = HitIcon(l); if (i >= 0) { g_sel = i; Commit(); } return 0; }
}
diff --git a/src/shell/shell.h b/src/shell/shell.h
index 46dceff..a406635 100644
--- a/src/shell/shell.h
+++ b/src/shell/shell.h
@@ -108,6 +108,7 @@ IDCompositionAnimation* CompCurve(const std::vector<float>& v, float durSec);
void Acrylic(HWND h, DWORD tintABGR); // desfoque atrás da janela (SetWindowCompositionAttribute)
IDWriteTextFormat* Format(float size, DWRITE_FONT_WEIGHT w, bool icons = false,
DWRITE_TEXT_ALIGNMENT a = DWRITE_TEXT_ALIGNMENT_LEADING);
+IDWriteTextFormat* FormatFace(const wchar_t* face, float size, DWRITE_FONT_WEIGHT w); // família escolhida (Leopard: Lucida)
float TextWidth(IDWriteTextFormat* tf, const std::wstring& s);
ID2D1Bitmap* Bitmap(ID2D1RenderTarget* rt, UINT w, UINT h, const std::vector<BYTE>& bgra);
// Tahoe: Aparência > "Estilo de ícones e widgets" (estilo_icones): padrao | escuro | transparente | tingido.
@@ -408,6 +409,7 @@ std::wstring Path();
}
namespace pilhas { // Pilhas do Dock (pilhas.cpp): Downloads em Leque, Grade ou Lista, como no Mac
void Show(POINT anchorScreen); // anchor: centro de cima do ícone
+void ShowApps(POINT anchorScreen); // Leopard: a pasta Aplicativos da Dock como Pilha em Grade
void Menu(POINT anchorScreen); // botão direito: ordenar, ver como, exibir como (pasta/pilha), abrir a pasta
bool IsOpen();
std::vector<std::wstring> Recentes(int max); // os primeiros arquivos de Downloads na ordem escolhida (a pilha no Dock)
@@ -472,6 +474,7 @@ HWND Fundo(); // o vidro, a janela mais de baixo do Dock
int ReservedHeight(); // px reservados embaixo (área de trabalho)
HMONITOR MonitorHandle(); // o monitor do Dock (ajuste dock_monitor; vazio = o principal)
void Raise(); // traz o Dock para cima (ex.: por cima do Launchpad)
+void OpenAppsStack(); // Leopard: a pasta Aplicativos como Pilha em Grade
void ReloadSettings(); // o Ajustes do Sistema mudou tamanho, ampliação...
void ApplyTheme(); // claro/escuro mudou
void IconsChanged(); // o pacote de ícones mudou (tema Sequoia/Tahoe): solta os ícones guardados
@@ -499,6 +502,7 @@ void AfterCommit(HWND to, UINT msg);
struct Style {
bool liquid = false; // liquid_glass: vidro líquido do macOS Tahoe
bool golden = false; // golden_gate (com liquid_glass): tema macOS 27 Golden Gate
+ bool leopard = false; // leopard (sem liquid_glass): tema Mac OS X Leopard (o Sequoia com o Aqua de 2007)
bool tinted = false; // liquid_estilo: "nitido" ou "tingido"
float refraction = 0.6f; // liquid_refracao 0..1: força da lente nas bordas
bool reduce = false; // reduzir_transparencia
@@ -524,6 +528,7 @@ D2D1_COLOR_F AdjustTint(D2D1_COLOR_F c);
namespace liquid { // tema macOS Tahoe nos painéis do Shell (liquid.cpp): detalhes D2D por cima do vidro
bool On(); // Tema = macOS Tahoe (liquid_glass), mesmo com a transparência reduzida
bool Golden(); // Tema = macOS Golden Gate (liquid_glass + golden_gate): o Tahoe com o que mudou no macOS 27
+bool Leopard(); // Tema = Mac OS X Leopard (leopard=1, sem liquid_glass): barra de menus clara com a maçã grafite, Dock em prateleira
// contorno especular; spec = força do brilho dos cantos (0 em repouso, 1 com o ponteiro em cima), lx/ly = de onde vem a
// luz (0..1 dentro da peça, a posição do ponteiro; < 0 = canto de cima à esquerda)
void Rim(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, bool dark, float strength = 1, float spec = 1, float lx = -1, float ly = -1);
@@ -590,4 +595,6 @@ void Stop(Live* live);
namespace ponteiro { // ponteiro.cpp: sacudir o mouse faz o ponteiro crescer (como no Mac)
void Start();
void Stop();
+// tema Mac OS X Leopard: liga o cursor do Mac OS X (guardando o esquema de antes) ou devolve o de antes
+void TemaLeopard(bool on);
}
diff --git a/src/shell/sobre.cpp b/src/shell/sobre.cpp
index cbd6feb..cf59dab 100644
--- a/src/shell/sobre.cpp
+++ b/src/shell/sobre.cpp
@@ -9,6 +9,8 @@
#include <cmath>
#include "../comum/idioma.h"
#include "../comum/semaforo.h"
+#include "../comum/leopard.h" // tema Mac OS X Leopard: o metal da barra
+#include "../comum/simbolos.h" // a maçã do Leopard (apple.logo em prata)
namespace {
@@ -16,13 +18,16 @@ const float W = 280;
// macOS 27 Golden Gate (About-This-Mac.png, 2x): 280 × 487, nome a 245,5 sem a linha do ano, dados a partir de 285,5
// a cada 16, "Mais Informações…" de 24 em 376,5 e o rodapé em 422 / 437 / 451
#define GG (liquid::Golden())
-#define H (GG ? 487.f : 474.f)
+// Mac OS X Leopard (About This Mac do 10.5): 280 × 384, janela cinza 232 com a barra de 22, maçã prateada, "Mac OS X",
+// a versão, "Atualização de Software…", Processador / Memória / Disco de Inicialização, "Mais Informações…" e o rodapé
+#define LEO (liquid::Leopard())
+#define H (LEO ? 384.f : GG ? 487.f : 474.f)
const float LIGHT_PITCH = 23, LIGHT_R = 7; // padrão do projeto (o do Monitor de Atividade)
// Tahoe (guia macOS26-Theme-Reference, seção 9.1): janela só com título = cantos de 16 e o 1º botão em x 9, y 9
// (centro 16, 16); Sequoia: cantos de 10, centro em 19, 14
-#define RADIUS (liquid::On() ? 16.f : 10.f)
-#define LIGHT_X0 (liquid::On() ? 16.f : 19.f)
-#define LIGHT_Y (liquid::On() ? 16.f : 14.f)
+#define RADIUS (liquid::On() ? 16.f : LEO ? 6.f : 10.f)
+#define LIGHT_X0 (liquid::On() ? 16.f : LEO ? 14.5f : 19.f)
+#define LIGHT_Y (liquid::On() ? 16.f : LEO ? 11.f : 14.f)
const float IMG_TOP = 90, IMG_W = 145.5f, IMG_H = 70.7f;
const float YEAR_CY = 262;
#define TITLE_CY (GG ? 245.5f : 240.6f)
@@ -46,6 +51,43 @@ UINT g_pw, g_ph; std::vector<BYTE> g_px; bool g_triedPhoto;
float Sc() { return ui::Scale(g_wnd); }
+// dados reais da máquina para o Sobre do Leopard (o 10.5 mostrava o processador, a memória e o disco)
+std::wstring Processador() {
+ wchar_t v[128] = {}; DWORD cb = sizeof(v);
+ RegGetValueW(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", L"ProcessorNameString", RRF_RT_REG_SZ, nullptr, v, &cb);
+ std::wstring s = v;
+ while (!s.empty() && s.back() == L' ') s.pop_back();
+ while (!s.empty() && s[0] == L' ') s.erase(0, 1);
+ for (const wchar_t* tira : { L"(R)", L"(TM)", L" CPU", L" Processor" }) for (size_t p; (p = s.find(tira)) != std::wstring::npos;) s.erase(p, wcslen(tira));
+ if (size_t p = s.find(L" @ "); p != std::wstring::npos) s = s.substr(p + 3) + L" " + s.substr(0, p); // "3,6 GHz Intel Core i7" como no Mac
+ return s.empty() ? L"Intel Core 2 Duo" : s;
+}
+std::wstring Memoria() {
+ MEMORYSTATUSEX m{ sizeof(m) };
+ GlobalMemoryStatusEx(&m);
+ wchar_t b[32]; swprintf_s(b, L"%llu GB", (m.ullTotalPhys + (1ull << 29)) >> 30);
+ return b;
+}
+
+// botão em pílula do Aqua (perolado; com o mouse apertado, azul)
+void AquaPill(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r, bool down) {
+ float rad = (r.bottom - r.top) / 2;
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, r.top + 1, r.right, r.bottom + 1), rad, rad), br);
+ D2D1_GRADIENT_STOP st[4] = { { 0, down ? D2D1::ColorF(0.66f, 0.80f, 0.98f, 1) : D2D1::ColorF(1, 1, 1, 1) },
+ { 0.5f, down ? D2D1::ColorF(0.38f, 0.60f, 0.93f, 1) : D2D1::ColorF(0.95f, 0.95f, 0.95f, 1) },
+ { 0.5f, down ? D2D1::ColorF(0.24f, 0.47f, 0.87f, 1) : D2D1::ColorF(0.88f, 0.88f, 0.88f, 1) },
+ { 1, down ? D2D1::ColorF(0.58f, 0.82f, 1.0f, 1) : D2D1::ColorF(0.98f, 0.98f, 0.98f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 4, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))
+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.40f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), rad - 0.5f, rad - 0.5f), br, 1);
+}
+
// número de série estável para esta máquina (10 caracteres, como os do Mac)
std::wstring Serial() {
wchar_t guid[64] = {}; DWORD n = sizeof(guid);
@@ -146,6 +188,66 @@ void DrawMacStudio(ID2D1DeviceContext* dc, float x, float y) {
const UINT WM_SB_FRAME = WM_APP + 72;
double g_openAt; // a mola comum dos painéis ao aparecer
+void PaintLeopard(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br) {
+ // fundo cinza 232 do 10.5 com a barra de 22 em metal (cantos de cima redondos, os de baixo quase retos)
+ br->SetColor(D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0, 0, W, H), RADIUS, RADIUS), br);
+ leopard::Metal(dc, D2D1::RectF(0, 0, W, 22), g_active, false, true, RADIUS);
+ Text(dc, br, Tr(L"Sobre Este Mac"), 13, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, D2D1::RectF(70, 1, W - 70, 22), D2D1::ColorF(1, 1, 1, 0.5f));
+ Text(dc, br, Tr(L"Sobre Este Mac"), 13, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, D2D1::RectF(70, 0, W - 70, 21), D2D1::ColorF(0, 0, 0, g_active ? 0.80f : 0.45f));
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0.5f, 0.5f, W - 0.5f, H - 0.5f), RADIUS - 0.5f, RADIUS - 0.5f), br, 1);
+ // só o fechar aceso (gel); minimizar e ampliar apagados
+ for (int k = 0; k < 3; k++) {
+ D2D1_POINT_2F c{ LIGHT_X0 + k * 21.f, LIGHT_Y };
+ br->SetColor(k == 0 && g_active ? semaforo::Close() : D2D1::ColorF(0.75f, 0.75f, 0.75f, 1));
+ dc->FillEllipse(D2D1::Ellipse(c, 7, 7), br);
+ semaforo::Gloss(dc, c, 7, br);
+ if (k == 0 && g_hover == 0) {
+ br->SetColor(D2D1::ColorF(0.30f, 0, 0, 0.75f));
+ dc->DrawLine({ c.x - 2.6f, c.y - 2.6f }, { c.x + 2.6f, c.y + 2.6f }, br, 1.2f);
+ dc->DrawLine({ c.x - 2.6f, c.y + 2.6f }, { c.x + 2.6f, c.y - 2.6f }, br, 1.2f);
+ }
+ }
+ // a maçã prateada (degradê do branco para o cinza, com o contorno escuro fino)
+ {
+ D2D1_RECT_F ar = D2D1::RectF(W / 2 - 34, 40, W / 2 + 34, 118);
+ D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(0.97f, 0.97f, 0.98f, 1) }, { 0.55f, D2D1::ColorF(0.80f, 0.81f, 0.83f, 1) }, { 1, D2D1::ColorF(0.58f, 0.59f, 0.62f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 3, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, ar.top }, { 0, ar.bottom }), gs, &lb))) {
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.22f)); // sombra
+ simbolo::Draw(dc, L"apple.logo", D2D1::RectF(ar.left, ar.top + 1.5f, ar.right, ar.bottom + 1.5f), br);
+ simbolo::Draw(dc, L"apple.logo", ar, lb);
+ }
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ }
+ auto C = DWRITE_TEXT_ALIGNMENT_CENTER;
+ D2D1_COLOR_F ink = D2D1::ColorF(0, 0, 0, 0.88f), gray = D2D1::ColorF(0, 0, 0, 0.55f);
+ Text(dc, br, L"Mac OS X", 27, DWRITE_FONT_WEIGHT_LIGHT, C, D2D1::RectF(0, 124, W, 158), D2D1::ColorF(0.25f, 0.25f, 0.26f, 1));
+ Text(dc, br, Tr(L"Versão 10.5.8"), 11, DWRITE_FONT_WEIGHT_NORMAL, C, D2D1::RectF(0, 158, W, 174), gray);
+ auto pill = [&](const std::wstring& s, float top, D2D1_RECT_F& out, int id) {
+ IDWriteTextFormat* tb = ui::Format(11, DWRITE_FONT_WEIGHT_NORMAL);
+ float tw = tb ? ui::TextWidth(tb, s) : 110;
+ if (tb) tb->Release();
+ float bw = std::ceil(tw + 30);
+ out = D2D1::RectF((W - bw) / 2, top, (W + bw) / 2, top + 19);
+ AquaPill(dc, br, out, g_press == id && g_hover == id);
+ Text(dc, br, s, 11, DWRITE_FONT_WEIGHT_NORMAL, C, out, ink);
+ };
+ pill(Tr(L"Atualização de Software…"), 184, g_reg, 2);
+ const std::wstring rows[3][2] = { { Tr(L"Processador"), Processador() }, { Tr(L"Memória"), Memoria() }, { Tr(L"Disco de Inicialização"), L"Macintosh HD" } };
+ for (int i = 0; i < 3; i++) {
+ float cy = 232 + i * 22.f;
+ Text(dc, br, rows[i][0], 11, DWRITE_FONT_WEIGHT_BOLD, DWRITE_TEXT_ALIGNMENT_TRAILING, D2D1::RectF(0, cy - 8, 112, cy + 8), ink);
+ Text(dc, br, rows[i][1], 11, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_LEADING, D2D1::RectF(120, cy - 8, W - 10, cy + 8), ink);
+ }
+ pill(Tr(L"Mais Informações…"), 300, g_btn, 1);
+ Text(dc, br, Tr(L"™ e © 1983-2009 Apple Inc."), 10, DWRITE_FONT_WEIGHT_NORMAL, C, D2D1::RectF(0, 344, W, 358), gray);
+ Text(dc, br, Tr(L"Todos os direitos reservados."), 10, DWRITE_FONT_WEIGHT_NORMAL, C, D2D1::RectF(0, 358, W, 372), gray);
+}
+
void Paint() {
if (!g_wnd || !IsWindowVisible(g_wnd)) return;
float sc = Sc();
@@ -155,6 +257,17 @@ void Paint() {
bool dark = ui::Dark();
ID2D1SolidColorBrush* br = nullptr;
dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);
+ if (LEO) { // Leopard: janela opaca (sem o vidro), o desenho do 10.5
+ PaintLeopard(dc, br);
+ br->Release();
+ ui::GpuEnd(g_s);
+ if (g_glass) backdrop::SetPieces(g_back, (float)wpx, (float)hpx, { { D2D1::RectF(0, 0, (float)wpx, (float)hpx), RADIUS * sc } },
+ D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1), 0.f);
+ anim::Panel mo = anim::PanelIn(anim::Now() - g_openAt);
+ ui::GpuMotion(g_s, mo.scale, wpx / 2.f, hpx / 2.f, mo.fade);
+ if (g_glass) backdrop::Fade(g_back, mo.fade, mo.scale, wpx / 2.f, hpx / 2.f);
+ return;
+ }
if (!g_glass) {
br->SetColor(dark ? D2D1::ColorF(0.145f, 0.145f, 0.15f) : D2D1::ColorF(0.93f, 0.93f, 0.94f));
dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0, 0, W, H), RADIUS, RADIUS), br);
@@ -263,7 +376,7 @@ int Hit(D2D1_POINT_2F p) {
void Click(int what) {
if (what == 0) Close();
else if (what == 1) shell::OpenSettings(L"geral");
- else if (what == 2) shell::OpenSettings(L"geral");
+ else if (what == 2) shell::OpenSettings(LEO ? L"atualizacao" : L"geral"); // Leopard: "Atualização de Software…"
}
LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
diff --git a/src/shell/spotlight.cpp b/src/shell/spotlight.cpp
index 6c15432..21040e1 100644
--- a/src/shell/spotlight.cpp
+++ b/src/shell/spotlight.cpp
@@ -61,8 +61,12 @@ void Metricas() {
CARD_H = 63.5f;
GG_GAP = 11;
}
+ if (liquid::Leopard()) { // Leopard: o menu do Spotlight do 10.5, preso na barra de menus à direita
+ W = 380; FIELD_H = 34; CARD_H = 20;
+ }
WIN_H = FIELD_H + 1 + GG_GAP + MAX_LIST_H;
}
+const float LEO_ROW = 20, LEO_COL = 112; // Leopard: linhas de 20 e a coluna das categorias
const UINT WM_SP_FILES = WM_APP + 60, WM_SP_ICON = WM_APP + 61, WM_SP_APPS = WM_APP + 62, WM_SP_FRAME = WM_APP + 63, WM_SP_SUGG = WM_APP + 64;
const UINT_PTR T_SEARCH = 1, T_CARET = 2, T_ICONS = 3, T_REGRAB = 4;
@@ -854,7 +858,7 @@ std::vector<std::wstring> Chips() {
}
bool HasChips() { return (ModePanel() && g_mode != 3) || (liquid::Golden() && g_mode == 0 && !g_query.empty()); }
// macOS 27: com fichas, a lista começa 6 abaixo delas (fichas de 26 com o centro a 33 do alto do painel)
-float ListTop() { return liquid::Golden() && HasChips() ? FIELD_H + GG_GAP + 52 : FIELD_H + 1 + GG_GAP + (HasChips() ? CHIPS_H : 0); }
+float ListTop() { if (liquid::Leopard()) return FIELD_H + 1; return liquid::Golden() && HasChips() ? FIELD_H + GG_GAP + 52 : FIELD_H + 1 + GG_GAP + (HasChips() ? CHIPS_H : 0); }
bool ChipAllows(Kind k, const std::wstring& name) {
bool ggAll = liquid::Golden() && g_mode == 0; // macOS 27: as fichas também no Spotlight comum
if (!g_chip || (!ModePanel() && !ggAll)) return true;
@@ -1125,6 +1129,18 @@ void Rebuild() {
// posições de tudo no conteúdo (a partir do topo da lista); devolve a altura total
float Layout() {
+ if (liquid::Leopard()) { // Leopard: uma lista só; o cabeçalho de cada seção vai na coluna da esquerda da 1ª linha
+ float y = 4;
+ bool first = true;
+ for (auto& row : g_rows) {
+ if (row.type == R_HEAD) { if (!first) y += 5; row.r = D2D1::RectF(0, y, W, y); first = false; continue; }
+ if (row.type == R_APP || row.type == R_MODE) { row.r = D2D1::RectF(0, 0, 0, 0); continue; }
+ row.r = D2D1::RectF(0, y, W, y + LEO_ROW);
+ y += LEO_ROW;
+ first = false;
+ }
+ return y + 4;
+ }
const bool gg = liquid::Golden();
float y = gg ? (g_mode == 1 ? 17.5f : HasChips() ? 7.5f : 8.f) : 8, x = PAD; // (a lista já começa 6 abaixo das fichas)
bool inTiles = false;
@@ -1334,8 +1350,118 @@ float SpotR(float H) {
return FIELD_H / 2 + (26.f - FIELD_H / 2) * k; // cápsula recolhida (28) → 26 com resultados (guia, seção 28.2)
}
+// Mac OS X Leopard: o menu do Spotlight do 10.5 (desenho próprio). Branco, preso na barra de menus (cantos de baixo
+// redondos), "Spotlight" em negrito e o campo em pílula branca com o anel azul; a lista com a coluna cinza das
+// categorias à esquerda, linhas de 20 com ícone de 16 e a escolhida em degradê azul com o texto branco
+void PaintLeopard() {
+ float sc = Sc();
+ int wpx = (int)std::lround(W * sc), hpx = (int)std::lround(WIN_H * sc);
+ if (g_back && IsWindowVisible(g_back)) ShowWindow(g_back, SW_HIDE);
+ auto* dc = ui::GpuBegin(g_s, wpx, hpx, sc);
+ if (!dc) return;
+ Pal p = Colors();
+ ID2D1SolidColorBrush* br = nullptr;
+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);
+ if (!br) { ui::GpuEnd(g_s); return; }
+ float fade, scale;
+ Transition(fade, scale);
+ dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), fade), nullptr);
+ static IDWriteTextFormat* tfB = ui::FormatFace(L"Lucida Sans Unicode", 13, DWRITE_FONT_WEIGHT_BOLD);
+ static IDWriteTextFormat* tfN = ui::FormatFace(L"Lucida Sans Unicode", 12, DWRITE_FONT_WEIGHT_NORMAL);
+ static IDWriteTextFormat* tfH = [] { auto* f = ui::FormatFace(L"Lucida Sans Unicode", 11, DWRITE_FONT_WEIGHT_NORMAL); if (f) f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_TRAILING); return f; }();
+ float H = std::max(FIELD_H, g_h);
+ const float RR = 5;
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.18f)); // sombra curta
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(1, 2, W - 1, H + 2), RR, RR), br);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.97f));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0, 0, W, H), RR, RR), br);
+ dc->FillRectangle(D2D1::RectF(0, 0, W, RR), br); // em cima é reto (sai da barra de menus)
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0.5f, -RR, W - 0.5f, H - 0.5f), RR, RR), br, 1);
+ // cabeçalho: "Spotlight" e o campo
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.88f));
+ dc->DrawTextW(L"Spotlight", 9, tfB, D2D1::RectF(12, 0, 100, FIELD_H), br);
+ D2D1_RECT_F f = D2D1::RectF(96, (FIELD_H - 20) / 2, W - 10, (FIELD_H + 20) / 2);
+ float fr = (f.bottom - f.top) / 2;
+ br->SetColor(D2D1::ColorF(0.36f, 0.60f, 0.95f, 0.75f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(f.left - 1.5f, f.top - 1.5f, f.right + 1.5f, f.bottom + 1.5f), fr + 1.5f, fr + 1.5f), br, 3);
+ br->SetColor(D2D1::ColorF(1, 1, 1, 1));
+ dc->FillRoundedRectangle(D2D1::RoundedRect(f, fr, fr), br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.10f));
+ dc->FillRectangle(D2D1::RectF(f.left + fr * 0.6f, f.top + 1, f.right - fr * 0.6f, f.top + 3), br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f));
+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(f.left + 0.5f, f.top + 0.5f, f.right - 0.5f, f.bottom - 0.5f), fr - 0.5f, fr - 0.5f), br, 1);
+ br->SetColor(D2D1::ColorF(0.25f, 0.25f, 0.27f, 1)); // a lupa
+ float my = (f.top + f.bottom) / 2;
+ dc->DrawEllipse(D2D1::Ellipse({ f.left + 12, my - 1 }, 4, 4), br, 1.5f);
+ dc->DrawLine({ f.left + 15, my + 2 }, { f.left + 18, my + 5 }, br, 1.8f);
+ D2D1_RECT_F tr = D2D1::RectF(f.left + 24, f.top, f.right - 8, f.bottom);
+ float tw = ui::TextWidth(tfN, g_query);
+ if (g_selAll && !g_query.empty()) {
+ br->SetColor(D2D1::ColorF(0.36f, 0.60f, 0.95f, 0.35f));
+ dc->FillRectangle(D2D1::RectF(tr.left, f.top + 3, tr.left + tw, f.bottom - 3), br);
+ }
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.9f));
+ dc->DrawTextW(g_query.c_str(), (UINT32)g_query.size(), tfN, tr, br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ if (g_caretOn && !g_selAll) dc->FillRectangle(D2D1::RectF(tr.left + tw + 0.5f, f.top + 4, tr.left + tw + 1.5f, f.bottom - 4), br);
+ // a lista
+ if (H > FIELD_H + 2) {
+ float top = ListTop();
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.14f));
+ dc->FillRectangle(D2D1::RectF(0, top - 1, W, top), br);
+ dc->PushAxisAlignedClip(D2D1::RectF(0, top, W, H - 1), D2D1_ANTIALIAS_MODE_ALIASED);
+ br->SetColor(D2D1::ColorF(0.93f, 0.93f, 0.94f, 1)); // a coluna das categorias
+ dc->FillRectangle(D2D1::RectF(0, top, LEO_COL, H), br);
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.10f));
+ dc->FillRectangle(D2D1::RectF(LEO_COL, top, LEO_COL + 1, H), br);
+ std::wstring head;
+ bool firstOfSect = false, firstSect = true;
+ for (int i = 0; i < (int)g_rows.size(); i++) {
+ auto& row = g_rows[i];
+ if (row.type == R_HEAD) {
+ head = row.head; firstOfSect = true;
+ if (!firstSect) { // linha entre as seções
+ float ly = top + row.r.top - g_scroll - 2.5f;
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.10f));
+ dc->FillRectangle(D2D1::RectF(0, ly, W, ly + 1), br);
+ }
+ firstSect = false;
+ continue;
+ }
+ if (row.res < 0 || row.res >= (int)g_res.size() || row.r.bottom <= row.r.top) continue;
+ D2D1_RECT_F r = D2D1::RectF(row.r.left, top + row.r.top - g_scroll, row.r.right, top + row.r.bottom - g_scroll);
+ if (r.bottom < top || r.top > H) { firstOfSect = false; continue; }
+ bool sel = i == g_sel;
+ if (sel) {
+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(0.39f, 0.56f, 0.96f, 1) }, { 1, D2D1::ColorF(0.13f, 0.35f, 0.88f, 1) } };
+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;
+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&
+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))
+ dc->FillRectangle(D2D1::RectF(LEO_COL + 1, r.top, W, r.bottom), lb);
+ if (lb) lb->Release();
+ if (gs) gs->Release();
+ }
+ if (firstOfSect) {
+ std::wstring h = row.type == R_CARD ? std::wstring(Tr(L"Melhor Resultado")) : head;
+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.55f));
+ dc->DrawTextW(h.c_str(), (UINT32)h.size(), tfH, D2D1::RectF(4, r.top, LEO_COL - 8, r.bottom), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ firstOfSect = row.type == R_CARD; // o melhor resultado é sozinho: a seção de baixo também mostra o nome
+ }
+ const Result& res = g_res[row.res];
+ DrawIcon(dc, br, res, D2D1::RectF(LEO_COL + 8, r.top + 2, LEO_COL + 24, r.top + 18), p);
+ br->SetColor(sel ? D2D1::ColorF(1, 1, 1, 1) : D2D1::ColorF(0, 0, 0, 0.9f));
+ dc->DrawTextW(res.name.c_str(), (UINT32)res.name.size(), tfN, D2D1::RectF(LEO_COL + 30, r.top, W - 8, r.bottom), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);
+ }
+ dc->PopAxisAlignedClip();
+ }
+ dc->PopLayer();
+ br->Release();
+ ui::GpuEnd(g_s);
+}
+
void Paint() {
if (!g_visible) return;
+ if (liquid::Leopard()) { PaintLeopard(); return; }
double tp0 = anim::Now();
float sc = Sc();
int wpx = (int)std::lround(W * sc), hpx = (int)std::lround(WIN_H * sc);
@@ -1764,6 +1890,7 @@ void Place() {
RECT m = mi.rcMonitor;
// no Mac (Sequoia) o campo fica a ~22% da altura da tela; no Tahoe a 30 % (guia, seção 39); o painel cresce para baixo
int x = m.left + (m.right - m.left - wpx) / 2, y = m.top + (int)((m.bottom - m.top) * (liquid::On() ? 0.30f : 0.22f));
+ if (liquid::Leopard()) { x = m.right - wpx - 2; y = m.top + menubar::Height(); } // Leopard: desce da lupa, na ponta direita
SetWindowPos(g_wnd, HWND_TOPMOST, x, y, wpx, hpx, SWP_NOACTIVATE);
SetWindowPos(g_back, g_wnd, x, y, wpx, hpx, SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
diff --git a/src/shell/ui.cpp b/src/shell/ui.cpp
index 39f5bed..6b95652 100644
--- a/src/shell/ui.cpp
+++ b/src/shell/ui.cpp
@@ -589,6 +589,15 @@ IDWriteTextFormat* ui::Format(float size, DWRITE_FONT_WEIGHT w, bool icons, DWRI
return tf;
}
+IDWriteTextFormat* ui::FormatFace(const wchar_t* face, float size, DWRITE_FONT_WEIGHT w) {
+ IDWriteTextFormat* tf = nullptr;
+ if (FAILED(dw->CreateTextFormat(face, nullptr, w, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, size, L"pt-br", &tf)) || !tf)
+ return Format(size, w);
+ tf->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
+ tf->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);
+ return tf;
+}
+
float ui::TextWidth(IDWriteTextFormat* tf, const std::wstring& s) {
IDWriteTextLayout* tl = nullptr;
if (FAILED(dw->CreateTextLayout(s.c_str(), (UINT32)s.size(), tf, 10000, 100, &tl))) return 0;
@@ -671,6 +680,10 @@ bool ui::LoadPng(const std::wstring& path, UINT& w, UINT& h, std::vector<BYTE>&
// Pasta dos ícones do Sequoia (icones\sequoia, ao lado de bin\): uso pessoal, ver icones\LEIA-ME.txt.
std::wstring ui::PackIcon(const std::wstring& name) {
std::wstring root = shell::dir.substr(0, shell::dir.find_last_of(L'\\')) + L"\\icones";
+ if (liquid::Leopard()) { // Leopard: os ícones do 10.5 (icones\leopard, tools\icones-leopard.py) vencem até o extra
+ std::wstring g = root + L"\\leopard\\" + name + L".png"; // (lá estão as versões Aqua dos ícones do extra)
+ if (GetFileAttributesW(g.c_str()) != INVALID_FILE_ATTRIBUTES) return g;
+ }
std::wstring extra = root + L"\\extra\\" + name + L".png"; // escolhidos pelo usuário vencem
if (GetFileAttributesW(extra.c_str()) != INVALID_FILE_ATTRIBUTES) return extra;
if (liquid::Golden()) { // Golden Gate: os ícones do macOS 27 (icones\goldengate, tools\icones-goldengate.py)
diff --git a/tools/aqua_icone.py b/tools/aqua_icone.py
new file mode 100644
index 0000000..8867a5a
--- /dev/null
+++ b/tools/aqua_icone.py
@@ -0,0 +1,167 @@
+# "Aquifica" um ícone moderno (o quadrado arredondado chapado do macOS 11+) no estilo dos ícones do Mac OS X Leopard
+# (comparado com os ícones do 10.5 na Dock): o canto bem menos redondo dos ícones de 2007 (o "squircle" de hoje vira um
+# quadrado de canto 14 %, com os cantos preenchidos pela cor da borda do próprio desenho), o brilho de gel do Aqua
+# (reflexo branco forte na metade de cima, com a borda de baixo nítida), o volume (base mais escura), o contorno
+# escuro fino, o fio de luz no alto e a sombra projetada embaixo.
+# Saída no formato do pacote do Leopard do projeto: quadro 25 % maior que o desenho (10 % de margem de cada lado).
+# Usado por tools/icones-leopard.py para os apps que não existiam em 2007 (Chrome, Discord, WhatsApp...).
+from PIL import Image, ImageChops, ImageDraw, ImageFilter, ImageEnhance
+
+
+def recorta(im):
+ a = im.getchannel('A').point(lambda v: 255 if v > 24 else 0)
+ box = a.getbbox()
+ return im.crop(box) if box else im
+
+
+def mascara_quadrada(w, h, raio):
+ m = Image.new('L', (w * 4, h * 4), 0)
+ ImageDraw.Draw(m).rounded_rectangle((0, 0, w * 4 - 1, h * 4 - 1), radius=raio * 4, fill=255)
+ return m.resize((w, h), Image.LANCZOS)
+
+
+def tira_placa(im):
+ """Se o ícone é um desenho sobre uma placa clara e lisa, devolve só o desenho (a placa vira transparente; o
+ branco de dentro do desenho, que não encosta na placa, fica). Senão, None."""
+ w, h = im.size
+ px = im.load()
+ amostra = []
+ for i in range(60):
+ t = i / 60
+ for x, y in ((t * w, h * 0.07), (t * w, h * 0.93), (w * 0.07, t * h), (w * 0.93, t * h)):
+ x, y = min(w - 1, int(x)), min(h - 1, int(y))
+ if w * 0.18 < x < w * 0.82 or h * 0.18 < y < h * 0.82: amostra.append(px[x, y])
+ if not amostra: return None
+ lum = [0.3 * r + 0.59 * g + 0.11 * b for r, g, b, a in amostra]
+ med = sum(lum) / len(lum)
+ if med < 195 or max(lum) - min(lum) > 75: return None
+ # a placa pode ter degradê de cima para baixo: a cor de referência de cada linha vem das bordas dela
+ linhas = []
+ for y in range(h):
+ cs = [px[x, y] for x in (int(w * 0.07), int(w * 0.93), int(w * 0.10), int(w * 0.90)) if px[x, y][3] > 250]
+ linhas.append(tuple(sum(c[i] for c in cs) // len(cs) for i in range(3)) if cs else None)
+ ult = next((c for c in linhas if c), None)
+ for y in range(h):
+ if linhas[y]: ult = linhas[y]
+ else: linhas[y] = ult
+ dist = Image.new('L', (w, h), 0)
+ dp = dist.load()
+ for y in range(h):
+ cor = linhas[y]
+ for x in range(w):
+ r, g, b, a = px[x, y]
+ d = max(abs(r - cor[0]), abs(g - cor[1]), abs(b - cor[2]))
+ dp[x, y] = 0 if a < 250 else min(255, d) # o meio-transparente (sombra da placa) é fundo
+ # a faixa de 7 % junto da borda é sempre placa (o aro sombreado do "squircle" moderno)
+ m = int(min(w, h) * 0.07)
+ ImageDraw.Draw(dist).rectangle((0, 0, w - 1, h - 1), outline=0, width=m)
+ desenho = dist.point(lambda v: 255 if v > 30 else 0)
+ # sobras pequenas soltas (pedaços do aro, sombra embaixo) saem: só ficam as partes com 3 % do desenho ou mais
+ marca = desenho.copy()
+ mp = marca.load()
+ partes = []
+ for y in range(0, h, 2):
+ for x in range(0, w, 2):
+ if mp[x, y] == 255:
+ antes = marca.histogram()[255]
+ ImageDraw.floodfill(marca, (x, y), 128 - len(partes) % 100)
+ partes.append(((x, y), antes - marca.histogram()[255]))
+ total = sum(n for _, n in partes) or 1
+ for (x, y), n in partes:
+ if n < 0.03 * total: ImageDraw.floodfill(desenho, (x, y), 0)
+ # o fundo é o que é placa e encosta na borda (enchente a partir da borda)
+ fundo = desenho.point(lambda v: 0 if v else 100)
+ for x0, y0 in ((w // 2, 2), (w // 2, h - 3), (2, h // 2), (w - 3, h // 2), (w // 5, h // 5)):
+ if fundo.getpixel((x0, y0)) == 100: ImageDraw.floodfill(fundo, (x0, y0), 255)
+ placa = fundo.point(lambda v: 255 if v == 255 else 0)
+ if sum(placa.histogram()[255:]) < 0.25 * w * h: return None
+ # borda macia: perto do desenho a transparência acompanha a distância de cor
+ suave = dist.point(lambda v: min(255, max(0, (v - 6) * 12)))
+ perto = placa.filter(ImageFilter.MinFilter(5))
+ alpha = ImageChops.subtract(Image.new('L', (w, h), 255), perto)
+ borda = ImageChops.subtract(placa, perto)
+ alpha = ImageChops.lighter(ImageChops.subtract(alpha, borda), ImageChops.multiply(borda, suave))
+ alpha = ImageChops.multiply(alpha, im.getchannel('A'))
+ out = im.copy(); out.putalpha(alpha)
+ if not alpha.point(lambda v: 255 if v > 24 else 0).getbbox(): return None
+ return out
+
+
+def aquifica(src, dst, lado=320):
+ im = recorta(Image.open(src).convert('RGBA'))
+ s = int(lado * 0.8)
+ k = s / max(im.size)
+ im = im.resize((max(1, round(im.width * k)), max(1, round(im.height * k))), Image.LANCZOS)
+ im = ImageEnhance.Color(im).enhance(1.15) # as cores do Aqua eram mais saturadas
+ w, h = im.size
+ orig_a = im.getchannel('A')
+ cheio = orig_a.point(lambda v: 255 if v > 200 else 0)
+ # só vale trocar o contorno de quem é um quadrado arredondado cheio (a maior parte do quadro é opaca)
+ quadrado = sum(cheio.histogram()[255:]) > 0.80 * w * h
+ solto = quadrado and tira_placa(im)
+ if solto:
+ # placa clara (Chrome, Claude, Edge...): em 2007 o ícone era o desenho solto, sem a placa
+ im = recorta(solto)
+ k = s / max(im.size)
+ im = im.resize((max(1, round(im.width * k)), max(1, round(im.height * k))), Image.LANCZOS)
+ w, h = im.size
+ alpha = im.getchannel('A')
+ elif quadrado:
+ # cantos: o próprio ícone ampliado e desfocado por baixo preenche o que o "squircle" deixava vazio
+ fundo = im.resize((round(w * 1.18), round(h * 1.18)), Image.LANCZOS).filter(ImageFilter.GaussianBlur(w * 0.03))
+ base = Image.new('RGBA', (w, h), (0, 0, 0, 0))
+ base.alpha_composite(fundo, (-(fundo.width - w) // 2, -(fundo.height - h) // 2))
+ base.alpha_composite(im)
+ alpha = mascara_quadrada(w, h, round(w * 0.14))
+ base.putalpha(alpha)
+ im = base
+ else:
+ alpha = orig_a
+ # volume: a base escurece (o Aqua desenhava os ícones com luz de cima)
+ sombra = Image.new('L', (1, h), 0)
+ for y in range(h):
+ t = y / h
+ sombra.putpixel((0, y), int(255 * 0.28 * max(0.0, (t - 0.55) / 0.45)) if t > 0.55 else 0)
+ sombra = ImageChops.multiply(sombra.resize((w, h)), alpha)
+ preto = Image.new('RGBA', (w, h), (0, 0, 0, 0)); preto.putalpha(sombra)
+ out = Image.alpha_composite(im, preto)
+ # o gel: reflexo branco forte em cima que termina numa curva nítida pouco acima do meio
+ gel = Image.new('L', (w, h), 0)
+ d = ImageDraw.Draw(gel)
+ d.ellipse((-w * 0.30, -h * 0.80, w * 1.30, h * 0.50), fill=255)
+ grad = Image.new('L', (1, h), 0)
+ for y in range(h):
+ t = y / h
+ grad.putpixel((0, y), int(255 * (0.62 - 0.50 * min(1.0, t / 0.50))) if t < 0.5 else 0)
+ gel = ImageChops.multiply(gel.filter(ImageFilter.GaussianBlur(w * 0.004)), grad.resize((w, h)))
+ gel = ImageChops.multiply(gel, alpha.filter(ImageFilter.MinFilter(5)))
+ branco = Image.new('RGBA', (w, h), (255, 255, 255, 0)); branco.putalpha(gel)
+ out = Image.alpha_composite(out, branco)
+ # contorno escuro fino e o fio de luz no alto da borda
+ er = alpha.filter(ImageFilter.MinFilter(3))
+ aro = ImageChops.subtract(alpha, er)
+ escuro = Image.new('RGBA', (w, h), (0, 0, 0, 0)); escuro.putalpha(aro.point(lambda v: int(v * 0.45)))
+ out = Image.alpha_composite(out, escuro)
+ er2 = alpha.filter(ImageFilter.MinFilter(7))
+ luz = ImageChops.subtract(er, er2)
+ topo = Image.new('L', (1, h), 0)
+ for y in range(h):
+ topo.putpixel((0, y), int(255 * 0.65 * max(0.0, 1 - y / (h * 0.35))))
+ luz = ImageChops.multiply(luz, topo.resize((w, h)))
+ lb = Image.new('RGBA', (w, h), (255, 255, 255, 0)); lb.putalpha(luz)
+ out = Image.alpha_composite(out, lb)
+ # quadro com a margem do pacote e a sombra projetada (mais forte embaixo)
+ q = Image.new('RGBA', (lado, lado), (0, 0, 0, 0))
+ x0, y0 = (lado - w) // 2, (lado - h) // 2 - int(lado * 0.01)
+ sh = Image.new('RGBA', (lado, lado), (0, 0, 0, 0))
+ sa = Image.new('L', (lado, lado), 0)
+ sa.paste(alpha.point(lambda v: int(v * 0.55)), (x0, y0 + int(lado * 0.025)))
+ sh.putalpha(sa.filter(ImageFilter.GaussianBlur(lado * 0.022)))
+ q = Image.alpha_composite(q, sh)
+ q.alpha_composite(out, (x0, y0))
+ q.save(dst)
+
+
+if __name__ == '__main__':
+ import sys
+ aquifica(sys.argv[1], sys.argv[2])
diff --git a/tools/cursor-leopard.py b/tools/cursor-leopard.py
new file mode 100644
index 0000000..fda51ef
--- /dev/null
+++ b/tools/cursor-leopard.py
@@ -0,0 +1,21 @@
+# Cursor do tema Mac OS X Leopard (cursor\Leopard) a partir do pacote "Mac OS X Cursors" (RaZcaLinSIDe), que o
+# usuário baixou em Downloads\mac_os_x_cursor_pack_by_razcalinside_dgcsg6. Uso pessoal: fora do git (.gitignore).
+# Só os 15 arquivos que o Shell aplica (ponteiro.cpp, ponteiro::TemaLeopard): a seta, a mãozinha, o I-beam etc. e o
+# cata-vento colorido de espera do Leopard ("RainbowSwirl"). O .inf do pacote copiaria para C:\Windows\Cursors (pasta
+# do sistema); aqui nada vai para o Windows: o Shell grava o esquema só em HKCU e devolve o anterior.
+# python tools\cursor-leopard.py [pasta do pacote] [destino]
+import os, shutil, sys
+
+SRC = sys.argv[1] if len(sys.argv) > 1 else os.path.expandvars(r'%USERPROFILE%\Downloads\mac_os_x_cursor_pack_by_razcalinside_dgcsg6')
+DST = sys.argv[2] if len(sys.argv) > 2 else os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'cursor', 'Leopard')
+ARQUIVOS = ['Normal Select.cur', 'Help Select.cur', 'RainbowSwirl-Background.ani', 'RainbowSwirl-Busy.ani',
+ 'Precision Select.cur', 'Text Select.cur', 'Handwriting.cur', 'Unavailable.cur', 'Vertical Resize.cur',
+ 'Horizontal Resize.cur', 'Diagonal Resize 1.cur', 'Diagonal Resize 2.cur', 'Move.cur', 'Alternate Select.cur',
+ 'Link Select.cur']
+os.makedirs(DST, exist_ok=True)
+falta = [a for a in ARQUIVOS if not os.path.isfile(os.path.join(SRC, a))]
+for a in ARQUIVOS:
+ if a not in falta: shutil.copyfile(os.path.join(SRC, a), os.path.join(DST, a))
+for f in ('Readme.txt',):
+ if os.path.isfile(os.path.join(SRC, f)): shutil.copyfile(os.path.join(SRC, f), os.path.join(DST, f))
+print(f'{len(ARQUIVOS) - len(falta)} cursores em {os.path.abspath(DST)}' + (f' (faltando: {falta})' if falta else ''))
diff --git a/tools/empacotar.ps1 b/tools/empacotar.ps1
index 3c07f7c..d9c5959 100644
--- a/tools/empacotar.ps1
+++ b/tools/empacotar.ps1
@@ -20,7 +20,7 @@ New-Item -ItemType Directory -Force "$pkg\bin" | Out-Null
# programas: só o que o Shell usa (bin\ferramentas, bin\obj, logs e cópias .run/.old ficam de fora)
$progs = 'WacOSShell.exe', 'WacOSFinder.exe', 'WacOSSettings.exe', 'WacOSActivityMonitor.exe', 'WacOSTerminal.exe',
'WacOSCalculator.exe', 'WacOSNotes.exe', 'WacOSScreenshot.exe', 'WacOSPreview.exe', 'WacOSReminders.exe', 'WacOSCalendar.exe', 'WacOSTextEdit.exe', 'WacOSClock.exe', 'WacOSWeather.exe', 'WacOSContacts.exe', 'WacOSPhotos.exe', 'WacOSTimeMachine.exe', 'WacOSMusic.exe', 'WacOSQuickTime.exe', 'WacOSForceQuit.exe', 'WacOSWindow.dll', 'WacOSWindow32.dll',
- 'WacOSWindow32Host.exe', 'DialogoMac.dll', 'DialogoMac32.dll'
+ 'DialogoMac.dll', 'DialogoMac32.dll'
if ($SemSistema) { $progs = $progs | Where-Object { $_ -notlike 'DialogoMac*' } }
$progs += 'versao.txt' # a versão (o GitHub Actions grava; o atualizador compara)
foreach ($p in $progs) {
@@ -39,9 +39,9 @@ if (-not $SemSistema) {
Copy-Item "$PSScriptRoot\dialogo-ligar.ps1" "$pkg\tools\dialogo-ligar.ps1"
}
-# ícones e sons (a pasta inteira de cada)
+# ícones e sons (a pasta inteira de cada). O tema Leopard ainda não saiu: icones\leopard fica de fora
foreach ($pasta in 'icones', 'sons') {
- if (Test-Path "$root\$pasta") { robocopy "$root\$pasta" "$pkg\$pasta" /E /NFL /NDL /NJH /NJS /NP | Out-Null }
+ if (Test-Path "$root\$pasta") { robocopy "$root\$pasta" "$pkg\$pasta" /E /XD leopard /NFL /NDL /NJH /NJS /NP | Out-Null }
}
# fontes SF instaladas neste PC (por usuário e do sistema)
@@ -62,6 +62,13 @@ foreach ($d in (Join-Path $env:LOCALAPPDATA 'Microsoft\Windows\Fonts'), (Join-Pa
# cursor em uso (se for um esquema de arquivos próprio): a pasta dele e o mapa papel=arquivo
$creg = Get-ItemProperty 'HKCU:\Control Panel\Cursors'
+# com o tema Leopard ligado neste PC o cursor em uso é o do Leopard (ainda não saiu): vai o que o Shell guardou
+# antes de trocar (%APPDATA%\Shell\cursor-antes.txt, papel=caminho), o cursor do Tahoe
+$antes = Join-Path $env:APPDATA 'Shell\cursor-antes.txt'
+if ((Split-Path (Split-Path $creg.Arrow) -Leaf) -eq 'Leopard' -and (Test-Path $antes)) {
+ $creg = [pscustomobject]@{}
+ foreach ($l in Get-Content $antes -Encoding utf8) { if ($l -match '^([^=]+)=(.*)$') { $creg | Add-Member -NotePropertyName $Matches[1] -NotePropertyValue $Matches[2] -Force } }
+}
$arrow = $creg.Arrow
if (-not $Atualizacao -and $arrow -and (Test-Path $arrow)) {
$cdir = Split-Path $arrow
diff --git a/tools/icones-leopard.py b/tools/icones-leopard.py
new file mode 100644
index 0000000..d62d3a5
--- /dev/null
+++ b/tools/icones-leopard.py
@@ -0,0 +1,169 @@
+# Ícones do tema Mac OS X Leopard (icones\leopard) a partir do pacote "Leopard Icons" (650 ícones no padrão do
+# Linux/GNOME, 128 px; itransform.freehostia.com), que o usuário baixou em Downloads\leopard-huge-iconpack-650.
+# Uso pessoal: a pasta icones\leopard fica fora do git (.gitignore), como as dos outros pacotes.
+# O pacote usa nomes do freedesktop (nautilus.png, user-trash.png...); aqui cada um ganha o nome que o WacOS
+# procura (o nome do app do Mac, como em icones\goldengate, ou o .exe do programa do Windows). O que faltar segue
+# o pacote do Sequoia (apps.cpp / ui.cpp).
+# python tools\icones-leopard.py [pasta do pacote] [destino]
+import os, sys
+from PIL import Image # pip install pillow
+
+SRC = sys.argv[1] if len(sys.argv) > 1 else os.path.expandvars(r'%USERPROFILE%\Downloads\leopard-huge-iconpack-650\Leopard Icons')
+DST = sys.argv[2] if len(sys.argv) > 2 else os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'icones', 'leopard')
+
+MAPA = {
+ # apps do sistema (nomes do Mac, os mesmos de icones\goldengate)
+ 'Finder': 'apps/nautilus.png',
+ 'Safari': 'apps/web-browser.png',
+ 'Settings': 'apps/gnome-control-center.png', # Preferências do Sistema do 10.5
+ 'System Preferences': 'apps/gnome-control-center.png',
+ 'Activity Monitor': 'apps/utilities-system-monitor.png',
+ 'Terminal': 'apps/gnome-terminal.png',
+ 'Calculator': 'apps/calc.png',
+ 'Notes': 'apps/tomboy.png', # o Leopard tinha o Stickies (Notas só no 10.8)
+ 'Stickies': 'apps/tomboy.png',
+ 'TextEdit': 'apps/text-editor.png',
+ 'Clock': 'apps/clock.png',
+ 'Preview': 'apps/eog.png',
+ 'Contacts': 'apps/addressbook.png',
+ 'Address Book': 'apps/addressbook.png',
+ 'Time Machine': 'apps/timemachine.png',
+ 'Front Row': 'apps/frontrow.png',
+ 'Dictionary': 'apps/gnome-dictionary.png',
+ 'Spotlight': 'apps/system-search.png',
+ 'Launchpad': 'Folder/folder2.png', # o Leopard não tinha Launchpad: a pasta Aplicativos
+ 'Force Quit': 'apps/gnome-panel-force-quit.png',
+ 'Screenshot': 'apps/applets-screenshooter.png', # o Grab
+ 'QuickTime Player': 'More/QuickTimePlayer.png',
+ 'Photos': 'apps/f-spot.png', # o iPhoto
+ 'Music': 'More/iTunes.png',
+ 'iTunes': 'More/iTunes.png',
+ 'Calendar': 'More/iCal.png',
+ 'iCal': 'More/iCal.png',
+ 'Mail': 'apps/evolution.png',
+ 'Messages': 'apps/gaim.png', # o iChat
+ 'Automator': 'More/Automator.png',
+ 'GarageBand': 'More/Garage Band.png',
+ 'Keynote': 'More/Keynote.png',
+ 'Tips': 'apps/gnome-help.png',
+ 'Help Viewer': 'apps/gnome-help.png',
+ 'System Information': 'places/gnome-fs-client.png',
+ 'Boot Camp Assistant': 'apps/bootcamp.png',
+ 'Dashcode': 'apps/dashcode.png',
+ 'Mission Control': 'apps/multidesktop.png', # no 10.5, o Spaces (os quatro quadros)
+ 'Spaces': 'apps/multidesktop.png',
+ 'Reminders': 'apps/evolution-tasks.png', # o 10.5 não tinha Lembretes: a prancheta de tarefas
+ 'Keychain Access': 'apps/stock_keyring.png',
+ 'Console': 'apps/logviewer.png',
+ 'Disk Utility': 'More/hdd.png',
+ 'Script Editor': 'More/AppleScript.png',
+ 'DVD Player': 'apps/DvD AppIcon.png',
+ 'Print Center': 'apps/printer.png',
+ 'Software Update': 'apps/software-properties.png',
+ 'Users & Groups': 'apps/system-users.png',
+ 'Wallpaper': 'apps/preferences-desktop-wallpaper.png',
+ 'Screen Saver': 'apps/screensaver.png',
+ 'World Clock': 'apps/gworldclock.png',
+ 'Sherlock': 'More/Sherlock.png',
+ 'X11': 'More/X11.png',
+ # programas do Windows pelo .exe (apps.cpp compara o nome e o .exe, normalizados)
+ 'firefox': 'apps/firefox.png', 'vlc': 'apps/vlc.png', 'skype': 'apps/skype.png', 'opera': 'apps/opera.png',
+ 'blender': 'apps/blender.png', 'audacity': 'apps/audacity.png', 'python': 'apps/python.png', 'java': 'apps/java.png',
+ 'inkscape': 'apps/inkscape.png', 'eclipse': 'apps/eclipse.png', 'virtualbox': 'apps/virtualbox.png',
+ 'vmware': 'apps/vmware.png', '7zip': 'apps/7zip.png', 'photoshop': 'More/Photoshop CS2.png',
+ 'illustrator': 'More/Illustrator CS2.png', 'acrobat': 'More/Adobe Acrobat.png', 'googleearth': 'More/Google Earth.png',
+ 'wmplayer': 'More/WMP.png', 'mspaint': 'apps/gnome-graphics.png',
+ # painéis das Preferências do Sistema do 10.5 (Ajustes no tema Leopard: "pref <id da página>")
+ 'pref aparencia': 'apps/gnome-settings-theme.png', 'pref fundo': 'apps/preferences-desktop-wallpaper.png',
+ 'pref protetor': 'apps/screensaver.png', 'pref dock': 'apps/avant-window-navigator.png',
+ 'pref central': 'apps/multidesktop.png', 'pref spotlight': 'apps/system-search.png', 'pref geral': 'apps/gnome-settings.png',
+ 'pref telas': 'apps/display-capplet.png', 'pref som': 'apps/preferences-desktop-sound.png',
+ 'pref energia': 'apps/gnome-power-manager.png', 'pref teclado': 'devices/input-keyboard.png', 'pref mouse': 'devices/input-mouse.png',
+ 'pref trackpad': 'devices/gvm-dev-tablet.png', 'pref impressoras': 'apps/printer.png', 'pref bluetooth': 'apps/bluetooth.png',
+ 'pref rede': 'places/gnome-fs-network.png', 'pref wifi': 'devices/network-wireless.png', 'pref contas': 'apps/evolution.png',
+ 'pref nuvem': 'apps/gnome-globe.png', 'pref jogos': 'devices/input-gaming.png', 'pref usuarios': 'apps/system-users.png',
+ 'pref privacidade': 'apps/system-config-securitylevel.png', 'pref senha': 'apps/stock_keyring.png',
+ 'pref bloqueio': 'apps/gnome-lockscreen.png', 'pref acessibilidade': 'apps/preferences-desktop-accessibility.png',
+ 'pref inteligencia': 'apps/orca.png', 'pref notificacoes': 'More/Alert Note.png', 'pref foco': 'apps/gnome-session-hibernate.png',
+ 'pref tempo': 'apps/users.png', 'pref data': 'apps/config-date.png', 'pref atualizacao': 'apps/software-properties.png',
+ # Finder: ícones da barra lateral do 10.5 ("side <item>") e dos documentos por tipo ("doc <tipo>")
+ 'side recentes': 'places/document-open-recent.png', 'side aplicativos': 'Folder/folder2.png',
+ 'side mesa': 'places/desktop.png', 'side documentos': 'places/gnome-fs-regular.png',
+ 'side videos': 'mimetypes/video-x-generic.png', 'side musica': 'mimetypes/audio-x-generic.png',
+ 'side imagens': 'apps/Pictures.png', 'side downloads': 'apps/gwget.png', 'side casa': 'places/user-home.png',
+ 'side computador': 'places/gnome-fs-client.png', 'side disco': 'places/gnome-dev-harddisk.png',
+ 'side removivel': 'devices/drive-removable-media.png', 'side rede': 'places/gnome-fs-network.png',
+ 'side pasta': 'Folder/gnome-fs-directory.png', 'side inteligente': 'Folder/folder17.png',
+ 'doc texto': 'mimetypes/text-x-generic.png', 'doc pdf': 'mimetypes/application-pdf.png',
+ 'doc word': 'mimetypes/application-msword.png', 'doc rich': 'mimetypes/text-richtext.png',
+ 'doc planilha': 'mimetypes/application-vnd.ms-excel.png',
+ 'doc apresentacao': 'mimetypes/application-vnd.oasis.opendocument.presentation.png',
+ 'doc zip': 'mimetypes/application-zip.png', 'doc audio': 'mimetypes/audio-x-generic.png',
+ 'doc exe': 'mimetypes/application-x-executable.png', 'doc html': 'mimetypes/text-html.png',
+ 'doc script': 'mimetypes/text-x-script.png', 'doc python': 'mimetypes/text-x-python.png',
+ 'doc c': 'mimetypes/text-x-c.png', 'doc cpp': 'mimetypes/text-x-c++.png', 'doc java': 'mimetypes/text-x-java.png',
+ 'doc disco': 'mimetypes/application-x-cd-image.png', 'doc fonte': 'mimetypes/font-x-generic.png',
+ 'doc log': 'mimetypes/text-x-log.png', 'doc xml': 'mimetypes/application-xml.png',
+ 'doc generico': 'places/gnome-fs-regular.png',
+ # pastas e Lixeira (nomes do pacote do Sequoia que o Dock pede)
+ 'folder downloads': 'Folder/folder7.png',
+ 'folder default': 'Folder/gnome-fs-directory.png',
+ 'folder applications': 'Folder/folder2.png',
+ 'folder documents': 'Folder/folder5.png',
+ 'folder docs': 'Folder/folder5.png', # nomes que o Finder pede (os mesmos do Tahoe)
+ 'folder videos': 'Folder/folder10.png',
+ 'folder desktop': 'Folder/gnome-fs-directory.png',
+ 'folder cloud': 'Folder/gnome-fs-directory.png',
+ 'folder music': 'Folder/folder11.png',
+ 'folder movies': 'Folder/folder10.png',
+ 'folder pictures': 'Folder/folder12.png',
+ 'folder public': 'Folder/folder8.png',
+ 'folder sites': 'Folder/folder6.png',
+ 'folder library': 'Folder/folder9.png',
+ 'folder utilities': 'Folder/folder4.png',
+ 'folder home': 'places/user-home.png',
+ 'Alert Note': 'More/Alert Note.png', # o ícone dos alertas do 10.5 (alertas.cpp)
+ 'trashempty@2x': 'places/user-trash.png',
+ 'trashfull@2x': 'places/user-trash-full.png',
+}
+
+os.makedirs(DST, exist_ok=True)
+ok = falta = 0
+for nome, rel in MAPA.items():
+ src = os.path.join(SRC, *rel.split('/'))
+ if not os.path.isfile(src):
+ print('falta no pacote:', rel); falta += 1; continue
+ # os PNGs do pacote do Sequoia trazem a margem do Mac (o desenho ocupa ~80 % do quadro) e o Dock os desenha
+ # assim; os do Leopard vêm sem margem: centraliza num quadro 25 % maior para ficarem do mesmo tamanho
+ im = Image.open(src).convert('RGBA')
+ # antes, corta a margem transparente que cada PNG do pacote traz (diferente em cada um): sem isso o Finder e as
+ # Preferências saíam menores que os outros ícones na Dock
+ caixa = im.getchannel('A').point(lambda v: 255 if v > 24 else 0).getbbox()
+ if caixa: im = im.crop(caixa)
+ lado = round(max(im.size) * 1.25)
+ q = Image.new('RGBA', (lado, lado), (0, 0, 0, 0))
+ q.paste(im, ((lado - im.width) // 2, (lado - im.height) // 2))
+ q.save(os.path.join(DST, nome + '.png')); ok += 1
+# Os apps que não existiam em 2007 (ou que o pacote não tem): o ícone moderno do projeto (icones\extra, depois
+# icones\sequoia) "aquificado" (tools/aqua_icone.py: brilho de gel, fio de luz e a sombra projetada do Leopard).
+# Pastas e Lixeira ficam só as do 10.5 (MAPA).
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
+from aqua_icone import aquifica
+def norm(n): return ''.join(c for c in n.lower() if c.isalnum())
+feitos = {norm(n) for n in MAPA}
+raiz = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'icones')
+aq = 0
+for sub in ('extra', 'sequoia'):
+ pasta = os.path.join(raiz, sub)
+ if not os.path.isdir(pasta): continue
+ for arq in sorted(os.listdir(pasta)):
+ nome, ext = os.path.splitext(arq)
+ if ext.lower() != '.png' or nome.lower().startswith(('folder', 'trash')) or norm(nome) in feitos: continue
+ feitos.add(norm(nome))
+ try: aquifica(os.path.join(pasta, arq), os.path.join(DST, arq)); aq += 1
+ except Exception as e: print('não deu para aquificar', arq, e)
+print(f'{aq} ícones modernos no estilo Aqua')
+with open(os.path.join(DST, 'CREDITOS.txt'), 'w', encoding='utf-8') as f:
+ f.write('Pacote "Leopard Icons" (650 ícones, itransform.freehostia.com), baixado pelo usuário. Uso pessoal; não distribuir.\n'
+ 'Gerado por tools\\icones-leopard.py.\n')
+print(f'{ok} ícones em {os.path.abspath(DST)} ({falta} faltando)')
diff --git a/tools/recursos.ps1 b/tools/recursos.ps1
index c05df1e..4444865 100644
--- a/tools/recursos.ps1
+++ b/tools/recursos.ps1
@@ -1,104 +1,105 @@
-# Gera os recursos de cada programa: ícone (.ico feito do PNG do pacote em icones\sequoia) e VERSIONINFO
-# com o nome em inglês que o Gerenciador de Tarefas mostra. Chamado pelo build.cmd; saída em bin\obj\res.
-# Sem o pacote de ícones (pasta icones\sequoia), gera só a versão (o .exe fica com o ícone padrão).
-param([string]$Out = (Join-Path $PSScriptRoot '..\bin\obj\res'))
-$ErrorActionPreference = 'Stop'
-Add-Type -AssemblyName System.Drawing
-$pack = Join-Path $PSScriptRoot '..\icones\sequoia'
-New-Item -ItemType Directory -Force $Out | Out-Null
-
-# nome do arquivo | descrição (Gerenciador de Tarefas) | PNG do pacote
-$itens = @(
- 'WacOSShell|WacOS (Menu Bar, Dock and Spotlight)|Launchpad.png',
- 'WacOSFinder|Finder|Finder.png',
- 'WacOSSettings|System Settings|Settings.png',
- 'WacOSActivityMonitor|Activity Monitor|Activity Monitor.png',
- 'WacOSTerminal|Terminal|Terminal.png',
- 'WacOSCalculator|Calculator|Calculator.png',
- 'WacOSNotes|Notes|Notes.png',
- 'WacOSScreenshot|Screenshot|Screenshot.png',
- 'WacOSPreview|Preview|Preview.png',
- 'WacOSReminders|Reminders|Reminders.png',
- 'WacOSCalendar|Calendar|Calendar.png',
- 'WacOSTextEdit|TextEdit|Textedit.png',
- 'WacOSClock|Clock|Clock.png',
- 'WacOSWeather|Weather|Weather.png',
- 'WacOSMusic|Music|Music.png',
- 'WacOSQuickTime|QuickTime Player|QuickTime Player.png',
- 'WacOSForceQuit|Force Quit Applications|Activity Monitor.png',
- 'WacOSContacts|Contacts|Contacts.png',
- 'WacOSPhotos|Photos|Photos.png',
- 'WacOSTimeMachine|Time Machine|Time Machine.png',
- 'WacOSWindow32Host|WacOS Window Host (32-bit)|Mission Control.png',
- 'WacOSWindow|WacOS Window Frames|',
- 'WacOSWindow32|WacOS Window Frames (32-bit)|'
-)
-
-# .ico com várias resoluções, cada uma guardada como PNG (aceito desde o Vista)
-function Make-Ico([string]$png, [string]$ico) {
- $src = [Drawing.Image]::FromFile($png)
- $frames = @()
- try {
- foreach ($s in 16, 20, 24, 32, 40, 48, 64, 128, 256) {
- $bmp = New-Object Drawing.Bitmap $s, $s, ([Drawing.Imaging.PixelFormat]::Format32bppArgb)
- $g = [Drawing.Graphics]::FromImage($bmp)
- $g.InterpolationMode = 'HighQualityBicubic'; $g.SmoothingMode = 'HighQuality'; $g.PixelOffsetMode = 'HighQuality'; $g.CompositingQuality = 'HighQuality'
- $g.DrawImage($src, 0, 0, $s, $s); $g.Dispose()
- $ms = New-Object IO.MemoryStream; $bmp.Save($ms, [Drawing.Imaging.ImageFormat]::Png); $bmp.Dispose()
- $frames += , @($s, $ms.ToArray())
- }
- } finally { $src.Dispose() }
- $fs = [IO.File]::Create($ico); $w = New-Object IO.BinaryWriter $fs
- $w.Write([UInt16]0); $w.Write([UInt16]1); $w.Write([UInt16]$frames.Count)
- $off = 6 + 16 * $frames.Count
- foreach ($f in $frames) {
- $s = $f[0]; $d = $f[1]
- $w.Write([byte]($s % 256)); $w.Write([byte]($s % 256)); $w.Write([byte]0); $w.Write([byte]0)
- $w.Write([UInt16]1); $w.Write([UInt16]32); $w.Write([UInt32]$d.Length); $w.Write([UInt32]$off)
- $off += $d.Length
- }
- foreach ($f in $frames) { $w.Write([byte[]]$f[1]) }
- $w.Close()
-}
-
-foreach ($linha in $itens) {
- $nome, $desc, $png = $linha.Split('|')
- $ext = if ($nome -like 'WacOSWindow' -or $nome -like 'WacOSWindow32') { 'dll' } else { 'exe' }
- $iconLine = ''
- $pngPath = if ($png) { Join-Path $pack $png } else { '' }
- if ($pngPath -and (Test-Path $pngPath)) {
- $ico = Join-Path $Out "$nome.ico"
- if (!(Test-Path $ico) -or (Get-Item $ico).LastWriteTime -lt (Get-Item $pngPath).LastWriteTime) { Make-Ico $pngPath $ico }
- $iconLine = "1 ICON `"$nome.ico`""
- }
- $rc = @"
-#include <winver.h>
-$iconLine
-VS_VERSION_INFO VERSIONINFO
-FILEVERSION 1,0,0,0
-PRODUCTVERSION 1,0,0,0
-FILEOS VOS_NT_WINDOWS32
-FILETYPE $(if ($ext -eq 'dll') { 'VFT_DLL' } else { 'VFT_APP' })
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904B0"
- BEGIN
- VALUE "CompanyName", "shell-proprio"
- VALUE "FileDescription", "$desc"
- VALUE "FileVersion", "1.0.0.0"
- VALUE "InternalName", "$nome"
- VALUE "OriginalFilename", "$nome.$ext"
- VALUE "ProductName", "Sequoia"
- VALUE "ProductVersion", "1.0.0.0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-"@
- [IO.File]::WriteAllText((Join-Path $Out "$nome.rc"), $rc, [Text.Encoding]::ASCII)
-}
-Write-Host "recursos gerados em $Out"
+# Gera os recursos de cada programa: ícone (.ico feito do PNG do pacote em icones\sequoia) e VERSIONINFO
+# com o nome em inglês que o Gerenciador de Tarefas mostra. Chamado pelo build.cmd; saída em bin\obj\res.
+# Sem o pacote de ícones (pasta icones\sequoia), gera só a versão (o .exe fica com o ícone padrão).
+param([string]$Out = (Join-Path $PSScriptRoot '..\bin\obj\res'))
+$ErrorActionPreference = 'Stop'
+Add-Type -AssemblyName System.Drawing
+$pack = Join-Path $PSScriptRoot '..\icones\sequoia'
+New-Item -ItemType Directory -Force $Out | Out-Null
+
+# nome do arquivo | descrição (Gerenciador de Tarefas) | PNG do pacote
+$itens = @(
+ 'WacOSShell|WacOS (Menu Bar, Dock and Spotlight)|Launchpad.png',
+ 'WacOSFinder|Finder|Finder.png',
+ 'WacOSSettings|System Settings|Settings.png',
+ 'WacOSActivityMonitor|Activity Monitor|Activity Monitor.png',
+ 'WacOSTerminal|Terminal|Terminal.png',
+ 'WacOSCalculator|Calculator|Calculator.png',
+ 'WacOSNotes|Notes|Notes.png',
+ 'WacOSScreenshot|Screenshot|Screenshot.png',
+ 'WacOSPreview|Preview|Preview.png',
+ 'WacOSReminders|Reminders|Reminders.png',
+ 'WacOSCalendar|Calendar|Calendar.png',
+ 'WacOSTextEdit|TextEdit|Textedit.png',
+ 'WacOSClock|Clock|Clock.png',
+ 'WacOSWeather|Weather|Weather.png',
+ 'WacOSMusic|Music|Music.png',
+ 'WacOSQuickTime|QuickTime Player|QuickTime Player.png',
+ 'WacOSForceQuit|Force Quit Applications|Activity Monitor.png',
+ 'WacOSContacts|Contacts|Contacts.png',
+ 'WacOSPhotos|Photos|Photos.png',
+ 'WacOSTimeMachine|Time Machine|Time Machine.png',
+ 'WacOSWindow|WacOS Window Frames|',
+ 'WacOSWindow32|WacOS Window Frames (32-bit)|'
+)
+
+# .ico com várias resoluções, cada uma guardada como PNG (aceito desde o Vista)
+function Make-Ico([string]$png, [string]$ico) {
+ $src = [Drawing.Image]::FromFile($png)
+ $frames = @()
+ try {
+ foreach ($s in 16, 20, 24, 32, 40, 48, 64, 128, 256) {
+ $bmp = New-Object Drawing.Bitmap $s, $s, ([Drawing.Imaging.PixelFormat]::Format32bppArgb)
+ $g = [Drawing.Graphics]::FromImage($bmp)
+ $g.InterpolationMode = 'HighQualityBicubic'; $g.SmoothingMode = 'HighQuality'; $g.PixelOffsetMode = 'HighQuality'; $g.CompositingQuality = 'HighQuality'
+ $g.DrawImage($src, 0, 0, $s, $s); $g.Dispose()
+ $ms = New-Object IO.MemoryStream; $bmp.Save($ms, [Drawing.Imaging.ImageFormat]::Png); $bmp.Dispose()
+ $frames += , @($s, $ms.ToArray())
+ }
+ } finally { $src.Dispose() }
+ $fs = [IO.File]::Create($ico); $w = New-Object IO.BinaryWriter $fs
+ $w.Write([UInt16]0); $w.Write([UInt16]1); $w.Write([UInt16]$frames.Count)
+ $off = 6 + 16 * $frames.Count
+ foreach ($f in $frames) {
+ $s = $f[0]; $d = $f[1]
+ $w.Write([byte]($s % 256)); $w.Write([byte]($s % 256)); $w.Write([byte]0); $w.Write([byte]0)
+ $w.Write([UInt16]1); $w.Write([UInt16]32); $w.Write([UInt32]$d.Length); $w.Write([UInt32]$off)
+ $off += $d.Length
+ }
+ foreach ($f in $frames) { $w.Write([byte[]]$f[1]) }
+ $w.Close()
+}
+
+foreach ($linha in $itens) {
+ $nome, $desc, $png = $linha.Split('|')
+ $ext = if ($nome -like 'WacOSWindow' -or $nome -like 'WacOSWindow32') { 'dll' } else { 'exe' }
+ $iconLine = ''
+ $pngPath = if ($png) { Join-Path $pack $png } else { '' }
+ if ($pngPath -and (Test-Path $pngPath)) {
+ $ico = Join-Path $Out "$nome.ico"
+ if (!(Test-Path $ico) -or (Get-Item $ico).LastWriteTime -lt (Get-Item $pngPath).LastWriteTime) { Make-Ico $pngPath $ico }
+ $iconLine = "1 ICON `"$nome.ico`""
+ }
+ $rc = @"
+#include <winver.h>
+$iconLine
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+FILEOS VOS_NT_WINDOWS32
+FILETYPE $(if ($ext -eq 'dll') { 'VFT_DLL' } else { 'VFT_APP' })
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "WacOS (open source)"
+ VALUE "Comments", "https://github.com/renzyxx/WacOS"
+ VALUE "LegalCopyright", "WacOS contributors"
+ VALUE "FileDescription", "$desc"
+ VALUE "FileVersion", "1.0.0.0"
+ VALUE "InternalName", "$nome"
+ VALUE "OriginalFilename", "$nome.$ext"
+ VALUE "ProductName", "WacOS"
+ VALUE "ProductVersion", "1.0.0.0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+"@
+ [IO.File]::WriteAllText((Join-Path $Out "$nome.rc"), $rc, [Text.Encoding]::ASCII)
+}
+Write-Host "recursos gerados em $Out"