Skip to content

Commit

Permalink
- added new plugin export window
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-hart committed Jan 23, 2025
1 parent 47f6a50 commit a208fb4
Show file tree
Hide file tree
Showing 21 changed files with 1,025 additions and 103 deletions.
17 changes: 16 additions & 1 deletion hi_backend/backend/BackendApplicationCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void BackendCommandTarget::getAllCommands(Array<CommandID>& commands)
MenuFileExtractEmbeddeSnippetFiles,
MenuFileImportSnippet,
MenuExportSetupWizard,
MenuExportCompileProject,
MenuExportFileAsPlugin,
MenuExportFileAsEffectPlugin,
MenuExportFileAsMidiFXPlugin,
Expand Down Expand Up @@ -328,6 +329,10 @@ void BackendCommandTarget::getCommandInfo(CommandID commandID, ApplicationComman
setCommandTarget(result, "Setup Export Wizard", true, false, 'X', false);
result.categoryName = "Export";
break;
case MenuExportCompileProject:
setCommandTarget(result, "Compile project", true, false, 'X', false);
result.categoryName = "Export";
break;
case MenuExportFileAsPlugin:
setCommandTarget(result, "Export as Instrument (VSTi / AUi) plugin", true, false, 'X', false);
result.categoryName = "Export";
Expand Down Expand Up @@ -687,6 +692,7 @@ bool BackendCommandTarget::perform(const InvocationInfo &info)
case MenuToolsRecompile: Actions::recompileAllScripts(bpe); return true;
case MenuToolsCheckCyclicReferences:Actions::checkCyclicReferences(bpe); return true;
case MenuToolsCreateExternalScriptFile: Actions::createExternalScriptFile(bpe); updateCommands(); return true;
case MenuExportCompileProject: Actions::compileProject(bpe); return true;
case MenuExportValidateUserPresets: Actions::validateUserPresets(bpe); return true;
case MenuExportRestoreToDefault: Actions::restoreToDefault(bpe); return true;
case MenuExportCheckUnusedImages: Actions::checkUnusedImages(bpe); return true;
Expand Down Expand Up @@ -974,7 +980,10 @@ PopupMenu BackendCommandTarget::getMenuForIndex(int topLevelMenuIndex, const Str
{
ADD_MENU_ITEM(MenuExportSetupWizard);

ADD_MENU_ITEM(MenuExportCompileProject);

p.addSectionHeader("Export As");

ADD_MENU_ITEM(MenuExportFileAsPlugin);
ADD_MENU_ITEM(MenuExportFileAsEffectPlugin);
ADD_MENU_ITEM(MenuExportFileAsMidiFXPlugin);
Expand Down Expand Up @@ -2074,8 +2083,14 @@ DialogWindowWithBackgroundThread* BackendCommandTarget::Actions::importProject(B
return nullptr;
}

void BackendCommandTarget::Actions::compileProject(BackendRootWindow* bpe)
{
auto cw = new multipage::library::CompileProjectDialog(bpe);
cw->setModalBaseWindowComponent(bpe);
}

struct HeadlessImporter: public ImporterBase,
public Thread
public Thread
{
HeadlessImporter(BackendRootWindow* bpe, const File& projectRoot):
ImporterBase(bpe),
Expand Down
3 changes: 3 additions & 0 deletions hi_backend/backend/BackendApplicationCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class BackendCommandTarget: public ApplicationCommandTarget,

// Export Menu
MenuExportSetupWizard,
MenuExportCompileProject,
MenuExportFileAsPlugin,
MenuExportFileAsEffectPlugin,
MenuExportFileAsMidiFXPlugin,
Expand Down Expand Up @@ -319,6 +320,8 @@ class BackendCommandTarget: public ApplicationCommandTarget,
static void loadProject(BackendRootWindow *bpe);
static DialogWindowWithBackgroundThread* importProject(BackendRootWindow* bpe);

static void compileProject(BackendRootWindow* bpe);

static void extractProject(BackendRootWindow* bpe, const File& newProjectRoot, const File& sourceFile);

static void createRnboTemplate(BackendRootWindow* bpe);
Expand Down
8 changes: 8 additions & 0 deletions hi_backend/backend/BackendComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ multipage::EncodedDialogBase::EncodedDialogBase(BackendRootWindow* bpe_, bool ad
ControlledObject(bpe_->getBackendProcessor()),
rootWindow(bpe_),
closeButton("close", nullptr, factory),
minimizeButton("minimize", nullptr, factory),
addBorder(addBorder_)
{
addAndMakeVisible(closeButton);
Expand All @@ -366,6 +367,13 @@ multipage::EncodedDialogBase::EncodedDialogBase(BackendRootWindow* bpe_, bool ad
}
};

addChildComponent(minimizeButton);

minimizeButton.onClick = [this]()
{
findParentComponentOfClass<BackendRootWindow>()->minimizeModalComponent(true, state.get());
};

closeButton.setVisible(addBorder);
}

Expand Down
25 changes: 24 additions & 1 deletion hi_backend/backend/BackendComponents.h
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,16 @@ struct EncodedDialogBase: public Component,
{
Path p;
LOAD_EPATH_IF_URL("close", HiBinaryData::ProcessorEditorHeaderIcons::closeIcon);

if(url == "minimize")
{
static const unsigned char pathData[] = { 110,109,47,128,38,68,0,0,64,67,98,2,156,55,68,0,0,64,67,0,128,69,68,248,143,119,67,0,128,69,68,216,255,157,67,98,0,128,69,68,176,55,192,67,2,156,55,68,254,255,219,67,47,128,38,68,254,255,219,67,98,254,99,21,68,254,255,219,67,0,128,7,68,176,55,192,67,
0,128,7,68,216,255,157,67,98,0,128,7,68,248,143,119,67,254,99,21,68,0,0,64,67,47,128,38,68,0,0,64,67,99,109,157,219,60,68,16,109,125,67,108,147,36,54,68,80,145,98,67,108,167,136,45,68,48,128,130,67,108,74,76,39,68,196,15,108,67,108,74,76,39,68,118,102,
156,67,108,14,124,58,68,118,102,156,67,108,177,63,52,68,42,238,143,67,108,157,219,60,68,16,109,125,67,99,109,67,219,22,68,4,183,202,67,108,47,119,31,68,98,127,185,67,108,5,179,37,68,176,247,197,67,108,5,179,37,68,28,153,159,67,108,241,131,18,68,28,153,
159,67,108,24,192,24,68,106,17,172,67,108,84,36,16,68,12,73,189,67,108,67,219,22,68,4,183,202,67,99,101,0,0 };
p.loadPathFromData (pathData, sizeof (pathData));
}

return p;
}
} factory;
Expand Down Expand Up @@ -803,6 +813,12 @@ struct EncodedDialogBase: public Component,

closeButton.setBounds(b.removeFromRight(34).removeFromTop(34).reduced(8));
closeButton.toFront(false);

if(minimizeButton.isVisible())
{
minimizeButton.toFront(false);
minimizeButton.setBounds(b.removeFromLeft(34).removeFromTop(34).reduced(8));
}
}

void navigate(int pageIndex, bool shouldSubmit)
Expand All @@ -821,13 +837,20 @@ struct EncodedDialogBase: public Component,
}
});
}


