diff --git a/app/src/gambas3/.src/Debug/FDebugButton.class b/app/src/gambas3/.src/Debug/FDebugButton.class index e590a4e06..47dbadb31 100644 --- a/app/src/gambas3/.src/Debug/FDebugButton.class +++ b/app/src/gambas3/.src/Debug/FDebugButton.class @@ -126,7 +126,7 @@ Public Sub SetMessage(Optional sText As String, bAdd As Boolean) lblMessage.Text = $sMessage lblMessage.Show dwgStatus.Hide - Wait + If Project.NoWait = 0 Then Wait Else lblMessage.Hide dwgStatus.Show diff --git a/app/src/gambas3/.src/FMain.class b/app/src/gambas3/.src/FMain.class index be26eff77..bf8e00951 100644 --- a/app/src/gambas3/.src/FMain.class +++ b/app/src/gambas3/.src/FMain.class @@ -107,7 +107,7 @@ End Public Sub Welcome() frmWelcome.Show - frmWelcome.SetFocus + 'frmWelcome.SetFocus End diff --git a/app/src/gambas3/.src/Help/CHelpSearchTask.class b/app/src/gambas3/.src/Help/CHelpSearchTask.class new file mode 100644 index 000000000..98535254e --- /dev/null +++ b/app/src/gambas3/.src/Help/CHelpSearchTask.class @@ -0,0 +1,47 @@ +' Gambas class file + +Inherits Task + +Public Search As String +Public Buffer As String + +Private $aImageExt As String[] = ["png", "jpg", "jpeg", "gif", "webm", "mov", "mp4", "mp3"] + +Public Sub Main() + + Dim aDir As New String[] + Dim sDir As String + Dim sData As String + Dim sRoot As String + Dim sFile As String + Dim sExt As String + Dim sLink As String + + Application.Priority = 10 + + sRoot = MHelp.GetOfflineDir() &/ "data" &/ MHelp.GetLanguage() + aDir.Add(sRoot) + + While aDir.Count + + sDir = aDir.Pop() + + Try sData = File.Load(sDir &/ "~page") + If Not Error Then + If String.InStr(sData, Search, 1, gb.IgnoreCase) Then + sLink = Mid$(sDir, Len(sRoot) + 1) + If Not sLink Then sLink = "/" + Print sLink + Flush + Endif + Endif + + For Each sFile In Dir(sDir, "*", gb.Directory) + sExt = File.Ext(sFile) + If $aImageExt.Exist(sExt) Then Continue + aDir.Add(sDir &/ sFile, 0) + Next + + Wend + +End diff --git a/app/src/gambas3/.src/Help/FHelpBrowser.class b/app/src/gambas3/.src/Help/FHelpBrowser.class index 77f717c09..21d03de51 100644 --- a/app/src/gambas3/.src/Help/FHelpBrowser.class +++ b/app/src/gambas3/.src/Help/FHelpBrowser.class @@ -8,6 +8,8 @@ Static Private $aLang As String[] = ["en", "fr", "de", "es", "it", "nl", "pl", " Private $bPrint As Boolean Private mnuLang As Menu Private $bFirstTime As Boolean +Private $bOffline As Boolean +Private $hTask As CHelpSearchTask Public Sub _new() @@ -50,7 +52,15 @@ End Public Sub ReadConfig() + $bOffLine = Settings["/UseOfflineHelp"] + Project.SetSmallFont(panToolbar) + If $bOffLine Then + tabClass.ShowTabBar = True + Else + tabClass.ShowTabBar = False + tabClass.Index = 0 + Endif End @@ -200,7 +210,7 @@ End Public Sub btnShowPanel_Click() - tvwClasses.Visible = btnShowPanel.Value + tabClass.Visible = btnShowPanel.Value If btnShowPanel.Value Then FillTree 'If splHelp.Layout[0] = 0 Then splHelp.Layout = [1, 2] @@ -271,6 +281,7 @@ Public Sub tvwClasses_Select() Dim aKey As String[] Dim sKey As String + lstResult.UnSelectAll sKey = tvwClasses.Current.Key If Not sKey Or If sKey = "$" Then Return @@ -335,3 +346,88 @@ Public Sub OnProjectChange() End + +Public Sub tabClass_Click() + + If tabClass.Index = 1 Then txtSearch.SetFocus + +End + +Public Sub btnSearch_Click() + + Dim sText As String + + If $hTask Then + $hTask.Stop + Else + sText = Trim(txtSearch.Text) + If sText Then + $hTask = New CHelpSearchTask As "TaskSearch" + $hTask.Search = sText + btnSearch.Picture = Picture["icon:/small/stop"] + txtSearch.Enabled = False + lstResult.Clear + spnSearch.Show + spnSearch.Raise + spnSearch.Start + Endif + Endif + +End + +Public Sub txtSearch_Activate() + + btnSearch.Value = True + +End + +Public Sub TaskSearch_Read(Data As String) + + Dim sLine As String + Dim iPos As Integer + Dim sTitle As String + + Data = $hTask.Buffer & Data + iPos = RInStr(Data, "\n") + If iPos = 0 Then + $hTask.Buffer = Data + Return + Endif + + $hTask.Buffer = Mid$(Data, iPos + 1) + + Inc Project.NoWait + For Each sLine In Split(Left(Data, iPos - 1), "\n") + sTitle = Wiki.GetPageTitle(sLine) + If sTitle Then + lstResult.Add(sLine, sTitle) + Else + lstResult.Add(sLine, sLine).Foreground = Color.LightForeground + Endif + Next + Dec Project.NoWait + +End + +Public Sub TaskSearch_Kill() + + $hTask = Null + btnSearch.Picture = Picture["icon:/small/find"] + txtSearch.Enabled = True + spnSearch.Hide + +End + + +Public Sub lstResult_Select() + + tvwClasses.UnSelectAll + MHelp.MakeOffline(webHelp, MHelp.GetURL(lstResult.Key)) + +End + +Public Sub tabClass_Arrange() + + spnSearch.Move(lstResult.X + (lstResult.W - spnSearch.W) \ 2, lstResult.Y + (lstResult.H - spnSearch.H) \ 2) + +End diff --git a/app/src/gambas3/.src/Help/FHelpBrowser.form b/app/src/gambas3/.src/Help/FHelpBrowser.form index 593401fa3..861a4b789 100644 --- a/app/src/gambas3/.src/Help/FHelpBrowser.form +++ b/app/src/gambas3/.src/Help/FHelpBrowser.form @@ -92,14 +92,53 @@ Arrangement = Arrange.Fill { splHelp HSplit MoveScaled(2,2,80,29) - { tvwClasses TreeView - MoveScaled(9,1,16,22) - Visible = False - Expand = True + { tabClass TabPanel + MoveScaled(1,1,37,26) + Arrangement = Arrange.Vertical Border = False + Count = 2 + Index = 0 + Text = ("Classes") + { tvwClasses TreeView + MoveScaled(2,3,16,17) + Expand = True + Border = False + } + Index = 1 + Text = ("Search") + { Panel2 HBox + MoveScaled(0,1,34,4) + Background = Color.TextBackground + { txtSearch ButtonBox + MoveScaled(0,0,24,4) + Expand = True + Border = False + Button = False + ClearButton = True + } + { btnSearch ToolButton + MoveScaled(24,0,4,4) + Picture = Picture["icon:/small/find"] + } + } + { Separator5 Separator + MoveScaled(7,7,14,0) + } + { lstResult ListView + MoveScaled(3,11,25,10) + Expand = True + Border = False + } + { spnSearch Spinner + MoveScaled(19,9,7,7) + Visible = False + Ignore = True + Type = Spinner.Circle + } + Index = 0 } { !webHelp HelpView - MoveScaled(29,1,28,16) + MoveScaled(45,4,28,16) #Public = True } } diff --git a/app/src/gambas3/.src/Help/Wiki/Wiki.module b/app/src/gambas3/.src/Help/Wiki/Wiki.module index 53fdd93f0..fa942f1c0 100644 --- a/app/src/gambas3/.src/Help/Wiki/Wiki.module +++ b/app/src/gambas3/.src/Help/Wiki/Wiki.module @@ -587,13 +587,12 @@ Public Sub GetSymbolTitle(Optional sPath As String) As String If Not hSym And If sClass Ends "[]" Then Try hSym = Documentation.Get(sComponent)["*[]"].Symbols[sSymbol] Endif - If Not hSym Then Return sSymbol & " ?" - If InStr("e:", hSym.Kind) Then - Return Mid$(hSym.Name, 2) - Else - Return hSym.Name - Endif Endif + ' If Not hSym Then Return sSymbol & " ?" + ' sName = hSym.Name + ' If InStr("e:", hSym.Kind) Then sName = Mid$(sName, 2) + ' Return hSym.Class & "." & sName & " (" & hSym.Component & ")" + ' Endif If Not hSym Then Return sClass & "." & sSymbol & " (" & sComponent & ")?" diff --git a/app/src/gambas3/.src/Options/FOption.class b/app/src/gambas3/.src/Options/FOption.class index b9941d3a0..afc9e66e3 100644 --- a/app/src/gambas3/.src/Options/FOption.class +++ b/app/src/gambas3/.src/Options/FOption.class @@ -599,7 +599,7 @@ Public Sub btnOfflineHelp_Click() Settings["/UseOfflineHelp"] = btnOfflineHelp.Value UpdateOfflineHelp - FHelpBrowser.GotoHome + FHelpBrowser.ReadConfig End diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index 1cc7041e0..08a7c3bd6 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -232,6 +232,8 @@ Public UseInheritance As Boolean Private $bFileIsUnknown As Boolean +Public NoWait As Integer + ' If GetFileIcon() has been called on an added file 'Private $bLastAdded As Boolean