diff --git a/docs/JUCE changelist.txt b/docs/JUCE changelist.txt index 76c62c5361..3692a98db7 100644 --- a/docs/JUCE changelist.txt +++ b/docs/JUCE changelist.txt @@ -14,6 +14,7 @@ Changelist for version 1.44 - small change to the strictness of the way TreeViews handle their root items. Be careful now to never delete a tree's root item until either the treeview has been deleted, or until you've removed the root from the tree using setRootItem (0). Not doing this can now cause a crash in the tree's destructor, where it expects the root to still be valid. - added some virtual methods to TextEditor to allow customisation of its popup menu. - added a Component::setExplicitFocusOrder() method for specifying the order in which components have their focus traversed, and added Jucer support for setting this value. +- made slider skew factor editable in the jucer ============================================================================== Changelist for version 1.43 diff --git a/extras/the jucer/Jucer To Do list.txt b/extras/the jucer/Jucer To Do list.txt index 000f0856d4..70df4e630b 100644 --- a/extras/the jucer/Jucer To Do list.txt +++ b/extras/the jucer/Jucer To Do list.txt @@ -2,14 +2,16 @@ Jucer things to do: ==================== -- add tooltips when testing components +- allow colours to be specified by name - add password character option to textboxes - add a field for specifying constructor parameters for the component's base class - add textbox font settings +- should be able to move graphics objects around with cursor keys, like components can be - ability to change some properties when more than one item is selected - a treeview of sub-objects and graphics elements, which can be selected - creation of more event handling callback code for the various types of component - polygon editing needs to be better and to support creating sub-paths +- add texteditorlistener callback - gradient points should probably be relative to the shape they're in rather than the whole component (not sure about this though) - look-and-feel editing - add lots of code comments explaining how it all works! @@ -25,4 +27,8 @@ Jucer things to do: - allow gradients to have more intermediate colours - menu editor - options for making font sizes, rounded rect corners, etc proportional -- allow standard widgets to specify a custom sub-class which will be created instead of the normal classname +- add a utility to create a complete set of ready-made project files for all the platforms +- aligning selected components vertically/horizontally +- equally distributing selected components vertically/horizontally inside their bounding rectangle. +- a way of replacing an existing subcomponent by another one while keeping all the properties which are common to all jucer components: name, location, size, tooltip... (Right-Click->Replace->list of components) +- allow position/size of multiple selected components to be edited with the mouse and/or by manually entering the surrounding rectangle dimensions diff --git a/extras/the jucer/src/model/components/jucer_ComponentTypeHandler.cpp b/extras/the jucer/src/model/components/jucer_ComponentTypeHandler.cpp index e3db4f92ef..d28f3b0f81 100644 --- a/extras/the jucer/src/model/components/jucer_ComponentTypeHandler.cpp +++ b/extras/the jucer/src/model/components/jucer_ComponentTypeHandler.cpp @@ -388,7 +388,7 @@ public: void setText (const String& newText) { - document.perform (new SetFocusOrderAction (component, *document.getComponentLayout(), newText.getIntValue()), + document.perform (new SetFocusOrderAction (component, *document.getComponentLayout(), jmax (0, newText.getIntValue())), T("Change focus order")); } diff --git a/extras/the jucer/src/model/components/jucer_SliderHandler.h b/extras/the jucer/src/model/components/jucer_SliderHandler.h index 2674c96c6f..8adc25cfbb 100644 --- a/extras/the jucer/src/model/components/jucer_SliderHandler.h +++ b/extras/the jucer/src/model/components/jucer_SliderHandler.h @@ -73,6 +73,7 @@ public: e->setAttribute (T("textBoxEditable"), s->isTextBoxEditable()); e->setAttribute (T("textBoxWidth"), s->getTextBoxWidth()); e->setAttribute (T("textBoxHeight"), s->getTextBoxHeight()); + e->setAttribute (T("skewFactor"), s->getSkewFactor()); return e; } @@ -95,6 +96,8 @@ public: xml.getIntAttribute (T("textBoxWidth"), 80), xml.getIntAttribute (T("textBoxHeight"), 20)); + s->setSkewFactor (xml.getDoubleAttribute (T("skewFactor"), 1.0)); + return true; } @@ -125,6 +128,9 @@ public: if (needsCallback (component)) r << memberVariableName << "->addListener (this);\n"; + if (s->getSkewFactor() != 1.0) + r << memberVariableName << "->setSkewFactor (" << s->getSkewFactor() << ");\n"; + r << T('\n'); code.constructorCode += r; } @@ -168,6 +174,7 @@ public: properties.add (new SliderTextboxEditableProperty (s, document)); properties.add (new SliderTextboxSizeProperty (s, document, true)); properties.add (new SliderTextboxSizeProperty (s, document, false)); + properties.add (new SliderSkewProperty (s, document)); addColourProperties (component, document, properties); } @@ -570,6 +577,62 @@ private: }; }; + //============================================================================== + class SliderSkewProperty : public ComponentTextProperty + { + public: + SliderSkewProperty (Slider* slider, JucerDocument& document) + : ComponentTextProperty (T("skew factor"), 12, false, slider, document) + { + } + + void setText (const String& newText) + { + const double skew = jlimit (0.001, 1000.0, newText.getDoubleValue()); + + document.perform (new SliderSkewChangeAction (component, *document.getComponentLayout(), skew), + T("Change Slider skew")); + } + + const String getText() const + { + Slider* s = dynamic_cast (component); + jassert (s != 0); + + return String (s->getSkewFactor()); + } + + private: + class SliderSkewChangeAction : public ComponentUndoableAction + { + public: + SliderSkewChangeAction (Slider* const comp, ComponentLayout& layout, const double newValue_) + : ComponentUndoableAction (comp, layout) + { + newValue = newValue_; + oldValue = comp->getSkewFactor(); + } + + bool perform() + { + showCorrectTab(); + getComponent()->setSkewFactor (newValue); + changed(); + return true; + } + + bool undo() + { + showCorrectTab(); + getComponent()->setSkewFactor (oldValue); + changed(); + return true; + } + + double newValue, oldValue; + }; + }; + //============================================================================== static const String sliderStyleToString (Slider::SliderStyle style) { diff --git a/extras/the jucer/src/ui/jucer_TestComponent.cpp b/extras/the jucer/src/ui/jucer_TestComponent.cpp index 862300a653..03d8ee7881 100644 --- a/extras/the jucer/src/ui/jucer_TestComponent.cpp +++ b/extras/the jucer/src/ui/jucer_TestComponent.cpp @@ -179,6 +179,8 @@ void TestComponent::resized() //============================================================================== void TestComponent::showInDialogBox (JucerDocument& document) { + TooltipWindow tooltipWindow (0, 400); + TestComponent testComp (0, document.createCopy(), true); DialogWindow::showModalDialog (T("Testing: ") + document.getClassName(), diff --git a/extras/the jucer/src/utility/jucer_UtilityFunctions.cpp b/extras/the jucer/src/utility/jucer_UtilityFunctions.cpp index 5b99769493..b12abcba64 100644 --- a/extras/the jucer/src/utility/jucer_UtilityFunctions.cpp +++ b/extras/the jucer/src/utility/jucer_UtilityFunctions.cpp @@ -220,6 +220,28 @@ const String makeValidCppIdentifier (String s, n << words[i]; } + // make sure it's not a reserved c++ keyword.. + static const tchar* const reservedWords[] = + { + T("auto"), T("const"), T("double"), T("float"), T("int"), T("short"), T("struct"), + T("return"), T("static"), T("union"), T("while"), T("asm"), T("dynamic_cast"), + T("unsigned"), T("break"), T("continue"), T("else"), T("for"), T("long"), T("signed"), + T("switch"), T("void"), T("case"), T("default"), T("enum"), T("goto"), T("register"), + T("sizeof"), T("typedef"), T("volatile"), T("char"), T("do"), T("extern"), T("if"), + T("namespace"), T("reinterpret_cast"), T("try"), T("bool"), T("explicit"), T("new"), + T("static_cast"), T("typeid"), T("catch"), T("false"), T("operator"), T("template"), + T("typename"), T("class"), T("friend"), T("private"), T("this"), T("using"), T("const_cast"), + T("inline"), T("public"), T("throw"), T("virtual"), T("delete"), T("mutable"), T("protected"), + T("true"), T("wchar_t"), T("and"), T("bitand"), T("compl"), T("not_eq"), T("or_eq"), + T("xor_eq"), T("and_eq"), T("bitor"), T("not"), T("or"), T("xor"), T("cin"), T("endl"), + T("INT_MIN"), T("iomanip"), T("main"), T("npos"), T("std"), T("cout"), T("include"), + T("INT_MAX"), T("iostream"), T("MAX_RAND"), T("NULL"), T("string") + }; + + for (int i = 0; i < numElementsInArray (reservedWords); ++i) + if (n == reservedWords[i]) + n << '_'; + return n; } diff --git a/src/juce_appframework/gui/components/controls/juce_Slider.h b/src/juce_appframework/gui/components/controls/juce_Slider.h index 29c0c9fa4f..78eeaea1e9 100644 --- a/src/juce_appframework/gui/components/controls/juce_Slider.h +++ b/src/juce_appframework/gui/components/controls/juce_Slider.h @@ -186,7 +186,7 @@ public: To set the skew position by using a mid-point, use the setSkewFactorFromMidPoint() method instead. - @see setSkewFactorFromMidPoint + @see getSkewFactor, setSkewFactorFromMidPoint */ void setSkewFactor (const double factor) throw(); @@ -195,10 +195,18 @@ public: This allows you to specify the slider value that should appear in the centre of the slider's visible range. - @see setSkewFactor + @see setSkewFactor, getSkewFactor */ void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint) throw(); + /** Returns the current skew factor. + + See setSkewFactor for more info. + + @see setSkewFactor, setSkewFactorFromMidPoint + */ + double getSkewFactor() const throw() { return skewFactor; } + //============================================================================== /** Used by setIncDecButtonsMode(). */