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

Squashed 'src/ted2go/' changes from d84196b4..257d070c

257d070c Added keywords for *.glsl.
c76c8e05 Added - saving state when open/close files and projects, so we will not lose it if app force closed.
95f8571f Added Monkey2 root path into prefs dialog.
91dd3809 Improved - close completion list if typed char is not an ident char.
07c018a0 Fixed inserted lambda breckets.
ed438515 Added - double clicking on the line number in status bar - open goto line dialog.
d7946027 v2.3.1
15dc4f36 * Fixed - completion list is above the line if editor toolbar is hidden. * Added - doubleClick on INS in status bar to change mode.
e284cf79 * Little faster menu expanding. * Confirm for deleting all .buildv. * Fixed numlock mode for keypad. * Fixed event filter - to catch single event (go to declaration by the only F1; commenting by Ctrl+' add two ' at the end line). * Fixed - mouse wheel event on text fields crashes app. * Fixed - custom font doesn't take theme scale factor
aa85ec0e Merge pull request #19 from Hezkore/dev
5a7ae3fc Done new menu system. Just hover on item with submenu and wait for 1 sec and you'll see it opened. Also just hover on menu bar when menu opened and you can see open other menus.
276d3f75 Updated smooth theme
09465c04 WIP sub menus 2.
3a777193 WIP sub menus.
36157433 Added "force stop" iconic button when app is running.
b0659dac Added option "Every 10th line number".
ee883bd6 Fixed status bar text.
6d0f4573 Fixed dark corner in project view.
13ea51a4 Added store/restore current console's and browser's tabs.
e39275bb Improvement - restore console visible after running stop, not building stop.
9085a043 Improved completion list: 1. Removed title strip, so looking easy. 2. Removed home / end keys logic but added pgUp / pgDown. 3. Fixed position.
1e1fdb75 WIP completion fixes.
643a3092 Fix insertion of overriden methods text.
66103f1b Feature - change statusbar color when run app.
a7ee07cf Store tab panels visibility in state.json. Attempt to fix crash - if quickly close ide after starting.
afdb9747 Improved c/cpp highlighter and added .c ext.
b09986bf Fixed debug line issue #9.
6312d54c Fixed - Insert / Override text mode not worked.
904866fd Make editor toolbar hidden by default.
d3dc6d2d Fixed issue with default editor font in CodeTextView. Set 'normal' font for TextField and GutterView. Added gutter line number for anchor position.
ea505fb4 Removed debug print.
45c0c147 Merge branch 'dev' of https://github.com/engor/Ted2Go into dev
219f9140 Merge pull request #18 from Hezkore/dev
45553986 Renamed all code files to CamelCase style. And move them to folders-by-type.
6f2557d9 Minor changes and documenting of ProcessReader.
e2c18cb6 Updated to correct Roboto font Updated theme smooth
278116b8 ProcessReader - done this class. And rewrite parser to use it.
407e95f4 WIP process wrapper.
5fec6f48 Fixed whole-line-selection position accordingly to horizontal scroll.
f755368f Fixed incorrect fonts for opened documents.
f33e8b96 Fixed findInFiles dialog issue. Added elapsed build time.
a55c395a WIP findInFiles improvement.
1469ee01 Project browser - added actions Update / Rebuild module.
8c374973 Project browser - added actions for folders: "Clean (delete  .buildv)" and "Open on Desktop".
d92396f6 Fixed filter for choosing font dialog.
20acd563 Changed AppTitle format: FileName - Ted2goName - FilePath.
a77d2336 If starting outside of monkey2 folder - show dialog to specify root folder.
e37d512b Improved whitespaces.
6b9a13ba Restore console visibility on app stop.
60aa24c6 GutterView - draw each 10 line number to make more clear view.
4b9850fa Replaced default progressbar image with smooth-theme one. And save smooth theme.
6c25dc7f Added filter parameter for RequestFile dialog.
ba9b6611 Added "recent projects" stuff.
3621c640 FileBrowser - added item "Open as project" and "Close Project" for folders.
c527ddc8 Added supporters names into about dialog.
3d2c2d91 Improved preferences - apply changes w/o restarting app. New setting - to move project tabs to the left side. New setting - to choose completion by dot (period).
7bad7cd8 Fixed: fonts doesn't copy to destination folder. Probably, this fix themes too.
4b52ff5f Improved choosing custom editor font.
e11e61f6 FontSize as Int.
f819ea37 Merge pull request #16 from Hezkore/master
c2bd8175 Added new option to override theme font
4c6e883a Fixed crash when typing inside of 'Extension' classes.

git-subtree-dir: src/ted2go
git-subtree-split: 257d070c4e80bd35a5bd89d0d502b25d8dbeaad5
Mark Sibly 8 жил өмнө
parent
commit
b68ac3fbc4
81 өөрчлөгдсөн 2837 нэмэгдсэн , 1194 устгасан
  1. 394 157
      MainWindow.monkey2
  2. 0 0
      Plugin.monkey2
  3. 65 12
      Prefs.monkey2
  4. 207 0
      ProcessReader.monkey2
  5. 229 0
      Ted2.monkey2
  6. 0 0
      ThemeImages.monkey2
  7. 101 73
      action/BuildActions.monkey2
  8. 6 30
      action/EditActions.monkey2
  9. 7 3
      action/FileActions.monkey2
  10. 82 75
      action/FindActions.monkey2
  11. 0 0
      action/HelpActions.monkey2
  12. 22 0
      action/ViewActions.monkey2
  13. 4 2
      assets/aboutTed2Go.html
  14. BIN
      assets/fonts/Roboto-Medium.ttf
  15. BIN
      assets/fonts/RobotoMono-Medium.ttf
  16. 5 3
      assets/themes/default.json
  17. BIN
      assets/themes/progressbar_icons.png
  18. BIN
      assets/themes/smooth_assets/tabbutton_selected_skin.png
  19. BIN
      assets/themes/smooth_assets/tabbutton_skin.png
  20. 33 3
      assets/themes/ted2-default.json
  21. 20 23
      assets/themes/theme-smooth.json
  22. 0 0
      dialog/DialogExt.monkey2
  23. 0 0
      dialog/EditProductDialog.monkey2
  24. 0 0
      dialog/FindDialog.monkey2
  25. 0 0
      dialog/FindInFilesDialog.monkey2
  26. 94 0
      dialog/NoTitleDialog.monkey2
  27. 217 0
      dialog/PrefsDialog.monkey2
  28. 0 0
      document/AudioDocument.monkey2
  29. 250 196
      document/CodeDocument.monkey2
  30. 5 1
      document/DocumentManager.monkey2
  31. 0 0
      document/ImageDocument.monkey2
  32. 0 0
      document/JsonDocument.monkey2
  33. 0 0
      document/Monkey2Document.monkey2
  34. 0 0
      document/PlainTextDocument.monkey2
  35. 0 0
      document/Ted2Document.monkey2
  36. 0 0
      document/XmlDocument.monkey2
  37. 11 18
      eventfilter/Monkey2KeyEventFilter.monkey2
  38. 0 0
      eventfilter/TextViewKeyEventFilter.monkey2
  39. 58 29
      parser/CodeItem.monkey2
  40. 40 14
      parser/Monkey2Parser.monkey2
  41. 0 0
      parser/Monkey2Parser_old.monkey2
  42. 0 0
      parser/Parser.monkey2
  43. 0 0
      parser/ParserPlugin.monkey2
  44. 0 119
      prefsdialog.monkey2
  45. 0 0
      product/BuildProduct.monkey2
  46. 1 1
      product/ModuleManager.monkey2
  47. 0 0
      product/Mx2ccEnv.monkey2
  48. 1 1
      project.json
  49. 150 0
      syntax/GlslHighlighter.monkey2
  50. 21 0
      syntax/GlslKeywords.monkey2
  51. 40 49
      syntax/cpphighlighter.monkey2
  52. 1 1
      syntax/cppkeywords.monkey2
  53. 0 190
      ted2.monkey2
  54. 0 0
      testing/AndroidManifest.xml
  55. 0 0
      testing/Canvas.monkey2
  56. 6 1
      testing/ParserTests.monkey2
  57. 9 7
      testing/async.cpp
  58. 19 3
      utils/jsonutils.monkey2
  59. 8 0
      utils/utils.monkey2
  60. 74 69
      view/AutocompleteView.monkey2
  61. 14 1
      view/CodeGutterView.monkey2
  62. 32 24
      view/CodeTextView.monkey2
  63. 0 0
      view/CodeTreeView.monkey2
  64. 0 0
      view/ConsoleViewExt.monkey2
  65. 27 7
      view/DebugView.monkey2
  66. 0 0
      view/GutterView.monkey2
  67. 3 3
      view/HelpTreeView.monkey2
  68. 3 15
      view/HintView.monkey2
  69. 0 0
      view/HtmlViewExt.monkey2
  70. 0 0
      view/JsonTreeView.monkey2
  71. 49 12
      view/ListViewExt.monkey2
  72. 366 0
      view/MenuExt.monkey2
  73. 0 0
      view/Monkey2TreeView.monkey2
  74. 28 6
      view/ProjectBrowserView.monkey2
  75. 96 42
      view/ProjectView.monkey2
  76. 39 4
      view/StatusBarView.monkey2
  77. 0 0
      view/TabViewExt.monkey2
  78. 0 0
      view/Ted2TextView.monkey2
  79. 0 0
      view/ToolBarViewExt.monkey2
  80. 0 0
      view/TreeViewExt.monkey2
  81. 0 0
      view/XmlTreeView.monkey2

+ 394 - 157
mainwindow.monkey2 → MainWindow.monkey2

@@ -9,6 +9,9 @@ Namespace ted2go
 
 #Import "assets/newfiles/@/ted2/newfiles"
 
+#Import "assets/fonts/@/fonts"
+
+
 Global MainWindow:MainWindowInstance
 
 Class MainWindowInstance Extends Window
@@ -18,28 +21,17 @@ Class MainWindowInstance Extends Window
 		
 		MainWindow=Self
 		
-		_tmp=RealPath( "tmp/" )
-		
-#If __TARGET__="macos"
-		_mx2cc="bin/mx2cc_macos"
-#Else If __TARGET__="windows"
-		_mx2cc="bin/mx2cc_windows.exe"
-#Else If __TARGET__="raspbian"
-		_mx2cc="bin/mx2cc_raspbian"
-#Else
-		_mx2cc="bin/mx2cc_linux"
-#Endif
-		_mx2cc=RealPath( _mx2cc )
-		
-		_modsDir=RealPath( "modules/" )
+		UpdateToolsPaths()
 		
 		_docsTabView=New TabViewExt( TabViewFlags.DraggableTabs|TabViewFlags.ClosableTabs )
 		
 		_browsersTabView=New TabView( TabViewFlags.DraggableTabs )
+		_browsersTabView.Style=GetStyle( "ProjectTabView" )
 		_consolesTabView=New TabView( TabViewFlags.DraggableTabs )
 		
-		_recentFilesMenu=New Menu( "Recent files..." )
-		_closeProjectMenu=New Menu( "Close project..." )
+		_recentFilesMenu=New MenuExt( "Recent files" )
+		_recentProjectsMenu=New MenuExt( "Recent projects" )
+		_closeProjectMenu=New MenuExt( "Close project" )
 		
 		_docBrowser=New DockingView
 		
@@ -53,11 +45,12 @@ Class MainWindowInstance Extends Window
 
 		_docsManager.DocumentAdded+=Lambda( doc:Ted2Document )
 			AddRecentFile( doc.Path )
-			UpdateRecentFilesMenu()
+			SaveState()
 		End
 
 		_docsManager.DocumentRemoved+=Lambda( doc:Ted2Document )
 			If IsTmpPath( doc.Path ) DeleteFile( doc.Path )
+			SaveState()
 		End
 
 		_buildConsole=New ConsoleExt
@@ -85,7 +78,7 @@ Class MainWindowInstance Extends Window
 		'Help tab
 		
 		_helpView=New HtmlViewExt
