見出しの判定を本体の描画に合わせた

このコミットが含まれているのは:
routersys committed 2026-08-24 19:04:38 +09:00
1 親 2cb3aae043
コミット 4e0de7b805
6ファイル変更
+59 -13

検索条件に一致するファイルはありません

+8 -1
ファイルの表示
@@ -12,6 +12,12 @@ void DockModel::Clear() {
region_ = RECT{};
}
bool DockModel::BuildRegion() {
Clear();
region_ = DockRegion();
return region_.right > 0 && region_.bottom > 0;
}
bool DockModel::Build() {
Clear();
if (!layout_.Build()) return false;
@@ -21,7 +27,8 @@ bool DockModel::Build() {
DockPanel entry = {};
entry.rect = panel.rect;
entry.title = panel.title;
entry.probe = POINT{ panel.rect.left + kProbeInset, panel.rect.top + kProbeInset };
const int top = panel.HasTitle() ? panel.title.top : panel.rect.top;
entry.probe = POINT{ panel.rect.left + kProbeInset, top + kProbeInset };
entry.stack = panel.stack;
entry.order = panel.order;
entry.area = kAreaUnknown;
+1
ファイルの表示
@@ -22,6 +22,7 @@ struct DockPanel {
class DockModel {
public:
bool Build();
bool BuildRegion();
void Clear();
const RECT& Region() const { return region_; }
+41 -12
ファイルの表示
@@ -9,6 +9,19 @@ namespace dl {
static const RECT kEmptyBand = {};
struct HeaderStyle {
int color;
int height;
};
RECT DockRegion() {
HWND host = HostWindow();
RECT client = {};
if (!host || !GetClientRect(host, &client)) return kEmptyBand;
RefreshStyle();
return RECT{ 0, 0, client.right, client.bottom - Style().footerHeight };
}
int PanelLayout::ClassifyRow(int y, int x0, int x1) const {
const StyleMetrics& style = Style();
int borders = 0;
@@ -74,29 +87,47 @@ std::vector<RECT> PanelLayout::SplitBands(const RECT& area, StackAxis axis) cons
return bands;
}
RECT PanelLayout::TitleBand(const RECT& area) const {
RECT PanelLayout::TitleBandFrom(const RECT& area, int top) const {
const StyleMetrics& style = Style();
const int left = area.left + 1;
const int right = area.right - 1;
if (right - left <= 0) return kEmptyBand;
if (right - left <= 0 || top >= area.bottom) return kEmptyBand;
const int top = surface_.At(left, area.top) == style.windowBorder ? area.top + 1 : area.top;
const int colors[2] = { style.titleHeader, style.grouping };
const int heights[2] = { style.titleHeaderHeight, style.settingItemHeight };
for (int i = 0; i < 2; i++) {
const HeaderStyle styles[] = {
{ style.titleHeader, style.titleHeaderHeight },
{ style.grouping, style.settingItemHeight },
{ style.groupingHover, style.settingItemHeight },
{ style.groupingSelect, style.settingItemHeight },
{ style.grouping, style.groupTabHeight },
{ style.groupingHover, style.groupTabHeight },
{ style.groupingSelect, style.groupTabHeight },
};
for (const HeaderStyle& header : styles) {
int rows = 0;
bool glyph = false;
bool full = false;
while (top + rows < area.bottom && RowMostly(top + rows, left, right, colors[i], &full)) {
while (top + rows < area.bottom && RowMostly(top + rows, left, right, header.color, &full)) {
if (!full) glyph = true;
rows++;
}
if (rows > 0 && glyph && abs(rows - heights[i]) <= 1)
if (rows > 0 && glyph && abs(rows - header.height) <= 1)
return RECT{ area.left, top, area.right, top + rows };
}
return kEmptyBand;
}
RECT PanelLayout::TitleBand(const RECT& area) const {
const StyleMetrics& style = Style();
const int top = surface_.At(area.left + 1, area.top) == style.windowBorder ? area.top + 1
: area.top;
const RECT first = TitleBandFrom(area, top);
if (first.bottom <= first.top) return TitleBandFrom(area, top + style.groupTabHeight);
const RECT second = TitleBandFrom(area, first.bottom);
if (second.bottom <= second.top) return first;
return RECT{ area.left, first.top, area.right, second.bottom };
}
void PanelLayout::Divide(const RECT& area, int stack, int order) {
for (const StackAxis axis : { StackAxis::Vertical, StackAxis::Horizontal }) {
const std::vector<RECT> bands = SplitBands(area, axis);
@@ -116,12 +147,10 @@ bool PanelLayout::Build() {
region_ = kEmptyBand;
HWND host = HostWindow();
if (!host) return false;
RECT client = {};
if (!GetClientRect(host, &client)) return false;
if (!host || !GetClientRect(host, &client)) return false;
RefreshStyle();
const RECT region = { 0, 0, client.right, client.bottom - Style().footerHeight };
const RECT region = DockRegion();
if (region.right <= 0 || region.bottom <= 0) return false;
if (!surface_.Capture(host, client.right, client.bottom)) return false;
+3
ファイルの表示
@@ -7,6 +7,8 @@
namespace dl {
RECT DockRegion();
enum class StackAxis { Vertical, Horizontal };
struct Panel {
@@ -34,6 +36,7 @@ private:
int ClassifyColumn(int x, int y0, int y1) const;
bool RowMostly(int y, int x0, int x1, int color, bool* full) const;
std::vector<RECT> SplitBands(const RECT& area, StackAxis axis) const;
RECT TitleBandFrom(const RECT& area, int top) const;
RECT TitleBand(const RECT& area) const;
void Divide(const RECT& area, int stack, int order);
+3
ファイルの表示
@@ -12,9 +12,12 @@ void RefreshStyle() {
g_style.windowBorder = ColorCode("WindowBorder");
g_style.titleHeader = ColorCode("TitleHeader");
g_style.grouping = ColorCode("Grouping");
g_style.groupingHover = ColorCode("GroupingHover");
g_style.groupingSelect = ColorCode("GroupingSelect");
g_style.windowSeparatorSize = LayoutSize("WindowSeparatorSize");
g_style.titleHeaderHeight = LayoutSize("TitleHeaderHeight");
g_style.settingItemHeight = LayoutSize("SettingItemHeight");
g_style.groupTabHeight = LayoutSize("GroupTabHeight");
g_style.footerHeight = LayoutSize("FooterHeight");
g_loaded = true;
}
+3
ファイルの表示
@@ -7,9 +7,12 @@ struct StyleMetrics {
int windowBorder;
int titleHeader;
int grouping;
int groupingHover;
int groupingSelect;
int windowSeparatorSize;
int titleHeaderHeight;
int settingItemHeight;
int groupTabHeight;
int footerHeight;
};