Skip to content

Commit 5818076

Browse files
committed
Merge fixes
2 parents d77f797 + 400ce81 commit 5818076

26 files changed

+479
-274
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64
2121
set(ENABLE_SFIZZ OFF)
2222
endif()
2323

24+
# Sfizz doesn't want to compile on aarch64 linux here...
25+
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
26+
set(ENABLE_SFIZZ OFF)
27+
endif()
28+
2429
function(message)
2530
if (NOT MESSAGE_QUIET)
2631
_message(${ARGN})

Source/CanvasViewport.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class CanvasViewport : public Viewport {
4646
e.originalComponent->setMouseCursor(MouseCursor::DraggingHandCursor);
4747
downPosition = viewport->getViewPosition();
4848
downCanvasOrigin = viewport->cnv->canvasOrigin;
49+
50+
for (auto* object : viewport->cnv->objects)
51+
object->setBufferedToImage(true);
4952
}
5053

5154
void mouseDrag(MouseEvent const& e) override
@@ -59,6 +62,9 @@ class CanvasViewport : public Viewport {
5962
void mouseUp(MouseEvent const& e) override
6063
{
6164
e.originalComponent->setMouseCursor(MouseCursor::NormalCursor);
65+
for (auto* object : viewport->cnv->objects){
66+
object->setBufferedToImage(false);
67+
}
6268
}
6369

6470
private:

Source/Connection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ StringArray Connection::getMessageFormated()
504504
formatedMessage.add("symbol:");
505505
formatedMessage.add(String(args[0].getSymbol()));
506506
} else if (name == "list") {
507-
formatedMessage.add("list:");
507+
formatedMessage.add("list (" + String(args.size()) + "):");
508508
for (auto& arg : args) {
509509
if (arg.isFloat()) {
510510
formatedMessage.add(String(arg.getFloat()));

Source/Dialogs/AddObjectMenu.h

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
#pragma once
88
#include "Dialogs.h"
9+
#include "../Utility/ObjectDragAndDrop.h"
910

1011
#define DEBUG_PRINT_OBJECT_LIST 0
1112

12-
class ObjectItem : public Component
13+
class ObjectItem : public ObjectDragAndDrop
1314
, public SettableTooltipClient {
1415
public:
1516
ObjectItem(PluginEditor* e, String const& text, String const& icon, String const& tooltip, String const& patch, ObjectIDs objectID, std::function<void(bool)> dismissCalloutBox)
@@ -22,6 +23,11 @@ class ObjectItem : public Component
2223
setTooltip(tooltip.replace("(@keypress) ", getKeyboardShortcutDescription(objectID)));
2324
}
2425

26+
void dismiss(bool withAnimation) override
27+
{
28+
dismissMenu(withAnimation);
29+
}
30+
2531
String getKeyboardShortcutDescription(ObjectIDs objectID)
2632
{
2733
auto keyPresses = editor->getKeyMappings()->getKeyPressesAssignedToCommand(objectID);
@@ -65,31 +71,9 @@ class ObjectItem : public Component
6571
repaint();
6672
}
6773

68-
void mouseDrag(MouseEvent const& e) override
74+
String getObjectString()
6975
{
70-
if (e.getDistanceFromDragStart() < 5)
71-
return;
72-
73-
auto* dragContainer = ZoomableDragAndDropContainer::findParentDragContainerFor(this);
74-
75-
if (dragContainer->isDragAndDropActive())
76-
return;
77-
78-
auto patchWithTheme = substituteThemeColours(objectPatch);
79-
80-
auto scale = 2.0f;
81-
if (dragImage.image.isNull()) {
82-
auto offlineObjectRenderer = OfflineObjectRenderer::findParentOfflineObjectRendererFor(this);
83-
dragImage = offlineObjectRenderer->patchToTempImage(patchWithTheme, scale);
84-
}
85-
86-
dismissMenu(true);
87-
88-
Array<var> palettePatchWithOffset;
89-
palettePatchWithOffset.add(var(dragImage.offset.getX()));
90-
palettePatchWithOffset.add(var(dragImage.offset.getY()));
91-
palettePatchWithOffset.add(var(patchWithTheme));
92-
dragContainer->startDragging(palettePatchWithOffset, this, ScaledImage(dragImage.image, scale), true, nullptr, nullptr, true);
76+
return substituteThemeColours(objectPatch);
9377
}
9478

9579
void mouseUp(MouseEvent const& e) override
@@ -98,11 +82,6 @@ class ObjectItem : public Component
9882
dismissMenu(false);
9983
}
10084

101-
void lookAndFeelChanged() override
102-
{
103-
dragImage.image = Image();
104-
}
105-
10685
String substituteThemeColours(String patch)
10786
{
10887
auto colourToHex = [this](PlugDataColour colourEnum) {
@@ -142,7 +121,6 @@ class ObjectItem : public Component
142121
String titleText;
143122
String iconText;
144123
String objectPatch;
145-
ImageWithOffset dragImage;
146124
bool isHovering = false;
147125
std::function<void(bool)> dismissMenu;
148126
PluginEditor* editor;

Source/Dialogs/ConnectionMessageDisplay.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class ConnectionMessageDisplay
7676

7777
auto halfEditorWidth = getParentComponent()->getWidth() / 2;
7878
auto fontStyle = haveMessage ? FontStyle::Semibold : FontStyle::Regular;
79-
auto textFont = Font(haveMessage ? Fonts::getSemiBoldFont() : Fonts::getCurrentFont());
79+
auto textFont = Font(haveMessage ? Fonts::getSemiBoldFont() : Fonts::getDefaultFont());
8080
textFont.setSizeAndStyle(14, FontStyle::Regular, 1.0f, 0.0f);
8181

8282
int stringWidth;
@@ -103,10 +103,10 @@ class ConnectionMessageDisplay
103103

104104
messageItemsWithFormat.add(TextStringWithMetrics(stringItem, fontStyle, stringWidth));
105105

106-
if (fontStyle != FontStyle::Monospace) {
107-
// set up font for next item/s - use monospace for values / lists etc
108-
fontStyle = FontStyle::Monospace;
109-
textFont = Font(Fonts::getMonospaceFont());
106+
if (fontStyle != FontStyle::Regular) {
107+
// set up font for next item/s -regular font to support extended character
108+
fontStyle = FontStyle::Regular;
109+
textFont = Font(Fonts::getDefaultFont());
110110
}
111111
}
112112

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#include <JuceHeader.h>
2+
#include "ListBoxObjectItem.h"
3+
#include "ObjectBrowserDialog.h"
4+
5+
ListBoxObjectItem::ListBoxObjectItem(ObjectsListBox* parent, int rowNumber, bool isSelected, std::function<void(bool shouldFade)> dismissDialog)
6+
: row(rowNumber)
7+
, rowIsSelected(isSelected)
8+
, objectsListBox(parent)
9+
, dismissMenu(dismissDialog)
10+
{
11+
objectName = parent->objects[rowNumber];
12+
objectDescription = parent->descriptions[objectName];
13+
}
14+
15+
void ListBoxObjectItem::paint(juce::Graphics& g)
16+
{
17+
if (rowIsSelected || mouseHover) {
18+
auto colour = findColour(PlugDataColour::panelActiveBackgroundColourId);
19+
if (mouseHover && !rowIsSelected)
20+
colour = colour.withAlpha(0.5f);
21+
22+
g.setColour(colour);
23+
g.fillRoundedRectangle(getLocalBounds().reduced(4, 2).toFloat(), Corners::defaultCornerRadius);
24+
//g.fillRoundedRectangle({ 4.0f, 1.0f, getWidth() - 8.0f, getHeight() - 2.0f }, Corners::defaultCornerRadius);
25+
}
26+
27+
auto colour = rowIsSelected ? findColour(PlugDataColour::panelActiveTextColourId) : findColour(PlugDataColour::panelTextColourId);
28+
29+
auto textBounds = Rectangle<int>(0, 0, getWidth(), getHeight()).reduced(18, 6);
30+
31+
Fonts::drawStyledText(g, objectName, textBounds.removeFromTop(textBounds.proportionOfHeight(0.5f)), colour, Bold, 14);
32+
33+
Fonts::drawText(g, objectDescription, textBounds, colour, 14);
34+
}
35+
36+
bool ListBoxObjectItem::hitTest(int x, int y)
37+
{
38+
auto bounds = getLocalBounds().reduced(4, 2);
39+
return bounds.contains(x, y);
40+
}
41+
42+
void ListBoxObjectItem::mouseEnter(MouseEvent const& e)
43+
{
44+
mouseHover = true;
45+
repaint();
46+
}
47+
48+
void ListBoxObjectItem::mouseExit(MouseEvent const& e)
49+
{
50+
mouseHover = false;
51+
repaint();
52+
}
53+
54+
void ListBoxObjectItem::mouseDown(MouseEvent const& e)
55+
{
56+
objectsListBox->selectRow(row, true, true);
57+
}
58+
59+
void ListBoxObjectItem::mouseUp(MouseEvent const& e)
60+
{
61+
if (e.mouseWasDraggedSinceMouseDown())
62+
dismissMenu(false);
63+
}
64+
65+
void ListBoxObjectItem::dismiss(bool withAnimation)
66+
{
67+
dismissMenu(withAnimation);
68+
}
69+
70+
String ListBoxObjectItem::getObjectString()
71+
{
72+
return "#X obj 0 0 " + objectName;
73+
}
74+
75+
String ListBoxObjectItem::getItemName() const
76+
{
77+
return objectName;
78+
}
79+
80+
void ListBoxObjectItem::refresh(String name, String description, int rowNumber, bool isSelected)
81+
{
82+
objectName = name;
83+
objectDescription = description;
84+
row = rowNumber;
85+
rowIsSelected = isSelected;
86+
repaint();
87+
}

Source/Dialogs/ListBoxObjectItem.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#pragma once
2+
3+
#include "../Utility/ObjectDragAndDrop.h"
4+
5+
class ObjectsListBox;
6+
class ListBoxObjectItem : public ObjectDragAndDrop
7+
{
8+
public:
9+
ListBoxObjectItem(ObjectsListBox* parent, int rowNumber, bool isSelected, std::function<void(bool shouldFade)> dismissDialog);
10+
11+
void paint(juce::Graphics& g) override;
12+
13+
bool hitTest(int x, int y);
14+
15+
void mouseDown(MouseEvent const& e) override;
16+
void mouseUp(MouseEvent const& e) override;
17+
void mouseEnter(MouseEvent const& e) override;
18+
void mouseExit(MouseEvent const& e) override;
19+
20+
String getItemName() const;
21+
22+
String getObjectString() override;
23+
void dismiss(bool withAnimation) override;
24+
25+
void refresh(String objectName, String objectDescription, int rowNumber, bool isSelected);
26+
27+
private:
28+
int row;
29+
String objectName;
30+
String objectDescription;
31+
bool rowIsSelected = false;
32+
ObjectsListBox* objectsListBox;
33+
34+
bool mouseHover = false;
35+
36+
std::function<void(bool shouldFade)> dismissMenu;
37+
};

0 commit comments

Comments
 (0)