A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Notes: working table, attachments, drawing and local Writing Tools buttons
Eternity07062880ebd3709528
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex 9b74cc7..cc832e3 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -797,3 +797,4 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem[2026-11-20 23:48] MODO "SÓ O DOCK E A BARRA DE MENUS" (Reddit, anybody001; ajuste modo=dock, Ajustes > Geral > Modo do WacOS). shell::SoDock() lido na partida: fica a barra de menus (Central de Controle, Notificações, Spotlight), o Dock (Launchpad, gênio, Mission Control), a Ilha (se ligada), o vigia (mesa::Start) e o limite das janelas. Fora: a nossa mesa (mesa.cpp força explorer=1: a área de trabalho e os ícones do Windows; sem Explorador ele é aberto), widgets, barras de título (janelas/dialogs/sombras/encaixe), Finder nas pastas (pastas::Start; o Ajustes desliga finder_padrao e guarda o de antes em finder_padrao_antes, que volta no modo completo), clique na mesa, ponteiro grande, Organizador Visual, tela de bloqueio, Cantos Ativos, Nota Rápida, janela de cópia, App Nap, e o gancho de teclado deixa passar tudo (tecla Windows = Iniciar, Alt+Tab e captura de tela do Windows; volume continua). Trocar o modo reinicia o Shell. Testado no PC: com modo=dock o log mostra "modo: só Dock", "mesa própria não" e nenhuma barra de título; voltou para o completo (modo= vazio, igual ao padrão) com a mesa e as barras de volta. Não testado: a troca pelo próprio Ajustes.[2026-11-21 00:10] Notas igual ao Notas do macOS 26/27 das fotos do usuário (claro e escuro), com o tema Tahoe ou Golden Gate (liquid_glass=1; Sequoia e Leopard como antes; branch claude/notas-macos27). Medido nas fotos (0,895 px por pt): barra lateral com "iCloud" a 61 pt, linha escolhida de 31 pt, pasta em contorno azul-ardósia e nome em negrito; Notas Matemáticas, Todo o iCloud e No Meu Mac só aparecem quando têm notas (ou estão escolhidas). Lista: "7 Dias Anteriores" em 14 pt com linha fina, cartão amarelo (255,227,143; escuro 159,131,46) de 55 pt e raio 11 com a lista em foco, data em negrito. Barra do editor: escrever num círculo; cápsula com Aa (apagado sem foco no texto), lista de verificação, tabela, anexo, marcação e Ferramentas de Escrita (os 3 últimos mostram que não estão disponíveis); cápsula com compartilhar e "⋯" (fixar nota, cadeado/colaborar/áudio indisponíveis); busca num círculo que vira campo. Divisórias quase invisíveis, escuro com lista 34,36,39 e editor 30. Novos símbolos icones\simbolos\paperclip.svg e pencil.tip.crop.circle.svg (tirados da SF Pro instalada, U+100262/U+100265; copiados também para a instalação). Captura: --foco-lista e --larguras=L,M. 2 frases novas nos 12 idiomas. Instalado só o WacOSNotes.exe (hash conferido). Conferido por foto (modo --captura); NÃO clicado ao vivo. Mantido: a janela nasce sem WS_SYSMENU. Nada no registro do Windows. DESFAZER: reverter o commit e reinstalar o WacOSNotes.exe anterior.[2026-11-21 00:10] Notas, issue renzyxx/WacOS#8 (carlosjrrr), no tema macOS 26/27 (mesmo branch claude/notas-macos27): (1) nova nota: o botão fica sempre na barra do editor, também com a barra lateral fechada e na galeria (conferido nas fotos de captura). (2) Barra lateral: o acrílico do Windows sozinho ficava num cinza turvo (chapado com a janela inativa); agora leva um véu na cor medida na foto (claro 236,236,240; escuro 32,34,38) a 72 %, e os botões de nova pasta/lateral são vidro discreto (véu claro de 38 % com borda), não mais brancos chapados. Conferido numa foto da janela real (aberta pelo WMI com dados de teste, modo escuro). (3) BUG: na galeria o seletor lista/galeria sumia e não havia como voltar; agora a galeria mostra o nome da pasta e o "⋯" (Ver como Lista/Galeria) e, com uma nota aberta, a seta de voltar num círculo de vidro. (4) BUG: o painel Aa (formatar) não fechava ao escolher; agora fecha a cada escolha (estilo, negrito/itálico/sublinhado/tachado, lista ou realce). Nada clicado ao vivo (sem SendInput). DESFAZER: reverter o commit.+[2026-11-21 00:25] Notas: os botões da barra do editor funcionam (pedido do usuário; branch claude/notas-macos27). Modelo: cada parágrafo ganhou um tipo (texto, linha de tabela, anexo), gravado como 6º número do cabeçalho do .nota só quando não é texto (notas comuns ficam iguais; uma versão antiga lê o anexo como o caminho). TABELA: insere 2 × 2 (como o Mac); células separadas por TAB, uma parada de tabulação por coluna e a grade desenhada por cima; Tab/Shift+Tab andam de célula em célula, Tab na última abre uma linha, Enter abre uma linha e Enter numa linha vazia no fim sai da tabela; com o cursor na tabela o botão mostra Adicionar/Apagar Linha e Coluna e Converter em Texto. ANEXO: Abrir do Windows (vários arquivos); o arquivo é copiado para Notas\anexos (caminho gravado relativo); imagens aparecem na nota (até 400 pt de altura), outros arquivos num cartão com nome e tamanho; clique duplo abre; Backspace/Delete apagam o anexo. MARCAÇÃO: folha de desenho (5 cores, Desfazer, Limpar, Cancelar, Inserir; Esc/Enter/Ctrl+Z) que grava um PNG em 2x recortado e anexa. FERRAMENTAS DE ESCRITA: sem IA e sem internet (dito no menu): Revisar (espaços, pontuação, maiúsculas, "i"->"I" em inglês), Converter em Lista, Converter em Tabela (separa por TAB, ;, | ou ,), MAIÚSCULAS, minúsculas, Iniciais Maiúsculas. O antigo botão de mídia do Sequoia também anexa. 17 frases novas nos 12 idiomas (saíram as 2 de "indisponível"). Teste sem clicar: modo de captura com --acoes= (tabela, linha, coluna, revisar, anexo:<arq>, desenho:<n>, folha:<n>, digitar:<texto com \t \n \b>, gravar); conferido em fotos que tudo funciona, grava e relê do disco, e numa foto da janela real (dados de teste). NÃO clicado ao vivo (sem SendInput). Anexos de notas apagadas ficam em Notas\anexos (não são removidos). DESFAZER: reverter o commit.diff --git a/src/comum/idioma_de.inc b/src/comum/idioma_de.incindex d05e5f7..1afd0cd 100644--- a/src/comum/idioma_de.inc+++ b/src/comum/idioma_de.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"Zusammenarbeit erfordert iCloud" },{ L"Tabelas ainda não disponíveis", L"Tabellen noch nicht verfügbar" },{ L"Gravar Áudio indisponível", L"Audioaufnahme nicht verfügbar" },-{ L"Desenhos indisponíveis", L"Zeichnungen nicht verfügbar" },-{ L"Ferramentas de Escrita indisponíveis", L"Schreibwerkzeuge nicht verfügbar" },+{ L"Desenho", L"Zeichnung" },+{ L"Inserir", L"Einfügen" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Hier mit Maus oder Stift zeichnen" },+{ L"Anexar Arquivo", L"Datei anhängen" },+{ L"Arquivo não encontrado", L"Datei nicht gefunden" },+{ L"Adicionar Linha", L"Zeile hinzufügen" },+{ L"Adicionar Coluna", L"Spalte hinzufügen" },+{ L"Apagar Linha", L"Zeile löschen" },+{ L"Apagar Coluna", L"Spalte löschen" },+{ L"Converter em Texto", L"In Text umwandeln" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Schreibwerkzeuge (auf diesem Computer, ohne KI)" },+{ L"Revisar", L"Korrekturlesen" },+{ L"Converter em Lista", L"Liste erstellen" },+{ L"Converter em Tabela", L"Tabelle erstellen" },+{ L"MAIÚSCULAS", L"GROSSBUCHSTABEN" },+{ L"minúsculas", L"kleinbuchstaben" },+{ L"Iniciais Maiúsculas", L"Wortanfänge groß" },{ L"Fotos e arquivos indisponíveis", L"Fotos und Dateien nicht verfügbar" },{ L"Notas apagadas não podem ser editadas.", L"Gelöschte Notizen können nicht bearbeitet werden." },{ L"Para editar esta nota, recupere-a primeiro.", L"Stelle diese Notiz zuerst wieder her, um sie zu bearbeiten." },diff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.incindex b2d3900..7b85b00 100644--- a/src/comum/idioma_en.inc+++ b/src/comum/idioma_en.inc@@ -961,8 +961,23 @@{ L"Colaborar requer iCloud", L"Collaborate requires iCloud" },{ L"Tabelas ainda não disponíveis", L"Tables not available yet" },{ L"Gravar Áudio indisponível", L"Record Audio unavailable" },-{ L"Desenhos indisponíveis", L"Drawings unavailable" },-{ L"Ferramentas de Escrita indisponíveis", L"Writing Tools unavailable" },+{ L"Desenho", L"Drawing" },+{ L"Inserir", L"Insert" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Draw here with your mouse or pen" },+{ L"Anexar Arquivo", L"Attach File" },+{ L"Arquivo não encontrado", L"File not found" },+{ L"Adicionar Linha", L"Add Row" },+{ L"Adicionar Coluna", L"Add Column" },+{ L"Apagar Linha", L"Delete Row" },+{ L"Apagar Coluna", L"Delete Column" },+{ L"Converter em Texto", L"Convert to Text" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Writing Tools (on this computer, no AI)" },+{ L"Revisar", L"Proofread" },+{ L"Converter em Lista", L"Make List" },+{ L"Converter em Tabela", L"Make Table" },+{ L"MAIÚSCULAS", L"UPPERCASE" },+{ L"minúsculas", L"lowercase" },+{ L"Iniciais Maiúsculas", L"Capitalize Words" },{ L"Fotos e arquivos indisponíveis", L"Photos and files unavailable" },{ L"Notas apagadas não podem ser editadas.", L"Deleted notes can’t be edited." },{ L"Para editar esta nota, recupere-a primeiro.", L"To edit this note, recover it first." },diff --git a/src/comum/idioma_es.inc b/src/comum/idioma_es.incindex 1105517..2726a8e 100644--- a/src/comum/idioma_es.inc+++ b/src/comum/idioma_es.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"Colaborar requiere iCloud" },{ L"Tabelas ainda não disponíveis", L"Las tablas aún no están disponibles" },{ L"Gravar Áudio indisponível", L"Grabar audio no disponible" },-{ L"Desenhos indisponíveis", L"Dibujos no disponibles" },-{ L"Ferramentas de Escrita indisponíveis", L"Herramientas de escritura no disponibles" },+{ L"Desenho", L"Dibujo" },+{ L"Inserir", L"Insertar" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Dibuja aquí con el ratón o el lápiz" },+{ L"Anexar Arquivo", L"Adjuntar archivo" },+{ L"Arquivo não encontrado", L"Archivo no encontrado" },+{ L"Adicionar Linha", L"Añadir fila" },+{ L"Adicionar Coluna", L"Añadir columna" },+{ L"Apagar Linha", L"Eliminar fila" },+{ L"Apagar Coluna", L"Eliminar columna" },+{ L"Converter em Texto", L"Convertir en texto" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Herramientas de escritura (en este ordenador, sin IA)" },+{ L"Revisar", L"Revisar" },+{ L"Converter em Lista", L"Crear lista" },+{ L"Converter em Tabela", L"Crear tabla" },+{ L"MAIÚSCULAS", L"MAYÚSCULAS" },+{ L"minúsculas", L"minúsculas" },+{ L"Iniciais Maiúsculas", L"Iniciales en mayúscula" },{ L"Fotos e arquivos indisponíveis", L"Fotos y archivos no disponibles" },{ L"Notas apagadas não podem ser editadas.", L"Las notas eliminadas no se pueden editar." },{ L"Para editar esta nota, recupere-a primeiro.", L"Para editar esta nota, recupérala primero." },diff --git a/src/comum/idioma_fr.inc b/src/comum/idioma_fr.incindex 23fc17b..8d7dac6 100644--- a/src/comum/idioma_fr.inc+++ b/src/comum/idioma_fr.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"La collaboration nécessite iCloud" },{ L"Tabelas ainda não disponíveis", L"Tableaux pas encore disponibles" },{ L"Gravar Áudio indisponível", L"Enregistrement audio indisponible" },-{ L"Desenhos indisponíveis", L"Dessins indisponibles" },-{ L"Ferramentas de Escrita indisponíveis", L"Outils d’écriture indisponibles" },+{ L"Desenho", L"Dessin" },+{ L"Inserir", L"Insérer" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Dessinez ici avec la souris ou le stylet" },+{ L"Anexar Arquivo", L"Joindre un fichier" },+{ L"Arquivo não encontrado", L"Fichier introuvable" },+{ L"Adicionar Linha", L"Ajouter une ligne" },+{ L"Adicionar Coluna", L"Ajouter une colonne" },+{ L"Apagar Linha", L"Supprimer la ligne" },+{ L"Apagar Coluna", L"Supprimer la colonne" },+{ L"Converter em Texto", L"Convertir en texte" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Outils d’écriture (sur cet ordinateur, sans IA)" },+{ L"Revisar", L"Relire" },+{ L"Converter em Lista", L"Créer une liste" },+{ L"Converter em Tabela", L"Créer un tableau" },+{ L"MAIÚSCULAS", L"MAJUSCULES" },+{ L"minúsculas", L"minuscules" },+{ L"Iniciais Maiúsculas", L"Majuscules en début de mot" },{ L"Fotos e arquivos indisponíveis", L"Photos et fichiers indisponibles" },{ L"Notas apagadas não podem ser editadas.", L"Les notes supprimées ne peuvent pas être modifiées." },{ L"Para editar esta nota, recupere-a primeiro.", L"Pour modifier cette note, récupérez-la d’abord." },diff --git a/src/comum/idioma_it.inc b/src/comum/idioma_it.incindex 7b44b68..cf6bba5 100644--- a/src/comum/idioma_it.inc+++ b/src/comum/idioma_it.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"La collaborazione richiede iCloud" },{ L"Tabelas ainda não disponíveis", L"Tabelle non ancora disponibili" },{ L"Gravar Áudio indisponível", L"Registrazione audio non disponibile" },-{ L"Desenhos indisponíveis", L"Disegni non disponibili" },-{ L"Ferramentas de Escrita indisponíveis", L"Strumenti di scrittura non disponibili" },+{ L"Desenho", L"Disegno" },+{ L"Inserir", L"Inserisci" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Disegna qui con il mouse o la penna" },+{ L"Anexar Arquivo", L"Allega file" },+{ L"Arquivo não encontrado", L"File non trovato" },+{ L"Adicionar Linha", L"Aggiungi riga" },+{ L"Adicionar Coluna", L"Aggiungi colonna" },+{ L"Apagar Linha", L"Elimina riga" },+{ L"Apagar Coluna", L"Elimina colonna" },+{ L"Converter em Texto", L"Converti in testo" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Strumenti di scrittura (su questo computer, senza IA)" },+{ L"Revisar", L"Correggi" },+{ L"Converter em Lista", L"Crea elenco" },+{ L"Converter em Tabela", L"Crea tabella" },+{ L"MAIÚSCULAS", L"MAIUSCOLO" },+{ L"minúsculas", L"minuscolo" },+{ L"Iniciais Maiúsculas", L"Iniziali maiuscole" },{ L"Fotos e arquivos indisponíveis", L"Foto e file non disponibili" },{ L"Notas apagadas não podem ser editadas.", L"Le note eliminate non possono essere modificate." },{ L"Para editar esta nota, recupere-a primeiro.", L"Per modificare questa nota, recuperala prima." },diff --git a/src/comum/idioma_ja.inc b/src/comum/idioma_ja.incindex 21a4622..c4519e9 100644--- a/src/comum/idioma_ja.inc+++ b/src/comum/idioma_ja.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"共同制作にはiCloudが必要です" },{ L"Tabelas ainda não disponíveis", L"表はまだ使用できません" },{ L"Gravar Áudio indisponível", L"オーディオ録音は使用できません" },-{ L"Desenhos indisponíveis", L"描画は使用できません" },-{ L"Ferramentas de Escrita indisponíveis", L"作文ツールは使用できません" },+{ L"Desenho", L"描画" },+{ L"Inserir", L"挿入" },+{ L"Desenhe aqui com o mouse ou a caneta", L"マウスまたはペンでここに描きます" },+{ L"Anexar Arquivo", L"ファイルを添付" },+{ L"Arquivo não encontrado", L"ファイルが見つかりません" },+{ L"Adicionar Linha", L"行を追加" },+{ L"Adicionar Coluna", L"列を追加" },+{ L"Apagar Linha", L"行を削除" },+{ L"Apagar Coluna", L"列を削除" },+{ L"Converter em Texto", L"テキストに変換" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"作文ツール(このコンピュータ上、AIなし)" },+{ L"Revisar", L"校正" },+{ L"Converter em Lista", L"リストにする" },+{ L"Converter em Tabela", L"表にする" },+{ L"MAIÚSCULAS", L"大文字" },+{ L"minúsculas", L"小文字" },+{ L"Iniciais Maiúsculas", L"単語の先頭を大文字" },{ L"Fotos e arquivos indisponíveis", L"写真とファイルは使用できません" },{ L"Notas apagadas não podem ser editadas.", L"削除したメモは編集できません。" },{ L"Para editar esta nota, recupere-a primeiro.", L"このメモを編集するには、まず復元してください。" },diff --git a/src/comum/idioma_ko.inc b/src/comum/idioma_ko.incindex 775c763..f0e10df 100644--- a/src/comum/idioma_ko.inc+++ b/src/comum/idioma_ko.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"공동 작업하려면 iCloud가 필요합니다" },{ L"Tabelas ainda não disponíveis", L"표는 아직 사용할 수 없음" },{ L"Gravar Áudio indisponível", L"오디오 녹음을 사용할 수 없음" },-{ L"Desenhos indisponíveis", L"그리기를 사용할 수 없음" },-{ L"Ferramentas de Escrita indisponíveis", L"글쓰기 도구를 사용할 수 없음" },+{ L"Desenho", L"그리기" },+{ L"Inserir", L"삽입" },+{ L"Desenhe aqui com o mouse ou a caneta", L"마우스나 펜으로 여기에 그리세요" },+{ L"Anexar Arquivo", L"파일 첨부" },+{ L"Arquivo não encontrado", L"파일을 찾을 수 없음" },+{ L"Adicionar Linha", L"행 추가" },+{ L"Adicionar Coluna", L"열 추가" },+{ L"Apagar Linha", L"행 삭제" },+{ L"Apagar Coluna", L"열 삭제" },+{ L"Converter em Texto", L"텍스트로 변환" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"글쓰기 도구(이 컴퓨터에서, AI 없음)" },+{ L"Revisar", L"교정" },+{ L"Converter em Lista", L"목록으로 만들기" },+{ L"Converter em Tabela", L"표로 만들기" },+{ L"MAIÚSCULAS", L"대문자" },+{ L"minúsculas", L"소문자" },+{ L"Iniciais Maiúsculas", L"단어 첫 글자 대문자" },{ L"Fotos e arquivos indisponíveis", L"사진 및 파일을 사용할 수 없음" },{ L"Notas apagadas não podem ser editadas.", L"삭제된 메모는 편집할 수 없습니다." },{ L"Para editar esta nota, recupere-a primeiro.", L"이 메모를 편집하려면 먼저 복구하십시오." },diff --git a/src/comum/idioma_pl.inc b/src/comum/idioma_pl.incindex 052ccdd..425e087 100644--- a/src/comum/idioma_pl.inc+++ b/src/comum/idioma_pl.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"Współpraca wymaga iCloud" },{ L"Tabelas ainda não disponíveis", L"Tabele nie są jeszcze dostępne" },{ L"Gravar Áudio indisponível", L"Nagrywanie dźwięku niedostępne" },-{ L"Desenhos indisponíveis", L"Rysunki niedostępne" },-{ L"Ferramentas de Escrita indisponíveis", L"Narzędzia pisania niedostępne" },+{ L"Desenho", L"Rysunek" },+{ L"Inserir", L"Wstaw" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Rysuj tutaj myszą lub piórem" },+{ L"Anexar Arquivo", L"Załącz plik" },+{ L"Arquivo não encontrado", L"Nie znaleziono pliku" },+{ L"Adicionar Linha", L"Dodaj wiersz" },+{ L"Adicionar Coluna", L"Dodaj kolumnę" },+{ L"Apagar Linha", L"Usuń wiersz" },+{ L"Apagar Coluna", L"Usuń kolumnę" },+{ L"Converter em Texto", L"Zamień na tekst" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Narzędzia pisania (na tym komputerze, bez AI)" },+{ L"Revisar", L"Sprawdź" },+{ L"Converter em Lista", L"Utwórz listę" },+{ L"Converter em Tabela", L"Utwórz tabelę" },+{ L"MAIÚSCULAS", L"WIELKIE LITERY" },+{ L"minúsculas", L"małe litery" },+{ L"Iniciais Maiúsculas", L"Wielkie Pierwsze Litery" },{ L"Fotos e arquivos indisponíveis", L"Zdjęcia i pliki niedostępne" },{ L"Notas apagadas não podem ser editadas.", L"Usuniętych notatek nie można edytować." },{ L"Para editar esta nota, recupere-a primeiro.", L"Aby edytować tę notatkę, najpierw ją odzyskaj." },diff --git a/src/comum/idioma_ru.inc b/src/comum/idioma_ru.incindex 6f55984..1dec38d 100644--- a/src/comum/idioma_ru.inc+++ b/src/comum/idioma_ru.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"Для совместной работы нужен iCloud" },{ L"Tabelas ainda não disponíveis", L"Таблицы пока недоступны" },{ L"Gravar Áudio indisponível", L"Запись аудио недоступна" },-{ L"Desenhos indisponíveis", L"Рисунки недоступны" },-{ L"Ferramentas de Escrita indisponíveis", L"Инструменты письма недоступны" },+{ L"Desenho", L"Рисунок" },+{ L"Inserir", L"Вставить" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Рисуйте здесь мышью или пером" },+{ L"Anexar Arquivo", L"Прикрепить файл" },+{ L"Arquivo não encontrado", L"Файл не найден" },+{ L"Adicionar Linha", L"Добавить строку" },+{ L"Adicionar Coluna", L"Добавить столбец" },+{ L"Apagar Linha", L"Удалить строку" },+{ L"Apagar Coluna", L"Удалить столбец" },+{ L"Converter em Texto", L"Преобразовать в текст" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Инструменты письма (на этом компьютере, без ИИ)" },+{ L"Revisar", L"Проверить" },+{ L"Converter em Lista", L"Сделать списком" },+{ L"Converter em Tabela", L"Сделать таблицей" },+{ L"MAIÚSCULAS", L"ПРОПИСНЫЕ" },+{ L"minúsculas", L"строчные" },+{ L"Iniciais Maiúsculas", L"Каждое Слово С Прописной" },{ L"Fotos e arquivos indisponíveis", L"Фото и файлы недоступны" },{ L"Notas apagadas não podem ser editadas.", L"Удаленные заметки нельзя редактировать." },{ L"Para editar esta nota, recupere-a primeiro.", L"Чтобы изменить эту заметку, сначала восстановите ее." },diff --git a/src/comum/idioma_tr.inc b/src/comum/idioma_tr.incindex b9b4021..9374e19 100644--- a/src/comum/idioma_tr.inc+++ b/src/comum/idioma_tr.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"Ortak çalışma iCloud gerektirir" },{ L"Tabelas ainda não disponíveis", L"Tablolar henüz kullanılamıyor" },{ L"Gravar Áudio indisponível", L"Ses Kaydı kullanılamıyor" },-{ L"Desenhos indisponíveis", L"Çizimler kullanılamıyor" },-{ L"Ferramentas de Escrita indisponíveis", L"Yazma Araçları kullanılamıyor" },+{ L"Desenho", L"Çizim" },+{ L"Inserir", L"Ekle" },+{ L"Desenhe aqui com o mouse ou a caneta", L"Fare veya kalemle buraya çizin" },+{ L"Anexar Arquivo", L"Dosya Ekle" },+{ L"Arquivo não encontrado", L"Dosya bulunamadı" },+{ L"Adicionar Linha", L"Satır Ekle" },+{ L"Adicionar Coluna", L"Sütun Ekle" },+{ L"Apagar Linha", L"Satırı Sil" },+{ L"Apagar Coluna", L"Sütunu Sil" },+{ L"Converter em Texto", L"Metne Dönüştür" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"Yazma Araçları (bu bilgisayarda, yapay zekâ yok)" },+{ L"Revisar", L"Düzelt" },+{ L"Converter em Lista", L"Liste Yap" },+{ L"Converter em Tabela", L"Tablo Yap" },+{ L"MAIÚSCULAS", L"BÜYÜK HARF" },+{ L"minúsculas", L"küçük harf" },+{ L"Iniciais Maiúsculas", L"Baş Harfleri Büyük" },{ L"Fotos e arquivos indisponíveis", L"Fotoğraflar ve dosyalar kullanılamıyor" },{ L"Notas apagadas não podem ser editadas.", L"Silinen notlar düzenlenemez." },{ L"Para editar esta nota, recupere-a primeiro.", L"Bu notu düzenlemek için önce kurtarın." },diff --git a/src/comum/idioma_zh.inc b/src/comum/idioma_zh.incindex 7527a2e..369142c 100644--- a/src/comum/idioma_zh.inc+++ b/src/comum/idioma_zh.inc@@ -952,8 +952,23 @@{ L"Colaborar requer iCloud", L"协作需要 iCloud" },{ L"Tabelas ainda não disponíveis", L"表格尚不可用" },{ L"Gravar Áudio indisponível", L"录音不可用" },-{ L"Desenhos indisponíveis", L"绘图不可用" },-{ L"Ferramentas de Escrita indisponíveis", L"写作工具不可用" },+{ L"Desenho", L"绘图" },+{ L"Inserir", L"插入" },+{ L"Desenhe aqui com o mouse ou a caneta", L"用鼠标或笔在这里绘图" },+{ L"Anexar Arquivo", L"附加文件" },+{ L"Arquivo não encontrado", L"找不到文件" },+{ L"Adicionar Linha", L"添加行" },+{ L"Adicionar Coluna", L"添加列" },+{ L"Apagar Linha", L"删除行" },+{ L"Apagar Coluna", L"删除列" },+{ L"Converter em Texto", L"转换为文本" },+{ L"Ferramentas de Escrita (no computador, sem IA)", L"写作工具(在这台电脑上,无 AI)" },+{ L"Revisar", L"校对" },+{ L"Converter em Lista", L"生成列表" },+{ L"Converter em Tabela", L"生成表格" },+{ L"MAIÚSCULAS", L"大写" },+{ L"minúsculas", L"小写" },+{ L"Iniciais Maiúsculas", L"单词首字母大写" },{ L"Fotos e arquivos indisponíveis", L"照片和文件不可用" },{ L"Notas apagadas não podem ser editadas.", L"已删除的备忘录无法编辑。" },{ L"Para editar esta nota, recupere-a primeiro.", L"要编辑此备忘录,请先将其恢复。" },diff --git a/src/notas/dados.cpp b/src/notas/dados.cppindex 4e67566..4e91a79 100644--- a/src/notas/dados.cpp+++ b/src/notas/dados.cpp@@ -2,6 +2,7 @@// e as Notas Matemáticas (expressões terminadas em "=" ganham o resultado; "nome = expr" cria variável).#include "notas.h"#include <shlobj.h>+#include <shlwapi.h>#include <cwctype>#include <cmath>#include <algorithm>@@ -19,10 +20,14 @@ ULONGLONG store::Now() { FILETIME f; GetSystemTimeAsFileTime(&f); return ((ULONG// ---------------------------------------------------------------------------// Note+static std::wstring NoTabs(std::wstring s) { // células da tabela na lista: separadas por espaços+ for (auto& c : s) if (c == L'\t') c = L' ';+ return s;+}std::wstring Note::Title() const {for (auto& p : paras) {size_t a = p.text.find_first_not_of(L" \t");- if (a != std::wstring::npos) return p.text.substr(a, 200);+ if (a != std::wstring::npos) return NoTabs(p.text.substr(a, 200));}return Tr(L"Nova Nota");}@@ -32,7 +37,7 @@ std::wstring Note::Preview() const {size_t a = p.text.find_first_not_of(L" \t");if (a == std::wstring::npos) continue;if (first) { first = false; continue; }- return p.text.substr(a, 200);+ return NoTabs(p.text.substr(a, 200));}return Tr(L"Nenhum texto adicional");}@@ -69,12 +74,20 @@ static std::wstring Unesc(const std::wstring& s) {return o;}+static std::wstring DataDir();std::wstring store::Serialize(const std::vector<Para>& ps) {std::wstring out;wchar_t b[64];for (auto& p : ps) {- swprintf_s(b, L"%d,%d,%d,%d,%d|", p.style, p.list, p.indent, p.checked ? 1 : 0, p.collapsed ? 1 : 0);+ // 6º número = tipo (texto, linha de tabela, anexo); só escrito quando não é texto (notas comuns ficam iguais)+ if (p.kind != K_TEXT) swprintf_s(b, L"%d,%d,%d,%d,%d,%d|", p.style, p.list, p.indent, p.checked ? 1 : 0, p.collapsed ? 1 : 0, p.kind);+ else swprintf_s(b, L"%d,%d,%d,%d,%d|", p.style, p.list, p.indent, p.checked ? 1 : 0, p.collapsed ? 1 : 0);out += b;+ if (p.kind == K_FILE) { // anexo: o caminho no lugar do texto; dentro de Notas\anexos fica relativo (a pasta pode mudar)+ std::wstring src = p.src, dir = DataDir() + L"\\";+ if (_wcsnicmp(src.c_str(), dir.c_str(), dir.size()) == 0) src = src.substr(dir.size());+ out += L"|"; out += Esc(src); out += L"\n"; continue;+ }// atributos em corridas: "aa:n;" (hex do atributo, quantidade)size_t i = 0;while (i < p.at.size()) {@@ -104,8 +117,9 @@ std::vector<Para> store::Deserialize(const std::wstring& s) {size_t b2 = line.find(L'|', b1 + 1);if (b2 == std::wstring::npos) continue;Para p;- int st = 3, li = 0, in = 0, ck = 0, co = 0;- swscanf_s(line.substr(0, b1).c_str(), L"%d,%d,%d,%d,%d", &st, &li, &in, &ck, &co);+ int st = 3, li = 0, in = 0, ck = 0, co = 0, kd = 0;+ swscanf_s(line.substr(0, b1).c_str(), L"%d,%d,%d,%d,%d,%d", &st, &li, &in, &ck, &co, &kd);+ p.kind = (uint8_t)std::clamp(kd, 0, 2);p.style = (uint8_t)std::clamp(st, 0, 4); p.list = (uint8_t)std::clamp(li, 0, 4); p.indent = (uint8_t)std::clamp(in, 0, 8);p.checked = ck != 0; p.collapsed = co != 0;p.text = Unesc(line.substr(b2 + 1));@@ -118,6 +132,7 @@ std::vector<Para> store::Deserialize(const std::wstring& s) {if (swscanf_s(runs.substr(r, semi - r).c_str(), L"%x:%zu", &v, &n) == 2) p.at.insert(p.at.end(), n, (uint8_t)v);r = semi + 1;}+ if (p.kind == K_FILE) { p.src = PathIsRelativeW(p.text.c_str()) ? DataDir() + L"\\" + p.text : p.text; p.text.clear(); p.at.clear(); }p.at.resize(p.text.size(), 0);ps.push_back(std::move(p));}@@ -235,6 +250,22 @@ bool store::Sync(const Note* keep) {return changed;}+std::wstring store::AttachDir() {+ std::wstring d = DataDir() + L"\\anexos";+ CreateDirectoryW(d.c_str(), nullptr);+ return d;+}++// anexos ficam com a nota: o arquivo é copiado para Notas\anexos com um prefixo único (apagar o original não estraga a nota)+std::wstring store::AddAttachment(const std::wstring& path) {+ std::wstring name = path.substr(path.find_last_of(L"\\/") + 1);+ wchar_t pre[32]; swprintf_s(pre, L"%llx-", (unsigned long long)Now());+ std::wstring dst = AttachDir() + L"\\" + pre + name;+ if (!CopyFileW(path.c_str(), dst.c_str(), TRUE)) { Log(L"anexo: falhou copiar %ls (%lu)", path.c_str(), GetLastError()); return L""; }+ Log(L"anexo: %ls", dst.c_str());+ return dst;+}+static std::wstring NotePath(const Note* n) { return DataDir() + L"\\" + n->id + L".nota"; }void store::SaveNote(Note* n) {diff --git a/src/notas/editor.cpp b/src/notas/editor.cppindex d8a2aae..32afd09 100644--- a/src/notas/editor.cpp+++ b/src/notas/editor.cpp@@ -8,6 +8,17 @@#include <cmath>#include "../comum/simbolos.h"#include "../comum/semaforo.h" // tema Leopard: o papel amarelo pautado das Notas do 10.5+#include <wincodec.h>+#include <shellapi.h>+#include <map>+// Tabelas, anexos e Ferramentas de Escrita (botões da barra do macOS 26/27):+// - tabela: cada linha é um parágrafo K_ROW com as células separadas por TAB; o layout usa uma parada de tabulação por+// coluna (largura da tabela / colunas), sem quebra de linha, e a grade é desenhada por cima. Tab/Shift+Tab andam de+// célula em célula, Enter abre uma linha nova e Enter numa linha vazia no fim sai da tabela.+// - anexo: parágrafo K_FILE sem texto, com o arquivo em `src` (copiado para Notas\anexos). Imagens aparecem na nota+// (WIC -> bitmap do Direct2D, até 400 pt de altura); outros arquivos viram um cartão; clique duplo abre no programa+// padrão. O cursor fica à esquerda do anexo; Backspace/Delete apagam o anexo inteiro.+// - Ferramentas de Escrita: transformações locais, sem IA (revisar espaços/pontuação/maiúsculas, lista, tabela, caixa).using editor::Pos;@@ -27,7 +38,10 @@ int hoverChevron = -1;int clickMode; // 1 caractere, 2 palavra, 3 parágrafo (arrastar estende nessa unidade)Pos clickA, clickB;-struct PL { IDWriteTextLayout* tl = nullptr; float x = 0, y = 0, h = 0, w = 0, base = 0; bool hidden = false; int number = 0, resultAt = -1; };+struct PL { IDWriteTextLayout* tl = nullptr; float x = 0, y = 0, h = 0, w = 0, base = 0; bool hidden = false; int number = 0, resultAt = -1;+ float pad = 0; // linha de tabela: folga em cima e embaixo do texto+ int cols = 0; float colW = 0, tableW = 0; // linha de tabela+ float imgW = 0, imgH = 0; }; // anexo: tamanho na notastd::vector<PL> pl;bool dirtyLayout = true;float layoutW = -1;@@ -37,7 +51,7 @@ ID2D1DeviceContext* lastDc;ID2D1SolidColorBrush *brAccent, *brHi[HI_COUNT + 1];IDWriteTextFormat* fmt[5];-const float MARGIN = 24, INDENT = 26, TOP_PAD = 34;+const float MARGIN = 24, INDENT = 26, TOP_PAD = 34, CELL_PAD = 8, ROW_PAD = 7;// medidas de cada estilo (tamanho, altura da linha, espaço depois)struct StyleM { float size, line, after; DWRITE_FONT_WEIGHT w; };@@ -70,10 +84,55 @@ Pos SelEnd() { return Less(caret, anchor) ? anchor : caret; }bool HasSel() { return !Same(caret, anchor); }Para& P(int i) { return N->paras[i]; }int Count() { return N ? (int)N->paras.size() : 0; }-int Level(const Para& p) { return p.style <= S_SUBHEADING ? p.style : 99; }+int Level(const Para& p) { return p.kind == K_TEXT && p.style <= S_SUBHEADING ? p.style : 99; }+bool IsRow(int i) { return i >= 0 && i < Count() && P(i).kind == K_ROW; }+bool IsFile(int i) { return i >= 0 && i < Count() && P(i).kind == K_FILE; }+int Tabs(const std::wstring& s) { return (int)std::count(s.begin(), s.end(), L'\t'); }+int TableCols(int i) { // colunas do bloco de linhas que contém i (a linha mais larga manda)+ int a = i, b = i, n = 1;+ while (IsRow(a - 1)) a--;+ while (IsRow(b + 1)) b++;+ for (int k = a; k <= b; k++) n = std::max(n, Tabs(P(k).text) + 1);+ return n;+}+float After(int i) { return IsFile(i) ? 10.f : IsRow(i) ? (IsRow(i + 1) ? 0.f : 10.f) : SM[P(i).style].after; }+bool IsImageFile(const std::wstring& path) {+ std::wstring e = path.substr(path.find_last_of(L'.') + 1);+ for (auto& c : e) c = towlower(c);+ return e == L"png" || e == L"jpg" || e == L"jpeg" || e == L"gif" || e == L"bmp" || e == L"tif" || e == L"tiff" || e == L"webp" || e == L"heic" || e == L"ico";+}+// nome mostrado: sem o prefixo único que o AddAttachment põe ("1dd7...-foto.png" -> "foto.png")+std::wstring ShownName(const std::wstring& path) {+ std::wstring n = path.substr(path.find_last_of(L"\\/") + 1);+ size_t d = n.find(L'-');+ if (d != std::wstring::npos && d >= 8 && n.find_first_not_of(L"0123456789abcdef") == d) n = n.substr(d + 1);+ return n;+}++// imagens dos anexos (por contexto do Direct2D; nullptr guardado = não é imagem ou não abriu)+std::map<std::wstring, ID2D1Bitmap*> imgs;+IWICImagingFactory* wic;+void ReleaseImages() { for (auto& k : imgs) if (k.second) k.second->Release(); imgs.clear(); }+ID2D1Bitmap* Img(ID2D1DeviceContext* dc, const std::wstring& path) {+ auto it = imgs.find(path);+ if (it != imgs.end()) return it->second;+ ID2D1Bitmap* bmp = nullptr;+ if (IsImageFile(path)) {+ if (!wic) CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&wic));+ IWICBitmapDecoder* dec = nullptr; IWICBitmapFrameDecode* fr = nullptr; IWICFormatConverter* cv = nullptr;+ if (wic && SUCCEEDED(wic->CreateDecoderFromFilename(path.c_str(), nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &dec)) &&+ SUCCEEDED(dec->GetFrame(0, &fr)) && SUCCEEDED(wic->CreateFormatConverter(&cv)) &&+ SUCCEEDED(cv->Initialize(fr, GUID_WICPixelFormat32bppPBGRA, WICBitmapDitherTypeNone, nullptr, 0, WICBitmapPaletteTypeMedianCut)))+ dc->CreateBitmapFromWicBitmap(cv, nullptr, &bmp);+ if (cv) cv->Release(); if (fr) fr->Release(); if (dec) dec->Release();+ }+ imgs[path] = bmp;+ return bmp;+}void ReleaseLayouts() { for (auto& l : pl) if (l.tl) l.tl->Release(); pl.clear(); dirtyLayout = true; }void ReleaseBrushes() {+ ReleaseImages();if (brAccent) brAccent->Release(); brAccent = nullptr;for (auto& b : brHi) { if (b) b->Release(); b = nullptr; }}@@ -124,9 +183,28 @@ void BuildLayouts(ID2D1DeviceContext* dc, float width) {else counters[std::min<int>(p.indent, 9)] = 0;}float base = MARGIN + p.indent * INDENT;- float lead = p.list == L_CHECK ? 28.f : p.list != L_NONE ? 24.f : 0.f;- l.x = base + lead; l.base = base;- l.w = std::max(40.f, width - l.x - MARGIN);+ if (p.kind == K_FILE) { // anexo: imagem na largura possível (até 400 de altura) ou cartão de 52+ l.x = l.base = base; l.w = std::max(40.f, width - base - MARGIN);+ gfx::dw->CreateTextLayout(L"", 0, fmt[S_BODY], l.w, 10000, &l.tl);+ if (l.tl) l.tl->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, SM[S_BODY].line, SM[S_BODY].line * 0.8f);+ if (ID2D1Bitmap* b = Img(dc, p.src)) {+ D2D1_SIZE_U px = b->GetPixelSize();+ // desenhos do Notas são gravados em 2x; o resto, 1 pixel = 1 pt+ float k = ShownName(p.src).rfind(L"desenho-", 0) == 0 || p.src.find(L"\\desenho-") != std::wstring::npos ? 0.5f : 1.f;+ float w = std::min(l.w, std::max(1.f, px.width * k)), h = w * px.height / std::max(1u, px.width);+ if (h > 400) { w *= 400 / h; h = 400; }+ l.imgW = w; l.imgH = h;+ } else { l.imgW = std::min(l.w, 320.f); l.imgH = 52; }+ l.h = l.imgH; l.y = y; y += l.h + After(i);+ continue;+ }+ if (p.kind == K_ROW) { // linha de tabela: uma parada de tabulação por coluna, sem quebra+ l.cols = TableCols(i); l.base = base;+ l.tableW = std::max(120.f, width - base - MARGIN); l.colW = l.tableW / l.cols;+ l.x = base + CELL_PAD; l.w = l.tableW - CELL_PAD; l.pad = ROW_PAD;+ }+ float lead = p.kind == K_ROW ? 0.f : p.list == L_CHECK ? 28.f : p.list != L_NONE ? 24.f : 0.f;+ if (p.kind != K_ROW) { l.x = base + lead; l.base = base; l.w = std::max(40.f, width - l.x - MARGIN); }std::wstring s = p.text;int resultAt = -1;if (i < (int)math.size() && !math[i].result.empty()) {@@ -138,6 +216,7 @@ void BuildLayouts(ID2D1DeviceContext* dc, float width) {gfx::dw->CreateTextLayout(s.c_str(), (UINT32)s.size(), fmt[p.style], l.w, 10000, &l.tl);if (!l.tl) continue;l.tl->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, m.line, m.line * 0.8f);+ if (p.kind == K_ROW) { l.tl->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); l.tl->SetIncrementalTabStop(l.colW); }UINT32 n = (UINT32)p.text.size();for (UINT32 k = 0; k < n;) { // corridas de atributosUINT32 j = k; uint8_t a = p.at[k];@@ -155,15 +234,15 @@ void BuildLayouts(ID2D1DeviceContext* dc, float width) {if (resultAt >= 0) l.tl->SetDrawingEffect(brAccent, { (UINT32)resultAt, (UINT32)math[i].result.size() });DWRITE_TEXT_METRICS tm{}; l.tl->GetMetrics(&tm);l.h = std::max(tm.height, m.line);- l.y = y;- y += l.h + m.after;+ l.y = y + l.pad;+ y += l.h + 2 * l.pad + After(i);}ComputeHidden();// recolhidos não ocupam espaçoy = TOP_PAD;for (int i = 0; i < Count(); i++) {- pl[i].y = y;- if (!pl[i].hidden) y += pl[i].h + SM[P(i).style].after;+ pl[i].y = y + pl[i].pad;+ if (!pl[i].hidden) y += pl[i].h + 2 * pl[i].pad + After(i);}contentH = y + 40;}@@ -181,6 +260,7 @@ void Changed() {// cursor em coordenadas do conteúdo (antes da rolagem)D2D1_RECT_F CaretRectAt(Pos q) {if (q.p >= (int)pl.size() || !pl[q.p].tl) return { 0, 0, 0, 0 };+ if (P(q.p).kind == K_FILE) return { pl[q.p].x - 4, pl[q.p].y, pl[q.p].x - 2, pl[q.p].y + pl[q.p].h }; // à esquerda do anexofloat x, y; DWRITE_HIT_TEST_METRICS m;pl[q.p].tl->HitTestTextPosition((UINT32)q.o, FALSE, &x, &y, &m);return { pl[q.p].x + x, pl[q.p].y + m.top, pl[q.p].x + x + 2, pl[q.p].y + m.top + m.height };@@ -193,7 +273,7 @@ Pos HitContent(float x, float y) { // ponto no conteúdo -> posiçãofor (int i = 0; i < Count(); i++) {if (pl[i].hidden) continue;best = i;- if (y < pl[i].y + pl[i].h + SM[P(i).style].after) break;+ if (y < pl[i].y + pl[i].h + pl[i].pad + After(i)) break;}if (best < 0) return r;r.p = best;@@ -240,8 +320,13 @@ void DeleteRange(Pos a, Pos b) {if (a.p == b.p) {pa.text.erase(a.o, b.o - a.o);pa.at.erase(pa.at.begin() + a.o, pa.at.begin() + b.o);+ } else if (P(b.p).kind == K_FILE && b.o == 0) { // a seleção para antes do anexo: ele fica inteiro+ if (pa.kind == K_FILE) { N->paras.erase(N->paras.begin() + a.p, N->paras.begin() + b.p); caret = anchor = { a.p, 0 }; return; }+ pa.text.resize(a.o); pa.at.resize(a.o);+ N->paras.erase(N->paras.begin() + a.p + 1, N->paras.begin() + b.p);} else {Para& pb = P(b.p);+ if (pa.kind == K_FILE) { pa.kind = pb.kind; pa.src = pb.src; pa.style = pb.style; pa.list = pb.list; pa.indent = pb.indent; pa.checked = pb.checked; } // o anexo selecionado somepa.text = pa.text.substr(0, a.o) + pb.text.substr(b.o);std::vector<uint8_t> at(pa.at.begin(), pa.at.begin() + a.o);at.insert(at.end(), pb.at.begin() + b.o, pb.at.end());@@ -376,6 +461,71 @@ void ToggleBlink() { blinkOn = !blinkOn; }void Invalidate() { dirtyLayout = true; }bool HasSelection() { return N && HasSel(); }+// grade da tabela que começa no parágrafo i: contorno arredondado, linhas entre as linhas e entre as colunas+void DrawTableGrid(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, int i, float ox, float oy) {+ int j = i;+ while (IsRow(j + 1)) j++;+ PL& a = pl[i]; PL& b = pl[j];+ float L = ox + a.base, R = L + a.tableW, T = oy + a.y - a.pad, B = oy + b.y + b.h + b.pad;+ br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.20f) : D2D1::ColorF(0, 0, 0, 0.16f));+ for (int k = i; k < j; k++) { if (pl[k].hidden) continue; float y = oy + pl[k].y + pl[k].h + pl[k].pad; dc->DrawLine({ L, y }, { R, y }, br, 1); }+ for (int c = 1; c < a.cols; c++) { float x = L + c * a.colW; dc->DrawLine({ x, T }, { x, B }, br, 1); }+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(L + 0.5f, T + 0.5f, R - 0.5f, B - 0.5f), 6, 6), br, 1);+}++// anexo: a imagem (cantos de 8) ou um cartão com a folha, o nome e o tamanho; clique duplo abre+void DrawFile(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Para& p, const PL& l, float ox, float oy, bool inSel, D2D1_COLOR_F accent) {+ D2D1_RECT_F r = D2D1::RectF(ox + l.x, oy + l.y, ox + l.x + l.imgW, oy + l.y + l.imgH);+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ if (ID2D1Bitmap* b = imgs.count(p.src) ? imgs[p.src] : nullptr) {+ ID2D1RoundedRectangleGeometry* g = nullptr;+ if (f) f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(r, 8, 8), &g);+ if (g) dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), g), nullptr);+ dc->DrawBitmap(b, r, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR);+ if (g) { dc->PopLayer(); g->Release(); }+ br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.12f) : D2D1::ColorF(0, 0, 0, 0.10f));+ 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);+ } else {+ br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.07f) : D2D1::ColorF(0, 0, 0, 0.035f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, 10, 10), br);+ br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.12f) : D2D1::ColorF(0, 0, 0, 0.10f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 9.5f, 9.5f), br, 1);+ // folha com a ponta dobrada+ float fx = r.left + 14, fy = r.top + 11, fw = 22, fh = 30, d = 7;+ ID2D1PathGeometry* g = nullptr;+ if (f && SUCCEEDED(f->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* k = nullptr; g->Open(&k);+ k->BeginFigure({ fx, fy }, D2D1_FIGURE_BEGIN_FILLED);+ k->AddLine({ fx + fw - d, fy }); k->AddLine({ fx + fw, fy + d }); k->AddLine({ fx + fw, fy + fh }); k->AddLine({ fx, fy + fh });+ k->EndFigure(D2D1_FIGURE_END_CLOSED); k->Close(); k->Release();+ br->SetColor(dark ? D2D1::ColorF(0.30f, 0.30f, 0.32f) : D2D1::ColorF(1, 1, 1));+ dc->FillGeometry(g, br);+ br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.45f) : D2D1::ColorF(0, 0, 0, 0.35f));+ dc->DrawGeometry(g, br, 1);+ dc->DrawLine({ fx + fw - d, fy }, { fx + fw - d, fy + d }, br, 1); dc->DrawLine({ fx + fw - d, fy + d }, { fx + fw, fy + d }, br, 1);+ g->Release();+ }+ std::wstring name = ShownName(p.src), info;+ WIN32_FILE_ATTRIBUTE_DATA fa{};+ if (GetFileAttributesExW(p.src.c_str(), GetFileExInfoStandard, &fa)) {+ double kb = (((ULONGLONG)fa.nFileSizeHigh << 32) | fa.nFileSizeLow) / 1024.0;+ wchar_t b[64];+ if (kb < 1024) swprintf_s(b, L"%.0f KB", std::max(1.0, kb)); else swprintf_s(b, L"%.1f MB", kb / 1024);+ info = b;+ } else info = Tr(L"Arquivo não encontrado");+ std::wstring ext = name.substr(name.find_last_of(L'.') + 1);+ if (ext.size() < name.size() && ext.size() <= 5) { for (auto& c : ext) c = towupper(c); info = ext + L" · " + info; }+ IDWriteTextFormat *t1 = nullptr, *t2 = nullptr;+ gfx::dw->CreateTextFormat(family.c_str(), nullptr, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 13, L"pt-br", &t1);+ gfx::dw->CreateTextFormat(family.c_str(), nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 11, L"pt-br", &t2);+ DWRITE_TRIMMING tr{ DWRITE_TRIMMING_GRANULARITY_CHARACTER, 0, 0 };+ if (t1) { t1->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); t1->SetTrimming(&tr, nullptr); br->SetColor(TextColor()); dc->DrawTextW(name.c_str(), (UINT32)name.size(), t1, D2D1::RectF(r.left + 48, r.top + 9, r.right - 10, r.top + 27), br); t1->Release(); }+ if (t2) { br->SetColor(Text2()); dc->DrawTextW(info.c_str(), (UINT32)info.size(), t2, D2D1::RectF(r.left + 48, r.top + 28, r.right - 10, r.top + 44), br); t2->Release(); }+ }+ if (f) f->Release();+ if (inSel) { br->SetColor(D2D1::ColorF(accent.r, accent.g, accent.b, focused ? 0.38f : 0.18f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, 8, 8), br); }+}+void Draw(ID2D1DeviceContext* dc, D2D1_RECT_F a) {area = a;if (!N) return;@@ -424,6 +574,9 @@ void Draw(ID2D1DeviceContext* dc, D2D1_RECT_F a) {if (py > a.bottom || py + l.h < a.top) continue;Para& p = P(i);float px = ox + l.x;+ bool inSel = sel && i >= ss.p && i <= se.p && !(i == se.p && se.o == 0 && se.p > ss.p);+ if (p.kind == K_FILE) { DrawFile(dc, br, p, l, ox, oy, inSel, accent); continue; }+ if (p.kind == K_ROW && !IsRow(i - 1)) DrawTableGrid(dc, br, i, ox, oy);auto rangeRects = [&](int from, int len, D2D1_COLOR_F c, float pad) {if (len <= 0) return;UINT32 cnt = 0;@@ -476,7 +629,7 @@ void Draw(ID2D1DeviceContext* dc, D2D1_RECT_F a) {br->SetColor(dark ? D2D1::ColorF(1, 1, 1, 0.38f) : D2D1::ColorF(0, 0, 0, 0.30f));dc->DrawEllipse(D2D1::Ellipse(c, 8, 8), br, 1.1f);}- } else if (p.list != L_NONE) {+ } else if (p.list != L_NONE && p.kind == K_TEXT) {std::wstring mk = p.list == L_BULLET ? L"•" : p.list == L_DASH ? L"–" : std::to_wstring(l.number) + L".";IDWriteTextLayout* ml = nullptr;gfx::dw->CreateTextLayout(mk.c_str(), (UINT32)mk.size(), fmt[p.style], 40, 100, &ml);@@ -592,6 +745,13 @@ void OnMouseDown(D2D1_POINT_2F p, bool shift, int clicks) {}Pos q = HitContent(cx, cy);typingSet = false; desiredX = -1;+ if (P(q.p).kind == K_FILE) { // anexo: clique põe o cursor nele; clique duplo abre no programa padrão+ caret = q; if (!shift) anchor = q;+ clickMode = 1;+ if (clicks == 2) ShellExecuteW(nullptr, L"open", P(q.p).src.c_str(), nullptr, nullptr, SW_SHOWNORMAL);+ RequestPaint();+ return;+ }const std::wstring& t = P(q.p).text;if (clicks == 2) {int a = q.o, b = q.o;@@ -682,6 +842,203 @@ void Redo() {Clamp(); Changed();}+bool InTable() { return N && IsRow(caret.p); }++void InsertTable(int rows, int cols) {+ if (!N) return;+ Checkpoint(3);+ DeleteSel();+ Para row; row.kind = K_ROW; row.text.assign(std::max(1, cols) - 1, L'\t'); row.at.assign(row.text.size(), 0);+ int i = caret.p, first;+ if (P(i).kind == K_TEXT && P(i).text.empty()) { P(i) = row; first = i; }+ else {+ if (P(i).kind == K_TEXT && caret.o > 0 && caret.o < (int)P(i).text.size()) { SplitPara(); i = caret.p - 1; }+ else if (P(i).kind == K_TEXT && caret.o == 0 && !P(i).text.empty()) i--; // no começo do parágrafo: a tabela vem antes+ N->paras.insert(N->paras.begin() + i + 1, row);+ first = i + 1;+ }+ for (int k = 1; k < rows; k++) N->paras.insert(N->paras.begin() + first + k, row);+ int last = first + rows - 1;+ if (last + 1 >= Count() || P(last + 1).kind != K_TEXT) N->paras.insert(N->paras.begin() + last + 1, Para{});+ caret = anchor = { first, 0 };+ typingSet = false;+ Changed();+}++// linha/coluna a mais ou a menos e "Converter em Texto" (menu do botão da tabela com o cursor dentro dela)+void Table(int op) {+ if (!N || !IsRow(caret.p)) return;+ Checkpoint(3);+ anchor = caret;+ int a = caret.p, b = caret.p;+ while (IsRow(a - 1)) a--;+ while (IsRow(b + 1)) b++;+ int col = (int)std::count(P(caret.p).text.begin(), P(caret.p).text.begin() + caret.o, L'\t');+ int cols = TableCols(caret.p);+ auto cellEnd = [](const std::wstring& t, int c) { // posição do fim da célula c (onde fica o TAB seguinte)+ size_t k = 0;+ for (int n = 0; n < c; n++) { k = t.find(L'\t', k); if (k == std::wstring::npos) return t.size(); k++; }+ size_t e = t.find(L'\t', k);+ return e == std::wstring::npos ? t.size() : e;+ };+ auto cellStart = [](const std::wstring& t, int c) {+ size_t k = 0;+ for (int n = 0; n < c; n++) { k = t.find(L'\t', k); if (k == std::wstring::npos) return t.size(); k++; }+ return k;+ };+ switch (op) {+ case T_ADD_ROW: {+ Para nr; nr.kind = K_ROW; nr.text.assign(cols - 1, L'\t'); nr.at.assign(nr.text.size(), 0);+ N->paras.insert(N->paras.begin() + caret.p + 1, nr);+ caret = anchor = { caret.p + 1, 0 };+ break;+ }+ case T_ADD_COL:+ for (int i = a; i <= b; i++) {+ Para& p = P(i);+ while (Tabs(p.text) < cols - 1) { p.text += L'\t'; p.at.push_back(0); } // linhas curtas completam+ size_t e = cellEnd(p.text, col);+ p.text.insert(e, 1, L'\t'); p.at.insert(p.at.begin() + e, 0);+ }+ caret = anchor = { caret.p, (int)cellEnd(P(caret.p).text, col) + 1 };+ break;+ case T_DEL_ROW:+ if (a == b) { P(a).kind = K_TEXT; P(a).text.clear(); P(a).at.clear(); caret = anchor = { a, 0 }; break; }+ N->paras.erase(N->paras.begin() + caret.p);+ caret.p = std::min(caret.p, b - 1); caret.o = 0; anchor = caret;+ break;+ case T_DEL_COL:+ if (cols <= 1) break;+ for (int i = a; i <= b; i++) {+ Para& p = P(i);+ size_t s = cellStart(p.text, col), e = cellEnd(p.text, col);+ if (s > p.text.size()) continue;+ // leva junto um TAB: o do fim (ou o de antes, na última coluna)+ if (e < p.text.size()) e++; else if (s > 0) s--;+ p.text.erase(s, e - s); p.at.erase(p.at.begin() + s, p.at.begin() + e);+ }+ caret = anchor = { caret.p, 0 };+ break;+ case T_TO_TEXT:+ for (int i = a; i <= b; i++) P(i).kind = K_TEXT;+ break;+ }+ Clamp();+ Changed();+}++void InsertAttachment(const std::wstring& path) {+ if (!N || path.empty()) return;+ Checkpoint(3);+ DeleteSel();+ Para f; f.kind = K_FILE; f.src = path;+ int i = caret.p, at;+ if (P(i).kind == K_TEXT && P(i).text.empty() && P(i).list == L_NONE) { P(i) = f; at = i; }+ else {+ if (P(i).kind == K_TEXT && caret.o > 0 && caret.o < (int)P(i).text.size()) { SplitPara(); i = caret.p - 1; }+ else if (P(i).kind == K_TEXT && caret.o == 0 && !P(i).text.empty()) i--;+ N->paras.insert(N->paras.begin() + i + 1, f);+ at = i + 1;+ }+ if (at + 1 >= Count() || P(at + 1).kind != K_TEXT) N->paras.insert(N->paras.begin() + at + 1, Para{});+ caret = anchor = { at + 1, 0 };+ typingSet = false;+ Changed();+}++// Revisar (sem IA): espaços repetidos, espaço antes de pontuação, espaço depois de , ; ! ? (e de . antes de maiúscula),+// maiúscula no começo do parágrafo e depois de . ! ?, "i" sozinho vira "I" em inglês. Os atributos andam junto.+static bool Proof(Para& p) {+ const std::wstring& s = p.text;+ std::wstring t; std::vector<uint8_t> at;+ bool row = p.kind == K_ROW;+ auto punct = [](wchar_t c) { return c == L',' || c == L'.' || c == L';' || c == L':' || c == L'!' || c == L'?' || c == L')'; };+ bool capNext = !row;+ for (size_t i = 0; i < s.size(); i++) {+ wchar_t c = s[i];+ uint8_t a = i < p.at.size() ? p.at[i] : 0;+ wchar_t nx = i + 1 < s.size() ? s[i + 1] : 0;+ if (c == L' ') {+ if (t.empty() || t.back() == L' ' || t.back() == L'\t' || nx == 0 || nx == L'\t' || (punct(nx) && nx != L')')) continue;+ t += c; at.push_back(a); continue;+ }+ if (c == L'\t') { while (!t.empty() && t.back() == L' ') { t.pop_back(); at.pop_back(); } t += c; at.push_back(a); continue; }+ if (iswalpha(c)) {+ if (capNext) c = towupper(c);+ capNext = false;+ if (idioma::En() && c == L'i' && (t.empty() || t.back() == L' ') && (nx == 0 || nx == L' ' || nx == L'\'' || nx == L'\u2019' || punct(nx))) c = L'I';+ } else if (iswdigit(c)) capNext = false;+ t += c; at.push_back(a);+ if (c == L'.' || c == L'!' || c == L'?') {+ bool sentence = c != L'.' || (nx == L' ' || nx == 0);+ if (!row && sentence) capNext = true;+ }+ if ((c == L',' || c == L';' || c == L'!' || c == L'?') && iswalpha(nx)) { t += L' '; at.push_back(a); }+ else if (c == L'.' && iswupper(nx) && !(i > 0 && iswupper(s[i - 1]))) { t += L' '; at.push_back(a); if (!row) capNext = true; }+ }+ while (!t.empty() && t.back() == L' ') { t.pop_back(); at.pop_back(); }+ if (t == s) return false;+ p.text = t; p.at = at;+ return true;+}++bool Transform(int kind) {+ if (!N) return false;+ Checkpoint(3);+ size_t undoN = N->undo.size();+ bool sel = HasSel();+ Pos ss = SelStart(), se = SelEnd();+ int a, b;+ if (kind == W_LIST || kind == W_TABLE || sel) SelParas(a, b); else { a = 0; b = Count() - 1; }+ bool changed = false;+ for (int i = a; i <= b; i++) {+ Para& p = P(i);+ if (p.kind == K_FILE) continue;+ int from = 0, to = (int)p.text.size();+ if (sel && (kind == W_UPPER || kind == W_LOWER || kind == W_TITLE)) { if (i == ss.p) from = ss.o; if (i == se.p) to = se.o; }+ switch (kind) {+ case W_UPPER: case W_LOWER: case W_TITLE: {+ bool start = true;+ for (int k = from; k < to; k++) {+ wchar_t c = p.text[k], n = c;+ if (kind == W_UPPER) n = towupper(c);+ else if (kind == W_LOWER) n = towlower(c);+ else { n = start ? towupper(c) : towlower(c); }+ start = !iswalnum(c) && c != L'\'' && c != L'\u2019';+ if (n != c) { p.text[k] = n; changed = true; }+ }+ break;+ }+ case W_LIST:+ if (p.kind == K_TEXT && !p.text.empty() && p.list != L_BULLET) { p.list = L_BULLET; if (p.style <= S_SUBHEADING) p.style = S_BODY; changed = true; }+ break;+ case W_TABLE: {+ if (p.kind != K_TEXT || p.text.empty()) break;+ // separador: TAB, senão ";", "|" ou ","; os espaços em volta somem+ wchar_t sep = 0;+ for (wchar_t c : { L'\t', L';', L'|', L',' }) if (p.text.find(c) != std::wstring::npos) { sep = c; break; }+ std::wstring t; std::vector<uint8_t> at;+ for (size_t k = 0; k < p.text.size(); k++) {+ wchar_t c = p.text[k] == sep ? L'\t' : p.text[k];+ if (c == L' ' && (t.empty() || t.back() == L'\t' || (k + 1 < p.text.size() && p.text[k + 1] == sep))) continue;+ t += c; at.push_back(k < p.at.size() ? p.at[k] : 0);+ }+ p.text = t; p.at = at; p.kind = K_ROW; p.list = L_NONE; p.style = S_BODY; p.collapsed = false;+ changed = true;+ break;+ }+ case W_PROOF:+ if (Proof(p)) changed = true;+ break;+ }+ }+ if (!changed) { if (N->undo.size() > undoN - 1 && N->undo.size() == undoN) N->undo.pop_back(); return false; }+ if (kind == W_TABLE && (b + 1 >= Count() || P(b + 1).kind != K_TEXT)) N->paras.insert(N->paras.begin() + b + 1, Para{});+ Clamp();+ Changed();+ return true;+}+int CurrentStyle() { return N ? P(caret.p).style : S_BODY; }int CurrentList() { return N ? P(caret.p).list : L_NONE; }uint8_t CurrentAttrs() {@@ -734,6 +1091,7 @@ void ToggleList(int kind) {bool all = true;for (int i = a; i <= b; i++) if (P(i).list != kind) all = false;for (int i = a; i <= b; i++) {+ if (P(i).kind != K_TEXT) continue;P(i).list = all ? (uint8_t)L_NONE : (uint8_t)kind;if (!all && P(i).style != S_MONO) P(i).style = P(i).style <= S_SUBHEADING && P(i).text.empty() ? (uint8_t)S_BODY : P(i).style;P(i).checked = false;@@ -759,6 +1117,24 @@ void ToggleChecked() {void OnChar(wchar_t c) {if (!N || !focused) return;+ if ((c == L'\r' || c == L'\n') && !HasSel() && (IsFile(caret.p) || IsRow(caret.p))) {+ Checkpoint(3);+ int i = caret.p;+ if (IsFile(i)) { N->paras.insert(N->paras.begin() + i + 1, Para{}); caret = anchor = { i + 1, 0 }; }+ else {+ Para& r = P(i);+ bool empty = r.text.find_first_not_of(L'\t') == std::wstring::npos;+ if (empty && !IsRow(i + 1) && IsRow(i - 1)) { r.kind = K_TEXT; r.text.clear(); r.at.clear(); caret = anchor = { i, 0 }; } // sai da tabela+ else {+ Para nr; nr.kind = K_ROW; nr.text.assign(TableCols(i) - 1, L'\t'); nr.at.assign(nr.text.size(), 0);+ N->paras.insert(N->paras.begin() + i + 1, nr);+ caret = anchor = { i + 1, 0 };+ }+ }+ typingSet = false;+ Changed();+ return;+ }if (c == L'\r' || c == L'\n') {Checkpoint(3);DeleteSel();@@ -777,6 +1153,11 @@ void OnChar(wchar_t c) {if (c == L'\t') return; // tratado em OnKeyif (c < 32 || c == 127) return;Checkpoint(1);+ if (!HasSel() && IsFile(caret.p)) { // digitou com o cursor no anexo: o texto vai num parágrafo novo depois dele+ Checkpoint(3);+ N->paras.insert(N->paras.begin() + caret.p + 1, Para{});+ caret = anchor = { caret.p + 1, 0 };+ }uint8_t at = AttrAtCaret();DeleteSel();Para& p = P(caret.p);@@ -787,7 +1168,7 @@ void OnChar(wchar_t c) {else if (p.text == L"-" || p.text == L"–") kind = L_DASH;else if (p.text == L"1." || p.text == L"1)") kind = L_NUMBER;else if (p.text == L"[]" || p.text == L"[ ]") kind = L_CHECK;- if (kind >= 0) {+ if (kind >= 0 && p.kind == K_TEXT) {Checkpoint(3);p.text.clear(); p.at.clear(); p.list = (uint8_t)kind; caret.o = 0; anchor = caret;if (p.style <= S_SUBHEADING) p.style = S_BODY;@@ -845,6 +1226,66 @@ bool OnKey(UINT vk) {}}Para& p = P(caret.p);+ auto jump = [&](Pos q) { caret = anchor = q; desiredX = -1; typingSet = false; wantReveal = true; };+ auto eraseFile = [&](int i) { // apaga o anexo inteiro (fica pelo menos um parágrafo)+ Checkpoint(3);+ if (Count() == 1) { P(0) = Para{}; caret = anchor = { 0, 0 }; }+ else { N->paras.erase(N->paras.begin() + i); int k = std::min(i, Count() - 1); caret = anchor = { k, k < i ? (int)P(k).text.size() : 0 }; }+ Changed();+ };+ if (!HasSel() && !ctrl) {+ // tabela: Tab/Shift+Tab de célula em célula (Tab na última célula abre uma linha nova)+ if (vk == VK_TAB && IsRow(caret.p)) {+ const std::wstring& t = p.text;+ if (!shift) {+ size_t k = t.find(L'\t', caret.o);+ if (k != std::wstring::npos) jump({ caret.p, (int)k + 1 });+ else if (IsRow(caret.p + 1)) jump({ caret.p + 1, 0 });+ else {+ Checkpoint(3);+ Para nr; nr.kind = K_ROW; nr.text.assign(TableCols(caret.p) - 1, L'\t'); nr.at.assign(nr.text.size(), 0);+ N->paras.insert(N->paras.begin() + caret.p + 1, nr);+ jump({ caret.p + 1, 0 });+ Changed();+ }+ } else {+ int s0 = caret.o == 0 ? 0 : (int)(t.rfind(L'\t', caret.o - 1) == std::wstring::npos ? 0 : t.rfind(L'\t', caret.o - 1) + 1);+ if (s0 > 0) { size_t k = s0 >= 2 ? t.rfind(L'\t', s0 - 2) : std::wstring::npos; jump({ caret.p, k == std::wstring::npos ? 0 : (int)k + 1 }); }+ else if (IsRow(caret.p - 1)) { const std::wstring& u = P(caret.p - 1).text; size_t k = u.rfind(L'\t'); jump({ caret.p - 1, k == std::wstring::npos ? 0 : (int)k + 1 }); }+ }+ return true;+ }+ if (vk == VK_BACK || vk == VK_DELETE) {+ if (IsFile(caret.p)) { eraseFile(caret.p); return true; }+ if (IsRow(caret.p)) {+ const std::wstring& t = p.text;+ if (vk == VK_BACK && caret.o > 0 && t[caret.o - 1] == L'\t') { jump({ caret.p, caret.o - 1 }); return true; } // não junta células+ if (vk == VK_DELETE && (caret.o >= (int)t.size() || t[caret.o] == L'\t')) return true;+ if (vk == VK_BACK && caret.o == 0) {+ if (t.find_first_not_of(L'\t') == std::wstring::npos) { // linha vazia: some (a última vira texto)+ Checkpoint(3);+ if (IsRow(caret.p - 1) || IsRow(caret.p + 1)) {+ N->paras.erase(N->paras.begin() + caret.p);+ int k = std::max(0, caret.p - 1);+ caret = anchor = { k, (int)P(k).text.size() };+ } else { p.kind = K_TEXT; p.text.clear(); p.at.clear(); }+ Changed();+ }+ return true;+ }+ }+ if (vk == VK_BACK && caret.o == 0 && caret.p > 0) {+ int k = PrevVisible(caret.p);+ if (IsFile(k)) { eraseFile(k); return true; }+ if (IsRow(k)) { jump({ k, (int)P(k).text.size() }); return true; }+ }+ if (vk == VK_DELETE && caret.o == (int)p.text.size()) {+ int k = NextVisible(caret.p);+ if (IsFile(k)) { int keep = caret.p; eraseFile(k); caret = anchor = { keep, (int)P(keep).text.size() }; return true; }+ if (IsRow(k)) return true;+ }+ }+ }switch (vk) {case VK_LEFT:if (!shift && HasSel()) { move(SelStart()); return true; }diff --git a/src/notas/main.cpp b/src/notas/main.cppindex 3fa1dc9..428d6be 100644--- a/src/notas/main.cpp+++ b/src/notas/main.cpp@@ -54,6 +54,7 @@ bool g_active = true, g_hoverLights;std::wstring g_family = L"Segoe UI", g_mono = L"Consolas";D2D1_SIZE_F g_capSize{}; // modo capturabool g_capture, g_capListFocus;+std::wstring g_capActions; // --acoes=: comandos do editor rodados antes da foto (testar sem clicar nem SendInput)float g_sideW = 214, g_listW = 300;bool g_sideHidden;@@ -79,6 +80,19 @@ int g_divDrag; // 1 borda da barra lateral, 2 borda da listastruct Sheet { bool on = false; std::wstring title, msg, ok; std::function<void()> act; } g_sheet;D2D1_RECT_F g_sheetOk, g_sheetCancel;+// folha de desenho (botão de marcação): uma tela branca para rabiscar com o mouse ou a caneta; "Inserir" grava um PNG+// em 2x em Notas\anexos e põe na nota como anexo. Os pontos ficam relativos ao canto da tela (a janela pode mudar).+struct Sketch {+ struct Stroke { std::vector<D2D1_POINT_2F> pts; int color = 0; };+ bool on = false, drawing = false;+ std::vector<Stroke> strokes;+ int color = 0;+ D2D1_RECT_F panel{}, canvas{}, bUndo{}, bClear{}, bCancel{}, bInsert{}, sw[5]{};+} g_sk;+const D2D1_COLOR_F SK_COLORS[5] = { D2D1::ColorF(0.11f, 0.11f, 0.12f), D2D1::ColorF(0.0f, 0.48f, 1.0f), D2D1::ColorF(1.0f, 0.23f, 0.19f), D2D1::ColorF(0.20f, 0.78f, 0.35f), D2D1::ColorF(1.0f, 0.75f, 0.0f) };+const float SK_PEN = 3.f;+void FocusEditor();+IDWriteTextFormat *g_f14b, *g_f13b, *g_f13, *g_f12, *g_f12b, *g_f11, *g_f11b, *g_fCount, *g_fCardT, *g_fCardD, *g_fThumbT, *g_fThumb, *g_f13c, *g_fFmt[5];ID2D1StrokeStyle* g_round;@@ -903,6 +917,7 @@ void DrawDragGhost(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal&Text(dc, br, t, g_f13b, D2D1::RectF(r.left + 12, r.top, r.right - 8, r.bottom), pal.text);}+void DrawSketch(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& pal);void Render(ID2D1DeviceContext* dc) {Pal pal = Colors();auto c = ClientDip();@@ -952,6 +967,7 @@ void Render(ID2D1DeviceContext* dc) {DrawFormatPanel(dc, br, pal);DrawDragGhost(dc, br, pal);DrawSheet(dc, br, pal);+ DrawSketch(dc, br, pal);br->Release();}@@ -1269,8 +1285,6 @@ void UnavailableMenu(int b) {else if (b == B_COLLAB) items = { I(Tr(L"Colaborar requer iCloud"), 1, true) };else if (b == B_TABLE) items = { I(Tr(L"Tabelas ainda não disponíveis"), 1, true) };else if (b == B_AUDIO) items = { I(Tr(L"Gravar Áudio indisponível"), 1, true) };- else if (b == B_MARKUP) items = { I(Tr(L"Desenhos indisponíveis"), 1, true) };- else if (b == B_WRITING) items = { I(Tr(L"Ferramentas de Escrita indisponíveis"), 1, true) };else items = { I(Tr(L"Fotos e arquivos indisponíveis"), 1, true) };int id = ctxmenu::ShowItems(g_hwnd, ScreenPt(r.left, r.bottom + 4), items);if (b == B_SHARE && editor::Current()) {@@ -1287,6 +1301,205 @@ void SetGallery(bool on) {SaveSoon(); Invalidate();}+// tabela: fora de uma tabela insere uma de 2 × 2 (como o Mac); dentro dela, o menu de linhas e colunas+void TableCmd() {+ if (!editor::Current()) return;+ if (editor::InTable()) {+ auto r = g_btn[B_TABLE].r;+ std::vector<Item> items = { I(Tr(L"Adicionar Linha"), 1), I(Tr(L"Adicionar Coluna"), 2), Sep(), I(Tr(L"Apagar Linha"), 3), I(Tr(L"Apagar Coluna"), 4), Sep(), I(Tr(L"Converter em Texto"), 5) };+ int id = ctxmenu::ShowItems(g_hwnd, ScreenPt(r.left, r.bottom + 4), items);+ const int ops[6] = { -1, editor::T_ADD_ROW, editor::T_ADD_COL, editor::T_DEL_ROW, editor::T_DEL_COL, editor::T_TO_TEXT };+ if (id >= 1 && id <= 5) editor::Table(ops[id]);+ } else editor::InsertTable(2, 2);+ FocusEditor();+}++// anexo: Abrir do Windows (ou o do Finder, se o Abrir/Salvar do Mac estiver ligado); vários arquivos de uma vez+void AttachCmd() {+ if (!editor::Current()) return;+ IFileOpenDialog* d = nullptr;+ if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&d)))) return;+ DWORD o = 0; d->GetOptions(&o);+ d->SetOptions(o | FOS_ALLOWMULTISELECT | FOS_FILEMUSTEXIST | FOS_FORCEFILESYSTEM);+ d->SetTitle(Tr(L"Anexar Arquivo"));+ int n = 0;+ if (SUCCEEDED(d->Show(g_hwnd))) {+ IShellItemArray* arr = nullptr;+ if (SUCCEEDED(d->GetResults(&arr))) {+ DWORD cnt = 0; arr->GetCount(&cnt);+ for (DWORD k = 0; k < cnt; k++) {+ IShellItem* it = nullptr; PWSTR p = nullptr;+ if (SUCCEEDED(arr->GetItemAt(k, &it)) && SUCCEEDED(it->GetDisplayName(SIGDN_FILESYSPATH, &p))) {+ std::wstring dst = store::AddAttachment(p);+ if (!dst.empty()) { editor::InsertAttachment(dst); n++; }+ CoTaskMemFree(p);+ }+ if (it) it->Release();+ }+ arr->Release();+ }+ }+ d->Release();+ Log(L"anexar: %d arquivo(s)", n);+ FocusEditor();+}++// Ferramentas de Escrita: sem o Apple Intelligence, só o que dá para fazer aqui mesmo, sem IA e sem internet+void WritingMenu() {+ if (!editor::Current()) return;+ auto r = g_btn[B_WRITING].r;+ std::vector<Item> items = { I(Tr(L"Ferramentas de Escrita (no computador, sem IA)"), 0, true), Sep(), I(Tr(L"Revisar"), 1), Sep(),+ I(Tr(L"Converter em Lista"), 2), I(Tr(L"Converter em Tabela"), 3), Sep(),+ I(Tr(L"MAIÚSCULAS"), 4), I(Tr(L"minúsculas"), 5), I(Tr(L"Iniciais Maiúsculas"), 6) };+ int id = ctxmenu::ShowItems(g_hwnd, ScreenPt(r.left, r.bottom + 4), items);+ const int kinds[7] = { -1, editor::W_PROOF, editor::W_LIST, editor::W_TABLE, editor::W_UPPER, editor::W_LOWER, editor::W_TITLE };+ if (id >= 1 && id <= 6) { bool ch = editor::Transform(kinds[id]); Log(L"escrita %d: %ls", id, ch ? L"mudou" : L"nada a mudar"); }+ FocusEditor();+}++// ---- folha de desenho+void SketchLayout() {+ auto c = ClientDip();+ float W = std::min(c.width - 40, 640.f), H = std::min(c.height - 40, 480.f);+ float x = (c.width - W) / 2, y = std::max(TOOLBAR_H, (c.height - H) / 2);+ g_sk.panel = { x, y, x + W, y + H };+ g_sk.canvas = { x + 16, y + 44, x + W - 16, y + H - 58 };+ float by = y + H - 44;+ for (int k = 0; k < 5; k++) g_sk.sw[k] = { x + 18 + k * 30.f, by + 2, x + 42 + k * 30.f, by + 26 };+ float bx = x + 18 + 5 * 30.f + 10;+ auto btn = [&](D2D1_RECT_F& r, float& from, const wchar_t* t, bool right) {+ float w = TextW(g_f13, Tr(t)) + 26;+ if (right) { r = { from - w, by, from, by + 28 }; from -= w + 8; }+ else { r = { from, by, from + w, by + 28 }; from += w + 8; }+ };+ btn(g_sk.bUndo, bx, L"Desfazer", false);+ btn(g_sk.bClear, bx, L"Limpar", false);+ float rx = x + W - 16;+ btn(g_sk.bInsert, rx, L"Inserir", true);+ btn(g_sk.bCancel, rx, L"Cancelar", true);+}++void SketchStrokes(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, D2D1_POINT_2F o, float k) {+ ID2D1Factory* f = nullptr; rt->GetFactory(&f);+ ID2D1StrokeStyle* rs = nullptr;+ if (f) f->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_LINE_JOIN_ROUND), nullptr, 0, &rs);+ for (auto& s : g_sk.strokes) {+ br->SetColor(SK_COLORS[s.color]);+ if (s.pts.size() == 1) { rt->FillEllipse(D2D1::Ellipse({ o.x + s.pts[0].x * k, o.y + s.pts[0].y * k }, SK_PEN * k / 2, SK_PEN * k / 2), br); continue; }+ ID2D1PathGeometry* g = nullptr;+ if (!f || FAILED(f->CreatePathGeometry(&g))) continue;+ ID2D1GeometrySink* sk = nullptr; g->Open(&sk);+ auto P = [&](size_t i) { return D2D1::Point2F(o.x + s.pts[i].x * k, o.y + s.pts[i].y * k); };+ sk->BeginFigure(P(0), D2D1_FIGURE_BEGIN_HOLLOW);+ for (size_t i = 1; i + 1 < s.pts.size(); i++) { // curva suave pelos pontos médios+ auto a = P(i), b = P(i + 1);+ sk->AddQuadraticBezier(D2D1::QuadraticBezierSegment(a, D2D1::Point2F((a.x + b.x) / 2, (a.y + b.y) / 2)));+ }+ sk->AddLine(P(s.pts.size() - 1));+ sk->EndFigure(D2D1_FIGURE_END_OPEN); sk->Close(); sk->Release();+ rt->DrawGeometry(g, br, SK_PEN * k, rs);+ g->Release();+ }+ if (rs) rs->Release();+ if (f) f->Release();+}++void DrawSketch(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& pal) {+ if (!g_sk.on) return;+ SketchLayout();+ auto c = ClientDip();+ br->SetColor(D2D1::ColorF(0, 0, 0, g_dark ? 0.35f : 0.15f));+ dc->FillRectangle(D2D1::RectF(0, 0, c.width, c.height), br);+ auto& P = g_sk.panel;+ for (int k = 6; k >= 1; k--) { br->SetColor(D2D1::ColorF(0, 0, 0, 0.04f)); dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(P.left - k, P.top - k + 4, P.right + k, P.bottom + k + 6), 16.f + k, 16.f + k), br); }+ br->SetColor(g_dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f) : D2D1::ColorF(0.965f, 0.965f, 0.97f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(P, 16, 16), br);+ Text(dc, br, Tr(L"Desenho"), g_f13c, D2D1::RectF(P.left, P.top + 12, P.right, P.top + 34), pal.text);+ br->SetColor(D2D1::ColorF(1, 1, 1));+ dc->FillRoundedRectangle(D2D1::RoundedRect(g_sk.canvas, 8, 8), br);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.12f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(g_sk.canvas, 8, 8), br, 1);+ dc->PushAxisAlignedClip(g_sk.canvas, D2D1_ANTIALIAS_MODE_ALIASED);+ SketchStrokes(dc, br, { g_sk.canvas.left, g_sk.canvas.top }, 1);+ dc->PopAxisAlignedClip();+ if (g_sk.strokes.empty()) Text(dc, br, Tr(L"Desenhe aqui com o mouse ou a caneta"), g_f13c, g_sk.canvas, D2D1::ColorF(0, 0, 0, 0.30f));+ for (int k = 0; k < 5; k++) {+ D2D1_POINT_2F m{ (g_sk.sw[k].left + g_sk.sw[k].right) / 2, (g_sk.sw[k].top + g_sk.sw[k].bottom) / 2 };+ br->SetColor(SK_COLORS[k]); dc->FillEllipse(D2D1::Ellipse(m, 9, 9), br);+ if (k == g_sk.color) { br->SetColor(pal.text); dc->DrawEllipse(D2D1::Ellipse(m, 12, 12), br, 1.5f); }+ }+ auto button = [&](D2D1_RECT_F r, const wchar_t* t, bool primary, bool enabled) {+ if (primary) br->SetColor(Accent()); else br->SetColor(g_dark ? D2D1::ColorF(1, 1, 1, 0.14f) : D2D1::ColorF(0, 0, 0, 0.07f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, 8, 8), br);+ Text(dc, br, Tr(t), g_f13c, r, primary ? D2D1::ColorF(0, 0, 0, enabled ? 0.85f : 0.35f) : enabled ? pal.text : pal.text3);+ };+ bool any = !g_sk.strokes.empty();+ button(g_sk.bUndo, L"Desfazer", false, any);+ button(g_sk.bClear, L"Limpar", false, any);+ button(g_sk.bCancel, L"Cancelar", false, true);+ button(g_sk.bInsert, L"Inserir", true, any);+}++// grava o desenho (recortado em volta do que foi desenhado, com folga) como PNG em 2x e anexa na nota+void SketchInsert() {+ if (g_sk.strokes.empty()) { g_sk = Sketch{}; FocusEditor(); return; }+ float x0 = 1e9f, y0 = 1e9f, x1 = -1e9f, y1 = -1e9f;+ for (auto& s : g_sk.strokes) for (auto& p : s.pts) { x0 = std::min(x0, p.x); y0 = std::min(y0, p.y); x1 = std::max(x1, p.x); y1 = std::max(y1, p.y); }+ float m = 16, cw = g_sk.canvas.right - g_sk.canvas.left, ch = g_sk.canvas.bottom - g_sk.canvas.top;+ x0 = std::max(0.f, x0 - m); y0 = std::max(0.f, y0 - m); x1 = std::min(cw, x1 + m); y1 = std::min(ch, y1 + m);+ float W = std::max(40.f, x1 - x0), H = std::max(30.f, y1 - y0), sc = 2;+ wchar_t name[64]; swprintf_s(name, L"\\desenho-%llx.png", (unsigned long long)store::Now());+ std::wstring path = store::AttachDir() + name;+ ID2D1Factory* f = nullptr; IWICImagingFactory* wic = nullptr; IWICBitmap* bmp = nullptr; ID2D1RenderTarget* rt = nullptr;+ D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), nullptr, (void**)&f);+ CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&wic));+ bool ok = false;+ if (f && wic && SUCCEEDED(wic->CreateBitmap((UINT)(W * sc), (UINT)(H * sc), GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnLoad, &bmp)) &&+ SUCCEEDED(f->CreateWicBitmapRenderTarget(bmp, D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_SOFTWARE, D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)), &rt))) {+ ID2D1SolidColorBrush* br = nullptr; rt->CreateSolidColorBrush(D2D1::ColorF(1, 1, 1), &br);+ rt->BeginDraw();+ rt->Clear(D2D1::ColorF(1, 1, 1)); // papel branco: o desenho aparece igual no claro e no escuro+ SketchStrokes(rt, br, { -x0 * sc, -y0 * sc }, sc);+ ok = SUCCEEDED(rt->EndDraw());+ br->Release();+ IWICStream* st = nullptr; IWICBitmapEncoder* enc = nullptr; IWICBitmapFrameEncode* fe = nullptr;+ if (ok && SUCCEEDED(wic->CreateStream(&st)) && SUCCEEDED(st->InitializeFromFilename(path.c_str(), GENERIC_WRITE)) &&+ SUCCEEDED(wic->CreateEncoder(GUID_ContainerFormatPng, nullptr, &enc)) && SUCCEEDED(enc->Initialize(st, WICBitmapEncoderNoCache)) &&+ SUCCEEDED(enc->CreateNewFrame(&fe, nullptr)) && SUCCEEDED(fe->Initialize(nullptr))) {+ fe->SetSize((UINT)(W * sc), (UINT)(H * sc));+ WICPixelFormatGUID pf = GUID_WICPixelFormat32bppPBGRA; fe->SetPixelFormat(&pf);+ ok = SUCCEEDED(fe->WriteSource(bmp, nullptr)) && SUCCEEDED(fe->Commit()) && SUCCEEDED(enc->Commit());+ } else ok = false;+ if (fe) fe->Release(); if (enc) enc->Release(); if (st) st->Release();+ }+ if (rt) rt->Release(); if (bmp) bmp->Release(); if (wic) wic->Release(); if (f) f->Release();+ Log(L"desenho: %ls %ls", path.c_str(), ok ? L"gravado" : L"FALHOU");+ g_sk = Sketch{};+ if (ok) editor::InsertAttachment(path);+ FocusEditor();+ Invalidate();+}++bool SketchMouse(UINT m, D2D1_POINT_2F p) { // true: a folha de desenho tratou+ if (!g_sk.on) return false;+ SketchLayout();+ D2D1_POINT_2F q{ p.x - g_sk.canvas.left, p.y - g_sk.canvas.top };+ if (m == WM_LBUTTONDOWN) {+ if (In(g_sk.canvas, p)) { Sketch::Stroke s; s.color = g_sk.color; s.pts.push_back(q); g_sk.strokes.push_back(s); g_sk.drawing = true; SetCapture(g_hwnd); }+ else if (In(g_sk.bUndo, p)) { if (!g_sk.strokes.empty()) g_sk.strokes.pop_back(); }+ else if (In(g_sk.bClear, p)) g_sk.strokes.clear();+ else if (In(g_sk.bCancel, p)) { g_sk = Sketch{}; FocusEditor(); }+ else if (In(g_sk.bInsert, p)) SketchInsert();+ else for (int k = 0; k < 5; k++) if (In(g_sk.sw[k], p)) g_sk.color = k;+ } else if (m == WM_MOUSEMOVE && g_sk.drawing && !g_sk.strokes.empty()) {+ auto& v = g_sk.strokes.back().pts;+ q.x = std::clamp(q.x, 0.f, g_sk.canvas.right - g_sk.canvas.left); q.y = std::clamp(q.y, 0.f, g_sk.canvas.bottom - g_sk.canvas.top);+ if (std::hypot(q.x - v.back().x, q.y - v.back().y) >= 0.8f) v.push_back(q);+ } else if (m == WM_LBUTTONUP) { g_sk.drawing = false; if (GetCapture() == g_hwnd) ReleaseCapture(); }+ Invalidate();+ return true;+}+void ClickButton(int b) {switch (b) {case B_SIDEBAR: ToggleSidebar(); break;@@ -1297,6 +1510,10 @@ void ClickButton(int b) {case B_COMPOSE: NewNoteCmd(); break;case B_FORMAT: g_fmtOpen = !g_fmtOpen; if (g_fmtOpen) { g_focus = F_EDITOR; editor::Focus(true); } break;case B_CHECK: editor::ToggleList(L_CHECK); g_focus = F_EDITOR; editor::Focus(true); break;+ case B_TABLE: TableCmd(); break;+ case B_ATTACH: case B_MEDIA: AttachCmd(); break;+ case B_MARKUP: if (editor::Current()) { g_sk = Sketch{}; g_sk.on = true; editor::Focus(false); } break;+ case B_WRITING: WritingMenu(); break;case B_SEARCH: OpenSearch(); break;case B_FOLDER: NewFolderCmd(); break;case B_EDMORE: { // macOS 26: o "⋯" do editor junta o que não coube na barra (fixar, cadeado, colaborar, áudio)@@ -1497,6 +1714,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {}case WM_MOUSEMOVE: {D2D1_POINT_2F p{ GET_X_LPARAM(l) / g_scale, GET_Y_LPARAM(l) / g_scale };+ if (SketchMouse(m, p)) return 0;TRACKMOUSEEVENT t{ sizeof(t), TME_LEAVE, h, 0 }; TrackMouseEvent(&t);if (g_divDrag) {if (g_divDrag == 1) g_sideW = std::round(std::clamp(p.x, SIDE_MIN, SIDE_MAX));@@ -1533,6 +1751,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {case WM_MOUSELEAVE: ampliacao::Verde(h, false); if (g_hoverBtn >= 0 || g_hoverLights) { g_hoverBtn = -1; g_hoverLights = false; Invalidate(); } return 0;case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: {D2D1_POINT_2F p{ GET_X_LPARAM(l) / g_scale, GET_Y_LPARAM(l) / g_scale };+ if (SketchMouse(WM_LBUTTONDOWN, p)) return 0;POINT raw{ GET_X_LPARAM(l), GET_Y_LPARAM(l) };DWORD now = GetTickCount();if (now - g_lastClick <= GetDoubleClickTime() && std::abs(raw.x - g_lastClickPt.x) < 5 && std::abs(raw.y - g_lastClickPt.y) < 5) g_clicks++;@@ -1631,6 +1850,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {}case WM_LBUTTONUP: {D2D1_POINT_2F p{ GET_X_LPARAM(l) / g_scale, GET_Y_LPARAM(l) / g_scale };+ if (SketchMouse(m, p)) return 0;if (GetCapture() == h) ReleaseCapture();if (g_divDrag) { g_divDrag = 0; SaveSoon(); return 0; }if (g_pressBtn >= 0) { int b = g_pressBtn; g_pressBtn = -1; if (HitBtn(p) == b) ClickButton(b); Invalidate(); return 0; }@@ -1673,6 +1893,13 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {}case WM_KEYDOWN: case WM_SYSKEYDOWN: {bool ctrl = GetKeyState(VK_CONTROL) < 0, shift = GetKeyState(VK_SHIFT) < 0, alt = GetKeyState(VK_MENU) < 0;+ if (g_sk.on) { // folha de desenho: Esc cancela, Enter insere, Ctrl+Z desfaz o último traço+ if (w == VK_ESCAPE) { g_sk = Sketch{}; FocusEditor(); }+ else if (w == VK_RETURN) SketchInsert();+ else if (ctrl && w == 'Z' && !g_sk.strokes.empty()) g_sk.strokes.pop_back();+ Invalidate();+ return 0;+ }if (g_sheet.on) {if (w == VK_ESCAPE) g_sheet = Sheet{};else if (w == VK_RETURN) { auto act = g_sheet.act; g_sheet = Sheet{}; if (act) act(); }@@ -1751,7 +1978,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {return 0;}case WM_CHAR:- if (g_sheet.on) return 0;+ if (g_sheet.on || g_sk.on) return 0;if (g_focus == F_RENAME) { if (w >= 32) g_rename.OnChar((wchar_t)w); Invalidate(); return 0; }if (g_focus == F_SEARCH) { if (w >= 32 && w != 127) { g_search.OnChar((wchar_t)w); SearchChanged(); } Invalidate(); return 0; }if (g_focus == F_EDITOR) {@@ -1907,6 +2134,58 @@ int Capture(const std::wstring& out, int noteIdx, bool aa) {else g_focus = g_capListFocus ? F_LIST : F_EDITOR;editor::Focus(g_focus == F_EDITOR);if (g_sel && g_focus == F_EDITOR) editor::PlaceCaretAtEnd();+ // --acoes=a;b;c (separadas por ;): tabela, linha, coluna, apaga-linha, apaga-coluna, texto (tabela->texto),+ // revisar, lista, em-tabela, maiusc, minusc, iniciais, tudo (selecionar tudo), inicio, anexo:<arquivo>,+ // digitar:<texto> ("\t" = Tab, "\n" = Enter, "\b" = Backspace), desenho:<n> (n traços de teste e Inserir)+ for (size_t a = 0; a < g_capActions.size();) {+ size_t e = g_capActions.find(L';', a); if (e == std::wstring::npos) e = g_capActions.size();+ std::wstring c = g_capActions.substr(a, e - a); a = e + 1;+ if (c == L"tabela") editor::InsertTable(2, 2);+ else if (c == L"linha") editor::Table(editor::T_ADD_ROW);+ else if (c == L"coluna") editor::Table(editor::T_ADD_COL);+ else if (c == L"apaga-linha") editor::Table(editor::T_DEL_ROW);+ else if (c == L"apaga-coluna") editor::Table(editor::T_DEL_COL);+ else if (c == L"texto") editor::Table(editor::T_TO_TEXT);+ else if (c == L"revisar") editor::Transform(editor::W_PROOF);+ else if (c == L"lista") editor::Transform(editor::W_LIST);+ else if (c == L"em-tabela") editor::Transform(editor::W_TABLE);+ else if (c == L"maiusc") editor::Transform(editor::W_UPPER);+ else if (c == L"minusc") editor::Transform(editor::W_LOWER);+ else if (c == L"iniciais") editor::Transform(editor::W_TITLE);+ else if (c == L"tudo") editor::SelectAll();+ else if (c == L"gravar") store::SaveAllDirty();+ else if (c == L"inicio") { editor::OnKey(VK_HOME); }+ else if (c.rfind(L"anexo:", 0) == 0) editor::InsertAttachment(store::AddAttachment(c.substr(6)));+ else if (c.rfind(L"folha:", 0) == 0) { // a folha de desenho aberta com n traços (para a foto)+ g_sk = Sketch{}; g_sk.on = true; SketchLayout();+ for (int k = 0; k < _wtoi(c.substr(6).c_str()); k++) {+ Sketch::Stroke s; s.color = k % 5;+ for (int t = 0; t <= 50; t++) s.pts.push_back({ 30.f + t * 10.f, 50.f + k * 40 + 30 * std::sin(t / 5.f) });+ g_sk.strokes.push_back(s);+ }+ }+ else if (c.rfind(L"desenho:", 0) == 0) {+ g_hwnd = nullptr; g_sk = Sketch{}; g_sk.on = true;+ float W = g_capSize.width, H = g_capSize.height;+ g_sk.canvas = { (W - 600) / 2, 100, (W + 600) / 2, H - 100 };+ for (int k = 0; k < _wtoi(c.substr(8).c_str()); k++) {+ Sketch::Stroke s; s.color = k % 5;+ for (int t = 0; t <= 40; t++) s.pts.push_back({ 40.f + t * 9.f, 60.f + k * 30 + 25 * std::sin(t / 4.f) });+ g_sk.strokes.push_back(s);+ }+ SketchInsert();+ }+ else if (c.rfind(L"digitar:", 0) == 0) {+ std::wstring t = c.substr(8);+ for (size_t k = 0; k < t.size(); k++) {+ if (t[k] == L'\\' && k + 1 < t.size()) {+ wchar_t n = t[++k];+ if (n == L't') editor::OnKey(VK_TAB); else if (n == L'n') editor::OnChar(L'\r'); else if (n == L'b') editor::OnKey(VK_BACK);+ } else editor::OnChar(t[k]);+ }+ }+ Log(L"acao: %ls", c.c_str());+ }dc->BeginDraw();// "papel de parede" + o acrílico da barra lateral (simulado)ID2D1GradientStopCollection* stops = nullptr;@@ -1964,7 +2243,8 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int show) {else if (auto v5 = val(L"--nota="); v5 != L"\x01") capNote = _wtoi(v5.c_str());else if (s == L"--galeria") g_gallery = true;else if (s == L"--aa") capAa = true;- else if (s == L"--foco-lista") g_capListFocus = true; // como na foto de referência: nota escolhida em amarelo+ else if (s == L"--foco-lista") g_capListFocus = true;+ else if (auto v8 = val(L"--acoes="); v8 != L"\x01") g_capActions = v8; // como na foto de referência: nota escolhida em amareloelse if (auto v7 = val(L"--larguras="); v7 != L"\x01") swscanf_s(v7.c_str(), L"%f,%f", &g_sideW, &g_listW);else if (s == L"--sem-lateral") g_sideHidden = true;else if (s == L"--nota-rapida") g_quick = true;diff --git a/src/notas/notas.h b/src/notas/notas.hindex 8c3efce..81aa23c 100644--- a/src/notas/notas.h+++ b/src/notas/notas.h@@ -19,11 +19,17 @@ inline int HiOf(uint8_t a) { return (a >> 4) & 7; }inline uint8_t WithHi(uint8_t a, int h) { return (uint8_t)((a & 0x0F) | ((h & 7) << 4)); }const int HI_COUNT = 5; // roxo, rosa, laranja, menta, azul (Sequoia)+// tipo do parágrafo: texto comum, linha de tabela (células separadas por TAB) ou anexo (arquivo/imagem/desenho em `src`,+// sem texto). Gravado como 6º número do cabeçalho; versões antigas leem só 5 e mostram o anexo como o caminho.+enum Kind : uint8_t { K_TEXT, K_ROW, K_FILE };+struct Para {std::wstring text;std::vector<uint8_t> at; // um por caractereuint8_t style = S_BODY, list = L_NONE, indent = 0;bool checked = false, collapsed = false;+ uint8_t kind = K_TEXT;+ std::wstring src; // K_FILE: caminho do arquivo (cópia em Notasnexos)};struct Note {@@ -67,6 +73,8 @@ std::wstring FolderName(const std::wstring& id);ULONGLONG Now();std::wstring Serialize(const std::vector<Para>& ps);std::vector<Para> Deserialize(const std::wstring& s);+std::wstring AttachDir(); // Notasnexos (criada se faltar)+std::wstring AddAttachment(const std::wstring& path); // copia para anexos; devolve o caminho novo ("" se falhou)}// ---- Notas Matemáticas: resultado depois de "=" e variáveis destacadas@@ -109,6 +117,14 @@ int CurrentList();uint8_t CurrentAttrs();void SelectAll();void PlaceCaretAtEnd();+// tabela, anexos e Ferramentas de Escrita (botões da barra do macOS 26/27)+void InsertTable(int rows, int cols);+void InsertAttachment(const std::wstring& path);+enum Writing { W_PROOF, W_LIST, W_TABLE, W_UPPER, W_LOWER, W_TITLE };+bool Transform(int kind); // false: nada mudou+bool InTable();+enum TableOp { T_ADD_ROW, T_ADD_COL, T_DEL_ROW, T_DEL_COL, T_TO_TEXT };+void Table(int op); // com o cursor numa tabelavoid Undo();void Redo();void CaretScreenRect(D2D1_RECT_F& r); // em DIPs (para o IME)