IPlatformFont issue when upgrading VSTGUI4.0->4.6

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
Post Reply
bx_andreas
Posts: 6
Joined: Fri Jul 13, 2018 12:31 pm

IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by bx_andreas » Thu Sep 19, 2019 4:36 pm

Hi Arne,

I'm currently porting some third party projects over to our framework using VSTGUI4.6 and VS2017 (from VSTGUI 4.0 and VS2008). The projects compile in VS2017 with the old VSTGUI version, so I took the VSTGUI4.6 from our framework and dropped it into the third party project. In doing so, I've encountered an issue with a custom multiline text field control in the third party code. They have the following lines, which worked in VSTGUI4.0 when IPlatformFont was still derived from CBaseObject and gives a compile error now:

Code: Select all

IPlatformFont *pPFont = fontID->getPlatformFont();
CCoord lineHeight = pPFont->getLeading();
The issue is a compiler error that IPlatformFont is an incomplete class and pointers to it are illegal. The funny thing is that even in VSTGUI itself, this happens numerous times, e.g. in CCoord GenericStringListDataBrowserSource::dbGetRowHeight (CDataBrowser* browser). For some reason, the compiler doesn't seem to understand that there is an actual implementation of that interface, but I'm a bit stumped as to why this is a problem here and not in our framework or in the third party project with the old VSTGUI.

Can you advise on how to solve this issue?

Best regards,
Andreas

Arne Scheffler
Posts: 304
Joined: Mon Jun 20, 2016 7:53 am

Re: IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by Arne Scheffler » Thu Sep 19, 2019 9:17 pm

Hi,
without seeing the compiler output I can only guess that an include to vstgui/lib/platform/iplatformfont.h is missing.

Cheers,
Arne

bx_andreas
Posts: 6
Joined: Fri Jul 13, 2018 12:31 pm

Re: IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by bx_andreas » Fri Sep 20, 2019 8:27 am

Hi Arne,

there's an include for IPlatformFont in cfontwin32.h, which is included in cfontwin32.cpp, which is included in vstgui_win32.cpp, so I don't think that's the problem. Here is the relevant compiler output.

1>c:\<projectfolder>\vstgui4\lib\vstguibase.h(407): error C2027: use of undefined type 'VSTGUI::IPlatformFont'
1>c:\u<projectfolder>\vstgui4\lib\vstguifwd.h(207): note: see declaration of 'VSTGUI::IPlatformFont'
1>c:\<projectfolder>\vstgui4\lib\vstguibase.h(405): note: while compiling class template member function 'VSTGUI::SharedPointer<VSTGUI::IPlatformFont>::~SharedPointer(void) noexcept'
1>c:\<projectfolder>\<product>\source\wsplashwnd.h(37): note: see reference to function template instantiation 'VSTGUI::SharedPointer<VSTGUI::IPlatformFont>::~SharedPointer(void) noexcept' being compiled
1>c:\<projectfolder>\vstgui4\lib\cfont.h(69): note: see reference to class template instantiation 'VSTGUI::SharedPointer<VSTGUI::IPlatformFont>' being compiled

Best regards,
Andreas

Arne Scheffler
Posts: 304
Joined: Mon Jun 20, 2016 7:53 am

Re: IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by Arne Scheffler » Fri Sep 20, 2019 8:31 am

So, you're compiling vstgui_win32.cpp ?
Then I don't know how this header:

Code: Select all

1>c:\<projectfolder>\<product>\source\wsplashwnd.h(37)
could be included other than changing the vstgui sources. And then I think you have a wrong order of includes in this file.

Cheers,
Arne

bx_andreas
Posts: 6
Joined: Fri Jul 13, 2018 12:31 pm

Re: IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by bx_andreas » Fri Sep 20, 2019 8:44 am

Hi Arne,

wsplashwnd.h is code from the third party. What do you mean with "could be included other than changing the vstgui sources"? There aren't really any relevant includes in this file, it includes vstgui.h with an include guard (where VS tells me that __vstgui__is already defined and the include does not happen here). Line 37 is the end of the class declaration that's in this file, it has two protected CFontDesc variables in the line before that.

Best regards,
Andreas

Arne Scheffler
Posts: 304
Joined: Mon Jun 20, 2016 7:53 am

Re: IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by Arne Scheffler » Fri Sep 20, 2019 9:22 am

I still think that the issue is that the compiler needs the

Code: Select all

vstgui/lib/platform/iplatformfont.h
include.
What happens if you add it to that file where the CFontDesc are used ?

bx_andreas
Posts: 6
Joined: Fri Jul 13, 2018 12:31 pm

Re: IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by bx_andreas » Fri Sep 20, 2019 11:28 am

Hi Arne,

Thanks for your patience, that indeed solves the problem *bangs head on desk*. I didn't understand that this was an issue because I thought "it's all being included by VSTGUI one way or the other anyway" and "it worked in the old version, with VSTGUI4.0), but either you changed something in the include order in the meantime, or the third party had done so. Also, Intellisense found the declaration of IPlatformFont without issues and coloured it accordingly, which added to my confusion (not to forget the bewildering "underline"-Error in the IDE that stated "pointer to incomplete class not allowed")

One more question though, while I'm here. The 3P code derives its "MainFrame" class from CFrame, which has been made final in the meantime. The prescribed way is to instead derive from PluginGuiEditor and make all calls to CFrame::...functions in their editor code use frame->...instead, right? Anything else I need to pay specific attention to?

Best regards,
Andreas

Arne Scheffler
Posts: 304
Joined: Mon Jun 20, 2016 7:53 am

Re: IPlatformFont issue when upgrading VSTGUI4.0->4.6

Post by Arne Scheffler » Fri Sep 20, 2019 12:44 pm

Regarding CFrame it's correct what you wrote. Otherwise read thru vstgui/doxygen/page_changes.h. Most breaking changes are written down there.

Cheers,
Arne

Post Reply