To use the Jucer or not?


#1

Hi,
I was wondering: the Jucer is called “experimental”, and I noticed from reading this forum that you have to be careful about which parts of the code you can edit.
In the end, are people really using the Jucer, or do they eventually fall back to using entirely self-written code instead?
I’ve got a feeling (and just that) that using the Jucer in the beginning can be very helpful to find out how do write things in code.
For example, what happens if you really like to build up your GUI of many different subcomponents (that each group together other subcomponents where only the lowest layer directly contains base components like buttons, sliders, … ), instead of using one top component and directly adding all single base components (buttons, sliders, …) to that (so without any component layer in between)? Does the Jucer support that? Will I be able to see all the components from the sub layers when I open the top component?
Any advice welcome!
Koen


#2

Alright, I think I have an answer :wink:
Just went ahead and created a few components with the Jucer, but after saving them and closing the Jucer, I couldn’t open them again in the Jucer. So the answer for me now seems to be “no, don’t use the Jucer, because it doesn’t work”.
However, I would very much like to be contradicted :wink:

The most basic test you can do to reproduce this is:

  1. start the Jucer
  2. do File -> New Component to create a new component
  3. do File -> Save to save the .cpp and .h files
  4. quit the Jucer
  5. start the Jucer again
  6. open the .cpp file again
    ==> the Jucer says: “Failed to open file… This wasn’t a valid Jucer .cpp file…”

Is this normal? Any hints/advice?

PS
This was with the Jucer from the latest version from git (this morning).
I tried with the latest stable version, but there I couldn’t see any code and the Jucer told me that I should set the path to the template files in the preferences, which I did, but that didn’t help: still the same message when I try to see the .h/.cpp code. This does work in the latest version from git though.


#3

I presume you’re talking about the old jucer here (the ‘experimental’ one doesn’t edit components yet).

The old one is solid as a rock. I’ve used it for years, never lost any data, and so have many other people… I’ve no idea how you managed to get it to fail like that.

Certainly the steps that you list there work perfectly for me. All I can think is that in between saving and reloading the file, something may have messed around with it. Did you open it in an editor, which may have resaved it with a strange character encoding or something?


#4

Someone once told me I’ve got a invisible black raven on my left shoulder :wink:

I used extras\prebuilt\jucer.exe from the tip of git.
On the About box it says: Jucer v1.12, JUCE v1.51.16

In the preferences, I have set the C++ template folder to
H:\Koen\Code\C++\Various\juce_git\extras\Jucer (experimental)\Source\templates
(H:\Koen\Code\C++\Various\juce_git contains the latest tip of git).

I just did the same steps again, making sure not to do anything else, just these steps (so, I definitely did not open any of the files in another editor). The same thing…

Just did a screencast with screenr.com to show you, have a look:
http://screenr.com/WqC

Any idea what I can possibly do?

(I am on Windows7, 64-bit)


#5

For the sake of completeness, this is the code that was generated:

NewJucerComponent.h:

/*
  ==============================================================================

  This is an automatically generated file created by the Jucer!

  Be careful when adding custom code to these files, as only the code within
  the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
  and re-saved.

  Created for JUCE version: %%juceVersion%%

  ------------------------------------------------------------------------------

  JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd.

  ==============================================================================
*/

#ifndef __JUCER_HEADER_NEWJUCERCOMPONENT_NEWJUCERCOMPONENT_EFF69ED0__
#define __JUCER_HEADER_NEWJUCERCOMPONENT_NEWJUCERCOMPONENT_EFF69ED0__

//[Headers]     -- You can add your own extra header files here --
%%defaultJuceInclude%%
//[/Headers]



//==============================================================================
/**
                                                                    //[Comments]
    An auto-generated component, created by the Jucer.

    Describe your class and how it works here!
                                                                    //[/Comments]
*/
class NewJucerComponent  : public Component
{
public:
    //==============================================================================
    NewJucerComponent ();
    ~NewJucerComponent();

    //==============================================================================
    //[UserMethods]     -- You can add your own custom methods in this section.
    //[/UserMethods]

    void paint (Graphics& g);
    void resized();


    //==============================================================================
    juce_UseDebuggingNewOperator

private:
    //[UserVariables]   -- You can add your own custom variables in this section.
    //[/UserVariables]

    //==============================================================================


    //==============================================================================
    // (prevent copy constructor and operator= being generated..)
    NewJucerComponent (const NewJucerComponent&);
    NewJucerComponent& operator= (const NewJucerComponent&);
};


#endif   // __JUCER_HEADER_NEWJUCERCOMPONENT_NEWJUCERCOMPONENT_EFF69ED0__

NewJucerComponent.cpp:

/*
  ==============================================================================

  This is an automatically generated file created by the Jucer!

  Be careful when adding custom code to these files, as only the code within
  the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
  and re-saved.

  Created for JUCE version: %%juceVersion%%

  ------------------------------------------------------------------------------

  JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd.

  ==============================================================================
*/

//[CppHeaders] You can add your own extra header files here...
//[/CppHeaders]

#include "NewJucerComponent.h"


//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]

//==============================================================================
NewJucerComponent::NewJucerComponent ()
{

    //[UserPreSize]
    //[/UserPreSize]

    setSize (600, 400);

    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}

NewJucerComponent::~NewJucerComponent()
{
    //[Destructor_pre]. You can add your own custom destruction code here..
    //[/Destructor_pre]



    //[Destructor]. You can add your own custom destruction code here..
    //[/Destructor]
}

//==============================================================================
void NewJucerComponent::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    g.fillAll (Colours::white);

    //[UserPaint] Add your own custom painting code here..
    //[/UserPaint]
}

void NewJucerComponent::resized()
{
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}



//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
//[/MiscUserCode]



//==============================================================================
//=======================  Jucer Information Section  ==========================
//==============================================================================
#if 0
/*  This section stores the Jucer's metadata - edit it at your own risk!

<JUCER_COMPONENT documentType="Component" className="NewJucerComponent" componentName=""
                 parentClasses="public Component" constructorParams="" variableInitialisers=""
                 snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330000013"
                 fixedSize="0" initialWidth="600" initialHeight="400">
  <BACKGROUND backgroundColour="ffffffff"/>
</JUCER_COMPONENT>

*/
#endif

#6

Ah, you’ve used a template file from the new jucer - it’s completely different to the old ones. Just change your template dir to the old one in extras/jucer/the jucer/src/templates.

Apologies for the confusion - I knew it’d cause problems to have two incompatible projects with the same name!


#7

So, just to make sure I got it right:

  • The “jucer.exe” in the juce\extras\prebuilt directory is the one I should use.
  • In the preferences, I need to set the templates path to juce\extras\the jucer\src\templates (so, the path with the added “the”)

This works for me now.

So, the file “jucer.exe” in juce\extras\prebuilt is actually the binary built by the code in the “juce\extras\the jucer” (with the added “the”)? And the stuff in “juce\extras\Jucer (experimental)” is the new stuff?
Have I got it right now?


#8

Yes, that’s right!