@@ -5,19 +5,21 @@ | |||||
namespace rack { | namespace rack { | ||||
namespace asset { | |||||
void assetInit(bool devMode); | |||||
void init(bool devMode); | |||||
/** Returns the path of a global resource. Should only read files from this location. */ | /** Returns the path of a global resource. Should only read files from this location. */ | ||||
std::string assetGlobal(std::string filename); | |||||
std::string global(std::string filename); | |||||
/** Returns the path of a local resource. Can read and write files to this location. */ | /** Returns the path of a local resource. Can read and write files to this location. */ | ||||
std::string assetLocal(std::string filename); | |||||
std::string local(std::string filename); | |||||
/** Returns the path of a resource in the plugin's folder. Should only read files from this location. */ | /** Returns the path of a resource in the plugin's folder. Should only read files from this location. */ | ||||
std::string assetPlugin(Plugin *plugin, std::string filename); | |||||
std::string plugin(Plugin *plugin, std::string filename); | |||||
extern std::string assetGlobalDir; | |||||
extern std::string assetLocalDir; | |||||
extern std::string globalDir; | |||||
extern std::string localDir; | |||||
} // namespace asset | |||||
} // namespace rack | } // namespace rack |
@@ -35,25 +35,25 @@ struct RoundKnob : SVGKnob { | |||||
struct RoundBlackKnob : RoundKnob { | struct RoundBlackKnob : RoundKnob { | ||||
RoundBlackKnob() { | RoundBlackKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/RoundBlackKnob.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/RoundBlackKnob.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct RoundSmallBlackKnob : RoundKnob { | struct RoundSmallBlackKnob : RoundKnob { | ||||
RoundSmallBlackKnob() { | RoundSmallBlackKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/RoundSmallBlackKnob.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/RoundSmallBlackKnob.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct RoundLargeBlackKnob : RoundKnob { | struct RoundLargeBlackKnob : RoundKnob { | ||||
RoundLargeBlackKnob() { | RoundLargeBlackKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/RoundLargeBlackKnob.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/RoundLargeBlackKnob.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct RoundHugeBlackKnob : RoundKnob { | struct RoundHugeBlackKnob : RoundKnob { | ||||
RoundHugeBlackKnob() { | RoundHugeBlackKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/RoundHugeBlackKnob.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/RoundHugeBlackKnob.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -74,37 +74,37 @@ struct Davies1900hKnob : SVGKnob { | |||||
struct Davies1900hWhiteKnob : Davies1900hKnob { | struct Davies1900hWhiteKnob : Davies1900hKnob { | ||||
Davies1900hWhiteKnob() { | Davies1900hWhiteKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Davies1900hWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Davies1900hBlackKnob : Davies1900hKnob { | struct Davies1900hBlackKnob : Davies1900hKnob { | ||||
Davies1900hBlackKnob() { | Davies1900hBlackKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hBlack.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Davies1900hBlack.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Davies1900hRedKnob : Davies1900hKnob { | struct Davies1900hRedKnob : Davies1900hKnob { | ||||
Davies1900hRedKnob() { | Davies1900hRedKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Davies1900hRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Davies1900hLargeWhiteKnob : Davies1900hKnob { | struct Davies1900hLargeWhiteKnob : Davies1900hKnob { | ||||
Davies1900hLargeWhiteKnob() { | Davies1900hLargeWhiteKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Davies1900hLargeWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Davies1900hLargeBlackKnob : Davies1900hKnob { | struct Davies1900hLargeBlackKnob : Davies1900hKnob { | ||||
Davies1900hLargeBlackKnob() { | Davies1900hLargeBlackKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeBlack.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Davies1900hLargeBlack.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Davies1900hLargeRedKnob : Davies1900hKnob { | struct Davies1900hLargeRedKnob : Davies1900hKnob { | ||||
Davies1900hLargeRedKnob() { | Davies1900hLargeRedKnob() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Davies1900hLargeRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Davies1900hLargeRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -118,163 +118,163 @@ struct Rogan : SVGKnob { | |||||
struct Rogan6PSWhite : Rogan { | struct Rogan6PSWhite : Rogan { | ||||
Rogan6PSWhite() { | Rogan6PSWhite() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan6PSWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan6PSWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan5PSGray : Rogan { | struct Rogan5PSGray : Rogan { | ||||
Rogan5PSGray() { | Rogan5PSGray() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan5PSGray.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan5PSGray.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PSBlue : Rogan { | struct Rogan3PSBlue : Rogan { | ||||
Rogan3PSBlue() { | Rogan3PSBlue() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSBlue.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PSBlue.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PSRed : Rogan { | struct Rogan3PSRed : Rogan { | ||||
Rogan3PSRed() { | Rogan3PSRed() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PSRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PSGreen : Rogan { | struct Rogan3PSGreen : Rogan { | ||||
Rogan3PSGreen() { | Rogan3PSGreen() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSGreen.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PSGreen.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PSWhite : Rogan { | struct Rogan3PSWhite : Rogan { | ||||
Rogan3PSWhite() { | Rogan3PSWhite() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PSWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PSWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PBlue : Rogan { | struct Rogan3PBlue : Rogan { | ||||
Rogan3PBlue() { | Rogan3PBlue() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PBlue.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PBlue.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PRed : Rogan { | struct Rogan3PRed : Rogan { | ||||
Rogan3PRed() { | Rogan3PRed() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PGreen : Rogan { | struct Rogan3PGreen : Rogan { | ||||
Rogan3PGreen() { | Rogan3PGreen() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PGreen.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PGreen.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan3PWhite : Rogan { | struct Rogan3PWhite : Rogan { | ||||
Rogan3PWhite() { | Rogan3PWhite() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan3PWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan3PWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2SGray : Rogan { | struct Rogan2SGray : Rogan { | ||||
Rogan2SGray() { | Rogan2SGray() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2SGray.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2SGray.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PSBlue : Rogan { | struct Rogan2PSBlue : Rogan { | ||||
Rogan2PSBlue() { | Rogan2PSBlue() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSBlue.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PSBlue.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PSRed : Rogan { | struct Rogan2PSRed : Rogan { | ||||
Rogan2PSRed() { | Rogan2PSRed() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PSRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PSGreen : Rogan { | struct Rogan2PSGreen : Rogan { | ||||
Rogan2PSGreen() { | Rogan2PSGreen() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSGreen.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PSGreen.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PSWhite : Rogan { | struct Rogan2PSWhite : Rogan { | ||||
Rogan2PSWhite() { | Rogan2PSWhite() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PSWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PSWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PBlue : Rogan { | struct Rogan2PBlue : Rogan { | ||||
Rogan2PBlue() { | Rogan2PBlue() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PBlue.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PBlue.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PRed : Rogan { | struct Rogan2PRed : Rogan { | ||||
Rogan2PRed() { | Rogan2PRed() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PGreen : Rogan { | struct Rogan2PGreen : Rogan { | ||||
Rogan2PGreen() { | Rogan2PGreen() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PGreen.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PGreen.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan2PWhite : Rogan { | struct Rogan2PWhite : Rogan { | ||||
Rogan2PWhite() { | Rogan2PWhite() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan2PWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan2PWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PSBlue : Rogan { | struct Rogan1PSBlue : Rogan { | ||||
Rogan1PSBlue() { | Rogan1PSBlue() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSBlue.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PSBlue.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PSRed : Rogan { | struct Rogan1PSRed : Rogan { | ||||
Rogan1PSRed() { | Rogan1PSRed() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PSRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PSGreen : Rogan { | struct Rogan1PSGreen : Rogan { | ||||
Rogan1PSGreen() { | Rogan1PSGreen() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSGreen.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PSGreen.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PSWhite : Rogan { | struct Rogan1PSWhite : Rogan { | ||||
Rogan1PSWhite() { | Rogan1PSWhite() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PSWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PSWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PBlue : Rogan { | struct Rogan1PBlue : Rogan { | ||||
Rogan1PBlue() { | Rogan1PBlue() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PBlue.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PBlue.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PRed : Rogan { | struct Rogan1PRed : Rogan { | ||||
Rogan1PRed() { | Rogan1PRed() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PRed.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PRed.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PGreen : Rogan { | struct Rogan1PGreen : Rogan { | ||||
Rogan1PGreen() { | Rogan1PGreen() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PGreen.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PGreen.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct Rogan1PWhite : Rogan { | struct Rogan1PWhite : Rogan { | ||||
Rogan1PWhite() { | Rogan1PWhite() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Rogan1PWhite.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Rogan1PWhite.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -283,9 +283,9 @@ struct SynthTechAlco : SVGKnob { | |||||
SynthTechAlco() { | SynthTechAlco() { | ||||
minAngle = -0.82*M_PI; | minAngle = -0.82*M_PI; | ||||
maxAngle = 0.82*M_PI; | maxAngle = 0.82*M_PI; | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/SynthTechAlco.svg"))); | |||||
SVGWidget *cap = new SVGWidget(); | SVGWidget *cap = new SVGWidget(); | ||||
cap->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco_cap.svg"))); | |||||
cap->setSVG(SVG::load(asset::global("res/ComponentLibrary/SynthTechAlco_cap.svg"))); | |||||
addChild(cap); | addChild(cap); | ||||
} | } | ||||
}; | }; | ||||
@@ -294,7 +294,7 @@ struct Trimpot : SVGKnob { | |||||
Trimpot() { | Trimpot() { | ||||
minAngle = -0.75*M_PI; | minAngle = -0.75*M_PI; | ||||
maxAngle = 0.75*M_PI; | maxAngle = 0.75*M_PI; | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/Trimpot.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/Trimpot.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -302,7 +302,7 @@ struct BefacoBigKnob : SVGKnob { | |||||
BefacoBigKnob() { | BefacoBigKnob() { | ||||
minAngle = -0.75*M_PI; | minAngle = -0.75*M_PI; | ||||
maxAngle = 0.75*M_PI; | maxAngle = 0.75*M_PI; | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoBigKnob.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/BefacoBigKnob.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -317,7 +317,7 @@ struct BefacoTinyKnob : SVGKnob { | |||||
BefacoTinyKnob() { | BefacoTinyKnob() { | ||||
minAngle = -0.75*M_PI; | minAngle = -0.75*M_PI; | ||||
maxAngle = 0.75*M_PI; | maxAngle = 0.75*M_PI; | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/BefacoTinyKnob.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/BefacoTinyKnob.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -326,7 +326,7 @@ struct BefacoSlidePot : SVGSlider { | |||||
Vec margin = Vec(3.5, 3.5); | Vec margin = Vec(3.5, 3.5); | ||||
maxHandlePos = Vec(-1, -2).plus(margin); | maxHandlePos = Vec(-1, -2).plus(margin); | ||||
minHandlePos = Vec(-1, 87).plus(margin); | minHandlePos = Vec(-1, 87).plus(margin); | ||||
setSVGs(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePot.svg")), SVG::load(assetGlobal("res/ComponentLibrary/BefacoSlidePotHandle.svg"))); | |||||
setSVGs(SVG::load(asset::global("res/ComponentLibrary/BefacoSlidePot.svg")), SVG::load(asset::global("res/ComponentLibrary/BefacoSlidePotHandle.svg"))); | |||||
background->box.pos = margin; | background->box.pos = margin; | ||||
box.size = background->box.size.plus(margin.mult(2)); | box.size = background->box.size.plus(margin.mult(2)); | ||||
} | } | ||||
@@ -336,38 +336,38 @@ struct LEDSlider : SVGSlider { | |||||
LEDSlider() { | LEDSlider() { | ||||
maxHandlePos = mm2px(Vec(0.738, 0.738).plus(Vec(2, 0))); | maxHandlePos = mm2px(Vec(0.738, 0.738).plus(Vec(2, 0))); | ||||
minHandlePos = mm2px(Vec(0.738, 22.078).plus(Vec(2, 0))); | minHandlePos = mm2px(Vec(0.738, 22.078).plus(Vec(2, 0))); | ||||
setSVGs(SVG::load(assetGlobal("res/ComponentLibrary/LEDSlider.svg")), NULL); | |||||
setSVGs(SVG::load(asset::global("res/ComponentLibrary/LEDSlider.svg")), NULL); | |||||
} | } | ||||
}; | }; | ||||
/** API is unstable for LEDSlider. Will add a LightWidget later. */ | /** API is unstable for LEDSlider. Will add a LightWidget later. */ | ||||
struct LEDSliderGreen : LEDSlider { | struct LEDSliderGreen : LEDSlider { | ||||
LEDSliderGreen() { | LEDSliderGreen() { | ||||
handle->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/LEDSliderGreenHandle.svg"))); | |||||
handle->setSVG(SVG::load(asset::global("res/ComponentLibrary/LEDSliderGreenHandle.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct LEDSliderRed : LEDSlider { | struct LEDSliderRed : LEDSlider { | ||||
LEDSliderRed() { | LEDSliderRed() { | ||||
handle->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/LEDSliderRedHandle.svg"))); | |||||
handle->setSVG(SVG::load(asset::global("res/ComponentLibrary/LEDSliderRedHandle.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct LEDSliderYellow : LEDSlider { | struct LEDSliderYellow : LEDSlider { | ||||
LEDSliderYellow() { | LEDSliderYellow() { | ||||
handle->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/LEDSliderYellowHandle.svg"))); | |||||
handle->setSVG(SVG::load(asset::global("res/ComponentLibrary/LEDSliderYellowHandle.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct LEDSliderBlue : LEDSlider { | struct LEDSliderBlue : LEDSlider { | ||||
LEDSliderBlue() { | LEDSliderBlue() { | ||||
handle->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/LEDSliderBlueHandle.svg"))); | |||||
handle->setSVG(SVG::load(asset::global("res/ComponentLibrary/LEDSliderBlueHandle.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct LEDSliderWhite : LEDSlider { | struct LEDSliderWhite : LEDSlider { | ||||
LEDSliderWhite() { | LEDSliderWhite() { | ||||
handle->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/LEDSliderWhiteHandle.svg"))); | |||||
handle->setSVG(SVG::load(asset::global("res/ComponentLibrary/LEDSliderWhiteHandle.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -377,19 +377,19 @@ struct LEDSliderWhite : LEDSlider { | |||||
struct PJ301MPort : SVGPort { | struct PJ301MPort : SVGPort { | ||||
PJ301MPort() { | PJ301MPort() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/PJ301M.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/PJ301M.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct PJ3410Port : SVGPort { | struct PJ3410Port : SVGPort { | ||||
PJ3410Port() { | PJ3410Port() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/PJ3410.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/PJ3410.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct CL1362Port : SVGPort { | struct CL1362Port : SVGPort { | ||||
CL1362Port() { | CL1362Port() { | ||||
setSVG(SVG::load(assetGlobal("res/ComponentLibrary/CL1362.svg"))); | |||||
setSVG(SVG::load(asset::global("res/ComponentLibrary/CL1362.svg"))); | |||||
} | } | ||||
}; | }; | ||||
@@ -512,83 +512,83 @@ struct PB61303Light : BASE { | |||||
struct NKK : SVGSwitch, ToggleSwitch { | struct NKK : SVGSwitch, ToggleSwitch { | ||||
NKK() { | NKK() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_0.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_1.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/NKK_2.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/NKK_0.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/NKK_1.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/NKK_2.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct CKSS : SVGSwitch, ToggleSwitch { | struct CKSS : SVGSwitch, ToggleSwitch { | ||||
CKSS() { | CKSS() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_0.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSS_1.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/CKSS_0.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/CKSS_1.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct CKSSThree : SVGSwitch, ToggleSwitch { | struct CKSSThree : SVGSwitch, ToggleSwitch { | ||||
CKSSThree() { | CKSSThree() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_0.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_1.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_2.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/CKSSThree_0.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/CKSSThree_1.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/CKSSThree_2.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct CKD6 : SVGSwitch, MomentarySwitch { | struct CKD6 : SVGSwitch, MomentarySwitch { | ||||
CKD6() { | CKD6() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_0.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_1.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/CKD6_0.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/CKD6_1.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct TL1105 : SVGSwitch, MomentarySwitch { | struct TL1105 : SVGSwitch, MomentarySwitch { | ||||
TL1105() { | TL1105() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_0.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/TL1105_1.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/TL1105_0.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/TL1105_1.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct LEDButton : SVGSwitch, MomentarySwitch { | struct LEDButton : SVGSwitch, MomentarySwitch { | ||||
LEDButton() { | LEDButton() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDButton.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/LEDButton.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct BefacoSwitch : SVGSwitch, ToggleSwitch { | struct BefacoSwitch : SVGSwitch, ToggleSwitch { | ||||
BefacoSwitch() { | BefacoSwitch() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_0.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_1.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoSwitch_2.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/BefacoSwitch_0.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/BefacoSwitch_1.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/BefacoSwitch_2.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct BefacoPush : SVGSwitch, MomentarySwitch { | struct BefacoPush : SVGSwitch, MomentarySwitch { | ||||
BefacoPush() { | BefacoPush() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_0.svg"))); | |||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/BefacoPush_1.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/BefacoPush_0.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/BefacoPush_1.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct LEDBezel : SVGSwitch, MomentarySwitch { | struct LEDBezel : SVGSwitch, MomentarySwitch { | ||||
LEDBezel() { | LEDBezel() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/LEDBezel.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/LEDBezel.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct PB61303 : SVGSwitch, MomentarySwitch { | struct PB61303 : SVGSwitch, MomentarySwitch { | ||||
PB61303() { | PB61303() { | ||||
addFrame(SVG::load(assetGlobal("res/ComponentLibrary/PB61303.svg"))); | |||||
addFrame(SVG::load(asset::global("res/ComponentLibrary/PB61303.svg"))); | |||||
} | } | ||||
}; | }; | ||||
struct PB61303Button : SVGButton { | struct PB61303Button : SVGButton { | ||||
PB61303Button() { | PB61303Button() { | ||||
setSVGs(SVG::load(assetGlobal("res/ComponentLibrary/PB61303.svg")), NULL); | |||||
setSVGs(SVG::load(asset::global("res/ComponentLibrary/PB61303.svg")), NULL); | |||||
} | } | ||||
}; | }; | ||||
struct LEDBezelButton : SVGButton { | struct LEDBezelButton : SVGButton { | ||||
LEDBezelButton() { | LEDBezelButton() { | ||||
setSVGs(SVG::load(assetGlobal("res/ComponentLibrary/LEDBezel.svg")), NULL); | |||||
setSVGs(SVG::load(asset::global("res/ComponentLibrary/LEDBezel.svg")), NULL); | |||||
} | } | ||||
}; | }; | ||||
@@ -598,14 +598,14 @@ struct LEDBezelButton : SVGButton { | |||||
struct ScrewSilver : SVGScrew { | struct ScrewSilver : SVGScrew { | ||||
ScrewSilver() { | ScrewSilver() { | ||||
sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewSilver.svg"))); | |||||
sw->setSVG(SVG::load(asset::global("res/ComponentLibrary/ScrewSilver.svg"))); | |||||
box.size = sw->box.size; | box.size = sw->box.size; | ||||
} | } | ||||
}; | }; | ||||
struct ScrewBlack : SVGScrew { | struct ScrewBlack : SVGScrew { | ||||
ScrewBlack() { | ScrewBlack() { | ||||
sw->setSVG(SVG::load(assetGlobal("res/ComponentLibrary/ScrewBlack.svg"))); | |||||
sw->setSVG(SVG::load(asset::global("res/ComponentLibrary/ScrewBlack.svg"))); | |||||
box.size = sw->box.size; | box.size = sw->box.size; | ||||
} | } | ||||
}; | }; | ||||
@@ -239,7 +239,7 @@ void AudioInterface::step() { | |||||
struct AudioInterfaceWidget : ModuleWidget { | struct AudioInterfaceWidget : ModuleWidget { | ||||
AudioInterfaceWidget(AudioInterface *module) : ModuleWidget(module) { | AudioInterfaceWidget(AudioInterface *module) : ModuleWidget(module) { | ||||
setPanel(SVG::load(assetGlobal("res/Core/AudioInterface.svg"))); | |||||
setPanel(SVG::load(asset::global("res/Core/AudioInterface.svg"))); | |||||
addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | ||||
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | ||||
@@ -182,7 +182,7 @@ struct MidiCcWidget : Grid16MidiWidget { | |||||
struct MIDICCToCVInterfaceWidget : ModuleWidget { | struct MIDICCToCVInterfaceWidget : ModuleWidget { | ||||
MIDICCToCVInterfaceWidget(MIDICCToCVInterface *module) : ModuleWidget(module) { | MIDICCToCVInterfaceWidget(MIDICCToCVInterface *module) : ModuleWidget(module) { | ||||
setPanel(SVG::load(assetGlobal("res/Core/MIDICCToCVInterface.svg"))); | |||||
setPanel(SVG::load(asset::global("res/Core/MIDICCToCVInterface.svg"))); | |||||
addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | ||||
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | ||||
@@ -259,7 +259,7 @@ struct MIDIToCVInterface : Module { | |||||
struct MIDIToCVInterfaceWidget : ModuleWidget { | struct MIDIToCVInterfaceWidget : ModuleWidget { | ||||
MIDIToCVInterfaceWidget(MIDIToCVInterface *module) : ModuleWidget(module) { | MIDIToCVInterfaceWidget(MIDIToCVInterface *module) : ModuleWidget(module) { | ||||
setPanel(SVG::load(assetGlobal("res/Core/MIDIToCVInterface.svg"))); | |||||
setPanel(SVG::load(asset::global("res/Core/MIDIToCVInterface.svg"))); | |||||
addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | ||||
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | ||||
@@ -199,7 +199,7 @@ struct MidiTrigWidget : Grid16MidiWidget { | |||||
struct MIDITriggerToCVInterfaceWidget : ModuleWidget { | struct MIDITriggerToCVInterfaceWidget : ModuleWidget { | ||||
MIDITriggerToCVInterfaceWidget(MIDITriggerToCVInterface *module) : ModuleWidget(module) { | MIDITriggerToCVInterfaceWidget(MIDITriggerToCVInterface *module) : ModuleWidget(module) { | ||||
setPanel(SVG::load(assetGlobal("res/Core/MIDITriggerToCVInterface.svg"))); | |||||
setPanel(SVG::load(asset::global("res/Core/MIDITriggerToCVInterface.svg"))); | |||||
addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | ||||
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | ||||
@@ -8,7 +8,7 @@ struct NotesWidget : ModuleWidget { | |||||
TextField *textField; | TextField *textField; | ||||
NotesWidget(Module *module) : ModuleWidget(module) { | NotesWidget(Module *module) : ModuleWidget(module) { | ||||
setPanel(SVG::load(assetGlobal("res/Core/Notes.svg"))); | |||||
setPanel(SVG::load(asset::global("res/Core/Notes.svg"))); | |||||
addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | ||||
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | ||||
@@ -301,7 +301,7 @@ struct QuadMIDIToCVInterface : Module { | |||||
struct QuadMIDIToCVInterfaceWidget : ModuleWidget { | struct QuadMIDIToCVInterfaceWidget : ModuleWidget { | ||||
QuadMIDIToCVInterfaceWidget(QuadMIDIToCVInterface *module) : ModuleWidget(module) { | QuadMIDIToCVInterfaceWidget(QuadMIDIToCVInterface *module) : ModuleWidget(module) { | ||||
setPanel(SVG::load(assetGlobal("res/Core/QuadMIDIToCVInterface.svg"))); | |||||
setPanel(SVG::load(asset::global("res/Core/QuadMIDIToCVInterface.svg"))); | |||||
addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0))); | ||||
addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | addChild(Widget::create<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); | ||||
@@ -32,7 +32,7 @@ void LedDisplaySeparator::draw(NVGcontext *vg) { | |||||
LedDisplayChoice::LedDisplayChoice() { | LedDisplayChoice::LedDisplayChoice() { | ||||
box.size = mm2px(math::Vec(0, 28.0 / 3)); | box.size = mm2px(math::Vec(0, 28.0 / 3)); | ||||
font = Font::load(assetGlobal("res/fonts/ShareTechMono-Regular.ttf")); | |||||
font = Font::load(asset::global("res/fonts/ShareTechMono-Regular.ttf")); | |||||
color = nvgRGB(0xff, 0xd7, 0x14); | color = nvgRGB(0xff, 0xd7, 0x14); | ||||
textOffset = math::Vec(10, 18); | textOffset = math::Vec(10, 18); | ||||
} | } | ||||
@@ -63,7 +63,7 @@ void LedDisplayChoice::onMouseDown(EventMouseDown &e) { | |||||
LedDisplayTextField::LedDisplayTextField() { | LedDisplayTextField::LedDisplayTextField() { | ||||
font = Font::load(assetGlobal("res/fonts/ShareTechMono-Regular.ttf")); | |||||
font = Font::load(asset::global("res/fonts/ShareTechMono-Regular.ttf")); | |||||
color = nvgRGB(0xff, 0xd7, 0x14); | color = nvgRGB(0xff, 0xd7, 0x14); | ||||
textOffset = math::Vec(5, 5); | textOffset = math::Vec(5, 5); | ||||
} | } | ||||
@@ -226,7 +226,7 @@ void ModuleWidget::save(std::string filename) { | |||||
} | } | ||||
void ModuleWidget::loadDialog() { | void ModuleWidget::loadDialog() { | ||||
std::string dir = assetLocal("presets"); | |||||
std::string dir = asset::local("presets"); | |||||
systemCreateDirectory(dir); | systemCreateDirectory(dir); | ||||
osdialog_filters *filters = osdialog_filters_parse(PRESET_FILTERS.c_str()); | osdialog_filters *filters = osdialog_filters_parse(PRESET_FILTERS.c_str()); | ||||
@@ -239,7 +239,7 @@ void ModuleWidget::loadDialog() { | |||||
} | } | ||||
void ModuleWidget::saveDialog() { | void ModuleWidget::saveDialog() { | ||||
std::string dir = assetLocal("presets"); | |||||
std::string dir = asset::local("presets"); | |||||
systemCreateDirectory(dir); | systemCreateDirectory(dir); | ||||
osdialog_filters *filters = osdialog_filters_parse(PRESET_FILTERS.c_str()); | osdialog_filters *filters = osdialog_filters_parse(PRESET_FILTERS.c_str()); | ||||
@@ -63,7 +63,7 @@ void RackWidget::reset() { | |||||
if (osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "Clear patch and start over?")) { | if (osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "Clear patch and start over?")) { | ||||
clear(); | clear(); | ||||
// Fails silently if file does not exist | // Fails silently if file does not exist | ||||
load(assetLocal("template.vcv")); | |||||
load(asset::local("template.vcv")); | |||||
lastPath = ""; | lastPath = ""; | ||||
} | } | ||||
} | } | ||||
@@ -71,7 +71,7 @@ void RackWidget::reset() { | |||||
void RackWidget::loadDialog() { | void RackWidget::loadDialog() { | ||||
std::string dir; | std::string dir; | ||||
if (lastPath.empty()) { | if (lastPath.empty()) { | ||||
dir = assetLocal("patches"); | |||||
dir = asset::local("patches"); | |||||
systemCreateDirectory(dir); | systemCreateDirectory(dir); | ||||
} | } | ||||
else { | else { | ||||
@@ -100,7 +100,7 @@ void RackWidget::saveAsDialog() { | |||||
std::string dir; | std::string dir; | ||||
std::string filename; | std::string filename; | ||||
if (lastPath.empty()) { | if (lastPath.empty()) { | ||||
dir = assetLocal("patches"); | |||||
dir = asset::local("patches"); | |||||
systemCreateDirectory(dir); | systemCreateDirectory(dir); | ||||
} | } | ||||
else { | else { | ||||
@@ -490,8 +490,8 @@ void RackWidget::step() { | |||||
// Autosave every 15 seconds | // Autosave every 15 seconds | ||||
if (gGuiFrame % (60 * 15) == 0) { | if (gGuiFrame % (60 * 15) == 0) { | ||||
save(assetLocal("autosave.vcv")); | |||||
settingsSave(assetLocal("settings.json")); | |||||
save(asset::local("autosave.vcv")); | |||||
settingsSave(asset::local("settings.json")); | |||||
} | } | ||||
Widget::step(); | Widget::step(); | ||||
@@ -31,7 +31,7 @@ struct TooltipIconButton : IconButton { | |||||
struct NewButton : TooltipIconButton { | struct NewButton : TooltipIconButton { | ||||
NewButton() { | NewButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_146097_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_146097_cc.svg"))); | |||||
tooltipText = "New patch (" WINDOW_MOD_KEY_NAME "+N)"; | tooltipText = "New patch (" WINDOW_MOD_KEY_NAME "+N)"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -41,7 +41,7 @@ struct NewButton : TooltipIconButton { | |||||
struct OpenButton : TooltipIconButton { | struct OpenButton : TooltipIconButton { | ||||
OpenButton() { | OpenButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_31859_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_31859_cc.svg"))); | |||||
tooltipText = "Open patch (" WINDOW_MOD_KEY_NAME "+O)"; | tooltipText = "Open patch (" WINDOW_MOD_KEY_NAME "+O)"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -51,7 +51,7 @@ struct OpenButton : TooltipIconButton { | |||||
struct SaveButton : TooltipIconButton { | struct SaveButton : TooltipIconButton { | ||||
SaveButton() { | SaveButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_1343816_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_1343816_cc.svg"))); | |||||
tooltipText = "Save patch (" WINDOW_MOD_KEY_NAME "+S)"; | tooltipText = "Save patch (" WINDOW_MOD_KEY_NAME "+S)"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -61,7 +61,7 @@ struct SaveButton : TooltipIconButton { | |||||
struct SaveAsButton : TooltipIconButton { | struct SaveAsButton : TooltipIconButton { | ||||
SaveAsButton() { | SaveAsButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_1343811_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_1343811_cc.svg"))); | |||||
tooltipText = "Save patch as (" WINDOW_MOD_KEY_NAME "+Shift+S)"; | tooltipText = "Save patch as (" WINDOW_MOD_KEY_NAME "+Shift+S)"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -71,7 +71,7 @@ struct SaveAsButton : TooltipIconButton { | |||||
struct RevertButton : TooltipIconButton { | struct RevertButton : TooltipIconButton { | ||||
RevertButton() { | RevertButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_1084369_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_1084369_cc.svg"))); | |||||
tooltipText = "Revert patch"; | tooltipText = "Revert patch"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -81,7 +81,7 @@ struct RevertButton : TooltipIconButton { | |||||
struct DisconnectCablesButton : TooltipIconButton { | struct DisconnectCablesButton : TooltipIconButton { | ||||
DisconnectCablesButton() { | DisconnectCablesButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_1745061_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_1745061_cc.svg"))); | |||||
tooltipText = "Disconnect cables"; | tooltipText = "Disconnect cables"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -91,7 +91,7 @@ struct DisconnectCablesButton : TooltipIconButton { | |||||
struct PowerMeterButton : TooltipIconButton { | struct PowerMeterButton : TooltipIconButton { | ||||
PowerMeterButton() { | PowerMeterButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_305536_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_305536_cc.svg"))); | |||||
tooltipText = "Toggle power meter (see manual for explanation)"; | tooltipText = "Toggle power meter (see manual for explanation)"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -115,7 +115,7 @@ struct SampleRateItem : MenuItem { | |||||
struct SampleRateButton : TooltipIconButton { | struct SampleRateButton : TooltipIconButton { | ||||
SampleRateButton() { | SampleRateButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_1240789_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_1240789_cc.svg"))); | |||||
tooltipText = "Engine sample rate"; | tooltipText = "Engine sample rate"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -142,7 +142,7 @@ struct SampleRateButton : TooltipIconButton { | |||||
struct RackLockButton : TooltipIconButton { | struct RackLockButton : TooltipIconButton { | ||||
RackLockButton() { | RackLockButton() { | ||||
setSVG(SVG::load(assetGlobal("res/icons/noun_468341_cc.svg"))); | |||||
setSVG(SVG::load(asset::global("res/icons/noun_468341_cc.svg"))); | |||||
tooltipText = "Lock modules"; | tooltipText = "Lock modules"; | ||||
} | } | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
@@ -204,7 +204,7 @@ Toolbar::Toolbar() { | |||||
layout->addChild(zoomSlider); | layout->addChild(zoomSlider); | ||||
// Kind of hacky, but display the PluginManagerWidget only if the local directory is not the development directory | // Kind of hacky, but display the PluginManagerWidget only if the local directory is not the development directory | ||||
if (assetLocal("") != "./") { | |||||
if (asset::local("") != "./") { | |||||
Widget *pluginManager = new PluginManagerWidget(); | Widget *pluginManager = new PluginManagerWidget(); | ||||
layout->addChild(pluginManager); | layout->addChild(pluginManager); | ||||
} | } | ||||
@@ -21,16 +21,17 @@ | |||||
namespace rack { | namespace rack { | ||||
namespace asset { | |||||
std::string assetGlobalDir; | |||||
std::string assetLocalDir; | |||||
std::string globalDir; | |||||
std::string localDir; | |||||
void assetInit(bool devMode) { | |||||
if (assetGlobalDir.empty()) { | |||||
void init(bool devMode) { | |||||
if (globalDir.empty()) { | |||||
if (devMode) { | if (devMode) { | ||||
assetGlobalDir = "."; | |||||
globalDir = "."; | |||||
} | } | ||||
else { | else { | ||||
#if ARCH_MAC | #if ARCH_MAC | ||||
@@ -41,25 +42,25 @@ void assetInit(bool devMode) { | |||||
Boolean success = CFURLGetFileSystemRepresentation(resourcesUrl, TRUE, (UInt8*) resourcesBuf, sizeof(resourcesBuf)); | Boolean success = CFURLGetFileSystemRepresentation(resourcesUrl, TRUE, (UInt8*) resourcesBuf, sizeof(resourcesBuf)); | ||||
assert(success); | assert(success); | ||||
CFRelease(resourcesUrl); | CFRelease(resourcesUrl); | ||||
assetGlobalDir = resourcesBuf; | |||||
globalDir = resourcesBuf; | |||||
#endif | #endif | ||||
#if ARCH_WIN | #if ARCH_WIN | ||||
char moduleBuf[MAX_PATH]; | char moduleBuf[MAX_PATH]; | ||||
DWORD length = GetModuleFileName(NULL, moduleBuf, sizeof(moduleBuf)); | DWORD length = GetModuleFileName(NULL, moduleBuf, sizeof(moduleBuf)); | ||||
assert(length > 0); | assert(length > 0); | ||||
PathRemoveFileSpec(moduleBuf); | PathRemoveFileSpec(moduleBuf); | ||||
assetGlobalDir = moduleBuf; | |||||
globalDir = moduleBuf; | |||||
#endif | #endif | ||||
#if ARCH_LIN | #if ARCH_LIN | ||||
// TODO For now, users should launch Rack from their terminal in the global directory | // TODO For now, users should launch Rack from their terminal in the global directory | ||||
assetGlobalDir = "."; | |||||
globalDir = "."; | |||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
if (assetLocalDir.empty()) { | |||||
if (localDir.empty()) { | |||||
if (devMode) { | if (devMode) { | ||||
assetLocalDir = "."; | |||||
localDir = "."; | |||||
} | } | ||||
else { | else { | ||||
#if ARCH_WIN | #if ARCH_WIN | ||||
@@ -67,15 +68,15 @@ void assetInit(bool devMode) { | |||||
char documentsBuf[MAX_PATH]; | char documentsBuf[MAX_PATH]; | ||||
HRESULT result = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documentsBuf); | HRESULT result = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documentsBuf); | ||||
assert(result == S_OK); | assert(result == S_OK); | ||||
assetLocalDir = documentsBuf; | |||||
assetLocalDir += "/Rack"; | |||||
localDir = documentsBuf; | |||||
localDir += "/Rack"; | |||||
#endif | #endif | ||||
#if ARCH_MAC | #if ARCH_MAC | ||||
// Get home directory | // Get home directory | ||||
struct passwd *pw = getpwuid(getuid()); | struct passwd *pw = getpwuid(getuid()); | ||||
assert(pw); | assert(pw); | ||||
assetLocalDir = pw->pw_dir; | |||||
assetLocalDir += "/Documents/Rack"; | |||||
localDir = pw->pw_dir; | |||||
localDir += "/Documents/Rack"; | |||||
#endif | #endif | ||||
#if ARCH_LIN | #if ARCH_LIN | ||||
// Get home directory | // Get home directory | ||||
@@ -85,31 +86,32 @@ void assetInit(bool devMode) { | |||||
assert(pw); | assert(pw); | ||||
homeBuf = pw->pw_dir; | homeBuf = pw->pw_dir; | ||||
} | } | ||||
assetLocalDir = homeBuf; | |||||
assetLocalDir += "/.Rack"; | |||||
localDir = homeBuf; | |||||
localDir += "/.Rack"; | |||||
#endif | #endif | ||||
} | } | ||||
} | } | ||||
systemCreateDirectory(assetGlobalDir); | |||||
systemCreateDirectory(assetLocalDir); | |||||
systemCreateDirectory(globalDir); | |||||
systemCreateDirectory(localDir); | |||||
} | } | ||||
std::string assetGlobal(std::string filename) { | |||||
return assetGlobalDir + "/" + filename; | |||||
std::string global(std::string filename) { | |||||
return globalDir + "/" + filename; | |||||
} | } | ||||
std::string assetLocal(std::string filename) { | |||||
return assetLocalDir + "/" + filename; | |||||
std::string local(std::string filename) { | |||||
return localDir + "/" + filename; | |||||
} | } | ||||
std::string assetPlugin(Plugin *plugin, std::string filename) { | |||||
std::string plugin(Plugin *plugin, std::string filename) { | |||||
assert(plugin); | assert(plugin); | ||||
return plugin->path + "/" + filename; | return plugin->path + "/" + filename; | ||||
} | } | ||||
} // namespace asset | |||||
} // namespace rack | } // namespace rack |
@@ -18,7 +18,7 @@ void init(bool devMode) { | |||||
outputFile = stderr; | outputFile = stderr; | ||||
} | } | ||||
else { | else { | ||||
std::string logFilename = assetLocal("log.txt"); | |||||
std::string logFilename = asset::local("log.txt"); | |||||
outputFile = fopen(logFilename.c_str(), "w"); | outputFile = fopen(logFilename.c_str(), "w"); | ||||
} | } | ||||
} | } | ||||
@@ -35,10 +35,10 @@ int main(int argc, char* argv[]) { | |||||
devMode = true; | devMode = true; | ||||
} break; | } break; | ||||
case 'g': { | case 'g': { | ||||
assetGlobalDir = optarg; | |||||
asset::globalDir = optarg; | |||||
} break; | } break; | ||||
case 'l': { | case 'l': { | ||||
assetLocalDir = optarg; | |||||
asset::localDir = optarg; | |||||
} break; | } break; | ||||
default: break; | default: break; | ||||
} | } | ||||
@@ -60,15 +60,15 @@ int main(int argc, char* argv[]) { | |||||
// Initialize environment | // Initialize environment | ||||
randomInit(); | randomInit(); | ||||
assetInit(devMode); | |||||
asset::init(devMode); | |||||
logger::init(devMode); | logger::init(devMode); | ||||
// Log environment | // Log environment | ||||
info("%s %s", gApplicationName.c_str(), gApplicationVersion.c_str()); | info("%s %s", gApplicationName.c_str(), gApplicationVersion.c_str()); | ||||
if (devMode) | if (devMode) | ||||
info("Development mode"); | info("Development mode"); | ||||
info("Global directory: %s", assetGlobal("").c_str()); | |||||
info("Local directory: %s", assetLocal("").c_str()); | |||||
info("Global directory: %s", asset::global("").c_str()); | |||||
info("Local directory: %s", asset::local("").c_str()); | |||||
// Initialize app | // Initialize app | ||||
pluginInit(devMode); | pluginInit(devMode); | ||||
@@ -79,13 +79,13 @@ int main(int argc, char* argv[]) { | |||||
gamepadInit(); | gamepadInit(); | ||||
windowInit(); | windowInit(); | ||||
appInit(devMode); | appInit(devMode); | ||||
settingsLoad(assetLocal("settings.json")); | |||||
settingsLoad(asset::local("settings.json")); | |||||
if (patchFile.empty()) { | if (patchFile.empty()) { | ||||
// To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded. | // To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded. | ||||
bool oldSkipAutosaveOnLaunch = gSkipAutosaveOnLaunch; | bool oldSkipAutosaveOnLaunch = gSkipAutosaveOnLaunch; | ||||
gSkipAutosaveOnLaunch = true; | gSkipAutosaveOnLaunch = true; | ||||
settingsSave(assetLocal("settings.json")); | |||||
settingsSave(asset::local("settings.json")); | |||||
gSkipAutosaveOnLaunch = false; | gSkipAutosaveOnLaunch = false; | ||||
if (oldSkipAutosaveOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Clear your patch and start over?")) { | if (oldSkipAutosaveOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Clear your patch and start over?")) { | ||||
gRackWidget->lastPath = ""; | gRackWidget->lastPath = ""; | ||||
@@ -93,7 +93,7 @@ int main(int argc, char* argv[]) { | |||||
else { | else { | ||||
// Load autosave | // Load autosave | ||||
std::string oldLastPath = gRackWidget->lastPath; | std::string oldLastPath = gRackWidget->lastPath; | ||||
gRackWidget->load(assetLocal("autosave.vcv")); | |||||
gRackWidget->load(asset::local("autosave.vcv")); | |||||
gRackWidget->lastPath = oldLastPath; | gRackWidget->lastPath = oldLastPath; | ||||
} | } | ||||
} | } | ||||
@@ -108,8 +108,8 @@ int main(int argc, char* argv[]) { | |||||
engineStop(); | engineStop(); | ||||
// Destroy namespaces | // Destroy namespaces | ||||
gRackWidget->save(assetLocal("autosave.vcv")); | |||||
settingsSave(assetLocal("settings.json")); | |||||
gRackWidget->save(asset::local("autosave.vcv")); | |||||
settingsSave(asset::local("settings.json")); | |||||
appDestroy(); | appDestroy(); | ||||
windowDestroy(); | windowDestroy(); | ||||
bridgeDestroy(); | bridgeDestroy(); | ||||
@@ -199,7 +199,7 @@ static bool syncPlugin(std::string slug, json_t *manifestJ, bool dryRun) { | |||||
info("Downloading plugin %s %s %s", slug.c_str(), latestVersion.c_str(), arch.c_str()); | info("Downloading plugin %s %s %s", slug.c_str(), latestVersion.c_str(), arch.c_str()); | ||||
// Download zip | // Download zip | ||||
std::string pluginDest = assetLocal("plugins/" + slug + ".zip"); | |||||
std::string pluginDest = asset::local("plugins/" + slug + ".zip"); | |||||
if (!requestDownload(downloadUrl, pluginDest, &downloadProgress)) { | if (!requestDownload(downloadUrl, pluginDest, &downloadProgress)) { | ||||
warn("Plugin %s download was unsuccessful", slug.c_str()); | warn("Plugin %s download was unsuccessful", slug.c_str()); | ||||
return false; | return false; | ||||
@@ -331,14 +331,14 @@ void pluginInit(bool devMode) { | |||||
gPlugins.push_back(corePlugin); | gPlugins.push_back(corePlugin); | ||||
// Get local plugins directory | // Get local plugins directory | ||||
std::string localPlugins = assetLocal("plugins"); | |||||
std::string localPlugins = asset::local("plugins"); | |||||
mkdir(localPlugins.c_str(), 0755); | mkdir(localPlugins.c_str(), 0755); | ||||
if (!devMode) { | if (!devMode) { | ||||
// Copy Fundamental package to plugins directory if folder does not exist | // Copy Fundamental package to plugins directory if folder does not exist | ||||
std::string fundamentalSrc = assetGlobal("Fundamental.zip"); | |||||
std::string fundamentalDest = assetLocal("plugins/Fundamental.zip"); | |||||
std::string fundamentalDir = assetLocal("plugins/Fundamental"); | |||||
std::string fundamentalSrc = asset::global("Fundamental.zip"); | |||||
std::string fundamentalDest = asset::local("plugins/Fundamental.zip"); | |||||
std::string fundamentalDir = asset::local("plugins/Fundamental"); | |||||
if (systemIsFile(fundamentalSrc) && !systemIsFile(fundamentalDest) && !systemIsDirectory(fundamentalDir)) { | if (systemIsFile(fundamentalSrc) && !systemIsFile(fundamentalDest) && !systemIsDirectory(fundamentalDir)) { | ||||
systemCopy(fundamentalSrc, fundamentalDest); | systemCopy(fundamentalSrc, fundamentalDest); | ||||
} | } | ||||
@@ -401,7 +401,7 @@ void windowInit() { | |||||
assert(gFramebufferVg); | assert(gFramebufferVg); | ||||
// Set up Blendish | // Set up Blendish | ||||
gGuiFont = Font::load(assetGlobal("res/fonts/DejaVuSans.ttf")); | |||||
gGuiFont = Font::load(asset::global("res/fonts/DejaVuSans.ttf")); | |||||
bndSetFont(gGuiFont->handle); | bndSetFont(gGuiFont->handle); | ||||
windowSetTheme(nvgRGB(0x33, 0x33, 0x33), nvgRGB(0xf0, 0xf0, 0xf0)); | windowSetTheme(nvgRGB(0x33, 0x33, 0x33), nvgRGB(0xf0, 0xf0, 0xf0)); | ||||