Skip to content

Commit cd0f361

Browse files
committed
Show text editor right-click menu when an object's editor is active (instead of the regular context menu)
1 parent 3b47cab commit cd0f361

7 files changed

Lines changed: 8 additions & 5 deletions

File tree

Source/Components/WelcomePanel.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,8 @@ class WelcomePanel final : public Component
845845
for (int i = recentlyOpenedTree.getNumChildren() - 1; i >= 0; i--) {
846846
auto subTree = recentlyOpenedTree.getChild(i);
847847
auto patchFile = File(subTree.getProperty("Path").toString());
848-
if (!File(patchFile).existsAsFile()) {
849-
if (!subTree.hasProperty("Removable")) {
850-
recentlyOpenedTree.removeChild(i, nullptr);
851-
}
848+
if (!File(patchFile).existsAsFile() && !subTree.hasProperty("Removable")) {
849+
recentlyOpenedTree.removeChild(i, nullptr);
852850
}
853851
}
854852

Source/Object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ void Object::mouseDown(MouseEvent const& e)
744744
{
745745
// Only show right-click menu in locked mode if the object can be opened
746746
// We don't allow alt+click for popupmenus here, as that will conflict with some object behaviour, like for [range.hsl]
747-
if (e.mods.isRightButtonDown() && !cnv->isGraph) {
747+
if (e.mods.isRightButtonDown() && !cnv->isGraph && !(gui && gui->isEditorShown())) {
748748
PopupMenu::dismissAllActiveMenus();
749749
if (!getValue<bool>(locked)) {
750750
if (!e.mods.isAnyModifierKeyDown() && !e.mods.isRightButtonDown())

Source/Objects/CommentObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class CommentObject final : public ObjectBase
106106
{
107107
if (editor == nullptr) {
108108
editor.reset(TextObjectHelper::createTextEditor(object, 15));
109+
editor->setLookAndFeel(&object->getLookAndFeel());
109110
editor->setColour(TextEditor::textColourId, cnv->editor->getLookAndFeel().findColour(PlugDataColour::commentTextColourId));
110111

111112
editor->setBorder(border.addedTo(BorderSize<int>(1, 0, 0, 0)));

Source/Objects/GraphOnParent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class GraphOnParent final : public ObjectBase {
116116
if (!getValue<bool>(hideNameAndArgs) && editor == nullptr) {
117117
editor.reset(TextObjectHelper::createTextEditor(object, 13));
118118

119+
editor->setLookAndFeel(&object->getLookAndFeel());
119120
editor->setBorder(BorderSize<int>(2, 5, 2, 1));
120121
editor->setBounds(getLocalBounds().removeFromTop(18));
121122
editor->setText(getText(), false);

Source/Objects/MessageObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class MessageObject final : public ObjectBase
211211
if (editor == nullptr) {
212212
editor.reset(TextObjectHelper::createTextEditor(object, 15));
213213

214+
editor->setLookAndFeel(&object->getLookAndFeel());
214215
editor->setBorder(border);
215216
editor->setBounds(getLocalBounds().withTrimmedRight(5));
216217
editor->setText(objectText, false);

Source/Objects/OpenFileObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class OpenFileObject final : public TextBase {
2727

2828
auto const font = editor->getFont();
2929
auto const textWidth = font.getStringWidth(objectText) + 20;
30+
editor->setLookAndFeel(&object->getLookAndFeel());
3031
editor->setBorder(border);
3132
editor->setBounds(getLocalBounds().withWidth(textWidth));
3233
object->setSize(textWidth + Object::doubleMargin, getHeight() + Object::doubleMargin);

Source/Objects/TextObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ class TextBase : public ObjectBase
401401
if (editor == nullptr) {
402402
editor.reset(TextObjectHelper::createTextEditor(object, 15));
403403

404+
editor->setLookAndFeel(&object->getLookAndFeel());
404405
editor->setBorder(border.addedTo(BorderSize<int>(0, 0, 1, 0)));
405406
editor->setBounds(getLocalBounds());
406407
editor->setText(objectText, false);

0 commit comments

Comments
 (0)