|
05-23-2021, 12:10 AM
|
#1
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
How to use Swell?
How to use Swell for OSX?
I can not compile the plugins or any application if I add Swell. I tried everything: IPlug 2, Oli and Tale version.
Where do I find instructions on how to use it? I added the Swell directory to the project and I inserted #include "swell.h" but receive lot of errors in XCode like:
Code:
error: invalid use of incomplete type 'struct HWND__'
error: forward declaration of 'struct HWND__'
error: invalid use of incomplete type 'struct HWND__'
|
|
|
05-23-2021, 02:37 AM
|
#2
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,653
|
I think I include only specific parts of SWELL in my IPlug version, namely:
- swell.h
- swell-gdi.mm
- swell-internal.h
|
|
|
05-23-2021, 04:48 AM
|
#3
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
The error has changed: duplicate symbol SelectObject(HDC__*, HGDIOBJ__*)
|
|
|
05-23-2021, 08:09 AM
|
#4
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
If it's for use in a REAPER plugin: don't build any of the SWELL source files. The implementation of the SWELL functions should be loaded at runtime from REAPER instead. (So that future updates to SWELL are applied to the plugin, and to reduce unnecessary duplication.)
Define SWELL_PROVIDED_BY_APP before including swell.h and only build the loader: swell-modstub.mm (swell-modstub-generic.cpp on Linux).
|
|
|
05-23-2021, 09:34 AM
|
#5
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
Error again
|
|
|
05-25-2021, 03:30 AM
|
#6
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
I just managed to reduce the number of errors to one:
swell-gdi.mm:162: error: conversion from 'objc_object*' to non-scalar type '_NSRect' requested
This error occurs when I try to compile the sample_project from WDL>Swell
|
|
|
05-28-2021, 04:50 PM
|
#7
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
IPlug2 app target is using swell. It's a good example to follow. Or you can look at the swell sample_project in WDL or the lice demo.
|
|
|
06-04-2021, 04:46 AM
|
#8
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
I added swell-modstub.mm to the project to be compiled. I added to the header file of the plugin #include "../../../WDL-tale/WDL/swell/swell.h"
But I receive this error:
Code:
"SWELL_LoadCursor(char const*)", referenced from:
MyBar::ValToMouse(int, int, bool, bool)in Main.o
ld: symbol(s) not found
If I add swell-kb.mm the project to be compiled. I get this error:
Code:
"SWELL_CStringToCFString(char const*)", referenced from:
swell_imageFromCursorString(char const*, POINT*)in swell-kb.o
swell_imageFromCursorString(char const*, POINT*)in swell-kb.o
"GetTickCount()", referenced from:
swell_imageFromCursorString(char const*, POINT*)in swell-kb.o
"GetTempPath(int, char*)", referenced from:
swell_imageFromCursorString(char const*, POINT*)in swell-kb.o
"GetModuleFileName(void*, char*, unsigned int)", referenced from:
swell_imageFromCursorString(char const*, POINT*)in swell-kb.o
ld: symbol(s) not found
|
|
|
06-04-2021, 05:10 AM
|
#9
|
Human being with feelings
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
|
you're on the right track. The compiler reports missing symbols, so you need to add the implementation file with those missing things.
SWELL_CStringToCFString is in swell-misc.mm
https://github.com/justinfrankel/WDL...ll-misc.mm#L87
If you don't compile that with your code you'll get an error.
BUT - if you are trying to do something with modstub, you have to link against swell.dylib, rather than compiling swell-misc.mm etc with your project
https://github.com/justinfrankel/WDL...modstub.mm#L29
|
|
|
06-04-2021, 08:39 AM
|
#10
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
Quote:
Originally Posted by TonyGlover
I added swell-modstub.mm to the project to be compiled. I added to the header file of the plugin #include "../../../WDL-tale/WDL/swell/swell.h"
But I receive this error:
Code:
"SWELL_LoadCursor(char const*)", referenced from:
MyBar::ValToMouse(int, int, bool, bool)in Main.o
ld: symbol(s) not found
|
Was SWELL_PROVIDED_BY_APP defined before main.cpp included swell.h?
|
|
|
06-04-2021, 10:43 AM
|
#11
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
Quote:
Originally Posted by olilarkin
|
Thanks Oli, worked
I added swell-misc.mm and swell.cpp.
Thanks to everyone for your great help!!!
|
|
|
06-25-2021, 05:19 AM
|
#12
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
One more question please.
How to use SWELL_InitiateDragDrop ?
I want to make my own Control that accepts drag and drops files on the control area. How do I make that?
|
|
|
06-25-2021, 01:31 PM
|
#13
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
That's for dragging. For dropping files, enable the WS_EX_ACCEPTFILES exstyle and handle the WM_DROPFILES message.
|
|
|
06-26-2021, 02:48 AM
|
#14
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
Where to set WS_EX_ACCEPTFILES exstyle ?
The window was created, SetExtendedStyle do not exist, DragAcceptFiles(hWnd, true); do not exist.
I see internal swellSetExtendedStyle(WS_EX_ACCEPTFILES) but how to use it ?
|
|
|
06-26-2021, 03:25 AM
|
#15
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
Code:
SetWindowLong(hwnd, GWL_EXSTYLE, WS_EX_ACCEPTFILES); // (might want to preserve existing styles)
Last edited by cfillion; 06-26-2021 at 03:32 AM.
|
|
|
06-26-2021, 07:38 AM
|
#16
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
I tried like this, but it doesn't work.
Cannot work exactly like windows I suppose, there is a variable m_supports_ddrop which is false, this disable drop actions.
Maybe must call swellSetExtendedStyle to set m_supports_ddrop=true
|
|
|
06-26-2021, 01:57 PM
|
#17
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
Quote:
Originally Posted by TonyGlover
I tried like this, but it doesn't work.
Cannot work exactly like windows I suppose, there is a variable m_supports_ddrop which is false, this disable drop actions.
Maybe must call swellSetExtendedStyle to set m_supports_ddrop=true
|
SetWindowLong calls swellSetExtendedStyle. (WS_EX_ACCEPTFILES can also be put in the resource file, mac_resgen.php supports it.)
This works here:
Code:
WDL_DLGRET DialogProc(HWND handle, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_INITDIALOG:
SetWindowLong(handle, GWL_EXSTYLE, WS_EX_ACCEPTFILES);
return 0;
case WM_DROPFILES: {
HDROP drop { reinterpret_cast<HDROP>(wParam) };
unsigned int count { DragQueryFile(drop, -1, nullptr, 0) };
printf("dropped %d files\n", count);
DragFinish(drop);
return 0;
}
// ...
}
}
|
|
|
06-27-2021, 04:37 AM
|
#18
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
I tested with trace to check but do not accept drag & drop for any file. Trace are not called when drop any file on plugin area.
Please can you give an example how to use what you say to make a plugin with framework Iplug OLi, Iplug Tale or even Iplug 2 ?
I tried in VST CTOR after AttachGraphics(pGraphics);:
Code:
SetWindowLong((HWND)pGraphics->GetWindow(), GWL_EXSTYLE, WS_EX_ACCEPTFILES);
|
|
|
06-27-2021, 02:51 PM
|
#19
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,968
|
I don't have experience with those plugin frameworks. Here's a few ideas:
- Is pGraphics->GetWindow() an instance of REAPERSwell_hwnd (alias for SWELL_hwndChild, a subclass of NSView)? This can be checked in Objective-C:
Code:
NSLog(@"%@", NSStringFromClass([(__bridge NSView*)pGraphics->GetWindow() class]));
- If yes, your plugin's SetWindowLong is probably failing to detect it's class because you're building a different copy of SWELL in your plugin rather than using REAPER's (modstub.mm). Using REAPER's SetWindowLong should fix that.
- If not, adding a subcontrol might be an option.
- If not, then bypassing SWELL and directly using the macOS API (Objective-C or Swift) is always an option.
https://developer.apple.com/library/...tingdrags.html
Code:
- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender;
- (void)draggingExited:(id<NSDraggingInfo>)sender;
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender;
Last edited by cfillion; 06-27-2021 at 02:58 PM.
|
|
|
06-29-2021, 07:37 AM
|
#20
|
Human being with feelings
Join Date: Mar 2016
Posts: 70
|
Thanks, it's finally working:
I modified the file IGraphicsCocoa.mm
In initWithIGraphics: (IGraphicsMac*) pGraphics added:
Code:
[self registerForDraggedTypes:[NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
then
Code:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>) sender {
NSPasteboard *pboard = [sender draggingPasteboard];
return (([pboard.types containsObject:NSFilenamesPboardType]) ? NSDragOperationLink : NSDragOperationNone);
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>) sender {
NSPasteboard *pboard = [sender draggingPasteboard];
if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
NSPoint pt = [self convertPoint:[sender draggingLocation] fromView:nil];
for (NSString *path in [pboard propertyListForType:NSFilenamesPboardType]) {
const char* tmp=[path UTF8String];
if (mGraphics) {
mGraphics->OnMouseDragDrop(pt.x, mGraphics->Height() - pt.y, (char*)tmp);
break;
}
}
}
return YES;
}
Two questions:
How can I limit dragging on two types of files: wav and aif
This code also works on new versions of macOS, from Sierra above?
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:51 AM.
|