-		_helpViewDocker=New DockingView
+		_helpConsole=New DockingView
 		Local bar:=New ToolBarExt
 		bar.MaxSize=New Vec2i( 300,30 )
 		bar.AddIconicButton(
@@ -117,21 +110,31 @@ Class MainWindowInstance Extends Window
 			label.Text=url
 		End
 		
-		_helpViewDocker.AddView( bar,"top" )
-		_helpViewDocker.ContentView=_helpView
+		_helpConsole.AddView( bar,"top" )
+		_helpConsole.ContentView=_helpView
 		
 		_helpView.Navigate( "asset::ted2/about.html" )
 		
-		_projectView=New ProjectView( _docsManager )
-		
-		_helpTree=New HelpTree( _helpView )
+		_helpTree=New HelpTreeView( _helpView )
 		
 		_debugView=New DebugView( _docsManager,_outputConsole )
 		
+		
+		_buildActions=New BuildActions( _docsManager,_buildConsole,_debugView )
+		
+		_projectView=New ProjectView( _docsManager,_buildActions )
+		_projectView.ProjectOpened+=Lambda( dir:String )
+			AddRecentProject( dir )
+			SaveState()
+		End
+		_projectView.ProjectClosed+=Lambda( dir:String )
+			UpdateCloseProjectMenu( dir )
+			SaveState()
+		End
+		
 		_fileActions=New FileActions( _docsManager )
 		_editActions=New EditActions( _docsManager )
 		_findActions=New FindActions( _docsManager,_projectView,_findConsole )
-		_buildActions=New BuildActions( _docsManager,_buildConsole,_debugView )
 		_helpActions=New HelpActions
 		_viewActions=New ViewActions( _docsManager )
 
@@ -163,11 +166,11 @@ Class MainWindowInstance Extends Window
 		
 		'File menu
 		'
-		_newFiles=New Menu( "New..." )
+		_templateFiles=New MenuExt( "Templates" )
 		Local p:=AssetsDir()+"ted2/newfiles/"
 		For Local f:=Eachin LoadDir( p )
 			Local src:=stringio.LoadString( p+f )
-			_newFiles.AddAction( StripExt( f.Replace( "_"," " ) ) ).Triggered=Lambda()
+			_templateFiles.AddAction( StripExt( f.Replace( "_"," " ) ) ).Triggered=Lambda()
 				Local path:=AllocTmpPath( "untitled",ExtractExt( f ) )
 				If Not path Return
 				SaveString( src,path )
@@ -175,11 +178,11 @@ Class MainWindowInstance Extends Window
 			End
 		Next
 		
-		_fileMenu=New Menu( "File" )
+		_fileMenu=New MenuExt( "File" )
 		_fileMenu.AddAction( _fileActions.new_ )
-		_fileMenu.AddSubMenu( _newFiles )
 		_fileMenu.AddAction( _fileActions.open )
 		_fileMenu.AddSubMenu( _recentFilesMenu )
+		_fileMenu.AddSubMenu( _templateFiles )
 		_fileMenu.AddSeparator()
 		_fileMenu.AddAction( _fileActions.close )
 		_fileMenu.AddAction( _fileActions.closeOthers )
@@ -191,6 +194,7 @@ Class MainWindowInstance Extends Window
 		_fileMenu.AddAction( _fileActions.saveAll )
 		_fileMenu.AddSeparator()
 		_fileMenu.AddAction( _projectView.openProject )
+		_fileMenu.AddSubMenu( _recentProjectsMenu )
 		_fileMenu.AddSubMenu( _closeProjectMenu )
 		_fileMenu.AddSeparator()
 		_fileMenu.AddAction( _fileActions.prefs )
@@ -199,7 +203,7 @@ Class MainWindowInstance Extends Window
 		
 		'Edit menu
 		'
-		_editMenu=New Menu( "Edit" )
+		_editMenu=New MenuExt( "Edit" )
 		_editMenu.AddAction( _editActions.undo )
 		_editMenu.AddAction( _editActions.redo )
 		_editMenu.AddSeparator()
@@ -213,7 +217,7 @@ Class MainWindowInstance Extends Window
 		
 		'Find menu
 		'
-		_findMenu=New Menu( "Find" )
+		_findMenu=New MenuExt( "Find" )
 		_findMenu.AddAction( _findActions.find )
 		_findMenu.AddAction( _findActions.findNext )
 		_findMenu.AddAction( _findActions.findPrevious )
@@ -224,9 +228,9 @@ Class MainWindowInstance Extends Window
 		
 		'View menu
 		'
-		_viewMenu=New Menu( "View" )
-		_viewMenu.AddAction( _editActions.gotoLine )
-		_viewMenu.AddAction( _editActions.gotoDeclaration )
+		_viewMenu=New MenuExt( "View" )
+		_viewMenu.AddAction( _viewActions.gotoLine )
+		_viewMenu.AddAction( _viewActions.gotoDeclaration )
 		_viewMenu.AddSeparator()
 		_viewMenu.AddAction( _viewActions.comment )
 		_viewMenu.AddAction( _viewActions.uncomment )
@@ -242,9 +246,9 @@ Class MainWindowInstance Extends Window
 		_forceStop.HotKeyModifiers=Modifier.Shift
 		
 		'
-		_buildActions.PreBuild+=OnForceStop		
+		_buildActions.PreBuild+=OnForceStop
 		
-		_buildMenu=New Menu( "Build" )
+		_buildMenu=New MenuExt( "Build" )
 		_buildMenu.AddAction( _buildActions.buildAndRun )
 		_buildMenu.AddAction( _buildActions.build )
 		_buildMenu.AddAction( _buildActions.semant )
@@ -262,12 +266,12 @@ Class MainWindowInstance Extends Window
 		
 		'Window menu
 		'
-		_windowMenu=New Menu( "Window" )
+		_windowMenu=New MenuExt( "Window" )
 		_windowMenu.AddAction( _docsManager.nextDocument )
 		_windowMenu.AddAction( _docsManager.prevDocument )
 		_windowMenu.AddSeparator()
 		
-		_themesMenu=CreateThemesMenu( "Themes..." )
+		_themesMenu=CreateThemesMenu( "Themes" )
 		
 		AddZoomActions( _windowMenu )
 		_windowMenu.AddSeparator()
@@ -276,7 +280,7 @@ Class MainWindowInstance Extends Window
 		
 		'Help menu
 		'
-		_helpMenu=New Menu( "Help" )
+		_helpMenu=New MenuExt( "Help" )
 		_helpMenu.AddAction( _helpActions.quickHelp )
 		_helpMenu.AddAction( _helpActions.viewManuals )
 		_helpMenu.AddSeparator()
@@ -293,7 +297,7 @@ Class MainWindowInstance Extends Window
 		
 		'Menu bar
 		'
-		_menuBar=New MenuBar
+		_menuBar=New MenuBarExt
 		_menuBar.AddMenu( _fileMenu )
 		_menuBar.AddMenu( _editMenu )
 		_menuBar.AddMenu( _findMenu )
@@ -302,55 +306,6 @@ Class MainWindowInstance Extends Window
 		_menuBar.AddMenu( _windowMenu )
 		_menuBar.AddMenu( _helpMenu )
 		
-		'Tool Bar
-		'
-		Local newTitle:=GetActionTextWithShortcut( _fileActions.new_ )
-		Local openTitle:=GetActionTextWithShortcut( _fileActions.open )
-		Local saveAllTitle:=GetActionTextWithShortcut( _fileActions.saveAll )
-		Local undoTitle:=GetActionTextWithShortcut( _editActions.undo )
-		Local redoTitle:=GetActionTextWithShortcut( _editActions.redo )
-		Local runTitle:=GetActionTextWithShortcut( _buildActions.buildAndRun )
-		Local buildTitle:=GetActionTextWithShortcut( _buildActions.build )
-		Local checkTitle:=GetActionTextWithShortcut( _buildActions.semant )
-		Local findTitle:=GetActionTextWithShortcut( _findActions.find )
-		
-		If Prefs.MainToolBarVisible
-			_toolBar=New ToolBarExt
-			_toolBar.Style=GetStyle( "MainToolBar" )
-			_toolBar.MaxSize=New Vec2i( 10000,40 )
-			
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/new_file.png" ),_fileActions.new_.Triggered,newTitle )
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/open_file.png" ),_fileActions.open.Triggered,openTitle )
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/open_project.png" ),_projectView.openProject.Triggered,"Open project..." )
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/save_all.png" ),_fileActions.saveAll.Triggered,saveAllTitle )
-			_toolBar.AddSeparator()
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/undo.png" ),_editActions.undo.Triggered,undoTitle )
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/redo.png" ),_editActions.redo.Triggered,redoTitle )
-			_toolBar.AddSeparator()
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/check.png" ),_buildActions.semant.Triggered,checkTitle )
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/build.png" ),_buildActions.build.Triggered,buildTitle )
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/run.png" ),_buildActions.buildAndRun.Triggered,runTitle )
-			_toolBar.AddSeparator()
-			
-			Local act:=Lambda()
-				_buildActions.targetMenu.Open()
-			End
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/options.png" ),act,"Target settings" )
-			_toolBar.AddSeparator()
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/find.png" ),_findActions.find.Triggered,findTitle )
-			_toolBar.AddSeparator()
-			
-			Local goBack:=Lambda()
-				Navigator.TryBack()
-			End
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/back.png" ),goBack,"Go back (Alt+Left)" )
-			
-			Local goForw:=Lambda()
-				Navigator.TryForward()
-			End
-			_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/forward.png" ),goForw,"Go forward (Alt+Right)" )
-			
-		Endif
 		
 		_browsersTabView.AddTab( "Project",_projectView,True )
 		_browsersTabView.AddTab( "Source",_docBrowser,False )
@@ -359,29 +314,15 @@ Class MainWindowInstance Extends Window
 		
 		_consolesTabView.AddTab( "Build",_buildConsole,True )
 		_consolesTabView.AddTab( "Output",_outputConsole,False )
-		_consolesTabView.AddTab( "Docs",_helpViewDocker,False )
+		_consolesTabView.AddTab( "Docs",_helpConsole,False )
 		_consolesTabView.AddTab( "Find",_findConsole,False )
 		
-		_statusBar=New StatusBar
+		_statusBar=New StatusBarView
 		
 		_contentView=New DockingView
 		_contentView.AddView( _menuBar,"top" )
 		
-		If _toolBar
-'			Local vv:=New DockingView
-'			vv.AddView( _toolBar,"left" )
-'			
-'			Local better:=New DockingView
-'			better.AddView( New Label( "Make me better" ),"left" )
-'			vv.AddView( better,"right" )
-			
-			_contentView.AddView( _toolBar,"top" )
-		Endif
-		
-		_contentView.AddView( _statusBar,"bottom" )
-		_contentView.AddView( _browsersTabView,"right",250,True )
-		_contentView.AddView( _consolesTabView,"bottom",200,True )
-		_contentView.ContentView=_docsTabView
+		ArrangeElements()
 		
 		ContentView=_contentView
 
@@ -390,13 +331,43 @@ Class MainWindowInstance Extends Window
 		LoadState( jobj )
 		
 		App.MouseEventFilter+=ThemeScaleMouseFilter
-				
+		
 		App.Idle+=OnAppIdle
 		
 		If GetFileType( "bin/ted2.state.json" )=FileType.None _helpActions.about.Trigger()
 		
+		_enableSaving=True
+		
+	End
+	
+	Method ArrangeElements()
+		
+		_contentView.RemoveView( _toolBar )
+		_contentView.RemoveView( _statusBar )
+		_contentView.RemoveView( _browsersTabView )
+		_contentView.RemoveView( _consolesTabView )
+		
+		If Prefs.MainToolBarVisible
+			_toolBar=GetMainToolBar()
+			_contentView.AddView( _toolBar,"top" )
+		Endif
+		
+		_contentView.AddView( _statusBar,"bottom" )
+		
+		Local location:=Prefs.MainProjectTabsRight ? "right" Else "left"
+		
+		Local size:=_browsersTabView.Rect.Width
+		If size=0 Then size=250
+		_contentView.AddView( _browsersTabView,location,size,True )
+		
+		size=_consolesTabView.Rect.Height
+		If size=0 Then size=200
+		_contentView.AddView( _consolesTabView,"bottom",size,True )
+		
+		_contentView.ContentView=_docsTabView
 	End
 	
+	
 	Method OnFind()
 		_findActions.find.Trigger()
 	End
@@ -409,6 +380,18 @@ Class MainWindowInstance Extends Window
 		_findActions.findNext.Trigger()
 	End
 	
+	Method OnForceStop()
+	
+		If _buildConsole.Running
+			_buildConsole.Terminate()
+			HideStatusBarProgress()
+			RestoreConsoleVisibility()
+		Endif
+		If _outputConsole.Running
+			_outputConsole.Terminate()
+		Endif
+	End
+	
 	Property Mx2ccPath:String()
 	
 		Return _mx2cc
@@ -439,22 +422,42 @@ Class MainWindowInstance Extends Window
 		Return _buildActions.LockedDocument
 	End
 	
+	Property IsTerminating:Bool()
+		
+		Return _isTerminating
+	End
+	
+	Property ThemeName:String()
+		
+		Return _theme
+	Setter( value:String )
+		
+		_theme=value
+	End
+	
 	Method Terminate()
 	
+		_isTerminating=True
+		
 		SaveState()
 		
+		_fileActions.closeAll.Trigger() 'stops all parser's timers on close docs
+		
 		App.Terminate()
 	End
 
 	'Use these as macos still seems to have problems running requesters on a fiber - stacksize?
 	'
-	Method RequestFile:String( title:String,path:String,save:Bool )
+	Method RequestFile:String( title:String,path:String,save:Bool,filter:String="" )
 	
 		Local future:=New Future<String>
 		
-		App.Idle+=Lambda()
+		If Not filter Then filter="Monkey2 files:monkey2;Text files:txt;Image files:png,jpg,jpeg;All files:*"
 		
-			future.Set( requesters.RequestFile( title,,save,path ) )
+		App.Idle+=Lambda()
+			
+			Local s:=requesters.RequestFile( title,filter,save,path )
+			future.Set( s )
 		End
 		
 		Return future.Get()
@@ -482,14 +485,48 @@ Class MainWindowInstance Extends Window
 		Return ""
 	End
 	
+	Method UpdateToolsPaths()
+		
+		_tmp=RealPath( "tmp/" )
+		
+#If __TARGET__="macos"
+		_mx2cc="bin/mx2cc_macos"
+#Else If __TARGET__="windows"
+		_mx2cc="bin/mx2cc_windows.exe"
+#Else If __TARGET__="raspbian"
+		_mx2cc="bin/mx2cc_raspbian"
+#Else
+		_mx2cc="bin/mx2cc_linux"
+#Endif
+		_mx2cc=RealPath( _mx2cc )
+		
+		_modsDir=RealPath( "modules/" )
+	End
+	
+	Method StoreConsoleVisibility()
+		
+		_storedConsoleVisible=_consolesTabView.Visible
+	End
+	
+	Method RestoreConsoleVisibility()
+	
+		_consolesTabView.Visible=_storedConsoleVisible
+		RequestRender()
+	End
+	
 	Method IsTmpPath:Bool( path:String )
 
 		Return path.StartsWith( _tmp )
 	End
-
-	Method ShowStatusBarText( text:String )
 	
-		_statusBar.SetText( text )
+	Method SetStatusBarActive( active:Bool )
+	
+		_statusBar.SetActiveState( active )
+	End
+	
+	Method ShowStatusBarText( text:String,append:Bool=False )
+	
+		_statusBar.SetText( text,append )
 	End
 	
 	Method SetStatusBarInsertMode( ins:Bool )
@@ -506,10 +543,10 @@ Class MainWindowInstance Extends Window
 		_statusBar.SetLineInfo( "Ln : "+line+"  Col : "+pos )
 	End
 	
-	Method ShowStatusBarProgress( cancelCallback:Void() )
+	Method ShowStatusBarProgress( cancelCallback:Void(),cancelIconOnly:Bool=False )
 	
 		_statusBar.Cancelled=cancelCallback
-		_statusBar.ShowProgress()
+		_statusBar.ShowProgress( cancelIconOnly )
 	End
 	
 	Method HideStatusBarProgress()
@@ -519,7 +556,61 @@ Class MainWindowInstance Extends Window
 	
 	
 	Private
+	
+	Method GetMainToolBar:ToolBarExt()
+		
+		If _toolBar Return _toolBar
+		
+		'Tool Bar
+		'
+		Local newTitle:=GetActionTextWithShortcut( _fileActions.new_ )
+		Local openTitle:=GetActionTextWithShortcut( _fileActions.open )
+		Local saveAllTitle:=GetActionTextWithShortcut( _fileActions.saveAll )
+		Local undoTitle:=GetActionTextWithShortcut( _editActions.undo )
+		Local redoTitle:=GetActionTextWithShortcut( _editActions.redo )
+		Local runTitle:=GetActionTextWithShortcut( _buildActions.buildAndRun )
+		Local buildTitle:=GetActionTextWithShortcut( _buildActions.build )
+		Local checkTitle:=GetActionTextWithShortcut( _buildActions.semant )
+		Local findTitle:=GetActionTextWithShortcut( _findActions.find )
 		
+		_toolBar=New ToolBarExt
+		_toolBar.Style=GetStyle( "MainToolBar" )
+		_toolBar.MaxSize=New Vec2i( 10000,40 )
+		
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/new_file.png" ),_fileActions.new_.Triggered,newTitle )
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/open_file.png" ),_fileActions.open.Triggered,openTitle )
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/open_project.png" ),_projectView.openProject.Triggered,"Open project..." )
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/save_all.png" ),_fileActions.saveAll.Triggered,saveAllTitle )
+		_toolBar.AddSeparator()
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/undo.png" ),_editActions.undo.Triggered,undoTitle )
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/redo.png" ),_editActions.redo.Triggered,redoTitle )
+		_toolBar.AddSeparator()
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/check.png" ),_buildActions.semant.Triggered,checkTitle )
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/build.png" ),_buildActions.build.Triggered,buildTitle )
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/run.png" ),_buildActions.buildAndRun.Triggered,runTitle )
+		_toolBar.AddSeparator()
+		
+		Local act:=Lambda()
+			_buildActions.targetMenu.Open()
+		End
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/options.png" ),act,"Target settings" )
+		_toolBar.AddSeparator()
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/find.png" ),_findActions.find.Triggered,findTitle )
+		_toolBar.AddSeparator()
+		
+		Local goBack:=Lambda()
+			Navigator.TryBack()
+		End
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/back.png" ),goBack,"Go back (Alt+Left)" )
+		
+		Local goForw:=Lambda()
+			Navigator.TryForward()
+		End
+		_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/forward.png" ),goForw,"Go forward (Alt+Right)" )
+		
+		Return _toolBar
+	End
+	
 	Method DeleteTmps()
 	
 		For Local f:=Eachin LoadDir( _tmp )
@@ -544,6 +635,7 @@ Class MainWindowInstance Extends Window
 	End
 	
 	Method ShowBuildConsole( vis:Bool=True )
+		
 		If vis _consolesTabView.Visible=True
 		_consolesTabView.CurrentView=_buildConsole
 	End
@@ -555,7 +647,7 @@ Class MainWindowInstance Extends Window
 	
 	Method ShowHelpView()
 		_consolesTabView.Visible=True
-		_consolesTabView.CurrentView=_helpViewDocker
+		_consolesTabView.CurrentView=_helpConsole
 	End
 	
 	Method ShowFindResults()
@@ -683,13 +775,40 @@ Class MainWindowInstance Extends Window
 		doc.GotoDeclaration()
 	End
 	
+	Method GotoLine()
+		
+		Local tv:=_docsManager.CurrentTextView
+		If Not tv Return
+		
+		New Fiber( Lambda()
+			
+			Local line:=RequestInt( "Goto line:","Goto line",tv.CursorLine+1,0,1,tv.Document.NumLines )
+			
+			If line Then tv.GotoLine( line-1 )
+			
+			tv.MakeKeyView()
+			
+		End )
+		
+	End
+	
+	
 	Method SaveState()
 	
+		If Not _enableSaving Return
+
 		Local jobj:=New JsonObject
 		
 		jobj["windowRect"]=ToJson( Frame )
+		
 		jobj["browserSize"]=New JsonNumber( Int( _contentView.GetViewSize( _browsersTabView ) ) )
+		jobj["browserVisible"]=New JsonBool( _browsersTabView.Visible )
+		jobj["browserTab"]=New JsonString( GetBrowsersTabAsString() )
+		
 		jobj["consoleSize"]=New JsonNumber( Int( _contentView.GetViewSize( _consolesTabView ) ) )
+		jobj["consoleVisible"]=New JsonBool( _consolesTabView.Visible )
+		jobj["consoleTab"]=New JsonString( GetConsolesTabAsString() )
+		
 		
 		Local recent:=New JsonArray
 		For Local path:=Eachin _recentFiles
@@ -697,7 +816,13 @@ Class MainWindowInstance Extends Window
 		End
 		jobj["recentFiles"]=recent
 		
-		jobj["theme"]=New JsonString( _theme )
+		recent=New JsonArray
+		For Local path:=Eachin _recentProjects
+			recent.Add( New JsonString( path ) )
+		End
+		jobj["recentProjects"]=recent
+		
+		jobj["theme"]=New JsonString( ThemeName )
 		
 		jobj["themeScale"]=New JsonNumber( App.Theme.Scale.y )
 		
@@ -753,22 +878,25 @@ Class MainWindowInstance Extends Window
 		_docsTabView.EnsureVisibleCurrentTab()
 	End
 	
-	Method OnForceStop()
+	Method OnCloseApp()
 		
-		If _buildConsole.Running
-			_buildConsole.Terminate()
-			HideStatusBarProgress()
-		Else If _outputConsole.Running
-			_outputConsole.Terminate()
-		Endif
+		SaveState()
+		_enableSaving=False
+		OnForceStop() ' kill build process if started
+		ProcessReader.StopAll()
+		_fileActions.quit.Trigger()
 	End
 	
 	Method LoadState( jobj:JsonObject )
 	
 		If jobj.Contains( "browserSize" ) _contentView.SetViewSize( _browsersTabView,jobj.GetNumber( "browserSize" ) )
-
+		If jobj.Contains( "browserVisible" ) _browsersTabView.Visible=jobj.GetBool( "browserVisible" )
+		If jobj.Contains( "browserTab" ) SetBrowsersTabByString( jobj.GetString( "browserTab" ) )
+		
 		If jobj.Contains( "consoleSize" ) _contentView.SetViewSize( _consolesTabView,jobj.GetNumber( "consoleSize" ) )
-			
+		If jobj.Contains( "consoleVisible" ) _consolesTabView.Visible=jobj.GetBool( "consoleVisible" )
+		If jobj.Contains( "consoleTab" ) SetConsolesTabByString( jobj.GetString( "consoleTab" ) )
+		
 		If jobj.Contains( "recentFiles" )
 			For Local file:=Eachin jobj.GetArray( "recentFiles" )
 				Local path:=file.ToString()
@@ -777,7 +905,15 @@ Class MainWindowInstance Extends Window
 			Next
 		End
 		
-		If jobj.Contains( "theme" ) _theme=jobj.GetString( "theme" )
+		If jobj.Contains( "recentProjects" )
+			For Local file:=Eachin jobj.GetArray( "recentProjects" )
+				Local path:=file.ToString()
+				If GetFileType( path )<>FileType.Directory Continue
+				_recentProjects.Push( path )
+			Next
+		End
+		
+		If jobj.Contains( "theme" ) ThemeName=jobj.GetString( "theme" )
 		
 		If jobj.Contains( "themeScale" )
 			_themeScale=jobj.GetNumber( "themeScale" )
@@ -790,16 +926,15 @@ Class MainWindowInstance Extends Window
 			_mx2cc=_mx2ccDir+StripDir( _mx2cc )
 		Endif
 		
+		
 		_docsManager.LoadState( jobj )
 		_buildActions.LoadState( jobj )
 		_projectView.LoadState( jobj )
 		
 		If Not _projectView.OpenProjects _projectView.OpenProject( CurrentDir() )
 		
-		_projectView.ProjectOpened+=UpdateCloseProjectMenu
-		
 		UpdateRecentFilesMenu()
-		
+		UpdateRecentProjectsMenu()
 		UpdateCloseProjectMenu()
 
 		DeleteTmps()
@@ -828,8 +963,7 @@ Class MainWindowInstance Extends Window
 
 		Select event.Type
 		Case EventType.WindowClose
-			SaveState()
-			_fileActions.quit.Trigger()
+			OnCloseApp()
 		Default
 			Super.OnWindowEvent( event )
 		End
@@ -856,13 +990,13 @@ Class MainWindowInstance Extends Window
 	Field _buildConsole:Console
 	Field _outputConsole:Console
 	Field _helpView:HtmlViewExt
-	Field _helpViewDocker:DockingView
+	Field _helpConsole:DockingView
 	Field _findConsole:TreeViewExt
 	
 	Field _projectView:ProjectView
 	Field _docBrowser:DockingView
 	Field _debugView:DebugView
-	Field _helpTree:HelpTree
+	Field _helpTree:HelpTreeView
 
 	Field _docsTabView:TabViewExt
 	Field _consolesTabView:TabView
@@ -871,30 +1005,36 @@ Class MainWindowInstance Extends Window
 	Field _forceStop:Action
 
 	Field _tabMenu:Menu
-	Field _newFiles:Menu
-	Field _fileMenu:Menu
-	Field _editMenu:Menu
-	Field _findMenu:Menu
-	Field _viewMenu:Menu
-	Field _buildMenu:Menu
-	Field _windowMenu:Menu
-	Field _helpMenu:Menu
-	Field _menuBar:MenuBar
-	
-	Field _themesMenu:Menu
+	Field _templateFiles:MenuExt
+	Field _fileMenu:MenuExt
+	Field _editMenu:MenuExt
+	Field _findMenu:MenuExt
+	Field _viewMenu:MenuExt
+	Field _buildMenu:MenuExt
+	Field _windowMenu:MenuExt
+	Field _helpMenu:MenuExt
+	Field _menuBar:MenuBarExt
+	
+	Field _themesMenu:MenuExt
 	
 	Field _theme:String="default"
 	Field _themeScale:Float=1
 	
 	Field _contentView:DockingView
+	Field _contentLeftView:DockingView
+	Field _contentRightView:DockingView
 
 	Field _recentFiles:=New StringStack
+	Field _recentProjects:=New StringStack
 	
-	Field _recentFilesMenu:Menu
-	Field _closeProjectMenu:Menu
-	Field _statusBar:StatusBar
+	Field _recentFilesMenu:MenuExt
+	Field _recentProjectsMenu:MenuExt
+	Field _closeProjectMenu:MenuExt
+	Field _statusBar:StatusBarView
 	Field _ovdMode:=False
-	
+	Field _storedConsoleVisible:Bool
+	Field _isTerminating:Bool
+	Field _enableSaving:Bool
 	
 	Method ToJson:JsonValue( rect:Recti )
 		Return New JsonArray( New JsonValue[]( New JsonNumber( rect.min.x ),New JsonNumber( rect.min.y ),New JsonNumber( rect.max.x ),New JsonNumber( rect.max.y ) ) )
@@ -910,14 +1050,27 @@ Class MainWindowInstance Extends Window
 		_recentFiles.Remove( path )
 		_recentFiles.Insert( 0,path )
 		
-		If _recentFiles.Length>20 _recentFiles.Resize( 20 )
+		If _recentFiles.Length>20 Then _recentFiles.Resize( 20 )
+		
+		UpdateRecentFilesMenu()
+	End
+	
+	Method AddRecentProject( path:String )
+	
+		_recentProjects.Remove( path )
+		_recentProjects.Insert( 0,path )
+	
+		If _recentProjects.Length>10 Then _recentProjects.Resize( 10 )
+		
+		UpdateRecentProjectsMenu()
+		UpdateCloseProjectMenu( path )
 	End
 	
 	Method UpdateRecentFilesMenu()
 	
 		_recentFilesMenu.Clear()
 		
-		Local recentFiles:=New StringStack
+		Local recents:=New StringStack
 		
 		For Local path:=Eachin _recentFiles
 			If GetFileType( path )<>FileType.File Continue
@@ -926,10 +1079,29 @@ Class MainWindowInstance Extends Window
 				_docsManager.OpenDocument( path,True )
 			End
 			
-			recentFiles.Add( path )
+			recents.Add( path )
 		Next
 		
-		_recentFiles=recentFiles
+		_recentFiles=recents
+	End
+	
+	Method UpdateRecentProjectsMenu()
+	
+		_recentProjectsMenu.Clear()
+	
+		Local recents:=New StringStack
+	
+		For Local path:=Eachin _recentProjects
+			If GetFileType( path )<>FileType.Directory Continue
+	
+			_recentProjectsMenu.AddAction( path ).Triggered=Lambda()
+				_projectView.OpenProject( path )
+			End
+	
+			recents.Add( path )
+		Next
+	
+		_recentProjects=recents
 	End
 	
 	Method UpdateCloseProjectMenu( dir:String="" )
@@ -948,7 +1120,7 @@ Class MainWindowInstance Extends Window
 		Next
 	End
 	
-	Method AddZoomActions( menu:Menu )
+	Method AddZoomActions( menu:MenuExt )
 		
 		menu.AddAction( "Zoom in" ).Triggered=Lambda()
 			If _themeScale>=4 Return
@@ -1001,9 +1173,9 @@ Class MainWindowInstance Extends Window
 		
 	End
 	
-	Method CreateThemesMenu:Menu( text:String )
+	Method CreateThemesMenu:MenuExt( text:String )
 	
-		Local menu:=New Menu( text )
+		Local menu:=New MenuExt( text )
 		
 		Local themes:=JsonObject.Load( "theme::themes.json" )
 		If Not themes Return menu
@@ -1012,7 +1184,11 @@ Class MainWindowInstance Extends Window
 			Local name:=it.Key
 			Local value:=it.Value.ToString()
 			menu.AddAction( name ).Triggered=Lambda()
-				_theme=value
+				
+				If value=ThemeName Return
+				
+				ThemeName=value
+				
 				App.Theme.Load( _theme,New Vec2f( _themeScale ) )
 				SaveState()
 			End
@@ -1022,7 +1198,7 @@ Class MainWindowInstance Extends Window
 	End
 		
 	Method OnAppIdle()
-	
+		
 		_docsManager.Update()
 		_fileActions.Update()
 		_editActions.Update()
@@ -1036,6 +1212,67 @@ Class MainWindowInstance Extends Window
 		GCCollect()	'thrash that GC!
 	End
 	
+	Method GetConsolesTabAsString:String()
+		
+		Select _consolesTabView.CurrentView
+			Case _outputConsole
+				Return "output"
+			Case _buildConsole
+				Return "build"
+			Case _helpConsole
+				Return "docs"
+			Case _findConsole
+				Return "find"
+		End
+		Return ""
+	End
+	
+	Method SetConsolesTabByString( value:String )
+		
+		Local view:View
+		Select value
+			Case "output"
+				view=_outputConsole
+			Case "build"
+				view=_buildConsole
+			Case "docs"
+				view=_helpConsole
+			Case "find"
+				view=_findConsole
+		End
+		If view Then _consolesTabView.CurrentView=view
+	End
+	
+	Method GetBrowsersTabAsString:String()
+	
+		Select _browsersTabView.CurrentView
+			Case _projectView
+				Return "project"
+			Case _docBrowser
+				Return "source"
+			Case _debugView
+				Return "debug"
+			Case _helpTree
+				Return "help"
+		End
+		Return ""
+	End
+	
+	Method SetBrowsersTabByString( value:String )
+	
+		Local view:View
+		Select value
+			Case "project"
+				view=_projectView
+			Case "source"
+				view=_docBrowser
+			Case "debug"
+				view=_debugView
+			Case "help"
+				view=_helpTree
+		End
+		If view Then _browsersTabView.CurrentView=view
+	End
 End
 
 

+ 0 - 0
plugin.monkey2 → Plugin.monkey2


+ 65 - 12
prefs.monkey2 → Prefs.monkey2

@@ -1,4 +1,3 @@
-
 Namespace ted2go
 
 
@@ -11,19 +10,34 @@ Class Prefs
 	Global AcUseTab:=True
 	Global AcUseEnter:=False
 	Global AcUseSpace:=True
+	Global AcUseDot:=False
 	Global AcNewLineByEnter:=True
 	'
 	Global MainToolBarVisible:=True
-	Global EditorToolBarVisible:=True
+	Global MainProjectTabsRight:=True
+	'
+	Global EditorToolBarVisible:=False
 	Global EditorGutterVisible:=True
 	Global EditorShowWhiteSpaces:=False
+	Global EditorFontPath:String
+	Global EditorFontSize:=16
+	Global EditorShowEvery10LineNumber:=True
 	'
 	Global SourceSortByType:=True
 	Global SourceShowInherited:=False
-	
+	'
+	Global MonkeyRootPath:String
 	
 	Function LoadState( json:JsonObject )
 		
+		If json.Contains( "main" )
+			
+			Local j2:=json["main"].ToObject()
+			If j2.Contains( "toolBarVisible" ) Then MainToolBarVisible=j2["toolBarVisible"].ToBool()
+			If j2.Contains( "tabsRight" ) Then MainProjectTabsRight=j2["tabsRight"].ToBool()
+		
+		Endif
+		
 		If json.Contains( "completion" )
 		
 			Local j2:=json["completion"].ToObject()
@@ -33,22 +47,20 @@ Class Prefs
 			AcUseTab=j2["useTab"].ToBool()
 			AcUseEnter=j2["useEnter"].ToBool()
 			AcUseSpace=GetJsonBool( j2,"useSpace",AcUseSpace )
+			AcUseDot=GetJsonBool( j2,"useDot",AcUseDot )
 			AcNewLineByEnter=j2["newLineByEnter"].ToBool()
 			
 		Endif
 		
-		If json.Contains( "mainToolBarVisible" )
-		
-			MainToolBarVisible=json["mainToolBarVisible"].ToBool()
-		
-		Endif
-		
 		If json.Contains( "editor" )
 		
 			Local j2:=json["editor"].ToObject()
 			EditorToolBarVisible=j2["toolBarVisible"].ToBool()
 			EditorGutterVisible=j2["gutterVisible"].ToBool()
 			EditorShowWhiteSpaces=GetJsonBool( j2,"showWhiteSpaces",EditorShowWhiteSpaces )
+			If j2.Contains("fontPath") Then EditorFontPath=j2["fontPath"].ToString()
+			If j2.Contains("fontSize") Then EditorFontSize=Int( j2["fontSize"].ToNumber() )
+			EditorShowEvery10LineNumber=GetJsonBool( j2,"showEvery10",EditorShowEvery10LineNumber )
 			
 		Endif
 		
@@ -57,28 +69,35 @@ Class Prefs
 			Local j2:=json["source"].ToObject()
 			SourceSortByType=j2["sortByType"].ToBool()
 			SourceShowInherited=j2["showInherited"].ToBool()
-		
+			
 		Endif
 	End
 	
 	Function SaveState( json:JsonObject )
 		
 		Local j:=New JsonObject
+		j["toolBarVisible"]=New JsonBool( MainToolBarVisible )
+		j["tabsRight"]=New JsonBool( MainProjectTabsRight )
+		json["main"]=j
+		 
+		j=New JsonObject
 		j["enabled"]=New JsonBool( AcEnabled )
 		j["keywordsOnly"]=New JsonBool( AcKeywordsOnly )
 		j["showAfter"]=New JsonNumber( AcShowAfter )
 		j["useTab"]=New JsonBool( AcUseTab )
 		j["useEnter"]=New JsonBool( AcUseEnter )
 		j["useSpace"]=New JsonBool( AcUseSpace )
+		j["useDot"]=New JsonBool( AcUseDot )
 		j["newLineByEnter"]=New JsonBool( AcNewLineByEnter )
 		json["completion"]=j
 		
-		json["mainToolBarVisible"]=New JsonBool( MainToolBarVisible )
-		
 		j=New JsonObject
 		j["toolBarVisible"]=New JsonBool( EditorToolBarVisible )
 		j["gutterVisible"]=New JsonBool( EditorGutterVisible )
 		j["showWhiteSpaces"]=New JsonBool( EditorShowWhiteSpaces )
+		j["fontPath"]=New JsonString( EditorFontPath )
+		j["fontSize"]=New JsonNumber( EditorFontSize )
+		j["showEvery10"]=New JsonBool( EditorShowEvery10LineNumber )
 		json["editor"]=j
 		
 		j=New JsonObject
@@ -87,6 +106,40 @@ Class Prefs
 		json["source"]=j
 	End
 	
+	Function LoadLocalState()
+		
+		Local json:=JsonObject.Load( AppDir()+"state.json" )
+		If Not json Return
+		
+		If json.Contains( "rootPath" ) Then MonkeyRootPath=json["rootPath"].ToString()
+		
+	End
+	
+	Function SaveLocalState()
+		
+		Local json:=New JsonObject
+		json["rootPath"]=New JsonString( MonkeyRootPath )
+		json.Save( AppDir()+"state.json" )
+		
+	End
+	
+	Function GetCustomFontPath:String()
+		
+		If Not EditorFontPath Return ""
+		If Not EditorFontPath.Contains( ".ttf" ) Return ""
+		
+		Local path:=EditorFontPath
+		If Not path.Contains( ":" ) 'relative asset path
+			path=AssetsDir()+path
+		Endif
+		
+		Return path
+	End
+	
+	Function GetCustomFontSize:Int()
+	
+		Return Max( EditorFontSize,6 ) '6 is a minumal
+	End
 End
 
 

+ 207 - 0
ProcessReader.monkey2

@@ -0,0 +1,207 @@
+
+Namespace ted2go
+
+
+#rem monkeydoc The ProcessReader class.
+
+Allow us to read output from process.
+We can reuse this class with any commands.
+Each command starts new process.
+You should to wait until work is finished - if you run while process already running then nothing happen.
+
+There are 2 usage scenarios: RunAsync and Run.
+
+With RunAsync we get output by PortionRead and Finished events.
+This is not blocked method.
+
+With Run we get output as result of this call.
+This is blocked method.
+
+Both methods are using Fiber to waiting process finished.
+#end
+Class ProcessReader
+	
+	#rem monkeydoc Invoked when a process finishes execution.
+	#end
+	Field Finished:Void( output:String,exitCode:Int )
+	
+	#rem monkeydoc Invoked when read portion of output from process.
+	#end
+	Field PortionRead:Void( output:String )
+	
+	#rem monkeydoc Invoked when a process finishes execution AND exitCode <> 0.
+	#end
+	Field Error:Void( exitCode:Int )
+	
+	#rem monkeydoc Obtain a reader instance.
+	#end
+	Function Obtain:ProcessReader()
+	
+		Local r:ProcessReader
+		If _recycled.Empty
+			r=New ProcessReader
+		Else
+			r=_recycled[0]
+			_recycled.Remove( r )
+		Endif
+		r.Finished=Null
+		r.PortionRead=Null
+		r.Error=Null
+		_items.Add( r )
+		Return r
+	End
+	
+	#rem monkeydoc Recycle a reader instance. So we can get it again using Obtain.
+	#end
+	Function Recycle( r:ProcessReader )
+	
+		_items.Remove( r )
+		r.Stop()
+		_recycled.Add( r )
+	End
+	
+	#rem monkeydoc Stops all obtained readers if them are running and not recycled.
+	#end
+	Function StopAll()
+	
+		For Local r:=Eachin _items
+			r.Stop()
+		Next
+	End
+	
+	
+	#rem monkeydoc Async reading of process. You should to subscribe on (at least) Finished event to get result.
+	This method can be used without creation of new Fiber.
+	If started while process already running - nothing happen.
+	#end
+	Method RunAsync( command:String )
+		
+		If _running Return
+		
+		New Fiber( Lambda()
+		
+			RunInternal( command )
+		End )
+	End
+	
+	#rem monkeydoc Sync reading of process.
+	This method must be used with creation of new Fiber, because it uses Future to waiting for process finished.
+	Return full output of a process.
+	If started while process already running - immediately return an empty string.
+	#end
+	Method Run:String( command:String )
+	
+		If _running Return ""
+	
+		Return RunInternal( command )
+	End
+	
+	#rem monkeydoc Terminate process execution.
+	#end
+	Method Stop()
+	
+		If _running Then _process.Terminate()
+	End
+	
+	#rem monkeydoc Is reading currently in progress.
+	#end
+	Method IsRunning:Bool()
+	
+		Return _running
+	End
+	
+	Protected
+	
+	Method New()
+	End
+	
+	Private
+	
+	Field _process:Process
+	Field _output:String
+	Field _running:Bool
+	Field _stdoutWaiting:Future<Bool>
+	Field _stdoutOpen:Bool,_procOpen:Bool
+	Global _items:=New Stack<ProcessReader>
+	Global _recycled:=New Stack<ProcessReader>
+	
+	Method RunInternal:String( cmd:String )
+	
+		If Not Start( cmd )
+			Print "Failed to start process '"+cmd+"'"
+			Return ""
+		Endif
+		
+		' waiting for the end
+		_stdoutWaiting=New Future<Bool>
+		_stdoutWaiting.Get()
+		_stdoutWaiting=Null
+		
+		Return _output
+	End
+	
+	Method Start:Bool( cmd:String )
+		
+		If _running Return False
+		
+		Local process:=New Process
+	
+		process.Finished=Lambda()
+			
+			_procOpen=False
+			UpdateRunning()
+		End
+		
+		process.StdoutReady=Lambda()
+		
+			Local stdout:=process.ReadStdout()
+			
+			If stdout
+				stdout=stdout.Replace( "~r~n","~n" ).Replace( "~r","~n" )
+				_output+=stdout
+				PortionRead( stdout )
+			Else
+				_stdoutOpen=False
+				UpdateRunning()
+			Endif
+		End
+		
+		If Not process.Start( cmd ) Return False
+		
+		_process=process
+		
+		_running=True
+		_procOpen=True
+		_stdoutOpen=True
+		_output=""
+		
+		Return True
+	End
+	
+	Method UpdateRunning()
+	
+		If Not _running Or _procOpen Or _stdoutOpen Return
+	
+		_running=False
+		
+		If _stdoutWaiting Then _stdoutWaiting.Set( True )
+		
+		Local code:=_process.ExitCode
+		
+		Finished( _output,code )
+		If code<>0 Then Error( code )
+	End
+	
+End
+
+
+Private
+
+' Extends ProcessReader - to get access to protected New()
+Class ProcessBridge Extends ProcessReader
+
+	Function Create:ProcessReader()
+		
+		Return New ProcessReader
+	End
+End

+ 229 - 0
Ted2.monkey2

@@ -0,0 +1,229 @@
+
+#If __TARGET__="windows"
+
+#Import "bin/wget.exe"
+
+'to build resource.o when icon changes...
+'
+'windres resource.rc resource.o
+
+#Import "logo/resource.o"
+
+#Endif
+
+'----------------------------
+
+'#Import "<reflection>"
+
+#Import "<std>"
+#Import "<mojo>"
+#Import "<mojox>"
+#Import "<tinyxml2>"
+
+#Import "action/FileActions"
+#Import "action/EditActions"
+#Import "action/BuildActions"
+#Import "action/HelpActions"
+#Import "action/FindActions"
+#Import "action/ViewActions"
+
+#Import "dialog/FindDialog"
+#Import "dialog/PrefsDialog"
+#Import "dialog/EditProductDialog"
+#Import "dialog/DialogExt"
+#Import "dialog/NoTitleDialog"
+#Import "dialog/FindInFilesDialog"
+
+#Import "document/DocumentManager"
+#Import "document/Ted2Document"
+#Import "document/CodeDocument"
+#Import "document/PlainTextDocument"
+#Import "document/ImageDocument"
+#Import "document/AudioDocument"
+#Import "document/JsonDocument"
+#Import "document/XmlDocument"
+
+#Import "eventfilter/TextViewKeyEventFilter"
+#Import "eventfilter/Monkey2KeyEventFilter"
+
+#Import "parser/CodeItem"
+#Import "parser/Parser"
+#Import "parser/Monkey2Parser"
+#Import "parser/ParserPlugin"
+
+#Import "product/BuildProduct"
+#Import "product/Mx2ccEnv"
+#Import "product/ModuleManager"
+
+#Import "syntax/Keywords"
+#Import "syntax/Monkey2Keywords"
+#Import "syntax/Highlighter"
+#Import "syntax/Monkey2Highlighter"
+#Import "syntax/CppHighlighter"
+#Import "syntax/CppKeywords"
+#Import "syntax/GlslHighlighter"
+#Import "syntax/GlslKeywords"
+#Import "syntax/CodeFormatter"
+#Import "syntax/Monkey2Formatter"
+
+#Import "testing/ParserTests"
+
+#Import "utils/JsonUtils"
+#Import "utils/Utils"
+
+#Import "view/CodeTextView"
+#Import "view/ConsoleViewExt"
+#Import "view/ListViewExt"
+#Import "view/AutocompleteView"
+#Import "view/CodeTreeView"
+#Import "view/TreeViewExt"
+#Import "view/CodeGutterView"
+#Import "view/ToolBarViewExt"
+#Import "view/HintView"
+#Import "view/HtmlViewExt"
+#Import "view/ProjectBrowserView"
+#Import "view/TabViewExt"
+#Import "view/StatusBarView"
+#Import "view/DebugView"
+#Import "view/ProjectView"
+#Import "view/HelpTreeView"
+#Import "view/Ted2TextView"
+#Import "view/JsonTreeView"
+#Import "view/XmlTreeView"
+#Import "view/Monkey2TreeView"
+#Import "view/GutterView"
+#Import "view/MenuExt"
+
+#Import "MainWindow"
+#Import "Plugin"
+#Import "ThemeImages"
+#Import "Prefs"
+#Import "ProcessReader"
+
+
+Namespace ted2go
+
+Using std..
+Using mojo..
+Using mojox..
+Using tinyxml2..
+
+
+Global AppTitle:="Ted2Go v2.3.1"
+
+
+Function Main()
+
+	Prefs.LoadLocalState()
+	
+	Local root:=Prefs.MonkeyRootPath
+	If Not root Then root=AppDir()
+	
+	' return real folder or empty string
+	Local path:=SetupMonkeyRootPath( root,True )
+	If Not path
+		libc.exit_( 1 )
+		Return
+	Endif
+	
+	If path<>root
+		Prefs.MonkeyRootPath=path
+		Prefs.SaveLocalState()
+	Endif
+	
+	'load ted2 state
+	'
+	Local jobj:=JsonObject.Load( "bin/ted2.state.json" )
+	If Not jobj jobj=New JsonObject
+
+	Prefs.LoadState( jobj )
+	
+	'initial theme
+	'	
+	If Not jobj.Contains( "theme" ) jobj["theme"]=New JsonString( "theme-classic-dark" )
+	If Not jobj.Contains( "themeScale" ) jobj["themeScale"]=New JsonNumber( 1 )
+	
+	Local config:=New StringMap<String>
+	
+	config["initialTheme"]=jobj.GetString( "theme" )
+	config["initialThemeScale"]=jobj.GetNumber( "themeScale" )
+	
+	'start the app!
+	'	
+	New AppInstance( config )
+	
+	'initial window state
+	'
+	Local flags:=WindowFlags.Resizable|WindowFlags.HighDPI
+
+	Local rect:Recti
+	
+	If jobj.Contains( "windowRect" ) 
+		rect=ToRecti( jobj["windowRect"] )
+	Else
+		Local w:=Min( 1024,App.DesktopSize.x-40 )
+		Local h:=Min( 768,App.DesktopSize.y-64 )
+		rect=New Recti( 0,0,w,h )
+		flags|=WindowFlags.Center
+	Endif
+
+	New MainWindowInstance( AppTitle,rect,flags,jobj )
+	
+	' open docs from args
+	Local args:=AppArgs()
+	For Local i:=1 Until args.Length
+		Local arg:=args[i]
+		arg=arg.Replace( "\","/" )
+		If GetFileType( arg ) = FileType.File
+			MainWindow.OpenDocument( arg )
+		Endif
+	Next
+	
+	App.Run()
+		
+End
+
+Function SetupMonkeyRootPath:String( rootPath:String,searchMode:Bool )
+	
+#If __DESKTOP_TARGET__
+	
+	ChangeDir( rootPath )
+	
+	If searchMode
+		While GetFileType( "bin" )<>FileType.Directory Or GetFileType( "modules" )<>FileType.Directory
+	
+			If IsRootDir( CurrentDir() )
+				
+				Local ok:=Confirm( "Initializing","Error initializing - can't find working dir!~nDo you want to specify Monkey2 root folder now?" )
+				If Not ok
+					Return ""
+				End
+				Local s:=requesters.RequestDir( "Choose Monkey2 folder",AppDir() )
+				ChangeDir( s )
+				Continue
+			Endif
+			
+			ChangeDir( ExtractDir( CurrentDir() ) )
+		Wend
+		
+		rootPath=CurrentDir()
+	Else
+		
+		Local ok:= (GetFileType( "bin" )=FileType.Directory And GetFileType( "modules" )=FileType.Directory)
+		If Not ok
+			Notify( "Monkey2 root folder","Incorrect folder!" )
+			Return ""
+		Endif
+		
+	Endif
+	
+#Endif
+	
+	Return rootPath
+End
+
+Function GetActionTextWithShortcut:String( action:Action )
+
+	Return action.Text+" ("+action.HotKeyText+")"
+End
+

+ 0 - 0
themeimages.monkey2 → ThemeImages.monkey2


+ 101 - 73
actions/buildactions.monkey2 → action/BuildActions.monkey2

@@ -23,7 +23,15 @@ Class BuildError
 	
 End
 
-Class BuildActions
+
+Interface IModuleBuilder
+	
+	Method BuildModules:Bool( clean:Bool,modules:String="" )
+	
+End
+
+
+Class BuildActions Implements IModuleBuilder
 
 	Field buildAndRun:Action
 	Field build:Action
@@ -36,7 +44,8 @@ Class BuildActions
 	Field moduleManager:Action
 	Field rebuildHelp:Action
 	
-	Field targetMenu:Menu
+	Field targetMenu:MenuExt
+	
 	
 	Field PreBuild:Void()
 	
@@ -80,7 +89,7 @@ Class BuildActions
 		semant.Triggered=OnSemant
 		
 		
-		buildSettings=New Action( "Target settings" )
+		buildSettings=New Action( "Target settings..." )
 		buildSettings.Triggered=OnBuildFileSettings
 		
 		nextError=New Action( "Next build error" )
@@ -92,17 +101,17 @@ Class BuildActions
 		lockBuildFile.HotKey=Key.L
 		lockBuildFile.HotKeyModifiers=Modifier.Menu
 		
-		updateModules=New Action( "Update modules" )
+		updateModules=New Action( "Update modules..." )
 		updateModules.Triggered=OnUpdateModules
 		updateModules.HotKey=Key.U
 		updateModules.HotKeyModifiers=Modifier.Menu
 		
-		rebuildModules=New Action( "Rebuild modules" )
+		rebuildModules=New Action( "Rebuild modules..." )
 		rebuildModules.Triggered=OnRebuildModules
 		rebuildModules.HotKey=Key.U
 		rebuildModules.HotKeyModifiers=Modifier.Menu|Modifier.Shift
 		
-		moduleManager=New Action( "Module manager" )
+		moduleManager=New Action( "Module manager..." )
 		moduleManager.Triggered=OnModuleManager
 		
 		rebuildHelp=New Action( "Rebuild documentation" )
@@ -138,7 +147,7 @@ Class BuildActions
 		_iosTarget=New CheckButton( "iOS",,group )
 		_iosTarget.Layout="fill-x"
 		
-		targetMenu=New Menu( "Build target..." )
+		targetMenu=New MenuExt( "Build variants" )
 		targetMenu.AddView( _debugConfig )
 		targetMenu.AddView( _releaseConfig )
 		targetMenu.AddSeparator()
@@ -275,6 +284,49 @@ Class BuildActions
 		moduleManager.Enabled=idle
 	End
 
+	Method BuildModules:Bool( clean:Bool,modules:String="" )
+	
+		Local targets:=New StringStack
+	
+		For Local target:=Eachin _validTargets
+			targets.Push( target="ios" ? "iOS" Else target.Capitalize() )
+		Next
+	
+		targets.Push( "All!" )
+		targets.Push( "Cancel" )
+	
+		Local prefix:=clean ? "Rebuild" Else "Update"
+		Local text:="Modules: "
+		If modules Then text+=modules.Replace( " ",", " ) Else text+="All"
+		text+="~n~nSelect target:"
+	
+		Local i:=TextDialog.Run( prefix+" modules",text,targets.ToArray(),0,targets.Length-1 )
+	
+		Local result:=True
+	
+		Select i
+		Case targets.Length-1	'Cancel
+			Return False
+		Case targets.Length-2	'All!
+			For Local i:=0 Until targets.Length-2
+				If BuildModules( clean,targets[i],modules ) Continue
+				result=False
+				Exit
+			Next
+		Default
+			result=BuildModules( clean,targets[i],modules )
+		End
+	
+		If result
+			_console.Write( "~n"+prefix+" modules completed successfully!~n" )
+		Else
+			_console.Write( "~n"+prefix+" modules failed.~n" )
+		Endif
+	
+		Return result
+	End
+	
+	
 	Private
 	
 	Field _docs:DocumentManager
@@ -297,6 +349,7 @@ Class BuildActions
 	Field _iosTarget:CheckButton
 	
 	Field _validTargets:StringStack
+	Field _timing:Long
 	
 	Method BuildDoc:CodeDocument()
 		
@@ -338,33 +391,26 @@ Class BuildActions
 		tv.GotoLine( err.line )
 	End
 	
-	Method BuildMx2:Bool( cmd:String,progressText:String,run:Bool=True )
+	Method BuildMx2:Bool( cmd:String,progressText:String,action:String="build" )
 	
 		ClearErrors()
 		
 		_console.Clear()
 		
-		MainWindow.ShowBuildConsole( False )
+		MainWindow.StoreConsoleVisibility()
+		
+		MainWindow.ShowBuildConsole()
 		
 		If Not SaveAll() Return False
-
+		
+		_timing=Millisecs()
+		
 		If Not _console.Start( cmd )
 			Alert( "Failed to start process: '"+cmd+"'" )
 			Return False
 		Endif
 		
-		Local title := run ? "Building" Else "Checking"
-		'Local progress:=New ProgressDialog( title,progressText )
-		
-		'progress.MinSize=New Vec2i( 320,0 )
-		
-		'Local cancel:=progress.AddAction( "Cancel" )
-		
-		'cancel.Triggered=Lambda()
-		'	_console.Terminate()
-		'End
-		
-		'progress.Open()
+		Local title := (action="semant") ? "Checking" Else "Building"
 		
 		Local s:=progressText
 		If Not s.EndsWith( "..." ) Then s+="..."
@@ -413,23 +459,29 @@ Class BuildActions
 				Endif
 				
 			Endif
-						
+			
 			_console.Write( stdout )
 		
 		Forever
 		
-		'progress.Close()
 		MainWindow.HideStatusBarProgress()
 		
-		Local status:=hasErrors ? "Process failed. See the build console for details." Else (_console.ExitCode=0 ? "Process finished." Else "Process cancelled.")
+		Local status:=hasErrors ? "{0} failed. See the build console for details." Else (_console.ExitCode=0 ? "{0} finished." Else "{0} cancelled.")
+		status=status.Replace( "{0}",title )
+		
+		Local elapsed:=(Millisecs()-_timing)/1000
+		Local m:=elapsed/60
+		Local sec:=elapsed Mod 60
+		status+="   Time elapsed: "+m+" m "+sec+" s."
+		
 		MainWindow.ShowStatusBarText( status )
 		
 		Return _console.ExitCode=0
 	End
 
-	Method BuildModules:Bool( clean:Bool,target:String )
+	Method BuildModules:Bool( clean:Bool,target:String,modules:String )
 	
-		Local msg:=(clean ? "Rebuilding " Else "Updating ")+target
+		Local msg:=(clean ? "Rebuilding ~ " Else "Updating ~ ")+target
 		
 		For Local config:=0 Until 2
 		
@@ -438,56 +490,23 @@ Class BuildActions
 			Local cmd:=MainWindow.Mx2ccPath+" makemods -target="+target
 			If clean cmd+=" -clean"
 			cmd+=" -config="+cfg
+			If modules Then cmd+=" "+modules
 			
-			If Not BuildMx2( cmd,msg+" "+cfg+" modules..." ) Return False
+			Local s:=msg+" ~ "+cfg+" ~ ["
+			s+=modules ? modules Else "all modules"
+			s+="]..."
+			If Not BuildMx2( cmd,s ) Return False
 		Next
 		
 		Return True
 	End
 	
-	Method BuildModules:Bool( clean:Bool )
-	
-		Local targets:=New StringStack
-		
-		For Local target:=Eachin _validTargets
-			targets.Push( target="ios" ? "iOS" Else target.Capitalize() )
-		Next
-
-		targets.Push( "All!" )
-		targets.Push( "Cancel" )
-		
-		Local i:=TextDialog.Run( "Build Modules","Select target..",targets.ToArray(),0,targets.Length-1 )
-		
-		Local result:=True
-		
-		Select i
-		Case targets.Length-1	'Cancel
-			Return False
-		Case targets.Length-2	'All!
-			For Local i:=0 Until targets.Length-2
-				If BuildModules( clean,targets[i] ) Continue
-				result=False
-				Exit
-			Next
-		Default
-			result=BuildModules( clean,targets[i] )
-		End
-		
-		If result
-			_console.Write( "~nBuild modules completed successfully!~n" )
-		Else
-			_console.Write( "~nBuild modules failed.~n" )
-		Endif
-		
-		Return result
-	End
-	
 	Method MakeDocs:Bool()
 	
 		Return BuildMx2( MainWindow.Mx2ccPath+" makedocs","Rebuilding documentation..." )
 	End
 	
-	Method BuildApp:Bool( config:String,target:String,action:String )
+	Method BuildApp:Bool( config:String,target:String,sourceAction:String )
 	
 		Local buildDoc:=BuildDoc()
 		If Not buildDoc Return False
@@ -497,29 +516,38 @@ Class BuildActions
 		
 		Local opts:=product.GetMx2ccOpts()
 		
-		Local run:=(action="run")
-		If run action="build"
+		Local run:=(sourceAction="run")
+		
+		Local action:=sourceAction
+		If run Then action="build"
 
 		Local cmd:=MainWindow.Mx2ccPath+" makeapp -"+action+" "+opts
 		cmd+=" -config="+config
 		cmd+=" -target="+target
 		cmd+=" ~q"+buildDoc.Path+"~q"
 		
-		Local title := action="build" ? "Building" Else "Checking"
+		Local title := sourceAction="build" ? "Building" Else (sourceAction="run" ? "Running" Else "Checking")
 		Local msg:=title+" ~ "+target+" ~ "+config+" ~ "+StripDir( buildDoc.Path )
 		
-		If Not BuildMx2( cmd,msg,run ) Return False
+		If Not BuildMx2( cmd,msg,sourceAction ) Return False
 		
 		_console.Write("~nDone.")
 		
-		If Not run Return True
+		If Not run
+			MainWindow.RestoreConsoleVisibility()
+			Return True
+		Endif
 		
 		Local exeFile:=product.GetExecutable()
 		If Not exeFile Return True
 		
 		Select target
 		Case "desktop"
-
+			
+			MainWindow.ShowStatusBarText( "   App is running now...",True )
+			MainWindow.SetStatusBarActive( True )
+			MainWindow.ShowStatusBarProgress( MainWindow.OnForceStop,True )
+			
 			_debugView.DebugApp( exeFile,config )
 
 		Case "emscripten","wasm"
@@ -537,7 +565,7 @@ Class BuildActions
 		PreBuild()
 		
 		If _console.Running Return
-	
+		
 		BuildApp( _buildConfig,_buildTarget,"run" )
 	End
 	

+ 6 - 30
actions/editactions.monkey2 → action/EditActions.monkey2

@@ -11,8 +11,7 @@ Class EditActions
 	Field paste:Action
 	Field selectAll:Action
 	Field wordWrap:Action
-	Field gotoLine:Action
-	Field gotoDeclaration:Action
+	
 	
 	Method New( docs:DocumentManager )
 	
@@ -58,15 +57,6 @@ Class EditActions
 		wordWrap.HotKey=Key.Z
 		wordWrap.HotKeyModifiers=Modifier.Alt
 		
-		gotoLine=New Action( "Goto line" )
-		gotoLine.Triggered=OnGotoLine
-		gotoLine.HotKey=Key.G
-		gotoLine.HotKeyModifiers=Modifier.Menu
-		
-		gotoDeclaration=New Action( "Goto declaration" )
-		gotoDeclaration.Triggered=OnGotoDeclaration
-		gotoDeclaration.HotKey=Key.F12
-		
 	End
 	
 	Method Update()
@@ -90,6 +80,10 @@ Class EditActions
 		Local tv:=Cast<TextView>( App.KeyView )
 		
 		If tv tv.Undo()
+		
+		'TODO
+		' testing stuff here
+		
 	End
 	
 	Method OnRedo()
@@ -113,7 +107,7 @@ Class EditActions
 		If tv tv.Copy()
 	End
 
-	Method OnPaste()		
+	Method OnPaste()
 		
 		Local tv:=Cast<TextView>( App.KeyView )
 		
@@ -134,22 +128,4 @@ Class EditActions
 		If tv tv.WordWrap=Not tv.WordWrap
 	End
 	
-	Method OnGotoLine()
-	
-		Local tv:=Cast<TextView>( App.KeyView )
-		If Not tv Return
-		
-		Local line:=RequestInt( "Goto line:","Goto line",tv.CursorLine+1,0,1,tv.Document.NumLines )
-		If Not line Return
-		
-		tv.GotoLine( line-1 )
-		
-		tv.MakeKeyView()
-	End
-
-	Method OnGotoDeclaration()
-	
-		MainWindow.GotoDeclaration()
-	End
-	
 End

+ 7 - 3
actions/fileactions.monkey2 → action/FileActions.monkey2

@@ -122,7 +122,8 @@ Class FileActions
 		Local doc:=_docs.CurrentDocument
 		If Not doc Return Null
 		
-		Local path:=MainWindow.RequestFile( "Save As","",True )
+		Local name:=StripDir( doc.Path )
+		Local path:=MainWindow.RequestFile( "Save As",name,True )
 		If Not path Return Null
 				
 		If Not ExtractExt( path ) path+=ExtractExt( doc.Path )
@@ -340,10 +341,13 @@ Class FileActions
 			_prefsDialog.Apply+=Lambda()
 			
 				For Local d:=Eachin _docs.OpenDocuments
-					Local tv:=Cast<CodeTextView>( d.TextView )
-					If tv Then tv.ShowWhiteSpaces=Prefs.EditorShowWhiteSpaces
+					Local tv:=Cast<CodeDocumentView>( d.TextView )
+					If tv Then tv.UpdatePrefs()
 				Next
+				
+				MainWindow.ArrangeElements()
 			End
+			
 		Endif
 		_prefsDialog.Show()
 	End

+ 82 - 75
actions/findactions.monkey2 → action/FindActions.monkey2

@@ -131,84 +131,91 @@ Class FindActions
 		_findInFilesDialog.Hide()
 		MainWindow.ShowFindResults()
 		
-		New Fiber( Lambda()
-		
-			Local what:=_findInFilesDialog.FindText
-			If Not what Return
-			
-			Local proj:=_findInFilesDialog.SelectedProject
-			If Not proj Return
-			
-			Local filter:=_findInFilesDialog.FilterText
-			If Not filter Then filter="monkey2"
-			
-			Local exts:=filter.Split( "," )
-			
-			proj+="/"
-			
-			Local sens:=_findInFilesDialog.CaseSensitive
-			
-			If Not sens Then what=what.ToLower()
-			
-			Local files:=New Stack<String>
-			Utils.GetAllFiles( proj,exts,files )
-			
-			Local root:=_findConsole.RootNode
-			root.RemoveAllChildren()
-			
-			root.Text="Finding of '"+what+"'"
-						
-			Local subRoot:TreeView.Node
-			Local items:=New Stack<FileJumpData>
-			Local len:=what.Length
-			
-			Local doc:=New TextDocument 'use it to get line number
-			For Local f:=Eachin files
-				
-				Local text:=LoadString( f )
-				
-				If Not sens Then text=text.ToLower()
-				text=text.Replace( "~r~n","~n" )
-				text=text.Replace( "~r","~n" )
-				
-				doc.Text=text
-				
-				Local i:=0
-				items.Clear()
-				
-				Repeat
-					i=text.Find( what,i )
-					If i=-1 Exit
-					
-					Local data:=New FileJumpData
-					data.path=f
-					data.pos=i
-					data.len=len
-					data.line=doc.FindLine( i )+1
-					
-					items.Add( data )
-					
-					i+=len
-				Forever
-				
-				If Not items.Empty
-
-					subRoot=New TreeView.Node( f.Replace( proj,"" )+" ("+items.Length+")",root )
-					
-					For Local d:=Eachin items
-						Local node:=New NodeWithData<FileJumpData>( " at line "+d.line,subRoot )
-						node.data=d
-					Next
-					
-				Endif
-			Next
+		App.Idle+=Lambda()
 			
-			If root.NumChildren=0 Then New TreeView.Node( "not found :(",root )
+			New Fiber( Lambda()
 			
-			root.Expanded=True
-			
-		End)
+				FindInFilesInternal()
+			End)
+		End
+		
+	End
+	
+	Method FindInFilesInternal()
+		
+		Local what:=_findInFilesDialog.FindText
+		If Not what Return
+		
+		Local proj:=_findInFilesDialog.SelectedProject
+		If Not proj Return
+		
+		Local filter:=_findInFilesDialog.FilterText
+		If Not filter Then filter="monkey2"
+		
+		Local exts:=filter.Split( "," )
+		
+		proj+="/"
+		
+		Local sens:=_findInFilesDialog.CaseSensitive
+		
+		If Not sens Then what=what.ToLower()
+		
+		Local files:=New Stack<String>
+		Utils.GetAllFiles( proj,exts,files )
+		
+		Local root:=_findConsole.RootNode
+		root.RemoveAllChildren()
+		
+		root.Text="Finding of '"+what+"'"
+		
+		Local subRoot:TreeView.Node
+		Local items:=New Stack<FileJumpData>
+		Local len:=what.Length
+		
+		Local doc:=New TextDocument 'use it to get line number
+		For Local f:=Eachin files
+		
+			Local text:=LoadString( f )
+		
+			If Not sens Then text=text.ToLower()
+			text=text.Replace( "~r~n","~n" )
+			text=text.Replace( "~r","~n" )
+		
+			doc.Text=text
+		
+			Local i:=0
+			items.Clear()
+		
+			Repeat
+				i=text.Find( what,i )
+				If i=-1 Exit
+		
+				Local data:=New FileJumpData
+				data.path=f
+				data.pos=i
+				data.len=len
+				data.line=doc.FindLine( i )+1
+		
+				items.Add( data )
+		
+				i+=len
+			Forever
+		
+			If Not items.Empty
+		
+				subRoot=New TreeView.Node( f.Replace( proj,"" )+" ("+items.Length+")",root )
+		
+				For Local d:=Eachin items
+					Local node:=New NodeWithData<FileJumpData>( " at line "+d.line,subRoot )
+					node.data=d
+				Next
+		
+			Endif
+		Next
+		
+		If root.NumChildren=0 Then New TreeView.Node( "not found :(",root )
 		
+		root.Expanded=True
 	End
 	
 	Method OnFindPrevious()

+ 0 - 0
actions/helpactions.monkey2 → action/HelpActions.monkey2


+ 22 - 0
actions/viewactions.monkey2 → action/ViewActions.monkey2

@@ -8,6 +8,8 @@ Class ViewActions
 	Field goForward:Action
 	Field comment:Action
 	Field uncomment:Action
+	Field gotoLine:Action
+	Field gotoDeclaration:Action
 	
 	Method New( docs:DocumentManager )
 		
@@ -40,6 +42,15 @@ Class ViewActions
 		uncomment.HotKey=Key.Apostrophe
 #Endif
 		uncomment.HotKeyModifiers=Modifier.Menu|Modifier.Shift
+		
+		gotoLine=New Action( "Goto line" )
+		gotoLine.Triggered=OnGotoLine
+		gotoLine.HotKey=Key.G
+		gotoLine.HotKeyModifiers=Modifier.Menu
+		
+		gotoDeclaration=New Action( "Goto declaration" )
+		gotoDeclaration.Triggered=OnGotoDeclaration
+		gotoDeclaration.HotKey=Key.F12
 	End
 	
 	
@@ -78,4 +89,15 @@ Class ViewActions
 	
 		doc.Uncomment()
 	End
+	
+	Method OnGotoLine()
+	
+		MainWindow.GotoLine()
+	End
+	
+	Method OnGotoDeclaration()
+	
+		MainWindow.GotoDeclaration()
+	End
+	
 End

+ 4 - 2
assets/aboutTed2Go.html

@@ -91,7 +91,7 @@ Allow you to find in whole project.
 </ul>
 
 
-<h3>Quick Help</h3>
+<h3>Shortcuts</h3>
 <ul>
 <li>F1 - show help for ident under cursor;</li>
 <li>F12 - goto ident declaration;</li>
@@ -101,6 +101,8 @@ Allow you to find in whole project.
 <li>Ctrl+E - delete whole line under cursor (on windows).</li>
 <li>Ctrl+Shift+F - open "Find in files" dialog.</li>
 <li>Shift+F5 - stop current process (cancel building, etc).</li>
+<li>Esc - show/hide console tabs.</li>
+<li>Shift+Esc - show/hide project tabs.</li>
 </ul>
 
 
@@ -118,7 +120,7 @@ Enjoy coding!</p>
 
 <h3>Special Thanks</h3>
 
-<p>Leonardo Teixeira, Jesus Perez, Mark Sibly, Philipp Moeller, Lee Wade.</p>
+<p>Peter Scheutz, Matthieu Chemin, David Maziarka, Leonardo Teixeira, Jesus Perez, Mark Sibly, Philipp Moeller, Lee Wade.</p>
 
 </body>
 

BIN
assets/fonts/Roboto-Medium.ttf


BIN
assets/fonts/RobotoMono-Medium.ttf


+ 5 - 3
assets/themes/default.json

@@ -1,6 +1,7 @@
 {
 	"colors":{
 
+		"transparent": "#0000",
 		"clear": "#181818",
 		"gutter": "#262626",
 		"content": "#323232",
@@ -28,7 +29,8 @@
 		"textview-color6":"#fc0",
 		"textview-color7":"#fff",
 		
-		"windowClearColor":"clear"
+		"windowClearColor":"clear",
+		"menu-shortcut":"text-background"
 	},
 	
 	"fonts":{
@@ -127,7 +129,7 @@
 		},
 		
 		"TextField":{
-			"font":"editor",
+			"font":"normal",
 			"padding":[ 2 ],
 			"margin":[ 2 ],
 			"skin":"button_skin.png",
@@ -165,7 +167,7 @@
 		},
 		
 		"Menu":{
-			
+			"extends":"DockingView",
 			"padding":[ 0 ],
 			"skin":"dialog_skin.png",
 			"skinColor":"panel"

BIN
assets/themes/progressbar_icons.png


BIN
assets/themes/smooth_assets/tabbutton_selected_skin.png


BIN
assets/themes/smooth_assets/tabbutton_skin.png


+ 33 - 3
assets/themes/ted2-default.json

@@ -1,11 +1,18 @@
 {
 	"extends":"default",
 	
+	"colors":{
+
+		"statusbar": "content",
+		"statusbar-active": "#CA5100"
+	},
+
 	"styles":{
 	
 		"GutterView":{
 			"extends":"TextView",
-			"textColor":"text-disabled"
+			"textColor":"text-disabled",
+			"font":"normal"
 		},
 		
 		"DebugToolBar":{
@@ -65,10 +72,14 @@
 			"margin":[ 1,0,2,0 ]
 		},
 
+		"ProgressBar":{
+			"icons":"progressbar_icons.png"
+		},
+
 		"StatusBar":{
 			"extends":"DockingView",
 			"padding":[ 0 ],
-			"backgroundColor":"content",
+			"backgroundColor":"statusbar",
 			"border":[ 0,1,0,0 ]
 		},
 		"StatusBarText":{
@@ -76,7 +87,7 @@
 		},
 		"StatusBarLineInfo":{
 			"extends":"Label",
-			"margin":[ 30,0,0,0 ]
+			"margin":[ 40,0,0,0 ]
 		},
 		"StatusBarIns":{
 			"extends":"Label"
@@ -84,6 +95,25 @@
 		"StatusBarProgress":{
 			"extends":"ProgressBar",
 			"margin":[ 6,0 ]
+		},
+
+		"CompletionDialog":{
+			"extends":"Dialog"
+		},
+		"CompletionDialogContent":{
+			"padding":[ 1 ]
+		},
+		
+		"ProjectTabView":{
+			"extends":"TabView",
+			"backgroundColor":"content"
+		},
+		
+		"StatusBarButton":{
+			"extends":"ToolButton",
+			"padding":[ 0 ],
+			"skinColor":"transparent"
 		}
+		
 	}
 }

+ 20 - 23
assets/themes/theme-smooth.json

@@ -54,6 +54,7 @@
 		},
 
 		"TextView":{
+			"font":"editor",
 			"border":[1,0,1,1],
 			"borderColor":"border",
 			"backgroundColor":"content"
@@ -109,14 +110,13 @@
 			"extends":"Label",
 			"backgroundColor":"knob"
 		},
-
-		"TreeView":{
-			"border":[1,0,1,0],
-			"borderColor":"border",
-			"backgroundColor":"content",
-			"icons":"smooth_assets/treeview_icons.png",
-			"iconColor":"#9DA5B4"
-		},
+        
+        "TreeView":{
+            "borderColor":"border",
+            "backgroundColor":"content",
+            "icons":"smooth_assets/treeview_icons.png",
+            "iconColor":"#9DA5B4"
+        },
 
 		"TreeViewContent":{
 			"border":[0],
@@ -177,40 +177,37 @@
 				}
 			}
 		},
-
+        
 		"ToolBar":{
 			"padding":[2,2,0,2],
 			"backgroundColor":"panel"
 		},
 
 		"TabBar":{
-			"border":[0,0,0,1],
-			"borderColor":"border",
 			"extends":"ToolBar",
-			"padding":[ 0,2,4,0 ],
+			"padding":[0,2,4,0 ],
 			"backgroundColor":"clear"
 		},
 
 		"TabButton":{
+            "skinColor":"#ffffff",
 			"extends":"Button",
 			"font":"small",
-			"padding":[16,5,16,5],
-			"margin":[1,0],
+            "margin":[0,0,-1,0],
+			"padding":[16,5,16,7],
 			"backgroundColor":"#0000",
 			"skin":"smooth_assets/tabbutton_skin.png",
-			"skinColor":"gutter",
 			"textColor":"text-background",
 			"states":{
 				"hover":{
-					"skinColor":"gutter"
 				},
 				"active":{
-					"skinColor":"content"
 				},
 				"selected":{
-					"border":[2,0,0,0],
+                    "skin":"smooth_assets/tabbutton_selected_skin.png",
+                    "padding":[16,5,16,9],
+					"border":[0],
 					"borderColor":"#507FDF",
-					"skinColor":"content",
 					"textColor":"text-default"
 				}
 			}
@@ -263,9 +260,9 @@
 	},
 
 	"fonts":{
-		"normal":"DejaVuSans.ttf,16",
-		"fixedWidth":"DejaVuSans.ttf,15",
-		"editor":"DejaVuSansMono.ttf,15",
-		"small":"DejaVuSans.ttf,15"
+		"normal":"Roboto-Medium.ttf,16",
+		"fixedWidth":"RobotoMono-Medium.ttf,18",
+		"editor":"RobotoMono-Medium.ttf,18",
+		"small":"Roboto-Medium.ttf,14"
 	}
 }

+ 0 - 0
views/dialogext.monkey2 → dialog/DialogExt.monkey2


+ 0 - 0
editproductdialog.monkey2 → dialog/EditProductDialog.monkey2


+ 0 - 0
finddialog.monkey2 → dialog/FindDialog.monkey2


+ 0 - 0
findinfilesdialog.monkey2 → dialog/FindInFilesDialog.monkey2


+ 94 - 0
dialog/NoTitleDialog.monkey2

@@ -0,0 +1,94 @@
+
+Namespace ted2go
+
+
+Class NoTitleDialog Extends View
+	
+	Field OnShow:Void()
+	Field OnHide:Void()
+	
+	Method New()
+		
+		Style=GetStyle( "CompletionDialog" )
+		
+		_content=New DockingView
+		_content.Style=GetStyle( "CompletionDialogContent" )
+		
+		AddChildView( _content )
+	End
+	
+	Property ContentView:View()
+	
+		Return _content.ContentView
+	
+	Setter( contentView:View )
+	
+		_content.ContentView=contentView
+	End
+	
+	Method Open()
+		
+		Assert( Not _window,"Dialog is already open" )
+	
+		_window=App.ActiveWindow
+	
+		Local size:=MeasureLayoutSize()
+	
+		Local origin:=(_window.Rect.Size-size)/2
+	
+		Frame=New Recti( origin,origin+size )
+	
+		_window.AddChildView( Self )
+	End
+	
+	Method Close()
+		
+		Assert( _window,"Dialog is not open" )
+	
+		_window.RemoveChildView( Self )
+	
+		_window=Null
+	End
+	
+	Property IsOpened:Bool()
+		
+		Return _opened
+	End
+	
+	Method Show()
+		
+		If _opened Return
+		_opened = True
+		Open()
+		OnShow()
+	End
+	
+	Method Hide()
+		
+		If Not _opened Return
+		_opened = False
+		Close()
+		OnHide()
+	End
+	
+	
+	Protected
+	
+	Method OnMeasure:Vec2i() Override
+		
+		Return _content.LayoutSize
+	End
+	
+	Method OnLayout() Override
+		
+		_content.Frame=Rect
+	End
+	
+	
+	Private
+	
+	Field _opened:Bool
+	Field _content:DockingView
+	Field _window:Window
+	
+End

+ 217 - 0
dialog/PrefsDialog.monkey2

@@ -0,0 +1,217 @@
+Namespace ted2go
+
+
+Class PrefsDialog Extends DialogExt
+
+	Field Apply:Void()
+	
+	Method New()
+		
+		Title="Prefs"
+		
+		_acShowAfter=New TextField( ""+Prefs.AcShowAfter )
+		
+		_acEnabled=New CheckButton( "Enabled" )
+		_acEnabled.Checked=Prefs.AcEnabled
+		
+		_acKeywordsOnly=New CheckButton( "Keywords only" )
+		_acKeywordsOnly.Checked=Prefs.AcKeywordsOnly
+		
+		_acUseTab=New CheckButton( "Choose by Tab" )
+		_acUseTab.Checked=Prefs.AcUseTab
+		
+		_acUseEnter=New CheckButton( "Choose by Enter" )
+		_acUseEnter.Checked=Prefs.AcUseEnter
+		
+		_acUseSpace=New CheckButton( "Choose by Space" )
+		_acUseSpace.Checked=Prefs.AcUseSpace
+		
+		_acUseDot=New CheckButton( "Choose by Dot (.)" )
+		_acUseDot.Checked=Prefs.AcUseDot
+		
+		_acNewLineByEnter=New CheckButton( "Add new line (by Enter)" )
+		_acNewLineByEnter.Checked=Prefs.AcNewLineByEnter
+		
+		_editorToolBarVisible=New CheckButton( "ToolBar visible" )
+		_editorToolBarVisible.Checked=Prefs.EditorToolBarVisible
+		
+		_editorGutterVisible=New CheckButton( "Gutter visible" )
+		_editorGutterVisible.Checked=Prefs.EditorGutterVisible
+		
+		_mainToolBarVisible=New CheckButton( "ToolBar visible" )
+		_mainToolBarVisible.Checked=Prefs.MainToolBarVisible
+		
+		_mainProjectTabsRight=New CheckButton( "Project tabs on the right side" )
+		_mainProjectTabsRight.Checked=Prefs.MainProjectTabsRight
+		
+		_editorShowWhiteSpaces=New CheckButton( "Whitespaces visible" )
+		_editorShowWhiteSpaces.Checked=Prefs.EditorShowWhiteSpaces
+		
+		_editorShowEvery10LineNumber=New CheckButton( "Every 10th line number" )
+		_editorShowEvery10LineNumber.Checked=Prefs.EditorShowEvery10LineNumber
+		
+		Local path:=Prefs.EditorFontPath
+		If Not path Then path=_defaultFont
+		_editorFontPath=New TextField( path )
+		_editorFontSize=New TextField( ""+Prefs.EditorFontSize )
+		
+		Local chooseFont:=New Action( "..." )
+		chooseFont.Triggered+=Lambda()
+			
+			Local initDir:=RealPath( AssetsDir() )
+			
+			Local path:=MainWindow.RequestFile( "Choose Font",initDir,False,"Font files:ttf;Any files:*" )
+			If Not path Return
+			
+			path=RealPath( path )
+			path=path.Replace( initDir,"" )
+			
+			_editorFontPath.Text=path
+		End
+		Local btnChooseFont:=New PushButton( chooseFont )
+		
+		Local font:=New DockingView
+		font.AddView( New Label( "Font" ),"left" )
+		font.AddView( _editorFontPath,"left" )
+		font.AddView( btnChooseFont,"left" )
+		font.AddView( _editorFontSize,"left","45" )
+		
+		Local after:=New DockingView
+		after.AddView( New Label( "Show after" ),"left" )
+		after.AddView( _acShowAfter,"left" )
+		
+		' monkey path
+		'
+		_monkeyRootPath=New TextField( Prefs.MonkeyRootPath )
+		_monkeyRootPath.Enabled=False
+		Local chooseMonkeyPath:=New Action( "..." )
+		chooseMonkeyPath.Triggered+=Lambda()
+		
+			Local initDir:=Prefs.MonkeyRootPath
+		
+			Local path:=MainWindow.RequestDir( "Choose Monkey2 root folder",initDir )
+			If Not path Return
+			
+			' check path
+			Local real:=SetupMonkeyRootPath( path,False )
+			If real
+				_monkeyRootPath.Text=path
+				Prefs.MonkeyRootPath=path
+				MainWindow.UpdateToolsPaths()
+				Return
+			Else
+				' restore current
+				ChangeDir( initDir )
+			Endif
+			
+		End
+		Local btnChooseMonkeyPath:=New PushButton( chooseMonkeyPath )
+		
+		Local monkeyPathDock:=New DockingView
+		monkeyPathDock.AddView( New Label( "Monkey2 root folder" ),"left" )
+		monkeyPathDock.AddView( _monkeyRootPath,"left" )
+		monkeyPathDock.AddView( btnChooseMonkeyPath,"left" )
+		
+		'----------------------------
+		' put into the form
+		'----------------------------
+		Local docker:=New DockingView
+		
+		docker.AddView( monkeyPathDock,"top" )
+		
+		docker.AddView( New Label( "------ Main:" ),"top" )
+		docker.AddView( _mainProjectTabsRight,"top" )
+		docker.AddView( _mainToolBarVisible,"top" )
+		docker.AddView( New Label( " " ),"top" )
+		
+		docker.AddView( New Label( "------ Code Editor:" ),"top" )
+		docker.AddView( _editorToolBarVisible,"top" )
+		docker.AddView( _editorGutterVisible,"top" )
+		docker.AddView( _editorShowWhiteSpaces,"top" )
+		docker.AddView( font,"top" )
+		docker.AddView( _editorShowEvery10LineNumber,"top" )
+		docker.AddView( New Label( " " ),"top" )
+		
+		docker.AddView( New Label( "------ Completion:" ),"top" )
+		docker.AddView( _acEnabled,"top" )
+		docker.AddView( after,"top" )
+		docker.AddView( _acUseTab,"top" )
+		docker.AddView( _acUseEnter,"top" )
+		docker.AddView( _acNewLineByEnter,"top" )
+		docker.AddView( _acUseSpace,"top" )
+		docker.AddView( _acUseDot,"top" )
+		docker.AddView( _acKeywordsOnly,"top" )
+		docker.AddView( New Label( " " ),"top" )
+		'docker.AddView( New Label( "(Restart IDE to see all changes)" ),"top" )
+		'docker.AddView( New Label( " " ),"top" )
+		
+		ContentView=docker
+		
+		Local apply:=AddAction( "Apply" )
+		apply.Triggered=OnApply
+		
+		_acShowAfter.Activated+=_acShowAfter.MakeKeyView
+		
+		Deactivated+=MainWindow.UpdateKeyView
+	End
+	
+	
+	Private
+	
+	Const _defaultFont:="(default)"
+	Field _acEnabled:CheckButton
+	Field _acUseTab:CheckButton
+	Field _acUseEnter:CheckButton
+	Field _acUseSpace:CheckButton
+	Field _acUseDot:CheckButton
+	Field _acNewLineByEnter:CheckButton
+	Field _acKeywordsOnly:CheckButton
+	Field _acShowAfter:TextField
+	
+	Field _editorToolBarVisible:CheckButton
+	Field _editorGutterVisible:CheckButton
+	Field _editorShowWhiteSpaces:CheckButton
+	Field _editorFontPath:TextField
+	Field _editorFontSize:TextField
+	Field _editorShowEvery10LineNumber:CheckButton
+	
+	Field _mainToolBarVisible:CheckButton
+	Field _mainProjectTabsRight:CheckButton
+	
+	Field _monkeyRootPath:TextField
+	
+	Method OnApply()
+	
+		Prefs.AcEnabled=_acEnabled.Checked
+		Prefs.AcUseTab=_acUseTab.Checked
+		Prefs.AcUseEnter=_acUseEnter.Checked
+		Prefs.AcUseSpace=_acUseSpace.Checked
+		Prefs.AcUseDot=_acUseDot.Checked
+		Prefs.AcNewLineByEnter=_acNewLineByEnter.Checked
+		Prefs.AcKeywordsOnly=_acKeywordsOnly.Checked
+		Local count:=Max( 1,Int( _acShowAfter.Text ) )
+		Prefs.AcShowAfter=count
+		
+		Prefs.EditorToolBarVisible=_editorToolBarVisible.Checked
+		Prefs.EditorGutterVisible=_editorGutterVisible.Checked
+		Prefs.EditorShowWhiteSpaces=_editorShowWhiteSpaces.Checked
+		Local path:=_editorFontPath.Text.Trim()
+		If Not path Or path=_defaultFont Then path=""
+		Prefs.EditorFontPath=path
+		Local size:=_editorFontSize.Text.Trim()
+		If Not size Then size="16" 'default
+		Prefs.EditorFontSize=Int(size)
+		Prefs.EditorShowEvery10LineNumber=_editorShowEvery10LineNumber.Checked
+		
+		Prefs.MainToolBarVisible=_mainToolBarVisible.Checked
+		Prefs.MainProjectTabsRight=_mainProjectTabsRight.Checked
+		
+		App.ThemeChanged()
+		
+		Hide()
+		Apply()
+		
+		Prefs.SaveLocalState()
+	End
+	
+End

+ 0 - 0
audiodocument.monkey2 → document/AudioDocument.monkey2


+ 250 - 196
codedocument.monkey2 → document/CodeDocument.monkey2

@@ -1,4 +1,3 @@
-
 Namespace ted2go
 
 
@@ -33,25 +32,19 @@ Class CodeDocumentView Extends Ted2CodeTextView
 	
 	Method New( doc:CodeDocument )
 	
-		ShowWhiteSpaces=Prefs.EditorShowWhiteSpaces
-		
 		_doc=doc
 		
 		Document=_doc.TextDocument
 		
 		ContentView.Style.Border=New Recti( -4,-4,4,4 )
 		
-		If Prefs.EditorGutterVisible
-			AddView( New CodeGutterView( _doc ),"left" )
-		Endif
-		
 		'very important to set FileType for init
 		'formatter, highlighter and keywords
 		FileType=doc.FileType
 		FilePath=doc.Path
 		
 		'AutoComplete
-		If AutoComplete = Null Then AutoComplete=New AutocompleteDialog( "" )
+		If Not AutoComplete Then AutoComplete=New AutocompleteDialog
 		AutoComplete.OnChoosen+=Lambda( result:AutocompleteResult )
 			If App.KeyView = Self
 				
@@ -68,10 +61,7 @@ Class CodeDocumentView Extends Ted2CodeTextView
 		End
 		
 		UpdateThemeColors()
-		
-		App.ThemeChanged+=Lambda()
-			UpdateThemeColors()
-		End
+		UpdatePrefs()
 	End
 	
 	Property CharsToShowAutoComplete:Int()
@@ -79,24 +69,38 @@ Class CodeDocumentView Extends Ted2CodeTextView
 		Return Prefs.AcShowAfter
 	End
 	
+	Method UpdatePrefs()
+		
+		ShowWhiteSpaces=Prefs.EditorShowWhiteSpaces
+		
+		RemoveView( _gutter )
+		If Prefs.EditorGutterVisible
+			If Not _gutter Then _gutter=New CodeGutterView( _doc )
+			AddView( _gutter,"left" )
+		Endif
+		
+		_doc.ArrangeElements()
+	End
+	
+	
 	Protected
 	
 	Method OnRenderContent( canvas:Canvas ) Override
 	
 		Local color:=canvas.Color
-		
+		Local xx:=Scroll.x
 		' whole current line
 		canvas.Color=_lineColor
-		canvas.DrawRect( 0,Line*LineHeight-1,Width,LineHeight+3 )
+		canvas.DrawRect( xx,Line*LineHeight-1,Width,LineHeight+3 )
 		
 		
 		If _doc._debugLine<>-1
-
+			
 			Local line:=_doc._debugLine
-			If line<0 Or line>=Document.NumLines Return
+			'If line<0 Or line>=Document.NumLines Return
 			
 			canvas.Color=New Color( 0,.5,0 )
-			canvas.DrawRect( 0,line*LineHeight,Width,LineHeight )
+			canvas.DrawRect( xx,line*LineHeight,Width,LineHeight )
 			
 		Endif
 		
@@ -106,8 +110,7 @@ Class CodeDocumentView Extends Ted2CodeTextView
 		
 		If _doc._errors.Length
 		
-			canvas.Color=New Color( 1,0,0 )
-			
+			canvas.Color=Color.Red
 			For Local err:=Eachin _doc._errors
 				Local s:=Document.GetLine( err.line )
 				Local indent:=Utils.GetIndent( s )
@@ -611,11 +614,23 @@ Class CodeDocumentView Extends Ted2CodeTextView
 	Field _doc:CodeDocument
 	Field _prevErrorLine:Int
 	Field _lineColor:Color
+	Field _gutter:CodeGutterView
 	
-	
-	Method UpdateThemeColors()
+	Method UpdateThemeColors() Override
+		
+		Super.UpdateThemeColors()
 		
 		_lineColor=App.Theme.GetColor( "textview-cursor-line" )
+		
+		Local newFont:Font
+		Local fontPath:=Prefs.GetCustomFontPath()
+		If fontPath
+			Local size:=Prefs.GetCustomFontSize()
+			newFont=App.Theme.OpenFont( fontPath,size )
+		Endif
+		If Not newFont Then newFont=App.Theme.GetStyle( Style.Name ).Font
+		
+		RenderStyle.Font=newFont
 	End
 	
 End
@@ -624,6 +639,7 @@ End
 Class CodeDocument Extends Ted2Document
 	
 	Method New( path:String )
+		
 		Super.New( path )
 	
 		_doc=New TextDocument
@@ -634,6 +650,7 @@ Class CodeDocument Extends Ted2Document
 		End
 		
 		_doc.LinesModified+=Lambda( first:Int,removed:Int,inserted:Int )
+		
 			Local put:=0
 			For Local get:=0 Until _errors.Length
 				Local err:=_errors[get]
@@ -648,6 +665,11 @@ Class CodeDocument Extends Ted2Document
 				put+=1
 			Next
 			_errors.Resize( put )
+			
+			' also move debug line
+			If _debugLine>=first
+				_debugLine+=(inserted-removed)
+			Endif
 		End
 
 		_view=New DockingView
@@ -659,96 +681,12 @@ Class CodeDocument Extends Ted2Document
 		End
 		_codeView.LineChanged += OnLineChanged
 		
-		Local commentTitle:=GetActionTextWithShortcut( MainWindow.GetActionComment() )
-		Local uncommentTitle:=GetActionTextWithShortcut( MainWindow.GetActionUncomment() )
-		Local findTitle:=GetActionTextWithShortcut( MainWindow.GetActionFind() )
-
-		' Toolbar
-		Local bar:ToolBarExt=Null
-		If Prefs.EditorToolBarVisible
-		
-			bar=New ToolBarExt
-			bar.Style=App.Theme.GetStyle( "EditorToolBar" )
-			bar.MaxSize=New Vec2i( 10000,30 )
-			bar.AddSeparator()
-			bar.AddSeparator()
-			bar.AddSeparator()
-			bar.AddSeparator()
-			
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/find_selection.png" ),
-				Lambda()
-					OnFindSelection()
-				End,
-				findTitle )
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/find_previous.png" ),
-				Lambda()
-					OnFindPrev()
-				End,
-				"Find previous (Shift+F3)" )
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/find_next.png" ),
-				Lambda()
-					OnFindNext()
-				End,
-				"Find next (F3)" )
-			bar.AddSeparator()
-			#Rem
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/previous_bookmark.png" ),
-				Lambda()
-					OnPrevBookmark()
-				End,
-				"Prev bookmark (Ctrl+,)" )
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/next_bookmark.png" ),
-				Lambda()
-					OnNextBookmark()
-				End,
-				"Next bookmark (Ctrl+.)" )
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/toggle_bookmark.png" ),
-				Lambda()
-					OnToggleBookmark()
-				End,
-				"Toggle bookmark (Ctrl+M)" )
-			bar.AddSeparator()
-			#End
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/shift_left.png" ),
-				Lambda()
-					OnShiftLeft()
-				End,
-				"Shift left (Shift+Tab)" )
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/shift_right.png" ),
-				Lambda()
-					OnShiftRight()
-				End,
-				"Shift right (Tab)" )
-			bar.AddSeparator()
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/comment.png" ),
-				Lambda()
-					Comment()
-				End,
-				commentTitle )
-			bar.AddIconicButton(
-				ThemeImages.Get( "editorbar/uncomment.png" ),
-				Lambda()
-					Uncomment()
-				End,
-				uncommentTitle )
-				
-		Endif
 		
 		' bar + editor
