Skip to content

Commit

Permalink
Cleaned up Pd fork repo, fixed warnings, fixed canvas title not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Nov 28, 2024
1 parent 20343e9 commit 2c18833
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Libraries/pure-data
4 changes: 2 additions & 2 deletions Source/Components/WelcomePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ class WelcomePanel : public Component
}

WelcomePanelTile(WelcomePanel& welcomePanel, String name, String subtitle, String svgImage, Colour iconColour, float scale, bool favourited, Image const& thumbImage = Image())
: parent(welcomePanel)
, isFavourited(favourited)
: isFavourited(favourited)
, parent(welcomePanel)
, snapshotScale(scale)
, tileName(name)
, tileSubtitle(subtitle)
Expand Down
2 changes: 1 addition & 1 deletion Source/Dialogs/Dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void Dialogs::showMultiChoiceDialog(std::unique_ptr<Dialog>* target, Component*

public:
MultiChoiceDialog(Dialog* dialog, String const& title, std::function<void(int)> const& callback, StringArray const& options, String const& icon)
: label("", title), icon(icon)
: icon(icon), label("", title)
{
auto attributedTitle = AttributedString(title);
attributedTitle.setJustification(Justification::horizontallyCentred);
Expand Down
10 changes: 5 additions & 5 deletions Source/Pd/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,12 @@ void Instance::initialisePd(String& pdlua_version)
t_canvas* glist = (t_canvas*)argv->a_w.w_gpointer;
auto* undoName = atom_getsymbol(argv + 1);
auto* redoName = atom_getsymbol(argv + 2);
bool isDirty = atom_getfloat(argv + 3);
MessageManager::callAsync([pd, glist, undoName, redoName, isDirty]() {
MessageManager::callAsync([pd, glist, undoName, redoName]() {
for(auto& patch : pd->patches)
{
if(patch->ptr.getRaw<t_canvas>() == glist)
{
patch->updateUndoRedoState(SmallString(undoName->s_name), SmallString(redoName->s_name), isDirty);
patch->updateUndoRedoState(SmallString(undoName->s_name), SmallString(redoName->s_name));
}
}
});
Expand All @@ -273,13 +272,14 @@ void Instance::initialisePd(String& pdlua_version)
auto* pd = static_cast<PluginProcessor*>(inst);
t_canvas* glist = (t_canvas*)argv->a_w.w_gpointer;
auto* title = atom_getsymbol(argv + 1);
int isDirty = atom_getfloat(argv + 2);

MessageManager::callAsync([pd, glist, title]() {
MessageManager::callAsync([pd, glist, title, isDirty]() {
for(auto& patch : pd->patches)
{
if(patch->ptr.getRaw<t_canvas>() == glist)
{
patch->updateTitle(SmallString(title->s_name));
patch->updateTitle(SmallString(title->s_name), isDirty);
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions Source/Pd/Patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool Patch::isSubpatch()
return false;
}

void Patch::updateUndoRedoState(SmallString undoName, SmallString redoName, bool dirty)
void Patch::updateUndoRedoState(SmallString undoName, SmallString redoName)
{
if(undoName == "props") undoName = "Change property";
if(redoName == "props") redoName = "Change property";
Expand All @@ -153,7 +153,6 @@ void Patch::updateUndoRedoState(SmallString undoName, SmallString redoName, bool
canPatchRedo = redoName != "no";
lastUndoSequence = undoName.substring(0, 1).toUpperCase() + undoName.substring(1);
lastRedoSequence = redoName.substring(0, 1).toUpperCase() + redoName.substring(1);
isPatchDirty = dirty;
}

void Patch::savePatch()
Expand Down Expand Up @@ -585,9 +584,10 @@ void Patch::redo()
}


void Patch::updateTitle(SmallString const& newTitle)
void Patch::updateTitle(SmallString const& newTitle, bool dirty)
{
title = newTitle;
isPatchDirty = dirty;
}

void Patch::updateTitle()
Expand Down
4 changes: 2 additions & 2 deletions Source/Pd/Patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Patch : public ReferenceCountedObject {

void setCurrentFile(URL const& newFile);

void updateUndoRedoState(SmallString undoName, SmallString redoName, bool isPatchDirty);
void updateUndoRedoState(SmallString undoName, SmallString redoName);

bool hasConnection(t_object* src, int nout, t_object* sink, int nin);
bool canConnect(t_object* src, int nout, t_object* sink, int nin);
Expand Down Expand Up @@ -118,7 +118,7 @@ class Patch : public ReferenceCountedObject {

static void reloadPatch(File const& changedPatch, t_glist* except);

void updateTitle(SmallString const& newTitle);
void updateTitle(SmallString const& newTitle, bool dirty);
void updateTitle();

String getTitle() const;
Expand Down
2 changes: 1 addition & 1 deletion Source/Sidebar/SearchPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class SearchPanel : public Component
patchTree.onClick = [this](ValueTree& tree) {
auto* ptr = reinterpret_cast<void*>(static_cast<int64>(tree.getProperty("Object")));
if (auto obj = editor->highlightSearchTarget(ptr, true)) {
auto launchInspector = [this, obj, ptr]() {
auto launchInspector = [this, obj]() {
SmallArray<ObjectParameters, 6> parameters = { obj->gui->getParameters() };
auto toShow = SmallArray<Component*>();
toShow.add(obj);
Expand Down

0 comments on commit 2c18833

Please sign in to comment.