I’m using this code to check for the current VST DLL Folder and load a skin file, and open a directory inside it. Where I keep my DATA files. Just sharing. I don’t know if there’s an easier / cleaner way to do this. So if my code is dirty, please, let me know, I’m here to learn too. :oops:
[code] // Read Skin File Positions //
File xFile(File::getSpecialLocation(File::currentExecutableFile));
xFile = xFile.getParentDirectory();
String dPath(xFile.getFullPathName());
dPath.append(T("\Wusik Red Fuse\Skins\Default\Positions.xml"),99);
XmlDocument myDocument = new XmlDocument ( File(dPath) );
if (myDocument != 0)
{
XmlElement myParentXml = myDocument->getDocumentElement();
forEachXmlChildElement (*myParentXml, child)
{
int Pos[4] = {0,0,0,0};
Pos[0] = child->getIntAttribute(T("PosX"), Pos[0] );
Pos[1] = child->getIntAttribute(T("PosY"), Pos[1] );
Pos[2] = child->getIntAttribute(T("Width"), Pos[2] );
Pos[3] = child->getIntAttribute(T("Height"), Pos[3] );
if (child->hasTagName (T("TreeView"))) cTreeView->setBounds (Pos[0],Pos[1],Pos[2],Pos[3]);
if (child->hasTagName (T("TreeV_Indent"))) cTreeView->setIndentSize(Pos[2]);
if (child->hasTagName (T("Keyboard"))) midiKeyboard->setBounds (Pos[0],Pos[1],Pos[2],Pos[3]);
if (child->hasTagName (T("Keyboard_Key"))) midiKeyboard->setKeyWidth(float(Pos[2]));
}
delete myDocument;
}
// Read Skin File Colours //
String dPath2(xFile.getFullPathName());
dPath2.append(T("\\Wusik Red Fuse\\Skins\\Default\\Colours.xml"),99);
myDocument = new XmlDocument ( File(dPath2) );
if (myDocument != 0)
{
XmlElement* myParentXml = myDocument->getDocumentElement();
forEachXmlChildElement (*myParentXml, child)
{
if (child->hasTagName (T("Keyboard")))
{
midiKeyboard->setColour(MidiKeyboardComponent::whiteNoteColourId, Colour::fromString( child->getStringAttribute(T("whiteNote"),T("000000")) ));
midiKeyboard->setColour(MidiKeyboardComponent::blackNoteColourId, Colour::fromString( child->getStringAttribute(T("blackNote"),T("000000")) ));
midiKeyboard->setColour(MidiKeyboardComponent::keySeparatorLineColourId, Colour::fromString( child->getStringAttribute(T("keySeparatorLine"),T("000000")) ));
midiKeyboard->setColour(MidiKeyboardComponent::mouseOverKeyOverlayColourId, Colour::fromString( child->getStringAttribute(T("mouseOverKeyOverlay"),T("000000")) ));
midiKeyboard->setColour(MidiKeyboardComponent::keyDownOverlayColourId, Colour::fromString( child->getStringAttribute(T("keyDownOverlay"),T("000000")) ));
midiKeyboard->setColour(MidiKeyboardComponent::textLabelColourId, Colour::fromString( child->getStringAttribute(T("textLabel"),T("000000")) ));
midiKeyboard->setColour(MidiKeyboardComponent::upDownButtonBackgroundColourId, Colour::fromString( child->getStringAttribute(T("upDownButtonBack"),T("000000")) ));
midiKeyboard->setColour(MidiKeyboardComponent::upDownButtonArrowColourId, Colour::fromString( child->getStringAttribute(T("upDownButtonArrow"),T("000000")) ));
}
if (child->hasTagName (T("TreeView")))
{
cTreeView->setColour(TreeView::backgroundColourId, Colour::fromString( child->getStringAttribute(T("background"),T("000000")) ));
cTreeView->setColour(TreeView::linesColourId, Colour::fromString( child->getStringAttribute(T("lines"),T("000000")) ));
cTreeView->setColour(DirectoryContentsDisplayComponent::highlightColourId, Colour::fromString( child->getStringAttribute(T("highlight"),T("000000")) ));
cTreeView->setColour(DirectoryContentsDisplayComponent::textColourId, Colour::fromString( child->getStringAttribute(T("text"),T("000000")) ));
}
}
delete myDocument;
}
[/code]
Wk