Skip to content

Commit

Permalink
Fix linux build and some scaling issues
Browse files Browse the repository at this point in the history
- Fixed tab and dock icons drawing in the wrong spot
- Fixed blurry SToolBarButton icons
  • Loading branch information
sirjuddington committed Jun 1, 2024
1 parent 82c36f8 commit 1f32dfd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/MainEditor/UI/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ void MainWindow::onSize(wxSizeEvent& e)
// Update toolbar layout (if needed)
toolbar_->updateLayout();
#ifndef __WXMSW__
aui_mgr_->GetPane(toolbar_).MinSize(-1, toolbar_->getBarHeight());
aui_mgr_->GetPane(toolbar_).MinSize(-1, toolbar_->getBarHeight(this));
aui_mgr_->Update();
#endif

Expand Down
8 changes: 4 additions & 4 deletions src/UI/SAuiTabArt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void SAuiTabArt::DrawTab(
if (page.bitmap.IsOk())
{
const auto& bmp = page.bitmap.GetBitmapFor(wnd);
dc.DrawBitmap(bmp, tab_x + padding_, drawn_tab_yoff + drawn_tab_height / 2 - bmp.GetHeight() / 2, true);
dc.DrawBitmap(bmp, tab_x + padding_, drawn_tab_yoff + drawn_tab_height / 2 - bmp.GetLogicalSize().y / 2, true);
}

// draw tab text
Expand All @@ -390,8 +390,8 @@ void SAuiTabArt::DrawTab(
if (m_flags & wxAUI_NB_BOTTOM)
offsetY = 1;

int close_button_width = m_activeCloseBmp.GetPreferredBitmapSizeFor(wnd).x;
int close_button_height = m_activeCloseBmp.GetPreferredBitmapSizeFor(wnd).y;
int close_button_width = m_activeCloseBmp.GetPreferredLogicalSizeFor(wnd).x;
int close_button_height = m_activeCloseBmp.GetPreferredLogicalSizeFor(wnd).y;

wxRect rect(
tab_x + tab_width - close_button_width - padding_,
Expand Down Expand Up @@ -647,7 +647,7 @@ void SAuiDockArt::DrawPaneButton(
wxRect rect = _rect;

int old_y = rect.y;
rect.y = rect.y + rect.height / 2 - bmp.GetPreferredBitmapSizeFor(window).y / 2;
rect.y = rect.y + rect.height / 2 - bmp.GetPreferredLogicalSizeFor(window).y / 2;
rect.height = old_y + rect.height - rect.y - 1;


Expand Down
13 changes: 7 additions & 6 deletions src/UI/SToolBar/SToolBarButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,9 @@ void SToolBarButton::onPaint(wxPaintEvent& e)
gc->DrawRoundedRectangle(pad_outer_, pad_outer_, width_inner, height_inner, 1);
}

auto icon_size = FromDIP(wxSize{ icon_size_, icon_size_ });
auto icon = icon_.GetBitmap(icon_size);
//auto icon_size = FromDIP(wxSize{ icon_size_, icon_size_ });
//auto icon = icon_.GetBitmap(icon_size);
auto icon = icon_.GetBitmapFor(this);

if (icon.IsOk())
{
Expand All @@ -418,8 +419,8 @@ void SToolBarButton::onPaint(wxPaintEvent& e)
icon.ConvertToDisabled(r),
FromDIP(pad_outer_ + pad_inner_),
FromDIP(pad_outer_ + pad_inner_),
icon.GetWidth(),
icon.GetHeight());
FromPhys(icon.GetWidth()),
FromPhys(icon.GetHeight()));
}

// Otherwise draw normal icon
Expand All @@ -428,8 +429,8 @@ void SToolBarButton::onPaint(wxPaintEvent& e)
icon,
FromDIP(pad_outer_ + pad_inner_),
FromDIP(pad_outer_ + pad_inner_),
icon.GetWidth(),
icon.GetHeight());
FromPhys(icon.GetWidth()),
FromPhys(icon.GetHeight()));
}

if (show_name_)
Expand Down

0 comments on commit 1f32dfd

Please sign in to comment.