diff --git a/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp b/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp index b01e22a961..63610a7593 100644 --- a/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp +++ b/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.cpp @@ -198,8 +198,9 @@ bool OpenDocumentManager::closeDocument (int index, bool saveIfNeeded) bool canClose = true; for (int i = listeners.size(); --i >= 0;) - if (! listeners.getUnchecked(i)->documentAboutToClose (doc)) - canClose = false; + if (DocumentCloseListener* l = listeners[i]) + if (! l->documentAboutToClose (doc)) + canClose = false; if (! canClose) return false; @@ -219,12 +220,9 @@ bool OpenDocumentManager::closeDocument (Document* document, bool saveIfNeeded) void OpenDocumentManager::closeFile (const File& f, bool saveIfNeeded) { for (int i = documents.size(); --i >= 0;) - { - Document* d = documents.getUnchecked (i); - - if (d->isForFile (f)) - closeDocument (i, saveIfNeeded); - } + if (Document* d = documents[i]) + if (d->isForFile (f)) + closeDocument (i, saveIfNeeded); } bool OpenDocumentManager::closeAll (bool askUserToSave) @@ -239,15 +237,10 @@ bool OpenDocumentManager::closeAll (bool askUserToSave) bool OpenDocumentManager::closeAllDocumentsUsingProject (Project& project, bool saveIfNeeded) { for (int i = documents.size(); --i >= 0;) - { - Document* d = documents.getUnchecked (i); - - if (d->refersToProject (project)) - { - if (! closeDocument (i, saveIfNeeded)) - return false; - } - } + if (Document* d = documents[i]) + if (d->refersToProject (project)) + if (! closeDocument (i, saveIfNeeded)) + return false; return true; } @@ -255,12 +248,8 @@ bool OpenDocumentManager::closeAllDocumentsUsingProject (Project& project, bool bool OpenDocumentManager::anyFilesNeedSaving() const { for (int i = documents.size(); --i >= 0;) - { - Document* d = documents.getUnchecked (i); - - if (d->needsSaving()) + if (documents.getUnchecked (i)->needsSaving()) return true; - } return false; } @@ -268,12 +257,8 @@ bool OpenDocumentManager::anyFilesNeedSaving() const bool OpenDocumentManager::saveAll() { for (int i = documents.size(); --i >= 0;) - { - Document* d = documents.getUnchecked (i); - - if (! d->save()) + if (! documents.getUnchecked (i)->save()) return false; - } return true; } diff --git a/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.h b/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.h index 2a4750c1d3..77ba65b5a6 100644 --- a/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.h +++ b/extras/Introjucer/Source/Application/jucer_OpenDocumentManager.h @@ -112,9 +112,9 @@ public: private: - OwnedArray types; - OwnedArray documents; - Array listeners; + OwnedArray types; + OwnedArray documents; + Array listeners; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenDocumentManager) }; @@ -146,7 +146,7 @@ public: private: bool documentAboutToClose (OpenDocumentManager::Document*); - Array previousDocs, nextDocs; + Array previousDocs, nextDocs; }; diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_ButtonHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_ButtonHandler.h index 4a308f5599..4a520ed465 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_ButtonHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_ButtonHandler.h @@ -80,9 +80,9 @@ public: return true; } - String getCreationParameters (Component* component) + String getCreationParameters (GeneratedCode& code, Component* component) { - return quotedString (component->getName()); + return quotedString (component->getName(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) @@ -95,7 +95,7 @@ public: { code.constructorCode << memberVariableName << "->setButtonText (" - << quotedString (b->getButtonText()) << ");\n"; + << quotedString (b->getButtonText(), code.shouldUseTransMacro()) << ");\n"; } if (b->getConnectedEdgeFlags() != 0) diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComboBoxHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComboBoxHandler.h index c405b6d77a..5e4e22a36b 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComboBoxHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComboBoxHandler.h @@ -85,9 +85,9 @@ public: props.add (new ComboTextWhenNoItemsProperty (c, document)); } - String getCreationParameters (Component* component) + String getCreationParameters (GeneratedCode& code, Component* component) { - return quotedString (component->getName()); + return quotedString (component->getName(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) @@ -100,8 +100,8 @@ public: String s; s << memberVariableName << "->setEditableText (" << CodeHelpers::boolLiteral (c->isTextEditable()) << ");\n" << memberVariableName << "->setJustificationType (" << CodeHelpers::justificationToCode (c->getJustificationType()) << ");\n" - << memberVariableName << "->setTextWhenNothingSelected (" << quotedString (c->getTextWhenNothingSelected()) << ");\n" - << memberVariableName << "->setTextWhenNoChoicesAvailable (" << quotedString (c->getTextWhenNoChoicesAvailable()) << ");\n"; + << memberVariableName << "->setTextWhenNothingSelected (" << quotedString (c->getTextWhenNothingSelected(), code.shouldUseTransMacro()) << ");\n" + << memberVariableName << "->setTextWhenNoChoicesAvailable (" << quotedString (c->getTextWhenNoChoicesAvailable(), code.shouldUseTransMacro()) << ");\n"; StringArray lines; lines.addLines (c->getProperties() ["items"].toString()); @@ -113,7 +113,7 @@ public: s << memberVariableName << "->addSeparator();\n"; else s << memberVariableName << "->addItem (" - << quotedString (lines[i]) << ", " << itemId++ << ");\n"; + << quotedString (lines[i], code.shouldUseTransMacro()) << ", " << itemId++ << ");\n"; } if (needsCallback (component)) diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp index ae8b611911..a7af6e8d2e 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.cpp @@ -522,14 +522,14 @@ void ComponentTypeHandler::fillInResizeCode (GeneratedCode& code, Component* com code.getCallbackCode (String::empty, "void", "resized()", false) += r; } -String ComponentTypeHandler::getCreationParameters (Component*) +String ComponentTypeHandler::getCreationParameters (GeneratedCode&, Component*) { return String::empty; } void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) { - String params (getCreationParameters (component)); + String params (getCreationParameters (code, component)); const String virtualName (component->getProperties() ["virtualName"].toString()); String s; @@ -557,7 +557,7 @@ void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* c if (ttc->getTooltip().isNotEmpty()) { s << memberVariableName << "->setTooltip (" - << quotedString (ttc->getTooltip()) + << quotedString (ttc->getTooltip(), code.shouldUseTransMacro()) << ");\n"; } } diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.h index c994f46435..72080e3c06 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_ComponentTypeHandler.h @@ -99,11 +99,11 @@ public: virtual void fillInGeneratedCode (Component* component, GeneratedCode& code); - virtual void fillInMemberVariableDeclarations (GeneratedCode& code, Component* component, const String& memberVariableName); - virtual void fillInResizeCode (GeneratedCode& code, Component* component, const String& memberVariableName); - virtual void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName); - virtual String getCreationParameters (Component* component); - virtual void fillInDeletionCode (GeneratedCode& code, Component* component, const String& memberVariableName); + virtual void fillInMemberVariableDeclarations (GeneratedCode&, Component*, const String& memberVariableName); + virtual void fillInResizeCode (GeneratedCode&, Component*, const String& memberVariableName); + virtual void fillInCreationCode (GeneratedCode&, Component*, const String& memberVariableName); + virtual String getCreationParameters (GeneratedCode&, Component*); + virtual void fillInDeletionCode (GeneratedCode&, Component*, const String& memberVariableName); //============================================================================== const String& getTypeName() const noexcept { return typeName; } @@ -136,8 +136,7 @@ protected: OwnedArray colours; private: - ComponentTypeHandler (const ComponentTypeHandler&); - ComponentTypeHandler& operator= (const ComponentTypeHandler&); + JUCE_DECLARE_NON_COPYABLE (ComponentTypeHandler) }; diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_GenericComponentHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_GenericComponentHandler.h index 5322bf4e5d..3d0b94395f 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_GenericComponentHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_GenericComponentHandler.h @@ -107,12 +107,12 @@ public: String getClassName (Component* comp) const { - return ((GenericComponent*) comp)->actualClassName; + return static_cast (comp)->actualClassName; } - String getCreationParameters (Component* comp) + String getCreationParameters (GeneratedCode&, Component* comp) { - return ((GenericComponent*) comp)->constructorParams; + return static_cast (comp)->constructorParams; } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) @@ -122,7 +122,7 @@ public: if (component->getName().isNotEmpty()) code.constructorCode << memberVariableName << "->setName (" - << quotedString (component->getName()) + << quotedString (component->getName(), code.shouldUseTransMacro()) << ");\n\n"; else code.constructorCode << "\n"; diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_GroupComponentHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_GroupComponentHandler.h index c166d09e55..deeaed7c0a 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_GroupComponentHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_GroupComponentHandler.h @@ -65,13 +65,13 @@ public: return true; } - String getCreationParameters (Component* component) + String getCreationParameters (GeneratedCode& code, Component* component) { GroupComponent* g = dynamic_cast (component); - return quotedString (component->getName()) + return quotedString (component->getName(), code.shouldUseTransMacro()) + ",\n" - + quotedString (g->getText()); + + quotedString (g->getText(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_HyperlinkButtonHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_HyperlinkButtonHandler.h index 21951542f0..dd8d23c80e 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_HyperlinkButtonHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_HyperlinkButtonHandler.h @@ -67,13 +67,13 @@ public: return true; } - String getCreationParameters (Component* comp) + String getCreationParameters (GeneratedCode& code, Component* comp) { HyperlinkButton* const hb = dynamic_cast (comp); - return quotedString (hb->getButtonText()) + return quotedString (hb->getButtonText(), code.shouldUseTransMacro()) + ",\nURL (" - + quotedString (hb->getURL().toString (false)) + + quotedString (hb->getURL().toString (false), code.shouldUseTransMacro()) + ")"; } diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_JucerComponentHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_JucerComponentHandler.h index a039004d3b..3a2a33cd4c 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_JucerComponentHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_JucerComponentHandler.h @@ -98,12 +98,11 @@ public: props.add (new JucerCompOpenDocProperty (tc)); } - String getCreationParameters (Component* component) + String getCreationParameters (GeneratedCode&, Component* component) { - TestComponent* const tc = dynamic_cast (component); - - return tc->getConstructorParams().trim(); + return dynamic_cast (component)->getConstructorParams().trim(); } + void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) { ComponentTypeHandler::fillInCreationCode (code, component, memberVariableName); diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_LabelHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_LabelHandler.h index cd76044b11..93f74eb459 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_LabelHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_LabelHandler.h @@ -97,13 +97,13 @@ public: label->setFont (f); } - String getCreationParameters (Component* component) + String getCreationParameters (GeneratedCode& code, Component* component) { Label* const l = dynamic_cast (component); - return quotedString (component->getName()) + return quotedString (component->getName(), code.shouldUseTransMacro()) + ",\n" - + quotedString (l->getText()); + + quotedString (l->getText(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_SliderHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_SliderHandler.h index a2e5bedbda..514f794de4 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_SliderHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_SliderHandler.h @@ -85,9 +85,9 @@ public: return true; } - String getCreationParameters (Component* component) + String getCreationParameters (GeneratedCode& code, Component* component) { - return quotedString (component->getName()); + return quotedString (component->getName(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h index d507c3e1aa..f1a09da8df 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_TabbedComponentHandler.h @@ -134,7 +134,7 @@ public: } } - String getCreationParameters (Component* comp) + String getCreationParameters (GeneratedCode&, Component* comp) { TabbedComponent* const t = dynamic_cast (comp); @@ -184,7 +184,7 @@ public: code.constructorCode << memberVariableName << "->addTab (" - << quotedString (t->getTabNames() [i]) + << quotedString (t->getTabNames() [i], code.shouldUseTransMacro()) << ", " << CodeHelpers::colourToCode (t->getTabBackgroundColour (i)); diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_TextEditorHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_TextEditorHandler.h index 6c5ee79162..e4a10c8573 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_TextEditorHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_TextEditorHandler.h @@ -96,9 +96,9 @@ public: addColourProperties (t, document, props); } - String getCreationParameters (Component* component) + String getCreationParameters (GeneratedCode& code, Component* component) { - return quotedString (component->getName()); + return quotedString (component->getName(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) @@ -116,7 +116,7 @@ public: << memberVariableName << "->setCaretVisible (" << CodeHelpers::boolLiteral (te->isCaretVisible()) << ");\n" << memberVariableName << "->setPopupMenuEnabled (" << CodeHelpers::boolLiteral (te->isPopupMenuEnabled()) << ");\n" << getColourIntialisationCode (component, memberVariableName) - << memberVariableName << "->setText (" << quotedString (te->getProperties() ["initialText"].toString()) << ");\n\n"; + << memberVariableName << "->setText (" << quotedString (te->getProperties() ["initialText"].toString(), code.shouldUseTransMacro()) << ");\n\n"; code.constructorCode += s; } diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_TreeViewHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_TreeViewHandler.h index 63a8ac460c..bcfe933cb5 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_TreeViewHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_TreeViewHandler.h @@ -73,9 +73,9 @@ public: addColourProperties (t, document, props); } - String getCreationParameters (Component* comp) + String getCreationParameters (GeneratedCode& code, Component* comp) { - return quotedString (comp->getName()); + return quotedString (comp->getName(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) diff --git a/extras/Introjucer/Source/ComponentEditor/components/jucer_ViewportHandler.h b/extras/Introjucer/Source/ComponentEditor/components/jucer_ViewportHandler.h index b2221e86b3..6d1c08a477 100644 --- a/extras/Introjucer/Source/ComponentEditor/components/jucer_ViewportHandler.h +++ b/extras/Introjucer/Source/ComponentEditor/components/jucer_ViewportHandler.h @@ -97,9 +97,9 @@ public: } } - String getCreationParameters (Component* comp) + String getCreationParameters (GeneratedCode& code, Component* comp) { - return quotedString (comp->getName()); + return quotedString (comp->getName(), code.shouldUseTransMacro()); } void fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) diff --git a/extras/Introjucer/Source/ComponentEditor/documents/jucer_ButtonDocument.cpp b/extras/Introjucer/Source/ComponentEditor/documents/jucer_ButtonDocument.cpp index 987cb08a1d..a0635bb46a 100644 --- a/extras/Introjucer/Source/ComponentEditor/documents/jucer_ButtonDocument.cpp +++ b/extras/Introjucer/Source/ComponentEditor/documents/jucer_ButtonDocument.cpp @@ -318,7 +318,7 @@ void ButtonDocument::fillInGeneratedCode (GeneratedCode& code) const { JucerDocument::fillInGeneratedCode (code); - code.parentClassInitialiser = "Button (" + quotedString (code.componentName) + ")"; + code.parentClassInitialiser = "Button (" + quotedString (code.componentName, shouldUseTransMacro()) + ")"; code.removeCallback ("void", "paint (Graphics& g)"); } diff --git a/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.cpp b/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.cpp index d6db35cf89..634be514d0 100644 --- a/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.cpp +++ b/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.cpp @@ -24,7 +24,7 @@ #include "../jucer_Headers.h" #include "jucer_GeneratedCode.h" - +#include "jucer_JucerDocument.h" //============================================================================== GeneratedCode::GeneratedCode (const JucerDocument* const doc) @@ -229,6 +229,11 @@ static String getIncludeFileCode (StringArray files) return s; } +bool GeneratedCode::shouldUseTransMacro() const noexcept +{ + return document->shouldUseTransMacro(); +} + //============================================================================== static void replaceTemplate (String& text, const String& itemName, const String& value) { @@ -297,11 +302,10 @@ static void copyAcrossUserSections (String& dest, const String& src) if (getUserSection (srcLines, tag, sourceLines)) { - int j; - for (j = endLine - i; --j > 0;) + for (int j = endLine - i; --j > 0;) dstLines.remove (i + 1); - for (j = 0; j < sourceLines.size(); ++j) + for (int j = 0; j < sourceLines.size(); ++j) dstLines.insert (++i, sourceLines [j].trimEnd()); ++i; diff --git a/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.h b/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.h index 030939c431..8540a9ef51 100644 --- a/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.h +++ b/extras/Introjucer/Source/ComponentEditor/jucer_GeneratedCode.h @@ -88,6 +88,8 @@ public: String getCallbackDefinitions() const; StringArray getExtraParentClasses() const; + bool shouldUseTransMacro() const noexcept; + private: String getClassDeclaration() const; String getInitialiserList() const; diff --git a/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.cpp b/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.cpp index d491754d49..45b04e26ef 100644 --- a/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.cpp +++ b/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.cpp @@ -426,7 +426,7 @@ void JucerDocument::fillInGeneratedCode (GeneratedCode& code) const code.initialisers.addLines (variableInitialisers); if (! componentName.isEmpty()) - code.constructorCode << "setName (" + quotedString (componentName) + ");\n"; + code.constructorCode << "setName (" + quotedString (componentName, shouldUseTransMacro()) + ");\n"; // call these now, just to make sure they're the first two methods in the list. code.getCallbackCode (String::empty, "void", "paint (Graphics& g)", false) diff --git a/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.h b/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.h index 790c2d82d9..7e206fcff4 100644 --- a/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.h +++ b/extras/Introjucer/Source/ComponentEditor/jucer_JucerDocument.h @@ -133,6 +133,8 @@ public: String getTemplateFile() const { return templateFile; } void setTemplateFile (const String&); + static bool shouldUseTransMacro() noexcept { return true; } + protected: SourceCodeDocument* cpp; diff --git a/extras/Introjucer/Source/ComponentEditor/jucer_UtilityFunctions.h b/extras/Introjucer/Source/ComponentEditor/jucer_UtilityFunctions.h index 6a7c1275a0..ba52f86422 100644 --- a/extras/Introjucer/Source/ComponentEditor/jucer_UtilityFunctions.h +++ b/extras/Introjucer/Source/ComponentEditor/jucer_UtilityFunctions.h @@ -25,7 +25,7 @@ #ifndef __JUCER_UTILITYFUNCTIONS_JUCEHEADER__ #define __JUCER_UTILITYFUNCTIONS_JUCEHEADER__ -inline String quotedString (const String& s) +inline String quotedString (const String& s, bool wrapInTransMacro) { const int embeddedIndex = s.indexOfIgnoreCase ("%%"); @@ -48,18 +48,23 @@ inline String quotedString (const String& s) String result; if (s1.isNotEmpty()) - result << quotedString (s1) << " + "; + result << quotedString (s1, wrapInTransMacro) << " + "; result << code; if (s2.isNotEmpty()) - result << " + " << quotedString (s2); + result << " + " << quotedString (s2, wrapInTransMacro); return result; } } - return CodeHelpers::stringLiteral (s); + String lit (CodeHelpers::stringLiteral (s)); + + if (wrapInTransMacro && lit.startsWithChar ('"')) + return "TRANS(" + lit + ")"; + + return lit; } inline String castToFloat (const String& expression) diff --git a/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementText.h b/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementText.h index d700ee594c..69f8ebe5a8 100644 --- a/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementText.h +++ b/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementText.h @@ -91,7 +91,7 @@ public: r << "g.setFont (" << FontPropertyComponent::getCompleteFontCode (font, typefaceName) << ");\ng.drawText (" - << quotedString (text) + << quotedString (text, code.shouldUseTransMacro()) << ",\n " << x << ", " << y << ", " << w << ", " << h << ",\n "