| @@ -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. | - 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 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. | - 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 | Changelist for version 1.43 | ||||
| @@ -2,14 +2,16 @@ | |||||
| Jucer things to do: | Jucer things to do: | ||||
| ==================== | ==================== | ||||
| - add tooltips when testing components | |||||
| - allow colours to be specified by name | |||||
| - add password character option to textboxes | - add password character option to textboxes | ||||
| - add a field for specifying constructor parameters for the component's base class | - add a field for specifying constructor parameters for the component's base class | ||||
| - add textbox font settings | - 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 | - ability to change some properties when more than one item is selected | ||||
| - a treeview of sub-objects and graphics elements, which can be 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 | - 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 | - 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) | - 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 | - look-and-feel editing | ||||
| - add lots of code comments explaining how it all works! | - 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 | - allow gradients to have more intermediate colours | ||||
| - menu editor | - menu editor | ||||
| - options for making font sizes, rounded rect corners, etc proportional | - 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 | |||||
| @@ -388,7 +388,7 @@ public: | |||||
| void setText (const String& newText) | 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")); | T("Change focus order")); | ||||
| } | } | ||||
| @@ -73,6 +73,7 @@ public: | |||||
| e->setAttribute (T("textBoxEditable"), s->isTextBoxEditable()); | e->setAttribute (T("textBoxEditable"), s->isTextBoxEditable()); | ||||
| e->setAttribute (T("textBoxWidth"), s->getTextBoxWidth()); | e->setAttribute (T("textBoxWidth"), s->getTextBoxWidth()); | ||||
| e->setAttribute (T("textBoxHeight"), s->getTextBoxHeight()); | e->setAttribute (T("textBoxHeight"), s->getTextBoxHeight()); | ||||
| e->setAttribute (T("skewFactor"), s->getSkewFactor()); | |||||
| return e; | return e; | ||||
| } | } | ||||
| @@ -95,6 +96,8 @@ public: | |||||
| xml.getIntAttribute (T("textBoxWidth"), 80), | xml.getIntAttribute (T("textBoxWidth"), 80), | ||||
| xml.getIntAttribute (T("textBoxHeight"), 20)); | xml.getIntAttribute (T("textBoxHeight"), 20)); | ||||
| s->setSkewFactor (xml.getDoubleAttribute (T("skewFactor"), 1.0)); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -125,6 +128,9 @@ public: | |||||
| if (needsCallback (component)) | if (needsCallback (component)) | ||||
| r << memberVariableName << "->addListener (this);\n"; | r << memberVariableName << "->addListener (this);\n"; | ||||
| if (s->getSkewFactor() != 1.0) | |||||
| r << memberVariableName << "->setSkewFactor (" << s->getSkewFactor() << ");\n"; | |||||
| r << T('\n'); | r << T('\n'); | ||||
| code.constructorCode += r; | code.constructorCode += r; | ||||
| } | } | ||||
| @@ -168,6 +174,7 @@ public: | |||||
| properties.add (new SliderTextboxEditableProperty (s, document)); | properties.add (new SliderTextboxEditableProperty (s, document)); | ||||
| properties.add (new SliderTextboxSizeProperty (s, document, true)); | properties.add (new SliderTextboxSizeProperty (s, document, true)); | ||||
| properties.add (new SliderTextboxSizeProperty (s, document, false)); | properties.add (new SliderTextboxSizeProperty (s, document, false)); | ||||
| properties.add (new SliderSkewProperty (s, document)); | |||||
| addColourProperties (component, document, properties); | addColourProperties (component, document, properties); | ||||
| } | } | ||||
| @@ -570,6 +577,62 @@ private: | |||||
| }; | }; | ||||
| }; | }; | ||||
| //============================================================================== | |||||
| class SliderSkewProperty : public ComponentTextProperty <Slider> | |||||
| { | |||||
| public: | |||||
| SliderSkewProperty (Slider* slider, JucerDocument& document) | |||||
| : ComponentTextProperty <Slider> (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 <Slider*> (component); | |||||
| jassert (s != 0); | |||||
| return String (s->getSkewFactor()); | |||||
| } | |||||
| private: | |||||
| class SliderSkewChangeAction : public ComponentUndoableAction <Slider> | |||||
| { | |||||
| public: | |||||
| SliderSkewChangeAction (Slider* const comp, ComponentLayout& layout, const double newValue_) | |||||
| : ComponentUndoableAction <Slider> (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) | static const String sliderStyleToString (Slider::SliderStyle style) | ||||
| { | { | ||||
| @@ -179,6 +179,8 @@ void TestComponent::resized() | |||||
| //============================================================================== | //============================================================================== | ||||
| void TestComponent::showInDialogBox (JucerDocument& document) | void TestComponent::showInDialogBox (JucerDocument& document) | ||||
| { | { | ||||
| TooltipWindow tooltipWindow (0, 400); | |||||
| TestComponent testComp (0, document.createCopy(), true); | TestComponent testComp (0, document.createCopy(), true); | ||||
| DialogWindow::showModalDialog (T("Testing: ") + document.getClassName(), | DialogWindow::showModalDialog (T("Testing: ") + document.getClassName(), | ||||
| @@ -220,6 +220,28 @@ const String makeValidCppIdentifier (String s, | |||||
| n << words[i]; | 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; | return n; | ||||
| } | } | ||||
| @@ -186,7 +186,7 @@ public: | |||||
| To set the skew position by using a mid-point, use the setSkewFactorFromMidPoint() | To set the skew position by using a mid-point, use the setSkewFactorFromMidPoint() | ||||
| method instead. | method instead. | ||||
| @see setSkewFactorFromMidPoint | |||||
| @see getSkewFactor, setSkewFactorFromMidPoint | |||||
| */ | */ | ||||
| void setSkewFactor (const double factor) throw(); | void setSkewFactor (const double factor) throw(); | ||||
| @@ -195,10 +195,18 @@ public: | |||||
| This allows you to specify the slider value that should appear in the | This allows you to specify the slider value that should appear in the | ||||
| centre of the slider's visible range. | centre of the slider's visible range. | ||||
| @see setSkewFactor | |||||
| @see setSkewFactor, getSkewFactor | |||||
| */ | */ | ||||
| void setSkewFactorFromMidPoint (const double sliderValueToShowAtMidPoint) throw(); | 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(). | /** Used by setIncDecButtonsMode(). | ||||
| */ | */ | ||||