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

Squashed 'src/ted2go/' changes from 3aee91f1..de1d6d4a

de1d6d4a Restored adding .monkey2 for "New file" action
9a1b1df1 Merge branch 'dev'
59671e5b Fixed project tree resets (#129)
58148338 Fixed folding issue (#128).
8a415023 Added "Open on Desktop" action into right-click on docs tab.
2cd7ddd9 Merge branch 'master' into dev
0aa19eb6 Fix.
130d3a0a Merge branch 'dev'
8689b185 Merge branch 'folding-fixes' into dev
00e3cc5c Changed hotkeys for folding (win+macos).
129a6a23 Folding fixes.
bf9fc2c0 Bump version.
6a5e016d Merge remote-tracking branch 'origin/dev' into dev
619227b2 Folding - fixed rendering positions of elements.
2b3a2679 Merge branch 'dev' of https://github.com/engor/Ted2Go into dev
67ff70e0 Updated SceneDocument to latest version.
72c6f1b6 New feature - "Recently viewed files" dialog (Ctrl+E)
0038da84 Added ~r processing in Console view to print on the same line.
d01d8f00 New feature - Line spacing interval.
a368ee50 Updated special thanks section.
599fb494 Merge branch 'code-folding' into dev
225b20f2 Removed IRCView file and changed default theme to hollow.
b0101ae8 Improved code-folding stuff
3e9de4e0 Project view - added action 'Collapse all' for folders.
5b4e9160 Added ability to drop folder onto .exe to open it as a project
991fbfd2 Fixed - "Find in files... crash when there are no open documents" (#123)
cd6c7477 Fixed crash when removing code template items (#116).
f6344856 Project view - now have autoscrolling to just-drag-n-dropped item (#120).
630df8be Project view - improve dragging stuff (wip).
e2423848 Project view - dragging mode - added autoscroll nearest edges and autoexpand folders by hover about 1 sec
1f606918 Fix `##Rem` in autocompletion (#117)
6928715d Fixed custom font applying at startup (#119).
dd4ed41a Fixed preprocessor keywords for c++.
cef36a40 Merge branch 'dev' into code-folding
fe5891d5 Added support of code folding!
7426e4ae Merge branch 'dev' of https://github.com/engor/Ted2Go into dev
e56d71dc Fixed Ted2go growing PATH.
46b635c8 Fixed macos build error in v1.1.11
ab388858 Fixed disabled menu itemss for hollow theme.

git-subtree-dir: src/ted2go
git-subtree-split: de1d6d4a6793f91b23ab1bb73754fe5d07b2f136
Mark Sibly 7 жил өмнө
parent
commit
1de9ded880

+ 16 - 0
MainWindow.monkey2

@@ -248,6 +248,22 @@ Class MainWindowInstance Extends Window
 		_tabMenu.AddSeparator()
 		_tabMenu.AddAction( _buildActions.lockBuildFile )
 		
+		_tabMenu.AddSeparator()
+		_tabMenu.AddAction( "Open on Desktop" ).Triggered=Lambda()
+			
+			Local path:=_docsManager.CurrentDocument?.Path
+			If path
+				requesters.OpenUrl( ExtractDir( path ) )
+			Endif
+		End
+		_tabMenu.AddAction( "Copy path" ).Triggered=Lambda()
+		
+			Local path:=_docsManager.CurrentDocument?.Path
+			If path
+				App.ClipboardText=path
+			Endif
+		End
+		
 		_docsTabView.RightClicked+=Lambda()
 			_tabMenu.Open()
 		End

+ 18 - 12
action/FoldingActions.monkey2

@@ -13,35 +13,41 @@ Class FoldingActions
 	
 	Method New()
 		
+		#If __TARGET__="macos"
+		Local modif:=Modifier.Gui
+		#Else
+		Local modif:=Modifier.Control
+		#Endif
+		
 		foldCurrent=New Action( "Fold current" )
 		foldCurrent.Triggered=OnFoldCurrent
-		foldCurrent.HotKey=Key.Minus
-		foldCurrent.HotKeyModifiers=Modifier.Alt
+		foldCurrent.HotKey=Key.LeftBracket
+		foldCurrent.HotKeyModifiers=modif
 		
 		foldScope=New Action( "Fold current & parents" )
 		foldScope.Triggered=OnFoldScope
-		foldScope.HotKey=Key.Minus
-		foldScope.HotKeyModifiers=Modifier.Alt|Modifier.Shift
+		foldScope.HotKey=Key.LeftBracket
+		foldScope.HotKeyModifiers=modif|Modifier.Alt
 		
 		foldAll=New Action( "Fold all" )
 		foldAll.Triggered=OnFoldAll
-		foldAll.HotKey=Key.Minus
-		foldAll.HotKeyModifiers=Modifier.Alt|Modifier.Shift|Modifier.Control
+		foldAll.HotKey=Key.LeftBracket
+		foldAll.HotKeyModifiers=modif|Modifier.Shift
 		
 		unfoldCurrent=New Action( "Unfold current" )
 		unfoldCurrent.Triggered=OnUnfoldCurrent
-		unfoldCurrent.HotKey=Key.Equals
-		unfoldCurrent.HotKeyModifiers=Modifier.Alt
+		unfoldCurrent.HotKey=Key.RightBracket
+		unfoldCurrent.HotKeyModifiers=modif
 		
 		unfoldScope=New Action( "Unfold current & children" )
 		unfoldScope.Triggered=OnUnfoldScope
-		unfoldScope.HotKey=Key.Equals
-		unfoldScope.HotKeyModifiers=Modifier.Alt|Modifier.Shift
+		unfoldScope.HotKey=Key.RightBracket
+		unfoldScope.HotKeyModifiers=modif|Modifier.Alt
 		
 		unfoldAll=New Action( "Unfold all" )
 		unfoldAll.Triggered=OnUnfoldAll
-		unfoldAll.HotKey=Key.Equals
-		unfoldAll.HotKeyModifiers=Modifier.Alt|Modifier.Shift|Modifier.Control
+		unfoldAll.HotKey=Key.RightBracket
+		unfoldAll.HotKeyModifiers=modif|Modifier.Shift
 		
 	End
 	

+ 16 - 8
document/CodeDocument.monkey2

@@ -302,8 +302,13 @@ Class CodeDocumentView Extends Ted2CodeTextView
 						Local line:=CursorLine
 						If Cursor=Anchor And Cursor=Document.StartOfLine( line )
 							
+							_delKey=Key.Backspace
+							
 							Local f:=_folding[line]
-							If f And f.folded
+							If f
+								If f.folded
+									SetLineVisible( line,False )
+								Endif
 								_folding.Remove( line )
 								_folding[line-1]=f
 								f.startLine-=1
@@ -344,7 +349,9 @@ Class CodeDocumentView Extends Ted2CodeTextView
 			
 			
 				Case Key.KeyDelete
-			
+					
+					_delKey=Key.KeyDelete
+					
 					If shift 'shift+del - cut selected
 						If ctrl
 '							DeleteToEnd()
@@ -389,12 +396,13 @@ Class CodeDocumentView Extends Ted2CodeTextView
 					
 					Local beforeIndent:=(posInLine<=indent)
 					
-					If beforeIndent
-						Local f:=_folding[line]
-						If f And f.folded
-							_folding.Remove( line )
-							_folding[line+1]=f
-							SetLineVisible( line+1,True )
+					Local f:=_folding[line]
+					If f And beforeIndent
+						f.folded+=20
+					Elseif Not f And Not beforeIndent
+						f=FindNearestFolding( line )
+						If f And line=f.endLine
+							f.folded+=30
 						Endif
 					Endif
 					

+ 2 - 2
document/SceneDocument.monkey2

@@ -126,7 +126,7 @@ Class SceneDocument Extends Ted2Document
 	
 	Method OnLoad:Bool() Override
 		
-		If ExtractExt( Path )=".mojo3d"		
+		If ExtractExt( Path )=".mojo3d"
 			
 			Print "Loading scene from "+Path
 			
@@ -135,7 +135,7 @@ Class SceneDocument Extends Ted2Document
 			_camera=Cast<Camera>( _scene.FindEntity( "Camera" ) )
 			
 			If _camera _camera.View=_view
-				
+			
 			Return True
 		Endif
 		

+ 22 - 3
view/CodeTextView.monkey2

@@ -43,8 +43,9 @@ Class CodeTextView Extends TextView
 			' line with folding was removed
 			'
 			If removed<>0
-				Local i1:=Min( first,first+removed )
-				Local i2:=Max( first,first+removed )
+				Local dd:=(_delKey=Key.Backspace) ? -removed Else removed
+				Local i1:=Min( first,first+dd )
+				Local i2:=Max( first,first+dd )
 				For Local i:=i1 Until i2
 					Local f:=_folding[i]
 					If Not f Continue
@@ -52,7 +53,8 @@ Class CodeTextView Extends TextView
 						_folding.Remove( i )
 					Else
 						f.folded-=10
-						UpdateLineWidth( i ) ' dirty
+						f.endLine+=1
+						UpdateLineWidth( i )
 					Endif
 				Next
 			Endif
@@ -82,9 +84,18 @@ Class CodeTextView Extends TextView
 					
 					expandBlock=(first<f.endLine Or less) ' expand block ending
 					
+					If f.folded>=30
+						expandBlock=False
+						f.folded-=30
+					Endif
+					
+					If f.folded>=20
+						shiftBlock=True
+					Endif
 				Endif
 				
 				If shiftBlock ' shift down whole block
+					
 					If f.folded
 						flag=True
 					Endif
@@ -92,8 +103,15 @@ Class CodeTextView Extends TextView
 					f.endLine+=delta
 					_foldingTmpMap[line]=f
 					
+					If f.folded>=20
+						SetLineVisible( f.startLine,True )
+						f.folded-=20
+					Endif
+					
 				Elseif expandBlock
+					
 					f.endLine+=delta
+					
 				Endif
 				
 			Next
@@ -656,6 +674,7 @@ Class CodeTextView Extends TextView
 	Protected
 	
 	Field _folding:=New IntMap<Folding>
+	Field _delKey:Key
 	
 	Method CheckFormat( event:KeyEvent )
 		

+ 5 - 1
view/ProjectBrowserView.monkey2

@@ -28,8 +28,12 @@ Class ProjectBrowserView Extends TreeViewExt Implements IDraggableHolder
 		NodeCollapsed+=OnNodeCollapsed
 		
 		App.Activated+=Lambda()
-		
+			
+			Local sc:=Scroll
+			
 			UpdateAllNodes()
+			
+			Scroll=sc
 		End
 		
 		UpdateFileTypeIcons()

+ 16 - 16
view/ProjectView.monkey2

@@ -350,8 +350,22 @@ Class ProjectView Extends DockingView
 			Local path:=node.Path
 			Local pasteAction:Action
 			Local isFolder:=False
+			Local fileType:=GetFileType( path )
 			
-			Select GetFileType( path )
+			menu.AddAction( "Open on Desktop" ).Triggered=Lambda()
+			
+				Local p:=(fileType=FileType.File) ? ExtractDir( path ) Else path
+				requesters.OpenUrl( p )
+			End
+			menu.AddAction( "Copy path" ).Triggered=Lambda()
+			
+				App.ClipboardText=path
+			End
+			
+			menu.AddSeparator()
+			
+			
+			Select fileType
 			Case FileType.Directory
 				
 				isFolder=True
@@ -379,7 +393,7 @@ Class ProjectView Extends DockingView
 				
 				menu.AddAction( "New file" ).Triggered=Lambda()
 					
-					Local file:=RequestString( "New file name:" )
+					Local file:=RequestString( "New file name:","New file",".monkey2" )
 					If Not file Return
 					
 					Local tpath:=path+"/"+file
@@ -512,23 +526,9 @@ Class ProjectView Extends DockingView
 					Endif
 				Endif
 				
-				menu.AddSeparator()
-				
-				menu.AddAction( "Open on Desktop" ).Triggered=Lambda()
-					
-					requesters.OpenUrl( path )
-				End
-			
 			
 			Case FileType.File
 				
-				menu.AddAction( "Open on Desktop" ).Triggered=Lambda()
-					
-					requesters.OpenUrl( ExtractDir( path ) )
-				End
-				
-				menu.AddSeparator()
-				
 				menu.AddAction( "Rename file" ).Triggered=Lambda()
 					
 					Local oldName:=StripDir( path )