Browse Source

Cleanup and credits

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 3 years ago
parent
commit
b6ac2766dc
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 54 additions and 17 deletions
  1. +27
    -17
      src/CardinalCommon.cpp
  2. +27
    -0
      src/override/Scene.cpp

+ 27
- 17
src/CardinalCommon.cpp View File

@@ -15,6 +15,16 @@
* For a full copy of the GNU General Public License see the LICENSE file. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */


/**
* This file is partially based on VCVRack's patch.cpp
* Copyright (C) 2016-2021 VCV.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*/

#include "CardinalCommon.hpp" #include "CardinalCommon.hpp"


#include "AsyncDialog.hpp" #include "AsyncDialog.hpp"
@@ -42,31 +52,31 @@ namespace patchUtils


static void promptClear(const char* const message, const std::function<void()> action) static void promptClear(const char* const message, const std::function<void()> action)
{ {
if (APP->history->isSaved() || APP->scene->rack->hasModules())
return action();
if (APP->history->isSaved() || APP->scene->rack->hasModules())
return action();


asyncDialog::create(message, action);
asyncDialog::create(message, action);
} }


static std::string homeDir() static std::string homeDir()
{ {
#ifdef ARCH_WIN #ifdef ARCH_WIN
if (const char* const userprofile = getenv("USERPROFILE"))
{
return userprofile;
}
else if (const char* const homedrive = getenv("HOMEDRIVE"))
{
if (const char* const homepath = getenv("HOMEPATH"))
return system::join(homedrive, homepath);
}
if (const char* const userprofile = getenv("USERPROFILE"))
{
return userprofile;
}
else if (const char* const homedrive = getenv("HOMEDRIVE"))
{
if (const char* const homepath = getenv("HOMEPATH"))
return system::join(homedrive, homepath);
}
#else #else
if (const char* const home = getenv("HOME"))
return home;
else if (struct passwd* const pwd = getpwuid(getuid()))
return pwd->pw_dir;
if (const char* const home = getenv("HOME"))
return home;
else if (struct passwd* const pwd = getpwuid(getuid()))
return pwd->pw_dir;
#endif #endif
return {};
return {};
} }


using namespace rack; using namespace rack;


+ 27
- 0
src/override/Scene.cpp View File

@@ -1,3 +1,30 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
*/

/**
* This file is an edited version of VCVRack's Scene.cpp
* Copyright (C) 2016-2021 VCV.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*/

#include <thread> #include <thread>


#include <app/Scene.hpp> #include <app/Scene.hpp>


Loading…
Cancel
Save