News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Quick new C++ file (small question)

Started by cyanide911, November 16, 2009, 06:45:19 PM

Previous topic - Next topic

cyanide911

Currently it's a long process - File->New->File->C/C++ source->C++->Filename.
Is there way to simply open an Untitledx.cpp file with a single/fewer clicks, and then specify the filename while saving it? (or a similar shorter method)

zabzonk

I just right-click on the relevant directory in the Workspace tree and select Add Files... This pops up the standard Windows file open dialog, which allows you to create new files from its context menu. Of course, this doesn't allow you to use CB templates, but I've never liked that feature in any IDE I've used.

Jenna

Quote from: zabzonk on November 16, 2009, 08:41:16 PM
I just right-click on the relevant directory in the Workspace tree and select Add Files... This pops up the standard Windows file open dialog, which allows you to create new files from its context menu. Of course, this doesn't allow you to use CB templates, but I've never liked that feature in any IDE I've used.

Does not work on linux (at least not in xfce).

What about using ctrl+shift+n, answering the popup-dialog with yes and type a name, or if it should not be added to a project, click no and save with ctrl+s, type a name and that's it.

Radek

I add an empty file and then I write my code. Then I save the file with the .cpp extension. This seems to work, at least I haven't seen any misunderstandings. Perhaps, the online parser guess the file contents form "signals", like #include, #ifdef, typical syntax constructs and so on.

cyanide911

#4
Yeah, but the problem with writing the code in an empty file (without .cpp extension) is syntax highlighting. CodeBlocks will hilight the syntax only if it know that I'm making a C++ file.
@Jens: CtrlShiftN opens an empty file without any popup for the file name.

Zini

I think this sequence

QuoteFile->New->File->C/C++ source->C++->Filename

could easily be reduced by one step by integrating the C++ part into the C/C++ source part.

We are already choosing what type of file we want at that stage. Why have another stage to choose the language?

The file type list would then look like this:
C header, C++ header, C source, C++ source, Empty file

Jenna

Quote from: cyanide911 on November 17, 2009, 10:14:12 AM
Yeah, but the problem with writing the code in an empty file (without .cpp extension) is syntax highlighting. CodeBlocks will hilight the syntax only if it know that I'm making a C++ file.
@Jens: CtrlShiftN opens an empty file without any popup for the file name.
The popup only occurs, if a project is open, if not, ctrl+s tries to save the file and asks for a name, if you now save with cpp-ending, you have c++ syntax-highlighting.

dmoore

Quote from: jens on November 17, 2009, 11:05:54 AM
Quote from: cyanide911 on November 17, 2009, 10:14:12 AM
Yeah, but the problem with writing the code in an empty file (without .cpp extension) is syntax highlighting. CodeBlocks will hilight the syntax only if it know that I'm making a C++ file.
@Jens: CtrlShiftN opens an empty file without any popup for the file name.
The popup only occurs, if a project is open, if not, ctrl+s tries to save the file and asks for a name, if you now save with cpp-ending, you have c++ syntax-highlighting.

also don't forget edit->highlight mode->[your language]
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]