Skip to content

Commit

Permalink
Pull request #91: Bugfix/NA DockedCellChanges tweaks
Browse files Browse the repository at this point in the history
Merge in PAC/chatbook from bugfix/NA_DockedCellChanges_tweaks to main

* commit '9342443312c3ea4441db457d3a4b9b7cc4d0fcce':
  Adjust NA toolbar margins
  Add BaselinePosition to NA toolbar icons
  • Loading branch information
Kevin Daily authored and rhennigan committed Nov 20, 2024
2 parents 259d75e + 9342443 commit 5ffe702
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ RawBoxes @ ToBoxes @ Graphics[
},
ImageSize -> { 20.0, 20.0 },
PlotRange -> { { 0.0, 20.0 }, { 0.0, 20.0 } },
AspectRatio -> Automatic
AspectRatio -> Automatic,
BaselinePosition -> Center -> Center
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ RawBoxes @ ToBoxes @ Graphics[{Thickness[0.058823529411764705],
{0.34799957275390625, 14.}, {0.7779998779296875, 14.},
{13.222000002861023, 14.}}}]},
ImageSize -> {22., 20.}, PlotRange -> {{-5., 17.}, {-3, 17}},
AspectRatio -> Automatic, DefaultBaseStyle -> {}]
AspectRatio -> Automatic, DefaultBaseStyle -> {},
BaselinePosition -> Center -> Center]
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ RawBoxes @ ToBoxes @ Graphics[
]
},
AspectRatio -> Automatic,
ImageSize -> { 12, 12 },
PlotRange -> { { -0.5, 9.5 }, { -0.5, 9.5 } }
ImageMargins -> { { 0, 1 }, { 0, 0 } },
ImageSize -> { 10, 10 },
PlotRange -> { { -0.5, 9.5 }, { -0.5, 9.5 } },
BaselinePosition -> Center -> Center
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ RawBoxes @ ToBoxes @ Graphics[{Thickness[0.07692307692307693],
{0.4479999542236328, 0.}, {1., 0.}, {7., 0.}, {7., 1.}},
{{13., 5.}, {13., 3.}, {10., 3.}, {10., 0.}, {8., 0.}, {8., 3.}, {5., 3.},
{5., 5.}, {8., 5.}, {8., 8.}, {10., 8.}, {10., 5.}, {13., 5.}}}]},
AspectRatio -> Automatic, ImageSize -> {20, 20}, PlotRange -> {{-6, 14}, {-4, 16}}]
AspectRatio -> Automatic, ImageSize -> {20, 20}, PlotRange -> {{-6, 14}, {-4, 16}},
BaselinePosition -> Center -> Center]
7 changes: 6 additions & 1 deletion FrontEnd/TextResources/ChatbookResources.tr
Original file line number Diff line number Diff line change
Expand Up @@ -4496,6 +4496,7 @@ xyc4nl4Kwfno8Q8ARrPSLw==
8.9882}, {16., 8.9882}, {16., 10.989}, {4., 10.989}, {4., 8.9882}}, {{4.,
5.}, {16., 5.}, {16., 7.}, {4., 7.}, {4., 5.}}}]},
AspectRatio->Automatic,
BaselinePosition->(Center -> Center),
ImageSize->{20., 20.},
PlotRange->{{0., 20.}, {0., 20.}}],

Expand All @@ -4515,6 +4516,7 @@ A0U+4ekLe2T+AtdrKHwoCEhIFUTmM6yREUbmI4UPhA8LP4R5Omj2gfko8QEA
LWkzDA==
"]}]},
AspectRatio->Automatic,
BaselinePosition->(Center -> Center),
DefaultBaseStyle->{},
ImageSize->{22., 20.},
PlotRange->{{-5., 17.}, {-3, 17}}],
Expand All @@ -4535,6 +4537,7 @@ Zg4YNGTtgZiDMA+rOgZE+KPzP9gDADwyPuA=
"], {{13., 5.}, {13., 3.}, {10., 3.}, {10., 0.}, {8., 0.}, {8., 3.}, {5.,
3.}, {5., 5.}, {8., 5.}, {8., 8.}, {10., 8.}, {10., 5.}, {13., 5.}}}]},
AspectRatio->Automatic,
BaselinePosition->(Center -> Center),
ImageSize->{20, 20},
PlotRange->{{-6, 14}, {-4, 16}}],

Expand Down Expand Up @@ -5602,7 +5605,9 @@ hPG91XSQ1r+rwnZQz0FvwoIfhm3KUHFtB2neB7oTgO6HhT96fAAASQiSDg==
0.}, {0., 0.}, {0., 9.}, {3., 9.}, {3., 8.}, {1., 8.}, {1., 1.}, {8.,
1.}, {8., 3.}, {9., 3.}, {9., 0.}}}]},
AspectRatio->Automatic,
ImageSize->{12, 12},
BaselinePosition->(Center -> Center),
ImageMargins->{{0, 1}, {0, 0}},
ImageSize->{10, 10},
PlotRange->{{-0.5, 9.5}, {-0.5, 9.5}}]
}
@|
Expand Down
36 changes: 21 additions & 15 deletions Source/Chatbook/ChatModes/UI.wl
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ makeWorkspaceChatDockedCell[ ] := workspaceChatInitializer @ Framed[
LogChatTiming @ openAsChatbookButton @ Dynamic @ nbo
} },
Alignment -> { Automatic, Center },
Spacings -> 0.5
Spacings -> 0.2
],
Initialization :> (nbo = EvaluationNotebook[ ])
],
Background -> RGBColor[ "#66ADD2" ],
FrameStyle -> RGBColor[ "#66ADD2" ], (* RGBColor[ "#A3C9F2" ] *)
FrameMargins -> { { 3, 3 }, { 0, 0 } },
FrameMargins -> { { 5, 4 }, { 0, 1 } },
ImageMargins -> 0
];

Expand All @@ -87,7 +87,6 @@ makeWorkspaceChatSubDockedCellExpression[ content_ ] := Cell[ BoxData @ ToBoxes
Framed[
content,
Background -> RGBColor[ "#DDEFF9" ],
BaseStyle -> { FontSlant -> Italic },
FrameMargins -> { { 7, 7 }, { 4, 4 } },
FrameStyle -> RGBColor[ "#DDEFF9" ],
ImageMargins -> 0,
Expand Down Expand Up @@ -185,7 +184,7 @@ newChatButton[ Dynamic[ nbo_ ] ] :=
toolbarButtonLabel[ lightButton, {label, hotlabel}, "New"],
clearOverlayMenus @ nbo;
NotebookDelete @ Cells @ nbo;
NotebookDelete @ Cells[ nbo, DockedCell -> True, CellTags -> "WorkspaceChatSubDockedCell" ];
removeWorkspaceChatSubDockedCell @ nbo;
CurrentChatSettings[ nbo, "ConversationUUID" ] = CreateUUID[ ];
CurrentValue[ nbo, { TaggingRules, "ConversationTitle" } ] = "";
moveChatInputToTop @ nbo;
Expand Down Expand Up @@ -225,9 +224,9 @@ toolbarButtonLabel[ iconName_String, label_, tooltipName: _String | None, opts:
With[ { lbl = toolbarButtonLabel0[ iconName, label, {}, {} ]},
buttonTooltip[
mouseDown[
Framed[ lbl, opts, $toolbarButtonCommon, $toolbarButtonDefault ],
Framed[ lbl, opts, $toolbarButtonCommon, $toolbarButtonHover ],
Framed[ lbl, opts, $toolbarButtonCommon, $toolbarButtonActive ]
Framed[ lbl, opts, $toolbarButtonCommon[ label =!= None ], $toolbarButtonDefault ],
Framed[ lbl, opts, $toolbarButtonCommon[ label =!= None ], $toolbarButtonHover ],
Framed[ lbl, opts, $toolbarButtonCommon[ label =!= None ], $toolbarButtonActive ]
],
tooltipName
]
Expand All @@ -236,9 +235,9 @@ toolbarButtonLabel[ iconName_String, label_, tooltipName: _String | None, opts:
toolbarButtonLabel[ lightButton, {default_, hot_}, tooltipName_, opts: OptionsPattern[] ] :=
buttonTooltip[
mouseDown[
Framed[ default, opts, $toolbarButtonCommon, $toolbarButtonLight ],
Framed[ hot, opts, $toolbarButtonCommon, $toolbarButtonHover ],
Framed[ hot, opts, $toolbarButtonCommon, $toolbarButtonActive ]
Framed[ default, opts, $toolbarButtonCommon @ True, $toolbarButtonLight ],
Framed[ hot, opts, $toolbarButtonCommon @ True, $toolbarButtonHover ],
Framed[ hot, opts, $toolbarButtonCommon @ True, $toolbarButtonActive ]
],
tooltipName
]
Expand All @@ -257,7 +256,8 @@ toolbarButtonLabel0[ iconName_String, None, {styleopts___}, {gridopts___}] :=
{ { chatbookIcon[ "WorkspaceToolbarIcon"<>iconName, False ] } },
gridopts,
Spacings -> 0.25,
Alignment -> { {Left, Right}, Center }
Alignment -> { {Left, Right}, Baseline },
BaselinePosition -> { 1, 1 }
];

toolbarButtonLabel0[ iconName_String, label_, {styleopts___}, {gridopts___}] :=
Expand All @@ -268,13 +268,15 @@ toolbarButtonLabel0[ iconName_String, label_, {styleopts___}, {gridopts___}] :=
} },
gridopts,
Spacings -> 0.25,
Alignment -> { {Left, Right}, Center }
Alignment -> { {Left, Right}, Baseline },
BaselinePosition -> { 1, 2 }
];

toolbarButtonLabel0 // endDefinition;

$toolbarButtonCommon = Sequence[
FrameMargins -> { { 1, 6 }, { 1, 1 } },
$toolbarButtonCommon[ hasLabelQ_ ] := Sequence[
Alignment -> { Center, Center },
FrameMargins -> { If[ hasLabelQ, { 1, 6 }, { 3, 3 } ], { 1, 1 } },
ImageMargins -> { { 0, 0 }, { 4, 4 } },
ImageSize -> { Automatic, 22 },
RoundingRadius -> 3
Expand Down Expand Up @@ -1285,7 +1287,11 @@ toggleOverlayMenu[ nbo_NotebookObject, name_String ] :=

If[ MissingQ @ cell,
If[ name == "Sources",
writeWorkspaceChatSubDockedCell[ nbo, Style[ tr[ "WorkspaceToolbarSourcesSubTitle" ], FontSlant -> Italic, FontFamily -> "Source Sans Pro" ] ],
writeWorkspaceChatSubDockedCell[
nbo,
Style[
tr[ "WorkspaceToolbarSourcesSubTitle" ],
FontColor -> GrayLevel[ 0.2 ], FontFamily -> "Source Sans Pro", FontSlant -> Italic ] ],
removeWorkspaceChatSubDockedCell[ nbo ]
];
attachOverlayMenu[ nbo, name ];
Expand Down

0 comments on commit 5ffe702

Please sign in to comment.