diff --git a/Documentation/Catalogs/Deutsch/Editor.catalog b/Documentation/Catalogs/Deutsch/Editor.catalog index 689f6395..120f6bd9 100644 --- a/Documentation/Catalogs/Deutsch/Editor.catalog +++ b/Documentation/Catalogs/Deutsch/Editor.catalog @@ -264,6 +264,7 @@ FileLoad = Datei laden, wenn das Projekt geöffnet wird FilePanel = Datei in der Projektliste anzeigen FileWarn = Eine Warnung anzeigen, wenn Datei verändert wurde Filename = Dateiname +FileListSort = Nach Dateinamen sortieren FileScanShort = Scannen FileLoadShort = Laden FilePanelShort = Liste diff --git a/Documentation/Catalogs/Editor.catalog b/Documentation/Catalogs/Editor.catalog index 29f65241..1335542d 100644 --- a/Documentation/Catalogs/Editor.catalog +++ b/Documentation/Catalogs/Editor.catalog @@ -264,6 +264,7 @@ FileLoad = Load file when opening the project FilePanel = Show file in the Project panel FileWarn = Display a warning if file changed Filename = Filename +FileListSort = Sort on Filename FileScanShort = Scan FileLoadShort = Load FilePanelShort = Panel diff --git a/Documentation/Catalogs/Francais/Editor.catalog b/Documentation/Catalogs/Francais/Editor.catalog index fa685fef..0b9b5346 100644 --- a/Documentation/Catalogs/Francais/Editor.catalog +++ b/Documentation/Catalogs/Francais/Editor.catalog @@ -265,6 +265,7 @@ FileLoad = Charger le fichier à l'ouverture du projet FilePanel = Afficher le fichier dans le panneau de projet FileWarn = Afficher une alerte si le fichier a été modifié Filename = Nom du fichier +FileListSort = Trier sur le Nom du fichier FileScanShort = Scanner FileLoadShort = Charger FilePanelShort = Panneau diff --git a/Documentation/Catalogs/Italian/Editor.Catalog b/Documentation/Catalogs/Italian/Editor.Catalog index 4c23c6d8..f2070e6c 100644 --- a/Documentation/Catalogs/Italian/Editor.Catalog +++ b/Documentation/Catalogs/Italian/Editor.Catalog @@ -245,6 +245,7 @@ FileLoad = Carica il file quando si apre il Progetto FilePanel = Mostra il file nel pannello Progetto FileWarn = Mostra un avvertimento se viene modificato il file Filename = Nome del file +FileListSort = Ordina per Nome del file FileScanShort = Scansiona FileLoadShort = Carica FilePanelShort = Pannello diff --git a/Documentation/Catalogs/Russian/editor.catalog b/Documentation/Catalogs/Russian/editor.catalog index 8835dfaf..c675ea3b 100644 --- a/Documentation/Catalogs/Russian/editor.catalog +++ b/Documentation/Catalogs/Russian/editor.catalog @@ -260,6 +260,7 @@ FileLoad = Загрузить файл при открытии проекта FilePanel = Показать файл в панели проекта FileWarn = Предупреждать, если файл изменился Filename = Имя файла +FileListSort = Сортировать по Имя файла FileScanShort = Сканирование FileLoadShort = Загрузка FilePanelShort = Панель diff --git a/Documentation/Catalogs/Spanish/Editor.catalog b/Documentation/Catalogs/Spanish/Editor.catalog index 91ca4459..183a5093 100644 --- a/Documentation/Catalogs/Spanish/Editor.catalog +++ b/Documentation/Catalogs/Spanish/Editor.catalog @@ -237,6 +237,7 @@ FileLoad = Carga de archivos al abrir el proyecto FilePanel = Mostrar archivo en el panel Proyecto FileWarn = Mostrar una advertencia si el archivo modificado Filename = Nombre del archivo +FileListSort = Ordenar por Nombre del archivo FileScanShort = Scan FileLoadShort = Carga FilePanelShort = Panel diff --git a/Documentation/SpiderBasic/Catalogs/Deutsch/Editor.catalog b/Documentation/SpiderBasic/Catalogs/Deutsch/Editor.catalog index d3902400..8b70bddd 100644 --- a/Documentation/SpiderBasic/Catalogs/Deutsch/Editor.catalog +++ b/Documentation/SpiderBasic/Catalogs/Deutsch/Editor.catalog @@ -253,6 +253,7 @@ FileLoad = Datei laden, wenn das Projekt ge FilePanel = Datei in der Projektliste anzeigen FileWarn = Eine Warnung anzeigen, wenn Datei verndert wurde Filename = Dateiname +FileListSort = Nach Dateinamen sortieren FileScanShort = Scannen FileLoadShort = Laden FilePanelShort = Liste diff --git a/Documentation/SpiderBasic/Catalogs/Editor.catalog b/Documentation/SpiderBasic/Catalogs/Editor.catalog index 9f3da00b..a3419136 100644 --- a/Documentation/SpiderBasic/Catalogs/Editor.catalog +++ b/Documentation/SpiderBasic/Catalogs/Editor.catalog @@ -253,6 +253,7 @@ FileLoad = Load file when opening the project FilePanel = Show file in the Project panel FileWarn = Display a warning if file changed Filename = Filename +FileListSort = Sort on Filename FileScanShort = Scan FileLoadShort = Load FilePanelShort = Panel diff --git a/Documentation/SpiderBasic/Catalogs/Francais/Editor.catalog b/Documentation/SpiderBasic/Catalogs/Francais/Editor.catalog index fe0f277c..24e1376c 100644 --- a/Documentation/SpiderBasic/Catalogs/Francais/Editor.catalog +++ b/Documentation/SpiderBasic/Catalogs/Francais/Editor.catalog @@ -253,6 +253,7 @@ FileLoad = Charger le fichier FilePanel = Afficher le fichier dans le panneau de projet FileWarn = Afficher une alerte si le fichier a t modifi Filename = Nom du fichier +FileListSort = Trier sur le Nom du fichier FileScanShort = Scanner FileLoadShort = Charger FilePanelShort = Panneau diff --git a/Documentation/SpiderBasic/Catalogs/Italian/Editor.Catalog b/Documentation/SpiderBasic/Catalogs/Italian/Editor.Catalog index 8e01d03a..fd12c719 100644 --- a/Documentation/SpiderBasic/Catalogs/Italian/Editor.Catalog +++ b/Documentation/SpiderBasic/Catalogs/Italian/Editor.Catalog @@ -235,6 +235,7 @@ FileLoad = Carica il file quando si apre il Progetto FilePanel = Mostra il file nel pannello Progetto FileWarn = Mostra un avvertimento se viene modificato il file Filename = Nome del file +FileListSort = Ordina per Nome del file FileScanShort = Scansiona FileLoadShort = Carica FilePanelShort = Pannello diff --git a/Documentation/SpiderBasic/Catalogs/Spanish/Editor.catalog b/Documentation/SpiderBasic/Catalogs/Spanish/Editor.catalog index 5d27b270..153a821d 100644 --- a/Documentation/SpiderBasic/Catalogs/Spanish/Editor.catalog +++ b/Documentation/SpiderBasic/Catalogs/Spanish/Editor.catalog @@ -227,6 +227,7 @@ FileLoad = Carga de archivos al abrir el proyecto FilePanel = Mostrar archivo en el panel Proyecto FileWarn = Mostrar una advertencia si el archivo modificado Filename = Nombre del archivo +FileListSort = Ordenar por Nombre del archivo FileScanShort = Scan FileLoadShort = Carga FilePanelShort = Panel diff --git a/PureBasicIDE/Common.pb b/PureBasicIDE/Common.pb index c6d5ea15..7c9ad60d 100644 --- a/PureBasicIDE/Common.pb +++ b/PureBasicIDE/Common.pb @@ -145,6 +145,8 @@ Runtime Enumeration 1 ; 0 is reserved for uninitialized #PB_Any #GADGET_ProjectInfo_FrameFiles #GADGET_ProjectInfo_FrameTargets #GADGET_ProjectInfo_Info + #GADGET_ProjectInfo_FilterInput + #GADGET_ProjectInfo_SortFiles #GADGET_ProjectInfo_Files #GADGET_ProjectInfo_Targets #GADGET_ProjectInfo_OpenOptions @@ -186,6 +188,8 @@ Runtime Enumeration 1 ; 0 is reserved for uninitialized #PB_Any #GADGET_ProcedureBrowser_SwitchButtons #GADGET_ProjectPanel + #GADGET_ProjectPanel_FilterInput + #GADGET_ProjectPanel_DummyButton #GADGET_Explorer #GADGET_Explorer_Pattern @@ -2801,7 +2805,7 @@ Global IsProjectBusy = 0 Global ProjectFile$, ProjectName$, ProjectComments$, DefaultProjectFile$, LastOpenProjectFile$ Global ProjectExplorerPattern, ProjectExplorerPath$ Global ProjectCloseFiles.l -Global ProjectOpenMode.l, ProjectShowLog.l, AutoCloseBuildWindow.l +Global ProjectOpenMode.l, ProjectShowLog.l, AutoCloseBuildWindow.l, ProjectFilesSort.l Global ProjectLastOpenDate, ProjectLastOpenHost$, ProjectLastOpenUser$, ProjectLastOpenEditor$ Global *DefaultTarget.CompileTarget Global *ProjectInfo.SourceFile ; the fake sourcefile in the File tab diff --git a/PureBasicIDE/Language.pb b/PureBasicIDE/Language.pb index 5502e62a..3551656d 100644 --- a/PureBasicIDE/Language.pb +++ b/PureBasicIDE/Language.pb @@ -698,6 +698,7 @@ DataSection Data$ "FileWarn", "Display a warning if file changed" Data$ "Filename", "Filename" + Data$ "FileListSort", "Sort on Filename" Data$ "FileScanShort", "Scan" Data$ "FileLoadShort", "Load" Data$ "FilePanelShort", "Panel" diff --git a/PureBasicIDE/Preferences.pb b/PureBasicIDE/Preferences.pb index 3af9711f..309a27e4 100644 --- a/PureBasicIDE/Preferences.pb +++ b/PureBasicIDE/Preferences.pb @@ -388,6 +388,7 @@ Procedure LoadPreferences() ;- - Projects PreferenceGroup("Projects") DefaultProjectFile$ = ReadPreferenceString("DefaultProject", "") + ProjectFilesSort = ReadPreferenceLong("ProjectFilesSort", 1) LoadDialogPosition(@ProjectOptionsPosition, -1, -1, 0, 0, "ProjectOptions") ; will get a minimum size anyway, so no default w/h @@ -1193,6 +1194,7 @@ Procedure SavePreferences() PreferenceGroup("Projects") PreferenceComment("") WritePreferenceString("DefaultProject", DefaultProjectFile$) + WritePreferenceLong("ProjectFilesSort",ProjectFilesSort) SaveDialogPosition(@ProjectOptionsPosition, 1, "ProjectOptions") diff --git a/PureBasicIDE/ProjectManagement.pb b/PureBasicIDE/ProjectManagement.pb index 5d19124b..e8fc5961 100644 --- a/PureBasicIDE/ProjectManagement.pb +++ b/PureBasicIDE/ProjectManagement.pb @@ -15,6 +15,10 @@ #Project_Open_LoadMain = 3 #Project_Open_LoadNone = 4 +; Filter text for the ProjectFiles() list. +Global ProjectInfoFilterText$ +Global ProjectInfoFilter + ; Some helpers for the XML reading/writing ; Procedure NewSection(*Main, Name$) @@ -145,6 +149,14 @@ Procedure AddProjectBuildMenuEntries() EndIf EndProcedure +Procedure ProjectInfo_InBasePath(Base$, Filename$) + If Len(Base$) < Len(Filename$) And CompareMemoryString(@Base$, @Filename$, #PATH_CaseInsensitive, Len(Base$)) = #PB_String_Equal + ProcedureReturn #True + Else + ProcedureReturn #False + EndIf +EndProcedure + Procedure IsProjectFile(FileName$) Protected Result = #False @@ -433,18 +445,22 @@ Procedure ResizeProjectInfo(Width, Height) CompilerEndIf ; size for other parts - PartHeight = (Height-60-InfoHeight) / 2 + PartHeight = Height-40-InfoHeight - Button1Height + PartFilesHeight = PartHeight * 3 / 5 + PartProjectHeight = PartHeight - PartFilesHeight - ResizeGadget(#GADGET_ProjectInfo_FrameProject, 20-BorderOffset, 20-BorderOffset, Width-40, InfoHeight) - ResizeGadget(#GADGET_ProjectInfo_Info, 30-BorderOffset, 25+ProjectInfoFrameHeight-BorderOffset, Width-65-ButtonWidth, InfoHeight-15-ProjectInfoFrameHeight) + ResizeGadget(#GADGET_ProjectInfo_FrameProject, 20-BorderOffset, 10-BorderOffset, Width-40, InfoHeight) + ResizeGadget(#GADGET_ProjectInfo_Info, 30-BorderOffset, 15+ProjectInfoFrameHeight-BorderOffset, Width-65-ButtonWidth, InfoHeight-15-ProjectInfoFrameHeight) ResizeGadget(#GADGET_ProjectInfo_OpenOptions, Width-30-ButtonWidth-BorderOffset, 25+ProjectInfoFrameHeight-BorderOffset, ButtonWidth, Button1Height) ResizeGadget(#GADGET_ProjectInfo_OpenCompilerOptions, Width-30-ButtonWidth-BorderOffset, 30+ProjectInfoFrameHeight+Button1Height-BorderOffset, ButtonWidth, Button1Height) - ResizeGadget(#GADGET_ProjectInfo_FrameFiles, 20-BorderOffset, InfoHeight+30-BorderOffset, Width-40, PartHeight) - ResizeGadget(#GADGET_ProjectInfo_Files, 30-BorderOffset, InfoHeight+35+ProjectInfoFrameHeight-BorderOffset, Width-60, PartHeight-15-ProjectInfoFrameHeight) + ResizeGadget(#GADGET_ProjectInfo_FrameFiles, 20-BorderOffset, InfoHeight+20-BorderOffset, Width-40, PartFilesHeight) + ResizeGadget(#GADGET_ProjectInfo_FilterInput, 30-BorderOffset, InfoHeight+25+ProjectInfoFrameHeight-BorderOffset, 200, Button1Height) + ResizeGadget(#GADGET_ProjectInfo_SortFiles, 240-BorderOffset, InfoHeight+25+ProjectInfoFrameHeight-BorderOffset, 200, Button1Height) + ResizeGadget(#GADGET_ProjectInfo_Files, 30-BorderOffset, InfoHeight+30+ProjectInfoFrameHeight+Button1Height-BorderOffset, Width-60, PartFilesHeight-15-ProjectInfoFrameHeight) - ResizeGadget(#GADGET_ProjectInfo_FrameTargets, 20-BorderOffset, InfoHeight+PartHeight+40-BorderOffset, Width-40, PartHeight) - ResizeGadget(#GADGET_ProjectInfo_Targets, 30-BorderOffset, InfoHeight+PartHeight+45+ProjectInfoFrameHeight-BorderOffset, Width-60, PartHeight-15-ProjectInfoFrameHeight) + ResizeGadget(#GADGET_ProjectInfo_FrameTargets, 20-BorderOffset, InfoHeight+PartFilesHeight+30+Button1Height-BorderOffset, Width-40, PartProjectHeight) + ResizeGadget(#GADGET_ProjectInfo_Targets, 30-BorderOffset, InfoHeight+PartFilesHeight+35+Button1Height+ProjectInfoFrameHeight-BorderOffset, Width-60, PartProjectHeight-15-ProjectInfoFrameHeight) CompilerIf #CompileWindows ; Will size the middle columns small, and the last as big as possible @@ -459,6 +475,7 @@ Procedure ResizeProjectInfo(Width, Height) SendMessage_(GadgetID(#GADGET_ProjectInfo_Targets), #LVM_SETCOLUMNWIDTH, i, #LVSCW_AUTOSIZE_USEHEADER) EndIf Next i + CompilerEndIf EndProcedure @@ -474,7 +491,7 @@ EndProcedure ; Apply project data changes Procedure UpdateProjectInfo() If *ProjectInfo - + Base$ = GetPathPart(ProjectFile$) ; Project Info ; Text$ = Language("Project","ProjectName")+": " + ProjectName$ + #NewLine @@ -497,22 +514,54 @@ Procedure UpdateProjectInfo() ; File List ; ClearGadgetItems(#GADGET_ProjectInfo_Files) - ForEach ProjectFiles() - Text$ = CreateRelativePath(GetPathPart(ProjectFile$), ProjectFiles()\Filename$) + Chr(10) - Text$ + ProjectInfo_Boolean(ProjectFiles()\AutoLoad) + Chr(10) - Text$ + ProjectInfo_Boolean(ProjectFiles()\ShowWarning) + Chr(10) - Text$ + ProjectInfo_Boolean(ProjectFiles()\AutoScan) + Chr(10) - Text$ + ProjectInfo_Boolean(ProjectFiles()\ShowPanel) + Chr(10) + + ; copied ProjectFiles() to ProjectInfoFiles() and sorted it on PanelState$ (overwritten) to preserve the default sorting of projectfiles() + NewList ProjectInfoFiles.ProjectFile() + CopyList(ProjectFiles(), ProjectInfoFiles()) + + ForEach ProjectInfoFiles() + ProjectInfoFiles()\SortIndex = ListIndex(ProjectInfoFiles()) ; ProjectFile() index + RelativePathFilename$ = CreateRelativePath(GetPathPart(ProjectFile$), ProjectInfoFiles()\Filename$) + If ProjectInfo_InBasePath(Base$, ProjectInfoFiles()\FileName$) = #False + ProjectInfoFiles()\PanelState$ = "2" + RelativePathFilename$ ;ExternalBase + Else + + If Right(GetPathPart(RelativePathFilename$), 1) = #Separator + ProjectInfoFiles()\PanelState$ = "1" + RelativePathFilename$ ;Directory + Else + ProjectInfoFiles()\PanelState$ = "0" + RelativePathFilename$ ;ProjectFile + EndIf + EndIf + Next ProjectInfoFiles() + + If GetGadgetState(#GADGET_ProjectInfo_SortFiles) = #PB_Checkbox_Checked + SortStructuredList(ProjectInfoFiles(), #PB_Sort_Ascending, OffsetOf(ProjectFile\PanelState$), #PB_String) + EndIf + + ForEach ProjectInfoFiles() + ; Filter the project list + RelativePathFilename$ = CreateRelativePath(GetPathPart(ProjectFile$), ProjectInfoFiles()\Filename$) + If ProjectInfoFilter + If Not FindString(RelativePathFilename$, ProjectInfoFilterText$, 1, #PB_String_NoCase) + Continue + EndIf + EndIf + + Text$ = RelativePathFilename$ + Chr(10) + Text$ + ProjectInfo_Boolean(ProjectInfoFiles()\AutoLoad) + Chr(10) + Text$ + ProjectInfo_Boolean(ProjectInfoFiles()\ShowWarning) + Chr(10) + Text$ + ProjectInfo_Boolean(ProjectInfoFiles()\AutoScan) + Chr(10) + Text$ + ProjectInfo_Boolean(ProjectInfoFiles()\ShowPanel) + Chr(10) - Size = FileSize(ProjectFiles()\Filename$) + Size = FileSize(ProjectInfoFiles()\Filename$) If Size < 0 ; file missing Text$ + Chr(10) + Chr(10) Else Text$ + StrByteSize(Size) + Chr(10) - Text$ + FormatDate(Language("Project","FileDateFormat"), GetFileDate(ProjectFiles()\Filename$, #PB_Date_Modified)) + Text$ + FormatDate(Language("Project","FileDateFormat"), GetFileDate(ProjectInfoFiles()\Filename$, #PB_Date_Modified)) EndIf - If ProjectFiles()\AutoScan + If ProjectInfoFiles()\AutoScan ImageID = OptionalImageID(#IMAGE_ProjectPanel_FileScanned) Else ImageID = OptionalImageID(#IMAGE_ProjectPanel_File) @@ -520,8 +569,10 @@ Procedure UpdateProjectInfo() AddGadgetItem(#GADGET_ProjectInfo_Files, -1, Text$, ImageID) ; Associate the ProjectFile structure (for the Popup menu) + SelectElement(ProjectFiles(), ProjectInfoFiles()\SortIndex) SetGadgetItemData(#GADGET_ProjectInfo_Files, CountGadgetItems(#GADGET_ProjectInfo_Files)-1, @ProjectFiles()) - Next ProjectFiles() + Next ProjectInfoFiles() + FreeList(ProjectInfoFiles()) ; Target list ; @@ -576,6 +627,19 @@ Procedure UpdateProjectInfo() EndProcedure +Procedure ProjectInfo_Filter(Text$) + + If Asc(Text$) + ProjectInfoFilter = #True + Else + ProjectInfoFilter = #False + EndIf + + ProjectInfoFilterText$ = Text$ + UpdateProjectInfo() + +EndProcedure + ; Apply preferences changes Procedure UpdateProjectInfoPreferences() If *ProjectInfo @@ -588,6 +652,7 @@ Procedure UpdateProjectInfoPreferences() SetGadgetText(#GADGET_ProjectInfo_FrameProject, Language("Project","ProjectInfo")) SetGadgetText(#GADGET_ProjectInfo_FrameFiles, Language("Project","FileTab")) + SetGadgetText(#GADGET_ProjectInfo_SortFiles, Language("Project","FileListSort")) SetGadgetText(#GADGET_ProjectInfo_FrameTargets, Language("Project","ProjectTargets")) SetGadgetText(#GADGET_ProjectInfo_OpenOptions, Language("Project","ProjectOptions")) @@ -668,6 +733,10 @@ Procedure AddProjectInfo() ButtonGadget(#GADGET_ProjectInfo_OpenCompilerOptions, 0, 0, 0, 0, Language("Project","CompilerOptions")) FrameGadget(#GADGET_ProjectInfo_FrameFiles, 0, 0, 0, 0, Language("Project","FileTab")) + StringGadget(#GADGET_ProjectInfo_FilterInput, 0, 0, 0, 0, "") + + CheckBoxGadget(#GADGET_ProjectInfo_SortFiles, 0, 0, 0, 0, Language("Project","FileListSort")) + SetGadgetState(#GADGET_ProjectInfo_SortFiles, ProjectFilesSort) ListIconGadget(#GADGET_ProjectInfo_Files, 0, 0, 300, 0, Language("Project","Filename"), 300, #PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_MultiSelect) AddGadgetColumn(#GADGET_ProjectInfo_Files, 1, Language("Project","FileLoadShort"), 60) AddGadgetColumn(#GADGET_ProjectInfo_Files, 2, Language("Project","FileWarnShort"), 60) @@ -967,6 +1036,7 @@ Procedure LoadProject(Filename$) ; Project file list ; (load this even in commandline build mode, so the project is correctly saved back!) ; + *Files = GetSection(*Main, "files") If *Files *File = ChildXMLNode(*Files) diff --git a/PureBasicIDE/ProjectPanel.pb b/PureBasicIDE/ProjectPanel.pb index 11103460..28420a61 100644 --- a/PureBasicIDE/ProjectPanel.pb +++ b/PureBasicIDE/ProjectPanel.pb @@ -18,6 +18,9 @@ Global ProjectPanelVisible Global ProjectPanelMenuGadget +; Filter text for the ProjectFiles() list. +Global ProjectPanelFilterText$ +Global ProjectPanelFilter ; Delete a file entry and all its parents if empty (recursive) ; @@ -429,6 +432,19 @@ Procedure UpdateProjectPanel() EndIf Next i + ; Filter the project list. + If ProjectPanelFilter + For i = CountGadgetItems(#GADGET_ProjectPanel)-1 To 0 Step -1 + Select GetGadgetItemData(#GADGET_ProjectPanel, i) + Case #ProjectPanel_Directory, #ProjectPanel_InternalBase, #ProjectPanel_ExternalBase + Default ; its a ProjectFile. Remove the Gadget Item if the input filter was not found in the project file name. + If Not FindString(GetGadgetItemText(#GADGET_ProjectPanel, i), ProjectPanelFilterText$, 1, #PB_String_NoCase) + RemoveGadgetItem(#GADGET_ProjectPanel, i) + EndIf + EndSelect + Next i + EndIf + Else ; project was closed ClearGadgetItems(#GADGET_ProjectPanel) @@ -438,11 +454,27 @@ Procedure UpdateProjectPanel() EndProcedure +Procedure ProjectPanel_Filter(Text$) + + If Asc(Text$) + ProjectPanelFilter = #True + Else + ProjectPanelFilter = #False + EndIf + + ProjectPanelFilterText$ = Text$ + UpdateProjectPanel() + +EndProcedure Procedure ProjectPanel_CreateFunction(*Entry.ToolsPanelEntry) ; Note: The ProjectPanel menu is created in CreateIDEPopupMenu() as the ProjectInfo uses it too ; + ; The Button #GADGET_ProjectPanel_DummyButton is here to obtain its height, which isapplied to the String filter, to have a height similar to the ProcedureBrowser filter one + ButtonGadget(#GADGET_ProjectPanel_DummyButton, -10, -10, 0, 0, "Abc") + HideGadget(#GADGET_ProjectPanel_DummyButton, #True) + StringGadget(#GADGET_ProjectPanel_FilterInput, 0, 0, 0, 0, "") TreeGadget(#GADGET_ProjectPanel, 0, 0, 0, 0) ProjectPanelVisible = #True @@ -457,7 +489,8 @@ EndProcedure Procedure ProjectPanel_DestroyFunction(*Entry.ToolsPanelEntry) StoreProjectPanelStates() ; store expanded states - + FreeGadget(#GADGET_ProjectPanel_DummyButton) + FreeGadget(#GADGET_ProjectPanel_FilterInput) FreeGadget(#GADGET_ProjectPanel) ProjectPanelVisible = #False @@ -465,10 +498,13 @@ EndProcedure Procedure ProjectPanel_ResizeHandler(*Entry.ToolsPanelEntry, PanelWidth, PanelHeight) + GetRequiredSize(#GADGET_ProjectPanel_DummyButton, @Width.l, @Height.l) + + ResizeGadget(#GADGET_ProjectPanel_FilterInput, 5, 5, PanelWidth-10, Height) If *Entry\IsSeparateWindow - ResizeGadget(#GADGET_ProjectPanel, 5, 5, PanelWidth-10, PanelHeight-10) + ResizeGadget(#GADGET_ProjectPanel, 5, 10+Height, PanelWidth-10, PanelHeight-15-Height) Else - ResizeGadget(#GADGET_ProjectPanel, 0, 0, PanelWidth, PanelHeight) + ResizeGadget(#GADGET_ProjectPanel, 0, 10+Height, PanelWidth, PanelHeight-15-Height) EndIf EndProcedure @@ -673,52 +709,58 @@ EndProcedure Procedure ProjectPanel_EventHandler(*Entry.ToolsPanelEntry, EventGadgetID) - If EventGadgetID = #GADGET_ProjectPanel - Index = GetGadgetState(#GADGET_ProjectPanel) - - Select EventType() - - Case #PB_EventType_DragStart - If Index <> -1 - *File.ProjectFile = GetGadgetItemData(#GADGET_ProjectPanel, Index) - If ProjectPanel_IsFile(*File) - ; its a single file - DragFiles(*File\FileName$) - - ElseIf *File = #ProjectPanel_Directory - ; its a directory - Files$ = "" - Sublevel = GetGadgetItemAttribute(#GADGET_ProjectPanel, Index, #PB_Tree_SubLevel) - Count = CountGadgetItems(#GADGET_ProjectPanel) - Index + 1 - While Index < Count And GetGadgetItemAttribute(#GADGET_ProjectPanel, Index, #PB_Tree_SubLevel) > Sublevel - *File = GetGadgetItemData(#GADGET_ProjectPanel, Index) - If ProjectPanel_IsFile(*File) - Files$ + *File\FileName$ + Chr(10) + Select EventGadgetID + Case #GADGET_ProjectPanel_FilterInput + If EventType() = #PB_EventType_Change + ProjectPanel_Filter(GetGadgetText(#GADGET_ProjectPanel_FilterInput)) + EndIf + + Case #GADGET_ProjectPanel + Index = GetGadgetState(#GADGET_ProjectPanel) + + Select EventType() + + Case #PB_EventType_DragStart + If Index <> -1 + *File.ProjectFile = GetGadgetItemData(#GADGET_ProjectPanel, Index) + If ProjectPanel_IsFile(*File) + ; its a single file + DragFiles(*File\FileName$) + + ElseIf *File = #ProjectPanel_Directory + ; its a directory + Files$ = "" + Sublevel = GetGadgetItemAttribute(#GADGET_ProjectPanel, Index, #PB_Tree_SubLevel) + Count = CountGadgetItems(#GADGET_ProjectPanel) + Index + 1 + While Index < Count And GetGadgetItemAttribute(#GADGET_ProjectPanel, Index, #PB_Tree_SubLevel) > Sublevel + *File = GetGadgetItemData(#GADGET_ProjectPanel, Index) + If ProjectPanel_IsFile(*File) + Files$ + *File\FileName$ + Chr(10) + EndIf + Index + 1 + Wend + If Files$ <> "" + DragFiles(Left(Files$, Len(Files$)-1)) ; cut the last Chr(10) EndIf - Index + 1 - Wend - If Files$ <> "" - DragFiles(Left(Files$, Len(Files$)-1)) ; cut the last Chr(10) + EndIf - EndIf - EndIf - - Case #PB_EventType_LeftDoubleClick - If Index <> -1 - *File.ProjectFile = GetGadgetItemData(#GADGET_ProjectPanel, Index) - If ProjectPanel_IsFile(*File) - LoadSourceFile(*File\FileName$, 1, 0) ; will just switch if open + + Case #PB_EventType_LeftDoubleClick + If Index <> -1 + *File.ProjectFile = GetGadgetItemData(#GADGET_ProjectPanel, Index) + If ProjectPanel_IsFile(*File) + LoadSourceFile(*File\FileName$, 1, 0) ; will just switch if open + EndIf EndIf - EndIf - - Case #PB_EventType_RightClick - DisplayProjectPanelMenu(*Entry, #GADGET_ProjectPanel) - - EndSelect - - EndIf + + Case #PB_EventType_RightClick + DisplayProjectPanelMenu(*Entry, #GADGET_ProjectPanel) + + EndSelect + + EndSelect EndProcedure @@ -748,4 +790,3 @@ AvailablePanelTools()\PanelTitle$ = "ProjectPanelShort" AvailablePanelTools()\ToolName$ = "ProjectPanelLong" AvailablePanelTools()\PanelTabOrder = 2 - diff --git a/PureBasicIDE/UserInterface.pb b/PureBasicIDE/UserInterface.pb index 828a7016..13207bdf 100644 --- a/PureBasicIDE/UserInterface.pb +++ b/PureBasicIDE/UserInterface.pb @@ -2224,19 +2224,30 @@ Procedure MainWindowEvents(EventID) DisplayPopupMenu(#POPUPMENU_ErrorLog, WindowID(#WINDOW_Main)) EndIf + + Case #GADGET_ProjectInfo_FilterInput + If EventType() = #PB_EventType_Change + ProjectInfo_Filter(GetGadgetText(#GADGET_ProjectInfo_FilterInput)) + EndIf + + Case #GADGET_ProjectInfo_SortFiles + ProjectFilesSort = GetGadgetState(#GADGET_ProjectInfo_SortFiles) + UpdateProjectInfo() Case #GADGET_ProjectInfo_Files index = GetGadgetState(#GADGET_ProjectInfo_Files) Select EventType() Case #PB_EventType_DragStart - If index <> -1 And SelectElement(ProjectFiles(), index) - DragFiles(ProjectFiles()\Filename$) + If index <> -1 + *ProjectFiles.ProjectFile = GetGadgetItemData(#GADGET_ProjectInfo_Files, index) + DragFiles(*ProjectFiles\Filename$) EndIf Case #PB_EventType_LeftDoubleClick - If index <> -1 And SelectElement(ProjectFiles(), index) - LoadSourceFile(ProjectFiles()\Filename$) ; will just switch if open + If index <> -1 + *ProjectFiles.ProjectFile = GetGadgetItemData(#GADGET_ProjectInfo_Files, index) + LoadSourceFile(*ProjectFiles\Filename$) ; will just switch if open EndIf Case #PB_EventType_RightClick diff --git a/PureBasicIDE/dialogs/Projects.xml b/PureBasicIDE/dialogs/Projects.xml index 8c63f696..87f0af1b 100644 --- a/PureBasicIDE/dialogs/Projects.xml +++ b/PureBasicIDE/dialogs/Projects.xml @@ -74,7 +74,7 @@ - +