void setMinimizable(bool isMinimizable)
{
minimizeButton.setVisible(isMinimizable);
resized();
}

protected:

ScopedPointer<State> state;
ScopedPointer<Dialog> dialog;

HiseShapeButton closeButton;
HiseShapeButton minimizeButton;

bool closeOnEscape = true;

Expand Down
11 changes: 9 additions & 2 deletions hi_backend/backend/BackendEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,11 @@ MainTopBar::MainTopBar(FloatingTile* parent) :
SimpleTimer(parent->getMainController()->getGlobalUIUpdater()),
PreloadListener(parent->getMainController()->getSampleManager()),
ComponentWithHelp(parent->getBackendRootWindow()),
quickPlayButton(parent->getMainController())
quickPlayButton(parent->getMainController()),
minimizeBar()
{
addChildComponent(minimizeBar);

parent->getMainController()->getScriptComponentEditBroadcaster()->getLearnBroadcaster().addListener(*this, updateLearnConnection);

{
Expand Down Expand Up @@ -617,6 +620,7 @@ void MainTopBar::buttonClicked(Button* b)

void MainTopBar::resized()
{
minimizeBar.initialise();
hiseButton->setVisible(false);

layoutButton->setVisible(false);
Expand All @@ -628,7 +632,10 @@ void MainTopBar::resized()
auto b = getLocalBounds();

customPopupButton->setBounds(b.removeFromLeft(getHeight()).reduced(8));


if(minimizeBar.isVisible())
minimizeBar.setBounds(b.removeFromLeft(getWidth() / 4).reduced(8));

macroButton->setBounds(frontendArea.removeFromLeft(bWidth).reduced(7));
pluginPreviewButton->setBounds(frontendArea.removeFromLeft(bWidth).reduced(7));
presetBrowserButton->setBounds(frontendArea.removeFromLeft(bWidth).reduced(7));
Expand Down
82 changes: 82 additions & 0 deletions hi_backend/backend/BackendEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,88 @@ class MainTopBar : public FloatingTileContent,
numPopupTypes
};

struct MinimizeBar: public Component
{
MinimizeBar()
{
setMouseCursor(MouseCursor::PointingHandCursor);
}

bool initialised = false;

void initialise()
{
if(!initialised)
{
if(auto mbw = findParentComponentOfClass<ModalBaseWindow>())
{
initialised = true;
mbw->minimizeBroadcaster.addListener(*this, onMinimize);
}
}
}

static void onMinimize(MinimizeBar& b, bool shouldBeVisible, multipage::State* state)
{
b.setVisible(shouldBeVisible);
b.state = state;

if(shouldBeVisible)
{
b.text = state->getFirstDialog()->getGlobalProperty(multipage::mpid::Header).toString();
if(auto j = state->currentJob)
{
b.addAndMakeVisible(b.bar = new ProgressBar(j->getProgress()));
b.resized();
}
}


if(auto mb = b.findParentComponentOfClass<MainTopBar>())
mb->resized();
}

void mouseDown(const MouseEvent& e) override
{
findParentComponentOfClass<ModalBaseWindow>()->minimizeModalComponent(false, state);
}

void resized() override
{
if(bar != nullptr)
{
auto f = GLOBAL_BOLD_FONT();
auto w = f.getStringWidth(text) + 20;
auto b = getLocalBounds();
b.removeFromLeft(w);
bar->setBounds(b.reduced(4));
}
}

void paint(Graphics& g) override
{
if(isMouseOver(true))
{
g.setColour(Colours::white.withAlpha(0.1f));
g.fillRoundedRectangle(getLocalBounds().toFloat(), 3.0f);
}


g.setColour(Colours::white.withAlpha(0.8f));

g.setFont(GLOBAL_BOLD_FONT());
g.drawText(text, getLocalBounds().toFloat().reduced(5.0f), Justification::left);
}

String text;

ScopedPointer<juce::ProgressBar> bar;

WeakReference<multipage::State> state;

JUCE_DECLARE_WEAK_REFERENCEABLE(MinimizeBar);
} minimizeBar;

MainTopBar(FloatingTile* parent);

~MainTopBar();
Expand Down
42 changes: 31 additions & 11 deletions hi_backend/backend/CompileExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,9 @@ CompileExporter::BuildOption CompileExporter::getBuildOptionFromCommandLine(Stri
CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, BuildOption option)
{

setProgress(0.1);


logMessage("> Perform sanity checks");

const auto& data = dynamic_cast<GlobalSettingManager*>(chainToExport->getMainController())->getSettingsObject();

Expand Down Expand Up @@ -558,6 +559,8 @@ CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, Bu

solutionDirectory = GET_PROJECT_HANDLER(chainToExport).getSubDirectory(ProjectHandler::SubDirectories::Binaries).getFullPathName();

logMessage("> Create C++ autogenerated files");

if (option != Cancelled)
{
// Use plugin mode for iOS Standalone AUv3 apps...
Expand All @@ -574,6 +577,8 @@ CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, Bu
if (result != ErrorCodes::OK) return result;
}

logMessage("> Create binary data files");

result = copyHISEImageFiles();

if (result != ErrorCodes::OK) return result;
Expand Down Expand Up @@ -631,39 +636,44 @@ CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, Bu

bool alreadyExported = iof.existsAsFile() || sof.existsAsFile() || smof.existsAsFile() || mof.existsAsFile();

setProgress(0.3);

if (rawMode || (alreadyExported && data.getSetting(HiseSettings::Compiler::RebuildPoolFiles)))
{
iof.deleteFile();
sof.deleteFile();
smof.deleteFile();
mof.deleteFile();

logMessage("> Exporting the pooled resources");

std::cout << "Exporting the pooled resources...";

handler.exportAllPoolsToTemporaryDirectory(chainToExport, nullptr);
DialogWindowWithBackgroundThread::LogData d;
d.logFunction = BIND_MEMBER_FUNCTION_1(CompileExporter::logMessage);

handler.exportAllPoolsToTemporaryDirectory(chainToExport, &d);

std::cout << "DONE\n" ;
logMessage("DONE");

if (rawMode)
{
auto printExportedFiles = [](MainController* mc, const Array<PoolReference>& files, ProjectHandler::SubDirectories d)
auto printExportedFiles = [this](MainController* mc, const Array<PoolReference>& files, ProjectHandler::SubDirectories d)
{
String name = ProjectHandler::getIdentifier(d);
NewLine nl;

std::cout << "Exported " << name << " resources: " << nl;
logMessage("Exported " + name + " resources: ");

auto& handler = mc->getCurrentFileHandler();


auto folder = handler.getSubDirectory(d);

for (const auto& ref : files)
{
std::cout << ref.getFile().getRelativePathFrom(folder) << nl;
}
logMessage(ref.getFile().getRelativePathFrom(folder));

std::cout << "=============================================";
logMessage("=============================================");
};

auto mc = chainToExport->getMainController();
Expand All @@ -690,6 +700,8 @@ CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, Bu
handler.exportAllPoolsToTemporaryDirectory(chainToExport, nullptr);
}

setProgress(0.4);

File imageOutputFile, sampleOutputFile, samplemapFile, midiFile;

if (embedFiles)
Expand Down Expand Up @@ -786,6 +798,8 @@ CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, Bu
mof.copyFileTo(midiFile);
}

logMessage("> Create embedded data files");

String presetDataString("PresetData");
String sourceDirectory = solutionDirectory + "/Source";

Expand All @@ -802,7 +816,13 @@ CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, Bu
if (result != ErrorCodes::OK) return result;
}

result = compileSolution(option, type);
setProgress(0.5);

logMessage("> Launch system compi");

result = compileSolution(option, type, manager);

setProgress(1.0);

return result;
}
Expand Down Expand Up @@ -2555,7 +2575,7 @@ void CompileExporter::BatchFileCreator::createBatchFile(CompileExporter* exporte

if (!exporter->rawMode && BuildOptionHelpers::is64Bit(buildOption))
{
ADD_LINE("echo Compiling 64bit " << projectType << " %project% ...");
ADD_LINE("echo > Compiling 64bit " << projectType << " %project% ...");
ADD_LINE("set Platform=X64");
ADD_LINE("%msbuild% \"%build_path%\\Builds\\" << vsFolder << "\\%project%.sln\" %vs_args%");

Expand Down
Loading

0 comments on commit a208fb4

Please sign in to comment.