-		Local docker:=New DockingView
-		If bar Then docker.AddView( bar,"top" )
-		docker.ContentView=_codeView
+		_content=New DockingView
+		_content.ContentView=_codeView
 		
-		_view.ContentView=docker
+		_view.ContentView=_content
 		
 		OnCreateBrowser()
 		
@@ -759,66 +697,79 @@ Class CodeDocument Extends Ted2Document
 		End
 		
 		' update 
-		Monkey2Parser.OnDoneParseModules+=Lambda()
+		Monkey2Parser.OnDoneParseModules+=Lambda( deltaMs:Int )
 			UpdateCodeTree()
 		End
 		
+		ArrangeElements()
+	End
+	
+	Method ArrangeElements()
+		
+		If Not _content Return
+		
+		_content.RemoveView( _toolBar )
+		
+		If Prefs.EditorToolBarVisible
+			_toolBar=GetToolBar()
+			_content.AddView( _toolBar,"top" )
+		Endif
+		
 	End
 	
 	Method OnCreateBrowser:View() Override
 		
-		If Not _browserView
-			
-			' sorting toolbar
-			_browserView=New DockingView
-			
-			Local bar:=New ToolBarExt
-			bar.Style=App.Theme.GetStyle( "SourceToolBar" )
-			bar.MaxSize=New Vec2i( 10000,30 )
-			Local btn:ToolButtonExt
-			
-			btn = bar.AddIconicButton( ThemeImages.Get( "sourcebar/sort_alpha.png" ),
-				Lambda()
-				End,
-				"Sort by type")
-			btn.ToggleMode=True
-			btn.IsToggled=Prefs.SourceSortByType
-			btn.Toggled+=Lambda( state:Bool )
-				' true - sort by alpha, false - sort by source
-				Prefs.SourceSortByType=state
-				_treeView.SortByType=state
-				UpdateCodeTree()
-			End
-			btn = bar.AddIconicButton( ThemeImages.Get( "sourcebar/filter_inherited.png" ),
-				Lambda()
-				End,
-				"Show inherited members")
-			btn.ToggleMode=True
-			btn.IsToggled=Prefs.SourceShowInherited
-			btn.Toggled+=Lambda( state:Bool )
-				Prefs.SourceShowInherited=state
-				_treeView.ShowInherited=state
-				UpdateCodeTree()
-			End
-			_browserView.AddView( bar,"top" )
-			
-			
-			
-			_treeView=New CodeTreeView
-			_browserView.ContentView=_treeView
-			
-			_treeView.SortByType=Prefs.SourceSortByType
-			_treeView.ShowInherited=Prefs.SourceShowInherited
-			
-			' goto item from tree view
-			_treeView.NodeClicked+=Lambda( node:TreeView.Node )
+		If _browserView Return _browserView
+			
+		' sorting toolbar
+		_browserView=New DockingView
+		
+		Local bar:=New ToolBarExt
+		bar.Style=App.Theme.GetStyle( "SourceToolBar" )
+		bar.MaxSize=New Vec2i( 10000,30 )
+		Local btn:ToolButtonExt
+		
+		btn = bar.AddIconicButton( ThemeImages.Get( "sourcebar/sort_alpha.png" ),
+			Lambda()
+			End,
+			"Sort by type")
+		btn.ToggleMode=True
+		btn.IsToggled=Prefs.SourceSortByType
+		btn.Toggled+=Lambda( state:Bool )
+			' true - sort by alpha, false - sort by source
+			Prefs.SourceSortByType=state
+			_treeView.SortByType=state
+			UpdateCodeTree()
+		End
+		btn = bar.AddIconicButton( ThemeImages.Get( "sourcebar/filter_inherited.png" ),
+			Lambda()
+			End,
+			"Show inherited members")
+		btn.ToggleMode=True
+		btn.IsToggled=Prefs.SourceShowInherited
+		btn.Toggled+=Lambda( state:Bool )
+			Prefs.SourceShowInherited=state
+			_treeView.ShowInherited=state
+			UpdateCodeTree()
+		End
+		_browserView.AddView( bar,"top" )
+		
+		
+		
+		_treeView=New CodeTreeView
+		_browserView.ContentView=_treeView
+		
+		_treeView.SortByType=Prefs.SourceSortByType
+		_treeView.ShowInherited=Prefs.SourceShowInherited
+		
+		' goto item from tree view
+		_treeView.NodeClicked+=Lambda( node:TreeView.Node )
+		
+			Local codeNode:=Cast<CodeTreeNode>( node )
+			Local item:=codeNode.CodeItem
+			JumpToPosition( item.FilePath,item.ScopeStartPos )
 			
