Skip to content

Commit 437d517

Browse files
committed
A few tweaks to layout support
1 parent 11d803f commit 437d517

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

modules/gin_gui/utilities/gin_layoutsupport.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,16 @@ void LayoutSupport::setLayout (const juce::String& rawJson)
445445
setLayoutInternal (files);
446446
}
447447

448+
void LayoutSupport::setLayouts (const juce::StringArray& rawJson)
449+
{
450+
juce::Array<JsonFile> files;
451+
452+
for (auto [n, j] : juce::enumerate (rawJson))
453+
files.add ({ juce::String::formatted ("raw%d", int (n)), j });
454+
455+
setLayoutInternal (files);
456+
}
457+
448458
void LayoutSupport::setLayoutInternal (const juce::Array<JsonFile>& files)
449459
{
450460
layoutSet = true;

modules/gin_gui/utilities/gin_layoutsupport.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ class LayoutSupport : private gin::FileSystemWatcher::Listener
312312
*/
313313
void setLayout (const juce::String& rawJson);
314314

315+
/**
316+
Load layout from several raw JSON string.
317+
318+
@param rawJson JSON strings containing layout definition
319+
*/
320+
void setLayouts (const juce::StringArray& rawJson);
321+
322+
315323
/**
316324
Set or update a constant value.
317325
@@ -320,11 +328,16 @@ class LayoutSupport : private gin::FileSystemWatcher::Listener
320328
*/
321329
void setConstant (const juce::String& name, int value);
322330

331+
/**
332+
Find a resource by name
333+
334+
*/
335+
juce::String findContent (const juce::String& name);
336+
323337
/** Callback invoked when layout is loaded or reloaded */
324338
std::function<void()> layoutChanged;
325339

326340
protected:
327-
juce::String findContent (const juce::String& name);
328341
juce::Component* getComp (const juce::String& cid);
329342

330343
juce::Component& parent;

0 commit comments

Comments
 (0)