I have submitted a patch to BerliOS for your consideration.
http://developer.berlios.de/patch/?func=detailpatch&patch_id=2425&group_id=5358Currently, Code::Blocks has inconsistent concepts of what a "source file" and "header file" are, which prevents some functionality from working. See discussion here:
http://forums.codeblocks.org/index.php/topic,8098.msg60489.html and here:
http://forums.codeblocks.org/index.php/topic,7905.0.html The Project Manager has predefined file masks to define "Source Files" and "Header Files". ".C" (capital letter) is a valid extension, for example. You can also add you own extensions, such as ".inl" for inline code.
Elsewhere in Code::Blocks, functionality that requires knowing header and source files ignore extensions defined in the Project Manager - even many of the default ones - and use a hard coded list.
This patch will retain the existing hard-coded extensions, but before returning failure also check whatever extensions are known by the Project Manager.
If you use non-standard file extensions such as .C or .H or .inl or any other extensions you teach the Project Manager, the following functionality will now work with those files:
- Source Code Formatter (AStyle) will format these files
- Code completion will always consider these files
- GCC compiler will support "Build file" on right-click
- GCC compiler will support building a single file outside of a project
- GDB Debugger will always show the file in the editor when appropriate
- Swap header/source (F11) works
- Code::Blocks will always assume that the file should be viewed in the editor
- File name can be used as command-line parameter to Code::Blocks to open it immediately.
Files affected:src/sdk/globals.cpp
Modified FileTypeOf() so that, before giving up and returning ftOther, check the Project Manager to see if it would consider the file a source or header
src/sdk/filegroupsandmasks.cpp
Improved const-correctness
src/sdk/editormanager.cpp
Changed swap header/source code to consider file extensions known by the project manager
src/include/projectmanager.h
Provided an accessor to a const FileGroupsAndMasks object
src/include/filegroupsandmasks.h
Improved const-correctness