-				Local codeNode:=Cast<CodeTreeNode>( node )
-				Local item:=codeNode.CodeItem
-				JumpToPosition( item.FilePath,item.ScopeStartPos )
-				
-			End
-		Endif
+		End
 		
 		Return _browserView
 	End
@@ -833,7 +784,9 @@ Class CodeDocument Extends Ted2Document
 			Local i:=textLine.Find( "Method " ) 'to simplify overriding - insert full text
 			If i <> -1 And i < cursorPosInLine
 				Local i2:=textLine.Find( "(" ) 'is inside of params?
-				If i2 = -1 Or i2 > cursorPosInLine Return text+" Override"
+				If i2 = -1 Or i2 > cursorPosInLine
+					Return text.StartsWith( "New(" ) ? text Else text+" Override"
+				Endif
 			Endif
 			
 			If cursorPosInLine = textLine.Length
@@ -875,9 +828,10 @@ Class CodeDocument Extends Ted2Document
 							s=item.Text.Slice( item.Ident.Length )
 							' and add some formatting
 							s=s.Replace( " ","" )
-							s=s.Replace( "(","( " )
-							s=s.Replace( ")"," )" )
-							
+							If s<>"()" 'if have params
+								s=s.Replace( "(","( " )
+								s=s.Replace( ")"," )" )
+							Endif
 							result="Lambda"+s
 						Endif
 					Endif
