Hi Jerry, RadioT,
sorry that you have some troubles with MPLabX IDE file management.
Well, I'll try to explain some of the problems I faced with Microchip file management in the project.
Actually, you must understand that in the "Project" view of the IDE, the tree structure you are seing is a pure "virtual" structure. It means, on disk, your files can be anywhere. The Project view give you the possibility to organise your files in virtual folders. Those virtual folders do **not** necessarily map to physical folders on disk.
So, you can right click the "Source Files" virtual folder, create your virtual tree view and structure, and then right click each virtual subfolder you created and select the option "Add exsiting items..." from the menu in order to add your *.bas files.
Since Swordfish basic can access files in the folder and subfolders contained in the project folder (in fact in the folder containing your SF PROGRAM file), and it can also access files in the SF "UserLibrary" subfolder, you can simply add those files to your virtual directory structure and then have them accessible from the project view.
If you don't add those files, they'll be compiled anyway as SF compiler will look for them when they are included in the usual SF way (current prog folder, UserLibfolder, Lib folder, ...).
Actually, there is an option in the context menu when you right click the "Source Files" virtual folder (blue folder) in the "Projects" view of the IDE. This option is named "Add existing items from Folders". This feature is intended to add the selected folder(s) and its files to your project, and create associated virtual directory structure automatically (all above described work automatically).
UNFORTUNATELY Microchip made this option specific to the "C" language soure files, and then, it does accept (automatically) only *.c, *.h, *.asm files. If you select any folder with it and ask the directory selection window to use ALL FILES, it'll create the virtual directory structure for you, but it won't add any *.bas file. You'll have to add *.bas files by hand as explained above (using "add existing items..." option).
I need to implement the same functionnality (and hide Microchip one related to C files) by hand in the futur.
As for the MAIN file that need to have the Project name, this is a choice I have been forced to do.
In fact, the make file builder called automatically when you click build (for release or debug) need to pass the Swordfish PROGRAM file as a parameter to SF command line compiler.
The PROBLEM is that when you create a new project, I need to know which file in the project directory IS THE MAIN Swordfish PROGRAM file.
I had 4 alternatives:
1- Force the user to name his main file "main.bas" or "program.bas". I don't like this option because SF will give this name to final *.hex file, and thus, all your projects will have the same output hex name
2- Give the user the possibility to select the main program file, and use the menu to tag it as MAIN program file. (Turbo Pascal 5 and 6 users remember that in the IDE they had this option in order to be able to compile the project without having to have the "Program" file opened or selected in the IDE) . This means I had first to add this option, store this information somewhere in the project file, and update this information each time user change or rename his program file. This is too much work. It also need to be documented.
3- Force user to name the PROGRAM file the same as the Project. This is what I prefered as it's very easy to deduce the name of the file to pass as a parameter to the SF command line compiler.
4- Create a full SF code parser that parses all the project files and then guess the main program file directly (as it's done actually by the SF IDE). I have an almost working parser, but I need to finish the Preprocessor Options handling to have it fully working. THIS IS THE WAY TO DO things correctly. Unfortunately, due to some (personal life) events this year, I didn't finished this part of the work
I'll manage to work on it in few days, and if I got it working completely, I'll remove the constraint on the program file name completely. This full parser will also let me implement code folding (and eventually syntax completion).