Browse Source

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

tags/2021-05-28
jules 11 years ago
parent
commit
4a3c45e7bd
3 changed files with 12 additions and 5 deletions
  1. +1
    -2
      modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp
  2. +10
    -2
      modules/juce_gui_extra/misc/juce_LiveConstantEditor.cpp
  3. +1
    -1
      modules/juce_gui_extra/misc/juce_LiveConstantEditor.h

+ 1
- 2
modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp 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);


+ 10
- 2
modules/juce_gui_extra/misc/juce_LiveConstantEditor.cpp 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);


+ 1
- 1
modules/juce_gui_extra/misc/juce_LiveConstantEditor.h 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>


Loading…
Cancel
Save