@@ -151,7 +151,7 @@ makeSidebarMenuContent[ sidebarCell_CellObject, nbObj_NotebookObject ] := Enclos
151151 "Type" -> "Custom" ,
152152 "Content" -> Pane [ makeAutomaticResultAnalysisCheckboxSidebar @ nbObj , ImageMargins -> { { 5 , 5 }, { 2.5 , 2.5 } } ],
153153 "ResetAction" :> (CurrentValue [ nbObj , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ] = Inherited ),
154- "ResetCondition" :> (AbsoluteCurrentValue [ nbObj , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ] =!= Inherited )
154+ "ResetCondition" :> (CurrentValue [ nbObj , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ] =!= Inherited )
155155 |> },
156156 items ];
157157
@@ -468,42 +468,54 @@ SetFallthroughError[makeAutomaticResultAnalysisCheckboxSidebar]
468468(* the side bar changes the notebook-level setting regardless of the $FrontEndSession value *)
469469makeAutomaticResultAnalysisCheckboxSidebar [ nbo_ NotebookObject ] :=
470470Pane [ # , FrameMargins -> { { 0 , 0 }, { 7 , 7 } } ]& @
471- DynamicModule [ { value = TrueQ @ initialValue },
472- Row [
473- {
474- Checkbox [
475- Dynamic [ value , Function [ value = # ; CurrentValue [ nbo , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ] = # ] ],
476- {False , True }
477- ],
478- Spacer [3 ],
479- EventHandler [
480- Style [
471+ DynamicModule [ { value , mouseover = False },
472+ DynamicWrapper [
473+ Row [
474+ {
475+ EventHandler [
481476 Row [
482477 {
483- FrontEndResource [ "ChatbookStrings" , "UIAutomaticAnalysisLabel" ],
478+ Checkbox [
479+ Dynamic [ value , Function [ Null (* let the EventHandler control the click action *) ] ],
480+ {False , True }
481+ ],
484482 Spacer [ 3 ],
485- Tooltip [ chatbookIcon [ "InformationTooltip" , False ], FrontEndResource [ "ChatbookStrings" , "UIAutomaticAnalysisTooltip" ] ]
483+ Style [
484+ FrontEndResource [ "ChatbookStrings" , "UIAutomaticAnalysisLabel" ],
485+ FontColor -> (Dynamic [ If [ mouseover , #1 , #2 ] ]& [
486+ LightDarkSwitched [ RGBColor [ "#2FA7DC" ], RGBColor [ "#87D0F9" ] ], (* should these move to ColorData? *)
487+ LightDarkSwitched [ GrayLevel [ 0.2 ], GrayLevel [ 0.9613 ] ]
488+ ])]
489+ },
490+ BaseStyle -> {
491+ "Text" ,
492+ FontFamily -> "Source Sans Pro" ,
493+ FontSize -> 12 ,
494+ FontSlant -> Plain ,
495+ CheckboxBoxOptions -> { ImageMargins -> 0 }
486496 },
487- "\[ NoBreak]" ,
488497 StripOnInput -> True
489498 ],
490- FontColor -> (Dynamic [ If [ CurrentValue [ "MouseOver" ], #1 , #2 ] ]& [
491- LightDarkSwitched [ RGBColor [ "#2FA7DC" ], RGBColor [ "#87D0F9" ] ],
492- LightDarkSwitched [ GrayLevel [ 0.2 ], GrayLevel [ 0.9613 ] ]
493- ])
499+ {
500+ "MouseEntered" :> (mouseover = True ),
501+ "MouseExited" :> (mouseover = False ),
502+ "MouseClicked" :> (CurrentValue [ nbo , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ] = value = ! value )
503+ },
504+ PassEventsDown -> True
494505 ],
495- "MouseClicked" :> (CurrentValue [ nbo , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ] = value = ! value )
496- ]
497- },
498- BaseStyle -> {
499- "Text" ,
500- FontFamily -> "Source Sans Pro" ,
501- FontSize -> 12 ,
502- FontSlant -> Plain ,
503- CheckboxBoxOptions -> { ImageMargins -> 0 },
504- LineBreakWithin -> False
505- },
506- StripOnInput -> True
506+ Tooltip [ chatbookIcon [ "InformationTooltip" , False ], FrontEndResource [ "ChatbookStrings" , "UIAutomaticAnalysisTooltip" ] ]
507+ },
508+ "\[ NoBreak]" ,
509+ BaseStyle -> { LineBreakWithin -> False },
510+ StripOnInput -> True
511+ ],
512+ value = (* no need to go through the slow AbsoluteCurrentChatSettings for resolving this state *)
513+ If [# === Inherited ,
514+ TrueQ @ CurrentValue [ $FrontEndSession , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ]
515+ ,
516+ TrueQ @ #
517+ ]& @ CurrentValue [ nbo , { TaggingRules , "ChatNotebookSettings" , "Assistance" } ],
518+ TrackedSymbols :> {}
507519 ]
508520
509521]
0 commit comments