Some basic structure questions


#1

Hi
So i’m experimenting with juce, I’m on a very early, basic stage. Please forgive these rookie questions.
Anyway, I have created a test project using the Introjucer. If I understand it correct it creates Main.cpp that starts and ends everything.
This then creates a MainWindow class derived from DocumentWindow, Then there is the MainComponent class that is added to the MainWindow.
If I understand the documentation correct, I’m not supposed to fiddle to much with the MainWindow class it is just a container, my stuff should go in the MainComponent part.
Ok, so I want to use the ApplicationCommandManager, I had a look at the HostDemo and the JuceDemo.
These are structured in a different way. Here the CommandManager is global, and the targets registered in the Main file. and there is only one MainComponent, that inherits from DocumentWindow and a bunch of other classes.
In the code that the introdjucer creates this is not possible, as the MainComponent is not available after it has been added to the MainWindow.

So what I ask is, where should the main ApplcationCommandManager (And other such objects) live?
How do you guys structure your code. Keep in mind that I am used to languages/frameworks where most of the GUI (placing of elements, linking of actions, setting of properties) is handled “under the hood” not hard coded.
Hope my question even makes sense, I’m just a bit confused as to what should go where.


#2

It’s up to you really. Juce is an SDK, not an application framework, so it’s up to you to decide how you want to build and manage things. You might want to start by creating a class that represents your application as a whole and go from there. The ApplicationCommandManager can be a member of that class and doesn’t need to (IMHO shouldn’t) be tied to your UI, aside from hooking up to the necessary things as listed in the documentation.


#3

The introjucer might also be a good project to look at for ideas about how to structure an app with a command manager.