diff --git a/Developer/StylesheetBuilder.wl b/Developer/StylesheetBuilder.wl index ddd8c0b3..8f2e5bb5 100644 --- a/Developer/StylesheetBuilder.wl +++ b/Developer/StylesheetBuilder.wl @@ -573,29 +573,71 @@ $chatDelimiterCellDingbat = Wolfram`Chatbook`UI`MakeChatDelimiterCellDingbat[ (* ::Subsection::Closed:: *) (*Cell Insertion Point Cell*) -$cellInsertionPointCell := $cellInsertionPointCell = ReplaceAll[ - FrontEndResource[ "FEExpressions", "CellInsertionMenu" ], - { - PaneSelectorBox[ - args: { - True -> StyleBox[ - DynamicBox[ FEPrivate`FrontEndResource[ "CellInsertionMenu", "TextStyle2Mac" ], ___ ], - ___ - ], - ___ - }, - True|False, - opts___ - ] :> PaneSelectorBox[ args, Dynamic[ $OperatingSystem === "MacOSX" ], opts ] - , - item: HoldPattern[ _ :> FrontEndTokenExecute[ EvaluationNotebook[ ], "Style", "ExternalLanguage" ] ] :> - Sequence[ - item, - insertionPointMenuItem[ TemplateBox[ { }, "ChatInputIcon" ], trBox[ "StylesheetInsertionMenuChatInput" ], "'", "ChatInput" ], - insertionPointMenuItem[ TemplateBox[ { }, "SideChatIcon" ], trBox[ "StylesheetInsertionMenuSideChat" ], "''", "SideChat" ] - ] - } -]; + +(* +The cell structures used by the cell insertion point cell in the 14.2 FE are +significantly different than in 14.1 and earlier FEs. Also note that 14.2 FEs +already have chat-related styles in its insertion menu, so this menu re-ordering +and additions won't be necessary starting in 14.2. + +Because of that, when the code below is run in 14.2 or later FEs, +$cellInsertionPointCell will be set to Inherited. And the 14.1-specific code can +be very particular about what the boxes actually look like. +*) + + +$cellInsertionPointCell := $cellInsertionPointCell = +If[BoxForm`sufficientVersionQ[14.2], Inherited, + ReplaceAll[ + reorderAndAddMenuItems[ FrontEndResource[ "FEExpressions", "CellInsertionMenu" ] ], + { + PaneSelectorBox[ + args: { + True -> StyleBox[ + DynamicBox[ FEPrivate`FrontEndResource[ "CellInsertionMenu", "TextStyle2Mac" ], ___ ], + ___ + ], + ___ + }, + True|False, + opts___ + ] :> PaneSelectorBox[ args, Dynamic[ $OperatingSystem === "MacOSX" ], opts ] + } + ] +] + + +reorderAndAddMenuItems[boxexpr_] := +ReplaceAll[ boxexpr, ActionMenuBox[label_, items_, rest___] :> + ActionMenuBox[ + label, + Replace[items, + { + input: (_ :> FrontEndTokenExecute[EvaluationNotebook[], "Style", "Input"]), + Delimiter, + washort: (_ :> FrontEndTokenExecute[EvaluationNotebook[], "Style", "WolframAlphaShort"]), + walong: (_ :> FrontEndTokenExecute[EvaluationNotebook[], "Style", "WolframAlphaLong"]), + ext: (_ :> FrontEndTokenExecute[EvaluationNotebook[], "Style", "ExternalLanguage"]), + Delimiter, + text: (_ :> FrontEndTokenExecute[EvaluationNotebook[], "Style", "Text"]), + other: (_ :> FrontEndTokenExecute[EvaluationNotebook[], "StyleOther"]) + } :> + { + input, + text, + other, + Delimiter, + insertionPointMenuItem[ TemplateBox[ { }, "ChatInputIcon" ], trBox[ "StylesheetInsertionMenuChatInput" ], "'", "ChatInput" ], + insertionPointMenuItem[ TemplateBox[ { }, "SideChatIcon" ], trBox[ "StylesheetInsertionMenuChatBreak" ], "~", "ChatDelimiter" ], + Delimiter, + washort, + walong, + ext + } + ], + rest + ] +] insertionPointMenuItem // Attributes = { HoldRest }; diff --git a/FrontEnd/StyleSheets/Chatbook.nb b/FrontEnd/StyleSheets/Chatbook.nb index 81f62d6f..1e308701 100644 --- a/FrontEnd/StyleSheets/Chatbook.nb +++ b/FrontEnd/StyleSheets/Chatbook.nb @@ -117,16 +117,12 @@ Notebook[ "Style", "Input" ], - Delimiter, GridBox[ { { PaneBox[ DynamicBox[ - FEPrivate`FrontEndResource[ - "FEBitmaps", - "InsertionFreeform" - ] + FEPrivate`FrontEndResource["FEBitmaps", "InsertionText"] ], BaselinePosition -> Center -> Scaled[0.55] ], @@ -134,20 +130,37 @@ Notebook[ DynamicBox[ FEPrivate`FrontEndResource[ "CellInsertionMenu", - "FreeformInput" + "TextStyle" ] ], "CellInsertionMenu" ], StyleBox[ - StyleBox[ - DynamicBox[ - FEPrivate`FrontEndResource[ - "CellInsertionMenu", - "FreeformInput2" - ] - ], - "CellInsertionMenuShortcut" + PaneSelectorBox[ + { + True -> + StyleBox[ + DynamicBox[ + FEPrivate`FrontEndResource[ + "CellInsertionMenu", + "TextStyle2Mac" + ] + ], + "CellInsertionMenuStyleShortcutLabel" + ], + False -> + StyleBox[ + DynamicBox[ + FEPrivate`FrontEndResource[ + "CellInsertionMenu", + "TextStyle2" + ] + ], + "CellInsertionMenuStyleShortcutLabel" + ] + }, + Dynamic[$OperatingSystem === "MacOSX"], + ImageSize -> {Automatic, Automatic} ], "CellInsertionMenuShortcut" ] @@ -207,30 +220,32 @@ Notebook[ "Rows" -> {{0}} } ] :> - FrontEndTokenExecute[ - EvaluationNotebook[], - "Style", - "WolframAlphaShort" - ], + FrontEndTokenExecute[EvaluationNotebook[], "Style", "Text"], GridBox[ { { PaneBox[ DynamicBox[ - FEPrivate`FrontEndResource["FEBitmaps", "InsertionAlpha"] + FEPrivate`FrontEndResource["FEBitmaps", "InsertionOther"] ], BaselinePosition -> Center -> Scaled[0.55] ], StyleBox[ DynamicBox[ - FEPrivate`FrontEndResource["CellInsertionMenu", "WAQuery"] + FEPrivate`FrontEndResource[ + "CellInsertionMenu", + "OtherStyle" + ] ], "CellInsertionMenu" ], StyleBox[ StyleBox[ DynamicBox[ - FEPrivate`FrontEndResource["CellInsertionMenu", "WAQuery2"] + FEPrivate`FrontEndResource[ + "CellInsertionMenu", + "OtherStyle2" + ] ], "CellInsertionMenuShortcut" ], @@ -292,42 +307,26 @@ Notebook[ "Rows" -> {{0}} } ] :> - FrontEndTokenExecute[ - EvaluationNotebook[], - "Style", - "WolframAlphaLong" - ], + FrontEndTokenExecute[EvaluationNotebook[], "StyleOther"], + Delimiter, GridBox[ { { PaneBox[ - DynamicBox[ - FEPrivate`FrontEndResource[ - "FEBitmaps", - "InsertionExternal" - ] - ], + TemplateBox[{}, "ChatInputIcon"], BaselinePosition -> Center -> Scaled[0.55] ], StyleBox[ DynamicBox[ FEPrivate`FrontEndResource[ - "CellInsertionMenu", - "ExternalLanguageInput" + "ChatbookStrings", + "StylesheetInsertionMenuChatInput" ] ], "CellInsertionMenu" ], StyleBox[ - StyleBox[ - DynamicBox[ - FEPrivate`FrontEndResource[ - "CellInsertionMenu", - "ExternalLanguageInput2" - ] - ], - "CellInsertionMenuShortcut" - ], + StyleBox["'", "CellInsertionMenuShortcut"], "CellInsertionMenuShortcut" ] } @@ -389,26 +388,26 @@ Notebook[ FrontEndTokenExecute[ EvaluationNotebook[], "Style", - "ExternalLanguage" + "ChatInput" ], GridBox[ { { PaneBox[ - TemplateBox[{}, "ChatInputIcon"], + TemplateBox[{}, "SideChatIcon"], BaselinePosition -> Center -> Scaled[0.55] ], StyleBox[ DynamicBox[ FEPrivate`FrontEndResource[ "ChatbookStrings", - "StylesheetInsertionMenuChatInput" + "StylesheetInsertionMenuChatBreak" ] ], "CellInsertionMenu" ], StyleBox[ - StyleBox["'", "CellInsertionMenuShortcut"], + StyleBox["~", "CellInsertionMenuShortcut"], "CellInsertionMenuShortcut" ] } @@ -470,26 +469,40 @@ Notebook[ FrontEndTokenExecute[ EvaluationNotebook[], "Style", - "ChatInput" + "ChatDelimiter" ], + Delimiter, GridBox[ { { PaneBox[ - TemplateBox[{}, "SideChatIcon"], + DynamicBox[ + FEPrivate`FrontEndResource[ + "FEBitmaps", + "InsertionFreeform" + ] + ], BaselinePosition -> Center -> Scaled[0.55] ], StyleBox[ DynamicBox[ FEPrivate`FrontEndResource[ - "ChatbookStrings", - "StylesheetInsertionMenuSideChat" + "CellInsertionMenu", + "FreeformInput" ] ], "CellInsertionMenu" ], StyleBox[ - StyleBox["''", "CellInsertionMenuShortcut"], + StyleBox[ + DynamicBox[ + FEPrivate`FrontEndResource[ + "CellInsertionMenu", + "FreeformInput2" + ] + ], + "CellInsertionMenuShortcut" + ], "CellInsertionMenuShortcut" ] } @@ -551,53 +564,29 @@ Notebook[ FrontEndTokenExecute[ EvaluationNotebook[], "Style", - "SideChat" + "WolframAlphaShort" ], - Delimiter, GridBox[ { { PaneBox[ DynamicBox[ - FEPrivate`FrontEndResource["FEBitmaps", "InsertionText"] + FEPrivate`FrontEndResource["FEBitmaps", "InsertionAlpha"] ], BaselinePosition -> Center -> Scaled[0.55] ], StyleBox[ DynamicBox[ - FEPrivate`FrontEndResource[ - "CellInsertionMenu", - "TextStyle" - ] + FEPrivate`FrontEndResource["CellInsertionMenu", "WAQuery"] ], "CellInsertionMenu" ], StyleBox[ - PaneSelectorBox[ - { - True -> - StyleBox[ - DynamicBox[ - FEPrivate`FrontEndResource[ - "CellInsertionMenu", - "TextStyle2Mac" - ] - ], - "CellInsertionMenuStyleShortcutLabel" - ], - False -> - StyleBox[ - DynamicBox[ - FEPrivate`FrontEndResource[ - "CellInsertionMenu", - "TextStyle2" - ] - ], - "CellInsertionMenuStyleShortcutLabel" - ] - }, - Dynamic[$OperatingSystem === "MacOSX"], - ImageSize -> {Automatic, Automatic} + StyleBox[ + DynamicBox[ + FEPrivate`FrontEndResource["CellInsertionMenu", "WAQuery2"] + ], + "CellInsertionMenuShortcut" ], "CellInsertionMenuShortcut" ] @@ -657,13 +646,20 @@ Notebook[ "Rows" -> {{0}} } ] :> - FrontEndTokenExecute[EvaluationNotebook[], "Style", "Text"], + FrontEndTokenExecute[ + EvaluationNotebook[], + "Style", + "WolframAlphaLong" + ], GridBox[ { { PaneBox[ DynamicBox[ - FEPrivate`FrontEndResource["FEBitmaps", "InsertionOther"] + FEPrivate`FrontEndResource[ + "FEBitmaps", + "InsertionExternal" + ] ], BaselinePosition -> Center -> Scaled[0.55] ], @@ -671,7 +667,7 @@ Notebook[ DynamicBox[ FEPrivate`FrontEndResource[ "CellInsertionMenu", - "OtherStyle" + "ExternalLanguageInput" ] ], "CellInsertionMenu" @@ -681,7 +677,7 @@ Notebook[ DynamicBox[ FEPrivate`FrontEndResource[ "CellInsertionMenu", - "OtherStyle2" + "ExternalLanguageInput2" ] ], "CellInsertionMenuShortcut" @@ -744,7 +740,11 @@ Notebook[ "Rows" -> {{0}} } ] :> - FrontEndTokenExecute[EvaluationNotebook[], "StyleOther"] + FrontEndTokenExecute[ + EvaluationNotebook[], + "Style", + "ExternalLanguage" + ] }, Appearance -> None ], @@ -824,7 +824,7 @@ Notebook[ ], Cell[ StyleData["ChatStyleSheetInformation"], - TaggingRules -> <|"StyleSheetVersion" -> "1.5.2.3940599860"|> + TaggingRules -> <|"StyleSheetVersion" -> "1.5.2.3940939112"|> ], Cell[ StyleData["NotebookAssistant`Text"], diff --git a/FrontEnd/TextResources/ChatbookStrings.tr b/FrontEnd/TextResources/ChatbookStrings.tr index 669f32bd..c1cb1776 100644 --- a/FrontEnd/TextResources/ChatbookStrings.tr +++ b/FrontEnd/TextResources/ChatbookStrings.tr @@ -181,6 +181,7 @@ "StylesheetToggleFormatting" -> "Toggle Formatting", "StylesheetCopyChatObject" -> "Copy ChatObject", "StylesheetInsertionMenuChatInput" -> "Chat Input", +"StylesheetInsertionMenuChatBreak" -> "Chat Break", "StylesheetInsertionMenuSideChat" -> "Side Chat", "StylesheetContextMenuIncludeExclude" -> "Include/Exclude From AI Chat", diff --git a/FrontEnd/TextResources/ChineseSimplified/ChatbookStrings.tr b/FrontEnd/TextResources/ChineseSimplified/ChatbookStrings.tr index b1e8c055..969b69a7 100644 --- a/FrontEnd/TextResources/ChineseSimplified/ChatbookStrings.tr +++ b/FrontEnd/TextResources/ChineseSimplified/ChatbookStrings.tr @@ -181,6 +181,7 @@ "StylesheetToggleFormatting" -> "\:5207\:6362\:683C\:5F0F", "StylesheetCopyChatObject" -> "\:590D\:5236 ChatObject", "StylesheetInsertionMenuChatInput" -> "\:804A\:5929\:8F93\:5165", +"StylesheetInsertionMenuChatBreak" -> "Chat Break", "StylesheetInsertionMenuSideChat" -> "\:79C1\:804A", "StylesheetContextMenuIncludeExclude" -> "\:4ECE AI \:804A\:5929\:4E2D\:5305\:542B/\:6392\:9664", diff --git a/FrontEnd/TextResources/ChineseTraditional/ChatbookStrings.tr b/FrontEnd/TextResources/ChineseTraditional/ChatbookStrings.tr index e92b19ea..2767e1ef 100644 --- a/FrontEnd/TextResources/ChineseTraditional/ChatbookStrings.tr +++ b/FrontEnd/TextResources/ChineseTraditional/ChatbookStrings.tr @@ -181,6 +181,7 @@ "StylesheetToggleFormatting" ->"\:96D9\:614B\:89F8\:8B8A\:683C\:5F0F\:5316\:4E2D", "StylesheetCopyChatObject" -> "\:8907\:88FD ChatObject", "StylesheetInsertionMenuChatInput" -> "\:7DB2\:8DEF\:804A\:5929\:7CFB\:7D71\:8F38\:5165", +"StylesheetInsertionMenuChatBreak" -> "Chat Break", "StylesheetInsertionMenuSideChat" -> "Side Chat \:FF08\:585E\:6390\:FF09", "StylesheetContextMenuIncludeExclude" -> "\:5F9E AI \:804A\:5929\:7CFB\:7D71\:7B97\:5165/\:9010\:51FA", diff --git a/FrontEnd/TextResources/French/ChatbookStrings.tr b/FrontEnd/TextResources/French/ChatbookStrings.tr index de606a37..70dc8ab6 100644 --- a/FrontEnd/TextResources/French/ChatbookStrings.tr +++ b/FrontEnd/TextResources/French/ChatbookStrings.tr @@ -181,6 +181,7 @@ "StylesheetToggleFormatting" -> "Basculer la mise en forme", "StylesheetCopyChatObject" -> "Copier l\[CloseCurlyQuote]objet de Chat", "StylesheetInsertionMenuChatInput" -> "Entr\[EAcute]e de chat", +"StylesheetInsertionMenuChatBreak" -> "Chat Break", "StylesheetInsertionMenuSideChat" -> "Chat lat\[EAcute]ral", "StylesheetContextMenuIncludeExclude" -> "Inclure/exclure du chat IA", diff --git a/FrontEnd/TextResources/Japanese/ChatbookStrings.tr b/FrontEnd/TextResources/Japanese/ChatbookStrings.tr index 288cf663..00b044f1 100644 --- a/FrontEnd/TextResources/Japanese/ChatbookStrings.tr +++ b/FrontEnd/TextResources/Japanese/ChatbookStrings.tr @@ -181,6 +181,7 @@ "StylesheetToggleFormatting" -> "\:66f8\:5f0f\:8a2d\:5b9a\:3092\:5207\:308a\:66ff\:3048\:308b", "StylesheetCopyChatObject" -> "ChatObject\:3092\:30b3\:30d4\:30fc\:3059\:308b", "StylesheetInsertionMenuChatInput" -> "\:30c1\:30e3\:30c3\:30c8\:5165\:529b", +"StylesheetInsertionMenuChatBreak" -> "Chat Break", "StylesheetInsertionMenuSideChat" -> "\:30b5\:30a4\:30c9\:30c1\:30e3\:30c3\:30c8", "StylesheetContextMenuIncludeExclude" -> "AI\:30C1\:30E3\:30C3\:30C8\:304B\:3089\:306E\:3082\:306E\:3092\:542B\:3080\:FF0F\:542B\:307E\:306A\:3044", diff --git a/FrontEnd/TextResources/Korean/ChatbookStrings.tr b/FrontEnd/TextResources/Korean/ChatbookStrings.tr index 30781abb..d5aa59f2 100644 --- a/FrontEnd/TextResources/Korean/ChatbookStrings.tr +++ b/FrontEnd/TextResources/Korean/ChatbookStrings.tr @@ -182,6 +182,7 @@ "StylesheetToggleFormatting" -> "\:C11C\:C2DD \:C124\:C815 \:C804\:D658", "StylesheetCopyChatObject" -> "ChatObject \:BCF5\:C0AC", "StylesheetInsertionMenuChatInput" -> "\:CC44\:D305 \:C785\:B825", +"StylesheetInsertionMenuChatBreak" -> "Chat Break", "StylesheetInsertionMenuSideChat" -> "\:C0AC\:C774\:B4DC \:CC44\:D305", "StylesheetContextMenuIncludeExclude" -> "AI \:CC44\:D305\:C5D0\:C11C \:C624\:B294 \:AC83\:C744 \:D3EC\:D568/\:C81C\:C678", diff --git a/FrontEnd/TextResources/Spanish/ChatbookStrings.tr b/FrontEnd/TextResources/Spanish/ChatbookStrings.tr index 7c1aa163..090a52b3 100644 --- a/FrontEnd/TextResources/Spanish/ChatbookStrings.tr +++ b/FrontEnd/TextResources/Spanish/ChatbookStrings.tr @@ -181,6 +181,7 @@ "StylesheetToggleFormatting" -> "Activar formato", "StylesheetCopyChatObject" -> "Copiar ChatObject", "StylesheetInsertionMenuChatInput" -> "Entrada de chat", +"StylesheetInsertionMenuChatBreak" -> "Chat Break", "StylesheetInsertionMenuSideChat" -> "Chat lateral", "StylesheetContextMenuIncludeExclude" -> "Incluir/excluir del Asistente de chat",