Author Topic: Quick new C++ file (small question)  (Read 5503 times)

cyanide911

  • Guest
Quick new C++ file (small question)
« on: November 16, 2009, 06:45:19 pm »
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

  • Guest
Re: Quick new C++ file (small question)
« Reply #1 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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Quick new C++ file (small question)
« Reply #2 on: November 16, 2009, 09:28:53 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.

Offline Radek

  • Multiple posting newcomer
  • *
  • Posts: 104
Re: Quick new C++ file (small question)
« Reply #3 on: November 16, 2009, 10:06:46 pm »
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

  • Guest
Re: Quick new C++ file (small question)
« Reply #4 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.
« Last Edit: November 17, 2009, 10:22:27 am by cyanide911 »

Offline Zini

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: Quick new C++ file (small question)
« Reply #5 on: November 17, 2009, 10:29:12 am »
I think this sequence

Quote
File->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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Quick new C++ file (small question)
« Reply #6 on: November 17, 2009, 11:05:54 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.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Quick new C++ file (small question)
« Reply #7 on: November 18, 2009, 04:20:34 pm »
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]