mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
CodeEditorComponent rendering improvements. Faster OSX font lookup.
This commit is contained in:
parent
a7b0ec0678
commit
4b128378cf
9 changed files with 75 additions and 70 deletions
|
|
@ -46,8 +46,7 @@ CodeDocument& SourceCodeDocument::getCodeDocument()
|
|||
|
||||
Component* SourceCodeDocument::createEditor()
|
||||
{
|
||||
SourceCodeEditor* e = new SourceCodeEditor (this);
|
||||
e->createEditor (getCodeDocument());
|
||||
SourceCodeEditor* e = new SourceCodeEditor (this, getCodeDocument());
|
||||
applyLastState (*(e->editor));
|
||||
return e;
|
||||
}
|
||||
|
|
@ -114,9 +113,21 @@ void SourceCodeDocument::applyLastState (CodeEditorComponent& editor) const
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* doc)
|
||||
SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* doc, CodeDocument& codeDocument)
|
||||
: DocumentEditorComponent (doc)
|
||||
{
|
||||
setOpaque (true);
|
||||
|
||||
if (document->getFile().hasFileExtension (sourceOrHeaderFileExtensions))
|
||||
setEditor (new CppCodeEditorComponent (document->getFile(), codeDocument));
|
||||
else
|
||||
setEditor (new GenericCodeEditorComponent (document->getFile(), codeDocument, nullptr));
|
||||
}
|
||||
|
||||
SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* doc, CodeEditorComponent* ed)
|
||||
: DocumentEditorComponent (doc)
|
||||
{
|
||||
setEditor (ed);
|
||||
}
|
||||
|
||||
SourceCodeEditor::~SourceCodeEditor()
|
||||
|
|
@ -130,14 +141,6 @@ SourceCodeEditor::~SourceCodeEditor()
|
|||
doc->updateLastState (*editor);
|
||||
}
|
||||
|
||||
void SourceCodeEditor::createEditor (CodeDocument& codeDocument)
|
||||
{
|
||||
if (document->getFile().hasFileExtension (sourceOrHeaderFileExtensions))
|
||||
setEditor (new CppCodeEditorComponent (document->getFile(), codeDocument));
|
||||
else
|
||||
setEditor (new GenericCodeEditorComponent (document->getFile(), codeDocument, nullptr));
|
||||
}
|
||||
|
||||
void SourceCodeEditor::setEditor (CodeEditorComponent* newEditor)
|
||||
{
|
||||
if (editor != nullptr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue