Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/Catalogs/Deutsch/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/Catalogs/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/Catalogs/Francais/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/Catalogs/Italian/Editor.Catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/Catalogs/Russian/editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ FileLoad = Загрузить файл при открытии проекта
FilePanel = Показать файл в панели проекта
FileWarn = Предупреждать, если файл изменился
Filename = Имя файла
FileListSort = Сортировать по Имя файла
FileScanShort = Сканирование
FileLoadShort = Загрузка
FilePanelShort = Панель
Expand Down
1 change: 1 addition & 0 deletions Documentation/Catalogs/Spanish/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/SpiderBasic/Catalogs/Deutsch/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ FileLoad = Datei laden, wenn das Projekt ge
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
Expand Down
1 change: 1 addition & 0 deletions Documentation/SpiderBasic/Catalogs/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/SpiderBasic/Catalogs/Francais/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/SpiderBasic/Catalogs/Italian/Editor.Catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Documentation/SpiderBasic/Catalogs/Spanish/Editor.catalog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion PureBasicIDE/Common.pb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions PureBasicIDE/Language.pb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions PureBasicIDE/Preferences.pb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -1193,6 +1194,7 @@ Procedure SavePreferences()
PreferenceGroup("Projects")
PreferenceComment("")
WritePreferenceString("DefaultProject", DefaultProjectFile$)
WritePreferenceLong("ProjectFilesSort",ProjectFilesSort)

SaveDialogPosition(@ProjectOptionsPosition, 1, "ProjectOptions")

Expand Down
106 changes: 88 additions & 18 deletions PureBasicIDE/ProjectManagement.pb
Original file line number Diff line number Diff line change
Expand Up @@ -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$)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -459,6 +475,7 @@ Procedure ResizeProjectInfo(Width, Height)
SendMessage_(GadgetID(#GADGET_ProjectInfo_Targets), #LVM_SETCOLUMNWIDTH, i, #LVSCW_AUTOSIZE_USEHEADER)
EndIf
Next i

CompilerEndIf

EndProcedure
Expand All @@ -474,7 +491,7 @@ EndProcedure
; Apply project data changes
Procedure UpdateProjectInfo()
If *ProjectInfo

Base$ = GetPathPart(ProjectFile$)
; Project Info
;
Text$ = Language("Project","ProjectName")+": " + ProjectName$ + #NewLine
Expand All @@ -497,31 +514,65 @@ 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)
EndIf
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
;
Expand Down Expand Up @@ -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
Expand All @@ -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"))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading