2
0
Эх сурвалжийг харах

Added some syntax highlighting themes by forum user AnTiArT. Fixed memory leaks when closing entity editor and mesh viewer projects

Ivan Safrin 12 жил өмнө
parent
commit
f4bec10b9a

+ 0 - 1
IDE/Contents/Include/PolycodeEntityEditor.h

@@ -313,7 +313,6 @@ class PolycodeEntityEditor : public PolycodeEditor {
     
         SceneEntityInstance *loadedInstance;
 		UIHSizer *mainSizer;
-        UIVSizer *rightSizer;
     
     
 };

+ 17 - 0
IDE/Contents/Resources/SyntaxThemes/deutera.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<syntaxTheme useStrongHinting="false">
+	<bgColor r="28" g="28" b="28"/>
+	<cursorColor r="255" g="255" b="255"/>
+	<selectionColor r="60" g="60" b="60"/>
+	<lineNumberColor r="131" g="131" b="131"/>
+	<textColors>
+		<color r="227" g="227" b="227"/>
+		<color r="131" g="131" b="131"/>	
+		<color r="255" g="211" b="146"/>
+		<color r="250" g="186" b="1"/>
+		<color r="144" g="108" b="0"/>
+		<color r="127" g="169" b="255"/>
+		<color r="0" g="82" b="174"/>		
+		<color r="20" g="46" b="75"/>		
+	</textColors>
+</syntaxTheme>

+ 17 - 0
IDE/Contents/Resources/SyntaxThemes/forst.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<syntaxTheme useStrongHinting="false">
+	<bgColor r="17" g="10" b="1"/>
+	<cursorColor r="248" g="247" b="124"/>
+	<selectionColor r="4" g="51" b="18"/>
+	<lineNumberColor r="136" g="97" b="68"/>
+	<textColors>
+		<color r="19" g="106" b="19"/>
+		<color r="78" g="57" b="46"/>	
+		<color r="115" g="61" b="13"/>
+		<color r="94" g="148" b="0"/>
+		<color r="111" g="236" b="28"/>
+		<color r="143" g="135" b="0"/>		
+		<color r="173" g="207" b="14"/>
+		<color r="0" g="0" b="0"/>		
+	</textColors>
+</syntaxTheme>

+ 17 - 0
IDE/Contents/Resources/SyntaxThemes/gold.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<syntaxTheme useStrongHinting="false">
+	<bgColor r="36" g="23" b="17"/>
+	<cursorColor r="255" g="255" b="255"/>
+	<selectionColor r="65" g="53" b="47"/>
+	<lineNumberColor r="97" g="84" b="77"/>
+	<textColors>
+		<color r="252" g="247" b="183"/>
+		<color r="131" g="80" b="63"/>	
+		<color r="220" g="174" b="35"/>
+		<color r="252" g="225" b="84"/>
+		<color r="181" g="92" b="2"/>
+		<color r="255" g="255" b="255"/>		
+		<color r="215" g="138" b="18"/>
+		<color r="0" g="0" b="0"/>		
+	</textColors>
+</syntaxTheme>

+ 17 - 0
IDE/Contents/Resources/SyntaxThemes/orchiday.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<syntaxTheme useStrongHinting="false">
+	<bgColor r="255" g="252" b="215"/>
+	<cursorColor r="14" g="77" b="17"/>
+	<selectionColor r="248" g="215" b="226"/>
+	<lineNumberColor r="248" g="215" b="226"/>
+	<textColors>
+		<color r="34" g="123" b="6"/>
+		<color r="98" g="133" b="93"/>	
+		<color r="14" g="77" b="17"/>
+		<color r="129" g="152" b="3"/>
+		<color r="166" g="3" b="107"/>
+		<color r="215" g="67" b="192"/>		
+		<color r="193" g="5" b="94"/>
+		<color r="0" g="0" b="0"/>		
+	</textColors>
+</syntaxTheme>

+ 17 - 0
IDE/Contents/Resources/SyntaxThemes/scriptorum.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<syntaxTheme useStrongHinting="false">
+	<bgColor r="208" g="204" b="192"/>
+	<cursorColor r="20" g="14" b="15"/>
+	<selectionColor r="177" g="172" b="159"/>
+	<lineNumberColor r="247" g="239" b="140"/>
+	<textColors>
+		<color r="29" g="20" b="21"/>
+		<color r="116" g="99" b="87"/>	
+		<color r="111" g="46" b="33"/>
+		<color r="177" g="60" b="40"/>
+		<color r="22" g="46" b="124"/>
+		<color r="142" g="113" b="14"/>
+		<color r="25" g="71" b="203"/>
+		<color r="70" g="139" b="120"/>		
+	</textColors>
+</syntaxTheme>

+ 17 - 0
IDE/Contents/Resources/SyntaxThemes/toybox.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<syntaxTheme useStrongHinting="false">
+	<bgColor r="239" g="239" b="222"/>
+	<cursorColor r="0" g="0" b="0"/>
+	<selectionColor r="254" g="254" b="78"/>
+	<lineNumberColor r="254" g="254" b="78"/>
+	<textColors>
+		<color r="217" g="38" b="9"/>
+		<color r="184" g="186" b="7"/>	
+		<color r="9" g="162" b="164"/>
+		<color r="222" g="135" b="0"/>
+		<color r="196" g="13" b="194"/>
+		<color r="59" g="143" b="3"/>		
+		<color r="45" g="25" b="213"/>
+		<color r="0" g="0" b="0"/>		
+	</textColors>
+</syntaxTheme>

