mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-14 00:14:18 +00:00
Code clean-ups. Jucer development.
This commit is contained in:
parent
22e02cf791
commit
1751beed57
145 changed files with 2247 additions and 1853 deletions
|
|
@ -659,9 +659,15 @@ static const unsigned char temp_73015554[] =
|
|||
"//[MiscUserDefs] You can add your own user definitions and misc code here...\r\n"
|
||||
"//[/MiscUserDefs]\r\n"
|
||||
"\r\n"
|
||||
"extern const unsigned char %%className%%_ComponentStateData[];\r\n"
|
||||
"\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"%%className%%::%%className%% (%%constructorParams%%)\r\n"
|
||||
"%%initialisers%%{\r\n"
|
||||
" componentState = ValueTree::readFromData (%%className%%_ComponentStateData, %%statedatasize%%);\r\n"
|
||||
" jassert (componentState.isValid());\r\n"
|
||||
" const ValueTree componentStateList (componentState.getChildByName (\"COMPONENTS\"));\r\n"
|
||||
"\r\n"
|
||||
" %%constructor%%\r\n"
|
||||
"\r\n"
|
||||
" //[Constructor] You can add your own custom stuff here..\r\n"
|
||||
|
|
@ -688,6 +694,10 @@ static const unsigned char temp_73015554[] =
|
|||
"%%staticMemberDefinitions%%\r\n"
|
||||
"\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"/* This data contains the ValueTree that holds all the Jucer-generated settings for the components */\r\n"
|
||||
"const unsigned char %%className%%_ComponentStateData[] = %%statedata%%;\r\n"
|
||||
"\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"//======================= Jucer Information Section ==========================\r\n"
|
||||
"//==============================================================================\r\n"
|
||||
"#if 0\r\n"
|
||||
|
|
@ -760,6 +770,8 @@ static const unsigned char temp_b930c59[] =
|
|||
" %%privateMemberDeclarations%%\r\n"
|
||||
"\r\n"
|
||||
" //==============================================================================\r\n"
|
||||
" ValueTree componentState;\r\n"
|
||||
" \r\n"
|
||||
" // (prevent copy constructor and operator= being generated..)\r\n"
|
||||
" %%className%% (const %%className%%&);\r\n"
|
||||
" %%className%%& operator= (const %%className%%&);\r\n"
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ namespace BinaryData
|
|||
const int jucer_AudioPluginFilterTemplate_hSize = 2353;
|
||||
|
||||
extern const char* jucer_ComponentTemplate_cpp;
|
||||
const int jucer_ComponentTemplate_cppSize = 1976;
|
||||
const int jucer_ComponentTemplate_cppSize = 2534;
|
||||
|
||||
extern const char* jucer_ComponentTemplate_h;
|
||||
const int jucer_ComponentTemplate_hSize = 2239;
|
||||
const int jucer_ComponentTemplate_hSize = 2276;
|
||||
|
||||
extern const char* jucer_MainConsoleAppTemplate_cpp;
|
||||
const int jucer_MainConsoleAppTemplate_cppSize = 749;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class ComboBoxHandler : public ComponentTypeHelper<ComboBox>
|
||||
{
|
||||
public:
|
||||
ComboBoxHandler() : ComponentTypeHelper<ComboBox> ("ComboBox", "COMBOBOX", "comboBox")
|
||||
ComboBoxHandler() : ComponentTypeHelper<ComboBox> ("ComboBox", "ComboBox", "COMBOBOX", "comboBox")
|
||||
{
|
||||
addEditableColour (ComboBox::backgroundColourId, "Background", "backgroundColour");
|
||||
addEditableColour (ComboBox::textColourId, "Text", "textColour");
|
||||
|
|
@ -45,16 +45,16 @@ public:
|
|||
|
||||
~ComboBoxHandler() {}
|
||||
|
||||
Component* createComponent() { return new ComboBox (String::empty); }
|
||||
Component* createComponent() { return new ComboBox(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); }
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
state.setProperty ("items", "Item 1\nItem 2", 0);
|
||||
state.setProperty ("editable", false, 0);
|
||||
state.setProperty ("textJustification", (int) Justification::centredLeft, 0);
|
||||
state.setProperty ("unselectedText", "", 0);
|
||||
state.setProperty ("noItemsText", "(No Choices)", 0);
|
||||
item.set ("items", "Item 1\nItem 2");
|
||||
item.set ("editable", false);
|
||||
item.set ("textJustification", (int) Justification::centredLeft);
|
||||
item.set ("unselectedText", "");
|
||||
item.set ("noItemsText", "(No Choices)");
|
||||
}
|
||||
|
||||
void updateItems (ComboBox* comp, const String& itemString)
|
||||
|
|
@ -77,29 +77,34 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void update (ComponentDocument& document, ComboBox* comp, const ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, ComboBox* comp)
|
||||
{
|
||||
updateItems (comp, state ["items"]);
|
||||
comp->setEditableText (state ["editable"]);
|
||||
comp->setJustificationType ((int) state ["textJustification"]);
|
||||
comp->setTextWhenNothingSelected (state ["unselectedText"].toString());
|
||||
comp->setTextWhenNoChoicesAvailable (state ["noItemsText"].toString());
|
||||
updateItems (comp, item ["items"]);
|
||||
comp->setEditableText (item ["editable"]);
|
||||
comp->setJustificationType ((int) item ["textJustification"]);
|
||||
comp->setTextWhenNothingSelected (item ["unselectedText"].toString());
|
||||
comp->setTextWhenNoChoicesAvailable (item ["noItemsText"].toString());
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
item.addTooltipProperty (props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("items", state, document), "Items", 16384, true));
|
||||
props.add (new TextPropertyComponent (item.getValue ("items"), "Items", 16384, true));
|
||||
props.getLast()->setTooltip ("A list of items to use to initialise the ComboBox");
|
||||
|
||||
props.add (new BooleanPropertyComponent (getValue ("editable", state, document), "Editable", "Text is editable"));
|
||||
props.add (createJustificationProperty ("Text Position", getValue ("textJustification", state, document), false));
|
||||
props.add (new TextPropertyComponent (getValue ("unselectedText", state, document), "Text when none selected", 512, false));
|
||||
props.add (new TextPropertyComponent (getValue ("noItemsText", state, document), "Text when no items", 512, false));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("editable"), "Editable", "Text is editable"));
|
||||
item.addJustificationProperty (props, "Text Position", item.getValue ("textJustification"), false);
|
||||
props.add (new TextPropertyComponent (item.getValue ("unselectedText"), "Text when none selected", 512, false));
|
||||
props.add (new TextPropertyComponent (item.getValue ("noItemsText"), "Text when no items", 512, false));
|
||||
|
||||
addEditableColourProperties (document, state, props);
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -153,101 +153,6 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
ComponentTypeHandler::ComponentTypeHandler (const String& name_, const String& xmlTag_,
|
||||
const String& memberNameRoot_)
|
||||
: name (name_), xmlTag (xmlTag_),
|
||||
memberNameRoot (memberNameRoot_)
|
||||
{
|
||||
}
|
||||
|
||||
ComponentTypeHandler::~ComponentTypeHandler()
|
||||
{
|
||||
}
|
||||
|
||||
Value ComponentTypeHandler::getValue (const var::identifier& name_, ValueTree& state, ComponentDocument& document) const
|
||||
{
|
||||
return state.getPropertyAsValue (name_, document.getUndoManager());
|
||||
}
|
||||
|
||||
void ComponentTypeHandler::updateComponent (ComponentDocument& document, Component* comp, const ValueTree& state)
|
||||
{
|
||||
RectangleCoordinates pos (state [ComponentDocument::compBoundsProperty].toString());
|
||||
comp->setBounds (pos.resolve (document));
|
||||
|
||||
comp->setName (state [ComponentDocument::compNameProperty]);
|
||||
|
||||
comp->setExplicitFocusOrder (state [ComponentDocument::compFocusOrderProperty]);
|
||||
|
||||
SettableTooltipClient* tooltipClient = dynamic_cast <SettableTooltipClient*> (comp);
|
||||
if (tooltipClient != 0)
|
||||
tooltipClient->setTooltip (state [ComponentDocument::compTooltipProperty]);
|
||||
}
|
||||
|
||||
void ComponentTypeHandler::initialiseNewItem (ComponentDocument& document, ValueTree& state)
|
||||
{
|
||||
state.setProperty (ComponentDocument::compNameProperty, String::empty, 0);
|
||||
state.setProperty (ComponentDocument::memberNameProperty, document.getNonexistentMemberName (getMemberNameRoot()), 0);
|
||||
|
||||
const Rectangle<int> bounds (getDefaultSize().withPosition (Point<int> (Random::getSystemRandom().nextInt (100) + 100,
|
||||
Random::getSystemRandom().nextInt (100) + 100)));
|
||||
|
||||
state.setProperty (ComponentDocument::compBoundsProperty,
|
||||
RectangleCoordinates (bounds.toFloat(),
|
||||
state [ComponentDocument::memberNameProperty]).toString(), 0);
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class CompMemberNameValueSource : public Value::ValueSource,
|
||||
public Value::Listener
|
||||
{
|
||||
public:
|
||||
CompMemberNameValueSource (ComponentDocument& document_, const ValueTree& state)
|
||||
: sourceValue (state.getPropertyAsValue (ComponentDocument::memberNameProperty, document_.getUndoManager())),
|
||||
document (document_)
|
||||
{
|
||||
sourceValue.addListener (this);
|
||||
}
|
||||
|
||||
~CompMemberNameValueSource() {}
|
||||
|
||||
void valueChanged (Value&) { sendChangeMessage (true); }
|
||||
const var getValue() const { return sourceValue.toString(); }
|
||||
|
||||
void setValue (const var& newValue)
|
||||
{
|
||||
if (newValue == sourceValue)
|
||||
return;
|
||||
|
||||
const String name (document.getNonexistentMemberName (newValue));
|
||||
|
||||
if (sourceValue != name)
|
||||
{
|
||||
document.renameAnchor (sourceValue.toString(), name);
|
||||
sourceValue = name;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Value sourceValue;
|
||||
ComponentDocument& document;
|
||||
|
||||
CompMemberNameValueSource (const CompMemberNameValueSource&);
|
||||
const CompMemberNameValueSource& operator= (const CompMemberNameValueSource&);
|
||||
};
|
||||
|
||||
void ComponentTypeHandler::createPropertyEditors (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (Value (new CompMemberNameValueSource (document, state)), "Member Name", 256, false));
|
||||
|
||||
props.add (new ComponentBoundsEditor (document, "Left", ComponentBoundsEditor::left, state, getValue (ComponentDocument::compBoundsProperty, state, document)));
|
||||
props.add (new ComponentBoundsEditor (document, "Right", ComponentBoundsEditor::right, state, getValue (ComponentDocument::compBoundsProperty, state, document)));
|
||||
props.add (new ComponentBoundsEditor (document, "Top", ComponentBoundsEditor::top, state, getValue (ComponentDocument::compBoundsProperty, state, document)));
|
||||
props.add (new ComponentBoundsEditor (document, "Bottom", ComponentBoundsEditor::bottom, state, getValue (ComponentDocument::compBoundsProperty, state, document)));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
ComponentTypeManager::ComponentTypeManager()
|
||||
{
|
||||
|
|
@ -268,7 +173,10 @@ Component* ComponentTypeManager::createFromStoredType (ComponentDocument& docume
|
|||
|
||||
Component* c = handler->createComponent();
|
||||
if (c != 0)
|
||||
handler->updateComponent (document, c, value);
|
||||
{
|
||||
ComponentTypeInstance item (document, value);
|
||||
handler->updateComponent (item, c);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
@ -282,13 +190,372 @@ ComponentTypeHandler* ComponentTypeManager::getHandlerFor (const String& type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const StringArray ComponentTypeManager::getTypeNames() const
|
||||
const StringArray ComponentTypeManager::getDisplayNames() const
|
||||
{
|
||||
StringArray s;
|
||||
for (int i = 0; i < handlers.size(); ++i)
|
||||
s.add (handlers.getUnchecked(i)->getName());
|
||||
s.add (handlers.getUnchecked(i)->getDisplayName());
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
juce_ImplementSingleton_SingleThreaded (ComponentTypeManager);
|
||||
|
||||
|
||||
|
||||
//==============================================================================
|
||||
ComponentTypeHandler::ComponentTypeHandler (const String& displayName_, const String& className_,
|
||||
const String& xmlTag_, const String& memberNameRoot_)
|
||||
: displayName (displayName_), className (className_), xmlTag (xmlTag_),
|
||||
memberNameRoot (memberNameRoot_)
|
||||
{
|
||||
}
|
||||
|
||||
ComponentTypeHandler::~ComponentTypeHandler()
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
class CompMemberNameValueSource : public Value::ValueSource,
|
||||
public Value::Listener
|
||||
{
|
||||
public:
|
||||
CompMemberNameValueSource (ComponentTypeInstance& item_)
|
||||
: sourceValue (item_.getValue (ComponentDocument::memberNameProperty)),
|
||||
item (item_)
|
||||
{
|
||||
sourceValue.addListener (this);
|
||||
}
|
||||
|
||||
~CompMemberNameValueSource() {}
|
||||
|
||||
void valueChanged (Value&) { sendChangeMessage (true); }
|
||||
const var getValue() const { return sourceValue.toString(); }
|
||||
|
||||
void setValue (const var& newValue)
|
||||
{
|
||||
if (newValue == sourceValue)
|
||||
return;
|
||||
|
||||
const String name (item.getDocument().getNonexistentMemberName (newValue));
|
||||
|
||||
if (sourceValue != name)
|
||||
{
|
||||
item.getDocument().renameAnchor (sourceValue.toString(), name);
|
||||
sourceValue = name;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Value sourceValue;
|
||||
ComponentTypeInstance& item;
|
||||
|
||||
CompMemberNameValueSource (const CompMemberNameValueSource&);
|
||||
const CompMemberNameValueSource& operator= (const CompMemberNameValueSource&);
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
ComponentTypeInstance::ComponentTypeInstance (ComponentDocument& document_, const ValueTree& state_)
|
||||
: document (document_), state (state_)
|
||||
{
|
||||
}
|
||||
|
||||
Value ComponentTypeInstance::getValue (const var::identifier& name) const
|
||||
{
|
||||
return state.getPropertyAsValue (name, document.getUndoManager());
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::set (const var::identifier& name, const var& value)
|
||||
{
|
||||
state.setProperty (name, value, 0);
|
||||
}
|
||||
|
||||
ComponentTypeHandler* ComponentTypeInstance::getHandler() const
|
||||
{
|
||||
ComponentTypeHandler* const handler = ComponentTypeManager::getInstance()->getHandlerFor (state.getType());
|
||||
jassert (handler != 0);
|
||||
return handler;
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::updateComponent (Component* comp)
|
||||
{
|
||||
getHandler()->updateComponent (*this, comp);
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::createProperties (Array <PropertyComponent*>& props)
|
||||
{
|
||||
getHandler()->createPropertyEditors (*this, props);
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::createCode (CodeGenerator& code)
|
||||
{
|
||||
code.addPrivateMember (getHandler()->getClassName (*this) + "*", getMemberName());
|
||||
getHandler()->createCode (*this, code);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void ComponentTypeInstance::initialiseNewItemBasics()
|
||||
{
|
||||
ComponentTypeHandler* handler = getHandler();
|
||||
|
||||
set (ComponentDocument::compNameProperty, String::empty);
|
||||
set (ComponentDocument::memberNameProperty, document.getNonexistentMemberName (handler->getMemberNameRoot()));
|
||||
|
||||
Rectangle<int> bounds (handler->getDefaultSize());
|
||||
int cw = document.getCanvasWidth().getValue();
|
||||
int ch = document.getCanvasHeight().getValue();
|
||||
bounds.setPosition (Random::getSystemRandom().nextInt (cw / 3) + cw / 4,
|
||||
Random::getSystemRandom().nextInt (ch / 3) + ch / 4);
|
||||
|
||||
set (ComponentDocument::compBoundsProperty, RectangleCoordinates (bounds.toFloat(), getMemberName()).toString());
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::updateComponentBasics (Component* comp)
|
||||
{
|
||||
RectangleCoordinates pos (state [ComponentDocument::compBoundsProperty].toString());
|
||||
comp->setBounds (pos.resolve (document));
|
||||
|
||||
comp->setName (state [ComponentDocument::compNameProperty]);
|
||||
|
||||
comp->setExplicitFocusOrder (state [ComponentDocument::compFocusOrderProperty]);
|
||||
|
||||
SettableTooltipClient* tooltipClient = dynamic_cast <SettableTooltipClient*> (comp);
|
||||
if (tooltipClient != 0)
|
||||
tooltipClient->setTooltip (state [ComponentDocument::compTooltipProperty]);
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::addMemberNameProperty (Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (Value (new CompMemberNameValueSource (*this)),
|
||||
"Member Name", 256, false));
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::addBoundsProperties (Array <PropertyComponent*>& props)
|
||||
{
|
||||
const Value bounds (getValue (ComponentDocument::compBoundsProperty));
|
||||
props.add (new ComponentBoundsEditor (document, "Left", ComponentBoundsEditor::left, state, bounds));
|
||||
props.add (new ComponentBoundsEditor (document, "Right", ComponentBoundsEditor::right, state, bounds));
|
||||
props.add (new ComponentBoundsEditor (document, "Top", ComponentBoundsEditor::top, state, bounds));
|
||||
props.add (new ComponentBoundsEditor (document, "Bottom", ComponentBoundsEditor::bottom, state, bounds));
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::addTooltipProperty (Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (getValue (ComponentDocument::compTooltipProperty),
|
||||
"Tooltip", 4096, false));
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::addFocusOrderProperty (Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (getValue (ComponentDocument::compFocusOrderProperty))),
|
||||
"Focus Order", 10, false));
|
||||
}
|
||||
|
||||
void ComponentTypeInstance::addColourProperty (Array <PropertyComponent*>& props, int colourId, const String& name, const String& propertyName)
|
||||
{
|
||||
props.add (new ColourPropertyComponent (document, name, getValue (propertyName),
|
||||
LookAndFeel::getDefaultLookAndFeel().findColour (colourId), true));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
class FontNameValueSource : public Value::ValueSource,
|
||||
public Value::Listener
|
||||
{
|
||||
public:
|
||||
FontNameValueSource (const Value& source)
|
||||
: sourceValue (source)
|
||||
{
|
||||
sourceValue.addListener (this);
|
||||
}
|
||||
|
||||
~FontNameValueSource() {}
|
||||
|
||||
void valueChanged (Value&) { sendChangeMessage (true); }
|
||||
|
||||
const var getValue() const
|
||||
{
|
||||
const String fontName (Font::fromString (sourceValue.toString()).getTypefaceName());
|
||||
const int index = StoredSettings::getInstance()->getFontNames().indexOf (fontName);
|
||||
|
||||
if (index >= 0) return 4 + index;
|
||||
else if (fontName == Font::getDefaultSansSerifFontName()) return 1;
|
||||
else if (fontName == Font::getDefaultSerifFontName()) return 2;
|
||||
else if (fontName == Font::getDefaultMonospacedFontName()) return 3;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void setValue (const var& newValue)
|
||||
{
|
||||
Font font (Font::fromString (sourceValue.toString()));
|
||||
|
||||
const int index = newValue;
|
||||
if (index <= 1) font.setTypefaceName (Font::getDefaultSansSerifFontName());
|
||||
else if (index == 2) font.setTypefaceName (Font::getDefaultSerifFontName());
|
||||
else if (index == 3) font.setTypefaceName (Font::getDefaultMonospacedFontName());
|
||||
else font.setTypefaceName (StoredSettings::getInstance()->getFontNames() [index - 4]);
|
||||
|
||||
sourceValue = font.toString();
|
||||
}
|
||||
|
||||
static ChoicePropertyComponent* createProperty (const String& title, const Value& value)
|
||||
{
|
||||
StringArray fontNames;
|
||||
fontNames.add (Font::getDefaultSansSerifFontName());
|
||||
fontNames.add (Font::getDefaultSerifFontName());
|
||||
fontNames.add (Font::getDefaultMonospacedFontName());
|
||||
fontNames.add (String::empty);
|
||||
fontNames.addArray (StoredSettings::getInstance()->getFontNames());
|
||||
|
||||
return new ChoicePropertyComponent (Value (new FontNameValueSource (value)), title, fontNames);
|
||||
}
|
||||
|
||||
private:
|
||||
Value sourceValue;
|
||||
};
|
||||
|
||||
class FontSizeValueSource : public Value::ValueSource,
|
||||
public Value::Listener
|
||||
{
|
||||
public:
|
||||
FontSizeValueSource (const Value& source)
|
||||
: sourceValue (source)
|
||||
{
|
||||
sourceValue.addListener (this);
|
||||
}
|
||||
|
||||
~FontSizeValueSource() {}
|
||||
|
||||
void valueChanged (Value&) { sendChangeMessage (true); }
|
||||
|
||||
const var getValue() const
|
||||
{
|
||||
return Font::fromString (sourceValue.toString()).getHeight();
|
||||
}
|
||||
|
||||
void setValue (const var& newValue)
|
||||
{
|
||||
Font font (Font::fromString (sourceValue.toString()));
|
||||
font.setHeight (newValue);
|
||||
sourceValue = font.toString();
|
||||
}
|
||||
|
||||
static PropertyComponent* createProperty (const String& title, const Value& value)
|
||||
{
|
||||
return new SliderPropertyComponent (Value (new FontSizeValueSource (value)), title, 1.0, 150.0, 0.1, 0.5);
|
||||
}
|
||||
|
||||
private:
|
||||
Value sourceValue;
|
||||
};
|
||||
|
||||
class FontStyleValueSource : public Value::ValueSource,
|
||||
public Value::Listener
|
||||
{
|
||||
public:
|
||||
FontStyleValueSource (const Value& source)
|
||||
: sourceValue (source)
|
||||
{
|
||||
sourceValue.addListener (this);
|
||||
}
|
||||
|
||||
~FontStyleValueSource() {}
|
||||
|
||||
void valueChanged (Value&) { sendChangeMessage (true); }
|
||||
|
||||
const var getValue() const
|
||||
{
|
||||
const Font f (Font::fromString (sourceValue.toString()));
|
||||
|
||||
if (f.isBold() && f.isItalic()) return getStyles() [3];
|
||||
if (f.isBold()) return getStyles() [1];
|
||||
if (f.isItalic()) return getStyles() [2];
|
||||
|
||||
return getStyles() [0];
|
||||
}
|
||||
|
||||
void setValue (const var& newValue)
|
||||
{
|
||||
Font font (Font::fromString (sourceValue.toString()));
|
||||
font.setBold (newValue.toString().containsIgnoreCase ("Bold"));
|
||||
font.setItalic (newValue.toString().containsIgnoreCase ("Italic"));
|
||||
sourceValue = font.toString();
|
||||
}
|
||||
|
||||
static PropertyComponent* createProperty (const String& title, const Value& value)
|
||||
{
|
||||
return StringListValueSource::create (title, Value (new FontStyleValueSource (value)), StringArray (getStyles()));
|
||||
}
|
||||
|
||||
static const char* const* getStyles()
|
||||
{
|
||||
static const char* const fontStyles[] = { "Normal", "Bold", "Italic", "Bold + Italic", 0 };
|
||||
return fontStyles;
|
||||
}
|
||||
|
||||
private:
|
||||
Value sourceValue;
|
||||
};
|
||||
|
||||
void ComponentTypeInstance::addFontProperties (Array <PropertyComponent*>& props, const var::identifier& name)
|
||||
{
|
||||
Value v (getValue (name));
|
||||
props.add (FontNameValueSource::createProperty ("Font", v));
|
||||
props.add (FontSizeValueSource::createProperty ("Font Size", v));
|
||||
props.add (FontStyleValueSource::createProperty ("Font Style", v));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void ComponentTypeInstance::addJustificationProperty (Array <PropertyComponent*>& props, const String& name, const Value& value, bool onlyHorizontal)
|
||||
{
|
||||
ValueRemapperSource* remapper = new ValueRemapperSource (value);
|
||||
StringArray strings;
|
||||
|
||||
if (onlyHorizontal)
|
||||
{
|
||||
const char* const layouts[] = { "Left", "Centred", "Right", 0 };
|
||||
const int justifications[] = { Justification::left, Justification::centred, Justification::right, 0 };
|
||||
|
||||
for (int i = 0; i < numElementsInArray (justifications) - 1; ++i)
|
||||
remapper->addMapping (justifications[i], i + 1);
|
||||
|
||||
strings = StringArray (layouts);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* const layouts[] = { "Centred", "Centred-left", "Centred-right", "Centred-top", "Centred-bottom", "Top-left",
|
||||
"Top-right", "Bottom-left", "Bottom-right", 0 };
|
||||
const int justifications[] = { Justification::centred, Justification::centredLeft, Justification::centredRight,
|
||||
Justification::centredTop, Justification::centredBottom, Justification::topLeft,
|
||||
Justification::topRight, Justification::bottomLeft, Justification::bottomRight, 0 };
|
||||
|
||||
for (int i = 0; i < numElementsInArray (justifications) - 1; ++i)
|
||||
remapper->addMapping (justifications[i], i + 1);
|
||||
|
||||
strings = StringArray (layouts);
|
||||
}
|
||||
|
||||
props.add (new ChoicePropertyComponent (Value (remapper), name, strings));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
const String ComponentTypeInstance::createConstructorStatement (const String& params)
|
||||
{
|
||||
String s;
|
||||
s << "addAndMakeVisible (" << getMemberName()
|
||||
<< " = new " << getHandler()->getClassName (*this);
|
||||
|
||||
if (params.isEmpty())
|
||||
s << "());" << newLine;
|
||||
else
|
||||
{
|
||||
s << " (";
|
||||
s << CodeFormatting::indent (params.trim(), s.length(), false) << "));" << newLine;
|
||||
}
|
||||
|
||||
// s << getMemberName() << "->updateStateFrom (componentStateList.getChild ("
|
||||
// << document.getComponentGroup().indexOf (state) << ");" << newLine;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,70 @@
|
|||
#include "../../../jucer_Headers.h"
|
||||
#include "../jucer_ComponentDocument.h"
|
||||
#include "../../../utility/jucer_ColourEditorComponent.h"
|
||||
class ComponentTypeHandler;
|
||||
|
||||
class JucerState
|
||||
{
|
||||
public:
|
||||
JucerState (const ValueTree& state_)
|
||||
: state (state_)
|
||||
{
|
||||
}
|
||||
|
||||
~JucerState()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
ValueTree state;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/** Temporary wrapper around a document and a component's ValueTree, providing lots of useful
|
||||
functions that can be performed on the component.
|
||||
*/
|
||||
class ComponentTypeInstance
|
||||
{
|
||||
public:
|
||||
ComponentTypeInstance (ComponentDocument& document_, const ValueTree& state_);
|
||||
|
||||
//==============================================================================
|
||||
ComponentDocument& getDocument() throw() { return document; }
|
||||
ValueTree& getState() throw() { return state; }
|
||||
|
||||
Value getValue (const var::identifier& name) const;
|
||||
void set (const var::identifier& name, const var& value);
|
||||
const var operator[] (const var::identifier& name) const { return state [name] ;}
|
||||
|
||||
const String getMemberName() const { return state [ComponentDocument::memberNameProperty]; }
|
||||
const String getComponentName() const { return state [ComponentDocument::compNameProperty]; }
|
||||
|
||||
//==============================================================================
|
||||
void initialiseNewItemBasics();
|
||||
void updateComponentBasics (Component* comp);
|
||||
|
||||
void addMemberNameProperty (Array <PropertyComponent*>& props);
|
||||
void addBoundsProperties (Array <PropertyComponent*>& props);
|
||||
void addTooltipProperty (Array <PropertyComponent*>& props);
|
||||
void addFocusOrderProperty (Array <PropertyComponent*>& props);
|
||||
void addColourProperty (Array <PropertyComponent*>& props, int colourId, const String& name, const String& propertyName);
|
||||
void addFontProperties (Array <PropertyComponent*>& props, const var::identifier& name);
|
||||
void addJustificationProperty (Array <PropertyComponent*>& props, const String& name, const Value& value, bool onlyHorizontal);
|
||||
|
||||
//==============================================================================
|
||||
const String createConstructorStatement (const String& params);
|
||||
|
||||
//==============================================================================
|
||||
ComponentTypeHandler* getHandler() const;
|
||||
void updateComponent (Component* comp);
|
||||
void createProperties (Array <PropertyComponent*>& props);
|
||||
void createCode (CodeGenerator& code);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
ComponentDocument& document;
|
||||
ValueTree state;
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -36,25 +100,25 @@ class ComponentTypeHandler
|
|||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
ComponentTypeHandler (const String& name_, const String& xmlTag_, const String& memberNameRoot_);
|
||||
ComponentTypeHandler (const String& displayName_, const String& className_, const String& xmlTag_, const String& memberNameRoot_);
|
||||
virtual ~ComponentTypeHandler();
|
||||
|
||||
const String& getName() const { return name; }
|
||||
const String& getDisplayName() const { return displayName; }
|
||||
const String& getXmlTag() const { return xmlTag; }
|
||||
const String& getMemberNameRoot() const { return memberNameRoot; }
|
||||
|
||||
virtual Component* createComponent() = 0;
|
||||
virtual const Rectangle<int> getDefaultSize() = 0;
|
||||
|
||||
virtual void updateComponent (ComponentDocument& document, Component* comp, const ValueTree& state);
|
||||
virtual void initialiseNewItem (ComponentDocument& document, ValueTree& state);
|
||||
virtual void createPropertyEditors (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props);
|
||||
|
||||
Value getValue (const var::identifier& name, ValueTree& state, ComponentDocument& document) const;
|
||||
virtual void initialiseNewItem (ComponentTypeInstance& item) = 0;
|
||||
virtual void updateComponent (ComponentTypeInstance& item, Component* comp) = 0;
|
||||
virtual void createPropertyEditors (ComponentTypeInstance& item, Array <PropertyComponent*>& props) = 0;
|
||||
virtual void createCode (ComponentTypeInstance& item, CodeGenerator& code) = 0;
|
||||
virtual const String getClassName (ComponentTypeInstance& item) const { return className; }
|
||||
|
||||
protected:
|
||||
//==============================================================================
|
||||
const String name, xmlTag, memberNameRoot;
|
||||
const String displayName, className, xmlTag, memberNameRoot;
|
||||
|
||||
private:
|
||||
ComponentTypeHandler (const ComponentTypeHandler&);
|
||||
|
|
@ -79,7 +143,7 @@ public:
|
|||
ComponentTypeHandler* getHandler (const int index) const { return handlers[index]; }
|
||||
|
||||
ComponentTypeHandler* getHandlerFor (const String& type);
|
||||
const StringArray getTypeNames() const;
|
||||
const StringArray getDisplayNames() const;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
@ -93,74 +157,46 @@ class ComponentTypeHelper : public ComponentTypeHandler
|
|||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
ComponentTypeHelper (const String& name_, const String& xmlTag_, const String& memberNameRoot_)
|
||||
: ComponentTypeHandler (name_, xmlTag_, memberNameRoot_)
|
||||
ComponentTypeHelper (const String& displayName_, const String& className_, const String& xmlTag_, const String& memberNameRoot_)
|
||||
: ComponentTypeHandler (displayName_, className_, xmlTag_, memberNameRoot_)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void update (ComponentDocument& document, ComponentClass* comp, const ValueTree& state) = 0;
|
||||
virtual void initialiseNew (ComponentTypeInstance& item) = 0;
|
||||
virtual void update (ComponentTypeInstance& item, ComponentClass* comp) = 0;
|
||||
virtual void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) = 0;
|
||||
|
||||
void updateComponent (ComponentDocument& document, Component* comp, const ValueTree& state)
|
||||
void initialiseNewItem (ComponentTypeInstance& item)
|
||||
{
|
||||
ComponentTypeHandler::updateComponent (document, comp, state);
|
||||
item.initialiseNewItemBasics();
|
||||
initialiseNew (item);
|
||||
}
|
||||
|
||||
void updateComponent (ComponentTypeInstance& item, Component* comp)
|
||||
{
|
||||
item.updateComponentBasics (comp);
|
||||
|
||||
ComponentClass* const c = dynamic_cast <ComponentClass*> (comp);
|
||||
jassert (c != 0);
|
||||
updateComponentColours (state, c);
|
||||
update (document, c, state);
|
||||
updateComponentColours (item, c);
|
||||
|
||||
update (item, c);
|
||||
}
|
||||
|
||||
virtual void initialiseNew (ComponentDocument& document, ValueTree& state) = 0;
|
||||
|
||||
void initialiseNewItem (ComponentDocument& document, ValueTree& state)
|
||||
void createPropertyEditors (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
ComponentTypeHandler::initialiseNewItem (document, state);
|
||||
initialiseNew (document, state);
|
||||
}
|
||||
item.addMemberNameProperty (props);
|
||||
item.addBoundsProperties (props);
|
||||
|
||||
virtual void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props) = 0;
|
||||
|
||||
void createPropertyEditors (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
{
|
||||
ComponentTypeHandler::createPropertyEditors (document, state, props);
|
||||
createProperties (document, state, props);
|
||||
createProperties (item, props);
|
||||
}
|
||||
|
||||
protected:
|
||||
//==============================================================================
|
||||
void addTooltipProperty (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (getValue (ComponentDocument::compTooltipProperty, state, document),
|
||||
"Tooltip", 4096, false));
|
||||
}
|
||||
|
||||
void addFocusOrderProperty (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (getValue (ComponentDocument::compFocusOrderProperty,
|
||||
state, document))),
|
||||
"Focus Order", 10, false));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
struct EditableColour
|
||||
{
|
||||
int colourId;
|
||||
String name, propertyName;
|
||||
|
||||
PropertyComponent* createProperty (ComponentTypeHelper& type, ComponentDocument& document, ValueTree& state)
|
||||
{
|
||||
return new ColourPropertyComponent (document, name, type.getValue (propertyName, state, document),
|
||||
LookAndFeel::getDefaultLookAndFeel().findColour (colourId), true);
|
||||
}
|
||||
|
||||
void updateComponent (const ValueTree& state, Component* component)
|
||||
{
|
||||
const String colour (state [propertyName].toString());
|
||||
if (colour.isNotEmpty())
|
||||
component->setColour (colourId, Colour::fromString (colour));
|
||||
else
|
||||
component->removeColour (colourId);
|
||||
}
|
||||
};
|
||||
|
||||
Array <EditableColour> editableColours;
|
||||
|
|
@ -174,16 +210,28 @@ protected:
|
|||
editableColours.add (ec);
|
||||
}
|
||||
|
||||
void addEditableColourProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void addEditableColourProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
for (int i = 0; i < editableColours.size(); ++i)
|
||||
props.add (editableColours.getReference(i).createProperty (*this, document, state));
|
||||
{
|
||||
const EditableColour& ec = editableColours.getReference(i);
|
||||
item.addColourProperty (props, ec.colourId, ec.name, ec.propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
void updateComponentColours (const ValueTree& state, Component* component)
|
||||
void updateComponentColours (ComponentTypeInstance& item, Component* component)
|
||||
{
|
||||
for (int i = 0; i < editableColours.size(); ++i)
|
||||
editableColours.getReference(i).updateComponent (state, component);
|
||||
{
|
||||
const EditableColour& ec = editableColours.getReference(i);
|
||||
|
||||
const String colour (item.getState() [ec.propertyName].toString());
|
||||
|
||||
if (colour.isNotEmpty())
|
||||
component->setColour (ec.colourId, Colour::fromString (colour));
|
||||
else
|
||||
component->removeColour (ec.colourId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class GenericComponentHandler : public ComponentTypeHelper<Component>
|
||||
{
|
||||
public:
|
||||
GenericComponentHandler() : ComponentTypeHelper<Component> ("Generic Component", "COMPONENT", "component") {}
|
||||
GenericComponentHandler() : ComponentTypeHelper<Component> ("Generic Component", "Component", "COMPONENT", "component") {}
|
||||
~GenericComponentHandler() {}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -66,24 +66,34 @@ public:
|
|||
Component* createComponent() { return new PlaceholderComp(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); }
|
||||
|
||||
void update (ComponentDocument& document, Component* comp, const ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
static_cast<PlaceholderComp*> (comp)->setDetails (state [ComponentDocument::memberNameProperty],
|
||||
state ["class"]);
|
||||
item.set ("class", "Component");
|
||||
}
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, Component* comp)
|
||||
{
|
||||
state.setProperty ("class", "Component", 0);
|
||||
static_cast<PlaceholderComp*> (comp)->setDetails (item [ComponentDocument::memberNameProperty],
|
||||
item ["class"]);
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addFocusOrderProperty (document, state, props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("class", state, document), "Class", 256, false));
|
||||
props.add (new TextPropertyComponent (item.getValue ("class"), "Class", 256, false));
|
||||
props.getLast()->setTooltip ("The class that this component is an instance of.");
|
||||
}
|
||||
|
||||
const String getClassName (ComponentTypeInstance& item) const
|
||||
{
|
||||
return item ["class"];
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class GroupComponentHandler : public ComponentTypeHelper<GroupComponent>
|
||||
{
|
||||
public:
|
||||
GroupComponentHandler() : ComponentTypeHelper<GroupComponent> ("GroupComponent", "GROUPCOMPONENT", "group")
|
||||
GroupComponentHandler() : ComponentTypeHelper<GroupComponent> ("GroupComponent", "GroupComponent", "GROUPCOMPONENT", "group")
|
||||
{
|
||||
addEditableColour (GroupComponent::outlineColourId, "Outline", "outlineColour");
|
||||
addEditableColour (GroupComponent::textColourId, "Text Colour", "textColour");
|
||||
|
|
@ -42,31 +42,36 @@ public:
|
|||
|
||||
~GroupComponentHandler() {}
|
||||
|
||||
Component* createComponent() { return new GroupComponent (String::empty, String::empty); }
|
||||
Component* createComponent() { return new GroupComponent(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 200, 200); }
|
||||
|
||||
void update (ComponentDocument& document, GroupComponent* comp, const ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
comp->setText (state ["text"].toString());
|
||||
comp->setTextLabelPosition ((int) state ["justification"]);
|
||||
item.set ("text", "Group");
|
||||
item.set ("justification", (int) Justification::left);
|
||||
}
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, GroupComponent* comp)
|
||||
{
|
||||
state.setProperty ("text", "Group", 0);
|
||||
state.setProperty ("justification", (int) Justification::left, 0);
|
||||
comp->setText (item ["text"].toString());
|
||||
comp->setTextLabelPosition ((int) item ["justification"]);
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
item.addTooltipProperty (props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("text", state, document), "Label", 512, false));
|
||||
props.add (new TextPropertyComponent (item.getValue ("text"), "Label", 512, false));
|
||||
props.getLast()->setTooltip ("The group's display name.");
|
||||
|
||||
props.add (createJustificationProperty ("Text Position", state.getPropertyAsValue ("justification", document.getUndoManager()), true));
|
||||
addEditableColourProperties (document, state, props);
|
||||
item.addJustificationProperty (props, "Text Position", item.getValue ("justification"), true);
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -57,24 +57,34 @@ private:
|
|||
class JucerComponentHandler : public ComponentTypeHelper<JucerComponent>
|
||||
{
|
||||
public:
|
||||
JucerComponentHandler() : ComponentTypeHelper<JucerComponent> ("Jucer Component", "JUCERCOMPONENT", "jucerComp") {}
|
||||
JucerComponentHandler() : ComponentTypeHelper<JucerComponent> ("Jucer Component", "Component", "JUCERCOMPONENT", "jucerComp") {}
|
||||
~JucerComponentHandler() {}
|
||||
|
||||
//==============================================================================
|
||||
Component* createComponent() { return new JucerComponent(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 150, 150); }
|
||||
|
||||
void update (ComponentDocument& document, JucerComponent* comp, const ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
}
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, JucerComponent* comp)
|
||||
{
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
}
|
||||
|
||||
const String getClassName (ComponentTypeInstance& item) const
|
||||
{
|
||||
return "xxx";
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class LabelHandler : public ComponentTypeHelper<Label>
|
||||
{
|
||||
public:
|
||||
LabelHandler() : ComponentTypeHelper<Label> ("Label", "LABEL", "label")
|
||||
LabelHandler() : ComponentTypeHelper<Label> ("Label", "Label", "LABEL", "label")
|
||||
{
|
||||
addEditableColour (Label::backgroundColourId, "Background", "backgroundColour");
|
||||
addEditableColour (Label::textColourId, "Text Colour", "textColour");
|
||||
|
|
@ -43,43 +43,47 @@ public:
|
|||
|
||||
~LabelHandler() {}
|
||||
|
||||
Component* createComponent() { return new Label (String::empty, String::empty); }
|
||||
Component* createComponent() { return new Label(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); }
|
||||
|
||||
void update (ComponentDocument& document, Label* comp, const ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
comp->setText (state ["text"].toString(), false);
|
||||
comp->setFont (getFontFromState (state, "fontName", "fontSize", "fontStyle"));
|
||||
int editMode = (int) state ["editMode"];
|
||||
item.set ("text", "New Label");
|
||||
item.set ("font", Font (14.0f).toString());
|
||||
item.set ("editMode", 1);
|
||||
item.set ("justification", (int) Justification::centredLeft);
|
||||
}
|
||||
|
||||
void update (ComponentTypeInstance& item, Label* comp)
|
||||
{
|
||||
comp->setText (item ["text"].toString(), false);
|
||||
comp->setFont (Font::fromString (item ["font"]));
|
||||
int editMode = (int) item ["editMode"];
|
||||
comp->setEditable (editMode == 2, editMode == 3, false);
|
||||
comp->setJustificationType ((int) state ["justification"]);
|
||||
comp->setJustificationType ((int) item ["justification"]);
|
||||
}
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
state.setProperty ("text", "New Label", 0);
|
||||
state.setProperty ("fontSize", 14, 0);
|
||||
state.setProperty ("editMode", 1, 0);
|
||||
state.setProperty ("justification", (int) Justification::centredLeft, 0);
|
||||
}
|
||||
item.addTooltipProperty (props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("text", state, document), "Text", 16384, true));
|
||||
props.add (new TextPropertyComponent (item.getValue ("text"), "Text", 16384, true));
|
||||
props.getLast()->setTooltip ("The label's text.");
|
||||
|
||||
props.add (createJustificationProperty ("Layout", state.getPropertyAsValue ("justification", document.getUndoManager()), false));
|
||||
item.addJustificationProperty (props, "Layout", item.getValue ("justification"), false);
|
||||
|
||||
const char* const editModes[] = { "Read-only", "Edit on Single-Click", "Edit on Double-Click", 0 };
|
||||
props.add (new ChoicePropertyComponent (state.getPropertyAsValue ("editMode", document.getUndoManager()),
|
||||
"Edit Mode", StringArray (editModes)));
|
||||
props.add (new ChoicePropertyComponent (item.getValue ("editMode"), "Edit Mode", StringArray (editModes)));
|
||||
|
||||
createFontProperties (props, state, "fontName", "fontSize", "fontStyle", document.getUndoManager());
|
||||
item.addFontProperties (props, "font");
|
||||
|
||||
addEditableColourProperties (document, state, props);
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class SliderHandler : public ComponentTypeHelper<Slider>
|
||||
{
|
||||
public:
|
||||
SliderHandler() : ComponentTypeHelper<Slider> ("Slider", "SLIDER", "slider")
|
||||
SliderHandler() : ComponentTypeHelper<Slider> ("Slider", "Slider", "SLIDER", "slider")
|
||||
{
|
||||
addEditableColour (Slider::backgroundColourId, "Background", "backgroundColour");
|
||||
addEditableColour (Slider::thumbColourId, "Thumb", "thumbColour");
|
||||
|
|
@ -49,54 +49,59 @@ public:
|
|||
|
||||
~SliderHandler() {}
|
||||
|
||||
Component* createComponent() { return new Slider (String::empty); }
|
||||
Component* createComponent() { return new Slider(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 200, 24); }
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
state.setProperty ("min", 0, 0);
|
||||
state.setProperty ("max", 100, 0);
|
||||
state.setProperty ("interval", 1, 0);
|
||||
state.setProperty ("type", 1 + Slider::LinearHorizontal, 0);
|
||||
state.setProperty ("textBoxPos", 2, 0);
|
||||
state.setProperty ("editable", true, 0);
|
||||
state.setProperty ("textBoxWidth", 80, 0);
|
||||
state.setProperty ("textBoxHeight", 20, 0);
|
||||
state.setProperty ("skew", 1, 0);
|
||||
item.set ("min", 0);
|
||||
item.set ("max", 100);
|
||||
item.set ("interval", 1);
|
||||
item.set ("type", 1 + Slider::LinearHorizontal);
|
||||
item.set ("textBoxPos", 2);
|
||||
item.set ("editable", true);
|
||||
item.set ("textBoxWidth", 80);
|
||||
item.set ("textBoxHeight", 20);
|
||||
item.set ("skew", 1);
|
||||
}
|
||||
|
||||
void update (ComponentDocument& document, Slider* comp, const ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, Slider* comp)
|
||||
{
|
||||
comp->setRange ((double) state ["min"], (double) state ["max"], (double) state ["interval"]);
|
||||
comp->setSliderStyle ((Slider::SliderStyle) ((int) state ["type"] - 1));
|
||||
comp->setTextBoxStyle ((Slider::TextEntryBoxPosition) ((int) state ["textBoxPos"] - 1),
|
||||
! (bool) state ["editable"],
|
||||
(int) state ["textBoxWidth"], (int) state ["textBoxHeight"]);
|
||||
comp->setSkewFactor ((double) state ["skew"]);
|
||||
comp->setRange ((double) item ["min"], (double) item ["max"], (double) item ["interval"]);
|
||||
comp->setSliderStyle ((Slider::SliderStyle) ((int) item ["type"] - 1));
|
||||
comp->setTextBoxStyle ((Slider::TextEntryBoxPosition) ((int) item ["textBoxPos"] - 1),
|
||||
! (bool) item ["editable"],
|
||||
(int) item ["textBoxWidth"], (int) item ["textBoxHeight"]);
|
||||
comp->setSkewFactor ((double) item ["skew"]);
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
item.addTooltipProperty (props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (getValue ("min", state, document))), "Minimum", 16, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (getValue ("max", state, document))), "Maximum", 16, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (getValue ("interval", state, document))), "Interval", 16, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue ("min"))), "Minimum", 16, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue ("max"))), "Maximum", 16, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue ("interval"))), "Interval", 16, false));
|
||||
|
||||
const char* const types[] = { "LinearHorizontal", "LinearVertical", "LinearBar", "Rotary", "RotaryHorizontalDrag", "RotaryVerticalDrag",
|
||||
"IncDecButtons", "TwoValueHorizontal", "TwoValueVertical", "ThreeValueHorizontal", "ThreeValueVertical", 0 };
|
||||
props.add (new ChoicePropertyComponent (state.getPropertyAsValue ("type", document.getUndoManager()), "Type", StringArray (types)));
|
||||
props.add (new ChoicePropertyComponent (item.getValue ("type"), "Type", StringArray (types)));
|
||||
|
||||
const char* const textBoxPositions[] = { "NoTextBox", "TextBoxLeft", "TextBoxRight", "TextBoxAbove", "TextBoxBelow", 0 };
|
||||
props.add (new ChoicePropertyComponent (state.getPropertyAsValue ("textBoxPos", document.getUndoManager()), "Text Box", StringArray (textBoxPositions)));
|
||||
props.add (new ChoicePropertyComponent (item.getValue ("textBoxPos"), "Text Box", StringArray (textBoxPositions)));
|
||||
|
||||
props.add (new BooleanPropertyComponent (getValue ("editable", state, document), "Editable", "Value can be edited"));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (getValue ("textBoxWidth", state, document))), "Text Box Width", 8, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (getValue ("textBoxHeight", state, document))), "Text Box Height", 8, false));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("editable"), "Editable", "Value can be edited"));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (item.getValue ("textBoxWidth"))), "Text Box Width", 8, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (item.getValue ("textBoxHeight"))), "Text Box Height", 8, false));
|
||||
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (getValue ("skew", state, document))), "Skew Factor", 16, false));
|
||||
addEditableColourProperties (document, state, props);
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue ("skew"))), "Skew Factor", 16, false));
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement (CodeFormatting::stringLiteral (item.getComponentName()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class TabbedComponentHandler : public ComponentTypeHelper<TabbedComponent>
|
||||
{
|
||||
public:
|
||||
TabbedComponentHandler() : ComponentTypeHelper<TabbedComponent> ("TabbedComponent", "TABBEDCOMPONENT", "tabbedComponent")
|
||||
TabbedComponentHandler() : ComponentTypeHelper<TabbedComponent> ("TabbedComponent", "TabbedComponent", "TABBEDCOMPONENT", "tabbedComponent")
|
||||
{
|
||||
addEditableColour (TabbedComponent::backgroundColourId, "Background", "backgroundColour");
|
||||
addEditableColour (TabbedComponent::outlineColourId, "Outline", "outlineColour");
|
||||
|
|
@ -45,17 +45,22 @@ public:
|
|||
Component* createComponent() { return new TabbedComponent (TabbedButtonBar::TabsAtTop); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 300, 200); }
|
||||
|
||||
void update (ComponentDocument& document, TabbedComponent* comp, const ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
}
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, TabbedComponent* comp)
|
||||
{
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addEditableColourProperties (document, state, props);
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement ("TabbedButtonBar::TabsAtTop");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class TextButtonHandler : public ComponentTypeHelper<TextButton>
|
||||
{
|
||||
public:
|
||||
TextButtonHandler() : ComponentTypeHelper<TextButton> ("TextButton", "TEXTBUTTON", "textButton")
|
||||
TextButtonHandler() : ComponentTypeHelper<TextButton> ("TextButton", "TextButton", "TEXTBUTTON", "textButton")
|
||||
{
|
||||
addEditableColour (TextButton::buttonColourId, "Background", "backgroundColour");
|
||||
addEditableColour (TextButton::textColourOffId, "Text Colour", "textColour");
|
||||
|
|
@ -42,50 +42,55 @@ public:
|
|||
|
||||
~TextButtonHandler() {}
|
||||
|
||||
Component* createComponent() { return new TextButton (String::empty); }
|
||||
Component* createComponent() { return new TextButton(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 150, 24); }
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
state.setProperty ("text", "New Button", 0);
|
||||
state.setProperty ("radioGroup", 0, 0);
|
||||
state.setProperty ("connectedLeft", false, 0);
|
||||
state.setProperty ("connectedRight", false, 0);
|
||||
state.setProperty ("connectedTop", false, 0);
|
||||
state.setProperty ("connectedBottom", false, 0);
|
||||
item.set ("text", "New Button");
|
||||
item.set ("radioGroup", 0);
|
||||
item.set ("connectedLeft", false);
|
||||
item.set ("connectedRight", false);
|
||||
item.set ("connectedTop", false);
|
||||
item.set ("connectedBottom", false);
|
||||
}
|
||||
|
||||
void update (ComponentDocument& document, TextButton* comp, const ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, TextButton* comp)
|
||||
{
|
||||
comp->setButtonText (state ["text"].toString());
|
||||
comp->setRadioGroupId (state ["radioGroup"]);
|
||||
comp->setButtonText (item ["text"].toString());
|
||||
comp->setRadioGroupId (item ["radioGroup"]);
|
||||
|
||||
int connected = 0;
|
||||
if (state ["connectedLeft"]) connected |= TextButton::ConnectedOnLeft;
|
||||
if (state ["connectedRight"]) connected |= TextButton::ConnectedOnRight;
|
||||
if (state ["connectedTop"]) connected |= TextButton::ConnectedOnTop;
|
||||
if (state ["connectedBottom"]) connected |= TextButton::ConnectedOnBottom;
|
||||
if (item ["connectedLeft"]) connected |= TextButton::ConnectedOnLeft;
|
||||
if (item ["connectedRight"]) connected |= TextButton::ConnectedOnRight;
|
||||
if (item ["connectedTop"]) connected |= TextButton::ConnectedOnTop;
|
||||
if (item ["connectedBottom"]) connected |= TextButton::ConnectedOnBottom;
|
||||
|
||||
comp->setConnectedEdges (connected);
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
item.addTooltipProperty (props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("text", state, document), "Button Text", 1024, false));
|
||||
props.add (new TextPropertyComponent (item.getValue ("text"), "Button Text", 1024, false));
|
||||
props.getLast()->setTooltip ("The button's text.");
|
||||
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (getValue ("radioGroup", state, document))), "Radio Group", 8, false));
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (item.getValue ("radioGroup"))), "Radio Group", 8, false));
|
||||
props.getLast()->setTooltip ("The radio group that this button is a member of.");
|
||||
|
||||
props.add (new BooleanPropertyComponent (getValue ("connectedLeft", state, document), "Connected left", "Connected"));
|
||||
props.add (new BooleanPropertyComponent (getValue ("connectedRight", state, document), "Connected right", "Connected"));
|
||||
props.add (new BooleanPropertyComponent (getValue ("connectedTop", state, document), "Connected top", "Connected"));
|
||||
props.add (new BooleanPropertyComponent (getValue ("connectedBottom", state, document), "Connected bottom", "Connected"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("connectedLeft"), "Connected left", "Connected"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("connectedRight"), "Connected right", "Connected"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("connectedTop"), "Connected top", "Connected"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("connectedBottom"), "Connected bottom", "Connected"));
|
||||
|
||||
addEditableColourProperties (document, state, props);
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode += item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class TextEditorHandler : public ComponentTypeHelper<TextEditor>
|
||||
{
|
||||
public:
|
||||
TextEditorHandler() : ComponentTypeHelper<TextEditor> ("TextEditor", "TEXTEDITOR", "textEditor")
|
||||
TextEditorHandler() : ComponentTypeHelper<TextEditor> ("TextEditor", "TextEditor", "TEXTEDITOR", "textEditor")
|
||||
{
|
||||
addEditableColour (TextEditor::backgroundColourId, "Background", "backgroundColour");
|
||||
addEditableColour (TextEditor::textColourId, "Text", "textColour");
|
||||
|
|
@ -51,45 +51,50 @@ public:
|
|||
Component* createComponent() { return new TextEditor(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); }
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
state.setProperty ("text", "Text Editor Content", 0);
|
||||
state.setProperty ("readOnly", false, 0);
|
||||
state.setProperty ("scrollbarsShown", true, 0);
|
||||
state.setProperty ("caretVisible", true, 0);
|
||||
state.setProperty ("popupMenuEnabled", true, 0);
|
||||
state.setProperty ("mode", 1, 0);
|
||||
item.set ("text", "Text Editor Content");
|
||||
item.set ("readOnly", false);
|
||||
item.set ("scrollbarsShown", true);
|
||||
item.set ("caretVisible", true);
|
||||
item.set ("popupMenuEnabled", true);
|
||||
item.set ("mode", 1);
|
||||
}
|
||||
|
||||
void update (ComponentDocument& document, TextEditor* comp, const ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, TextEditor* comp)
|
||||
{
|
||||
comp->setReadOnly (state["readOnly"]);
|
||||
comp->setScrollbarsShown (state ["scrollbarsShown"]);
|
||||
comp->setCaretVisible (state ["caretVisible"]);
|
||||
comp->setPopupMenuEnabled (state ["popupMenuEnabled"]);
|
||||
int mode = state ["mode"];
|
||||
comp->setReadOnly (item ["readOnly"]);
|
||||
comp->setScrollbarsShown (item ["scrollbarsShown"]);
|
||||
comp->setCaretVisible (item ["caretVisible"]);
|
||||
comp->setPopupMenuEnabled (item ["popupMenuEnabled"]);
|
||||
int mode = item ["mode"];
|
||||
comp->setMultiLine (mode > 1, true);
|
||||
comp->setReturnKeyStartsNewLine (mode != 3);
|
||||
comp->setText (state ["text"].toString());
|
||||
comp->setText (item ["text"].toString());
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
item.addTooltipProperty (props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("text", state, document), "Text", 16384, true));
|
||||
props.add (new TextPropertyComponent (item.getValue ("text"), "Text", 16384, true));
|
||||
props.getLast()->setTooltip ("The editor's initial content.");
|
||||
|
||||
const char* const modes[] = { "Single-Line", "Multi-Line (Return key starts new line)", "Multi-Line (Return key disabled)", 0 };
|
||||
props.add (new ChoicePropertyComponent (getValue ("mode", state, document), "Mode", StringArray (modes)));
|
||||
props.add (new ChoicePropertyComponent (item.getValue ("mode"), "Mode", StringArray (modes)));
|
||||
|
||||
props.add (new BooleanPropertyComponent (getValue ("readOnly", state, document), "Read-Only", "Read-Only"));
|
||||
props.add (new BooleanPropertyComponent (getValue ("scrollbarsShown", state, document), "Scrollbars", "Scrollbars Shown"));
|
||||
props.add (new BooleanPropertyComponent (getValue ("caretVisible", state, document), "Caret", "Caret Visible"));
|
||||
props.add (new BooleanPropertyComponent (getValue ("popupMenuEnabled", state, document), "Popup Menu", "Popup Menu Enabled"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("readOnly"), "Read-Only", "Read-Only"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("scrollbarsShown"), "Scrollbars", "Scrollbars Shown"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("caretVisible"), "Caret", "Caret Visible"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("popupMenuEnabled"), "Popup Menu", "Popup Menu Enabled"));
|
||||
|
||||
addEditableColourProperties (document, state, props);
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode += item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,39 +34,44 @@
|
|||
class ToggleButtonHandler : public ComponentTypeHelper<ToggleButton>
|
||||
{
|
||||
public:
|
||||
ToggleButtonHandler() : ComponentTypeHelper<ToggleButton> ("ToggleButton", "TOGGLEBUTTON", "toggleButton")
|
||||
ToggleButtonHandler() : ComponentTypeHelper<ToggleButton> ("ToggleButton", "ToggleButton", "TOGGLEBUTTON", "toggleButton")
|
||||
{
|
||||
addEditableColour (ToggleButton::textColourId, "Text Colour", "textColour");
|
||||
}
|
||||
|
||||
~ToggleButtonHandler() {}
|
||||
|
||||
Component* createComponent() { return new ToggleButton (String::empty); }
|
||||
Component* createComponent() { return new ToggleButton(); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); }
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
state.setProperty ("text", "New Toggle Button", 0);
|
||||
state.setProperty ("initialState", false, 0);
|
||||
item.set ("text", "New Toggle Button");
|
||||
item.set ("initialState", false);
|
||||
}
|
||||
|
||||
void update (ComponentDocument& document, ToggleButton* comp, const ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, ToggleButton* comp)
|
||||
{
|
||||
comp->setButtonText (state ["text"].toString());
|
||||
comp->setToggleState (state ["initialState"], false);
|
||||
comp->setButtonText (item ["text"].toString());
|
||||
comp->setToggleState (item ["initialState"], false);
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
item.addTooltipProperty (props);
|
||||
item.addFocusOrderProperty (props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("text", state, document), "Button Text", 1024, false));
|
||||
props.add (new TextPropertyComponent (item.getValue ("text"), "Button Text", 1024, false));
|
||||
props.getLast()->setTooltip ("The button's text.");
|
||||
|
||||
props.add (new BooleanPropertyComponent (getValue ("initialState", state, document), "Initial State", "Enabled initially"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("initialState"), "Initial State", "Enabled initially"));
|
||||
|
||||
addEditableColourProperties (document, state, props);
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode += item.createConstructorStatement (String::empty);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
class ViewportHandler : public ComponentTypeHelper<Viewport>
|
||||
{
|
||||
public:
|
||||
ViewportHandler() : ComponentTypeHelper<Viewport> ("Viewport", "VIEWPORT", "viewport") {}
|
||||
ViewportHandler() : ComponentTypeHelper<Viewport> ("Viewport", "Viewport", "VIEWPORT", "viewport") {}
|
||||
~ViewportHandler() {}
|
||||
|
||||
class DemoContentComponent : public Component
|
||||
|
|
@ -60,24 +60,30 @@ public:
|
|||
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 300, 200); }
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
void initialiseNew (ComponentTypeInstance& item)
|
||||
{
|
||||
state.setProperty ("scrollBarV", true, 0);
|
||||
state.setProperty ("scrollBarH", true, 0);
|
||||
state.setProperty ("scrollbarWidth", 18, 0);
|
||||
item.set ("scrollBarV", true);
|
||||
item.set ("scrollBarH", true);
|
||||
item.set ("scrollbarWidth", 18);
|
||||
}
|
||||
|
||||
void update (ComponentDocument& document, Viewport* comp, const ValueTree& state)
|
||||
void update (ComponentTypeInstance& item, Viewport* comp)
|
||||
{
|
||||
comp->setScrollBarsShown (state ["scrollBarV"], state ["scrollBarH"]);
|
||||
comp->setScrollBarThickness (state ["scrollbarWidth"]);
|
||||
comp->setScrollBarsShown (item ["scrollBarV"], item ["scrollBarH"]);
|
||||
comp->setScrollBarThickness (item ["scrollbarWidth"]);
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new BooleanPropertyComponent (getValue ("scrollBarV", state, document), "Scrollbar V", "Vertical scrollbar shown"));
|
||||
props.add (new BooleanPropertyComponent (getValue ("scrollBarH", state, document), "Scrollbar H", "Horizontal scrollbar shown"));
|
||||
props.add (new SliderPropertyComponent (getValue ("scrollbarWidth", state, document), "Scrollbar Thickness", 3, 40, 1));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("scrollBarV"), "Scrollbar V", "Vertical scrollbar shown"));
|
||||
props.add (new BooleanPropertyComponent (item.getValue ("scrollBarH"), "Scrollbar H", "Horizontal scrollbar shown"));
|
||||
props.add (new SliderPropertyComponent (item.getValue ("scrollbarWidth"), "Scrollbar Thickness", 3, 40, 1));
|
||||
addEditableColourProperties (item, props);
|
||||
}
|
||||
|
||||
void createCode (ComponentTypeInstance& item, CodeGenerator& code)
|
||||
{
|
||||
code.constructorCode << item.createConstructorStatement (CodeFormatting::stringLiteral (item.getComponentName()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ int CodeGenerator::getUniqueSuffix()
|
|||
return ++suffix;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void CodeGenerator::addPrivateMember (const String& type, const String& name)
|
||||
{
|
||||
privateMemberDeclarations << type << " " << name << ";" << newLine;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
String& CodeGenerator::getCallbackCode (const String& requiredParentClass,
|
||||
const String& returnType,
|
||||
|
|
@ -121,8 +127,8 @@ const String CodeGenerator::getCallbackDefinitions() const
|
|||
{
|
||||
CallbackMethod* const cm = callbacks.getUnchecked(i);
|
||||
|
||||
const String userCodeBlockName ("User" + makeValidCppIdentifier (cm->prototype.upToFirstOccurrenceOf ("(", false, false),
|
||||
true, true, false).trim());
|
||||
const String userCodeBlockName ("User" + CodeFormatting::makeValidIdentifier (cm->prototype.upToFirstOccurrenceOf ("(", false, false),
|
||||
true, true, false).trim());
|
||||
|
||||
if (userCodeBlockName.isNotEmpty() && cm->hasPrePostUserSections)
|
||||
{
|
||||
|
|
@ -132,7 +138,7 @@ const String CodeGenerator::getCallbackDefinitions() const
|
|||
<< " //[" << userCodeBlockName << "_Pre]" << newLine
|
||||
<< " //[/" << userCodeBlockName
|
||||
<< "_Pre]" << newLine << newLine
|
||||
<< " " << indentCode (cm->content.trim(), 4) << newLine
|
||||
<< " " << CodeFormatting::indent (cm->content.trim(), 4, false) << newLine
|
||||
<< newLine
|
||||
<< " //[" << userCodeBlockName << "_Post]" << newLine
|
||||
<< " //[/" << userCodeBlockName << "_Post]" << newLine
|
||||
|
|
@ -143,7 +149,7 @@ const String CodeGenerator::getCallbackDefinitions() const
|
|||
{
|
||||
s << cm->returnType << " " << className << "::" << cm->prototype << newLine
|
||||
<< "{" << newLine
|
||||
<< " " << indentCode (cm->content.trim(), 4) << newLine
|
||||
<< " " << CodeFormatting::indent (cm->content.trim(), 4, false) << newLine
|
||||
<< "}" << newLine
|
||||
<< newLine;
|
||||
}
|
||||
|
|
@ -222,7 +228,7 @@ static const String getIncludeFileCode (StringArray files)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
static void replaceTemplate (String& text, const String& itemName, const String& value)
|
||||
static void replaceTemplate (String& text, const String& itemName, const String& value, bool indent = true)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
|
|
@ -233,16 +239,18 @@ static void replaceTemplate (String& text, const String& itemName, const String&
|
|||
|
||||
int indentLevel = 0;
|
||||
|
||||
for (int i = index; --i >= 0;)
|
||||
if (indent)
|
||||
{
|
||||
if (text[i] == '\n')
|
||||
break;
|
||||
for (int i = index; --i >= 0;)
|
||||
{
|
||||
if (text[i] == '\n')
|
||||
break;
|
||||
|
||||
++indentLevel;
|
||||
++indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
text = text.replaceSection (index, itemName.length() + 4,
|
||||
indentCode (value, indentLevel));
|
||||
text = text.replaceSection (index, itemName.length() + 4, CodeFormatting::indent (value, indentLevel, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -251,7 +259,7 @@ void CodeGenerator::applyToCode (String& code, const File& targetFile,
|
|||
bool isForPreview, Project* project) const
|
||||
{
|
||||
replaceTemplate (code, "juceVersion", SystemStats::getJUCEVersion());
|
||||
replaceTemplate (code, "headerGuard", makeHeaderGuardName (targetFile));
|
||||
replaceTemplate (code, "headerGuard", CodeFormatting::makeHeaderGuardName (targetFile));
|
||||
|
||||
replaceTemplate (code, "className", className);
|
||||
replaceTemplate (code, "constructorParams", constructorParams);
|
||||
|
|
@ -264,7 +272,7 @@ void CodeGenerator::applyToCode (String& code, const File& targetFile,
|
|||
replaceTemplate (code, "methodDefinitions", getCallbackDefinitions());
|
||||
|
||||
if (project != 0)
|
||||
replaceTemplate (code, "defaultJuceInclude", createIncludeStatement (project->getAppIncludeFile(), targetFile));
|
||||
replaceTemplate (code, "defaultJuceInclude", CodeFormatting::createIncludeStatement (project->getAppIncludeFile(), targetFile));
|
||||
else
|
||||
replaceTemplate (code, "defaultJuceInclude", "#include \"juce_amalgamated.h\"");
|
||||
|
||||
|
|
@ -284,6 +292,14 @@ void CodeGenerator::applyToCode (String& code, const File& targetFile,
|
|||
replaceTemplate (code, "metadata", " << Metadata isn't shown in the code preview >>" + String (newLine));
|
||||
replaceTemplate (code, "staticMemberDefinitions", "// Static member declarations and resources would go here... (these aren't shown in the code preview)");
|
||||
}
|
||||
|
||||
{
|
||||
MemoryOutputStream compDataCpp;
|
||||
CodeFormatting::writeDataAsCppLiteral (componentStateData, compDataCpp);
|
||||
|
||||
replaceTemplate (code, "statedata", compDataCpp.toUTF8(), false);
|
||||
replaceTemplate (code, "statedatasize", String ((int) componentStateData.getSize()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -389,11 +405,10 @@ void CodeGenerator::CustomCodeList::reloadFrom (const String& fileContent)
|
|||
CodeDocumentRef::Ptr doc (getDocumentFor (tag, false));
|
||||
if (doc == 0)
|
||||
{
|
||||
CodeDocument* const codeDoc = new CodeDocument();
|
||||
doc = new CodeDocumentRef (codeDoc);
|
||||
codeDoc->replaceAllContent (content);
|
||||
codeDoc->clearUndoHistory();
|
||||
codeDoc->setSavePoint();
|
||||
doc = new CodeDocumentRef();
|
||||
doc->getDocument().replaceAllContent (content);
|
||||
doc->getDocument().clearUndoHistory();
|
||||
doc->getDocument().setSavePoint();
|
||||
}
|
||||
|
||||
newContent.add (doc);
|
||||
|
|
@ -493,7 +508,7 @@ const CodeGenerator::CustomCodeList::CodeDocumentRef::Ptr CodeGenerator::CustomC
|
|||
{
|
||||
sectionNames.add (sectionName);
|
||||
|
||||
const CodeDocumentRef::Ptr doc (new CodeDocumentRef (new CodeDocument()));
|
||||
const CodeDocumentRef::Ptr doc (new CodeDocumentRef());
|
||||
sectionContent.add (doc);
|
||||
return doc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public:
|
|||
String destructorCode;
|
||||
String staticMemberDefinitions;
|
||||
String jucerMetadata;
|
||||
MemoryBlock componentStateData;
|
||||
|
||||
struct CallbackMethod
|
||||
{
|
||||
|
|
@ -60,6 +61,8 @@ public:
|
|||
|
||||
OwnedArray<CallbackMethod> callbacks;
|
||||
|
||||
void addPrivateMember (const String& type, const String& name);
|
||||
|
||||
String& getCallbackCode (const String& requiredParentClass,
|
||||
const String& returnType,
|
||||
const String& prototype,
|
||||
|
|
@ -90,13 +93,13 @@ public:
|
|||
class CodeDocumentRef : public ReferenceCountedObject
|
||||
{
|
||||
public:
|
||||
CodeDocumentRef (CodeDocument* doc_) : doc (doc_) {}
|
||||
CodeDocument& getDocument() const throw() { return *doc; }
|
||||
CodeDocumentRef() {}
|
||||
CodeDocument& getDocument() throw() { return doc; }
|
||||
|
||||
typedef ReferenceCountedObjectPtr<CodeDocumentRef> Ptr;
|
||||
|
||||
private:
|
||||
CodeDocument* const doc;
|
||||
CodeDocument doc;
|
||||
|
||||
CodeDocumentRef (const CodeDocumentRef&);
|
||||
CodeDocumentRef& operator= (const CodeDocumentRef&);
|
||||
|
|
|
|||
|
|
@ -142,6 +142,17 @@ void ComponentDocument::writeCode (OutputStream& cpp, OutputStream& header)
|
|||
codeGen.className = getClassName().toString();
|
||||
codeGen.parentClasses = "public Component";
|
||||
|
||||
{
|
||||
MemoryOutputStream stateStream (1024, 1024, &codeGen.componentStateData);
|
||||
root.writeToStream (stateStream);
|
||||
}
|
||||
|
||||
for (int i = 0; i < getNumComponents(); ++i)
|
||||
{
|
||||
ComponentTypeInstance item (*this, getComponent (i));
|
||||
item.createCode (codeGen);
|
||||
}
|
||||
|
||||
{
|
||||
MemoryOutputStream metaData;
|
||||
writeMetadata (metaData);
|
||||
|
|
@ -185,8 +196,8 @@ bool ComponentDocument::save()
|
|||
MemoryOutputStream cpp, header;
|
||||
writeCode (cpp, header);
|
||||
|
||||
bool savedOk = overwriteFileWithNewDataIfDifferent (cppFile, cpp)
|
||||
&& overwriteFileWithNewDataIfDifferent (cppFile.withFileExtension (".h"), header);
|
||||
bool savedOk = FileUtils::overwriteFileWithNewDataIfDifferent (cppFile, cpp)
|
||||
&& FileUtils::overwriteFileWithNewDataIfDifferent (cppFile.withFileExtension (".h"), header);
|
||||
|
||||
if (savedOk)
|
||||
changedSinceSaved = false;
|
||||
|
|
@ -298,6 +309,9 @@ void ComponentDocument::checkRootObject()
|
|||
|
||||
if ((int) getCanvasHeight().getValue() <= 0)
|
||||
getCanvasHeight() = 480;
|
||||
|
||||
if (! root.hasProperty ("background"))
|
||||
getBackgroundColour() = Colours::white.toString();
|
||||
}
|
||||
|
||||
void ComponentDocument::setUsingTemporaryCanvasSize (bool b)
|
||||
|
|
@ -317,22 +331,27 @@ Value ComponentDocument::getCanvasHeight() const
|
|||
return usingTemporaryCanvasSize ? tempCanvasHeight : getRootValueNonUndoable ("height");
|
||||
}
|
||||
|
||||
Value ComponentDocument::getBackgroundColour() const
|
||||
{
|
||||
return getRootValueUndoable ("background");
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
const int menuItemOffset = 0x63451fa4;
|
||||
|
||||
void ComponentDocument::addNewComponentMenuItems (PopupMenu& menu) const
|
||||
{
|
||||
const StringArray typeNames (ComponentTypeManager::getInstance()->getTypeNames());
|
||||
const StringArray displayNames (ComponentTypeManager::getInstance()->getDisplayNames());
|
||||
|
||||
for (int i = 0; i < typeNames.size(); ++i)
|
||||
menu.addItem (i + menuItemOffset, "New " + typeNames[i]);
|
||||
for (int i = 0; i < displayNames.size(); ++i)
|
||||
menu.addItem (i + menuItemOffset, "New " + displayNames[i]);
|
||||
}
|
||||
|
||||
const ValueTree ComponentDocument::performNewComponentMenuItem (int menuResultCode)
|
||||
{
|
||||
const StringArray typeNames (ComponentTypeManager::getInstance()->getTypeNames());
|
||||
const StringArray displayNames (ComponentTypeManager::getInstance()->getDisplayNames());
|
||||
|
||||
if (menuResultCode >= menuItemOffset && menuResultCode < menuItemOffset + typeNames.size())
|
||||
if (menuResultCode >= menuItemOffset && menuResultCode < menuItemOffset + displayNames.size())
|
||||
{
|
||||
ComponentTypeHandler* handler = ComponentTypeManager::getInstance()->getHandler (menuResultCode - menuItemOffset);
|
||||
jassert (handler != 0);
|
||||
|
|
@ -341,7 +360,9 @@ const ValueTree ComponentDocument::performNewComponentMenuItem (int menuResultCo
|
|||
{
|
||||
ValueTree state (handler->getXmlTag());
|
||||
state.setProperty (idProperty, createAlphaNumericUID(), 0);
|
||||
handler->initialiseNewItem (*this, state);
|
||||
|
||||
ComponentTypeInstance comp (*this, state);
|
||||
handler->initialiseNewItem (comp);
|
||||
|
||||
getComponentGroup().addChild (state, -1, getUndoManager());
|
||||
|
||||
|
|
@ -541,7 +562,7 @@ bool ComponentDocument::setCoordsFor (ValueTree& state, const RectangleCoordinat
|
|||
|
||||
const String ComponentDocument::getNonexistentMemberName (String name)
|
||||
{
|
||||
String n (makeValidCppIdentifier (name, false, true, false));
|
||||
String n (CodeFormatting::makeValidIdentifier (name, false, true, false));
|
||||
int suffix = 2;
|
||||
|
||||
while (markersX->getMarkerNamed (n).isValid() || markersY->getMarkerNamed (n).isValid()
|
||||
|
|
@ -558,7 +579,7 @@ void ComponentDocument::renameAnchor (const String& oldName, const String& newNa
|
|||
{
|
||||
ValueTree v (getComponent(i));
|
||||
RectangleCoordinates coords (getCoordsFor (v));
|
||||
coords.renameAnchorIfUsed (oldName, newName);
|
||||
coords.renameAnchorIfUsed (oldName, newName, *this);
|
||||
setCoordsFor (v, coords);
|
||||
}
|
||||
|
||||
|
|
@ -664,11 +685,8 @@ void ComponentDocument::updateComponent (Component* comp)
|
|||
|
||||
if (v.isValid())
|
||||
{
|
||||
ComponentTypeHandler* handler = ComponentTypeManager::getInstance()->getHandlerFor (v.getType());
|
||||
jassert (handler != 0);
|
||||
|
||||
if (handler != 0)
|
||||
handler->updateComponent (*this, comp, v);
|
||||
ComponentTypeInstance item (*this, v);
|
||||
item.updateComponent (comp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -706,6 +724,7 @@ bool ComponentDocument::isStateForComponent (const ValueTree& storedState, Compo
|
|||
void ComponentDocument::removeComponent (const ValueTree& state)
|
||||
{
|
||||
jassert (state.isAChildOf (getComponentGroup()));
|
||||
renameAnchor (state [memberNameProperty], String::empty);
|
||||
getComponentGroup().removeChild (state, getUndoManager());
|
||||
}
|
||||
|
||||
|
|
@ -810,12 +829,8 @@ bool ComponentDocument::createItemProperties (Array <PropertyComponent*>& props,
|
|||
|
||||
if (comp.isValid())
|
||||
{
|
||||
ComponentTypeHandler* handler = ComponentTypeManager::getInstance()->getHandlerFor (comp.getType());
|
||||
jassert (handler != 0);
|
||||
|
||||
if (handler != 0)
|
||||
handler->createPropertyEditors (*this, comp, props);
|
||||
|
||||
ComponentTypeInstance item (*this, comp);
|
||||
item.createProperties (props);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public:
|
|||
void setUsingTemporaryCanvasSize (bool b);
|
||||
Value getCanvasWidth() const;
|
||||
Value getCanvasHeight() const;
|
||||
Value getBackgroundColour() const;
|
||||
|
||||
void createClassProperties (Array <PropertyComponent*>& props);
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ const String DrawableDocument::MarkerList::getNonexistentMarkerName (const Strin
|
|||
|
||||
const String DrawableDocument::getNonexistentMarkerName (const String& name)
|
||||
{
|
||||
String n (makeValidCppIdentifier (name, false, true, false));
|
||||
String n (CodeFormatting::makeValidIdentifier (name, false, true, false));
|
||||
int suffix = 2;
|
||||
|
||||
while (markersX->getMarkerNamed (n).isValid() || markersY->getMarkerNamed (n).isValid())
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ static bool fillInNewCppFileTemplate (const File& file, const Project::Item& ite
|
|||
.replace ("FILENAME", file.getFileName(), false)
|
||||
.replace ("DATE", Time::getCurrentTime().toString (true, true, true), false)
|
||||
.replace ("AUTHOR", SystemStats::getFullUserName(), false)
|
||||
.replace ("HEADERGUARD", makeHeaderGuardName (file), false);
|
||||
.replace ("HEADERGUARD", CodeFormatting::makeHeaderGuardName (file), false);
|
||||
|
||||
return overwriteFileWithNewDataIfDifferent (file, s);
|
||||
return FileUtils::overwriteFileWithNewDataIfDifferent (file, s);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ void Project::setMissingDefaultValues()
|
|||
if (! projectRoot.getChildWithName (Tags::exporters).isValid())
|
||||
createDefaultExporters();
|
||||
|
||||
const String sanitisedProjectName (makeValidCppIdentifier (getProjectName().toString(), false, true, false));
|
||||
const String sanitisedProjectName (CodeFormatting::makeValidIdentifier (getProjectName().toString(), false, true, false));
|
||||
|
||||
if (! projectRoot.hasProperty ("buildVST"))
|
||||
{
|
||||
|
|
@ -184,7 +184,7 @@ const String Project::saveDocument (const File& file)
|
|||
getJuceConfigFlags (flags);
|
||||
}
|
||||
|
||||
if (isJuceFolder (getLocalJuceFolder()))
|
||||
if (FileUtils::isJuceFolder (getLocalJuceFolder()))
|
||||
StoredSettings::getInstance()->setLastKnownJuceFolder (getLocalJuceFolder().getFullPathName());
|
||||
|
||||
StoredSettings::getInstance()->recentFiles.addFile (file);
|
||||
|
|
@ -310,7 +310,7 @@ const File Project::getLocalJuceFolder()
|
|||
{
|
||||
File f (resolveFilename (exp->getJuceFolder().toString()));
|
||||
|
||||
if (isJuceFolder (f))
|
||||
if (FileUtils::isJuceFolder (f))
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
Value getVersion() const { return getProjectValue ("version"); }
|
||||
Value getBundleIdentifier() const { return getProjectValue ("bundleIdentifier"); }
|
||||
void setBundleIdentifierToDefault() { getBundleIdentifier() = "com.yourcompany." + makeValidCppIdentifier (getProjectName().toString(), false, true, false); }
|
||||
void setBundleIdentifierToDefault() { getBundleIdentifier() = "com.yourcompany." + CodeFormatting::makeValidIdentifier (getProjectName().toString(), false, true, false); }
|
||||
|
||||
//==============================================================================
|
||||
enum JuceLinkage
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public:
|
|||
MemoryOutputStream mo;
|
||||
writeVC6Project (mo);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (getDSPFile(), mo))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (getDSPFile(), mo))
|
||||
return "Can't write to the VC project file: " + getDSPFile().getFullPathName();
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ public:
|
|||
MemoryOutputStream mo;
|
||||
writeDSWFile (mo);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (getDSWFile(), mo))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (getDSWFile(), mo))
|
||||
return "Can't write to the VC solution file: " + getDSWFile().getFullPathName();
|
||||
}
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ public:
|
|||
MemoryOutputStream mo;
|
||||
masterXml.writeToStream (mo, String::empty, false, true, "UTF-8", 10);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (getVCProjFile(), mo))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (getVCProjFile(), mo))
|
||||
return "Can't write to the VC project file: " + getVCProjFile().getFullPathName();
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ public:
|
|||
MemoryOutputStream mo;
|
||||
writeSolutionFile (mo);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (getSLNFile(), mo))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (getSLNFile(), mo))
|
||||
return "Can't write to the VC solution file: " + getSLNFile().getFullPathName();
|
||||
}
|
||||
}
|
||||
|
|
@ -352,8 +352,8 @@ private:
|
|||
{
|
||||
RelativePath rtasFolder (getRTASFolder().toString(), RelativePath::unknown);
|
||||
defines.add ("JucePlugin_WinBag_path="
|
||||
+ replaceCEscapeChars (rtasFolder.getChildFile ("WinBag")
|
||||
.toWindowsStyle().quoted()));
|
||||
+ CodeFormatting::addEscapeChars (rtasFolder.getChildFile ("WinBag")
|
||||
.toWindowsStyle().quoted()));
|
||||
}
|
||||
|
||||
defines.addArray (config.parsePreprocessorDefs());
|
||||
|
|
@ -424,8 +424,8 @@ private:
|
|||
const String binaryName (File::createLegalFileName (config.getTargetBinaryName().toString()));
|
||||
|
||||
xml.setAttribute ("Name", createConfigName (config));
|
||||
xml.setAttribute ("OutputDirectory", windowsStylePath (binariesPath));
|
||||
xml.setAttribute ("IntermediateDirectory", windowsStylePath (intermediatesPath));
|
||||
xml.setAttribute ("OutputDirectory", FileUtils::windowsStylePath (binariesPath));
|
||||
xml.setAttribute ("IntermediateDirectory", FileUtils::windowsStylePath (intermediatesPath));
|
||||
xml.setAttribute ("ConfigurationType", (project.isAudioPlugin() || project.isBrowserPlugin())
|
||||
? "2" : (project.isLibrary() ? "4" : "1"));
|
||||
xml.setAttribute ("UseOfMFC", "0");
|
||||
|
|
@ -457,7 +457,7 @@ private:
|
|||
midl->setAttribute ("MkTypLibCompatible", "true");
|
||||
midl->setAttribute ("SuppressStartupBanner", "true");
|
||||
midl->setAttribute ("TargetEnvironment", "1");
|
||||
midl->setAttribute ("TypeLibraryName", windowsStylePath (intermediatesPath + "/" + binaryName + ".tlb"));
|
||||
midl->setAttribute ("TypeLibraryName", FileUtils::windowsStylePath (intermediatesPath + "/" + binaryName + ".tlb"));
|
||||
midl->setAttribute ("HeaderFileName", "");
|
||||
}
|
||||
|
||||
|
|
@ -484,10 +484,10 @@ private:
|
|||
: (isDebug ? 1 : 0)); // MT static
|
||||
compiler->setAttribute ("RuntimeTypeInfo", "true");
|
||||
compiler->setAttribute ("UsePrecompiledHeader", "0");
|
||||
compiler->setAttribute ("PrecompiledHeaderFile", windowsStylePath (intermediatesPath + "/" + binaryName + ".pch"));
|
||||
compiler->setAttribute ("AssemblerListingLocation", windowsStylePath (intermediatesPath + "/"));
|
||||
compiler->setAttribute ("ObjectFile", windowsStylePath (intermediatesPath + "/"));
|
||||
compiler->setAttribute ("ProgramDataBaseFileName", windowsStylePath (intermediatesPath + "/"));
|
||||
compiler->setAttribute ("PrecompiledHeaderFile", FileUtils::windowsStylePath (intermediatesPath + "/" + binaryName + ".pch"));
|
||||
compiler->setAttribute ("AssemblerListingLocation", FileUtils::windowsStylePath (intermediatesPath + "/"));
|
||||
compiler->setAttribute ("ObjectFile", FileUtils::windowsStylePath (intermediatesPath + "/"));
|
||||
compiler->setAttribute ("ProgramDataBaseFileName", FileUtils::windowsStylePath (intermediatesPath + "/"));
|
||||
compiler->setAttribute ("WarningLevel", "3");
|
||||
compiler->setAttribute ("SuppressStartupBanner", "true");
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ private:
|
|||
{
|
||||
XmlElement* linker = createToolElement (xml, "VCLinkerTool");
|
||||
|
||||
linker->setAttribute ("OutputFile", windowsStylePath (binariesPath + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
|
||||
linker->setAttribute ("OutputFile", FileUtils::windowsStylePath (binariesPath + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
|
||||
linker->setAttribute ("SuppressStartupBanner", "true");
|
||||
|
||||
if (project.getJuceLinkageMode() == Project::useLinkedJuce)
|
||||
|
|
@ -516,7 +516,7 @@ private:
|
|||
|
||||
linker->setAttribute ("IgnoreDefaultLibraryNames", isDebug ? "libcmt.lib, msvcrt.lib" : "");
|
||||
linker->setAttribute ("GenerateDebugInformation", isDebug ? "true" : "false");
|
||||
linker->setAttribute ("ProgramDatabaseFile", windowsStylePath (intermediatesPath + "/" + binaryName + ".pdb"));
|
||||
linker->setAttribute ("ProgramDatabaseFile", FileUtils::windowsStylePath (intermediatesPath + "/" + binaryName + ".pdb"));
|
||||
linker->setAttribute ("SubSystem", project.isCommandLineApp() ? "1" : "2");
|
||||
|
||||
if (! isDebug)
|
||||
|
|
@ -546,7 +546,7 @@ private:
|
|||
{
|
||||
XmlElement* librarian = createToolElement (xml, "VCLibrarianTool");
|
||||
|
||||
librarian->setAttribute ("OutputFile", windowsStylePath (binariesPath + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
|
||||
librarian->setAttribute ("OutputFile", FileUtils::windowsStylePath (binariesPath + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
|
||||
librarian->setAttribute ("IgnoreDefaultLibraryNames", isDebug ? "libcmt.lib, msvcrt.lib" : "");
|
||||
}
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ private:
|
|||
{
|
||||
XmlElement* bscMake = createToolElement (xml, "VCBscMakeTool");
|
||||
bscMake->setAttribute ("SuppressStartupBanner", "true");
|
||||
bscMake->setAttribute ("OutputFile", windowsStylePath (intermediatesPath + "/" + binaryName + ".bsc"));
|
||||
bscMake->setAttribute ("OutputFile", FileUtils::windowsStylePath (intermediatesPath + "/" + binaryName + ".bsc"));
|
||||
}
|
||||
|
||||
createToolElement (xml, "VCFxCopTool");
|
||||
|
|
@ -683,7 +683,7 @@ private:
|
|||
targetList << "# Name \"" << configName << '"' << newLine;
|
||||
|
||||
const String binariesPath (getConfigTargetPath (config));
|
||||
const String targetBinary (windowsStylePath (binariesPath + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
|
||||
const String targetBinary (FileUtils::windowsStylePath (binariesPath + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
|
||||
const String optimisationFlag (((int) config.getOptimisationLevel().getValue() <= 1) ? "Od" : (config.getOptimisationLevel() == 2 ? "O2" : "O3"));
|
||||
const String defines (getPreprocessorDefs (config, " /D "));
|
||||
const bool isDebug = (bool) config.isDebug().getValue();
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public:
|
|||
writeMakefile (mo, files);
|
||||
|
||||
const File makefile (getTargetFolder().getChildFile ("Makefile"));
|
||||
if (! overwriteFileWithNewDataIfDifferent (makefile, mo))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (makefile, mo))
|
||||
return "Can't write to the Makefile: " + makefile.getFullPathName();
|
||||
|
||||
return String::empty;
|
||||
|
|
@ -151,7 +151,7 @@ private:
|
|||
headerPaths.insert (0, "/usr/include");
|
||||
|
||||
for (int i = 0; i < headerPaths.size(); ++i)
|
||||
out << " -I " << unixStylePath (headerPaths[i]).quoted();
|
||||
out << " -I " << FileUtils::unixStylePath (headerPaths[i]).quoted();
|
||||
}
|
||||
|
||||
void writeCppFlags (OutputStream& out, const Project::BuildConfiguration& config)
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public:
|
|||
MemoryOutputStream mo;
|
||||
writeProjectFile (mo);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (projectFile, mo))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (projectFile, mo))
|
||||
return "Can't write to file: " + projectFile.getFullPathName();
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ private:
|
|||
MemoryOutputStream mo;
|
||||
plist.writeToStream (mo, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
|
||||
|
||||
return overwriteFileWithNewDataIfDifferent (infoPlistFile, mo);
|
||||
return FileUtils::overwriteFileWithNewDataIfDifferent (infoPlistFile, mo);
|
||||
}
|
||||
|
||||
const StringArray getHeaderSearchPaths (const Project::BuildConfiguration& config)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int
|
|||
File juceFolder (StoredSettings::getInstance()->getLastKnownJuceFolder());
|
||||
File target (exp->getTargetFolder());
|
||||
|
||||
if (shouldPathsBeRelative (juceFolder.getFullPathName(), project.getFile().getFullPathName()))
|
||||
if (FileUtils::shouldPathsBeRelative (juceFolder.getFullPathName(), project.getFile().getFullPathName()))
|
||||
exp->getJuceFolder() = juceFolder.getRelativePathFrom (project.getFile().getParentDirectory());
|
||||
else
|
||||
exp->getJuceFolder() = juceFolder.getFullPathName();
|
||||
|
|
@ -121,7 +121,7 @@ const String ProjectExporter::getIncludePathForFileInJuceFolder (const String& p
|
|||
|
||||
if (juceFolderPath.startsWithChar ('<'))
|
||||
{
|
||||
juceFolderPath = unixStylePath (File::addTrailingSeparator (juceFolderPath.substring (1).dropLastCharacters(1)));
|
||||
juceFolderPath = FileUtils::unixStylePath (File::addTrailingSeparator (juceFolderPath.substring (1).dropLastCharacters(1)));
|
||||
if (juceFolderPath == "/")
|
||||
juceFolderPath = String::empty;
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ private:
|
|||
MemoryOutputStream mo;
|
||||
xml->writeToStream (mo, String::empty);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (projectFile, mo))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (projectFile, mo))
|
||||
errors.add ("Couldn't write to the target file!");
|
||||
}
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ private:
|
|||
<< newLine
|
||||
<< "*/"
|
||||
<< newLine << newLine
|
||||
<< createIncludeStatement (appConfigFile, appConfigFile) << newLine;
|
||||
<< CodeFormatting::createIncludeStatement (appConfigFile, appConfigFile) << newLine;
|
||||
|
||||
if (fileNumber == 0)
|
||||
writeInclude (out, project.isUsingFullyAmalgamatedFile() ? "juce_amalgamated.cpp"
|
||||
|
|
@ -216,7 +216,7 @@ private:
|
|||
<< "#define " << headerGuard << newLine << newLine;
|
||||
|
||||
if (hasAppConfigFile)
|
||||
out << createIncludeStatement (appConfigFile, appConfigFile) << newLine;
|
||||
out << CodeFormatting::createIncludeStatement (appConfigFile, appConfigFile) << newLine;
|
||||
|
||||
if (project.getJuceLinkageMode() != Project::notLinkedToJuce)
|
||||
{
|
||||
|
|
@ -228,13 +228,13 @@ private:
|
|||
}
|
||||
|
||||
if (binaryDataCpp.exists())
|
||||
out << createIncludeStatement (binaryDataCpp.withFileExtension (".h"), appConfigFile) << newLine;
|
||||
out << CodeFormatting::createIncludeStatement (binaryDataCpp.withFileExtension (".h"), appConfigFile) << newLine;
|
||||
|
||||
out << newLine
|
||||
<< "namespace ProjectInfo" << newLine
|
||||
<< "{" << newLine
|
||||
<< " const char* const projectName = " << replaceCEscapeChars (project.getProjectName().toString()).quoted() << ";" << newLine
|
||||
<< " const char* const versionString = " << replaceCEscapeChars (project.getVersion().toString()).quoted() << ";" << newLine
|
||||
<< " const char* const projectName = " << CodeFormatting::addEscapeChars (project.getProjectName().toString()).quoted() << ";" << newLine
|
||||
<< " const char* const versionString = " << CodeFormatting::addEscapeChars (project.getVersion().toString()).quoted() << ";" << newLine
|
||||
<< " const int versionNumber = " << createVersionCode (project.getVersion().toString()) << ";" << newLine
|
||||
<< "}" << newLine
|
||||
<< newLine
|
||||
|
|
@ -370,7 +370,7 @@ private:
|
|||
|
||||
bool replaceFileIfDifferent (const File& f, const MemoryOutputStream& newData)
|
||||
{
|
||||
if (! overwriteFileWithNewDataIfDifferent (f, newData))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (f, newData))
|
||||
{
|
||||
errors.add ("Can't write to file: " + f.getFullPathName());
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -79,30 +79,30 @@ public:
|
|||
for (int i = project.getNumConfigurations(); --i >= 0;)
|
||||
project.getConfiguration(i).getTargetBinaryName() = File::createLegalFileName (appTitle);
|
||||
|
||||
String appHeaders (createIncludeStatement (project.getAppIncludeFile(), mainCppFile));
|
||||
String appHeaders (CodeFormatting::createIncludeStatement (project.getAppIncludeFile(), mainCppFile));
|
||||
String initCode, shutdownCode, anotherInstanceStartedCode, privateMembers, memberInitialisers;
|
||||
|
||||
if (createWindow)
|
||||
{
|
||||
appHeaders << newLine << createIncludeStatement (mainWindowH, mainCppFile);
|
||||
appHeaders << newLine << CodeFormatting::createIncludeStatement (mainWindowH, mainCppFile);
|
||||
memberInitialisers = " : mainWindow (0)";
|
||||
initCode = "mainWindow = new " + windowClassName + "();";
|
||||
shutdownCode = "deleteAndZero (mainWindow);";
|
||||
privateMembers = windowClassName + "* mainWindow;";
|
||||
|
||||
String windowH = project.getFileTemplate ("jucer_WindowTemplate_h")
|
||||
.replace ("INCLUDES", createIncludeStatement (project.getAppIncludeFile(), mainWindowH), false)
|
||||
.replace ("INCLUDES", CodeFormatting::createIncludeStatement (project.getAppIncludeFile(), mainWindowH), false)
|
||||
.replace ("WINDOWCLASS", windowClassName, false)
|
||||
.replace ("HEADERGUARD", makeHeaderGuardName (mainWindowH), false);
|
||||
.replace ("HEADERGUARD", CodeFormatting::makeHeaderGuardName (mainWindowH), false);
|
||||
|
||||
String windowCpp = project.getFileTemplate ("jucer_WindowTemplate_cpp")
|
||||
.replace ("INCLUDES", createIncludeStatement (mainWindowH, mainWindowCpp), false)
|
||||
.replace ("INCLUDES", CodeFormatting::createIncludeStatement (mainWindowH, mainWindowCpp), false)
|
||||
.replace ("WINDOWCLASS", windowClassName, false);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (mainWindowH, windowH))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (mainWindowH, windowH))
|
||||
failedFiles.add (mainWindowH.getFullPathName());
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (mainWindowCpp, windowCpp))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (mainWindowCpp, windowCpp))
|
||||
failedFiles.add (mainWindowCpp.getFullPathName());
|
||||
|
||||
group.addFile (mainWindowCpp, -1);
|
||||
|
|
@ -113,17 +113,17 @@ public:
|
|||
{
|
||||
String mainCpp = project.getFileTemplate ("jucer_MainTemplate_cpp")
|
||||
.replace ("APPHEADERS", appHeaders, false)
|
||||
.replace ("APPCLASSNAME", makeValidCppIdentifier (appTitle + "Application", false, true, false), false)
|
||||
.replace ("APPCLASSNAME", CodeFormatting::makeValidIdentifier (appTitle + "Application", false, true, false), false)
|
||||
.replace ("MEMBERINITIALISERS", memberInitialisers, false)
|
||||
.replace ("APPINITCODE", initCode, false)
|
||||
.replace ("APPSHUTDOWNCODE", shutdownCode, false)
|
||||
.replace ("APPNAME", replaceCEscapeChars (appTitle), false)
|
||||
.replace ("APPNAME", CodeFormatting::addEscapeChars (appTitle), false)
|
||||
.replace ("APPVERSION", "1.0", false)
|
||||
.replace ("ALLOWMORETHANONEINSTANCE", "true", false)
|
||||
.replace ("ANOTHERINSTANCECODE", anotherInstanceStartedCode, false)
|
||||
.replace ("PRIVATEMEMBERS", privateMembers, false);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp))
|
||||
failedFiles.add (mainCppFile.getFullPathName());
|
||||
|
||||
group.addFile (mainCppFile, -1);
|
||||
|
|
@ -186,12 +186,12 @@ public:
|
|||
|
||||
if (createMainCpp)
|
||||
{
|
||||
String appHeaders (createIncludeStatement (project.getAppIncludeFile(), mainCppFile));
|
||||
String appHeaders (CodeFormatting::createIncludeStatement (project.getAppIncludeFile(), mainCppFile));
|
||||
|
||||
String mainCpp = project.getFileTemplate ("jucer_MainConsoleAppTemplate_cpp")
|
||||
.replace ("APPHEADERS", appHeaders, false);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp))
|
||||
failedFiles.add (mainCppFile.getFullPathName());
|
||||
|
||||
group.addFile (mainCppFile, -1);
|
||||
|
|
@ -228,7 +228,7 @@ public:
|
|||
if (! getSourceFilesFolder().createDirectory())
|
||||
failedFiles.add (getSourceFilesFolder().getFullPathName());
|
||||
|
||||
String filterClassName = makeValidCppIdentifier (appTitle, true, true, false) + "AudioProcessor";
|
||||
String filterClassName = CodeFormatting::makeValidIdentifier (appTitle, true, true, false) + "AudioProcessor";
|
||||
filterClassName = filterClassName.substring (0, 1).toUpperCase() + filterClassName.substring (1);
|
||||
String editorClassName = filterClassName + "Editor";
|
||||
|
||||
|
|
@ -247,42 +247,42 @@ public:
|
|||
for (int i = project.getNumConfigurations(); --i >= 0;)
|
||||
project.getConfiguration(i).getTargetBinaryName() = File::createLegalFileName (appTitle);
|
||||
|
||||
String appHeaders (createIncludeStatement (project.getAppIncludeFile(), filterCppFile));
|
||||
appHeaders << newLine << createIncludeStatement (project.getPluginCharacteristicsFile(), filterCppFile);
|
||||
String appHeaders (CodeFormatting::createIncludeStatement (project.getAppIncludeFile(), filterCppFile));
|
||||
appHeaders << newLine << CodeFormatting::createIncludeStatement (project.getPluginCharacteristicsFile(), filterCppFile);
|
||||
|
||||
String filterCpp = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_cpp")
|
||||
.replace ("FILTERHEADERS", createIncludeStatement (filterHFile, filterCppFile)
|
||||
+ newLine + createIncludeStatement (editorHFile, filterCppFile), false)
|
||||
.replace ("FILTERHEADERS", CodeFormatting::createIncludeStatement (filterHFile, filterCppFile)
|
||||
+ newLine + CodeFormatting::createIncludeStatement (editorHFile, filterCppFile), false)
|
||||
.replace ("FILTERCLASSNAME", filterClassName, false)
|
||||
.replace ("EDITORCLASSNAME", editorClassName, false);
|
||||
|
||||
String filterH = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_h")
|
||||
.replace ("APPHEADERS", appHeaders, false)
|
||||
.replace ("FILTERCLASSNAME", filterClassName, false)
|
||||
.replace ("HEADERGUARD", makeHeaderGuardName (filterHFile), false);
|
||||
.replace ("HEADERGUARD", CodeFormatting::makeHeaderGuardName (filterHFile), false);
|
||||
|
||||
String editorCpp = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_cpp")
|
||||
.replace ("EDITORCPPHEADERS", createIncludeStatement (filterHFile, filterCppFile)
|
||||
+ newLine + createIncludeStatement (editorHFile, filterCppFile), false)
|
||||
.replace ("EDITORCPPHEADERS", CodeFormatting::createIncludeStatement (filterHFile, filterCppFile)
|
||||
+ newLine + CodeFormatting::createIncludeStatement (editorHFile, filterCppFile), false)
|
||||
.replace ("FILTERCLASSNAME", filterClassName, false)
|
||||
.replace ("EDITORCLASSNAME", editorClassName, false);
|
||||
|
||||
String editorH = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_h")
|
||||
.replace ("EDITORHEADERS", appHeaders + newLine + createIncludeStatement (filterHFile, filterCppFile), false)
|
||||
.replace ("EDITORHEADERS", appHeaders + newLine + CodeFormatting::createIncludeStatement (filterHFile, filterCppFile), false)
|
||||
.replace ("FILTERCLASSNAME", filterClassName, false)
|
||||
.replace ("EDITORCLASSNAME", editorClassName, false)
|
||||
.replace ("HEADERGUARD", makeHeaderGuardName (editorHFile), false);
|
||||
.replace ("HEADERGUARD", CodeFormatting::makeHeaderGuardName (editorHFile), false);
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (filterCppFile, filterCpp))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (filterCppFile, filterCpp))
|
||||
failedFiles.add (filterCppFile.getFullPathName());
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (filterHFile, filterH))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (filterHFile, filterH))
|
||||
failedFiles.add (filterHFile.getFullPathName());
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (editorCppFile, editorCpp))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (editorCppFile, editorCpp))
|
||||
failedFiles.add (editorCppFile.getFullPathName());
|
||||
|
||||
if (! overwriteFileWithNewDataIfDifferent (editorHFile, editorH))
|
||||
if (! FileUtils::overwriteFileWithNewDataIfDifferent (editorHFile, editorH))
|
||||
failedFiles.add (editorHFile.getFullPathName());
|
||||
|
||||
group.addFile (filterCppFile, -1);
|
||||
|
|
@ -381,7 +381,7 @@ Project* ProjectWizard::runWizard (Component* ownerWindow_)
|
|||
failedFiles.add (newProjectFolder.getFullPathName());
|
||||
}
|
||||
|
||||
if (containsAnyNonHiddenFiles (newProjectFolder))
|
||||
if (FileUtils::containsAnyNonHiddenFiles (newProjectFolder))
|
||||
{
|
||||
if (! AlertWindow::showOkCancelBox (AlertWindow::InfoIcon, "New Juce Project",
|
||||
"The folder you chose isn't empty - are you sure you want to create the project there?\n\nAny existing files with the same names may be overwritten by the new files."))
|
||||
|
|
@ -480,7 +480,7 @@ Project* ProjectWizard::runNewProjectWizard (Component* ownerWindow)
|
|||
if (aw.runModalLoop() == 0)
|
||||
return 0;
|
||||
|
||||
if (isJuceFolder (juceFolderSelector.getCurrentFile()))
|
||||
if (FileUtils::isJuceFolder (juceFolderSelector.getCurrentFile()))
|
||||
{
|
||||
wizard = createWizard (aw.getComboBoxComponent ("type")->getSelectedItemIndex());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -100,83 +100,6 @@ int64 ResourceFile::getTotalDataSize() const
|
|||
return total;
|
||||
}
|
||||
|
||||
static void writeCppData (InputStream& in, OutputStream& out)
|
||||
{
|
||||
const int maxCharsOnLine = 250;
|
||||
|
||||
MemoryBlock mb;
|
||||
in.readIntoMemoryBlock (mb);
|
||||
const unsigned char* data = (const unsigned char*) mb.getData();
|
||||
int charsOnLine = 0;
|
||||
|
||||
bool canUseStringLiteral = mb.getSize() < 65535; // MS compilers can't handle strings bigger than 65536 chars..
|
||||
|
||||
if (canUseStringLiteral)
|
||||
{
|
||||
for (size_t i = 0; i < mb.getSize(); ++i)
|
||||
{
|
||||
const unsigned int num = (unsigned int) data[i];
|
||||
if (! ((num >= 32 && num < 127) || num == '\t' || num == '\r' || num == '\n'))
|
||||
{
|
||||
canUseStringLiteral = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! canUseStringLiteral)
|
||||
{
|
||||
out << "{ ";
|
||||
|
||||
for (size_t i = 0; i < mb.getSize(); ++i)
|
||||
{
|
||||
const int num = (int) (unsigned int) data[i];
|
||||
out << num << ',';
|
||||
|
||||
charsOnLine += 2;
|
||||
if (num >= 10)
|
||||
++charsOnLine;
|
||||
if (num >= 100)
|
||||
++charsOnLine;
|
||||
|
||||
if (charsOnLine >= maxCharsOnLine)
|
||||
{
|
||||
charsOnLine = 0;
|
||||
out << newLine;
|
||||
}
|
||||
}
|
||||
|
||||
out << "0,0 };";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "\"";
|
||||
|
||||
for (size_t i = 0; i < mb.getSize(); ++i)
|
||||
{
|
||||
const unsigned int num = (unsigned int) data[i];
|
||||
|
||||
switch (num)
|
||||
{
|
||||
case '\t': out << "\\t"; break;
|
||||
case '\r': out << "\\r"; break;
|
||||
case '\n': out << "\\n"; charsOnLine = maxCharsOnLine; break;
|
||||
case '"': out << "\\\""; break;
|
||||
case '\\': out << "\\\\"; break;
|
||||
default: out << (char) num; break;
|
||||
}
|
||||
|
||||
if (++charsOnLine >= maxCharsOnLine && i < mb.getSize() - 1)
|
||||
{
|
||||
charsOnLine = 0;
|
||||
out << "\"" << newLine << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
out << "\";";
|
||||
}
|
||||
}
|
||||
|
||||
static int calcResourceHashCode (const String& s)
|
||||
{
|
||||
const char* t = s.toUTF8();
|
||||
|
|
@ -202,7 +125,7 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream&
|
|||
<< comment;
|
||||
|
||||
if (juceHeader.exists())
|
||||
header << createIncludeStatement (juceHeader, cppFile) << newLine;
|
||||
header << CodeFormatting::createIncludeStatement (juceHeader, cppFile) << newLine;
|
||||
|
||||
const String namespaceName (className);
|
||||
StringArray variableNames;
|
||||
|
|
@ -210,10 +133,10 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream&
|
|||
int i;
|
||||
for (i = 0; i < files.size(); ++i)
|
||||
{
|
||||
String variableNameRoot (makeValidCppIdentifier (files.getUnchecked(i)->getFileName()
|
||||
.replaceCharacters (" .", "__")
|
||||
.retainCharacters ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"),
|
||||
false, true, false));
|
||||
String variableNameRoot (CodeFormatting::makeValidIdentifier (files.getUnchecked(i)->getFileName()
|
||||
.replaceCharacters (" .", "__")
|
||||
.retainCharacters ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"),
|
||||
false, true, false));
|
||||
String variableName (variableNameRoot);
|
||||
|
||||
int suffix = 2;
|
||||
|
|
@ -223,7 +146,7 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream&
|
|||
variableNames.add (variableName);
|
||||
}
|
||||
|
||||
cpp << createIncludeStatement (cppFile.withFileExtension (".h"), cppFile) << newLine
|
||||
cpp << CodeFormatting::createIncludeStatement (cppFile.withFileExtension (".h"), cppFile) << newLine
|
||||
<< newLine
|
||||
<< newLine
|
||||
<< "const char* " << namespaceName << "::getNamedResource (const char* resourceNameUTF8, int& numBytes) throw()" << newLine
|
||||
|
|
@ -273,7 +196,11 @@ bool ResourceFile::write (const File& cppFile, OutputStream& cpp, OutputStream&
|
|||
<< "static const unsigned char " << tempVariable
|
||||
<< "[] =" << newLine;
|
||||
|
||||
writeCppData (*fileStream, cpp);
|
||||
{
|
||||
MemoryBlock data;
|
||||
fileStream->readIntoMemoryBlock (data);
|
||||
CodeFormatting::writeDataAsCppLiteral (data, cpp);
|
||||
}
|
||||
|
||||
cpp << newLine << newLine
|
||||
<< "const char* " << namespaceName << "::" << variableName << " = (const char*) "
|
||||
|
|
@ -304,8 +231,8 @@ bool ResourceFile::write (const File& cppFile)
|
|||
cppOut = 0;
|
||||
hppOut = 0;
|
||||
|
||||
return (areFilesIdentical (tempCpp.getFile(), tempCpp.getTargetFile()) || tempCpp.overwriteTargetFileWithTemporary())
|
||||
&& (areFilesIdentical (tempH.getFile(), tempH.getTargetFile()) || tempH.overwriteTargetFileWithTemporary());
|
||||
return (FileUtils::areFilesIdentical (tempCpp.getFile(), tempCpp.getTargetFile()) || tempCpp.overwriteTargetFileWithTemporary())
|
||||
&& (FileUtils::areFilesIdentical (tempH.getFile(), tempH.getTargetFile()) || tempH.overwriteTargetFileWithTemporary());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,15 @@
|
|||
//[MiscUserDefs] You can add your own user definitions and misc code here...
|
||||
//[/MiscUserDefs]
|
||||
|
||||
extern const unsigned char %%className%%_ComponentStateData[];
|
||||
|
||||
//==============================================================================
|
||||
%%className%%::%%className%% (%%constructorParams%%)
|
||||
%%initialisers%%{
|
||||
componentState = ValueTree::readFromData (%%className%%_ComponentStateData, %%statedatasize%%);
|
||||
jassert (componentState.isValid());
|
||||
const ValueTree componentStateList (componentState.getChildByName ("COMPONENTS"));
|
||||
|
||||
%%constructor%%
|
||||
|
||||
//[Constructor] You can add your own custom stuff here..
|
||||
|
|
@ -52,6 +58,10 @@
|
|||
|
||||
%%staticMemberDefinitions%%
|
||||
|
||||
//==============================================================================
|
||||
/* This data contains the ValueTree that holds all the Jucer-generated settings for the components */
|
||||
const unsigned char %%className%%_ComponentStateData[] = %%statedata%%;
|
||||
|
||||
//==============================================================================
|
||||
//======================= Jucer Information Section ==========================
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ private:
|
|||
%%privateMemberDeclarations%%
|
||||
|
||||
//==============================================================================
|
||||
ValueTree componentState;
|
||||
|
||||
// (prevent copy constructor and operator= being generated..)
|
||||
%%className%% (const %%className%%&);
|
||||
%%className%%& operator= (const %%className%%&);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
Component* createComponentHolder()
|
||||
{
|
||||
return new ComponentHolder();
|
||||
return new ComponentHolder (getDocument().getBackgroundColour());
|
||||
}
|
||||
|
||||
void updateComponents()
|
||||
|
|
@ -222,24 +222,55 @@ private:
|
|||
//==============================================================================
|
||||
ComponentEditor& editor;
|
||||
|
||||
class ComponentHolder : public Component
|
||||
class ComponentHolder : public Component,
|
||||
public Value::Listener
|
||||
{
|
||||
public:
|
||||
ComponentHolder()
|
||||
ComponentHolder (const Value& backgroundColour_)
|
||||
: backgroundColour (backgroundColour_)
|
||||
{
|
||||
setOpaque (true);
|
||||
updateColour();
|
||||
backgroundColour.addListener (this);
|
||||
}
|
||||
|
||||
~ComponentHolder()
|
||||
{
|
||||
}
|
||||
|
||||
void updateColour()
|
||||
{
|
||||
Colour newColour (Colours::white);
|
||||
|
||||
if (backgroundColour.toString().isNotEmpty())
|
||||
newColour = Colour::fromString (backgroundColour.toString());
|
||||
|
||||
if (newColour != colour)
|
||||
{
|
||||
colour = newColour;
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void paint (Graphics& g)
|
||||
{
|
||||
g.fillAll (Colours::white);
|
||||
if (colour.isOpaque())
|
||||
g.fillAll (colour);
|
||||
else
|
||||
g.fillCheckerBoard (0, 0, getWidth(), getHeight(), 24, 24,
|
||||
Colour (0xffeeeeee).overlaidWith (colour),
|
||||
Colour (0xffffffff).overlaidWith (colour));
|
||||
}
|
||||
};
|
||||
|
||||
void valueChanged (Value&)
|
||||
{
|
||||
updateColour();
|
||||
}
|
||||
|
||||
private:
|
||||
Value backgroundColour;
|
||||
Colour colour;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#ifndef __JUCER_COMPONENTEDITORTOOLBAR_H_6B5CA931__
|
||||
#define __JUCER_COMPONENTEDITORTOOLBAR_H_6B5CA931__
|
||||
|
||||
#include "../../utility/jucer_ColourEditorComponent.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class JucerToolbarButton : public ToolbarItemComponent
|
||||
|
|
@ -103,6 +105,25 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class BackgroundColourToolbarButton : public JucerToolbarButton
|
||||
{
|
||||
public:
|
||||
BackgroundColourToolbarButton (ComponentEditor& editor_, int itemId_)
|
||||
: JucerToolbarButton (editor_, itemId_, "background")
|
||||
{
|
||||
setTriggeredOnMouseDown (true);
|
||||
}
|
||||
|
||||
void clicked()
|
||||
{
|
||||
editor.getDocument().getUndoManager()->beginNewTransaction();
|
||||
PopupColourSelector::showAt (this, editor.getDocument().getBackgroundColour(), Colours::white, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class ComponentEditorToolbarFactory : public ToolbarItemFactory
|
||||
{
|
||||
|
|
@ -120,15 +141,17 @@ public:
|
|||
enum DemoToolbarItemIds
|
||||
{
|
||||
createComponent = 1,
|
||||
showInfo = 2,
|
||||
showComponentTree = 3,
|
||||
showOrHideMarkers = 4,
|
||||
toggleSnapping = 5
|
||||
changeBackground,
|
||||
showInfo,
|
||||
showComponentTree,
|
||||
showOrHideMarkers,
|
||||
toggleSnapping
|
||||
};
|
||||
|
||||
void getAllToolbarItemIds (Array <int>& ids)
|
||||
{
|
||||
ids.add (createComponent);
|
||||
ids.add (changeBackground);
|
||||
ids.add (showInfo);
|
||||
ids.add (showComponentTree);
|
||||
ids.add (showOrHideMarkers);
|
||||
|
|
@ -143,6 +166,7 @@ public:
|
|||
{
|
||||
ids.add (spacerId);
|
||||
ids.add (createComponent);
|
||||
ids.add (changeBackground);
|
||||
ids.add (flexibleSpacerId);
|
||||
ids.add (showOrHideMarkers);
|
||||
ids.add (toggleSnapping);
|
||||
|
|
@ -159,7 +183,8 @@ public:
|
|||
|
||||
switch (itemId)
|
||||
{
|
||||
case createComponent: name = "new"; return new NewComponentToolbarButton (editor, createComponent);
|
||||
case createComponent: return new NewComponentToolbarButton (editor, itemId);
|
||||
case changeBackground: return new BackgroundColourToolbarButton (editor, itemId);
|
||||
case showInfo: name = "info"; commandId = CommandIDs::showOrHideProperties; break;
|
||||
case showComponentTree: name = "tree"; commandId = CommandIDs::showOrHideTree; break;
|
||||
case showOrHideMarkers: name = "markers"; commandId = CommandIDs::showOrHideMarkers; break;
|
||||
|
|
|
|||
|
|
@ -655,8 +655,8 @@ public:
|
|||
{
|
||||
const Rectangle<int> content (getContentArea());
|
||||
|
||||
// g.setColour (Colour::greyLevel (0.7f).withAlpha (0.4f));
|
||||
// g.drawRect (content.expanded (resizerThickness, resizerThickness), resizerThickness);
|
||||
g.setColour (Colour::greyLevel (0.1f).withAlpha (0.3f));
|
||||
g.drawRect (content.expanded (1, 1), 1);
|
||||
|
||||
const int bottomGap = getHeight() - content.getBottom();
|
||||
g.setFont (bottomGap - 5.0f);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
tree->setRootItemVisible (true);
|
||||
tree->setMultiSelectEnabled (true);
|
||||
tree->setDefaultOpenness (true);
|
||||
tree->setColour (TreeView::backgroundColourId, Colours::white);
|
||||
tree->setColour (TreeView::backgroundColourId, Colour::greyLevel (0.92f));
|
||||
tree->setIndentSize (15);
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ private:
|
|||
PropertyPanel* props;
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class CanvasViewport : public Viewport
|
||||
{
|
||||
public:
|
||||
|
|
@ -202,6 +202,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
Toolbar* toolbar;
|
||||
Viewport* viewport;
|
||||
InfoPanel* infoPanel;
|
||||
|
|
|
|||
|
|
@ -27,13 +27,121 @@
|
|||
#define __JUCER_COLOUREDITORCOMPONENT_JUCEHEADER__
|
||||
|
||||
|
||||
//==============================================================================
|
||||
class PopupColourSelector : public Component,
|
||||
public ChangeListener,
|
||||
public Value::Listener,
|
||||
public ButtonListener
|
||||
{
|
||||
public:
|
||||
PopupColourSelector (const Value& colourValue_,
|
||||
const Colour& defaultColour_,
|
||||
const bool canResetToDefault)
|
||||
: defaultButton ("Reset to Default"),
|
||||
colourValue (colourValue_),
|
||||
defaultColour (defaultColour_)
|
||||
{
|
||||
addAndMakeVisible (&selector);
|
||||
selector.setName ("Colour");
|
||||
selector.setCurrentColour (getColour());
|
||||
selector.addChangeListener (this);
|
||||
|
||||
if (canResetToDefault)
|
||||
{
|
||||
addAndMakeVisible (&defaultButton);
|
||||
defaultButton.addButtonListener (this);
|
||||
}
|
||||
|
||||
colourValue.addListener (this);
|
||||
}
|
||||
|
||||
~PopupColourSelector()
|
||||
{
|
||||
}
|
||||
|
||||
static void showAt (Component* comp, const Value& colourValue,
|
||||
const Colour& defaultColour, const bool canResetToDefault)
|
||||
{
|
||||
PopupColourSelector colourSelector (colourValue, defaultColour, canResetToDefault);
|
||||
|
||||
PopupMenu m;
|
||||
m.addCustomItem (1234, &colourSelector, 300, 400, false);
|
||||
m.showAt (comp);
|
||||
}
|
||||
|
||||
void resized()
|
||||
{
|
||||
if (defaultButton.isVisible())
|
||||
{
|
||||
selector.setBounds (0, 0, getWidth(), getHeight() - 30);
|
||||
defaultButton.changeWidthToFitText (22);
|
||||
defaultButton.setTopLeftPosition (10, getHeight() - 26);
|
||||
}
|
||||
else
|
||||
{
|
||||
selector.setBounds (0, 0, getWidth(), getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
const Colour getColour() const
|
||||
{
|
||||
if (colourValue.toString().isEmpty())
|
||||
return defaultColour;
|
||||
|
||||
return Colour::fromString (colourValue.toString());
|
||||
}
|
||||
|
||||
void setColour (const Colour& newColour)
|
||||
{
|
||||
if (getColour() != newColour)
|
||||
{
|
||||
if (newColour == defaultColour && defaultButton.isVisible())
|
||||
colourValue = var::null;
|
||||
else
|
||||
colourValue = newColour.toDisplayString (true);
|
||||
}
|
||||
}
|
||||
|
||||
void buttonClicked (Button*)
|
||||
{
|
||||
setColour (defaultColour);
|
||||
selector.setCurrentColour (defaultColour);
|
||||
}
|
||||
|
||||
void changeListenerCallback (void* source)
|
||||
{
|
||||
if (selector.getCurrentColour() != getColour())
|
||||
setColour (selector.getCurrentColour());
|
||||
}
|
||||
|
||||
void valueChanged (Value&)
|
||||
{
|
||||
selector.setCurrentColour (getColour());
|
||||
}
|
||||
|
||||
private:
|
||||
class ColourSelectorWithSwatches : public ColourSelector
|
||||
{
|
||||
public:
|
||||
ColourSelectorWithSwatches() {}
|
||||
|
||||
int getNumSwatches() const { return StoredSettings::getInstance()->swatchColours.size(); }
|
||||
const Colour getSwatchColour (int index) const { return StoredSettings::getInstance()->swatchColours [index]; }
|
||||
void setSwatchColour (int index, const Colour& newColour) const { StoredSettings::getInstance()->swatchColours.set (index, newColour); }
|
||||
};
|
||||
|
||||
ColourSelectorWithSwatches selector;
|
||||
TextButton defaultButton;
|
||||
Value colourValue;
|
||||
Colour defaultColour;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A component that shows a colour swatch with hex ARGB value, and which pops up
|
||||
a colour selector when you click it.
|
||||
*/
|
||||
class ColourEditorComponent : public Component,
|
||||
public ChangeListener,
|
||||
public Value::Listener
|
||||
{
|
||||
public:
|
||||
|
|
@ -47,7 +155,6 @@ public:
|
|||
|
||||
~ColourEditorComponent()
|
||||
{
|
||||
colourValue.removeListener (this);
|
||||
}
|
||||
|
||||
void paint (Graphics& g)
|
||||
|
|
@ -80,7 +187,7 @@ public:
|
|||
if (getColour() != newColour)
|
||||
{
|
||||
if (newColour == defaultColour && canResetToDefault)
|
||||
colourValue = var();
|
||||
colourValue = var::null;
|
||||
else
|
||||
colourValue = newColour.toDisplayString (true);
|
||||
}
|
||||
|
|
@ -105,19 +212,7 @@ public:
|
|||
void mouseDown (const MouseEvent& e)
|
||||
{
|
||||
document.getUndoManager()->beginNewTransaction();
|
||||
|
||||
SafePointer<Component> deletionChecker (this);
|
||||
|
||||
{
|
||||
ColourSelectorComp colourSelector (this, canResetToDefault);
|
||||
|
||||
PopupMenu m;
|
||||
m.addCustomItem (1234, &colourSelector, 300, 400, false);
|
||||
m.showAt (this);
|
||||
|
||||
if (deletionChecker == 0)
|
||||
return;
|
||||
}
|
||||
PopupColourSelector::showAt (this, colourValue, defaultColour, canResetToDefault);
|
||||
}
|
||||
|
||||
void valueChanged (Value&)
|
||||
|
|
@ -125,14 +220,6 @@ public:
|
|||
refresh();
|
||||
}
|
||||
|
||||
void changeListenerCallback (void* source)
|
||||
{
|
||||
ColourSelector* cs = static_cast <ColourSelector*> (source);
|
||||
|
||||
if (cs->getCurrentColour() != getColour())
|
||||
setColour (cs->getCurrentColour());
|
||||
}
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
|
|
@ -141,68 +228,6 @@ private:
|
|||
Colour lastColour;
|
||||
const Colour defaultColour;
|
||||
const bool canResetToDefault;
|
||||
|
||||
class ColourSelectorComp : public Component,
|
||||
public ButtonListener
|
||||
{
|
||||
public:
|
||||
ColourSelectorComp (ColourEditorComponent* owner_,
|
||||
const bool canResetToDefault)
|
||||
: owner (owner_),
|
||||
defaultButton ("Reset to Default")
|
||||
{
|
||||
addAndMakeVisible (&selector);
|
||||
selector.setName ("Colour");
|
||||
selector.setCurrentColour (owner->getColour());
|
||||
selector.addChangeListener (owner);
|
||||
|
||||
if (canResetToDefault)
|
||||
{
|
||||
addAndMakeVisible (&defaultButton);
|
||||
defaultButton.addButtonListener (this);
|
||||
}
|
||||
}
|
||||
|
||||
~ColourSelectorComp()
|
||||
{
|
||||
}
|
||||
|
||||
void resized()
|
||||
{
|
||||
if (defaultButton.isVisible())
|
||||
{
|
||||
selector.setBounds (0, 0, getWidth(), getHeight() - 30);
|
||||
defaultButton.changeWidthToFitText (22);
|
||||
defaultButton.setTopLeftPosition (10, getHeight() - 26);
|
||||
}
|
||||
else
|
||||
{
|
||||
selector.setBounds (0, 0, getWidth(), getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void buttonClicked (Button*)
|
||||
{
|
||||
owner->resetToDefault();
|
||||
owner->refresh();
|
||||
selector.setCurrentColour (owner->getColour());
|
||||
}
|
||||
|
||||
private:
|
||||
class ColourSelectorWithSwatches : public ColourSelector
|
||||
{
|
||||
public:
|
||||
ColourSelectorWithSwatches() {}
|
||||
|
||||
int getNumSwatches() const { return StoredSettings::getInstance()->swatchColours.size(); }
|
||||
const Colour getSwatchColour (int index) const { return StoredSettings::getInstance()->swatchColours [index]; }
|
||||
void setSwatchColour (int index, const Colour& newColour) const { StoredSettings::getInstance()->swatchColours.set (index, newColour); }
|
||||
};
|
||||
|
||||
ColourEditorComponent* owner;
|
||||
ColourSelectorWithSwatches selector;
|
||||
TextButton defaultButton;
|
||||
};
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -338,13 +338,29 @@ void Coordinate::changeAnchor2 (const String& newMarkerName, const MarkerResolve
|
|||
moveToAbsolute (oldValue, markerResolver);
|
||||
}
|
||||
|
||||
void Coordinate::renameAnchorIfUsed (const String& oldName, const String& newName)
|
||||
void Coordinate::renameAnchorIfUsed (const String& oldName, const String& newName, const MarkerResolver& markerResolver)
|
||||
{
|
||||
if (anchor1.upToFirstOccurrenceOf (".", false, false) == oldName)
|
||||
anchor1 = newName + anchor1.fromFirstOccurrenceOf (".", true, false);
|
||||
jassert (oldName.isNotEmpty());
|
||||
|
||||
if (anchor2.upToFirstOccurrenceOf (".", false, false) == oldName)
|
||||
anchor2 = newName + anchor2.fromFirstOccurrenceOf (".", true, false);
|
||||
if (newName.isEmpty())
|
||||
{
|
||||
if (anchor1.upToFirstOccurrenceOf (".", false, false) == oldName
|
||||
|| anchor2.upToFirstOccurrenceOf (".", false, false) == oldName)
|
||||
{
|
||||
value = resolve (markerResolver);
|
||||
isProportion = false;
|
||||
anchor1 = String::empty;
|
||||
anchor2 = String::empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (anchor1.upToFirstOccurrenceOf (".", false, false) == oldName)
|
||||
anchor1 = newName + anchor1.fromFirstOccurrenceOf (".", true, false);
|
||||
|
||||
if (anchor2.upToFirstOccurrenceOf (".", false, false) == oldName)
|
||||
anchor2 = newName + anchor2.fromFirstOccurrenceOf (".", true, false);
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -396,10 +412,11 @@ const String RectangleCoordinates::toString() const
|
|||
return left.toString() + ", " + top.toString() + ", " + right.toString() + ", " + bottom.toString();
|
||||
}
|
||||
|
||||
void RectangleCoordinates::renameAnchorIfUsed (const String& oldName, const String& newName)
|
||||
void RectangleCoordinates::renameAnchorIfUsed (const String& oldName, const String& newName,
|
||||
const Coordinate::MarkerResolver& markerResolver)
|
||||
{
|
||||
left.renameAnchorIfUsed (oldName, newName);
|
||||
right.renameAnchorIfUsed (oldName, newName);
|
||||
top.renameAnchorIfUsed (oldName, newName);
|
||||
bottom.renameAnchorIfUsed (oldName, newName);
|
||||
left.renameAnchorIfUsed (oldName, newName, markerResolver);
|
||||
right.renameAnchorIfUsed (oldName, newName, markerResolver);
|
||||
top.renameAnchorIfUsed (oldName, newName, markerResolver);
|
||||
bottom.renameAnchorIfUsed (oldName, newName, markerResolver);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,8 +97,10 @@ public:
|
|||
const String getAnchor2() const { return checkName (anchor2); }
|
||||
void changeAnchor2 (const String& newMarkerName, const MarkerResolver& markerResolver);
|
||||
|
||||
// Tells the coord that an anchor is changing its name.
|
||||
void renameAnchorIfUsed (const String& oldName, const String& newName);
|
||||
/** Tells the coord that an anchor is changing its name.
|
||||
If the new name is empty, it removes the anchor.
|
||||
*/
|
||||
void renameAnchorIfUsed (const String& oldName, const String& newName, const MarkerResolver& markerResolver);
|
||||
|
||||
//==============================================================================
|
||||
/*
|
||||
|
|
@ -158,7 +160,8 @@ public:
|
|||
const String toString() const;
|
||||
|
||||
// Tells the coord that an anchor is changing its name.
|
||||
void renameAnchorIfUsed (const String& oldName, const String& newName);
|
||||
void renameAnchorIfUsed (const String& oldName, const String& newName,
|
||||
const Coordinate::MarkerResolver& markerResolver);
|
||||
|
||||
Coordinate left, right, top, bottom;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
{
|
||||
ValueTree v (getMarker (i));
|
||||
Coordinate coord (getCoordinate (v));
|
||||
coord.renameAnchorIfUsed (oldName, newName);
|
||||
coord.renameAnchorIfUsed (oldName, newName, *this);
|
||||
setCoordinate (v, coord);
|
||||
}
|
||||
}
|
||||
|
|
@ -70,7 +70,11 @@ public:
|
|||
group.addChild (marker, -1, getUndoManager());
|
||||
}
|
||||
|
||||
void deleteMarker (ValueTree& markerState) { group.removeChild (markerState, getUndoManager()); }
|
||||
void deleteMarker (ValueTree& markerState)
|
||||
{
|
||||
renameAnchor (getName (markerState), String::empty);
|
||||
group.removeChild (markerState, getUndoManager());
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
virtual UndoManager* getUndoManager() const = 0;
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public:
|
|||
|
||||
RootFolder getRoot() const { return root; }
|
||||
|
||||
const String toUnixStyle() const { return unixStylePath (path); }
|
||||
const String toWindowsStyle() const { return windowsStylePath (path); }
|
||||
const String toUnixStyle() const { return FileUtils::unixStylePath (path); }
|
||||
const String toWindowsStyle() const { return FileUtils::windowsStylePath (path); }
|
||||
|
||||
const String getFileName() const { return getFakeFile().getFileName(); }
|
||||
const String getFileNameWithoutExtension() const { return getFakeFile().getFileNameWithoutExtension(); }
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ void StoredSettings::setLastProject (const File& file)
|
|||
|
||||
const File StoredSettings::getLastKnownJuceFolder() const
|
||||
{
|
||||
File defaultJuceFolder (findDefaultJuceFolder());
|
||||
File defaultJuceFolder (FileUtils::findDefaultJuceFolder());
|
||||
File f (props->getValue ("lastJuceFolder", defaultJuceFolder.getFullPathName()));
|
||||
|
||||
if ((! isJuceFolder (f)) && isJuceFolder (defaultJuceFolder))
|
||||
if ((! FileUtils::isJuceFolder (f)) && FileUtils::isJuceFolder (defaultJuceFolder))
|
||||
f = defaultJuceFolder;
|
||||
|
||||
return f;
|
||||
|
|
@ -123,7 +123,7 @@ const File StoredSettings::getLastKnownJuceFolder() const
|
|||
|
||||
void StoredSettings::setLastKnownJuceFolder (const File& file)
|
||||
{
|
||||
jassert (isJuceFolder (file));
|
||||
jassert (FileUtils::isJuceFolder (file));
|
||||
props->setValue ("lastJuceFolder", file.getFullPathName());
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,15 +25,28 @@
|
|||
|
||||
|
||||
//==============================================================================
|
||||
int64 calculateStreamHashCode (InputStream& stream);
|
||||
int64 calculateFileHashCode (const File& file);
|
||||
bool areFilesIdentical (const File& file1, const File& file2);
|
||||
namespace FileUtils
|
||||
{
|
||||
int64 calculateStreamHashCode (InputStream& stream);
|
||||
int64 calculateFileHashCode (const File& file);
|
||||
bool areFilesIdentical (const File& file1, const File& file2);
|
||||
|
||||
bool overwriteFileWithNewDataIfDifferent (const File& file, const char* data, int numBytes);
|
||||
bool overwriteFileWithNewDataIfDifferent (const File& file, const MemoryOutputStream& newData);
|
||||
bool overwriteFileWithNewDataIfDifferent (const File& file, const String& newData);
|
||||
bool overwriteFileWithNewDataIfDifferent (const File& file, const char* data, int numBytes);
|
||||
bool overwriteFileWithNewDataIfDifferent (const File& file, const MemoryOutputStream& newData);
|
||||
bool overwriteFileWithNewDataIfDifferent (const File& file, const String& newData);
|
||||
|
||||
bool containsAnyNonHiddenFiles (const File& folder);
|
||||
bool containsAnyNonHiddenFiles (const File& folder);
|
||||
|
||||
const String unixStylePath (const String& path);
|
||||
const String windowsStylePath (const String& path);
|
||||
|
||||
bool shouldPathsBeRelative (String path1, String path2);
|
||||
|
||||
//==============================================================================
|
||||
bool isJuceFolder (const File& folder);
|
||||
const File findParentJuceFolder (const File& file);
|
||||
const File findDefaultJuceFolder();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// String::hashCode64 actually hit some dupes, so this is a more powerful version.
|
||||
|
|
@ -44,38 +57,7 @@ const String hexString8Digits (int value);
|
|||
const String createAlphaNumericUID();
|
||||
const String createGUID (const String& seed); // Turns a seed into a windows GUID
|
||||
|
||||
const String unixStylePath (const String& path);
|
||||
const String windowsStylePath (const String& path);
|
||||
|
||||
bool shouldPathsBeRelative (String path1, String path2);
|
||||
|
||||
//==============================================================================
|
||||
bool isJuceFolder (const File& folder);
|
||||
const File findParentJuceFolder (const File& file);
|
||||
const File findDefaultJuceFolder();
|
||||
|
||||
//==============================================================================
|
||||
const String createIncludeStatement (const File& includeFile, const File& targetFile);
|
||||
const String makeHeaderGuardName (const File& file);
|
||||
|
||||
const String replaceCEscapeChars (const String& s);
|
||||
|
||||
const String makeValidCppIdentifier (String s,
|
||||
const bool capitalise,
|
||||
const bool removeColons,
|
||||
const bool allowTemplates);
|
||||
|
||||
//==============================================================================
|
||||
const String boolToCode (const bool b);
|
||||
const String floatToCode (const float v);
|
||||
const String doubleToCode (const double v);
|
||||
const String colourToCode (const Colour& col);
|
||||
const String justificationToCode (const Justification& justification);
|
||||
const String castToFloat (const String& expression);
|
||||
|
||||
//==============================================================================
|
||||
const String indentCode (const String& code, const int numSpaces);
|
||||
|
||||
int indexOfLineStartingWith (const StringArray& lines, const String& text, int startIndex);
|
||||
|
||||
void autoScrollForMouseEvent (const MouseEvent& e);
|
||||
|
|
@ -83,20 +65,6 @@ void autoScrollForMouseEvent (const MouseEvent& e);
|
|||
void drawComponentPlaceholder (Graphics& g, int w, int h, const String& text);
|
||||
void drawRecessedShadows (Graphics& g, int w, int h, int shadowSize);
|
||||
|
||||
//==============================================================================
|
||||
const Font getFontFromState (const ValueTree& state,
|
||||
const var::identifier& fontName,
|
||||
const var::identifier& fontSize,
|
||||
const var::identifier& fontStyle);
|
||||
|
||||
void createFontProperties (Array <PropertyComponent*>& props, const ValueTree& state,
|
||||
const var::identifier& fontName,
|
||||
const var::identifier& fontSize,
|
||||
const var::identifier& fontStyle,
|
||||
UndoManager* undoManager);
|
||||
|
||||
PropertyComponent* createJustificationProperty (const String& name, const Value& value, bool onlyHorizontal);
|
||||
|
||||
//==============================================================================
|
||||
class FileModificationDetector
|
||||
{
|
||||
|
|
@ -113,14 +81,14 @@ public:
|
|||
{
|
||||
return fileModificationTime != file.getLastModificationTime()
|
||||
&& (fileSize != file.getSize()
|
||||
|| calculateFileHashCode (file) != fileHashCode);
|
||||
|| FileUtils::calculateFileHashCode (file) != fileHashCode);
|
||||
}
|
||||
|
||||
void updateHash()
|
||||
{
|
||||
fileModificationTime = file.getLastModificationTime();
|
||||
fileSize = file.getSize();
|
||||
fileHashCode = calculateFileHashCode (file);
|
||||
fileHashCode = FileUtils::calculateFileHashCode (file);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -129,6 +97,27 @@ private:
|
|||
int64 fileHashCode, fileSize;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
namespace CodeFormatting
|
||||
{
|
||||
const String indent (const String& code, const int numSpaces, bool indentFirstLine);
|
||||
const String makeValidIdentifier (String s, bool capitalise, bool removeColons, bool allowTemplates);
|
||||
const String addEscapeChars (const String& text);
|
||||
const String createIncludeStatement (const File& includeFile, const File& targetFile);
|
||||
const String makeHeaderGuardName (const File& file);
|
||||
|
||||
const String stringLiteral (const String& text);
|
||||
const String boolLiteral (bool b);
|
||||
const String floatLiteral (float v);
|
||||
const String doubleLiteral (double v);
|
||||
|
||||
const String colourToCode (const Colour& col);
|
||||
const String justificationToCode (const Justification& justification);
|
||||
const String castToFloat (const String& expression);
|
||||
|
||||
void writeDataAsCppLiteral (const MemoryBlock& data, OutputStream& out);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
class PropertyPanelWithTooltips : public Component,
|
||||
public Timer
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -587,7 +587,7 @@
|
|||
|
||||
@see jassertfalse
|
||||
*/
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse }
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse; }
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -598,7 +598,7 @@
|
|||
#define jassertfalse { juce_LogCurrentAssertion }
|
||||
|
||||
#if JUCE_LOG_ASSERTIONS
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse }
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse; }
|
||||
#else
|
||||
#define jassert(a) { }
|
||||
#endif
|
||||
|
|
@ -634,7 +634,7 @@
|
|||
}
|
||||
|
||||
#define JUCE_CATCH_ALL catch (...) {}
|
||||
#define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
|
||||
#define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse; }
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -3957,7 +3957,7 @@ public:
|
|||
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
@ -6713,7 +6713,7 @@ public:
|
|||
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
@ -9050,10 +9050,10 @@ public:
|
|||
explicit XmlElement (const String& tagName) throw();
|
||||
|
||||
/** Creates a (deep) copy of another element. */
|
||||
XmlElement (const XmlElement& other) throw();
|
||||
XmlElement (const XmlElement& other);
|
||||
|
||||
/** Creates a (deep) copy of another element. */
|
||||
XmlElement& operator= (const XmlElement& other) throw();
|
||||
XmlElement& operator= (const XmlElement& other);
|
||||
|
||||
/** Deleting an XmlElement will also delete all its child elements. */
|
||||
~XmlElement() throw();
|
||||
|
|
@ -9148,7 +9148,7 @@ public:
|
|||
|
||||
@see hasTagName
|
||||
*/
|
||||
inline const String& getTagName() const throw() { return tagName; }
|
||||
inline const String& getTagName() const throw() { return tagName; }
|
||||
|
||||
/** Tests whether this element has a particular tag name.
|
||||
|
||||
|
|
@ -9489,7 +9489,7 @@ public:
|
|||
*/
|
||||
template <class ElementComparator>
|
||||
void sortChildElements (ElementComparator& comparator,
|
||||
const bool retainOrderOfEquivalentItems = false) throw()
|
||||
bool retainOrderOfEquivalentItems = false)
|
||||
{
|
||||
const int num = getNumChildElements();
|
||||
|
||||
|
|
@ -9524,14 +9524,14 @@ public:
|
|||
|
||||
@see isTextElement, getAllSubText, getChildElementAllSubText
|
||||
*/
|
||||
const String getText() const throw();
|
||||
const String& getText() const throw();
|
||||
|
||||
/** Sets the text in a text element.
|
||||
|
||||
Note that this is only a valid call if this element is a text element. If it's
|
||||
not, then no action will be performed.
|
||||
*/
|
||||
void setText (const String& newText) throw();
|
||||
void setText (const String& newText);
|
||||
|
||||
/** Returns all the text from this element's child nodes.
|
||||
|
||||
|
|
@ -9543,7 +9543,7 @@ public:
|
|||
|
||||
@see isTextElement, getChildElementAllSubText, getText, addTextElement
|
||||
*/
|
||||
const String getAllSubText() const throw();
|
||||
const String getAllSubText() const;
|
||||
|
||||
/** Returns all the sub-text of a named child element.
|
||||
|
||||
|
|
@ -9554,13 +9554,13 @@ public:
|
|||
@see getAllSubText
|
||||
*/
|
||||
const String getChildElementAllSubText (const String& childTagName,
|
||||
const String& defaultReturnValue) const throw();
|
||||
const String& defaultReturnValue) const;
|
||||
|
||||
/** Appends a section of text to this element.
|
||||
|
||||
@see isTextElement, getText, getAllSubText
|
||||
*/
|
||||
void addTextElement (const String& text) throw();
|
||||
void addTextElement (const String& text);
|
||||
|
||||
/** Removes all the text elements from this element.
|
||||
|
||||
|
|
@ -9570,7 +9570,7 @@ public:
|
|||
|
||||
/** Creates a text element that can be added to a parent element.
|
||||
*/
|
||||
static XmlElement* createTextElement (const String& text) throw();
|
||||
static XmlElement* createTextElement (const String& text);
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
|
|
@ -9596,7 +9596,7 @@ private:
|
|||
XmlAttributeNode* attributes;
|
||||
|
||||
XmlElement (int) throw();
|
||||
void copyChildrenAndAttributesFrom (const XmlElement& other) throw();
|
||||
void copyChildrenAndAttributesFrom (const XmlElement& other);
|
||||
void writeElementAsText (OutputStream& out, int indentationLevel, int lineWrapLength) const;
|
||||
void getChildElementsAsArray (XmlElement**) const throw();
|
||||
void reorderChildElements (XmlElement** const, const int) throw();
|
||||
|
|
@ -10363,7 +10363,7 @@ public:
|
|||
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
@ -11071,7 +11071,7 @@ public:
|
|||
{
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
@ -13719,7 +13719,7 @@ public:
|
|||
|
||||
This is needed to avoid unicode problems with the argc type params.
|
||||
*/
|
||||
static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
|
||||
static const String JUCE_CALLTYPE getCurrentCommandLineParams();
|
||||
#endif
|
||||
|
||||
/** Clears the floating point unit's flags.
|
||||
|
|
@ -16549,14 +16549,14 @@ public:
|
|||
SubregionStream (InputStream* sourceStream,
|
||||
int64 startPositionInSourceStream,
|
||||
int64 lengthOfSourceStream,
|
||||
bool deleteSourceWhenDestroyed) throw();
|
||||
bool deleteSourceWhenDestroyed);
|
||||
|
||||
/** Destructor.
|
||||
|
||||
This may also delete the source stream, if that option was chosen when the
|
||||
buffered stream was created.
|
||||
*/
|
||||
~SubregionStream() throw();
|
||||
~SubregionStream();
|
||||
|
||||
int64 getTotalLength();
|
||||
int64 getPosition();
|
||||
|
|
@ -18830,17 +18830,20 @@ public:
|
|||
/** Copies this point from another one. */
|
||||
Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
|
||||
|
||||
/** Returns true if the point is (0, 0). */
|
||||
bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
|
||||
|
||||
/** Returns the point's x co-ordinate. */
|
||||
inline ValueType getX() const throw() { return x; }
|
||||
|
||||
/** Returns the point's y co-ordinate. */
|
||||
inline ValueType getY() const throw() { return y; }
|
||||
|
||||
inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
|
||||
inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
|
||||
/** Sets the point's x co-ordinate. */
|
||||
inline void setX (const ValueType newX) throw() { x = newX; }
|
||||
|
||||
/** Returns true if the point is (0, 0). */
|
||||
bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
|
||||
/** Sets the point's y co-ordinate. */
|
||||
inline void setY (const ValueType newY) throw() { y = newY; }
|
||||
|
||||
/** Returns a point which has the same Y position as this one, but a new X. */
|
||||
const Point withX (const ValueType newX) const throw() { return Point (newX, y); }
|
||||
|
|
@ -18854,6 +18857,9 @@ public:
|
|||
/** Adds a pair of co-ordinates to this value. */
|
||||
void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
|
||||
|
||||
inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
|
||||
inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
|
||||
|
||||
/** Adds two points together. */
|
||||
const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
|
||||
|
||||
|
|
@ -18900,6 +18906,9 @@ public:
|
|||
*/
|
||||
void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
|
||||
|
||||
/** Returns the position of this point, if it is transformed by a given AffineTransform. */
|
||||
const Point transformedBy (const AffineTransform& transform) const throw() { ValueType x2 (x), y2 (y); transform.transformPoint (x2, y2); return Point (x2, y2); }
|
||||
|
||||
/** Returns the point as a string in the form "x, y". */
|
||||
const String toString() const { return String (x) + ", " + String (y); }
|
||||
|
||||
|
|
@ -23022,14 +23031,10 @@ public:
|
|||
/** Returns true if all colours are completely transparent. */
|
||||
bool isInvisible() const throw();
|
||||
|
||||
float x1;
|
||||
float y1;
|
||||
|
||||
float x2;
|
||||
float y2;
|
||||
Point<float> point1, point2;
|
||||
|
||||
/** If true, the gradient should be filled circularly, centred around
|
||||
(x1, y1), with (x2, y2) defining a point on the circumference.
|
||||
point1, with point2 defining a point on the circumference.
|
||||
|
||||
If false, the gradient is linear between the two points.
|
||||
*/
|
||||
|
|
@ -23038,7 +23043,19 @@ public:
|
|||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
Array <uint32> colours;
|
||||
struct ColourPoint
|
||||
{
|
||||
ColourPoint() throw() {}
|
||||
|
||||
ColourPoint (uint32 position_, const Colour& colour_) throw()
|
||||
: position (position_), colour (colour_)
|
||||
{}
|
||||
|
||||
uint32 position;
|
||||
Colour colour;
|
||||
};
|
||||
|
||||
Array <ColourPoint> colours;
|
||||
};
|
||||
|
||||
#endif // __JUCE_COLOURGRADIENT_JUCEHEADER__
|
||||
|
|
@ -27252,7 +27269,7 @@ public:
|
|||
|
||||
@see isScreenSaverEnabled
|
||||
*/
|
||||
static void setScreenSaverEnabled (bool isEnabled) throw();
|
||||
static void setScreenSaverEnabled (bool isEnabled);
|
||||
|
||||
/** Returns true if the screensaver has not been turned off.
|
||||
|
||||
|
|
@ -27262,7 +27279,7 @@ public:
|
|||
|
||||
@see setScreenSaverEnabled
|
||||
*/
|
||||
static bool isScreenSaverEnabled() throw();
|
||||
static bool isScreenSaverEnabled();
|
||||
|
||||
/** Registers a MouseListener that will receive all mouse events that occur on
|
||||
any component.
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ void JUCEApplication::unhandledException (const std::exception*,
|
|||
const String&,
|
||||
const int)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
void JUCEApplication::sendUnhandledException (const std::exception* const e,
|
||||
|
|
@ -342,7 +342,7 @@ void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI()
|
|||
// Ended up here? If so, TURN ON RTTI in your compiler settings!! And if you
|
||||
// got as far as this catch statement, then why haven't you got exception catching
|
||||
// turned on in the debugger???
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ class AiffAudioFormatWriter : public AudioFormatWriter
|
|||
|
||||
if (sampleRate >= mask)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
sampleRateBytes[1] = 0x1d;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ void AudioFormatManager::registerFormat (AudioFormat* newFormat,
|
|||
{
|
||||
if (getKnownFormat (i)->getFormatName() == newFormat->getFormatName())
|
||||
{
|
||||
jassertfalse // trying to add the same format twice!
|
||||
jassertfalse; // trying to add the same format twice!
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ AudioFormatWriter* QuickTimeAudioFormat::createWriterFor (OutputStream* /*stream
|
|||
const StringPairArray& /*metadataValues*/,
|
||||
int /*qualityOptionIndex*/)
|
||||
{
|
||||
jassertfalse // not yet implemented!
|
||||
jassertfalse; // not yet implemented!
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ void AudioDeviceManager::restartLastAudioDevice()
|
|||
// This method will only reload the last device that was running
|
||||
// before closeAudioDevice() was called - you need to actually open
|
||||
// one first, with setAudioDevice().
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ bool AudioIODevice::hasControlPanel() const
|
|||
|
||||
bool AudioIODevice::showControlPanel()
|
||||
{
|
||||
jassertfalse // this should only be called for devices which return true from
|
||||
// their hasControlPanel() method.
|
||||
jassertfalse; // this should only be called for devices which return true from
|
||||
// their hasControlPanel() method.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ void AudioDataConverters::convertFloatToFormat (const DataFormat destFormat,
|
|||
break;
|
||||
|
||||
default:
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -489,7 +489,7 @@ void AudioDataConverters::convertFormatToFloat (const DataFormat sourceFormat,
|
|||
break;
|
||||
|
||||
default:
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1308,7 +1308,7 @@ const String AudioUnitPluginInstance::getProgramName (int index)
|
|||
|
||||
void AudioUnitPluginInstance::changeProgramName (int index, const String& newName)
|
||||
{
|
||||
jassertfalse // xxx not implemented!
|
||||
jassertfalse; // xxx not implemented!
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -2676,7 +2676,7 @@ void VSTPluginInstance::changeProgramName (int index, const String& newName)
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // xxx not implemented!
|
||||
jassertfalse; // xxx not implemented!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ AudioProcessorGraph::Node* AudioProcessorGraph::addNode (AudioProcessor* const n
|
|||
{
|
||||
if (newProcessor == 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ public:
|
|||
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ int BigInteger::getBitRangeAsInt (const int startBit, int numBits) const throw()
|
|||
{
|
||||
if (numBits > 32)
|
||||
{
|
||||
jassertfalse // use getBitRange() if you need more than 32 bits..
|
||||
jassertfalse; // use getBitRange() if you need more than 32 bits..
|
||||
numBits = 32;
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ void BigInteger::setBitRangeAsInt (const int startBit, int numBits, unsigned int
|
|||
{
|
||||
if (numBits > 32)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
numBits = 32;
|
||||
}
|
||||
|
||||
|
|
@ -908,7 +908,7 @@ const String BigInteger::toString (const int base, const int minimumNumCharacter
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // can't do the specified base!
|
||||
jassertfalse; // can't do the specified base!
|
||||
return String::empty;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ public:
|
|||
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ public:
|
|||
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ public:
|
|||
{
|
||||
if (startIndex < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ void ValueTree::SharedObject::addChild (SharedObject* child, int index, UndoMana
|
|||
{
|
||||
// You're attempting to create a recursive loop! A node
|
||||
// can't be a child of one of its own children!
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -840,7 +840,7 @@ ValueTree ValueTree::readFromStream (InputStream& input)
|
|||
|
||||
if (numProps < 0)
|
||||
{
|
||||
jassertfalse // trying to read corrupted data!
|
||||
jassertfalse; // trying to read corrupted data!
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
|
||||
@see jassertfalse
|
||||
*/
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse }
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse; }
|
||||
|
||||
#else
|
||||
//==============================================================================
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
#define jassertfalse { juce_LogCurrentAssertion }
|
||||
|
||||
#if JUCE_LOG_ASSERTIONS
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse }
|
||||
#define jassert(expression) { if (! (expression)) jassertfalse; }
|
||||
#else
|
||||
#define jassert(a) { }
|
||||
#endif
|
||||
|
|
@ -173,7 +173,7 @@
|
|||
}
|
||||
|
||||
#define JUCE_CATCH_ALL catch (...) {}
|
||||
#define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse }
|
||||
#define JUCE_CATCH_ALL_ASSERT catch (...) { jassertfalse; }
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public:
|
|||
|
||||
This is needed to avoid unicode problems with the argc type params.
|
||||
*/
|
||||
static const String JUCE_CALLTYPE getCurrentCommandLineParams() throw();
|
||||
static const String JUCE_CALLTYPE getCurrentCommandLineParams();
|
||||
#endif
|
||||
|
||||
/** Clears the floating point unit's flags.
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ const BigInteger Primes::createProbablePrime (const int bitLength,
|
|||
return candidate;
|
||||
}
|
||||
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return BigInteger();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ bool RSAKey::applyToValue (BigInteger& value) const
|
|||
{
|
||||
if (part1.isZero() || part2.isZero() || value <= 0)
|
||||
{
|
||||
jassertfalse // using an uninitialised key
|
||||
jassertfalse; // using an uninitialised key
|
||||
value.clear();
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -945,7 +945,7 @@ void ListBox::startDragAndDrop (const MouseEvent& e, const String& dragDescripti
|
|||
{
|
||||
// to be able to do a drag-and-drop operation, the listbox needs to
|
||||
// be inside a component which is also a DragAndDropContainer.
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ float Slider::getPositionOfValue (const double value)
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // not a valid call on a slider that doesn't work linearly!
|
||||
jassertfalse; // not a valid call on a slider that doesn't work linearly!
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2190,7 +2190,7 @@ void TextEditor::handleCommandMessage (const int commandId)
|
|||
break;
|
||||
|
||||
default:
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public:
|
|||
{
|
||||
// to be able to do a drag-and-drop operation, the treeview needs to
|
||||
// be inside a component which is also a DragAndDropContainer.
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1801,7 +1801,7 @@ XmlElement* TreeViewItem::getOpennessState() const throw()
|
|||
{
|
||||
// trying to save the openness for an element that has no name - this won't
|
||||
// work because it needs the names to identify what to open.
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ void Component::userTriedToCloseWindow()
|
|||
If you want to ignore the event and don't want to trigger this assertion, just override
|
||||
this method and do nothing.
|
||||
*/
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
void Component::minimisationStateChanged (bool)
|
||||
|
|
@ -625,7 +625,7 @@ void Component::toBack()
|
|||
|
||||
if (isOnDesktop())
|
||||
{
|
||||
jassertfalse //xxx need to add this to native window
|
||||
jassertfalse; //xxx need to add this to native window
|
||||
}
|
||||
else if (parentComponent_ != 0 && childList.getFirst() != this)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public:
|
|||
|
||||
@see isScreenSaverEnabled
|
||||
*/
|
||||
static void setScreenSaverEnabled (bool isEnabled) throw();
|
||||
static void setScreenSaverEnabled (bool isEnabled);
|
||||
|
||||
/** Returns true if the screensaver has not been turned off.
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ public:
|
|||
|
||||
@see setScreenSaverEnabled
|
||||
*/
|
||||
static bool isScreenSaverEnabled() throw();
|
||||
static bool isScreenSaverEnabled();
|
||||
|
||||
//==============================================================================
|
||||
/** Registers a MouseListener that will receive all mouse events that occur on
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ bool MultiDocumentPanel::closeDocument (Component* component,
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ void ResizableBorderComponent::mouseDown (const MouseEvent& e)
|
|||
{
|
||||
if (component == 0)
|
||||
{
|
||||
jassertfalse // You've deleted the component that this resizer was supposed to be using!
|
||||
jassertfalse; // You've deleted the component that this resizer was supposed to be using!
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ void ResizableBorderComponent::mouseDrag (const MouseEvent& e)
|
|||
{
|
||||
if (component == 0)
|
||||
{
|
||||
jassertfalse // You've deleted the component that this resizer was supposed to be using!
|
||||
jassertfalse; // You've deleted the component that this resizer was supposed to be using!
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ const Colour LookAndFeel::findColour (const int colourId) const throw()
|
|||
if (index >= 0)
|
||||
return colours [index];
|
||||
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return Colours::black;
|
||||
}
|
||||
|
||||
|
|
@ -1923,7 +1923,7 @@ Button* LookAndFeel::createDocumentWindowButton (int buttonType)
|
|||
return new GlassWindowButton ("maximise", Colour (0xff119911), shape, fullscreenShape);
|
||||
}
|
||||
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -3050,8 +3050,8 @@ void LookAndFeel::drawGlassLozenge (Graphics& g,
|
|||
|
||||
if (! (flatOnRight || flatOnTop || flatOnBottom))
|
||||
{
|
||||
cg.x1 = x + width - edgeBlurRadius;
|
||||
cg.x2 = x + width;
|
||||
cg.point1.setX (x + width - edgeBlurRadius);
|
||||
cg.point2.setX (x + width);
|
||||
|
||||
g.saveState();
|
||||
g.setGradientFill (cg);
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ Button* OldSchoolLookAndFeel::createDocumentWindowButton (int buttonType)
|
|||
return b;
|
||||
}
|
||||
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1734,14 +1734,14 @@ void PopupMenuCustomComponent::triggerMenuItem()
|
|||
else
|
||||
{
|
||||
// something must have gone wrong with the component hierarchy if this happens..
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// why isn't this component inside a menu? Not much point triggering the item if
|
||||
// there's no menu.
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ const MouseEvent MouseEvent::getEventRelativeTo (Component* const otherComponent
|
|||
{
|
||||
if (otherComponent == 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -616,13 +616,13 @@ int ColourSelector::getNumSwatches() const
|
|||
|
||||
const Colour ColourSelector::getSwatchColour (const int) const
|
||||
{
|
||||
jassertfalse // if you've overridden getNumSwatches(), you also need to implement this method
|
||||
jassertfalse; // if you've overridden getNumSwatches(), you also need to implement this method
|
||||
return Colours::black;
|
||||
}
|
||||
|
||||
void ColourSelector::setSwatchColour (const int, const Colour&) const
|
||||
{
|
||||
jassertfalse // if you've overridden getNumSwatches(), you also need to implement this method
|
||||
jassertfalse; // if you've overridden getNumSwatches(), you also need to implement this method
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ void DocumentWindow::closeButtonPressed()
|
|||
still get cleaned-up if the app is quit by some other means (e.g. a cmd-Q on the mac
|
||||
or closing it via the taskbar icon on Windows).
|
||||
*/
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
void DocumentWindow::minimiseButtonPressed()
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ void ResizableWindow::setFullScreen (const bool shouldBeFullScreen)
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -427,7 +427,7 @@ void ResizableWindow::setMinimised (const bool shouldMinimise)
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -533,7 +533,7 @@ void ResizableWindow::addChildComponent (Component* const child, int zOrder)
|
|||
If you really know what you're doing and want to avoid this assertion, just call
|
||||
Component::addChildComponent directly.
|
||||
*/
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
|
||||
Component::addChildComponent (child, zOrder);
|
||||
}
|
||||
|
|
@ -550,7 +550,7 @@ void ResizableWindow::addAndMakeVisible (Component* const child, int zOrder)
|
|||
If you really know what you're doing and want to avoid this assertion, just call
|
||||
Component::addAndMakeVisible directly.
|
||||
*/
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
|
||||
Component::addAndMakeVisible (child, zOrder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ BEGIN_JUCE_NAMESPACE
|
|||
ColourGradient::ColourGradient() throw()
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
x1 = 987654.0f;
|
||||
point1.setX (987654.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -45,17 +45,12 @@ ColourGradient::ColourGradient (const Colour& colour1,
|
|||
const float x2_,
|
||||
const float y2_,
|
||||
const bool isRadial_)
|
||||
: x1 (x1_),
|
||||
y1 (y1_),
|
||||
x2 (x2_),
|
||||
y2 (y2_),
|
||||
: point1 (x1_, y1_),
|
||||
point2 (x2_, y2_),
|
||||
isRadial (isRadial_)
|
||||
{
|
||||
colours.add (0);
|
||||
colours.add (colour1.getARGB());
|
||||
|
||||
colours.add (1 << 16);
|
||||
colours.add (colour2.getARGB());
|
||||
colours.add (ColourPoint (0, colour1));
|
||||
colours.add (ColourPoint (1 << 16, colour2));
|
||||
}
|
||||
|
||||
ColourGradient::~ColourGradient()
|
||||
|
|
@ -77,62 +72,64 @@ void ColourGradient::addColour (const double proportionAlongGradient,
|
|||
const uint32 pos = jlimit (0, 65535, roundToInt (proportionAlongGradient * 65536.0));
|
||||
|
||||
int i;
|
||||
for (i = 0; i < colours.size(); i += 2)
|
||||
if (colours.getUnchecked(i) > pos)
|
||||
for (i = 0; i < colours.size(); ++i)
|
||||
if (colours.getReference(i).position > pos)
|
||||
break;
|
||||
|
||||
colours.insert (i, pos);
|
||||
colours.insert (i + 1, colour.getARGB());
|
||||
colours.insert (i, ColourPoint (pos, colour));
|
||||
}
|
||||
|
||||
void ColourGradient::multiplyOpacity (const float multiplier) throw()
|
||||
{
|
||||
for (int i = 1; i < colours.size(); i += 2)
|
||||
for (int i = 0; i < colours.size(); ++i)
|
||||
{
|
||||
const Colour c (colours.getUnchecked(i));
|
||||
colours.set (i, c.withMultipliedAlpha (multiplier).getARGB());
|
||||
Colour& c = colours.getReference(i).colour;
|
||||
c = c.withMultipliedAlpha (multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
int ColourGradient::getNumColours() const throw()
|
||||
{
|
||||
return colours.size() >> 1;
|
||||
return colours.size();
|
||||
}
|
||||
|
||||
double ColourGradient::getColourPosition (const int index) const throw()
|
||||
{
|
||||
return jlimit (0.0, 1.0, colours [index << 1] / 65535.0);
|
||||
if (((unsigned int) index) < (unsigned int) colours.size())
|
||||
return jlimit (0.0, 1.0, colours.getReference (index).position / 65535.0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Colour ColourGradient::getColour (const int index) const throw()
|
||||
{
|
||||
return Colour (colours [(index << 1) + 1]);
|
||||
if (((unsigned int) index) < (unsigned int) colours.size())
|
||||
return colours.getReference (index).colour;
|
||||
|
||||
return Colour();
|
||||
}
|
||||
|
||||
const Colour ColourGradient::getColourAtPosition (const float position) const throw()
|
||||
{
|
||||
jassert (colours.getUnchecked (0) == 0); // the first colour specified has to go at position 0
|
||||
jassert (colours.getReference(0).position == 0); // the first colour specified has to go at position 0
|
||||
|
||||
const int integerPos = jlimit (0, 65535, roundToInt (position * 65536.0f));
|
||||
|
||||
if (integerPos <= 0 || colours.size() <= 2)
|
||||
if (integerPos <= 0 || colours.size() <= 1)
|
||||
return getColour (0);
|
||||
|
||||
int i = colours.size() - 2;
|
||||
while (integerPos < (int) colours.getUnchecked(i))
|
||||
i -= 2;
|
||||
int i = colours.size() - 1;
|
||||
while (integerPos < (int) colours.getReference(i).position)
|
||||
--i;
|
||||
|
||||
if (i >= colours.size() - 2)
|
||||
return Colour (colours.getUnchecked(i));
|
||||
if (i >= colours.size() - 1)
|
||||
return colours.getReference(i).colour;
|
||||
|
||||
const int pos1 = colours.getUnchecked (i);
|
||||
const Colour col1 (colours.getUnchecked (i + 1));
|
||||
const ColourPoint& p1 = colours.getReference (i);
|
||||
const ColourPoint& p2 = colours.getReference (i + 1);
|
||||
|
||||
const int pos2 = colours.getUnchecked (i + 2);
|
||||
const Colour col2 (colours.getUnchecked (i + 3));
|
||||
|
||||
return col1.interpolatedWith (col2, (integerPos - pos1) / (float) (pos2 - pos1));
|
||||
return p1.colour.interpolatedWith (p2.colour, (integerPos - p1.position) / (float) (p2.position - p1.position));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -141,32 +138,26 @@ int ColourGradient::createLookupTable (const AffineTransform& transform, HeapBlo
|
|||
#if JUCE_DEBUG
|
||||
// trying to use the object without setting its co-ordinates? Have a careful read of
|
||||
// the comments for the constructors.
|
||||
jassert (x1 != 987654.0f);
|
||||
jassert (point1.getX() != 987654.0f);
|
||||
#endif
|
||||
|
||||
const int numColours = colours.size() >> 1;
|
||||
|
||||
float tx1 = x1, ty1 = y1, tx2 = x2, ty2 = y2;
|
||||
transform.transformPoint (tx1, ty1);
|
||||
transform.transformPoint (tx2, ty2);
|
||||
const double distance = juce_hypot (tx1 - tx2, ty1 - ty2);
|
||||
|
||||
const int numEntries = jlimit (1, (numColours - 1) << 8, 3 * (int) distance);
|
||||
const int numEntries = jlimit (1, (colours.size() - 1) << 8,
|
||||
3 * (int) point1.transformedBy (transform)
|
||||
.getDistanceFrom (point2.transformedBy (transform)));
|
||||
lookupTable.malloc (numEntries);
|
||||
|
||||
if (numColours >= 2)
|
||||
if (colours.size() >= 2)
|
||||
{
|
||||
jassert (colours.getUnchecked (0) == 0); // the first colour specified has to go at position 0
|
||||
jassert (colours.getReference(0).position == 0); // the first colour specified has to go at position 0
|
||||
|
||||
PixelARGB pix1 (colours.getUnchecked (1));
|
||||
pix1.premultiply();
|
||||
PixelARGB pix1 (colours.getReference (0).colour.getPixelARGB());
|
||||
int index = 0;
|
||||
|
||||
for (int j = 2; j < colours.size(); j += 2)
|
||||
for (int j = 1; j < colours.size(); ++j)
|
||||
{
|
||||
const int numToDo = ((colours.getUnchecked (j) * (numEntries - 1)) >> 16) - index;
|
||||
PixelARGB pix2 (colours.getUnchecked (j + 1));
|
||||
pix2.premultiply();
|
||||
const ColourPoint& p = colours.getReference (j);
|
||||
const int numToDo = ((p.position * (numEntries - 1)) >> 16) - index;
|
||||
const PixelARGB pix2 (p.colour.getPixelARGB());
|
||||
|
||||
for (int i = 0; i < numToDo; ++i)
|
||||
{
|
||||
|
|
@ -185,7 +176,7 @@ int ColourGradient::createLookupTable (const AffineTransform& transform, HeapBlo
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // no colours specified!
|
||||
jassertfalse; // no colours specified!
|
||||
}
|
||||
|
||||
return numEntries;
|
||||
|
|
@ -193,8 +184,8 @@ int ColourGradient::createLookupTable (const AffineTransform& transform, HeapBlo
|
|||
|
||||
bool ColourGradient::isOpaque() const throw()
|
||||
{
|
||||
for (int i = 1; i < colours.size(); i += 2)
|
||||
if (PixelARGB (colours.getUnchecked(i)).getAlpha() < 0xff)
|
||||
for (int i = 0; i < colours.size(); ++i)
|
||||
if (! colours.getReference(i).colour.isOpaque())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -202,8 +193,8 @@ bool ColourGradient::isOpaque() const throw()
|
|||
|
||||
bool ColourGradient::isInvisible() const throw()
|
||||
{
|
||||
for (int i = 1; i < colours.size(); i += 2)
|
||||
if (PixelARGB (colours.getUnchecked(i)).getAlpha() > 0)
|
||||
for (int i = 0; i < colours.size(); ++i)
|
||||
if (! colours.getReference(i).colour.isTransparent())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#define __JUCE_COLOURGRADIENT_JUCEHEADER__
|
||||
|
||||
#include "juce_Colour.h"
|
||||
#include "../geometry/juce_AffineTransform.h"
|
||||
#include "../geometry/juce_Point.h"
|
||||
#include "../../../containers/juce_Array.h"
|
||||
#include "../../../containers/juce_HeapBlock.h"
|
||||
|
||||
|
|
@ -132,14 +132,10 @@ public:
|
|||
bool isInvisible() const throw();
|
||||
|
||||
//==============================================================================
|
||||
float x1;
|
||||
float y1;
|
||||
|
||||
float x2;
|
||||
float y2;
|
||||
Point<float> point1, point2;
|
||||
|
||||
/** If true, the gradient should be filled circularly, centred around
|
||||
(x1, y1), with (x2, y2) defining a point on the circumference.
|
||||
point1, with point2 defining a point on the circumference.
|
||||
|
||||
If false, the gradient is linear between the two points.
|
||||
*/
|
||||
|
|
@ -149,7 +145,19 @@ public:
|
|||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
Array <uint32> colours;
|
||||
struct ColourPoint
|
||||
{
|
||||
ColourPoint() throw() {}
|
||||
|
||||
ColourPoint (uint32 position_, const Colour& colour_) throw()
|
||||
: position (position_), colour (colour_)
|
||||
{}
|
||||
|
||||
uint32 position;
|
||||
Colour colour;
|
||||
};
|
||||
|
||||
Array <ColourPoint> colours;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ void LowLevelGraphicsPostScriptRenderer::clipToPath (const Path& path, const Aff
|
|||
void LowLevelGraphicsPostScriptRenderer::clipToImageAlpha (const Image& /*sourceImage*/, const Rectangle<int>& /*srcClip*/, const AffineTransform& /*transform*/)
|
||||
{
|
||||
needToClip = true;
|
||||
jassertfalse // xxx
|
||||
jassertfalse; // xxx
|
||||
}
|
||||
|
||||
bool LowLevelGraphicsPostScriptRenderer::clipRegionIntersects (const Rectangle<int>& r)
|
||||
|
|
@ -299,7 +299,7 @@ void LowLevelGraphicsPostScriptRenderer::writePath (const Path& path) const
|
|||
break;
|
||||
|
||||
default:
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,8 +198,8 @@ public:
|
|||
: lookupTable (lookupTable_), numEntries (numEntries_)
|
||||
{
|
||||
jassert (numEntries_ >= 0);
|
||||
Point<float> p1 (gradient.x1, gradient.y1);
|
||||
Point<float> p2 (gradient.x2, gradient.y2);
|
||||
Point<float> p1 (gradient.point1);
|
||||
Point<float> p2 (gradient.point2);
|
||||
|
||||
if (! transform.isIdentity())
|
||||
{
|
||||
|
|
@ -271,13 +271,12 @@ public:
|
|||
const PixelARGB* const lookupTable_, const int numEntries_)
|
||||
: lookupTable (lookupTable_),
|
||||
numEntries (numEntries_),
|
||||
gx1 (gradient.x1),
|
||||
gy1 (gradient.y1)
|
||||
gx1 (gradient.point1.getX()),
|
||||
gy1 (gradient.point1.getY())
|
||||
{
|
||||
jassert (numEntries_ >= 0);
|
||||
const float gdx = gradient.x1 - gradient.x2;
|
||||
const float gdy = gradient.y1 - gradient.y2;
|
||||
maxDist = gdx * gdx + gdy * gdy;
|
||||
const Point<float> diff (gradient.point1 - gradient.point2);
|
||||
maxDist = diff.getX() * diff.getX() + diff.getY() * diff.getY();
|
||||
invScale = numEntries / std::sqrt (maxDist);
|
||||
jassert (roundToInt (std::sqrt (maxDist) * invScale) <= numEntries);
|
||||
}
|
||||
|
|
@ -1908,16 +1907,16 @@ public:
|
|||
|
||||
ColourGradient g2 (*(fillType.gradient));
|
||||
g2.multiplyOpacity (fillType.getOpacity());
|
||||
g2.x1 -= 0.5f; g2.y1 -= 0.5f;
|
||||
g2.x2 -= 0.5f; g2.y2 -= 0.5f;
|
||||
g2.point1.addXY (-0.5f, -0.5f);
|
||||
g2.point2.addXY (-0.5f, -0.5f);
|
||||
AffineTransform transform (fillType.transform.translated ((float) xOffset, (float) yOffset));
|
||||
const bool isIdentity = transform.isOnlyTranslation();
|
||||
|
||||
if (isIdentity)
|
||||
{
|
||||
// If our translation doesn't involve any distortion, we can speed it up..
|
||||
transform.transformPoint (g2.x1, g2.y1);
|
||||
transform.transformPoint (g2.x2, g2.y2);
|
||||
g2.point1.applyTransform (transform);
|
||||
g2.point2.applyTransform (transform);
|
||||
transform = AffineTransform::identity;
|
||||
}
|
||||
|
||||
|
|
@ -2096,7 +2095,7 @@ void LowLevelGraphicsSoftwareRenderer::restoreState()
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // trying to pop with an empty stack!
|
||||
jassertfalse; // trying to pop with an empty stack!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void DrawableComposite::insertDrawable (Drawable* drawable,
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // trying to add a drawable that's already in here!
|
||||
jassertfalse; // trying to add a drawable that's already in here!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,10 +142,8 @@ static const FillType readFillTypeFromTree (const ValueTree& v)
|
|||
else if (type.equalsIgnoreCase ("gradient"))
|
||||
{
|
||||
ColourGradient g;
|
||||
g.x1 = v["x1"];
|
||||
g.y1 = v["y1"];
|
||||
g.x2 = v["x2"];
|
||||
g.y2 = v["y2"];
|
||||
g.point1.setXY (v["x1"], v["y1"]);
|
||||
g.point2.setXY (v["x2"], v["y2"]);
|
||||
g.isRadial = v["radial"];
|
||||
|
||||
StringArray colours;
|
||||
|
|
@ -158,7 +156,7 @@ static const FillType readFillTypeFromTree (const ValueTree& v)
|
|||
return g;
|
||||
}
|
||||
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return FillType();
|
||||
}
|
||||
|
||||
|
|
@ -174,10 +172,10 @@ static ValueTree createTreeForFillType (const String& tagName, const FillType& f
|
|||
else if (fillType.isGradient())
|
||||
{
|
||||
v.setProperty ("type", "gradient", 0);
|
||||
v.setProperty ("x1", fillType.gradient->x1, 0);
|
||||
v.setProperty ("y1", fillType.gradient->y1, 0);
|
||||
v.setProperty ("x2", fillType.gradient->x2, 0);
|
||||
v.setProperty ("y2", fillType.gradient->y2, 0);
|
||||
v.setProperty ("x1", fillType.gradient->point1.getX(), 0);
|
||||
v.setProperty ("y1", fillType.gradient->point1.getY(), 0);
|
||||
v.setProperty ("x2", fillType.gradient->point2.getX(), 0);
|
||||
v.setProperty ("y2", fillType.gradient->point2.getY(), 0);
|
||||
v.setProperty ("radial", fillType.gradient->isRadial, 0);
|
||||
|
||||
String s;
|
||||
|
|
@ -189,7 +187,7 @@ static ValueTree createTreeForFillType (const String& tagName, const FillType& f
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse //xxx
|
||||
jassertfalse; //xxx
|
||||
}
|
||||
|
||||
return v;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ ValueTree DrawableText::createValueTree() const
|
|||
if (getName().isNotEmpty())
|
||||
v.setProperty ("id", getName(), 0);
|
||||
|
||||
jassertfalse // xxx not finished!
|
||||
jassertfalse; // xxx not finished!
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ DrawableText* DrawableText::createFromValueTree (const ValueTree& tree)
|
|||
|
||||
dt->setName (tree ["id"]);
|
||||
|
||||
jassertfalse // xxx not finished!
|
||||
jassertfalse; // xxx not finished!
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -752,25 +752,23 @@ private:
|
|||
|
||||
if (gradient.isRadial)
|
||||
{
|
||||
gradient.x1 = dx + getCoordLength (fillXml->getStringAttribute ("cx", "50%"), gradientWidth);
|
||||
gradient.y1 = dy + getCoordLength (fillXml->getStringAttribute ("cy", "50%"), gradientHeight);
|
||||
gradient.point1.setXY (dx + getCoordLength (fillXml->getStringAttribute ("cx", "50%"), gradientWidth),
|
||||
dy + getCoordLength (fillXml->getStringAttribute ("cy", "50%"), gradientHeight));
|
||||
|
||||
const float radius = getCoordLength (fillXml->getStringAttribute ("r", "50%"), gradientWidth);
|
||||
|
||||
gradient.x2 = gradient.x1 + radius;
|
||||
gradient.y2 = gradient.y1;
|
||||
gradient.point2 = gradient.point1 + Point<float> (radius, 0.0f);
|
||||
|
||||
//xxx (the fx, fy focal point isn't handled properly here..)
|
||||
}
|
||||
else
|
||||
{
|
||||
gradient.x1 = dx + getCoordLength (fillXml->getStringAttribute ("x1", "0%"), gradientWidth);
|
||||
gradient.y1 = dy + getCoordLength (fillXml->getStringAttribute ("y1", "0%"), gradientHeight);
|
||||
gradient.point1.setXY (dx + getCoordLength (fillXml->getStringAttribute ("x1", "0%"), gradientWidth),
|
||||
dy + getCoordLength (fillXml->getStringAttribute ("y1", "0%"), gradientHeight));
|
||||
|
||||
gradient.x2 = dx + getCoordLength (fillXml->getStringAttribute ("x2", "100%"), gradientWidth);
|
||||
gradient.y2 = dy + getCoordLength (fillXml->getStringAttribute ("y2", "0%"), gradientHeight);
|
||||
gradient.point2.setXY (dx + getCoordLength (fillXml->getStringAttribute ("x2", "100%"), gradientWidth),
|
||||
dy + getCoordLength (fillXml->getStringAttribute ("y2", "0%"), gradientHeight));
|
||||
|
||||
if (gradient.x1 == gradient.x2 && gradient.y1 == gradient.y2)
|
||||
if (gradient.point1 == gradient.point2)
|
||||
return Colour (gradient.getColour (gradient.getNumColours() - 1));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -827,7 +827,7 @@ void Path::addPath (const Path& other)
|
|||
else
|
||||
{
|
||||
// something's gone wrong with the element list!
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -881,7 +881,7 @@ void Path::addPath (const Path& other,
|
|||
else
|
||||
{
|
||||
// something's gone wrong with the element list!
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1323,7 +1323,7 @@ void Path::loadPathFromStream (InputStream& source)
|
|||
return; // end of path marker
|
||||
|
||||
default:
|
||||
jassertfalse // illegal char in the stream
|
||||
jassertfalse; // illegal char in the stream
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1529,7 +1529,7 @@ void Path::restoreFromString (const String& stringVersion)
|
|||
break;
|
||||
|
||||
default:
|
||||
jassertfalse // illegal string format?
|
||||
jassertfalse; // illegal string format?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,17 +59,20 @@ public:
|
|||
/** Copies this point from another one. */
|
||||
Point& operator= (const Point& other) throw() { x = other.x; y = other.y; return *this; }
|
||||
|
||||
/** Returns true if the point is (0, 0). */
|
||||
bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
|
||||
|
||||
/** Returns the point's x co-ordinate. */
|
||||
inline ValueType getX() const throw() { return x; }
|
||||
|
||||
/** Returns the point's y co-ordinate. */
|
||||
inline ValueType getY() const throw() { return y; }
|
||||
|
||||
inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
|
||||
inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
|
||||
/** Sets the point's x co-ordinate. */
|
||||
inline void setX (const ValueType newX) throw() { x = newX; }
|
||||
|
||||
/** Returns true if the point is (0, 0). */
|
||||
bool isOrigin() const throw() { return x == ValueType() && y == ValueType(); }
|
||||
/** Sets the point's y co-ordinate. */
|
||||
inline void setY (const ValueType newY) throw() { y = newY; }
|
||||
|
||||
/** Returns a point which has the same Y position as this one, but a new X. */
|
||||
const Point withX (const ValueType newX) const throw() { return Point (newX, y); }
|
||||
|
|
@ -83,6 +86,9 @@ public:
|
|||
/** Adds a pair of co-ordinates to this value. */
|
||||
void addXY (const ValueType xToAdd, const ValueType yToAdd) throw() { x += xToAdd; y += yToAdd; }
|
||||
|
||||
inline bool operator== (const Point& other) const throw() { return x == other.x && y == other.y; }
|
||||
inline bool operator!= (const Point& other) const throw() { return x != other.x || y != other.y; }
|
||||
|
||||
/** Adds two points together. */
|
||||
const Point operator+ (const Point& other) const throw() { return Point (x + other.x, y + other.y); }
|
||||
|
||||
|
|
@ -129,6 +135,9 @@ public:
|
|||
*/
|
||||
void applyTransform (const AffineTransform& transform) throw() { transform.transformPoint (x, y); }
|
||||
|
||||
/** Returns the position of this point, if it is transformed by a given AffineTransform. */
|
||||
const Point transformedBy (const AffineTransform& transform) const throw() { ValueType x2 (x), y2 (y); transform.transformPoint (x2, y2); return Point (x2, y2); }
|
||||
|
||||
/** Returns the point as a string in the form "x, y". */
|
||||
const String toString() const { return String (x) + ", " + String (y); }
|
||||
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ bool JPEGImageFormat::writeImageToStream (const Image& image, OutputStream& out)
|
|||
if (image.hasAlphaChannel())
|
||||
{
|
||||
// this method could fill the background in white and still save the image..
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ void Image::multiplyAllAlphas (const float amountToMultiplyBy)
|
|||
}
|
||||
else
|
||||
{
|
||||
jassertfalse // can't do this without an alpha-channel!
|
||||
jassertfalse; // can't do this without an alpha-channel!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ void ImageCache::incReferenceCount (Image* const image)
|
|||
}
|
||||
}
|
||||
|
||||
jassertfalse // (trying to inc the ref count of an image that's not in the cache)
|
||||
jassertfalse; // (trying to inc the ref count of an image that's not in the cache)
|
||||
}
|
||||
|
||||
void ImageCache::timerCallback()
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ const String File::parseAbsolutePath (const String& p)
|
|||
"File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
|
||||
path if that's what was supplied, or would evaluate a partial path relative to the CWD.
|
||||
*/
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
|
||||
path = File::getCurrentWorkingDirectory().getFullPathName().substring (0, 2) + path;
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ const String File::parseAbsolutePath (const String& p)
|
|||
"File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
|
||||
path if that's what was supplied, or would evaluate a partial path relative to the CWD.
|
||||
*/
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
|
||||
return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
|
||||
}
|
||||
|
|
@ -601,7 +601,7 @@ int File::getNumberOfChildFiles (const int whatToLookFor,
|
|||
else
|
||||
{
|
||||
// trying to search for files inside a non-directory?
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ FileOutputStream::FileOutputStream (const File& f,
|
|||
|
||||
if (currentPosition < 0)
|
||||
{
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
juce_fileClose (fileHandle);
|
||||
fileHandle = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const
|
|||
{
|
||||
// There's no temporary file to use. If your write failed, you should
|
||||
// probably check, and not bother calling this method.
|
||||
jassertfalse
|
||||
jassertfalse;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ bool StreamingSocket::connect (const String& remoteHostName,
|
|||
{
|
||||
if (isListener)
|
||||
{
|
||||
jassertfalse // a listener socket can't connect to another one!
|
||||
jassertfalse; // a listener socket can't connect to another one!
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ int64 GZIPCompressorOutputStream::getPosition()
|
|||
|
||||
bool GZIPCompressorOutputStream::setPosition (int64 /*newPosition*/)
|
||||
{
|
||||
jassertfalse // can't do it!
|
||||
jassertfalse; // can't do it!
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ int InputStream::readCompressedInt()
|
|||
const int numBytes = (sizeByte & 0x7f);
|
||||
if (numBytes > 4)
|
||||
{
|
||||
jassertfalse // trying to read corrupt data - this method must only be used
|
||||
// to read data that was written by OutputStream::writeCompressedInt()
|
||||
jassertfalse; // trying to read corrupt data - this method must only be used
|
||||
// to read data that was written by OutputStream::writeCompressedInt()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue