Browse Source

Use dpf utils for finding resources; Ensure GL3 usage

master
falkTX 2 years ago
parent
commit
28dd8b042b
6 changed files with 45 additions and 84 deletions
  1. +0
    -6
      Makefile
  2. +1
    -1
      dpf
  3. +31
    -76
      plugins/ProM/DistrhoUIProM.cpp
  4. +10
    -1
      plugins/ProM/DistrhoUIProM.hpp
  5. +1
    -0
      plugins/ProM/Makefile
  6. +2
    -0
      plugins/ProM/ResizeHandle.hpp

+ 0
- 6
Makefile View File

@@ -38,9 +38,6 @@ ifeq ($(MACOS),true)
install -d bin/ProM.vst/Contents/Resources/presets
ln -sf $(CURDIR)/plugins/ProM/projectM/presets/presets_* bin/ProM.vst/Contents/Resources/presets/
else
# VST2 directory
install -d bin/ProM.vst
mv bin/ProM-vst$(LIB_EXT) bin/ProM.vst/ProM$(LIB_EXT)
# VST2 fonts
install -d bin/ProM.vst/resources/fonts
ln -sf $(CURDIR)/plugins/ProM/projectM/fonts/*.ttf bin/ProM.vst/resources/fonts/
@@ -62,9 +59,6 @@ endif
ifneq ($(CROSS_COMPILING),true)
gen: plugins dpf/utils/lv2_ttl_generator
@$(CURDIR)/dpf/utils/generate-ttl.sh
ifeq ($(MACOS),true)
@$(CURDIR)/dpf/utils/generate-vst-bundles.sh
endif

dpf/utils/lv2_ttl_generator:
$(MAKE) -C dpf/utils/lv2-ttl-generator


+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit d8521efcdd36317421bd4cd3fccf58e1b9bcecf6
Subproject commit 7b3b7bacf5b57afd294603642811e72452847f17

+ 31
- 76
plugins/ProM/DistrhoUIProM.cpp View File

@@ -26,84 +26,31 @@
#include "DistrhoPluginProM.hpp"
#include "DistrhoUIProM.hpp"

#ifndef DISTRHO_OS_WINDOWS
# include <dlfcn.h>
#endif

#ifdef DISTRHO_OS_WINDOWS
static HINSTANCE hInstance = nullptr;

DISTRHO_PLUGIN_EXPORT
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
{
if (reason == DLL_PROCESS_ATTACH)
hInstance = hInst;
return 1;
}
#endif
#include "DistrhoPluginUtils.hpp"

START_NAMESPACE_DISTRHO

// -----------------------------------------------------------------------

static String getCurrentExecutableDataDir()
{
static String datadir;

if (datadir.isNotEmpty())
return datadir;

#ifdef DISTRHO_OS_WINDOWS
CHAR filename[MAX_PATH + 256];
filename[0] = '\0';
GetModuleFileName(hInstance, filename, sizeof(filename));

datadir = String(filename);
datadir.truncate(datadir.rfind('\\'));
#else
Dl_info info;
dladdr((void*)getCurrentExecutableDataDir, &info);

datadir = String(info.dli_fname);
datadir.truncate(datadir.rfind('/'));

# ifdef DISTRHO_OS_MAC
if (datadir.endsWith("/MacOS"))
{
datadir.truncate(datadir.rfind('/'));
datadir += "/Resources";
}
else
# endif
if (datadir.endsWith("/x86_64-linux"))
{
datadir.truncate(datadir.rfind('/'));
datadir += "/Resources";
}
else
#endif
{
datadir += "/resources";
}

return datadir;
}

// -----------------------------------------------------------------------

DistrhoUIProM::DistrhoUIProM()
: UI(512, 512),
fPM(nullptr),
fResizeHandle(this)
fPM(nullptr)
#ifndef DGL_USE_OPENGL3
, fResizeHandle(this)
#endif
{
// const double scaleFactor = getScaleFactor();
// if (d_isNotZero(scaleFactor))
// setSize(512*scaleFactor, 512*scaleFactor)
setGeometryConstraints(256, 256, true);
const double scaleFactor = getScaleFactor();

if (d_isNotZero(scaleFactor))
setSize(512*scaleFactor, 512*scaleFactor);

setGeometryConstraints(256*scaleFactor, 256*scaleFactor, true);

// no need to show resize handle if window is user-resizable
#ifndef DGL_USE_OPENGL3
// if (isResizable())
// fResizeHandle.hide();
#endif
}

DistrhoUIProM::~DistrhoUIProM()
@@ -154,19 +101,27 @@ void DistrhoUIProM::uiReshape(uint width, uint height)
#ifdef PROJECTM_DATA_DIR
fPM = new projectM(PROJECTM_DATA_DIR "/config.inp");
#else
const String datadir(getCurrentExecutableDataDir());
d_stdout("ProM datadir: '%s'", datadir.buffer());

projectM::Settings settings;
settings.presetURL = datadir + DISTRHO_OS_SEP_STR "presets";
settings.titleFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "Vera.ttf";
settings.menuFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "VeraMono.ttf";
settings.datadir = datadir;
fPM = new projectM(settings);
if (const char* const bundlePath = getBundlePath())
{
const String datadir(getResourcePath(bundlePath));
d_stdout("ProM datadir: '%s'", datadir.buffer());

projectM::Settings settings;
settings.presetURL = datadir + DISTRHO_OS_SEP_STR "presets";
settings.titleFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "Vera.ttf";
settings.menuFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "VeraMono.ttf";
settings.datadir = datadir;
fPM = new projectM(settings);
}
else
{
d_stderr2("ProM: failed to find bundle path, UI will be empty");
}
#endif
}

fPM->projectM_resetGL(width, height);
if (fPM != nullptr)
fPM->projectM_resetGL(width, height);
}

// -----------------------------------------------------------------------


+ 10
- 1
plugins/ProM/DistrhoUIProM.hpp View File

@@ -17,8 +17,15 @@
#ifndef DISTRHO_UI_PROM_HPP_INCLUDED
#define DISTRHO_UI_PROM_HPP_INCLUDED

#if defined(DISTRHO_OS_MAC) || defined(DISTRHO_OS_WINDOWS)
# define DGL_USE_OPENGL3
#endif

#include "DistrhoUI.hpp"
#include "ResizeHandle.hpp"

#ifndef DGL_USE_OPENGL3
# include "ResizeHandle.hpp"
#endif

class projectM;

@@ -52,7 +59,9 @@ protected:

private:
ScopedPointer<projectM> fPM;
#ifndef DGL_USE_OPENGL3
ResizeHandle fResizeHandle;
#endif

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIProM)
};


+ 1
- 0
plugins/ProM/Makefile View File

@@ -105,6 +105,7 @@ endif # !HAVE_PROJECTM
# --------------------------------------------------------------
# Do some magic

USE_VST2_BUNDLE = true
include ../../dpf/Makefile.plugins.mk

# --------------------------------------------------------------


+ 2
- 0
plugins/ProM/ResizeHandle.hpp View File

@@ -58,7 +58,9 @@ protected:

#ifdef DGL_OPENGL
glUseProgram(0);
# ifndef DGL_USE_OPENGL3
glMatrixMode(GL_MODELVIEW);
# endif
#endif

// draw white lines, 1px wide


Loading…
Cancel
Save