1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-03 03:30:06 +00:00

Updated the live constant editor to add C++ escape-sequences for non-ascii strings, and to allow multi-line strings.

This commit is contained in:
jules 2014-07-04 17:54:21 +01:00
parent c8bf8cd41e
commit 4a3c45e7bd
3 changed files with 12 additions and 5 deletions

View file

@ -115,8 +115,7 @@ void DirectoryContentsList::setFileFilter (const FileFilter* newFileFilter)
}
//==============================================================================
bool DirectoryContentsList::getFileInfo (const int index,
FileInfo& result) const
bool DirectoryContentsList::getFileInfo (const int index, FileInfo& result) const
{
const ScopedLock sl (fileListLock);

View file

@ -117,6 +117,8 @@ LivePropertyEditorBase::LivePropertyEditorBase (LiveValueBase& v, CodeDocument&
name.setFont (13.0f);
name.setText (v.name, dontSendNotification);
valueEditor.setMultiLine (true);
valueEditor.setReturnKeyStartsNewLine (true);
valueEditor.setText (v.getStringValue (wasHex), dontSendNotification);
valueEditor.addListener (this);
sourceEditor.setReadOnly (true);
@ -138,11 +140,17 @@ void LivePropertyEditorBase::resized()
Rectangle<int> top (left.removeFromTop (25));
resetButton.setBounds (top.removeFromRight (35).reduced (0, 3));
name.setBounds (top);
valueEditor.setBounds (left.removeFromTop (25));
left.removeFromTop (2);
if (customComp != nullptr)
{
valueEditor.setBounds (left.removeFromTop (25));
left.removeFromTop (2);
customComp->setBounds (left);
}
else
{
valueEditor.setBounds (left);
}
r.removeFromLeft (4);
sourceEditor.setBounds (r);

View file

@ -70,7 +70,7 @@ namespace LiveConstantEditor
template <typename Type>
inline String getAsCode (Type& v, bool preferHex) { return getAsString (v, preferHex); }
inline String getAsCode (Colour v, bool) { return "Colour (0x" + String::toHexString ((int) v.getARGB()).paddedLeft ('0', 8) + ")"; }
inline String getAsCode (const String& v, bool) { return "\"" + v + "\""; }
inline String getAsCode (const String& v, bool) { return CppTokeniserFunctions::addEscapeChars(v).quoted(); }
inline String getAsCode (const char* v, bool) { return getAsCode (String (v), false); }
template <typename Type>