@@ -1041,25 +995,23 @@ Class CodeDocument Extends Ted2Document
 		
 		Local cursorRect:=_codeView.CursorRect
 		Local scroll:=_codeView.Scroll
-		Local tvFrame:=_codeView.Frame
-		Local yy:=cursorRect.Top-scroll.y
-		
-		' get absolute Y of codeView inside of window
-		Local v:View=_codeView
-		While v.Parent And v.Parent<>MainWindow
-			v=v.Parent
-			yy+=v.Frame.Top
-		Wend
-		
-		frame.Left=tvFrame.Left-scroll.x+cursorRect.Left+100
+		Local tvFrame:=_codeView.RenderRect
+		Local yy:=tvFrame.Top+cursorRect.Top-scroll.y
+		yy+=30 'magic offset :)
+		Local xx:=tvFrame.Left+cursorRect.Left-scroll.x'+100
+		xx+=46 'magic
+		frame.Left=xx
 		frame.Right=frame.Left+w
 		frame.Top=yy
 		frame.Bottom=frame.Top+h
 		' fit dialog into window
-		If frame.Bottom > tvFrame.Bottom
-			Local dy:=frame.Bottom-tvFrame.Bottom-64
-			frame.Top-=dy
-			frame.Bottom-=dy
+		If frame.Bottom > MainWindow.RenderRect.Bottom
+			
+			Local dy:=frame.Bottom-MainWindow.RenderRect.Bottom-128
+			frame.Top+=dy
+			frame.Bottom+=dy
+			frame.Left+=50
+			frame.Right+=50
 		Endif
 		AutoComplete.Frame=frame
 		
@@ -1118,6 +1070,98 @@ Class CodeDocument Extends Ted2Document
 	Field _prevLine:=-1
 	Field _prevScope:CodeItem
 	
+	Field _toolBar:ToolBarExt
+	Field _content:DockingView
+	
+	
+	Method GetToolBar:ToolBarExt()
+		
+		If _toolBar Return _toolBar
+		
+		Local commentTitle:=GetActionTextWithShortcut( MainWindow.GetActionComment() )
+		Local uncommentTitle:=GetActionTextWithShortcut( MainWindow.GetActionUncomment() )
+		Local findTitle:=GetActionTextWithShortcut( MainWindow.GetActionFind() )
+		
+		' Toolbar
+		
+		Local bar:=New ToolBarExt
+		_toolBar=bar
+		bar.Style=App.Theme.GetStyle( "EditorToolBar" )
+		bar.MaxSize=New Vec2i( 10000,30 )
+		bar.AddSeparator()
+		bar.AddSeparator()
+		bar.AddSeparator()
+		bar.AddSeparator()
+	
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/find_selection.png" ),
+			Lambda()
+				OnFindSelection()
+			End,
+			findTitle )
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/find_previous.png" ),
+			Lambda()
+				OnFindPrev()
+			End,
+			"Find previous (Shift+F3)" )
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/find_next.png" ),
+			Lambda()
+				OnFindNext()
+			End,
+			"Find next (F3)" )
+		bar.AddSeparator()
+		#Rem
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/previous_bookmark.png" ),
+			Lambda()
+				OnPrevBookmark()
+			End,
+			"Prev bookmark (Ctrl+,)" )
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/next_bookmark.png" ),
+			Lambda()
+				OnNextBookmark()
+			End,
+			"Next bookmark (Ctrl+.)" )
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/toggle_bookmark.png" ),
+			Lambda()
+				OnToggleBookmark()
+			End,
+			"Toggle bookmark (Ctrl+M)" )
+		bar.AddSeparator()
+		#End
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/shift_left.png" ),
+			Lambda()
+				OnShiftLeft()
+			End,
+			"Shift left (Shift+Tab)" )
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/shift_right.png" ),
+			Lambda()
+				OnShiftRight()
+			End,
+			"Shift right (Tab)" )
+		bar.AddSeparator()
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/comment.png" ),
+			Lambda()
+				Comment()
+			End,
+			commentTitle )
+		bar.AddIconicButton(
+			ThemeImages.Get( "editorbar/uncomment.png" ),
+			Lambda()
+				Uncomment()
+			End,
+			uncommentTitle )
+		
+		Return _toolBar
+	End
+	
 	Method OnLoad:Bool() Override
 	
 		_parser=ParsersManager.Get( FileType )
@@ -1145,6 +1189,11 @@ Class CodeDocument Extends Ted2Document
 		Return _view
 	End
 	
+	Method OnClose() Override
+		
+		If _timer Then _timer.Cancel()
+	End
+	
 	Method OnLineChanged:Void( prevLine:Int,newLine:Int )
 	
 		Local scope:=_parser.GetScope( Path,_codeView.LineNumAtCursor+1 )	
@@ -1168,6 +1217,8 @@ Class CodeDocument Extends Ted2Document
 		
 		Local errors:=_parser.ParseFile( Path,pathOnDisk,False )
 		
+		If MainWindow.IsTerminating Return
+		
 		If errors
 			
 			Local arr:=errors.Split( "~n" )
@@ -1199,12 +1250,12 @@ Class CodeDocument Extends Ted2Document
 		
 		' catch for common operations
 		
-		' nothing yet
-		
 		
+		' -----------------------------------
 		' catch for parsing
 		
 		If FileType <> ".monkey2" Return
+
 		
 		If _timer _timer.Cancel()
 		
@@ -1214,23 +1265,26 @@ Class CodeDocument Extends Ted2Document
 			
 			_parsing=True
 			
-			Local tmp:=MainWindow.AllocTmpPath( "_mx2cc_parse_",".monkey2" )
-			Local file:=StripDir( Path )
-			'Print "parsing:"+file+" ("+tmp+")"
-			
-			SaveString( _doc.Text,tmp )
-		
-			BgParsing( tmp )
-			
-			'Print "finished:"+file
-			
-			DeleteFile( tmp )
+			New Fiber( Lambda()
 			
-			_timer.Cancel()
-						
-			_timer=Null
-			_parsing=False
+				Local tmp:=MainWindow.AllocTmpPath( "_mx2cc_parse_",".monkey2" )
+				Local file:=StripDir( Path )
+				'Print "parsing:"+file+" ("+tmp+")"
+				
+				SaveString( _doc.Text,tmp )
 			
+				BgParsing( tmp )
+				
+				'Print "finished:"+file
+				
+				DeleteFile( tmp )
+				
+				_timer.Cancel()
+							
+				_timer=Null
+				_parsing=False
+				
+			End )
 		End )
 		
 	End

+ 5 - 1
documentmanager.monkey2 → document/DocumentManager.monkey2

@@ -238,6 +238,8 @@ Class DocumentManager
 		doc.DirtyChanged+=Lambda()
 		
 			UpdateTabLabel( doc )
+			
+			If doc=_currentDoc Then UpdateWindowTitle( doc )
 		End
 		
 		doc.StateChanged+=Lambda()
@@ -297,7 +299,9 @@ Class DocumentManager
 		'
 		App.Idle+=Lambda()
 			If doc
-				MainWindow.Title = AppTitle+" - "+doc.Path
+				Local name:=StripDir( doc.Path )
+				If doc.Dirty Then name="*"+name
+				MainWindow.Title = name+" - "+AppTitle+" - "+doc.Path
 			Else
 				MainWindow.Title = AppTitle
 			Endif

+ 0 - 0
imagedocument.monkey2 → document/ImageDocument.monkey2


+ 0 - 0
jsondocument.monkey2 → document/JsonDocument.monkey2


+ 0 - 0
monkey2document.monkey2 → document/Monkey2Document.monkey2


+ 0 - 0
plaintextdocument.monkey2 → document/PlainTextDocument.monkey2


+ 0 - 0
ted2document.monkey2 → document/Ted2Document.monkey2


+ 0 - 0
xmldocument.monkey2 → document/XmlDocument.monkey2


+ 11 - 18
eventfilters/monkey2keyeventfilter.monkey2 → eventfilter/Monkey2KeyEventFilter.monkey2

@@ -8,47 +8,40 @@ Class Monkey2KeyEventFilter Extends TextViewKeyEventFilter
 		Return "Monkey2KeyEventFilter"
 	End
 	
-			
+	
 	Protected
 
 	Method OnFilterKeyEvent( event:KeyEvent,textView:TextView ) Override
-	
-		'Local codeView:=Cast<CodeTextView>(textView)
+		
 		Local ctrl:=(event.Modifiers & Modifier.Control)
 		Local shift:=(event.Modifiers & Modifier.Shift)
 			
 		Select event.Type
-		Case EventType.KeyDown ',EventType.KeyRepeat
+		Case EventType.KeyDown
 			
 			Select event.Key
-						
+				
 				Case Key.F1
+					
 					MainWindow.ShowQuickHelp()
+					event.Eat()
 					
 				Case Key.F2
+				
 					MainWindow.GotoDeclaration()
+					event.Eat()
 				
-				Case Key.Enter 'ctrl+enter - smart ending of expression
-					'If ctrl And Not codeView.CanCopy And codeView.IsCursorAtTheEndOfLine()
-						'Local ident:=codeView.FirstIdentInLine( codeView.Cursor )
-						'Print "ident: "+ident
-						'ident=ident.ToLower()
-						'Select ident
-						'	Case "method","function","class","interface","if","select"
-						'		'need to add 'End' keyword here for rapid coding
-						'		event.Eat()
-						'End
-					'Endif
-					
 				Case Key.Apostrophe 'ctrl+' - comment / uncomment block
 				
 					If  shift And ctrl 'uncomment
 						
 						OnCommentUncommentBlock( textView,False )
-					
+						event.Eat()
+						
 					Elseif ctrl 'comment
 					
 						OnCommentUncommentBlock( textView,True )
+						event.Eat()
 						
 					End
 				

+ 0 - 0
eventfilters/textviewkeyeventfilter.monkey2 → eventfilter/TextViewKeyEventFilter.monkey2


+ 58 - 29
parsers/codeitem.monkey2 → parser/CodeItem.monkey2

@@ -24,7 +24,7 @@ Class CodeItem
 		Return _type
 	Setter( value:CodeType )
 		_type=value
-		_type.ident=FixTypeIdent( _type.ident )		
+		_type.ident=FixTypeIdent( _type.ident )
 	End
 		
 	Property Kind:CodeItemKind()
@@ -57,39 +57,18 @@ Class CodeItem
 	End
 	
 	Property Text:String()
+		
 		If _text = Null
-			Local s:=Ident
-			Select _kind
-				Case CodeItemKind.Function_,CodeItemKind.Method_,CodeItemKind.Lambda_,CodeItemKind.Operator_
-					If Type<>Null And Type.ident<>"Void"
-						s+=" : "+Type.ToString()
-					Endif
-					s+=(HasParams ? " ( "+ParamsStr+" )" Else "()")
-				
-				Case CodeItemKind.Class_,CodeItemKind.Interface_,CodeItemKind.Struct_,CodeItemKind.Enum_
-					' nothing
-				
-				Case CodeItemKind.Inner_,CodeItemKind.EnumMember_
-					' nothing
-				
-				Case CodeItemKind.Property_
-					s+=" : "+Type.ToString()
-				
-				Default
-					If Type<>Null And Type.IsLikeFunc
-						If Type.ident<>"Void" Then s+=" : "+Type.ToString()
-						s+=(HasParams ? " ( "+ParamsStr+" )" Else "()")
-					Else
-						Local t:=Type.ToString()
-						If t Then s+=" : "+t
-					Endif
-					
-			End
-			_text=s
+			_text=GetText( True )
 		Endif
 		Return _text
 	End
 	
+	Property TextForInsert:String()
+		
+		Return GetText( False )
+	End
+	
 	Property Parent:CodeItem()
 		Return _parent
 	Setter( value:CodeItem )
@@ -294,6 +273,56 @@ Class CodeItem
 	
 	Private
 	
