diff --git a/Source/Heavy/DPFExporter.h b/Source/Heavy/DPFExporter.h index e9fb470a01..6b405097ec 100644 --- a/Source/Heavy/DPFExporter.h +++ b/Source/Heavy/DPFExporter.h @@ -19,6 +19,7 @@ class DPFExporter final : public ExporterBase { Value jackEnableValue = Value(var(0)); Value exportTypeValue = Value(var(1)); + Value guiTypeValue = Value(var(1)); Value pluginTypeValue = Value(var(1)); Value disableSIMD = Value(var(0)); @@ -32,7 +33,8 @@ class DPFExporter final : public ExporterBase { PropertiesArray properties; properties.add(new PropertiesPanel::EditableComponent("Maker Name (optional)", makerNameValue)); properties.add(new PropertiesPanel::EditableComponent("Project License (optional)", projectLicenseValue)); - properties.add(new PropertiesPanel::ComboComponent("Export type", exportTypeValue, { "Binary", "Binary + GUI", "Source code", "Source + GUI code" })); + properties.add(new PropertiesPanel::ComboComponent("Export type", exportTypeValue, { "Binary", "Source code" })); + properties.add(new PropertiesPanel::ComboComponent("Gui type", guiTypeValue, { "None", "ImGui", "NanoVG" })); properties.add(new PropertiesPanel::ComboComponent("Plugin type", pluginTypeValue, { "Effect", "Instrument", "Custom" })); midiinProperty = new PropertiesPanel::BoolComponent("Midi Input", midiinEnableValue, { "No", "yes" }); @@ -88,6 +90,7 @@ class DPFExporter final : public ExporterBase { state->setProperty("clap_enable_value", getValue(clapEnableValue)); state->setProperty("jack_enable_value", getValue(jackEnableValue)); state->setProperty("export_type_value", getValue(exportTypeValue)); + state->setProperty("gui_type_value", getValue(guiTypeValue)); state->setProperty("plugin_type_value", getValue(pluginTypeValue)); state->setProperty("disable_simd", getValue(disableSIMD)); globalState->setProperty("dpf", state); @@ -110,6 +113,7 @@ class DPFExporter final : public ExporterBase { clapEnableValue = state->getProperty("clap_enable_value"); jackEnableValue = state->getProperty("jack_enable_value"); exportTypeValue = state->getProperty("export_type_value"); + guiTypeValue = state->getProperty("gui_type_value"); pluginTypeValue = state->getProperty("plugin_type_value"); disableSIMD = state->getProperty("disable_simd"); } @@ -149,6 +153,7 @@ class DPFExporter final : public ExporterBase { auto const projectLicense = getValue(projectLicenseValue); auto const exportType = getValue(exportTypeValue); + auto const guiType = getValue(guiTypeValue); auto const midiin = getValue(midiinEnableValue); auto const midiout = getValue(midioutEnableValue); @@ -197,8 +202,24 @@ class DPFExporter final : public ExporterBase { metaDPF.getDynamicObject()->setProperty("midi_output", midiout); metaDPF.getDynamicObject()->setProperty("plugin_formats", formats); - if (exportType == 2 || exportType == 4) { - metaDPF.getDynamicObject()->setProperty("enable_ui", true); + File themeJsonFile; + + if (guiType == 2) { + metaDPF.getDynamicObject()->setProperty("enable_ui", 1); + } else if (guiType == 3) { + metaDPF.getDynamicObject()->setProperty("enable_ui", 2); + args.add("--gui"); + + DynamicObject::Ptr const themeJson(new DynamicObject()); + + themeJson->setProperty("cnv_color", "#" + PlugDataColours::canvasBackgroundColour.toDisplayString(false)); + // themeJson->setProperty("text_color", PlugDataColours::canvasTextColour.toDisplayString(false)); + // themeJson->setProperty("io_color", PlugDataColours::ioletAreaColour.toDisplayString(false)); + // themeJson->setProperty("bg_color", PlugdataColours::); + // themeJson->setProperty("sel_color", PlugdataColours::); + // themeJson->setProperty("out_color", PlugdataColours::); + + themeJsonFile = createThemeJson(themeJson); } metaJson->setProperty("dpf", metaDPF); @@ -235,13 +256,20 @@ class DPFExporter final : public ExporterBase { auto const DPF = toolchainDir.getChildFile("lib").getChildFile("dpf"); DPF.copyDirectoryTo(outputFile.getChildFile("dpf")); - if (exportType == 2 || exportType == 4) { + if (guiType == 2) { auto const DPFGui = toolchainDir.getChildFile("lib").getChildFile("dpf-widgets"); DPFGui.copyDirectoryTo(outputFile.getChildFile("dpf-widgets")); + } else if (guiType == 3) { + auto const DPFGui = toolchainDir.getChildFile("lib").getChildFile("pdvg"); + DPFGui.copyDirectoryTo(outputFile.getChildFile("pdvg")); } - if (exportType == 3 || exportType == 4) { + if (exportType == 2) { metaJsonFile.copyFileTo(outputFile.getChildFile("meta.json")); + if (guiType == 3) { + // themeJsonFile.copyFileTo(outputFile.getChildFile(pdPatch.quoted() + "-theme.json")); + themeJsonFile.copyFileTo(outputFile.getChildFile(String("bladie") + String("-theme.json"))); + } } // Delay to get correct exit code @@ -249,7 +277,7 @@ class DPFExporter final : public ExporterBase { bool const generationExitCode = getExitCode(); // Check if we need to compile - if (!generationExitCode && (exportType == 1 || exportType == 2)) { + if (!generationExitCode && (exportType == 1)) { auto const workingDir = File::getCurrentWorkingDirectory(); outputFile.setAsCurrentWorkingDirectory(); @@ -304,7 +332,7 @@ class DPFExporter final : public ExporterBase { OSUtils::moveFileTo(outputFile.getChildFile("bin").getChildFile(name + ".clap"), outputFile.getChildFile(name + ".clap")); if (jack) { #if JUCE_MAC - if (exportType == 2) { + if (guiType == 2 || guiType == 3){ OSUtils::moveFileTo(outputFile.getChildFile("bin").getChildFile(name + ".app"), outputFile.getChildFile(name + ".app")); } else { OSUtils::moveFileTo(outputFile.getChildFile("bin").getChildFile(name), outputFile.getChildFile(name)); @@ -322,6 +350,7 @@ class DPFExporter final : public ExporterBase { if (!compilationExitCode) { outputFile.getChildFile("dpf").deleteRecursively(); outputFile.getChildFile("dpf-widgets").deleteRecursively(); + outputFile.getChildFile("pdvg").deleteRecursively(); outputFile.getChildFile("build").deleteRecursively(); outputFile.getChildFile("plugin").deleteRecursively(); outputFile.getChildFile("bin").deleteRecursively();