|
@@ -13,6 +13,7 @@ Namespace ted2go
|
|
|
|
|
|
#Import "assets/themes/irc/@/themes/irc"
|
|
|
|
|
|
+
|
|
|
Global MainWindow:MainWindowInstance
|
|
|
|
|
|
Class MainWindowInstance Extends Window
|
|
@@ -27,6 +28,8 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
UpdateToolsPaths()
|
|
|
|
|
|
+ LiveTemplates.Load()
|
|
|
+
|
|
|
_docsTabView=New TabViewExt( TabViewFlags.DraggableTabs|TabViewFlags.ClosableTabs )
|
|
|
|
|
|
_browsersTabView=New TabView( TabViewFlags.DraggableTabs )
|
|
@@ -41,7 +44,11 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
_docsManager=New DocumentManager( _docsTabView,_docBrowser )
|
|
|
|
|
|
- _docsManager.CurrentDocumentChanged+=UpdateKeyView
|
|
|
+ _docsManager.CurrentDocumentChanged+=Lambda()
|
|
|
+
|
|
|
+ UpdateKeyView()
|
|
|
+ CodeDocument.HideAutocomplete()
|
|
|
+ End
|
|
|
|
|
|
App.FileDropped+=Lambda( path:String )
|
|
|
_docsManager.OpenDocument( path,True )
|
|
@@ -79,16 +86,6 @@ Class MainWindowInstance Extends Window
|
|
|
Local bar:=New ToolBarExt
|
|
|
bar.MaxSize=New Vec2i( 300,30 )
|
|
|
|
|
|
- bar.AddIconicButton(
|
|
|
- ThemeImages.Get( "outputbar/clean.png" ),
|
|
|
- Lambda()
|
|
|
- _outputConsole.ClearAll()
|
|
|
- End,
|
|
|
- "Clear all" )
|
|
|
-
|
|
|
- 'bar.AddSeparator()
|
|
|
- 'bar.AddSeparator()
|
|
|
-
|
|
|
Local label:=New Label( "Filter:" )
|
|
|
bar.AddView( label,"left" )
|
|
|
Local editFilter:=New TextField()
|
|
@@ -102,6 +99,23 @@ Class MainWindowInstance Extends Window
|
|
|
_outputConsole.SetFilter( t )
|
|
|
End
|
|
|
|
|
|
+ bar.AddSeparator()
|
|
|
+
|
|
|
+ bar.AddIconicButton(
|
|
|
+ ThemeImages.Get( "outputbar/clean.png" ),
|
|
|
+ Lambda()
|
|
|
+ _outputConsole.ClearAll()
|
|
|
+ End,
|
|
|
+ "Clear all" )
|
|
|
+
|
|
|
+ Local it:=bar.AddIconicButton(
|
|
|
+ ThemeImages.Get( "outputbar/wrap.png" ),
|
|
|
+ Lambda()
|
|
|
+ _outputConsole.WordWrap=Not _outputConsole.WordWrap
|
|
|
+ End,
|
|
|
+ "Word wrap" )
|
|
|
+ it.ToggleMode=True
|
|
|
+
|
|
|
_outputConsoleView=New DockingView
|
|
|
_outputConsoleView.AddView( bar,"top" )
|
|
|
_outputConsoleView.ContentView=_outputConsole
|
|
@@ -174,16 +188,23 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
|
|
|
_buildActions=New BuildActions( _docsManager,_buildConsole,_debugView )
|
|
|
+ _buildActions.ErrorsOccured+=Lambda( errors:BuildError[] )
|
|
|
+ ShowBuildConsole( True )
|
|
|
+ _buildActions.GotoError( errors[0] )
|
|
|
+
|
|
|
+ _buildErrorsList.Clear()
|
|
|
+ For Local err:=Eachin errors
|
|
|
+ _buildErrorsList.AddItem( New BuildErrorListViewItem( err ) )
|
|
|
+ Next
|
|
|
+ _buildErrorsList.Visible=True
|
|
|
+ End
|
|
|
|
|
|
_projectView=New ProjectView( _docsManager,_buildActions )
|
|
|
_projectView.ProjectOpened+=Lambda( dir:String )
|
|
|
AddRecentProject( dir )
|
|
|
SaveState()
|
|
|
End
|
|
|
- _projectView.ProjectClosed+=Lambda( dir:String )
|
|
|
- UpdateCloseProjectMenu( dir )
|
|
|
- SaveState()
|
|
|
- End
|
|
|
+ _projectView.ProjectClosed+=OnProjectClosed
|
|
|
|
|
|
_fileActions=New FileActions( _docsManager )
|
|
|
_editActions=New EditActions( _docsManager )
|
|
@@ -299,7 +320,8 @@ Class MainWindowInstance Extends Window
|
|
|
_forceStop.HotKeyModifiers=Modifier.Shift
|
|
|
|
|
|
'
|
|
|
- _buildActions.PreBuild+=OnForceStop
|
|
|
+ _buildActions.PreBuild+=OnPreBuild
|
|
|
+ _buildActions.PreSemant+=OnPreSemant
|
|
|
|
|
|
_buildMenu=New MenuExt( "Build" )
|
|
|
_buildMenu.AddAction( _buildActions.buildAndRun )
|
|
@@ -366,7 +388,18 @@ Class MainWindowInstance Extends Window
|
|
|
_browsersTabView.AddTab( "Debug",_debugView,False )
|
|
|
_browsersTabView.AddTab( "Help",_helpTree,False )
|
|
|
|
|
|
- _consolesTabView.AddTab( "Build",_buildConsole,True )
|
|
|
+ _buildErrorsList=New ListViewExt
|
|
|
+ _buildErrorsList.Visible=False
|
|
|
+ _buildErrorsList.OnItemChoosen+=Lambda()
|
|
|
+ Local item:=Cast<BuildErrorListViewItem>( _buildErrorsList.CurrentItem )
|
|
|
+ _buildActions.GotoError( item.error )
|
|
|
+ End
|
|
|
+
|
|
|
+ _buildConsoleView=New DockingView
|
|
|
+ _buildConsoleView.AddView( _buildErrorsList,"right","400",True )
|
|
|
+ _buildConsoleView.ContentView=_buildConsole
|
|
|
+
|
|
|
+ _consolesTabView.AddTab( "Build",_buildConsoleView,True )
|
|
|
_consolesTabView.AddTab( "Output",_outputConsoleView,False )
|
|
|
_consolesTabView.AddTab( "Docs",_helpConsole,False )
|
|
|
_consolesTabView.AddTab( "Find",_findConsole,False )
|
|
@@ -645,6 +678,7 @@ Class MainWindowInstance Extends Window
|
|
|
'
|
|
|
Local newTitle:=GetActionTextWithShortcut( _fileActions.new_ )
|
|
|
Local openTitle:=GetActionTextWithShortcut( _fileActions.open )
|
|
|
+ Local saveTitle:=GetActionTextWithShortcut( _fileActions.save )
|
|
|
Local saveAllTitle:=GetActionTextWithShortcut( _fileActions.saveAll )
|
|
|
Local undoTitle:=GetActionTextWithShortcut( _editActions.undo )
|
|
|
Local redoTitle:=GetActionTextWithShortcut( _editActions.redo )
|
|
@@ -653,15 +687,36 @@ Class MainWindowInstance Extends Window
|
|
|
Local checkTitle:=GetActionTextWithShortcut( _buildActions.semant )
|
|
|
Local findTitle:=GetActionTextWithShortcut( _findActions.find )
|
|
|
Local debugTitle:=GetActionTextWithShortcut( _buildActions.debugApp )
|
|
|
+ Local cutTitle:=GetActionTextWithShortcut( _editActions.cut )
|
|
|
+ Local copyTitle:=GetActionTextWithShortcut( _editActions.copy )
|
|
|
+ Local pasteTitle:=GetActionTextWithShortcut( _editActions.paste )
|
|
|
|
|
|
_toolBar=New ToolBarExt
|
|
|
_toolBar.Style=GetStyle( "MainToolBar" )
|
|
|
_toolBar.MaxSize=New Vec2i( 10000,40 )
|
|
|
|
|
|
+ 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)" )
|
|
|
+ _toolBar.AddSeparator()
|
|
|
+
|
|
|
_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 )
|
|
|
+ Local icons:=New Image[]( ThemeImages.Get( "toolbar/save.png" ),ThemeImages.Get( "toolbar/save_dirty.png" ) )
|
|
|
+ _saveItem=_toolBar.AddIconicButton( icons,_fileActions.save.Triggered,saveTitle )
|
|
|
+ icons=New Image[]( ThemeImages.Get( "toolbar/save_all.png" ),ThemeImages.Get( "toolbar/save_all_dirty.png" ) )
|
|
|
+ _saveAllItem=_toolBar.AddIconicButton( icons,_fileActions.saveAll.Triggered,saveAllTitle )
|
|
|
+ _toolBar.AddSeparator()
|
|
|
+ _toolBar.AddIconicButton( ThemeImages.Get( "toolbar/cut.png" ),_editActions.cut.Triggered,cutTitle )
|
|
|
+ _toolBar.AddIconicButton( ThemeImages.Get( "toolbar/copy.png" ),_editActions.copy.Triggered,copyTitle )
|
|
|
+ _toolBar.AddIconicButton( ThemeImages.Get( "toolbar/paste.png" ),_editActions.paste.Triggered,pasteTitle )
|
|
|
_toolBar.AddSeparator()
|
|
|
_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/undo.png" ),_editActions.undo.Triggered,undoTitle )
|
|
|
_toolBar.AddIconicButton( ThemeImages.Get( "toolbar/redo.png" ),_editActions.redo.Triggered,redoTitle )
|
|
@@ -678,17 +733,6 @@ Class MainWindowInstance Extends Window
|
|
|
_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
|
|
@@ -728,7 +772,7 @@ Class MainWindowInstance Extends Window
|
|
|
Method ShowBuildConsole( vis:Bool=True )
|
|
|
|
|
|
If vis _consolesTabView.Visible=True
|
|
|
- _consolesTabView.CurrentView=_buildConsole
|
|
|
+ _consolesTabView.CurrentView=_buildConsoleView
|
|
|
End
|
|
|
|
|
|
Method ShowOutputConsole( vis:Bool=True )
|
|
@@ -820,6 +864,21 @@ Class MainWindowInstance Extends Window
|
|
|
_helpView.Scroll=New Vec2i( 0,0 )
|
|
|
End
|
|
|
|
|
|
+ Method ShowEditorMenu( tv:TextView )
|
|
|
+
|
|
|
+ If Not tv Then tv=_docsManager.CurrentTextView
|
|
|
+ If Not tv Return
|
|
|
+
|
|
|
+ If Not _editorMenu
|
|
|
+ _editorMenu=New MenuExt
|
|
|
+ _editorMenu.AddAction( _editActions.cut )
|
|
|
+ _editorMenu.AddAction( _editActions.copy )
|
|
|
+ _editorMenu.AddAction( _editActions.paste )
|
|
|
+ Endif
|
|
|
+
|
|
|
+ _editorMenu.Open()
|
|
|
+ End
|
|
|
+
|
|
|
Method UpdateHelpTree()
|
|
|
_helpTree.Update()
|
|
|
End
|
|
@@ -994,6 +1053,32 @@ Class MainWindowInstance Extends Window
|
|
|
_fileActions.quit.Trigger()
|
|
|
End
|
|
|
|
|
|
+ Method OnPreBuild()
|
|
|
+
|
|
|
+ OnForceStop()
|
|
|
+ _buildErrorsList.Visible=False
|
|
|
+ End
|
|
|
+
|
|
|
+ Method OnPreSemant()
|
|
|
+
|
|
|
+ _buildErrorsList.Visible=False
|
|
|
+ End
|
|
|
+
|
|
|
+ Method OnProjectClosed( dir:String )
|
|
|
+
|
|
|
+ UpdateCloseProjectMenu( dir )
|
|
|
+
|
|
|
+ Local list:=New Stack<Ted2Document>
|
|
|
+ ' close all related files
|
|
|
+ For Local doc:=Eachin _docsManager.OpenDocuments
|
|
|
+ If doc.Path.StartsWith( dir ) Then list.Add( doc )
|
|
|
+ Next
|
|
|
+
|
|
|
+ _fileActions.CloseFiles( list.ToArray() )
|
|
|
+
|
|
|
+ SaveState()
|
|
|
+ End
|
|
|
+
|
|
|
Method OnResized()
|
|
|
|
|
|
' just set a flag here.
|
|
@@ -1020,21 +1105,41 @@ Class MainWindowInstance Extends Window
|
|
|
End
|
|
|
|
|
|
Method OnChatClicked()
|
|
|
+
|
|
|
If _consolesTabView.CurrentView<>_ircView Then Return
|
|
|
|
|
|
_consolesTabView.SetTabIcon( _ircView, Null )
|
|
|
+
|
|
|
_ircNotifyIcon=0
|
|
|
+
|
|
|
+ HideHint()
|
|
|
+
|
|
|
End
|
|
|
|
|
|
Method OnChatMessage( message:IRCMessage, container:IRCMessageContainer, server:IRCServer )
|
|
|
+
|
|
|
If message.type<>"PRIVMSG" Or _consolesTabView.CurrentView=_ircView Then Return
|
|
|
|
|
|
'Show notice icon
|
|
|
If message.text.Contains(server.nickname) Then
|
|
|
- If _ircNotifyIcon<=1 Then _ircNotifyIcon=2
|
|
|
-
|
|
|
+
|
|
|
+ If _ircNotifyIcon<=1 Then
|
|
|
+
|
|
|
+ _ircNotifyIcon=2
|
|
|
+
|
|
|
+ Local mentionStr:String
|
|
|
+ mentionStr=server.nickname+" was mentioned by "
|
|
|
+ mentionStr+=message.fromUser+" in "
|
|
|
+ mentionStr+=container.name
|
|
|
+
|
|
|
+ ShowHint( mentionStr, New Vec2i( 0, -GetStyle( "Hint" ).Font.Height*4 ), _consolesTabView, 20000 )
|
|
|
+
|
|
|
+ Endif
|
|
|
+
|
|
|
Else
|
|
|
+
|
|
|
If _ircNotifyIcon<=0 Then _ircNotifyIcon=1
|
|
|
+
|
|
|
Endif
|
|
|
|
|
|
End
|
|
@@ -1166,6 +1271,8 @@ Class MainWindowInstance Extends Window
|
|
|
Field _modsDir:String
|
|
|
|
|
|
Field _toolBar:ToolBarExt
|
|
|
+ Field _saveItem:MultiIconToolButton
|
|
|
+ Field _saveAllItem:MultiIconToolButton
|
|
|
Field _docsManager:DocumentManager
|
|
|
Field _fileActions:FileActions
|
|
|
Field _editActions:EditActions
|
|
@@ -1176,6 +1283,8 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
Field _ircView:IRCView
|
|
|
Field _buildConsole:ConsoleExt
|
|
|
+ Field _buildErrorsList:ListViewExt
|
|
|
+ Field _buildConsoleView:DockingView
|
|
|
Field _outputConsole:ConsoleExt
|
|
|
Field _outputConsoleView:DockingView
|
|
|
Field _helpView:HtmlViewExt
|
|
@@ -1207,7 +1316,7 @@ Class MainWindowInstance Extends Window
|
|
|
Field _windowMenu:MenuExt
|
|
|
Field _helpMenu:MenuExt
|
|
|
Field _menuBar:MenuBarExt
|
|
|
-
|
|
|
+ Field _editorMenu:MenuExt
|
|
|
Field _themesMenu:MenuExt
|
|
|
|
|
|
Field _theme:="default"
|
|
@@ -1404,6 +1513,9 @@ Class MainWindowInstance Extends Window
|
|
|
|
|
|
_forceStop.Enabled=_buildConsole.Running Or _outputConsole.Running
|
|
|
|
|
|
+ _saveItem.SetIcon( _fileActions.save.Enabled ? 1 Else 0 )
|
|
|
+ _saveAllItem.SetIcon( _fileActions.saveAll.Enabled ? 1 Else 0 )
|
|
|
+
|
|
|
App.Idle+=OnAppIdle
|
|
|
|
|
|
GCCollect() 'thrash that GC!
|
|
@@ -1414,7 +1526,7 @@ Class MainWindowInstance Extends Window
|
|
|
Select _consolesTabView.CurrentView
|
|
|
Case _outputConsoleView
|
|
|
Return "output"
|
|
|
- Case _buildConsole
|
|
|
+ Case _buildConsoleView
|
|
|
Return "build"
|
|
|
Case _helpConsole
|
|
|
Return "docs"
|
|
@@ -1431,7 +1543,7 @@ Class MainWindowInstance Extends Window
|
|
|
Case "output"
|
|
|
view=_outputConsoleView
|
|
|
Case "build"
|
|
|
- view=_buildConsole
|
|
|
+ view=_buildConsoleView
|
|
|
Case "docs"
|
|
|
view=_helpConsole
|
|
|
Case "find"
|