Bladeren bron

Squashed 'src/ted2go/' changes from 188a508b..6858bf5a

6858bf5a Removed wasm target.
9b069b16 Merge pull request #45 from DoctorWhoof/Leo
846265c5 Updated Warm theme
8a83d8ad Revert "MacOs improvements"
620a2b0f Updated Warm theme
98976b22 Added ability to drop folder to the window to add it as a project.
026d271f Fixed ident checking in 'Generate class' dialog (now super-class/ifase and namespace can contains dot char).
72d9a34a Merge branch 'master' of https://github.com/engor/Ted2Go
d9456c2a Merge branch 'master' into dev
e5221e7b Hide errors list when rebuilding modules.
6af096c8 Merge remote-tracking branch 'engor/master' into Leo
41ec0308 MacOs improvements
3818e6cd Merge branch 'master' into Leo
8b271a38 Updated gitignore
73c1f9ae Merge remote-tracking branch 'origin/dev'

git-subtree-dir: src/ted2go
git-subtree-split: 6858bf5a3de5f12bd52402eabb8867f78df4a066
Mark Sibly 8 jaren geleden
bovenliggende
commit
9287c65e79

+ 1 - 0
.gitignore

@@ -2,3 +2,4 @@
 *.bak
 *.buildv*
 *.products/
+*.app

+ 17 - 1
MainWindow.monkey2

@@ -51,7 +51,8 @@ Class MainWindowInstance Extends Window
 		End
 		
 		App.FileDropped+=Lambda( path:String )
-			_docsManager.OpenDocument( path,True )
+			
+			OnFileDropped( path )
 		End
 
 		_docsManager.DocumentAdded+=Lambda( doc:Ted2Document )
@@ -322,6 +323,7 @@ Class MainWindowInstance Extends Window
 		'
 		_buildActions.PreBuild+=OnPreBuild
 		_buildActions.PreSemant+=OnPreSemant
+		_buildActions.PreBuildModules+=OnPreBuildModules
 		
 		_buildMenu=New MenuExt( "Build" )
 		_buildMenu.AddAction( _buildActions.buildAndRun )
@@ -1048,6 +1050,15 @@ Class MainWindowInstance Extends Window
 		_docsTabView.EnsureVisibleCurrentTab()
 	End
 	
+	Method OnFileDropped( path:String )
+		
+		If FileExists( path )
+			_docsManager.OpenDocument( path,True )
+		Else
+			_projectView.OpenProject( path )
+		Endif
+	End
+	
 	Method OnAppClose()
 		
 		_fileActions.quit.Trigger()
@@ -1064,6 +1075,11 @@ Class MainWindowInstance Extends Window
 		_buildErrorsList.Visible=False
 	End
 	
+	Method OnPreBuildModules()
+	
+		_buildErrorsList.Visible=False
+	End
+	
 	Method OnProjectClosed( dir:String )
 		
 		UpdateCloseProjectMenu( dir )

+ 6 - 17
action/BuildActions.monkey2

@@ -49,6 +49,7 @@ Class BuildActions Implements IModuleBuilder
 	
 	Field PreBuild:Void()
 	Field PreSemant:Void()
+	Field PreBuildModules:Void()
 	Field ErrorsOccured:Void(errors:BuildError[])
 	
 	Method New( docs:DocumentManager,console:ConsoleExt,debugView:DebugView )
@@ -143,9 +144,6 @@ Class BuildActions Implements IModuleBuilder
 		_emscriptenTarget=New CheckButton( "Emscripten",,group )
 		_emscriptenTarget.Layout="fill-x"
 		
-		_wasmTarget=New CheckButton( "Wasm",,group )
-		_wasmTarget.Layout="fill-x"
-		
 		_androidTarget=New CheckButton( "Android",,group )
 		_androidTarget.Layout="fill-x"
 		
@@ -158,7 +156,6 @@ Class BuildActions Implements IModuleBuilder
 		targetMenu.AddSeparator()
 		targetMenu.AddView( _desktopTarget )
 		targetMenu.AddView( _emscriptenTarget )
-		targetMenu.AddView( _wasmTarget )
 		targetMenu.AddView( _androidTarget )
 		targetMenu.AddView( _iosTarget )
 		targetMenu.AddSeparator()
@@ -186,14 +183,6 @@ Class BuildActions Implements IModuleBuilder
 			_emscriptenTarget.Enabled=False
 		Endif
 
-		If _validTargets.Contains( "wasm" )
-			_wasmTarget.Clicked+=Lambda()
-				_buildTarget="wasm"
-			End
-		Else
-			_wasmTarget.Enabled=False
-		Endif
-
 		If _validTargets.Contains( "android" )
 			_androidTarget.Clicked+=Lambda()
 				_buildTarget="android"
