mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-09 05:27:57 +00:00
Initial VST FilePresenter implementation
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#include "VSTEditor.hpp"
|
||||
#include "VSTBackend.hpp"
|
||||
#include "FileOpenDialog.hpp"
|
||||
#include <Windowsx.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
extern void* hInstance;
|
||||
static WNDPROC OriginalListViewProc = 0;
|
||||
@@ -45,6 +48,31 @@ LRESULT CALLBACK VSTEditor::WindowProc(HWND hwnd,
|
||||
editor.selectPage(itemAct.iItem);
|
||||
return 0;
|
||||
}
|
||||
case TVN_GETDISPINFO:
|
||||
{
|
||||
NMTVDISPINFO& treeDispInfo = *reinterpret_cast<LPNMTVDISPINFO>(lParam);
|
||||
if (treeDispInfo.item.mask & TVIF_CHILDREN)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
case BN_CLICKED:
|
||||
{
|
||||
HWND button = HWND(lParam);
|
||||
if (button == editor.m_collectionAdd)
|
||||
editor.addAction();
|
||||
else if (button == editor.m_collectionRemove)
|
||||
editor.removeAction();
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
@@ -137,34 +165,56 @@ bool VSTEditor::open(void* ptr)
|
||||
SetWindowLongPtrW(m_rootView, 0, LONG_PTR(this));
|
||||
ShowWindow(m_rootView, SW_SHOW);
|
||||
|
||||
TVINSERTSTRUCT treeItem = {};
|
||||
treeItem.hParent = TVI_ROOT;
|
||||
treeItem.hInsertAfter = TVI_LAST;
|
||||
|
||||
treeItem.item.mask = TVIF_CHILDREN | TVIF_TEXT;
|
||||
treeItem.item.cChildren = 1;
|
||||
treeItem.item.pszText = L"Root A";
|
||||
|
||||
LVCOLUMN column = {};
|
||||
column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
|
||||
column.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH;
|
||||
column.cx = 200;
|
||||
column.cx = 199;
|
||||
|
||||
LVITEM item = {};
|
||||
item.mask = LVIF_TEXT | LVIF_GROUPID;
|
||||
item.mask = LVIF_TEXT;
|
||||
item.pszText = L"Test";
|
||||
item.iGroupId = 1;
|
||||
|
||||
m_collectionTree = CreateWindowW(WC_TREEVIEW,
|
||||
L"",
|
||||
WS_CHILD | WS_BORDER | TVS_HASLINES,
|
||||
0, 24,
|
||||
201,
|
||||
m_windowRect.bottom - m_windowRect.top - 24,
|
||||
WS_CHILD | WS_CLIPSIBLINGS | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS,
|
||||
1, 25,
|
||||
199,
|
||||
m_windowRect.bottom - m_windowRect.top - 26,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
TreeView_SetBkColor(m_collectionTree, RGB(64,64,64));
|
||||
TreeView_SetTextColor(m_collectionTree, RGB(255,255,255));
|
||||
HTREEITEM rootItemA = TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
treeItem.item.pszText = L"Root B";
|
||||
HTREEITEM rootItemB = TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
treeItem.hParent = rootItemA;
|
||||
treeItem.item.cChildren = 0;
|
||||
treeItem.item.pszText = L"Child A";
|
||||
TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
treeItem.item.pszText = L"Child B";
|
||||
TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
treeItem.hParent = rootItemB;
|
||||
treeItem.item.pszText = L"Child A";
|
||||
TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
treeItem.item.pszText = L"Child B";
|
||||
TreeView_InsertItem(m_collectionTree, &treeItem);
|
||||
ShowWindow(m_collectionTree, SW_SHOW);
|
||||
|
||||
m_collectionHeader = CreateWindowW(WC_HEADER,
|
||||
L"",
|
||||
WS_CHILD,
|
||||
1, 1,
|
||||
200,
|
||||
199,
|
||||
24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
@@ -174,12 +224,39 @@ bool VSTEditor::open(void* ptr)
|
||||
OriginalListViewProc = WNDPROC(SetWindowLongPtr(m_collectionHeader, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc)));
|
||||
ShowWindow(m_collectionHeader, SW_SHOW);
|
||||
|
||||
m_collectionAdd = CreateWindowW(WC_BUTTON,
|
||||
L"+",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | BS_PUSHBUTTON,
|
||||
1, m_windowRect.bottom - m_windowRect.top - 26,
|
||||
25, 24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
SetWindowFont(m_collectionAdd, GetStockObject(ANSI_FIXED_FONT), FALSE);
|
||||
Button_Enable(m_collectionAdd, TRUE);
|
||||
SetWindowPos(m_collectionAdd, HWND_TOP, 1, m_windowRect.bottom - m_windowRect.top - 26, 25, 24, SWP_SHOWWINDOW);
|
||||
|
||||
m_collectionRemove = CreateWindowW(WC_BUTTON,
|
||||
L"-",
|
||||
WS_CHILD | WS_CLIPSIBLINGS | BS_PUSHBUTTON,
|
||||
26, m_windowRect.bottom - m_windowRect.top - 26,
|
||||
25, 24,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
SetWindowFont(m_collectionRemove, GetStockObject(ANSI_FIXED_FONT), FALSE);
|
||||
Button_Enable(m_collectionRemove, TRUE);
|
||||
SetWindowPos(m_collectionRemove, HWND_TOP, 26, m_windowRect.bottom - m_windowRect.top - 26, 25, 24, SWP_SHOWWINDOW);
|
||||
|
||||
|
||||
m_groupListView = CreateWindowW(WC_LISTVIEW,
|
||||
L"",
|
||||
WS_CHILD | WS_BORDER | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER,
|
||||
200, 0,
|
||||
201,
|
||||
m_windowRect.bottom - m_windowRect.top,
|
||||
WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER,
|
||||
201, 1,
|
||||
199,
|
||||
m_windowRect.bottom - m_windowRect.top - 2,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
@@ -189,25 +266,32 @@ bool VSTEditor::open(void* ptr)
|
||||
SetWindowLongPtrW(header, GWLP_USERDATA, LONG_PTR(column.pszText));
|
||||
SetWindowLongPtr(header, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc));
|
||||
ListView_SetBkColor(m_groupListView, RGB(64,64,64));
|
||||
ListView_SetTextBkColor(m_groupListView, CLR_NONE);
|
||||
ListView_SetTextColor(m_groupListView, RGB(255,255,255));
|
||||
ListView_InsertColumn(m_groupListView, 0, &column);
|
||||
ListView_InsertItem(m_groupListView, &item);
|
||||
ShowWindow(m_groupListView, SW_SHOW);
|
||||
|
||||
m_pageListView = CreateWindowW(WC_LISTVIEW,
|
||||
L"",
|
||||
WS_CHILD | WS_BORDER | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER,
|
||||
400, 0,
|
||||
200,
|
||||
m_windowRect.bottom - m_windowRect.top,
|
||||
WS_CHILD | LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER,
|
||||
401, 1,
|
||||
198,
|
||||
m_windowRect.bottom - m_windowRect.top - 2,
|
||||
m_rootView,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
column.pszText = L"Page";
|
||||
column.cx = 198;
|
||||
header = ListView_GetHeader(m_pageListView);
|
||||
SetWindowLongPtrW(header, GWLP_USERDATA, LONG_PTR(column.pszText));
|
||||
SetWindowLongPtr(header, GWLP_WNDPROC, LONG_PTR(ColHeaderWindowProc));
|
||||
ListView_SetBkColor(m_pageListView, RGB(64,64,64));
|
||||
ListView_SetTextBkColor(m_pageListView, CLR_NONE);
|
||||
ListView_SetTextColor(m_pageListView, RGB(255,255,255));
|
||||
ListView_InsertColumn(m_pageListView, 0, &column);
|
||||
ListView_InsertItem(m_pageListView, &item);
|
||||
ShowWindow(m_pageListView, SW_SHOW);
|
||||
|
||||
return true;
|
||||
@@ -224,6 +308,31 @@ void VSTEditor::update()
|
||||
|
||||
}
|
||||
|
||||
void VSTEditor::addAction()
|
||||
{
|
||||
VstFileSelect fSelect = {};
|
||||
fSelect.command = kVstFileLoad;
|
||||
fSelect.type = kVstFileType;
|
||||
strcpy(fSelect.title, "Select Audio Group Archive");
|
||||
if (m_backend.openFileSelector(&fSelect))
|
||||
{
|
||||
m_backend.closeFileSelector(&fSelect);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring path = openDB();
|
||||
if (path.size())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VSTEditor::removeAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void VSTEditor::selectCollection(int idx)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user