Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repositioning of internal dialog titlebar buttons to the left size for Mac #6713

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/surge-xt/gui/SurgeJUCELookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,16 @@ void SurgeJUCELookAndFeel::drawDocumentWindowTitleBar(DocumentWindow &window, Gr
auto sw = fontSurge.getStringWidth(surgeLabel);
auto vw = fontVersion.getStringWidth(surgeVersion);

auto ic = associatedBitmapStore->getImage(IDB_SURGE_ICON);
auto icon = associatedBitmapStore->getImage(IDB_SURGE_ICON);

// Surge icon is 12 x 14 so draw that in the center
auto titleCenter = w / 2;
auto textMargin = Surge::Build::IsRelease ? 0 : 5;
auto titleTextWidth = sw + vw + textMargin;

if (ic)
if (icon)
{
ic->drawAt(g, titleCenter - (titleTextWidth / 2) - 14 - textMargin, h / 2 - 7, 1.0);
icon->drawAt(g, titleCenter - (titleTextWidth / 2) - 14 - textMargin, h / 2 - 7, 1.0);
}

auto boxSurge = Rectangle<int>(titleCenter - (titleTextWidth / 2), 0, sw, h);
Expand Down
11 changes: 8 additions & 3 deletions src/surge-xt/gui/overlays/MiniEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@ void MiniEdit::paint(juce::Graphics &g)
g.setFont(skin->fontManager->getLatoAtSize(10, juce::Font::bold));
g.drawText(title, tbRect, juce::Justification::centred);

auto d = associatedBitmapStore->getImage(IDB_SURGE_ICON);
auto icon = associatedBitmapStore->getImage(IDB_SURGE_ICON);

if (d)
if (icon)
{
d->drawAt(g, fullRect.getX() + 2, fullRect.getY() + 2, 1.0);
const auto iconSize = 14;
#if MAC
icon->drawAt(g, fullRect.getRight() - iconSize + 2, fullRect.getY() + 1, 1);
#else
icon->drawAt(g, fullRect.getX() + 2, fullRect.getY() + 1, 1);
#endif
}

auto bodyRect = fullRect.withTrimmedTop(18);
Expand Down
20 changes: 17 additions & 3 deletions src/surge-xt/gui/overlays/OverlayWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ void OverlayWrapper::paint(juce::Graphics &g)

if (icon)
{
const auto iconSize = titlebarSize;

#if MAC
icon->drawAt(g, sp.getRight() - iconSize + 1, sp.getY() + 1, 1);
#else
icon->drawAt(g, sp.getX() + 2, sp.getY() + 1, 1);
#endif
}

g.setColour(skin->getColor(Colors::Dialog::Border));
Expand All @@ -100,14 +106,22 @@ void OverlayWrapper::addAndTakeOwnership(std::unique_ptr<juce::Component> c)

auto q = sp.reduced(2 * margin, 2 * margin)
.withTrimmedBottom(titlebarSize)
.translated(0, titlebarSize + 0 * margin);
.translated(0, titlebarSize);
primaryChild = std::move(c);
primaryChild->setBounds(q);

auto buttonSize = titlebarSize;
auto closeButtonBounds =
juce::Rectangle<int> closeButtonBounds;
juce::Rectangle<int> tearOutButtonBounds;

#if MAC
closeButtonBounds = getLocalBounds().withSize(buttonSize, buttonSize).translated(2, 2);
tearOutButtonBounds = closeButtonBounds.translated(buttonSize + 2, 0);
#else
closeButtonBounds =
getLocalBounds().withHeight(buttonSize).withLeft(getWidth() - buttonSize).translated(-2, 2);
auto tearOutButtonBounds = closeButtonBounds.translated(-buttonSize - 2, 0);
tearOutButtonBounds = closeButtonBounds.translated(-buttonSize - 2, 0);
#endif

if (showCloseButton)
{
Expand Down