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

Fix a set of zoom problems in the standalone and clap #1480

Merged
merged 4 commits into from
Jan 22, 2025
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: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ else()
endif()

option(SCXT_SANITIZE "Build with clang/gcc address and undef sanitizer" OFF)
if (WIN32)
option(SCXT_USE_CLAP_WRAPPER_STANDALONE "Build with the clap wrapper standalone rather than our temp one" ON)
else()
option(SCXT_USE_CLAP_WRAPPER_STANDALONE "Build with the clap wrapper standalone rather than our temp one" OFF)
endif()
option(SCXT_USE_CLAP_WRAPPER_STANDALONE "Build with the clap wrapper standalone rather than our temp one" ON)

# Share some information about the build
message(STATUS "Shortcircuit XT ${CMAKE_PROJECT_VERSION}")
Expand Down
7 changes: 6 additions & 1 deletion clients/clap-first/scxt-plugin/scxt-clap-entry-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include "clapwrapper/vst3.h"
#include "clapwrapper/auv2.h"
#include "sst/plugininfra/misc_platform.h"

namespace scxt::clap_first
{
Expand Down Expand Up @@ -106,7 +107,11 @@ const void *get_factory(const char *factory_id)
}

// clap_init and clap_deinit are required to be fast, but we have nothing we need to do here
bool clap_init(const char *p) { return true; }
bool clap_init(const char *p)
{
// sst::plugininfra::misc_platform::allocateConsole();
return true;
}
void clap_deinit() {}

} // namespace scxt::clap_first
10 changes: 7 additions & 3 deletions clients/clap-first/scxt-plugin/scxt-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,21 @@ std::unique_ptr<juce::Component> SCXTPlugin::createEditor()
ed->onZoomChanged = [this](auto f) {
if (_host.canUseGui() && clapJuceShim->isEditorAttached())
{
// SCLOG("On Zoom Changed with " << f << " - requesting resize of " <<
// scxt::ui::SCXTEditor::edWidth * f << "x" << scxt::ui::SCXTEditor::edHeight * f)
_host.guiRequestResize(scxt::ui::app::SCXTEditor::edWidth * f,
scxt::ui::app::SCXTEditor::edHeight * f);
}
else
{
SCLOG("On Zoom Changed - not yet attached");
}
};
onShow = [e = ed.get()]() {
e->setZoomFactor(e->zoomFactor);
return true;
};
ed->setSize(scxt::ui::app::SCXTEditor::edWidth, scxt::ui::app::SCXTEditor::edHeight);
ed->setSize(scxt::ui::app::SCXTEditor::edWidth * ed->zoomFactor,
scxt::ui::app::SCXTEditor::edHeight * ed->zoomFactor);

ed->clapHost = _host.host();
return ed;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/sst/sst-basic-blocks
2 changes: 1 addition & 1 deletion libs/sst/sst-clap-helpers
16 changes: 9 additions & 7 deletions src-ui/app/editor-impl/SCXTEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,20 @@ void SCXTEditor::showWelcomeOverlay()
void SCXTEditor::resized()
{
static constexpr int32_t headerHeight{40};
headerRegion->setBounds(0, 0, getWidth(), headerHeight);
headerRegion->setBounds(0, 0, edWidth, headerHeight);

if (editScreen->isVisible())
editScreen->setBounds(0, headerHeight, getWidth(), getHeight() - headerHeight);
editScreen->setBounds(0, headerHeight, edWidth, edHeight - headerHeight);
if (mixerScreen->isVisible())
mixerScreen->setBounds(0, headerHeight, getWidth(), getHeight() - headerHeight);
mixerScreen->setBounds(0, headerHeight, edWidth, edHeight - headerHeight);
if (playScreen->isVisible())
playScreen->setBounds(0, headerHeight, getWidth(), getHeight() - headerHeight);
playScreen->setBounds(0, headerHeight, edWidth, edHeight - headerHeight);
if (aboutScreen->isVisible())
aboutScreen->setBounds(0, headerHeight, getWidth(), getHeight() - headerHeight);
aboutScreen->setBounds(0, headerHeight, edWidth, edHeight - headerHeight);
if (logScreen->isVisible())
logScreen->setBounds(0, headerHeight, getWidth(), getHeight() - headerHeight);
logScreen->setBounds(0, headerHeight, edWidth, edHeight - headerHeight);
if (welcomeScreen->isVisible())
welcomeScreen->setBounds(0, 0, getWidth(), getHeight());
welcomeScreen->setBounds(0, 0, edWidth, edHeight);
}

void SCXTEditor::idle()
Expand Down Expand Up @@ -421,6 +421,8 @@ void SCXTEditor::setZoomFactor(float zf)
zoomFactor * 100);
if (onZoomChanged)
onZoomChanged(zoomFactor);
else
SCLOG("Null onZoomChanged");
}

void SCXTEditor::configureHasDiscreteMenuBuilder(
Expand Down
Loading