@@ -262,8 +251,6 @@ Class BuildActions Implements IModuleBuilder
 					_desktopTarget.Checked=True
 				Case "emscripten"
 					_emscriptenTarget.Checked=True
-				Case "wasm"
-					_wasmTarget.Checked=True
 				Case "android"
 					_androidTarget.Checked=True
 				Case "ios"
@@ -305,6 +292,7 @@ Class BuildActions Implements IModuleBuilder
 		
 		Local targets:=dialog.SelectedTargets
 		modules=dialog.SelectedModules
+		
 		clean=dialog.NeedClean
 		configs=dialog.SelectedConfigs
 		
@@ -359,7 +347,6 @@ Class BuildActions Implements IModuleBuilder
 	Field _releaseConfig:CheckButton
 	Field _desktopTarget:CheckButton
 	Field _emscriptenTarget:CheckButton
-	Field _wasmTarget:CheckButton
 	Field _androidTarget:CheckButton
 	Field _iosTarget:CheckButton
 	
@@ -488,6 +475,8 @@ Class BuildActions Implements IModuleBuilder
 
 	Method BuildModules:Bool( clean:Bool,target:String,modules:String,configs:String="debug release" )
 		
+		PreBuildModules()
+		
 		Local msg:=(clean ? "Rebuilding ~ " Else "Updating ~ ")+target
 		
 		Local arr:=configs.Split( " " )
@@ -558,7 +547,7 @@ Class BuildActions Implements IModuleBuilder
 			
 			_debugView.DebugApp( exeFile,config )
 
-		Case "emscripten","wasm"
+		Case "emscripten"
 		
 			Local mserver:=GetEnv( "MX2_MSERVER" )
 			If mserver _console.Run( mserver+" ~q"+exeFile+"~q" )
@@ -644,7 +633,7 @@ Class BuildActions Implements IModuleBuilder
 	End
 	
 	Method OnUpdateModules()
-	
+		
 		If _console.Running Return
 	
 		BuildModules( False )

+ 1 - 1
assets/liveTemplates.json

@@ -12,7 +12,7 @@
 		"ife":"If ${Cursor}\n\t\nElse\n\t\nEndif",
 		"ifn":"If ${Cursor} = Null\n\t\nEndif",
 		"inn":"If ${Cursor} <> Null\n\t\nEndif",
-		"last":"[_${Cursor}.Lenght-1]",
+		"last":"[_${Cursor}.Length-1]",
 		"lo":"Local ${Cursor}:=",
 		"me":"Method ${Cursor}()\n\t\n\t\nEnd",
 		"meb":"Method ${Cursor}:Bool()\n\t\n\t\nEnd",

+ 56 - 14
assets/themes/theme-warm.json

@@ -1,22 +1,30 @@
 //Theme by Ethernaut, vaguely based on "smooth" by Hezkore
 {
 	"extends":"ted2-default",
- 
+
 	"colors":{
-		"border": "#211d12",
-		"clear": "#23211f",
-		"gutter": "#242324",
-		"content": "#282728",
-		"panel": "#594f45",
- 
-		"knob": "#363330",
-		"hover": "#594f45",
-		"active" : "#7e7763",
- 
+
+		"content": "#282728",			//page and toolbar background
+		"clear": "#23211f",				//bg behind document tabs
+		"panel": "#3B332B",				//menu background
+		"gutter": "#242324",			//bg on scrollbar and tabs
+		"menu-shortcut":"#9C7E57",		//shortcut hint on menu
+
+		"border": "#211d12",			//nothing?
+
+		"knob": "#363330",				//scrollbar, dock separator
+		"hover": "#090604",				//menu hilight
+		"active" : "#9C7E57",
+
+		"text-default": "#f2dba6",		//menu text, tab text
+		"text-highlight": "#ffcf22",
+		"text-disabled": "#444",		//inactive menu options, line numbers
+		"text-background": "#817A6A",	//inactive tab text
+
 		"textview-cursor":"#FFDD55",
 		"textview-selection":"#3E4451",
- 
-		"textview-color0":"#f2dba6",
+
+		"textview-color0": "#f2dba6",
 		"textview-color1": "#f6e4bc",	//identifiers
 		"textview-color2": "#ffbf00",	//keywords
 		"textview-color3": "#cbcb4d",	//strings
@@ -24,5 +32,39 @@
 		"textview-color5": "#8E744A",	//comment
 		"textview-color6": "#729888",	//preproc
 		"textview-color7": "#fff9e6"	//default
+	},
+
+	"styles":{
+		"default":{
+			"font":"normal",
+			"textColor":"text-default",
+			"iconColor":"#D6B69D",
+			"states":{
+				"disabled":{
+					"textColor":"text-disabled",
+					"iconColor":"#B46B29"
+				}
+			}
+		},
+
+		"ColoredToolButton":{
+			"extends":"ToolButton",
+			"iconColor":"#AB9D8D"
+		},
+
+		"TabClose":{
+			"margin":[8,8,8,8 ],
+			"icons":"prime_assets/tabclose_icons.png",
+			"iconColor":"text-disabled",
+			"states":{
+				"hover":{
+					"iconColor":"#FF0000"
+				},
+				"active":{
+					"iconColor":"#FFFFFF"
+				}
+			}
+		}
 	}
-}
+
+}

+ 1 - 1
dialog/GenerateClassDialog.monkey2

@@ -127,7 +127,7 @@ Class GenerateClassDialog Extends DialogExt
 	
 	Method OnGenerate()
 		
-		If Not IsIdentStr( ClassName )
+		If Not IsIdentStr( ClassName,False )
 			Alert( "Class name is invalid or empty!",Title )
 			Return
 		Endif

+ 5 - 43
product/BuildProduct.monkey2

@@ -39,8 +39,6 @@ Class BuildProduct
 #endif
 		Case "emscripten"
 			product=New EmscriptenProduct( srcPath )
-		Case "wasm"
-			product=New WasmProduct( srcPath )
 		Case "android"
 			product=New AndroidProduct( srcPath )
 		Case "ios"
@@ -435,6 +433,8 @@ Class EmscriptenProduct Extends BuildProduct
 		Super.New( srcPath,"emscripten" )
 
 		AddExts( New String[]( ".html" ) )
+		
+		AddVar( "Application Type","asmjs","options:asmjs|wasm|wasm+asmjs" )
 	End
 	
 	Protected
@@ -455,57 +455,19 @@ Class EmscriptenProduct Extends BuildProduct
 	
 	Method OnGetMx2ccOpts:String() Override
 
-		Local opts:=""
-		
-		opts+=" ~q-product="+ProductDir+AppName+".js~q"
-		
-		Return opts
-	End
-
-	Method OnGetExecutable:String() Override
-
-		Return ProductDir+AppName+".html"
-	
-	End
-End
-
-Class WasmProduct Extends BuildProduct
-
-	Method New( srcPath:String )
-		Super.New( srcPath,"wasm" )
-
-		AddExts( New String[]( ".html" ) )
-	End
-	
-	Protected
-	
-	Method OnCreateProduct() Override
-
-		CopyTemplate( "products/wasm",StripSlashes( ProductDir ) )
-		
-		CreateDir( ProductDir+"assets" )
-		
-		If AppName<>"Monkey2Game"
-		
-			CopyFile( ProductDir+"Monkey2Game.html",ProductDir+AppName+".html" )
-		
-			DeleteFile( ProductDir+"Monkey2Game.html" )
-		Endif
-	End
-	
-	Method OnGetMx2ccOpts:String() Override
+		Local appType:=GetVar( "APPLICATION_TYPE" )
 
 		Local opts:=""
 		
 		opts+=" ~q-product="+ProductDir+AppName+".js~q"
-		
+		opts+=" -apptype="+appType
+
 		Return opts
 	End
 
 	Method OnGetExecutable:String() Override
 
 		Return ProductDir+AppName+".html"
-	
 	End
 End
 

+ 0 - 1
product/Mx2ccEnv.monkey2

@@ -91,7 +91,6 @@ Function EnumValidTargets:StringStack( console:ConsoleExt )
 	
 	targets.Push( "desktop" )
 	targets.Push( "emscripten" )
-	targets.Push( "wasm" )
 	targets.Push( "android" )
 #If __TARGET__="macos"
 	targets.Push( "ios" )

+ 8 - 2
utils/Utils.monkey2

@@ -194,14 +194,20 @@ Function ShowMessage( title:String,msg:String,okButton:String="  OK  " )
 	Dialog.Run( title,New Label( msg ),New String[](okButton),0,0 )
 End
 
-Function IsIdentStr:Bool( str:String )
+Function IsIdentStr:Bool( str:String,skipDots:Bool=True )
 	
 	If Not str Return False
 	
 	If IsDigit( str[0] ) Return False
 	
+	If str[0]=Chars.DOT Or str[str.Length-1]=Chars.DOT Return False
+	
 	For Local c:=Eachin str
-		If Not IsIdent( c ) Return False
+		If c=Chars.DOT
+			If Not skipDots Return False
+		Else
+			If Not IsIdent( c ) Return False
+		Endif
 	Next
 	
 	Return True