+	Method GetText:String( withSpaces:Bool )
+		
+		Local s:=Ident
+		Select _kind
+			Case CodeItemKind.Function_,CodeItemKind.Method_,CodeItemKind.Lambda_,CodeItemKind.Operator_
+				If Type<>Null And Type.ident<>"Void"
+					s+=withSpaces ? " : " Else ":"
+					s+=Type.ToString()
+				Endif
+				If HasParams
+					s+=withSpaces ? " ( " Else "( "
+					s+=ParamsStr+" )"
+				Else
+					s+="()"
+				Endif
+		
+			Case CodeItemKind.Class_,CodeItemKind.Interface_,CodeItemKind.Struct_,CodeItemKind.Enum_
+				' nothing
+		
+			Case CodeItemKind.Inner_,CodeItemKind.EnumMember_
+				' nothing
+		
+			Case CodeItemKind.Property_
+				s+=withSpaces ? " : " Else ":"
+				s+=Type.ToString()
+		
+			Default
+				If Type<>Null And Type.IsLikeFunc
+					If Type.ident<>"Void"
+						s+=withSpaces ? " : " Else ":"
+						s+=Type.ToString()
+					Endif
+					If HasParams
+						s+=withSpaces ? " ( " Else "( "
+						s+=ParamsStr+" )"
+					Else
+						s+="()"
+					Endif
+				Else
+					Local t:=Type.ToString()
+					If t
+						s+=withSpaces ? " : " Else ":"
+						s+=t
+					Endif
+				Endif
+		
+		End
+		Return s
+	End
+	
 	Method UpdateKind()
 		Select _kindStr
 		Case "function"

+ 40 - 14
parsers/monkey2parser.monkey2 → parser/Monkey2Parser.monkey2

@@ -36,7 +36,7 @@ End
 
 Class Monkey2Parser Extends CodeParserPlugin
 	
-	Global OnDoneParseModules:Void()
+	Global OnDoneParseModules:Void( deltaMs:Int )
 	Global OnParseModule:Void( file:String )
 	
 	Property Name:String() Override
@@ -45,11 +45,19 @@ Class Monkey2Parser Extends CodeParserPlugin
 	
 	Method OnCreate() Override
 		
+		_modsPath=MainWindow.ModsPath
+		_mx2ccPath=MainWindow.Mx2ccPath
+				
 		New Fiber( Lambda()
-		
+			
+			Local time:=Millisecs()
+			
 			ParseModules()
 			
-			OnDoneParseModules()
+			time=Millisecs()-time
+			'Print "parse modules: "+time+" ms"
+			
+			OnDoneParseModules( time )
 		End )
 		
 	End
@@ -92,13 +100,16 @@ Class Monkey2Parser Extends CodeParserPlugin
 	
 	Method ParseFile:String( filePath:String,pathOnDisk:String,isModule:Bool )
 		
-		If Not isModule '!!! dirty code
-			isModule=filePath.StartsWith( MainWindow.ModsPath )
+		If Not isModule
+			isModule=filePath.StartsWith( _modsPath )
 		Endif
 		
 		' is file modified?
 		Local time:=GetFileTime( pathOnDisk )
+		If time=0 Return Null ' file not found
+		
 		Local last:=_filesTime[filePath]
+		
 		If last = 0 Or time > last
 			_filesTime[filePath]=time
 			'Print "parse file: "+filePath.Replace( "C:/proj/monkey/monkey2fork/","" )+"  "+pathOnDisk.Replace( "C:/proj/monkey/monkey2fork/","" )+"  mod:"+Int(isModule)
@@ -108,9 +119,7 @@ Class Monkey2Parser Extends CodeParserPlugin
 		Endif
 		
 		' start parsing process
-		Local cmd:="~q"+MainWindow.Mx2ccPath+"~q makeapp -parse -geninfo ~q"+pathOnDisk+"~q"
-		
-		Local str:=LoadString( "process::"+cmd )
+		Local str:=StartParsing( pathOnDisk,isModule )
 		Local hasErrors:=(str.Find( "] : Error : " ) > 0)
 		
 		Local i:=str.Find( "{" )
@@ -606,6 +615,7 @@ Class Monkey2Parser Extends CodeParserPlugin
 	Global _instance:=New Monkey2Parser
 	Field _filesTime:=New StringMap<Long>
 	Field _aliases:=New StringMap<CodeItem>
+	Field _modsPath:String,_mx2ccPath:String
 	
 	Method New()
 	
@@ -613,11 +623,21 @@ Class Monkey2Parser Extends CodeParserPlugin
 		_types=New String[](".monkey2")
 	End
 	
-	Method ParseModules()
+	Method StartParsing:String( pathOnDisk:String,isModule:Bool )
 		
-		Local modDir:=CurrentDir()+"modules/"
+		Local proc:=ProcessReader.Obtain()
 		
-		Local dd:=LoadDir( modDir )
+		Local cmd:=_mx2ccPath+" makeapp -parse -geninfo ~q"+pathOnDisk+"~q"
+		Local str:=proc.Run( cmd )
+		
+		ProcessReader.Recycle( proc )
+		
+		Return str
+	End
+	
+	Method ParseModules()
+		
+		Local dd:=LoadDir( _modsPath )
 		
 		' pop up some modules to parse them first
 		Local dirs:=New Stack<String>
@@ -629,8 +649,8 @@ Class Monkey2Parser Extends CodeParserPlugin
 		Next
 		
 		For Local d:=Eachin dirs
-			If GetFileType( modDir+d ) = FileType.Directory
-				Local file:=modDir + d + "/" + d + ".monkey2"
+			If GetFileType( _modsPath+d ) = FileType.Directory
+				Local file:=_modsPath + d + "/" + d + ".monkey2"
 				'Print "module: "+file
 				If GetFileType( file ) = FileType.File
 					OnParseModule( file )
@@ -885,8 +905,14 @@ Class Monkey2Parser Extends CodeParserPlugin
 		' add from super classes / ifaces
 		If Not item.SuperTypesStr Return
 		
+		' find class / iface
 		For Local t:=Eachin item.SuperTypesStr
-			' find class / iface
+			
+			' avoid recursive calls
+			If t = item.Ident
+				Continue
+			Endif
+			
 			Local result:CodeItem=Null
 			For Local i:=Eachin Items
 				If i.Ident = t

+ 0 - 0
parsers/monkey2parser_old.monkey2 → parser/Monkey2Parser_old.monkey2


+ 0 - 0
parsers/parser.monkey2 → parser/Parser.monkey2


+ 0 - 0
parsers/parserplugin.monkey2 → parser/ParserPlugin.monkey2


+ 0 - 119
prefsdialog.monkey2

@@ -1,119 +0,0 @@
-Namespace ted2go
-
-
-Class PrefsDialog Extends DialogExt
-
-	Field Apply:Void()
-	
-	Method New()
-		
-		Title="Prefs"
-		
-		_acShowAfter=New TextField( ""+Prefs.AcShowAfter )
-		
-		_acEnabled=New CheckButton( "Enabled" )
-		_acEnabled.Checked=Prefs.AcEnabled
-		
-		_acKeywordsOnly=New CheckButton( "Keywords only" )
-		_acKeywordsOnly.Checked=Prefs.AcKeywordsOnly
-		
-		_acUseTab=New CheckButton( "Choose by Tab" )
-		_acUseTab.Checked=Prefs.AcUseTab
-		
-		_acUseEnter=New CheckButton( "Choose by Enter" )
-		_acUseEnter.Checked=Prefs.AcUseEnter
-		
-		_acUseSpace=New CheckButton( "Choose by Space" )
-		_acUseSpace.Checked=Prefs.AcUseSpace
-		
-		_acNewLineByEnter=New CheckButton( "Add new line (by Enter)" )
-		_acNewLineByEnter.Checked=Prefs.AcNewLineByEnter
-		
-		_editorToolBarVisible=New CheckButton( "ToolBar visible" )
-		_editorToolBarVisible.Checked=Prefs.EditorToolBarVisible
-		
-		_editorGutterVisible=New CheckButton( "Gutter visible" )
-		_editorGutterVisible.Checked=Prefs.EditorGutterVisible
-		
-		_mainToolBarVisible=New CheckButton( "ToolBar visible" )
-		_mainToolBarVisible.Checked=Prefs.MainToolBarVisible
-		
-		_editorShowWhiteSpaces=New CheckButton( "Whitespaces visible" )
-		_editorShowWhiteSpaces.Checked=Prefs.EditorShowWhiteSpaces
-		
-		Local after:=New DockingView
-		after.AddView( New Label( "Show after" ),"left" )
-		after.AddView( _acShowAfter,"left" )
-		
-		Local docker:=New DockingView
-		docker.AddView( New Label( "[Main]" ),"top" )
-		docker.AddView( _mainToolBarVisible,"top" )
-		docker.AddView( New Label( " " ),"top" )
-		docker.AddView( New Label( "[Code Editor]" ),"top" )
-		docker.AddView( _editorToolBarVisible,"top" )
-		docker.AddView( _editorGutterVisible,"top" )
-		docker.AddView( _editorShowWhiteSpaces,"top" )
-		docker.AddView( New Label( " " ),"top" )
-		docker.AddView( New Label( "[Completion]" ),"top" )
-		docker.AddView( _acEnabled,"top" )
-		docker.AddView( after,"top" )
-		docker.AddView( _acUseTab,"top" )
-		docker.AddView( _acUseEnter,"top" )
-		docker.AddView( _acNewLineByEnter,"top" )
-		docker.AddView( _acUseSpace,"top" )
-		docker.AddView( _acKeywordsOnly,"top" )
-		docker.AddView( New Label( " " ),"top" )
-		docker.AddView( New Label( "(Restart IDE to see all changes)" ),"top" )
-		docker.AddView( New Label( " " ),"top" )
-		
-		ContentView=docker
-		
-		Local apply:=AddAction( "Apply" )
-		apply.Triggered=OnApply
-		
-		_acShowAfter.Activated+=_acShowAfter.MakeKeyView
-		
-		Deactivated+=MainWindow.UpdateKeyView
-		
-	End
-	
-	
-	Private
-	
-	Field _acEnabled:CheckButton
-	Field _acUseTab:CheckButton
-	Field _acUseEnter:CheckButton
-	Field _acUseSpace:CheckButton
-	Field _acNewLineByEnter:CheckButton
-	Field _acKeywordsOnly:CheckButton
-	Field _acShowAfter:TextField
-	
-	Field _editorToolBarVisible:CheckButton
-	Field _editorGutterVisible:CheckButton
-	Field _editorShowWhiteSpaces:CheckButton
-	
-	Field _mainToolBarVisible:CheckButton
-	
-	
-	Method OnApply()
-	
-		Prefs.AcEnabled=_acEnabled.Checked
-		Prefs.AcUseTab=_acUseTab.Checked
-		Prefs.AcUseEnter=_acUseEnter.Checked
-		Prefs.AcUseSpace=_acUseSpace.Checked
-		Prefs.AcNewLineByEnter=_acNewLineByEnter.Checked
-		Prefs.AcKeywordsOnly=_acKeywordsOnly.Checked
-		Local count:=Max( 1,Int( _acShowAfter.Text ) )
-		Prefs.AcShowAfter=count
-		
-		Prefs.EditorToolBarVisible=_editorToolBarVisible.Checked
-		Prefs.EditorGutterVisible=_editorGutterVisible.Checked
-		Prefs.EditorShowWhiteSpaces=_editorShowWhiteSpaces.Checked
-		
-		Prefs.MainToolBarVisible=_mainToolBarVisible.Checked
-		
-		Hide()
-		Apply()
-	End
-	
-End

+ 0 - 0
buildproduct.monkey2 → product/BuildProduct.monkey2


+ 1 - 1
modulemanager.monkey2 → product/ModuleManager.monkey2

@@ -256,7 +256,7 @@ Class ModuleManager Extends Dialog
 		For Local config:=0 Until 2
 			
 			Local cmd:=MainWindow.Mx2ccPath+" makemods -config="+(config ? "debug" Else "release")
-				
+			
 			If Not _console.Run( cmd ) Return False
 			
 			If _console.Process.ExitCode

+ 0 - 0
mx2ccenv.monkey2 → product/Mx2ccEnv.monkey2


+ 1 - 1
project.json

@@ -1,3 +1,3 @@
 {
-    "exclude":[".git","bin","*.buildv*"]
+    "exclude":[".git", "bin", "*.buildv*", "*.products", "logo"]
 }

+ 150 - 0
syntax/GlslHighlighter.monkey2

@@ -0,0 +1,150 @@
+
+Namespace ted2go
+
+
+Class GlslHighlighter Extends HighlighterPlugin
+
+	Property Name:String() Override
+		Return "GlslHighlighter"
+	End
+
+		
+	Private
+	
+	Global _instance:=New GlslHighlighter
+		
+	Method New()
+		Super.New()
+		_types=New String[]( ".glsl" )
+		_hl=New Highlighter
+		_hl.Painter=HL
+	End
+	
+	Method HL:Int( text:String,colors:Byte[],sol:Int,eol:Int,state:Int )
+
+		Local i0:=sol
+		Local icolor:=0
+		Local istart:=sol
+		
+		If state>-1 Then icolor=Highlighter.COLOR_COMMENT
+		
+		If _keywords = Null Then _keywords=KeywordsManager.Get( GetMainFileType() )
+		
+		While i0<eol
+			
+			Local start:=i0
+			Local chr:=text[i0]
+			Local chr2:=(i0+1<eol) ? text[i0+1] Else 0
+			
+			i0+=1
+			If IsSpace( chr ) Continue
+			
+			If state=-1 And chr=35 And istart=sol
+				icolor=Highlighter.COLOR_PREPROC
+				Exit ' it take whole line
+			Endif
+			
+			If chr="/"[0] And chr2="*"[0] ' /*  opened
+				
+				' colors for previous line part
+				For Local i:=istart Until start
+					colors[i]=icolor
+				Next
+				istart=start
+				
+				state=10 ' store multi-line comment state
+				icolor=Highlighter.COLOR_COMMENT
+			
+			Endif
+			
+			If state=10 
+				' */  closed
+				Local pos:=text.Slice( i0-1,eol ).Find( "*/" )
+				If pos<>-1
+					' colors for line part until comment closed
+					start+=pos+2
+					For Local i:=istart Until start
+						colors[i]=icolor
+					Next
+					istart=start
+					state=-1
+					i0+=pos+2
+					Continue ' already set colors, go to next char
+				Else
+					Exit ' have no closing pair - so exit and go to the next line
+				Endif
+			Endif
+			
+			Local color:=icolor
+			
+			If chr="/"[0] And chr2="/"[0] ' // single-line comment
+			
+				i0=eol
+				color=Highlighter.COLOR_COMMENT
+				
+			Else If chr=34 Or chr=39
+			
+				While i0<eol And text[i0]<>34 And text[i0]<>39
+					i0+=1
+				Wend
+				If i0<eol i0+=1
+				
+				color=Highlighter.COLOR_STRING
+				
+			Else If IsAlpha( chr ) Or chr=95 Or state>=10
+	
+				While i0<eol And (IsAlpha( text[i0] ) Or IsDigit( text[i0] )  Or text[i0]=95)
+					i0+=1
+				Wend
+				
+				Local id:=text.Slice( start,i0 )
+				
+				color=Highlighter.COLOR_IDENT
+				
+				If _keywords.Contains( id ) Then color=Highlighter.COLOR_KEYWORD
+				
+			Else If IsDigit( chr )
+			
+				While i0<eol And IsDigit( text[i0] )
+					i0+=1
+				Wend
+				
+				color=Highlighter.COLOR_NUMBER
+				
+			Else If chr=36 And i0<eol And IsHexDigit( text[i0] )
+			
+				i0+=1
+				While i0<eol And IsHexDigit( text[i0] )
+					i0+=1
+				Wend
+				
+				color=Highlighter.COLOR_NUMBER
+				
+			Else
+				
+				color=Highlighter.COLOR_NONE
+				
+			Endif
+			
+			If color=icolor Continue
+			
+			' set colors for current line part
+			For Local i:=istart Until start
+				colors[i]=icolor
+			Next
+			
+			icolor=color
+			istart=start
+		
+		Wend
+		
+		' set colors for the last line part
+		For Local i:=istart Until eol
+			colors[i]=icolor
+		Next
+		
+		Return state
+	
+	End
+	
+End

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 21 - 0
syntax/GlslKeywords.monkey2


+ 40 - 49
syntax/cpphighlighter.monkey2

@@ -15,7 +15,7 @@ Class CppHighlighter Extends HighlighterPlugin
 		
 	Method New()
 		Super.New()
-		_types=New String[](".cpp",".h",".hpp")
+		_types=New String[]( ".cpp",".h",".hpp",".c" )
 		_hl=New Highlighter
 		_hl.Painter=HL
 	End
@@ -23,70 +23,75 @@ Class CppHighlighter Extends HighlighterPlugin
 	Method HL:Int( text:String,colors:Byte[],sol:Int,eol:Int,state:Int )
 
 		Local i0:=sol
-		
 		Local icolor:=0
 		Local istart:=sol
-		Local preproc:=False
 		
 		If state>-1 Then icolor=Highlighter.COLOR_COMMENT
 		
 		If _keywords = Null Then _keywords=KeywordsManager.Get( GetMainFileType() )
 		
 		While i0<eol
-		
+			
 			Local start:=i0
 			Local chr:=text[i0]
+			Local chr2:=(i0+1<eol) ? text[i0+1] Else 0
+			
 			i0+=1
 			If IsSpace( chr ) Continue
 			
-			If chr=35 And istart=sol
-				preproc=True
-				If state=-1 icolor=Highlighter.COLOR_PREPROC
-				Continue
+			If state=-1 And chr=35 And istart=sol
+				icolor=Highlighter.COLOR_PREPROC
+				Exit ' it take whole line
 			Endif
 			
-			If preproc And (IsAlpha( chr ) Or chr=95)
-	
-				While i0<eol And (IsAlpha( text[i0] ) Or IsDigit( text[i0] )  Or text[i0]=95)
-					i0+=1
-				Wend
+			If chr="/"[0] And chr2="*"[0] ' /*  opened
 				
-				Local id:=text.Slice( start,i0 )
+				' colors for previous line part
+				For Local i:=istart Until start
+					colors[i]=icolor
+				Next
+				istart=start
 				
-				Select id.ToLower()
-				Case "rem"
-					state+=1
-					icolor=Highlighter.COLOR_COMMENT
-				Case "end"
-					If state>-1 
-						state-=1
-						icolor=Highlighter.COLOR_COMMENT
-					Endif
-				End
-				
-				Exit
+				state=10 ' store multi-line comment state
+				icolor=Highlighter.COLOR_COMMENT
 			
 			Endif
 			
-			If state>-1 Or preproc Exit
+			If state=10 
+				' */  closed
+				Local pos:=text.Slice( i0-1,eol ).Find( "*/" )
+				If pos<>-1
+					' colors for line part until comment closed
+					start+=pos+2
+					For Local i:=istart Until start
+						colors[i]=icolor
+					Next
+					istart=start
+					state=-1
+					i0+=pos+2
+					Continue ' already set colors, go to next char
+				Else
+					Exit ' have no closing pair - so exit and go to the next line
+				Endif
+			Endif
 			
 			Local color:=icolor
 			
-			If chr=39
+			If chr="/"[0] And chr2="/"[0] ' // single-line comment
 			
 				i0=eol
 				color=Highlighter.COLOR_COMMENT
 				
-			Else If chr=34
+			Else If chr=34 Or chr=39
 			
-				While i0<eol And text[i0]<>34
+				While i0<eol And text[i0]<>34 And text[i0]<>39
 					i0+=1
 				Wend
 				If i0<eol i0+=1
 				
 				color=Highlighter.COLOR_STRING
 				
-			Else If IsAlpha( chr ) Or chr=95
+			Else If IsAlpha( chr ) Or chr=95 Or state>=10
 	
 				While i0<eol And (IsAlpha( text[i0] ) Or IsDigit( text[i0] )  Or text[i0]=95)
 					i0+=1
@@ -94,25 +99,9 @@ Class CppHighlighter Extends HighlighterPlugin
 				
 				Local id:=text.Slice( start,i0 )
 				
-				If preproc And istart=sol
+				color=Highlighter.COLOR_IDENT
 				
-					Select id.ToLower()
-					Case "rem"				
-						state+=1
-					Case "end"
-						state=Max( state-1,-1 )
-					End
-					
-					icolor=Highlighter.COLOR_COMMENT
-					
-					Exit
-				Else
-				
-					color=Highlighter.COLOR_IDENT
-					
-					If _keywords.Contains( id ) Then color=Highlighter.COLOR_KEYWORD
-				
-				Endif
+				If _keywords.Contains( id ) Then color=Highlighter.COLOR_KEYWORD
 				
 			Else If IsDigit( chr )
 			
@@ -139,6 +128,7 @@ Class CppHighlighter Extends HighlighterPlugin
 			
 			If color=icolor Continue
 			
+			' set colors for current line part
 			For Local i:=istart Until start
 				colors[i]=icolor
 			Next
@@ -148,6 +138,7 @@ Class CppHighlighter Extends HighlighterPlugin
 		
 		Wend
 		
+		' set colors for the last line part
 		For Local i:=istart Until eol
 			colors[i]=icolor
 		Next

+ 1 - 1
syntax/cppkeywords.monkey2

@@ -15,7 +15,7 @@ Class CppKeywords Extends KeywordsPlugin
 	
 	Method New()
 		Super.New()
-		_types=New String[](".cpp",".h",".hpp")
+		_types=New String[]( ".cpp",".h",".hpp",".c" )
 	End
 	
 	Method GetInternal:String() Override

+ 0 - 190
ted2.monkey2