+ 2 - 0
IDE/Contents/Source/EntityEditorPropertyView.cpp

@@ -175,4 +175,6 @@ void EntityEditorPropertyView::setEntity(Entity *entity) {
 }
 
 EntityEditorPropertyView::~EntityEditorPropertyView() {
+    entityProps->setOwnsChildrenRecursive(true);
+    delete entityProps;
 }

+ 14 - 7
IDE/Contents/Source/PolycodeEntityEditor.cpp

@@ -309,11 +309,11 @@ EntityEditorMainView::EntityEditorMainView(PolycodeEditor *editor) {
     objectRootInstance = NULL;
     lightsDisabled = false;
     beforeData = NULL;
+    setOwnsChildrenRecursive(true);
     
     this->editor = editor;
-
 	mainScene = new Scene(Scene::SCENE_3D, true);
-
+    
 	renderTexture = new SceneRenderTexture(mainScene, mainScene->getDefaultCamera(), 512, 512);
 	mainScene->clearColor.setColor(0.2, 0.2, 0.2, 1.0);	
 	mainScene->useClearColor = true;
@@ -1391,11 +1391,11 @@ void EntityEditorMainView::setObjectRoot(SceneEntityInstance *entity) {
 EntityEditorMainView::~EntityEditorMainView() {
     delete mainScene;
     delete renderTexture;
-    delete transformGizmo;
-    delete transformGizmoMenu;
-    delete trackballCamera;
-    delete grid;
-    delete cameraPreview;
+//    delete transformGizmo;
+//    delete transformGizmoMenu;
+//    delete trackballCamera;
+//    delete grid;
+//    delete cameraPreview;
     input->removeAllHandlersForListener(this);
 }
 
@@ -1541,7 +1541,14 @@ void PolycodeEntityEditor::doAction(String actionName, PolycodeEditorActionData
 }
 
 PolycodeEntityEditor::~PolycodeEntityEditor() {
+    mainView->getMainScene()->rootEntity.setOwnsChildrenRecursive(true);
     delete mainView;
+    delete propertyView;
+    delete treeView;
+    delete settingsView;
+    
+    delete propertyContainer;
+    delete mainSizer;
 }
 
 bool PolycodeEntityEditor::openFile(OSFileEntry filePath) {	

+ 6 - 0
IDE/Contents/Source/PolycodeMeshEditor.cpp

@@ -28,6 +28,8 @@ PolycodeMeshEditor::PolycodeMeshEditor() : PolycodeEditor(true){
 	
 	previewScene = new Scene(Scene::SCENE_3D, true);		
 	renderTexture = new SceneRenderTexture(previewScene, previewScene->getDefaultCamera(), 512, 512);
+    
+    ownsChildren = true;
 
 	previewScene->clearColor.setColor(0.2, 0.2, 0.2, 1.0);	
 	previewScene->useClearColor = true;
@@ -112,6 +114,10 @@ void PolycodeMeshEditor::handleEvent(Event *event) {
 
 PolycodeMeshEditor::~PolycodeMeshEditor() {
     CoreServices::getInstance()->getResourceManager()->getGlobalPool()->removeAllHandlersForListener(this);
+    previewScene->rootEntity.setOwnsChildrenRecursive(true);
+    delete previewScene;
+    delete renderTexture;
+    delete trackballCamera;
 }
 
 bool PolycodeMeshEditor::openFile(OSFileEntry filePath) {

+ 2 - 4
IDE/Contents/Source/PolycodeProps.cpp

@@ -144,10 +144,11 @@ PropList::PropList(String caption) : UIElement() {
 	scrollContainer = new UIScrollContainer(propContents, false, true, 100, 100);
 	scrollContainer->setPosition(0, 30);
 	addChild(scrollContainer);
+    
+    ownsChildren = true;
 }
 
 PropList::~PropList() {
-
 }
 		
 void PropList::updateProps() {
@@ -604,9 +605,6 @@ CustomProp::~CustomProp() {
 	keyEntry->removeAllHandlersForListener(this);
 	valueEntry->removeAllHandlersForListener(this);
 	removeButton->removeAllHandlersForListener(this);
-	delete removeButton;
-	delete keyEntry;
-	delete valueEntry;
 }
 
 void CustomProp::handleEvent(Event *event) {

+ 3 - 1
Modules/Contents/UI/Source/PolyUIElement.cpp

@@ -109,7 +109,9 @@ String UILabel::getText() {
 }
 
 UILabel::~UILabel() {
-	delete label;
+    if(!ownsChildren) {
+        delete label;
+    }
 }
 
 Label *UILabel::getLabel() {

+ 4 - 2
Modules/Contents/UI/Source/PolyUIVScrollBar.cpp

@@ -213,6 +213,8 @@ void UIVScrollBar::handleEvent(Event *event) {
 	
 
 UIVScrollBar::~UIVScrollBar() {
-	delete bgBox;
-	delete handleBox;
+    if(!ownsChildren) {
+        delete bgBox;
+        delete handleBox;
+    }
 }