Skip to content

Commit

Permalink
scale mark bar weight if linespacing and baseline is set;
Browse files Browse the repository at this point in the history
limit mar bar weight size larger than 6 pixel.
  • Loading branch information
fxliang committed Apr 14, 2024
1 parent 312b946 commit 1c0c0b2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
7 changes: 6 additions & 1 deletion WeaselUI/FullScreenLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ void weasel::FullScreenLayout::DoLayout(CDCHandle dc, PDWR pDWR) {
pDWR->pTextFormat, pDWR, &sg);
mark_width = sg.cx;
mark_height = sg.cy;
if (_style.mark_text.empty())
if (_style.mark_text.empty()) {
mark_width = mark_height / 7;
if (_style.linespacing && _style.baseline)
mark_width =
(int)((float)mark_width / ((float)_style.linespacing / 100.0f));
mark_width = max(mark_width, 6);
}
mark_gap = (_style.mark_text.empty())
? mark_width
: mark_width + _style.hilite_spacing;
Expand Down
7 changes: 6 additions & 1 deletion WeaselUI/HorizontalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ void HorizontalLayout::DoLayout(CDCHandle dc, PDWR pDWR) {

mark_width = sg.cx;
mark_height = sg.cy;
if (_style.mark_text.empty())
if (_style.mark_text.empty()) {
mark_width = mark_height / 7;
if (_style.linespacing && _style.baseline)
mark_width =
(int)((float)mark_width / ((float)_style.linespacing / 100.0f));
mark_width = max(mark_width, 6);
}
mark_gap = (_style.mark_text.empty()) ? mark_width
: mark_width + _style.hilite_spacing;
}
Expand Down
14 changes: 12 additions & 2 deletions WeaselUI/VHorizontalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ void VHorizontalLayout::DoLayout(CDCHandle dc, PDWR pDWR) {

mark_width = sg.cx;
mark_height = sg.cy;
if (_style.mark_text.empty())
if (_style.mark_text.empty()) {
mark_height = mark_width / 7;
if (_style.linespacing && _style.baseline)
mark_height =
(int)((float)mark_height / ((float)_style.linespacing / 100.0f));
mark_height = max(mark_height, 6);
}
mark_gap = (_style.mark_text.empty()) ? mark_height
: mark_height + _style.hilite_spacing;
}
Expand Down Expand Up @@ -247,8 +252,13 @@ void VHorizontalLayout::DoLayoutWithWrap(CDCHandle dc, PDWR pDWR) {

mark_width = sg.cx;
mark_height = sg.cy;
if (_style.mark_text.empty())
if (_style.mark_text.empty()) {
mark_height = mark_width / 7;
if (_style.linespacing && _style.baseline)
mark_height =
(int)((float)mark_height / ((float)_style.linespacing / 100.0f));
mark_height = max(mark_height, 6);
}
mark_gap = (_style.mark_text.empty()) ? mark_height
: mark_height + _style.hilite_spacing;
}
Expand Down
7 changes: 6 additions & 1 deletion WeaselUI/VerticalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ void weasel::VerticalLayout::DoLayout(CDCHandle dc, PDWR pDWR) {

mark_width = sg.cx;
mark_height = sg.cy;
if (_style.mark_text.empty())
if (_style.mark_text.empty()) {
mark_width = mark_height / 7;
if (_style.linespacing && _style.baseline)
mark_width =
(int)((float)mark_width / ((float)_style.linespacing / 100.0f));
mark_width = max(mark_width, 6);
}
mark_gap = (_style.mark_text.empty()) ? mark_width
: mark_width + _style.hilite_spacing;
}
Expand Down

0 comments on commit 1c0c0b2

Please sign in to comment.