Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Feelzor on November 03, 2017, 12:55:25 pm

Title: Change default class creation header extension from .h to .hpp
Post by: Feelzor on November 03, 2017, 12:55:25 pm
Hello!

I must be extremely dumb, but even though I searched a lot, I found many useful things in the settings, I could not find a way to change this settings.

You know, when you create new file > class, it automatically sets the header extension to .h for C++ projects. I must admit I do not really like that, as I always have to manually change the .h to .hpp before creating the file, and I often forget to do so.
So I was wondering, is there a way to set in the settings the default extension for header files? If not, I'll keep doing it manually, and if there is a plugin available for that, do not hesitate to give me its name, I do not care whether it's a plugin or a setting :D

Thanks a bunch for your answers, and I hope this question has not been answered yet / I'm not too dumb ^^
Title: Re: Change default class creation header extension from .h to .hpp
Post by: BlueHazzard on November 03, 2017, 08:17:52 pm
currently there is no setting for this.
This are hard coded extensions in the source.
If the devs are ok with it i could make a patch for this.

The question is where to put this setting. One solution would be to provide it only in the config file...
Title: Re: Change default class creation header extension from .h to .hpp
Post by: oBFusCATed on November 03, 2017, 08:41:35 pm
Put it in the class creation dialog. And make it possible to change the source extension, too.
Title: Re: Change default class creation header extension from .h to .hpp
Post by: Feelzor on November 04, 2017, 11:35:05 am
Ah okay, so it's not me just being dumb :')
For the settings, maybe in the class creation dialog, putting a ticking box "remember class extension" and if it's ticked, it remembers the setting ^^
Title: Re: Change default class creation header extension from .h to .hpp
Post by: BlueHazzard on November 06, 2017, 10:35:39 am
does it even need a control? How about saving the currently extension by default?
Title: Re: Change default class creation header extension from .h to .hpp
Post by: BlueHazzard on November 07, 2017, 08:24:27 pm
Here is a patch that stores the extension of the header and the implementation file by default. I don't think that a setting is needed.

If this should be a setting i think we should it make global for all new file dialog. This would be a lot more work...

greetings
Title: Re: Change default class creation header extension from .h to .hpp
Post by: oBFusCATed on January 29, 2018, 02:17:44 am
In svn thanks for the contribution.