|
@@ -9,6 +9,9 @@ Namespace ted2go
|
|
|
|
|
|
#Import "assets/newfiles/@/ted2/newfiles"
|
|
#Import "assets/newfiles/@/ted2/newfiles"
|
|
|
|
|
|
|
|
+#Import "assets/fonts/@/fonts"
|
|
|
|
+
|
|
|
|
+
|
|
Global MainWindow:MainWindowInstance
|
|
Global MainWindow:MainWindowInstance
|
|
|
|
|
|
Class MainWindowInstance Extends Window
|
|
Class MainWindowInstance Extends Window
|
|
@@ -18,28 +21,17 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
MainWindow=Self
|
|
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 )
|
|
_docsTabView=New TabViewExt( TabViewFlags.DraggableTabs|TabViewFlags.ClosableTabs )
|
|
|
|
|
|
_browsersTabView=New TabView( TabViewFlags.DraggableTabs )
|
|
_browsersTabView=New TabView( TabViewFlags.DraggableTabs )
|
|
|
|
+ _browsersTabView.Style=GetStyle( "ProjectTabView" )
|
|
_consolesTabView=New TabView( TabViewFlags.DraggableTabs )
|
|
_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
|
|
_docBrowser=New DockingView
|
|
|
|
|
|
@@ -53,11 +45,12 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
_docsManager.DocumentAdded+=Lambda( doc:Ted2Document )
|
|
_docsManager.DocumentAdded+=Lambda( doc:Ted2Document )
|
|
AddRecentFile( doc.Path )
|
|
AddRecentFile( doc.Path )
|
|
- UpdateRecentFilesMenu()
|
|
|
|
|
|
+ SaveState()
|
|
End
|
|
End
|
|
|
|
|
|
_docsManager.DocumentRemoved+=Lambda( doc:Ted2Document )
|
|
_docsManager.DocumentRemoved+=Lambda( doc:Ted2Document )
|
|
If IsTmpPath( doc.Path ) DeleteFile( doc.Path )
|
|
If IsTmpPath( doc.Path ) DeleteFile( doc.Path )
|
|
|
|
+ SaveState()
|
|
End
|
|
End
|
|
|
|
|
|
_buildConsole=New ConsoleExt
|
|
_buildConsole=New ConsoleExt
|
|
@@ -85,7 +78,7 @@ Class MainWindowInstance Extends Window
|
|
'Help tab
|
|
'Help tab
|
|
|
|
|
|
_helpView=New HtmlViewExt
|
|
_helpView=New HtmlViewExt
|
|
- _helpViewDocker=New DockingView
|
|
|
|
|
|
+ _helpConsole=New DockingView
|
|
Local bar:=New ToolBarExt
|
|
Local bar:=New ToolBarExt
|
|
bar.MaxSize=New Vec2i( 300,30 )
|
|
bar.MaxSize=New Vec2i( 300,30 )
|
|
bar.AddIconicButton(
|
|
bar.AddIconicButton(
|
|
@@ -117,21 +110,31 @@ Class MainWindowInstance Extends Window
|
|
label.Text=url
|
|
label.Text=url
|
|
End
|
|
End
|
|
|
|
|
|
- _helpViewDocker.AddView( bar,"top" )
|
|
|
|
- _helpViewDocker.ContentView=_helpView
|
|
|
|
|
|
+ _helpConsole.AddView( bar,"top" )
|
|
|
|
+ _helpConsole.ContentView=_helpView
|
|
|
|
|
|
_helpView.Navigate( "asset::ted2/about.html" )
|
|
_helpView.Navigate( "asset::ted2/about.html" )
|
|
|
|
|
|
- _projectView=New ProjectView( _docsManager )
|
|
|
|
-
|
|
|
|
- _helpTree=New HelpTree( _helpView )
|
|
|
|
|
|
+ _helpTree=New HelpTreeView( _helpView )
|
|
|
|
|
|
_debugView=New DebugView( _docsManager,_outputConsole )
|
|
_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 )
|
|
_fileActions=New FileActions( _docsManager )
|
|
_editActions=New EditActions( _docsManager )
|
|
_editActions=New EditActions( _docsManager )
|
|
_findActions=New FindActions( _docsManager,_projectView,_findConsole )
|
|
_findActions=New FindActions( _docsManager,_projectView,_findConsole )
|
|
- _buildActions=New BuildActions( _docsManager,_buildConsole,_debugView )
|
|
|
|
_helpActions=New HelpActions
|
|
_helpActions=New HelpActions
|
|
_viewActions=New ViewActions( _docsManager )
|
|
_viewActions=New ViewActions( _docsManager )
|
|
|
|
|
|
@@ -163,11 +166,11 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
'File menu
|
|
'File menu
|
|
'
|
|
'
|
|
- _newFiles=New Menu( "New..." )
|
|
|
|
|
|
+ _templateFiles=New MenuExt( "Templates" )
|
|
Local p:=AssetsDir()+"ted2/newfiles/"
|
|
Local p:=AssetsDir()+"ted2/newfiles/"
|
|
For Local f:=Eachin LoadDir( p )
|
|
For Local f:=Eachin LoadDir( p )
|
|
Local src:=stringio.LoadString( p+f )
|
|
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 ) )
|
|
Local path:=AllocTmpPath( "untitled",ExtractExt( f ) )
|
|
If Not path Return
|
|
If Not path Return
|
|
SaveString( src,path )
|
|
SaveString( src,path )
|
|
@@ -175,11 +178,11 @@ Class MainWindowInstance Extends Window
|
|
End
|
|
End
|
|
Next
|
|
Next
|
|
|
|
|
|
- _fileMenu=New Menu( "File" )
|
|
|
|
|
|
+ _fileMenu=New MenuExt( "File" )
|
|
_fileMenu.AddAction( _fileActions.new_ )
|
|
_fileMenu.AddAction( _fileActions.new_ )
|
|
- _fileMenu.AddSubMenu( _newFiles )
|
|
|
|
_fileMenu.AddAction( _fileActions.open )
|
|
_fileMenu.AddAction( _fileActions.open )
|
|
_fileMenu.AddSubMenu( _recentFilesMenu )
|
|
_fileMenu.AddSubMenu( _recentFilesMenu )
|
|
|
|
+ _fileMenu.AddSubMenu( _templateFiles )
|
|
_fileMenu.AddSeparator()
|
|
_fileMenu.AddSeparator()
|
|
_fileMenu.AddAction( _fileActions.close )
|
|
_fileMenu.AddAction( _fileActions.close )
|
|
_fileMenu.AddAction( _fileActions.closeOthers )
|
|
_fileMenu.AddAction( _fileActions.closeOthers )
|
|
@@ -191,6 +194,7 @@ Class MainWindowInstance Extends Window
|
|
_fileMenu.AddAction( _fileActions.saveAll )
|
|
_fileMenu.AddAction( _fileActions.saveAll )
|
|
_fileMenu.AddSeparator()
|
|
_fileMenu.AddSeparator()
|
|
_fileMenu.AddAction( _projectView.openProject )
|
|
_fileMenu.AddAction( _projectView.openProject )
|
|
|
|
+ _fileMenu.AddSubMenu( _recentProjectsMenu )
|
|
_fileMenu.AddSubMenu( _closeProjectMenu )
|
|
_fileMenu.AddSubMenu( _closeProjectMenu )
|
|
_fileMenu.AddSeparator()
|
|
_fileMenu.AddSeparator()
|
|
_fileMenu.AddAction( _fileActions.prefs )
|
|
_fileMenu.AddAction( _fileActions.prefs )
|
|
@@ -199,7 +203,7 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
'Edit menu
|
|
'Edit menu
|
|
'
|
|
'
|
|
- _editMenu=New Menu( "Edit" )
|
|
|
|
|
|
+ _editMenu=New MenuExt( "Edit" )
|
|
_editMenu.AddAction( _editActions.undo )
|
|
_editMenu.AddAction( _editActions.undo )
|
|
_editMenu.AddAction( _editActions.redo )
|
|
_editMenu.AddAction( _editActions.redo )
|
|
_editMenu.AddSeparator()
|
|
_editMenu.AddSeparator()
|
|
@@ -213,7 +217,7 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
'Find menu
|
|
'Find menu
|
|
'
|
|
'
|
|
- _findMenu=New Menu( "Find" )
|
|
|
|
|
|
+ _findMenu=New MenuExt( "Find" )
|
|
_findMenu.AddAction( _findActions.find )
|
|
_findMenu.AddAction( _findActions.find )
|
|
_findMenu.AddAction( _findActions.findNext )
|
|
_findMenu.AddAction( _findActions.findNext )
|
|
_findMenu.AddAction( _findActions.findPrevious )
|
|
_findMenu.AddAction( _findActions.findPrevious )
|
|
@@ -224,9 +228,9 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
'View menu
|
|
'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.AddSeparator()
|
|
_viewMenu.AddAction( _viewActions.comment )
|
|
_viewMenu.AddAction( _viewActions.comment )
|
|
_viewMenu.AddAction( _viewActions.uncomment )
|
|
_viewMenu.AddAction( _viewActions.uncomment )
|
|
@@ -242,9 +246,9 @@ Class MainWindowInstance Extends Window
|
|
_forceStop.HotKeyModifiers=Modifier.Shift
|
|
_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.buildAndRun )
|
|
_buildMenu.AddAction( _buildActions.build )
|
|
_buildMenu.AddAction( _buildActions.build )
|
|
_buildMenu.AddAction( _buildActions.semant )
|
|
_buildMenu.AddAction( _buildActions.semant )
|
|
@@ -262,12 +266,12 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
'Window menu
|
|
'Window menu
|
|
'
|
|
'
|
|
- _windowMenu=New Menu( "Window" )
|
|
|
|
|
|
+ _windowMenu=New MenuExt( "Window" )
|
|
_windowMenu.AddAction( _docsManager.nextDocument )
|
|
_windowMenu.AddAction( _docsManager.nextDocument )
|
|
_windowMenu.AddAction( _docsManager.prevDocument )
|
|
_windowMenu.AddAction( _docsManager.prevDocument )
|
|
_windowMenu.AddSeparator()
|
|
_windowMenu.AddSeparator()
|
|
|
|
|
|
- _themesMenu=CreateThemesMenu( "Themes..." )
|
|
|
|
|
|
+ _themesMenu=CreateThemesMenu( "Themes" )
|
|
|
|
|
|
AddZoomActions( _windowMenu )
|
|
AddZoomActions( _windowMenu )
|
|
_windowMenu.AddSeparator()
|
|
_windowMenu.AddSeparator()
|
|
@@ -276,7 +280,7 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
'Help menu
|
|
'Help menu
|
|
'
|
|
'
|
|
- _helpMenu=New Menu( "Help" )
|
|
|
|
|
|
+ _helpMenu=New MenuExt( "Help" )
|
|
_helpMenu.AddAction( _helpActions.quickHelp )
|
|
_helpMenu.AddAction( _helpActions.quickHelp )
|
|
_helpMenu.AddAction( _helpActions.viewManuals )
|
|
_helpMenu.AddAction( _helpActions.viewManuals )
|
|
_helpMenu.AddSeparator()
|
|
_helpMenu.AddSeparator()
|
|
@@ -293,7 +297,7 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
'Menu bar
|
|
'Menu bar
|
|
'
|
|
'
|
|
- _menuBar=New MenuBar
|
|
|
|
|
|
+ _menuBar=New MenuBarExt
|
|
_menuBar.AddMenu( _fileMenu )
|
|
_menuBar.AddMenu( _fileMenu )
|
|
_menuBar.AddMenu( _editMenu )
|
|
_menuBar.AddMenu( _editMenu )
|
|
_menuBar.AddMenu( _findMenu )
|
|
_menuBar.AddMenu( _findMenu )
|
|
@@ -302,55 +306,6 @@ Class MainWindowInstance Extends Window
|
|
_menuBar.AddMenu( _windowMenu )
|
|
_menuBar.AddMenu( _windowMenu )
|
|
_menuBar.AddMenu( _helpMenu )
|
|
_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( "Project",_projectView,True )
|
|
_browsersTabView.AddTab( "Source",_docBrowser,False )
|
|
_browsersTabView.AddTab( "Source",_docBrowser,False )
|
|
@@ -359,29 +314,15 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
_consolesTabView.AddTab( "Build",_buildConsole,True )
|
|
_consolesTabView.AddTab( "Build",_buildConsole,True )
|
|
_consolesTabView.AddTab( "Output",_outputConsole,False )
|
|
_consolesTabView.AddTab( "Output",_outputConsole,False )
|
|
- _consolesTabView.AddTab( "Docs",_helpViewDocker,False )
|
|
|
|
|
|
+ _consolesTabView.AddTab( "Docs",_helpConsole,False )
|
|
_consolesTabView.AddTab( "Find",_findConsole,False )
|
|
_consolesTabView.AddTab( "Find",_findConsole,False )
|
|
|
|
|
|
- _statusBar=New StatusBar
|
|
|
|
|
|
+ _statusBar=New StatusBarView
|
|
|
|
|
|
_contentView=New DockingView
|
|
_contentView=New DockingView
|
|
_contentView.AddView( _menuBar,"top" )
|
|
_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
|
|
ContentView=_contentView
|
|
|
|
|
|
@@ -390,13 +331,43 @@ Class MainWindowInstance Extends Window
|
|
LoadState( jobj )
|
|
LoadState( jobj )
|
|
|
|
|
|
App.MouseEventFilter+=ThemeScaleMouseFilter
|
|
App.MouseEventFilter+=ThemeScaleMouseFilter
|
|
-
|
|
|
|
|
|
+
|
|
App.Idle+=OnAppIdle
|
|
App.Idle+=OnAppIdle
|
|
|
|
|
|
If GetFileType( "bin/ted2.state.json" )=FileType.None _helpActions.about.Trigger()
|
|
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
|
|
End
|
|
|
|
|
|
|
|
+
|
|
Method OnFind()
|
|
Method OnFind()
|
|
_findActions.find.Trigger()
|
|
_findActions.find.Trigger()
|
|
End
|
|
End
|
|
@@ -409,6 +380,18 @@ Class MainWindowInstance Extends Window
|
|
_findActions.findNext.Trigger()
|
|
_findActions.findNext.Trigger()
|
|
End
|
|
End
|
|
|
|
|
|
|
|
+ Method OnForceStop()
|
|
|
|
+
|
|
|
|
+ If _buildConsole.Running
|
|
|
|
+ _buildConsole.Terminate()
|
|
|
|
+ HideStatusBarProgress()
|
|
|
|
+ RestoreConsoleVisibility()
|
|
|
|
+ Endif
|
|
|
|
+ If _outputConsole.Running
|
|
|
|
+ _outputConsole.Terminate()
|
|
|
|
+ Endif
|
|
|
|
+ End
|
|
|
|
+
|
|
Property Mx2ccPath:String()
|
|
Property Mx2ccPath:String()
|
|
|
|
|
|
Return _mx2cc
|
|
Return _mx2cc
|
|
@@ -439,22 +422,42 @@ Class MainWindowInstance Extends Window
|
|
Return _buildActions.LockedDocument
|
|
Return _buildActions.LockedDocument
|
|
End
|
|
End
|
|
|
|
|
|
|
|
+ Property IsTerminating:Bool()
|
|
|
|
+
|
|
|
|
+ Return _isTerminating
|
|
|
|
+ End
|
|
|
|
+
|
|
|
|
+ Property ThemeName:String()
|
|
|
|
+
|
|
|
|
+ Return _theme
|
|
|
|
+ Setter( value:String )
|
|
|
|
+
|
|
|
|
+ _theme=value
|
|
|
|
+ End
|
|
|
|
+
|
|
Method Terminate()
|
|
Method Terminate()
|
|
|
|
|
|
|
|
+ _isTerminating=True
|
|
|
|
+
|
|
SaveState()
|
|
SaveState()
|
|
|
|
|
|
|
|
+ _fileActions.closeAll.Trigger() 'stops all parser's timers on close docs
|
|
|
|
+
|
|
App.Terminate()
|
|
App.Terminate()
|
|
End
|
|
End
|
|
|
|
|
|
'Use these as macos still seems to have problems running requesters on a fiber - stacksize?
|
|
'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>
|
|
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
|
|
End
|
|
|
|
|
|
Return future.Get()
|
|
Return future.Get()
|
|
@@ -482,14 +485,48 @@ Class MainWindowInstance Extends Window
|
|
Return ""
|
|
Return ""
|
|
End
|
|
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 )
|
|
Method IsTmpPath:Bool( path:String )
|
|
|
|
|
|
Return path.StartsWith( _tmp )
|
|
Return path.StartsWith( _tmp )
|
|
End
|
|
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
|
|
End
|
|
|
|
|
|
Method SetStatusBarInsertMode( ins:Bool )
|
|
Method SetStatusBarInsertMode( ins:Bool )
|
|
@@ -506,10 +543,10 @@ Class MainWindowInstance Extends Window
|
|
_statusBar.SetLineInfo( "Ln : "+line+" Col : "+pos )
|
|
_statusBar.SetLineInfo( "Ln : "+line+" Col : "+pos )
|
|
End
|
|
End
|
|
|
|
|
|
- Method ShowStatusBarProgress( cancelCallback:Void() )
|
|
|
|
|
|
+ Method ShowStatusBarProgress( cancelCallback:Void(),cancelIconOnly:Bool=False )
|
|
|
|
|
|
_statusBar.Cancelled=cancelCallback
|
|
_statusBar.Cancelled=cancelCallback
|
|
- _statusBar.ShowProgress()
|
|
|
|
|
|
+ _statusBar.ShowProgress( cancelIconOnly )
|
|
End
|
|
End
|
|
|
|
|
|
Method HideStatusBarProgress()
|
|
Method HideStatusBarProgress()
|
|
@@ -519,7 +556,61 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
|
|
|
|
Private
|
|
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()
|
|
Method DeleteTmps()
|
|
|
|
|
|
For Local f:=Eachin LoadDir( _tmp )
|
|
For Local f:=Eachin LoadDir( _tmp )
|
|
@@ -544,6 +635,7 @@ Class MainWindowInstance Extends Window
|
|
End
|
|
End
|
|
|
|
|
|
Method ShowBuildConsole( vis:Bool=True )
|
|
Method ShowBuildConsole( vis:Bool=True )
|
|
|
|
+
|
|
If vis _consolesTabView.Visible=True
|
|
If vis _consolesTabView.Visible=True
|
|
_consolesTabView.CurrentView=_buildConsole
|
|
_consolesTabView.CurrentView=_buildConsole
|
|
End
|
|
End
|
|
@@ -555,7 +647,7 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
Method ShowHelpView()
|
|
Method ShowHelpView()
|
|
_consolesTabView.Visible=True
|
|
_consolesTabView.Visible=True
|
|
- _consolesTabView.CurrentView=_helpViewDocker
|
|
|
|
|
|
+ _consolesTabView.CurrentView=_helpConsole
|
|
End
|
|
End
|
|
|
|
|
|
Method ShowFindResults()
|
|
Method ShowFindResults()
|
|
@@ -683,13 +775,40 @@ Class MainWindowInstance Extends Window
|
|
doc.GotoDeclaration()
|
|
doc.GotoDeclaration()
|
|
End
|
|
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()
|
|
Method SaveState()
|
|
|
|
|
|
|
|
+ If Not _enableSaving Return
|
|
|
|
+
|
|
Local jobj:=New JsonObject
|
|
Local jobj:=New JsonObject
|
|
|
|
|
|
jobj["windowRect"]=ToJson( Frame )
|
|
jobj["windowRect"]=ToJson( Frame )
|
|
|
|
+
|
|
jobj["browserSize"]=New JsonNumber( Int( _contentView.GetViewSize( _browsersTabView ) ) )
|
|
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["consoleSize"]=New JsonNumber( Int( _contentView.GetViewSize( _consolesTabView ) ) )
|
|
|
|
+ jobj["consoleVisible"]=New JsonBool( _consolesTabView.Visible )
|
|
|
|
+ jobj["consoleTab"]=New JsonString( GetConsolesTabAsString() )
|
|
|
|
+
|
|
|
|
|
|
Local recent:=New JsonArray
|
|
Local recent:=New JsonArray
|
|
For Local path:=Eachin _recentFiles
|
|
For Local path:=Eachin _recentFiles
|
|
@@ -697,7 +816,13 @@ Class MainWindowInstance Extends Window
|
|
End
|
|
End
|
|
jobj["recentFiles"]=recent
|
|
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 )
|
|
jobj["themeScale"]=New JsonNumber( App.Theme.Scale.y )
|
|
|
|
|
|
@@ -753,22 +878,25 @@ Class MainWindowInstance Extends Window
|
|
_docsTabView.EnsureVisibleCurrentTab()
|
|
_docsTabView.EnsureVisibleCurrentTab()
|
|
End
|
|
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
|
|
End
|
|
|
|
|
|
Method LoadState( jobj:JsonObject )
|
|
Method LoadState( jobj:JsonObject )
|
|
|
|
|
|
If jobj.Contains( "browserSize" ) _contentView.SetViewSize( _browsersTabView,jobj.GetNumber( "browserSize" ) )
|
|
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( "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" )
|
|
If jobj.Contains( "recentFiles" )
|
|
For Local file:=Eachin jobj.GetArray( "recentFiles" )
|
|
For Local file:=Eachin jobj.GetArray( "recentFiles" )
|
|
Local path:=file.ToString()
|
|
Local path:=file.ToString()
|
|
@@ -777,7 +905,15 @@ Class MainWindowInstance Extends Window
|
|
Next
|
|
Next
|
|
End
|
|
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" )
|
|
If jobj.Contains( "themeScale" )
|
|
_themeScale=jobj.GetNumber( "themeScale" )
|
|
_themeScale=jobj.GetNumber( "themeScale" )
|
|
@@ -790,16 +926,15 @@ Class MainWindowInstance Extends Window
|
|
_mx2cc=_mx2ccDir+StripDir( _mx2cc )
|
|
_mx2cc=_mx2ccDir+StripDir( _mx2cc )
|
|
Endif
|
|
Endif
|
|
|
|
|
|
|
|
+
|
|
_docsManager.LoadState( jobj )
|
|
_docsManager.LoadState( jobj )
|
|
_buildActions.LoadState( jobj )
|
|
_buildActions.LoadState( jobj )
|
|
_projectView.LoadState( jobj )
|
|
_projectView.LoadState( jobj )
|
|
|
|
|
|
If Not _projectView.OpenProjects _projectView.OpenProject( CurrentDir() )
|
|
If Not _projectView.OpenProjects _projectView.OpenProject( CurrentDir() )
|
|
|
|
|
|
- _projectView.ProjectOpened+=UpdateCloseProjectMenu
|
|
|
|
-
|
|
|
|
UpdateRecentFilesMenu()
|
|
UpdateRecentFilesMenu()
|
|
-
|
|
|
|
|
|
+ UpdateRecentProjectsMenu()
|
|
UpdateCloseProjectMenu()
|
|
UpdateCloseProjectMenu()
|
|
|
|
|
|
DeleteTmps()
|
|
DeleteTmps()
|
|
@@ -828,8 +963,7 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
Select event.Type
|
|
Select event.Type
|
|
Case EventType.WindowClose
|
|
Case EventType.WindowClose
|
|
- SaveState()
|
|
|
|
- _fileActions.quit.Trigger()
|
|
|
|
|
|
+ OnCloseApp()
|
|
Default
|
|
Default
|
|
Super.OnWindowEvent( event )
|
|
Super.OnWindowEvent( event )
|
|
End
|
|
End
|
|
@@ -856,13 +990,13 @@ Class MainWindowInstance Extends Window
|
|
Field _buildConsole:Console
|
|
Field _buildConsole:Console
|
|
Field _outputConsole:Console
|
|
Field _outputConsole:Console
|
|
Field _helpView:HtmlViewExt
|
|
Field _helpView:HtmlViewExt
|
|
- Field _helpViewDocker:DockingView
|
|
|
|
|
|
+ Field _helpConsole:DockingView
|
|
Field _findConsole:TreeViewExt
|
|
Field _findConsole:TreeViewExt
|
|
|
|
|
|
Field _projectView:ProjectView
|
|
Field _projectView:ProjectView
|
|
Field _docBrowser:DockingView
|
|
Field _docBrowser:DockingView
|
|
Field _debugView:DebugView
|
|
Field _debugView:DebugView
|
|
- Field _helpTree:HelpTree
|
|
|
|
|
|
+ Field _helpTree:HelpTreeView
|
|
|
|
|
|
Field _docsTabView:TabViewExt
|
|
Field _docsTabView:TabViewExt
|
|
Field _consolesTabView:TabView
|
|
Field _consolesTabView:TabView
|
|
@@ -871,30 +1005,36 @@ Class MainWindowInstance Extends Window
|
|
Field _forceStop:Action
|
|
Field _forceStop:Action
|
|
|
|
|
|
Field _tabMenu:Menu
|
|
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 _theme:String="default"
|
|
Field _themeScale:Float=1
|
|
Field _themeScale:Float=1
|
|
|
|
|
|
Field _contentView:DockingView
|
|
Field _contentView:DockingView
|
|
|
|
+ Field _contentLeftView:DockingView
|
|
|
|
+ Field _contentRightView:DockingView
|
|
|
|
|
|
Field _recentFiles:=New StringStack
|
|
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 _ovdMode:=False
|
|
-
|
|
|
|
|
|
+ Field _storedConsoleVisible:Bool
|
|
|
|
+ Field _isTerminating:Bool
|
|
|
|
+ Field _enableSaving:Bool
|
|
|
|
|
|
Method ToJson:JsonValue( rect:Recti )
|
|
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 ) ) )
|
|
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.Remove( path )
|
|
_recentFiles.Insert( 0,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
|
|
End
|
|
|
|
|
|
Method UpdateRecentFilesMenu()
|
|
Method UpdateRecentFilesMenu()
|
|
|
|
|
|
_recentFilesMenu.Clear()
|
|
_recentFilesMenu.Clear()
|
|
|
|
|
|
- Local recentFiles:=New StringStack
|
|
|
|
|
|
+ Local recents:=New StringStack
|
|
|
|
|
|
For Local path:=Eachin _recentFiles
|
|
For Local path:=Eachin _recentFiles
|
|
If GetFileType( path )<>FileType.File Continue
|
|
If GetFileType( path )<>FileType.File Continue
|
|
@@ -926,10 +1079,29 @@ Class MainWindowInstance Extends Window
|
|
_docsManager.OpenDocument( path,True )
|
|
_docsManager.OpenDocument( path,True )
|
|
End
|
|
End
|
|
|
|
|
|
- recentFiles.Add( path )
|
|
|
|
|
|
+ recents.Add( path )
|
|
Next
|
|
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
|
|
End
|
|
|
|
|
|
Method UpdateCloseProjectMenu( dir:String="" )
|
|
Method UpdateCloseProjectMenu( dir:String="" )
|
|
@@ -948,7 +1120,7 @@ Class MainWindowInstance Extends Window
|
|
Next
|
|
Next
|
|
End
|
|
End
|
|
|
|
|
|
- Method AddZoomActions( menu:Menu )
|
|
|
|
|
|
+ Method AddZoomActions( menu:MenuExt )
|
|
|
|
|
|
menu.AddAction( "Zoom in" ).Triggered=Lambda()
|
|
menu.AddAction( "Zoom in" ).Triggered=Lambda()
|
|
If _themeScale>=4 Return
|
|
If _themeScale>=4 Return
|
|
@@ -1001,9 +1173,9 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
End
|
|
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" )
|
|
Local themes:=JsonObject.Load( "theme::themes.json" )
|
|
If Not themes Return menu
|
|
If Not themes Return menu
|
|
@@ -1012,7 +1184,11 @@ Class MainWindowInstance Extends Window
|
|
Local name:=it.Key
|
|
Local name:=it.Key
|
|
Local value:=it.Value.ToString()
|
|
Local value:=it.Value.ToString()
|
|
menu.AddAction( name ).Triggered=Lambda()
|
|
menu.AddAction( name ).Triggered=Lambda()
|
|
- _theme=value
|
|
|
|
|
|
+
|
|
|
|
+ If value=ThemeName Return
|
|
|
|
+
|
|
|
|
+ ThemeName=value
|
|
|
|
+
|
|
App.Theme.Load( _theme,New Vec2f( _themeScale ) )
|
|
App.Theme.Load( _theme,New Vec2f( _themeScale ) )
|
|
SaveState()
|
|
SaveState()
|
|
End
|
|
End
|
|
@@ -1022,7 +1198,7 @@ Class MainWindowInstance Extends Window
|
|
End
|
|
End
|
|
|
|
|
|
Method OnAppIdle()
|
|
Method OnAppIdle()
|
|
-
|
|
|
|
|
|
+
|
|
_docsManager.Update()
|
|
_docsManager.Update()
|
|
_fileActions.Update()
|
|
_fileActions.Update()
|
|
_editActions.Update()
|
|
_editActions.Update()
|
|
@@ -1036,6 +1212,67 @@ Class MainWindowInstance Extends Window
|
|
GCCollect() 'thrash that GC!
|
|
GCCollect() 'thrash that GC!
|
|
End
|
|
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
|
|
End
|
|
|
|
|
|
|
|
|