1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-02 03:20:06 +00:00

Introjucer: minor internal refactoring

This commit is contained in:
jules 2015-09-18 18:29:11 +01:00
parent 6baf778e41
commit 416c8f3220
4 changed files with 12 additions and 11 deletions

View file

@ -103,9 +103,9 @@ void OpenDocumentManager::clear()
}
//==============================================================================
void OpenDocumentManager::registerType (DocumentType* type)
void OpenDocumentManager::registerType (DocumentType* type, int index)
{
types.add (type);
types.insert (index, type);
}
//==============================================================================

View file

@ -108,7 +108,7 @@ public:
virtual Document* openFile (Project* project, const File& file) = 0;
};
void registerType (DocumentType* type);
void registerType (DocumentType* type, int index = -1);
private:

View file

@ -697,9 +697,8 @@ public:
return SourceCodeDocument::createEditor();
}
class Type : public OpenDocumentManager::DocumentType
struct Type : public OpenDocumentManager::DocumentType
{
public:
Type() {}
bool canOpenFile (const File& f) override { return JucerDocument::isValidJucerCppFile (f); }

View file

@ -302,6 +302,11 @@ private:
static const Colour tabColour (Colour (0xff888888));
static SourceCodeEditor* createCodeEditor (const File& file, SourceCodeDocument& sourceCodeDoc)
{
return new SourceCodeEditor (&sourceCodeDoc,
new CppCodeEditorComponent (file, sourceCodeDoc.getCodeDocument()));
}
//==============================================================================
JucerDocumentEditor::JucerDocumentEditor (JucerDocument* const doc)
@ -330,11 +335,8 @@ JucerDocumentEditor::JucerDocumentEditor (JucerDocument* const doc)
tabbedComponent.addTab ("Resources", tabColour, new ResourceEditorPanel (*document), true);
SourceCodeEditor* codeEditor = new SourceCodeEditor (&document->getCppDocument(),
new CppCodeEditorComponent (document->getCppFile(),
document->getCppDocument().getCodeDocument()));
tabbedComponent.addTab ("Code", tabColour, codeEditor, true);
tabbedComponent.addTab ("Code", tabColour, createCodeEditor (document->getCppFile(),
document->getCppDocument()), true);
updateTabs();
@ -1088,7 +1090,7 @@ JucerDocumentEditor* JucerDocumentEditor::getActiveDocumentHolder()
ApplicationCommandInfo info (0);
ApplicationCommandTarget* target = IntrojucerApp::getCommandManager().getTargetForCommand (JucerCommandIDs::editCompLayout, info);
return dynamic_cast <JucerDocumentEditor*> (target);
return dynamic_cast<JucerDocumentEditor*> (target);
}
Image JucerDocumentEditor::createComponentLayerSnapshot() const