@@ -1,190 +0,0 @@
-
-#If __TARGET__="windows"
-
-#Import "bin/wget.exe"
-
-'to build resource.o when icon changes...
-'
-'windres resource.rc resource.o
-
-#Import "logo/resource.o"
-
-#Endif
-
-'----------------------------
-
-'#Import "<reflection>"
-
-#Import "<std>"
-#Import "<mojo>"
-#Import "<mojox>"
-#Import "<tinyxml2>"
-
-#Import "mainwindow"
-#Import "documentmanager"
-
-#Import "actions/fileactions"
-#Import "actions/editactions"
-#Import "actions/buildactions"
-#Import "actions/helpactions"
-#Import "actions/findactions"
-#Import "actions/viewactions"
-
-#Import "finddialog"
-#Import "debugview"
-#Import "projectview"
-#Import "helptree"
-#Import "modulemanager"
-#Import "ted2textview"
-#Import "jsontreeview"
-#Import "xmltreeview"
-#Import "monkey2treeview"
-#Import "gutterview"
-
-#Import "plugin"
-#Import "ted2document"
-#Import "codedocument"
-#Import "plaintextdocument"
-#Import "imagedocument"
-#Import "audiodocument"
-#Import "jsondocument"
-#Import "xmldocument"
-
-#Import "eventfilters/textviewkeyeventfilter"
-
-#Import "buildproduct"
-#Import "editproductdialog"
-
-#Import "mx2ccenv"
-
-#Import "eventfilters/monkey2keyeventfilter"
-
-#Import "syntax/keywords"
-#Import "syntax/monkey2keywords"
-#Import "syntax/highlighter"
-#Import "syntax/monkey2highlighter"
-#Import "syntax/cpphighlighter"
-#Import "syntax/cppkeywords"
-#Import "syntax/codeformatter"
-#Import "syntax/monkey2formatter"
-
-#Import "views/codetextview"
-#Import "views/consoleext"
-#Import "views/listviewext"
-#Import "views/dialogext"
-#Import "views/autocompleteview"
-#Import "views/codetreeview"
-#Import "views/treeviewext"
-#Import "views/codegutterview"
-#Import "views/toolbarext"
-#Import "views/hint"
-#Import "views/htmlviewext"
-#Import "views/projectbrowser"
-#Import "views/tabviewext"
-#Import "views/statusbar"
-
-#Import "parsers/parser"
-#Import "parsers/monkey2parser"
-#Import "parsers/codeitem"
-#Import "parsers/parserplugin"
-
-#Import "utils/jsonutils"
-#Import "utils/utils"
-
-#Import "test_files/parsertests"
-
-#Import "themeimages"
-#Import "findinfilesdialog"
-
-#Import "prefs"
-#Import "prefsdialog"
-
-
-
-Namespace ted2go
-
-Using std..
-Using mojo..
-Using mojox..
-Using tinyxml2..
-
-
-Global AppTitle:="Ted2Go v2.2.3"
-
-
-Function Main()
-
-#If __DESKTOP_TARGET__
-		
-	ChangeDir( AppDir() )
-	
-	While GetFileType( "bin" )<>FileType.Directory Or GetFileType( "modules" )<>FileType.Directory
-
-		If IsRootDir( CurrentDir() )
-			Print "Error initializing Ted2 - can't find working dir!"
-			libc.exit_( 1 )
-		Endif
-		
-		ChangeDir( ExtractDir( CurrentDir() ) )
-	Wend
-	
-#Endif
-	
-	'load ted2 state
-	'
-	Local jobj:=JsonObject.Load( "bin/ted2.state.json" )
-	If Not jobj jobj=New JsonObject
-
-	Prefs.LoadState( jobj )
-	
-	'initial theme
-	'	
-	If Not jobj.Contains( "theme" ) jobj["theme"]=New JsonString( "theme-classic-dark" )
-	If Not jobj.Contains( "themeScale" ) jobj["themeScale"]=New JsonNumber( 1 )
-	
-	Local config:=New StringMap<String>
-	
-	config["initialTheme"]=jobj.GetString( "theme" )
-	config["initialThemeScale"]=jobj.GetNumber( "themeScale" )
-	
-	'start the app!
-	'	
-	New AppInstance( config )
-	
-	'initial window state
-	'
-	Local flags:=WindowFlags.Resizable|WindowFlags.HighDPI
-
-	Local rect:Recti
-	
-	If jobj.Contains( "windowRect" ) 
-		rect=ToRecti( jobj["windowRect"] )
-	Else
-		Local w:=Min( 1024,App.DesktopSize.x-40 )
-		Local h:=Min( 768,App.DesktopSize.y-64 )
-		rect=New Recti( 0,0,w,h )
-		flags|=WindowFlags.Center
-	Endif
-
-	New MainWindowInstance( AppTitle,rect,flags,jobj )
-	
-	' open docs from args
-	Local args:=AppArgs()
-	For Local i:=1 Until args.Length
-		Local arg:=args[i]
-		arg=arg.Replace( "\","/" )
-		If GetFileType( arg ) = FileType.File
-			MainWindow.OpenDocument( arg )
-		Endif
-	Next
-	
-	App.Run()
-		
-End
-
-
-Function GetActionTextWithShortcut:String( action:Action )
-
-	Return action.Text+" ("+action.HotKeyText+")"
-End
-

+ 0 - 0
test_files/AndroidManifest.xml → testing/AndroidManifest.xml


+ 0 - 0
test_files/canvas.monkey2 → testing/Canvas.monkey2


+ 6 - 1
test_files/parsertests.monkey2 → testing/ParserTests.monkey2

@@ -68,9 +68,14 @@ Class AAA Extends TestClass
 	
 	Field generic:=New Vec2f
 	Field map:=New StringMap<Int>
-	
+	Global arr:String[]
 	Global event:Bool( p1:String[],p2:Object )
 	
+	Method TestArray( arr2:String[] )
+		
+		'arr2[i].start
+	End
+	
 	Method anstrMethod() Abstract
 	
 End

+ 9 - 7
test_files/async.cpp → testing/async.cpp

@@ -7,26 +7,28 @@ bbInt g_mojo_app_AppInstance_AddAsyncCallback( bbFunction<void()> callback );
 
 namespace{
 
-	const int INVOKE=0x40000000;
-	const int REMOVE=0x80000000;
-
+	//const int INVOKE=0x40000000;
+	rtyui;
+	/*const int REMOVE=0x80000000;
+	s='string is here' */
+	
 	static void postEvent( int code ){
 			SDL_UserEvent event;
 			event.type=SDL_USEREVENT;
 			event.code=code;
 			event.data1=0;
 			event.data2=0;
-			if( SDL_PeepEvents( (SDL_Event*)&event,1,SDL_ADDEVENT,SDL_FIRSTEVENT,SDL_LASTEVENT )!=1 ){
+			if( SDL_PeepEvents( (SDL_Event*)&event,/*1*/,SDL_ADDEVENT,SDL_FIRSTEVENT,SDL_LASTEVENT )!=1 ){
 				printf(" SDL_PeepEvents error!\n" );fflush( stdout );
 			}
 	}
 }
 
-int bbAddAsyncCallback( bbFunction<void()> callback ){
+int bbAddAsyncCallback( bbFunction<void()> /*callback*/ ){
 
 	return g_mojo_app_AppInstance_AddAsyncCallback( callback );
 }
-
+/*
 void bbInvokeAsyncCallback( int callback,bool remove ){
 
 	int code=callback|INVOKE;
@@ -35,7 +37,7 @@ void bbInvokeAsyncCallback( int callback,bool remove ){
 	
 	postEvent( code );
 }
-
+*/
 void bbRemoveAsyncCallback( int callback ){
 
 	int code=callback|REMOVE;

+ 19 - 3
utils/jsonutils.monkey2

@@ -4,15 +4,31 @@ Namespace ted2go
 
 Class JsonUtils
 
-	Function LoadValue:JsonValue( filePath:String,valueName:String )
+	Function LoadValue:JsonValue( filePath:String,key:String )
 		
-		If GetFileType(filePath) <> FileType.File Then Return Null
+		If GetFileType(filePath) <> FileType.File Return Null
 		
 		Local json:=JsonObject.Load( filePath )
 		
-		Return json[valueName]
+		Return FindValue( json.Data,key )
 	End
 	
+	Function FindValue:JsonValue( data:StringMap<JsonValue>,key:String )
+	
+		key=key.Replace( "\","/" )
+		Local keys:=key.Split( "/" )
+	
+		Local jval:JsonValue
+		For Local k:=0 Until keys.Length
+			jval=data[ keys[k] ]
+			If Not jval Return Null
+			If k=keys.Length-1 Exit
+			If Not jval.IsObject Return Null
+			data=jval.ToObject()
+		Next
+	
+		Return jval
+	End
 	
 	Private 
 	

+ 8 - 0
utils/utils.monkey2

@@ -127,6 +127,14 @@ Class Utils
 		Return Null
 	End
 	
+	Function PrintLog<T>( list:List<T>,prefix:String="" )
+	
+		For Local i:=Eachin list
+			Print prefix+""+i
+		End
+	End
+	
+	
 	Private
 	
 	Method New()

+ 74 - 69
views/autocompleteview.monkey2 → view/AutocompleteView.monkey2

@@ -15,11 +15,11 @@ Class CodeListViewItem Extends ListViewItem
 		Return _item
 	End
 	
-		
+	
 	Private
 	
 	Field _item:CodeItem
-		
+	
 End
 
 
@@ -27,8 +27,8 @@ Class AutocompleteListView Extends ListViewExt
 	
 	Field word:String 'word to select
 	
-	Method New( lineHeight:Int,width:Int=600,height:Int=480 )
-		Super.New( lineHeight,width,height )
+	Method New( lineHeight:Int,maxLines:Int )
+		Super.New( lineHeight,maxLines )
 	End
 	
 	
@@ -41,8 +41,10 @@ Class AutocompleteListView Extends ListViewExt
 		Local txt:=item.Text
 		Local icon:=item.Icon
 		If icon <> Null
+			canvas.Alpha=.8
 			canvas.DrawImage( icon,x-icon.Width*handleX,y-icon.Height*handleY )
 			x+=icon.Width+8
+			canvas.Alpha=1
 		Endif
 		If Not word
 			canvas.DrawText( txt,x,y,handleX,handleY )
@@ -87,21 +89,19 @@ Struct AutocompleteResult
 End
 
 
-Class AutocompleteDialog Extends DialogExt
+Class AutocompleteDialog Extends NoTitleDialog
 	
 	Field OnChoosen:Void( result:AutocompleteResult )
 	
-	Method New( title:String )
-		Self.New( title,800,480 )
-	End
-	
-	Method New( title:String,width:Int,height:Int )
-	
-		Title=title
+	Method New()
+		
+		Super.New()
 		
-		_view=New AutocompleteListView( 20,width,height )
+		_view=New AutocompleteListView( 20,15 )
 		_view.MoveCyclic=True
 		
+		_view.MaxSize=New Vec2i( 500,20*15 )
+		
 		ContentView=_view
 		
 		_keywords=New StringMap<List<ListViewItem>>
@@ -193,7 +193,7 @@ Class AutocompleteDialog Extends DialogExt
 			_view.Reset()'reset selIndex
 			_view.SetItems( result )
 			
-			Show()
+			Super.Show()
 			
 			_disableUsingsFilter=filter
 			Return
@@ -291,12 +291,12 @@ Class AutocompleteDialog Extends DialogExt
 		_view.Reset()'reset selIndex
 		_view.SetItems( result )
 		
-		Show()
+		Super.Show()
 		
-		_disableUsingsFilter=filter		
+		_disableUsingsFilter=filter
 	End
 	
-		
+	
 	Private
 	
 	Field _view:AutocompleteListView
@@ -307,9 +307,6 @@ Class AutocompleteDialog Extends DialogExt
 	Field _listForExtract2:=New List<CodeItem>
 	Field _disableUsingsFilter:Bool
 	
-	Method New()
-	End
-		
 	Method GetParser:ICodeParser( fileType:String )
 		If _parsers[fileType] = Null Then UpdateParsers( fileType )
 		Return _parsers[fileType]
@@ -329,58 +326,66 @@ Class AutocompleteDialog Extends DialogExt
 		
 		If Not IsOpened Return
 		
-		If event.Type = EventType.KeyDown Or event.Type = EventType.KeyRepeat
-			Select event.Key
-			Case Key.Escape
-				Hide()
-				event.Eat()
-			Case Key.Up
-				_view.SelectPrev()
-				event.Eat()
-			Case Key.Down
-				_view.SelectNext()
-				event.Eat()
-			Case Key.Home
-				_view.SelectFirst()
-				event.Eat()
-			Case Key.KeyEnd
-				_view.SelectLast()
-				event.Eat()
-			Case Key.Enter,Key.KeypadEnter
-				If Prefs.AcUseEnter
-					OnItemChoosen( _view.CurrentItem )
-					If Not Prefs.AcNewLineByEnter Then event.Eat()
-				Else
-					Hide() 'hide by enter
-				Endif
-			Case Key.Tab
-				If Prefs.AcUseTab
-					OnItemChoosen( _view.CurrentItem )
+		Select event.Type
+			
+			Case EventType.KeyDown,EventType.KeyRepeat
+				
+				Select event.Key
+				Case Key.Escape
+					Hide()
 					event.Eat()
-				Endif
-			Case Key.Space
-				Local ctrl:=event.Modifiers & Modifier.Control
-				If Prefs.AcUseSpace And Not ctrl
-					OnItemChoosen( _view.CurrentItem,True )
+				Case Key.Up
+					_view.SelectPrev()
 					event.Eat()
-				Endif
-			Case Key.Period
-				If Prefs.AcUseSpace
-					OnItemChoosen( _view.CurrentItem )
+				Case Key.Down
+					_view.SelectNext()
 					event.Eat()
-				Endif
-			
-			Case Key.Backspace
-			Case Key.CapsLock
-			Case Key.LeftShift,Key.RightShift
-			Case Key.LeftControl,Key.RightControl
-			Case Key.LeftAlt,Key.RightAlt
-				'do nothing,skip filtering
-			Default
-				'Hide()
-			End
+				Case Key.PageUp
+					_view.PageUp()
+					event.Eat()
+				Case Key.PageDown
+					_view.PageDown()
+					event.Eat()
+				Case Key.Enter,Key.KeypadEnter
+					If Prefs.AcUseEnter
+						OnItemChoosen( _view.CurrentItem )
+						If Not Prefs.AcNewLineByEnter Then event.Eat()
+					Else
+						Hide() 'hide by enter
+					Endif
+				Case Key.Tab
+					If Prefs.AcUseTab
+						OnItemChoosen( _view.CurrentItem )
+						event.Eat()
+					Endif
+				Case Key.Space
+					Local ctrl:=event.Modifiers & Modifier.Control
+					If Prefs.AcUseSpace And Not ctrl
+						OnItemChoosen( _view.CurrentItem,True )
+						event.Eat()
+					Endif
+				Case Key.Period
+					If Prefs.AcUseDot
+						OnItemChoosen( _view.CurrentItem )
+						event.Eat()
+					Endif
+				
+				Case Key.Backspace
+				Case Key.CapsLock
+				Case Key.LeftShift,Key.RightShift
+				Case Key.LeftControl,Key.RightControl
+				Case Key.LeftAlt,Key.RightAlt
+					'do nothing,skip filtering
+				Default
+					'Hide()
+				End
 			
-		Endif
+			Case EventType.KeyChar
+				
+				If Not IsIdent( event.Text[0] ) Then Hide()
+				
+		End
+		
 	End
 	
 	Method OnItemChoosen( item:ListViewItem,bySpace:Bool=False )
@@ -390,7 +395,7 @@ Class AutocompleteDialog Extends DialogExt
 		Local code:CodeItem=Null
 		If si <> Null
 			ident=si.CodeItem.Ident
-			text=si.CodeItem.Text
+			text=si.CodeItem.TextForInsert
 			code=si.CodeItem
 		Else
 			ident=item.Text

+ 14 - 1
views/codegutterview.monkey2 → view/CodeGutterView.monkey2

@@ -30,6 +30,10 @@ Class CodeGutterView Extends View
 	Method OnRender( canvas:Canvas ) Override
 	
 		_textView=_doc.TextView
+		
+		Local cursorLine:=_textView.Document.FindLine( _textView.Cursor )
+		Local anchorLine:=_textView.Document.FindLine( _textView.Anchor )
+		
 		canvas.Color=RenderStyle.BackgroundColor
 		
 		canvas.DrawRect( Rect.X,Rect.Y,Rect.Width,Rect.Height )
@@ -52,6 +56,14 @@ Class CodeGutterView Extends View
 		
 			Local rect:=_textView.LineRect( i )
 		
+			Local ok:= Prefs.EditorShowEvery10LineNumber And ((i+1) Mod 10 <> 0)
+			If ok And i<>cursorLine And i<>anchorLine
+				canvas.Alpha=0.5
+				canvas.DrawRect( _width-4,rect.Top+rect.Height*.5-1,2,2 )
+				canvas.Alpha=1
+				Continue
+			Endif
+			
 			' show error bubble
 			
 			If _doc.HasErrors And _doc.HasErrorAt( i )
@@ -61,7 +73,8 @@ Class CodeGutterView Extends View
 					canvas.Color=textColor
 				Endif
 			Else
-				canvas.DrawText( i+1,_width,rect.Top,1,0 )
+				canvas.Color=(i=cursorLine Or i=anchorLine) ? textColor*1.125 Else textColor 'make selected line number little brighter
+				canvas.DrawText( i+1,_width,rect.Top+rect.Height*.5,1,.5 )
 			Endif
 			
 		Next

+ 32 - 24
views/codetextview.monkey2 → view/CodeTextView.monkey2

@@ -4,7 +4,7 @@ Namespace ted2go
 
 Class CodeTextView Extends TextView
 
-	Field Formatter:ICodeFormatter		
+	Field Formatter:ICodeFormatter
 	Field Keywords:IKeywords
 	Field Highlighter:Highlighter
 	
@@ -18,7 +18,7 @@ Class CodeTextView Extends TextView
 		
 		CursorMoved += OnCursorMoved
 		
-		UpdateColors2()
+		UpdateThemeColors()
 	End
 	
 	Method IsCursorAtTheEndOfLine:Bool()
@@ -219,17 +219,12 @@ Class CodeTextView Extends TextView
 					If _typing Then DoFormat( False )
 				Endif
 				
-				If Cursor=Anchor
-					'override mode
-					Local ovd:=MainWindow.OverrideTextMode
-					If ovd
-						Local ctrl:=(event.Modifiers & Modifier.Control)
-						Local shift:=(event.Modifiers & Modifier.Shift)
-						
-						Local alt:=(event.Modifiers & Modifier.Alt)
-						If Cursor < Text.Length And Text[Cursor]<>10 And Not shift And Not ctrl And Not alt
-							SelectText( Cursor,Cursor+1 )
-						Endif
+				' select next char in override mode
+				If Cursor=Anchor And MainWindow.OverrideTextMode
+				
+					' don't select new-line-char ~n
+					If Cursor < Text.Length And Text[Cursor]<>10
+						SelectText( Cursor,Cursor+1 )
 					Endif
 				Endif
 		End
@@ -404,9 +399,15 @@ Class CodeTextView Extends TextView
 	Method OnThemeChanged() Override
 		
 		Super.OnThemeChanged()
-		UpdateColors2()
+		UpdateThemeColors()
 	End
 	
+	Method UpdateThemeColors() Virtual
+	
+		_whitespacesColor=App.Theme.GetColor( "textview-whitespaces" )
+	End
+	
+	
 	Private
 	
 	Field _line:Int
@@ -430,11 +431,6 @@ Class CodeTextView Extends TextView
 		
 	End
 	
-	Method UpdateColors2()
-		
-		_whitespacesColor=App.Theme.GetColor( "textview-whitespaces" )
-	End
-	
 	Method OnRenderLine( canvas:Canvas,line:Int ) Override
 	
 		Super.OnRenderLine( canvas,line )
@@ -448,17 +444,22 @@ Class CodeTextView Extends TextView
 		
 		For Local word:=Eachin WordIterator.ForLine( Self,line )
 		
-			Local len:=word.Length
-			If len > 1 And text[word.Index]=9 ' tab
+			If text[word.Index]=9 ' tab
 				
 				canvas.Color=_whitespacesColor
 				
+				Local len:=word.Length
+				
 				r=word.Rect
-				Local x0:=r.Left,y0:=r.Top
+				Local x0:=r.Left,y0:=r.Top+1,y1:=y0+r.Height
 				Local ww:=r.Width/len
 				Local xx:=x0+ww
-				For Local i:=1 Until len
-					canvas.DrawLine( xx,y0,xx,y0+r.Height )
+				
+				Local after:=word.Index+len
+				If after < text.Length And text[after] > 32 Then len-=1
+				
+				For Local i:=0 Until len
+					canvas.DrawLine( xx,y0,xx,y1 )
 					xx+=ww
 				Next
 			Endif
@@ -466,4 +467,11 @@ Class CodeTextView Extends TextView
 
 	End
 	
+'	Function DrawDottedLineVert ( canvas:Canvas,x:Float,y1:Float,y2:Float )
+'		
+'		For Local y:=y1 To y2 Step 6
+'			canvas.DrawLine( x,y,x,y+1 )
+'		Next
+'	End
+	
 End

+ 0 - 0
views/codetreeview.monkey2 → view/CodeTreeView.monkey2


+ 0 - 0
views/consoleext.monkey2 → view/ConsoleViewExt.monkey2


+ 27 - 7
debugview.monkey2 → view/DebugView.monkey2

@@ -28,6 +28,7 @@ Class DebugView Extends DockingView
 			If _stopped
 				_console.WriteStdin( "r~n" )
 				Resume()
+				ResetDebugLines()
 			Else
 				_console.Process.SendBreak()
 			Endif
@@ -140,13 +141,15 @@ Class DebugView Extends DockingView
 			
 			_console.Write( "~nFinished running app.~n" )
 			
-			MainWindow.UpdateKeyView()
+			OnStopRunning( "Finished running app." )
 			
 			Return
 		End
 		
 		If Not _console.Start( cmd )
+			
 			Alert( "Failed to start process: '"+cmd+"'" )
+			OnStopRunning( "Failed to start process: '"+cmd+"'" )
 			Return
 		Endif
 		
@@ -168,18 +171,35 @@ Class DebugView Extends DockingView
 		
 		DebugEnd()
 		
-		For Local doc:=Eachin _docs.OpenDocuments
-			Local mx2Doc:=Cast<CodeDocument>( doc )
-			If mx2Doc mx2Doc.DebugLine=-1
-		Next
-			
+		ResetDebugLines()
+		
 		_console.Write( "~nFinished debugging app.~n" )
 		
-		MainWindow.UpdateKeyView()
+		OnStopRunning( "Finished debugging app." )
 	End
 
+
 	Private
+	
+	Method OnStopRunning( info:String )
+		
+		MainWindow.UpdateKeyView()
+		MainWindow.SetStatusBarActive( False )
+		MainWindow.ShowStatusBarText( info )
+		MainWindow.RestoreConsoleVisibility()
+		MainWindow.HideStatusBarProgress()
 		
+	End
+	
+	Method ResetDebugLines()
+	
+		For Local doc:=Eachin _docs.OpenDocuments
+			Local mx2Doc:=Cast<CodeDocument>( doc )
+			If mx2Doc mx2Doc.DebugLine=-1
+		Next
+	End
+	
+	
 	Class Node Extends TreeView.Node
 
 		Field srcFile:String

+ 0 - 0
gutterview.monkey2 → view/GutterView.monkey2


+ 3 - 3
helptree.monkey2 → view/HelpTreeView.monkey2

@@ -31,7 +31,7 @@ End
 
 Public
 
-Class HelpTree Extends TreeViewExt
+Class HelpTreeView Extends TreeViewExt
 
 	Field PageClicked:Void( page:String )
 	
@@ -109,13 +109,13 @@ Class HelpTree Extends TreeViewExt
 	
 	Class Node Extends TreeView.Node
 	
-		Method New( page:String,parent:TreeView.Node,tree:HelpTree )
+		Method New( page:String,parent:TreeView.Node,tree:HelpTreeView )
 			Super.New( page,parent )
 			
 			_page=page
 		End
 	
-		Method New( obj:JsonObject,parent:TreeView.Node,tree:HelpTree )
+		Method New( obj:JsonObject,parent:TreeView.Node,tree:HelpTreeView )
 			Super.New( "",parent )
 		
 			Text=obj["text"].ToString()

+ 3 - 15
views/hint.monkey2 → view/HintView.monkey2

@@ -24,14 +24,14 @@ End
 
 Private
 
-Global _hint:HintInstance
+Global _hint:HintView
 Global _timer:Timer
 Global _time:Long
 Global _duration:Int
 
 Function InitHint()
 
-	_hint=New HintInstance
+	_hint=New HintView
 	_timer=New Timer( 1, Lambda()
 		If _time > 0 And Millisecs() >= _time+_duration
 			HideHint()
@@ -40,7 +40,7 @@ Function InitHint()
 End
 
 
-Class HintInstance Extends TextView
+Class HintView Extends TextView
 
 	Method New()
 		
@@ -72,16 +72,4 @@ Class HintInstance Extends TextView
 		Visible=False
 	End
 	
-	
-	Protected
-		
-	'Method OnRender( canvas:Canvas ) Override
-	'	
-	'	canvas.Clear( Color.Black )
-	'End
-	
-	
-	Private
-	
-	
 End

+ 0 - 0
views/htmlviewext.monkey2 → view/HtmlViewExt.monkey2


+ 0 - 0
jsontreeview.monkey2 → view/JsonTreeView.monkey2


+ 49 - 12
views/listviewext.monkey2 → view/ListViewExt.monkey2

@@ -44,11 +44,14 @@ Class ListViewExt Extends ScrollableView
 
 	Field OnItemChoosen:Void()
 	
-	Method New( lineHeight:Int,width:Int=600,height:Int=480 )
+	Method New( lineHeight:Int,maxLines:Int )
 		
-		_items=New List<ListViewItem>
 		_lineH=lineHeight
-		MaxSize=New Vec2i( width,height )
+		_maxLines=maxLines
+		
+		_items=New List<ListViewItem>
+		
+		'MaxSize=New Vec2i( width,height )
 		
 		_selColor=App.Theme.GetColor( "content" )
 		_hoverColor=App.Theme.GetColor( "knob" )
@@ -56,26 +59,38 @@ Class ListViewExt Extends ScrollableView
 	End
 	
 	Method AddItems( items:Stack<ListViewItem> )
+		
 		For Local i:=Eachin items
 			_items.AddLast( i )
 		Next
 		_count=_items.Count()
+		_visibleCount=Min( _maxLines,_count )
 	End
 	
 	Method SetItems<T>( items:Stack<T> ) Where T Extends ListViewItem
+		
 		_items.Clear()
 		AddItems( items )
 	End
 	
 	Method Reset()
+		
 		_selIndex=0
+		Scroll=New Vec2i
 	End
 	
 	Property LineHeight:Float()
 		Return _lineH
 	End
 	
+	Property MaxLines:Int()
+		Return _maxLines
+	Setter( value:Int )
+		_maxLines=value
+	End
+	
 	Property CurrentItem:ListViewItem()
+		
 		Assert( _selIndex >= 0 And _selIndex < _count,"Index out of bounds!" )
 		Return Utils.ValueAt<ListViewItem>( _items,_selIndex )
 	End
@@ -95,6 +110,7 @@ Class ListViewExt Extends ScrollableView
 	End
 	
 	Method SelectFirst()
+		
 		If _selIndex = 0 Return
 		_selIndex=0
 		EnsureVisible()
@@ -102,12 +118,31 @@ Class ListViewExt Extends ScrollableView
 	End
 	
 	Method SelectLast()
+		
 		If _selIndex = _count-1 Return
 		_selIndex=_count-1
 		EnsureVisible()
 		RequestRender()
 	End
 	
+	Method PageUp()
+	
+		_selIndex-=_visibleCount
+		If _selIndex < 0 Then _selIndex=0
+		
+		EnsureVisible()
+		RequestRender()
+	End
+	
+	Method PageDown()
+	
+		_selIndex+=_visibleCount
+		If _selIndex >= _count Then _selIndex=_count-1
+	
+		EnsureVisible()
+		RequestRender()
+	End
+	
 	Property Items:List<ListViewItem>.Iterator()
 		Return _items.All()
 	End
@@ -151,8 +186,9 @@ Class ListViewExt Extends ScrollableView
 	End
 	
 	Method EnsureVisible()
+		
 		Local clip:=VisibleRect
-			
+		
 		Local firstVisLine:=Max( clip.Top/_lineH,0 )
 		Local lastVisLine:=Min( (clip.Bottom-1)/_lineH,_count )
 		
@@ -170,15 +206,15 @@ Class ListViewExt Extends ScrollableView
 		Local clip:=VisibleRect
 		
 		'draw mouse hover
-		If Rect.Contains( MouseLocation ) 
-			Local yy:Int=MouseLocation.y/_lineH
-			canvas.Color=_hoverColor
-			canvas.DrawRect( clip.Left,yy*_lineH,clip.Width,_lineH )
-		Endif
+'		If Rect.Contains( MouseLocation ) 
+'			Local yy:Int=MouseLocation.y/_lineH
+'			canvas.Color=_hoverColor
+'			canvas.DrawRect( clip.Left,yy*_lineH,clip.Width,_lineH )
+'		Endif
 		
 		Local firstVisLine:=Max( clip.Top/_lineH,0 )
 		Local lastVisLine:=Min( (clip.Bottom-1)/_lineH,_count )
-				
+		
 		Local posY:=_lineH/2,k:=0
 		For Local item:=Eachin _items
 			If k >= firstVisLine
@@ -213,7 +249,7 @@ Class ListViewExt Extends ScrollableView
 	
 	Method OnMeasure:Vec2i() Override
 		
-		Local h:=Min( _count*_lineH,MaxSize.y )
+		Local h:=Min( _visibleCount*_lineH,MaxSize.y )
 		h=(h/_lineH)*_lineH
 		
 		Return New Vec2i( _width+40,h ) '+40 for icon + scrollbar
@@ -256,7 +292,8 @@ Class ListViewExt Extends ScrollableView
 	
 	Field _items:List<ListViewItem>
 	Field _lineH:Int
-	Field _count:Int
+	Field _count:Int,_visibleCount:Int
+	Field _maxLines:Int
 	Field _selIndex:Int
 	Field _selColor:Color,_hoverColor:Color
 	Field _width:Int

+ 366 - 0
view/MenuExt.monkey2

@@ -0,0 +1,366 @@
+
+Namespace ted2go
+
+
+Class MenuExt Extends DockingView
+
+	#rem monkeydoc Creates a new menu.
+	#end
+	Method New( text:String="" )
+		
+		Style=GetStyle( "Menu" )
+		Visible=False
+		Layout="float"
+		Gravity=New Vec2f( 0,0 )
+		
+		_text=text
+	End
+	
+	#rem monkeydoc Menu text
+	#end
+	Property Text:String()
+		Return _text
+	End
+
+	#rem monkeydoc Clears all items from the menu.
+	#end
+	Method Clear()
+		Super.RemoveAllViews()
+	End
+
+	#rem monkeydoc Adds a view to the menu.
+	#end	
+	Method AddView( view:View )
+	
+		AddView( view,"top" )
+	End
+	
+	#rem monkeydoc Adds an action to the menu.
+	#end	
+	Method AddAction( action:Action )
+	
+		Local button:=New MenuButtonExt( action )
+		
+		button.Clicked=Lambda()
+		
+			CloseAll()
+			'
+			'a bit gnarly, but makes sure menu is *really* closed...
+			'
+			App.RequestRender()
+			App.Idle+=action.Trigger
+		End
+		
+		AddView( button )
+	End
+	
+	Method AddAction:Action( text:String )
+		
+		Local action:=New Action( text )
+		AddAction( action )
+		Return action
+	End
+	
+	#rem monkeydoc Adds a separator to the menu.
+	#end
+	Method AddSeparator()
+		
+		AddView( New MenuSeparator,"top" )
+	End
+	
+	#rem monkeydoc Adds a submenu to the menu.
+	#end
+	Method AddSubMenu( menu:MenuExt )
+	
+		Local button:=New MenuButtonExt( menu.Text )
+		button.HasSubmenu=True
+		
+		_subs[button]=menu
+		
+		button.Clicked=Lambda()
+			If menu.Visible
+				menu.Close()
+			Else
+				Local location:=New Vec2i( button.Bounds.Right,button.Bounds.Top )
+				menu.Open( location,button,Self )
+			Endif
+		End
+		
+		AddView( button,"top" )
+	End
+	
+	#rem monkeydoc Opens the menu.
+	#end
+	Method Open()
+	
+		Open( App.MouseLocation,App.ActiveWindow,Null )
+	End
+	
+	#rem monkeydoc @hidden
+	#end
+	Method Open( location:Vec2i,view:View,owner:View )
+	
+		If Visible Return
+		
+		While Not _open.Empty And _open.Top<>owner
+			_open.Top.Close()
+		Wend
+		
+		If _open.Empty
+			_filter=App.MouseEventFilter
+			App.MouseEventFilter=MouseEventFilter
+		Endif
+		
+		Local window:=view.Window
+		location=view.TransformPointToView( location,window )
+		
+		window.AddChildView( Self )
+		Offset=location
+		Visible=True
+		
+		_owner=owner
+
+		_open.Push( Self )
+	End
+	
+	#rem monkeydoc @hidden
+	#end	
+	Method Close()
+	
+		If Not Visible Return
+		
+		While Not _open.Empty
+		
+			Local menu:=_open.Pop()
+			menu.Parent.RemoveChildView( menu )
+			menu.Visible=False
+			menu._owner=Null
+			
+			If menu=Self Exit
+		Wend
+		
+		If Not _open.Empty Return
+		
+		App.MouseEventFilter=_filter
+
+		_filter=Null
+	End
+	
+	Private
+	
+	Field _subs:=New Map<View,MenuExt>
+	Field _text:String
+	Field _owner:View
+	Global _hovered:View
+	Global _timer:Timer
+	Global _sub:MenuExt
+	
+	Global _open:=New Stack<MenuExt>
+	
+	Global _filter:Void( MouseEvent )
+	
+	Function CloseAll()
+		
+		_open[0].Close()
+	End
+	
+	Function MouseEventFilter( event:MouseEvent )
+	
+		If event.Eaten Return
+		
+		Local view:=event.View
+			
+		For Local menu:=Eachin _open
+		
+			If view.IsChildOf( menu )
+				
+				If event.Type=EventType.MouseMove
+					
+					' auto-expand sub menus
+					'
+					If view=_hovered Return
+					_hovered=view
+					Local sub:=menu._subs[view]
+					If _timer Then _timer.Cancel()
+					If _sub And menu<>_sub
+						_sub.Close()
+						_sub=Null
+					Endif
+					If sub
+						_timer=New Timer( 1.8,Lambda()
+							Local location:=New Vec2i( view.Bounds.Right,view.Bounds.Top )
+							If sub.Visible Then sub.Close()
+							sub.Open( location,view,menu )
+							_sub=sub
+							_timer.Cancel()
+							_timer=Null
+						End )
+					Endif
+				Endif
+				
+				Return
+			Endif
+		Next
+		
+		_hovered=Null
+		If _timer Then _timer.Cancel()
+		
+		' auto-expand root menus in menu bar
+		'
+		If event.Type=EventType.MouseMove
+			
+			Local bar:=Cast<MenuBarExt>( _open[0]._owner )
+			If bar
+				Local window:=view.Window
+				Local location:=view.TransformPointToView( event.Location,window )
+				Local v:=bar.FindViewAtWindowPoint( location )
+				If v<>bar.Opened
+					Local b:=Cast<MenuButton>( v )
+					If b Then b.Clicked()
+				Endif
+			Endif
+		Endif
+		
+		' we are interesting to mousedown only
+		'
+		If event.Type<>EventType.MouseDown Return
+		
+		If _open[0]._owner
+		
+			If view<>_open[0]._owner And view.IsChildOf( _open[0]._owner ) Return
+			
+			CloseAll()
+		Else
+			
+			CloseAll()
+		Endif
+	End
+	
+End
+
+
+Class MenuButtonExt Extends Button
+	
+	Field HasSubmenu:Bool
+	
+	Method New( action:Action )
+	
+		Super.New( action )
+		
+		Style=GetStyle( "MenuButton" )
+		TextGravity=New Vec2f( 0,.5 )
+		Layout="fill-x"
+		
+		_action=action
+		
+		UpdateThemeColors()
+	End
+	
+	Method New( text:String )
+	
+		Super.New( text )
+		
+		Style=GetStyle( "MenuButton" )
+		TextGravity=New Vec2f( 0,.5 )
+		Layout="fill-x"
+		
+		UpdateThemeColors()
+	End
+	
+	
+	Protected
+	
+	Method OnThemeChanged() Override
+		
+		UpdateThemeColors()
+	End
+	
+	Method OnMeasure:Vec2i() Override
+	
+		Local size:=Super.OnMeasure()
+	
+		If _action
+			Local hotKey:=_action.HotKeyText
+			If hotKey size.x+=RenderStyle.Font.TextWidth( "         "+hotKey )
+		Endif
+		If HasSubmenu
+			size.x+=RenderStyle.Font.TextWidth( " >" )
+		Endif
+		Return size
+	End
+	
+	Method OnRender( canvas:Canvas ) Override
+	
+		Super.OnRender( canvas )
+		
+		If _action
+			Local hotKey:=_action.HotKeyText
+			If hotKey
+				Local w:=RenderStyle.Font.TextWidth( hotKey )
+				Local tx:=(Width-w)
+				Local ty:=(Height-MeasuredSize.y) * TextGravity.y
+				Local color:=canvas.Color
+				canvas.Color=_shortCutColor
+				canvas.DrawText( hotKey,tx,ty )
+				canvas.Color=color
+			Endif
+		Endif
+		
+		If HasSubmenu
+			Local tx:=Width
+			Local ty:=(Height-MeasuredSize.y) * TextGravity.y
+			canvas.DrawText( ">",tx,ty,1,0 )
+		Endif
+	End
+	
+	
+	Private
+	
+	Field _action:Action
+	Field _shortCutColor:Color
+	
+	Method UpdateThemeColors()
+		
+		_shortCutColor=App.Theme.GetColor( "menu-shortcut" )
+	End
+	
+End
+
+
+Class MenuBarExt Extends ToolBar
+
+	Method New()
+		Style=GetStyle( "MenuBar" )
+		
+		Layout="fill-x"
+		Gravity=New Vec2f( 0,0 )
+	End
+	
+	Method AddMenu( menu:MenuExt )
+	
+		Local button:=New MenuButton( menu.Text )
+
+		button.Clicked=Lambda()
+			_opened=Null
+			If menu.Visible
+				menu.Close()
+			Else
+				Local location:=New Vec2i( button.Bounds.Left,button.Bounds.Bottom )
+				menu.Open( location,button,Self )
+				_opened=button
+			Endif
+		End
+		
+		AddView( button )
+	End
+	
+	Property Opened:MenuButton()
+		Return _opened
+	End
+	
+	
+	Private
+	
+	Field _opened:MenuButton
+	
+End

+ 0 - 0
monkey2treeview.monkey2 → view/Monkey2TreeView.monkey2


+ 28 - 6
views/projectbrowser.monkey2 → view/ProjectBrowserView.monkey2

@@ -2,7 +2,7 @@
 Namespace ted2go
 
 
-Class ProjectBrowser Extends FileBrowser
+Class ProjectBrowserView Extends FileBrowser
 
 	
 	Method New( rootPath:String )
@@ -14,20 +14,23 @@ Class ProjectBrowser Extends FileBrowser
 		
 		NodeExpanded+=Lambda( node:TreeView.Node )
 			
-			If node = RootNode And node.Expanded And _filters Then AdjustFilter( _filters )
+			If node = RootNode And node.Expanded Then Refresh( False )
 		End
 		
 		NodeDoubleClicked+=Lambda( node:TreeView.Node )
 			
 			node.Expanded=Not node.Expanded
-			If node = RootNode And node.Expanded And _filters Then AdjustFilter( _filters )
-			Update() 'need to refresh icons
+			
+			If node = RootNode And node.Expanded Then Refresh( True ) ' TRUE - need to refresh icons
 		End
 	End
 	
-	Method AdjustFilter( jarr:Stack<JsonValue> )
+	Method Refresh( update:Bool=True )
+		
+		If update Then Update()
 		
-		_filters=jarr
+		Local jarr:=GetFilterItems()
+		If Not jarr Return
 		
 		For Local i:=Eachin jarr
 			Local filter:=i.ToString()
@@ -49,6 +52,7 @@ Class ProjectBrowser Extends FileBrowser
 	Private
 	
 	Field _filters:Stack<JsonValue>
+	Field _fileTime:Long
 	
 	Method Filter( filter:String,type:FilterType)
 	
@@ -91,6 +95,24 @@ Class ProjectBrowser Extends FileBrowser
 		Next
 	End
 	
+	Method GetFilterItems:Stack<JsonValue>()
+		
+		Local path:=RootPath+"/project.json"
+		If GetFileType( path ) <> FileType.File Return _filters
+		
+		Local t:=GetFileTime( path )
+		If t=_fileTime Return _filters
+		
+		_fileTime=t
+		
+		Local json:=JsonObject.Load( path )
+		If json.Contains( "exclude" )
+			_filters=json["exclude"].ToArray()
+		Endif
+		
+		Return _filters
+	End
+	
 	Enum FilterType
 		Equals=0,
 		Starts=1,

+ 96 - 42
projectview.monkey2 → view/ProjectView.monkey2

@@ -7,11 +7,13 @@ Class ProjectView Extends ScrollView
 	Field openProject:Action
 	
 	Field ProjectOpened:Void( dir:String )
+	Field ProjectClosed:Void( dir:String )
 
-	Method New( docs:DocumentManager )
+	Method New( docs:DocumentManager,builder:IModuleBuilder )
 	
 		_docs=docs
-	
+		_builder=builder
+		
 		_docker=New DockingView
 		
 		ContentView=_docker
@@ -31,8 +33,6 @@ Class ProjectView Extends ScrollView
 			projs.Add( proj )
 		Next
 		
-'		projs.Add( _projects.Keys )	'Should work - FIXME
-		
 		Return projs.ToArray()
 	End
 	
@@ -44,14 +44,20 @@ Class ProjectView Extends ScrollView
 		
 		If GetFileType( dir )<>FileType.Directory Return False
 	
-		Local browser:=New ProjectBrowser( dir )
+		Local browser:=New ProjectBrowserView( dir )
 		
 		browser.FileClicked+=Lambda( path:String )
 		
-			OnOpenDocument( path )
+			'OnOpenDocument( path )
 			
 		End
 		
+		browser.FileDoubleClicked+=Lambda( path:String )
+		
+			OnOpenDocument( path )
+		
+		End
+		
 		browser.FileRightClicked+=Lambda( path:String )
 		
 			Local menu:=New Menu
@@ -59,7 +65,14 @@ Class ProjectView Extends ScrollView
 			Select GetFileType( path )
 			Case FileType.Directory
 			
-				menu.AddAction( "New File" ).Triggered=Lambda()
+				menu.AddAction( "Open on Desktop" ).Triggered=Lambda()
+				
+					requesters.OpenUrl( path )
+				End
+				
+				menu.AddSeparator()
+				
+				menu.AddAction( "New file" ).Triggered=Lambda()
 				
 					Local file:=RequestString( "New file name:" )
 					If Not file Return
@@ -77,11 +90,11 @@ Class ProjectView Extends ScrollView
 						Alert( "Failed to create file '"+file+"'" )
 					Endif
 					
-					browser.Update()
+					browser.Refresh()
 					Return
 				End
 		
-				menu.AddAction( "New Folder" ).Triggered=Lambda()
+				menu.AddAction( "New folder" ).Triggered=Lambda()
 				
 					Local dir:=RequestString( "New folder name:" )
 					If Not dir Return
@@ -98,7 +111,7 @@ Class ProjectView Extends ScrollView
 						Return
 					Endif
 					
-					browser.Update()
+					browser.Refresh()
 					Return
 				End
 				
@@ -107,16 +120,61 @@ Class ProjectView Extends ScrollView
 					If Not RequestOkay( "Really delete folder '"+path+"'?" ) Return
 					
 					If DeleteDir( path,True )
-						browser.Update()
+						browser.Refresh()
 						Return
 					Endif
 					
 					Alert( "Failed to delete folder '"+path+"'" )
 				End
 				
+				menu.AddSeparator()
+				
+				If path = browser.RootPath ' root node
+					
+					menu.AddAction( "Close project" ).Triggered=Lambda()
+					
+						CloseProject( path )
+					End
+					
+					menu.AddAction( "Clean (delete .buildv)" ).Triggered=Lambda()
+						
+						If Not RequestOkay( "Really delete all '.buildv' folders?" ) Return
+						
+						Local changes:=CleanProject( path )
+						If changes Then browser.Refresh()
+					End
+				Else
+					
+					menu.AddAction( "Open as a project" ).Triggered=Lambda()
+					
+						OpenProject( path )
+					End
+				Endif
+				
+				' update / rebuild module
+				path=path.Replace( "\","/" )
+				Local name := path.Slice( path.FindLast( "/")+1 )
+				Local file:=path+"/module.json"
+				
+				If path.Contains( "/modules/") And GetFileType( file )=FileType.File
+					
+					menu.AddSeparator()
+					
+					menu.AddAction( "Update module" ).Triggered=Lambda()
+						
+						_builder.BuildModules( False,name )
+					End
+					
+					menu.AddAction( "Rebuild module" ).Triggered=Lambda()
+				
+						_builder.BuildModules( True,name )
+					End
+				
+				Endif
+				
 			Case FileType.File
 			
-				menu.AddAction( "Open On Desktop" ).Triggered=Lambda()
+				menu.AddAction( "Open on Desktop" ).Triggered=Lambda()
 				
 					requesters.OpenUrl( path )
 				End
@@ -134,7 +192,7 @@ Class ProjectView Extends ScrollView
 					
 						DeleteFile( path )
 					
-						browser.Update()
+						browser.Refresh()
 						Return
 					Endif
 					
@@ -153,28 +211,13 @@ Class ProjectView Extends ScrollView
 						
 						If doc doc.Close()
 					
-						browser.Update()
+						browser.Refresh()
 						Return
 					Endif
 					
 					Alert( "Failed to delete file: '"+path+"'" )
 				End
 				
-				#rem
-				Local name := StripDir(path)
-				If name = "module.json"
-					menu.AddSeparator()
-			
-					menu.AddAction( "Rebuild module Debug" ).Triggered=Lambda()
-											
-					End
-					
-					menu.AddAction( "Rebuild module Release" ).Triggered=Lambda()
-											
-					End
-				Endif
-				#end
-				
 			Default
 			
 				Return
@@ -187,7 +230,7 @@ Class ProjectView Extends ScrollView
 		
 		_projects[dir]=browser
 		
-		AdjustFilter( browser )
+		browser.Refresh()
 		
 		ProjectOpened( dir )
 
@@ -204,6 +247,8 @@ Class ProjectView Extends ScrollView
 		_docker.RemoveView( view )
 		
 		_projects.Remove( dir )
+		
+		ProjectClosed( dir )
 	End
 	
 	Method SaveState( jobj:JsonObject )
@@ -233,8 +278,8 @@ Class ProjectView Extends ScrollView
 	
 		Select event.Type
 		Case EventType.MouseWheel ' little faster
-	
-			Scroll-=New Vec2i( 0,ContentView.RenderStyle.Font.Height*event.Wheel.Y*2 )
+			
+			Scroll-=New Vec2i( 0,ContentView.RenderStyle.Font.Height*event.Wheel.Y*3 )
 			Return
 	
 		End
@@ -246,10 +291,9 @@ Class ProjectView Extends ScrollView
 	Private
 	
 	Field _docs:DocumentManager
-	
 	Field _docker:=New DockingView
-	
 	Field _projects:=New StringMap<FileBrowser>
+	Field _builder:IModuleBuilder
 
 	Method OnOpenProject()
 	
@@ -270,15 +314,25 @@ Class ProjectView Extends ScrollView
 		Endif
 	End
 	
-	Method AdjustFilter( brow:ProjectBrowser )
-		
-		Local path:=brow.RootPath+"/project.json"
-		If GetFileType( path ) <> FileType.File Return
+	' Return True if there is an actual folder deletion
+	Method CleanProject:Bool( dir:String )
+	
+		Local succ:=0,err:=0
+		Local items:=LoadDir( dir )
+		For Local i:=Eachin items
+			i=dir+"/"+i
+			If GetFileType(i)=FileType.Directory
+				If i.Contains( ".buildv" )
+					Local ok:=DeleteDir( i,True )
+					If ok Then succ+=1 Else err+=1
+				Endif
+			Endif
+		Next
+	
+		Local s:= err=0 ? "Project was successfully cleaned." Else "Clean project error! Some files are busy or you have no privileges."
+		MainWindow.ShowStatusBarText( s )
 		
-		Local json:=JsonObject.Load( path )
-		If json.Contains( "exclude" )
-			brow.AdjustFilter( json["exclude"].ToArray() )
-		Endif
+		Return succ>0
 	End
 	
 End

+ 39 - 4
views/statusbar.monkey2 → view/StatusBarView.monkey2

@@ -2,7 +2,7 @@
 Namespace ted2go
 
 
-Class StatusBar Extends DockingView
+Class StatusBarView Extends DockingView
 	
 	Field Cancelled:Void()
 	
@@ -17,16 +17,27 @@ Class StatusBar Extends DockingView
 		_labelIns.MinSize=New Vec2i( 44,0 )
 		_labelIns.Style=GetStyle( "StatusBarIns" )
 		AddView( _labelIns,"right" )
+		' DoubleClick
+		_labelIns.DoubleClicked+=Lambda()
+		
+			MainWindow.OverrideTextMode=Not MainWindow.OverrideTextMode
+		End
 		
 		_labelLineInfo=New Label( "0 : 0")
 		_labelLineInfo.MinSize=New Vec2i( 200,0 )
 		_labelLineInfo.Style=GetStyle( "StatusBarLineInfo" )
 		AddView( _labelLineInfo,"right" )
+		' DoubleClick
+		_labelLineInfo.DoubleClicked+=Lambda()
+		
+			MainWindow.GotoLine()
+		End
 		
 		Local act:=New Action( Null,ThemeImages.Get( "cancel.png" ) )
 		act.Triggered=OnCancel
 		
 		_progressCancel=New ToolButtonExt( act,"" ) '"Stop process" )
+		_progressCancel.Style=GetStyle( "StatusBarButton" )
 		AddView( _progressCancel,"right" )
 		
 		_progress=New ProgressBar
@@ -39,30 +50,47 @@ Class StatusBar Extends DockingView
 		ContentView=_labelText
 		
 		HideProgress()
+		UpdateThemeColors()
+	End
+	
+	Method OnThemeChanged() Override
+		
+		Super.OnThemeChanged()
+		UpdateThemeColors()
 	End
 	
-	Method SetText( text:String )
+	Method SetText( text:String,append:Bool=False )
+		
+		If append Then text=_labelText.Text+text
 		_labelText.Text=text
 	End
 	
 	Method SetLineInfo( text:String )
+		
 		_labelLineInfo.Text=text
 	End
 	
 	Method SetInsMode( ins:Bool )
+		
 		_labelIns.Text=ins ? "INS" else "OVR"
 	End
 	
-	Method ShowProgress()
-		_progress.Visible=True
+	Method ShowProgress( cancelIconOnly:Bool=False )
+		
+		If Not cancelIconOnly Then _progress.Visible=True
 		_progressCancel.Visible=True
 	End
 	
 	Method HideProgress()
+		
 		_progress.Visible=False
 		_progressCancel.Visible=False
 	End
 	
+	Method SetActiveState( active:Bool )
+		
+		RenderStyle.BackgroundColor=active ? _activeColor Else _defaultColor
+	End
 	
 	Private
 	
@@ -71,6 +99,7 @@ Class StatusBar Extends DockingView
 	Field _labelIns:Label
 	Field _progress:ProgressBar
 	Field _progressCancel:ToolButtonExt
+	Field _activeColor:Color,_defaultColor:Color
 	
 	Method OnCancel()
 		
@@ -78,4 +107,10 @@ Class StatusBar Extends DockingView
 		Cancelled()
 	End
 	
+	Method UpdateThemeColors()
+		
+		_defaultColor=App.Theme.GetColor( "statusbar" )
+		_activeColor=App.Theme.GetColor( "statusbar-active" )
+	End
+	
 End

+ 0 - 0
views/tabviewext.monkey2 → view/TabViewExt.monkey2


+ 0 - 0
ted2textview.monkey2 → view/Ted2TextView.monkey2


+ 0 - 0
views/toolbarext.monkey2 → view/ToolBarViewExt.monkey2


+ 0 - 0
views/treeviewext.monkey2 → view/TreeViewExt.monkey2


+ 0 - 0
xmltreeview.monkey2 → view/XmlTreeView.monkey2


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно