소스 검색

Tweaked ted2 a bit to test out new json.

Mark Sibly 9 년 전
부모
커밋
59f13df367
2개의 변경된 파일7개의 추가작업 그리고 8개의 파일을 삭제
  1. 3 3
      src/ted2/documentmanager.monkey2
  2. 4 5
      src/ted2/mainwindow.monkey2

+ 3 - 3
src/ted2/documentmanager.monkey2

@@ -196,7 +196,7 @@ Class DocumentManager
 		
 		If Not jobj.Contains( "openDocuments" ) Return
 		
-		For Local doc:=Eachin jobj["openDocuments"].ToArray()
+		For Local doc:=Eachin jobj.GetArray( "openDocuments" )
 		
 			Local path:=doc.ToString()
 			If GetFileType( path )<>FileType.File Continue
@@ -205,8 +205,8 @@ Class DocumentManager
 			If tdoc And MainWindow.IsTmpPath( path ) tdoc.Dirty=True
 		Next
 		
-		If jobj.Contains( "currentDocument" )
-			Local path:=jobj["currentDocument"].ToString()
+		Local path:=jobj.GetString( "currentDocument" )
+		If path
 			Local doc:=FindDocument( path )
 			If doc CurrentDocument=doc
 		Endif

+ 4 - 5
src/ted2/mainwindow.monkey2

@@ -355,18 +355,17 @@ Class MainWindowInstance Extends Window
 		'for 'reload' later...
 		_projectView.ProjectOpened-=UpdateCloseProjectMenu
 		
-'		If jobj.Contains( "windowRect" ) Frame=ToRecti( jobj["windowRect"] )
-		If jobj.Contains( "browserSize" ) _contentView.SetViewSize( _browsersTabView,jobj["browserSize"].ToNumber() )
-		If jobj.Contains( "consoleSize" ) _contentView.SetViewSize( _consolesTabView,jobj["consoleSize"].ToNumber() )
+		If jobj.Contains( "browserSize" ) _contentView.SetViewSize( _browsersTabView,jobj.GetNumber( "browserSize" ) )
+		If jobj.Contains( "consoleSize" ) _contentView.SetViewSize( _consolesTabView,jobj.GetNumber( "consoleSize" ) )
 			
 		If jobj.Contains( "recentFiles" )
-			For Local file:=Eachin jobj["recentFiles"].ToArray()
+			For Local file:=Eachin jobj.GetArray( "recentFiles" )
 				Local path:=file.ToString()
 				If GetFileType( path )<>FileType.File Continue
 				_recentFiles.Push( path )
 			Next
 		End
-			
+		
 		_docsManager.LoadState( jobj )
 		_buildActions.LoadState( jobj )
 		_projectView.LoadState( jobj )