I have submitted a patch to BerliOS for your consideration.
http://developer.berlios.de/patch/?func=detailpatch&patch_id=2425&group_id=5358
Currently, 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.next.codeblocks.org/index.php/topic,8098.msg60489.html and here: http://forums.next.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
:) Nice ... I hope all the tests succeed for your sake, so that it can be included in SVN!
Quote
src/include/projectmanager.h
Provided an accessor to a const FileGroupsAndMasks object
src/include/filegroupsandmasks.h
Improved const-correctness
Without having looked at the patch yet, I can safely say it's probably not going to be accepted for the time being. That is because touching those files I quoted is going to break binary compatibility with the 8.02 release. And that is something that hasn't been yet decided by the devs how to handle.
Still, thanks for providing patches to improve C::B :).
Quote from: mandrav on April 01, 2008, 08:30:34 AM
Without having looked at the patch yet, I can safely say it's probably not going to be accepted for the time being. That is because touching those files I quoted is going to break binary compatibility with the 8.02 release. And that is something that hasn't been yet decided by the devs how to handle.
Hmm...I don't
have to change filegroupsandmasks.h...I made it more const correct because it seemed like the right thing to do.
As for projectmanager.h...it's holding on to that FileGroupsAndMasks object really tight. I could get my hands on it by doing some OFFSETOF voodoo instead of changing the interface in the header. You know, just while the devs are deciding how this should usually be handled.
What do you think?
Quote from: mandrav on April 01, 2008, 08:30:34 AM
Still, thanks for providing patches to improve C::B :).
Bah...it's fun. :lol:
Quote from: mandrav on April 01, 2008, 08:30:34 AM
Still, thanks for providing patches to improve C::B :).
Oh, and congratulations on your 2
12th post.
Doesn't look so bad all in all, except my TortoiseDiff doesn't seem to like the patch (some error about line 12... I'm too lazy to figure it out 8)), so only been reading out of context.
Quote from: thomas on April 01, 2008, 10:00:03 AM
Doesn't look so bad all in all, except my TortoiseDiff doesn't seem to like the patch (some error about line 12... I'm too lazy to figure it out 8)), so only been reading out of context.
If you think it could get in, I'll go see what Tortoise doesn't like about the patch.
[Edit]...Ah, Tortoise is Windows-only. I won't be able to check that right away. For what it's worth, I tested that patch in my Ubuntu environment against a clean svn checkout using
patch -p0 < filetypes.patch
And it worked. Perhaps it's just not happy about line endings?