Code editor skins? - c++

This is a kind of unorthodox question. Frankly, I won't lie to you. I am new to programming and am planning to improve myself. I enjoy coding but I need something to keep me going during the down times, so my question is:
Is there such a thing as a code editor skin? A compiler skin?
For example, you have the Command Prompt, it has a black background with white writing, it seems geeky, exactly what I want.
I want a compiler that looks like command prompt...black with white writing (or green) or still has color coding (some compilers change color of text based on command). Yes, this is mainly for boasting, but I don't want to show someone something that basically looks like a text editor, I just want something that looks a little cooler.
P.S (This question may seem a little unnecessary, it is because it is my first question, I'd like to warm up to this community before I start asking some real questions about code.)

Visual Studio is an editor/compiler etc that you can use to do C++ development, and it is highly themeable. You might be interested in http://www.phpvs.net/vs-themes/ and http://techietweaks.blogspot.com/2008/11/visual-studio-themes-gallery.html .

A text editor with a black background still looks like a text editor.
If you want a console-esque editor, look into vim and emacs - though they take some getting used to, once you're proficient with either they are pretty damn awesome.

I think you're confusing Compiler with IDE, the compiler is the program that converts your code into machine code/byte-code/etc.
The IDE is the editor itself, which usually works alongside the compiler.
For just text-editing you can use Notepad++. Then you can use the Style Configurator to change to default skins or make your own.
For a complete IDE, I recommend Code::Blocks especially if you're just starting out. You can change themes on Preferences.

Related

Drawing in the "margin" as an IDE/editor feature

I have a modest codebase (C++) that is well-documented but nonetheless very complex. I am involved in its maintenance and debugging, and I find myself drawing the same pictures over and over again, to check for wayward pointers and to look for optimizations. The pictures help a lot, as inconsistencies have crept into the code from time to time on seemingly logical optimizations.
It may be too much to ask, but is there an editor that would let me draw in the margins, a la MS Paint, as auxiliary comments, and maybe even to tack the picture to a particular line? Just in case such a thing exists, I would ideally like to use it alongside Vim.
Such an editor would have suffered the kind of feature creep that is against the philosophy of vim (or at least vi). You're more likely to be happy with adding your own layer of indirection between vim and an external doodling app. As #Mats Petersson suggests, a URL is one way. Or a filename relative to some directory, or an XML tag.
A plugin for vim that recognizes your layer might automatically display your doodles. If Clippy can be implemented as a vim plugin, surely so can this.
If ascii-art suffices, try the plugin DrawIt, http://www.vim.org/scripts/script.php?script_id=40 ; or use that webpage's search box.

Text layout engine API for C++

I have a project where I need to take input text and render it to an image. The text needs to be wrapped, have margins, kerning, letter spacing, specific fonts, and so on. It seems like I could write most of this by hand, but it also seems like something that there should be pre-existing libraries for.
I've looked at web rendering engines like WebKit and Gecko that seem too complex, LaTeX doesn't seem to have a C++ API, GhostScript looks the most promising so far.
I'm writing the app in C++, and I don't want to have to shell-out to a system call--it seems like that will be inflexible and non-performant. It needs to run on Linux, and preferably Mac OSX too.
Thanks for any advice you can offer.
Subprocesses can be pretty awesome, but I guess you are looking for something like pango or the font rendering engine in Qt. It looks like you can achieve everything you need with QPainter::drawText(...). See also QFont.
It is worth noting that I have dragged in Qt specifically for font rendering before, without using it for anything else. It needs you to create a QCoreApplication-object, but that's it. Works like a charm :)
If you want something lower level (and with fewer dependencies than Qt or Pango) you can use FreeType directly. It will take more lines of code to draw the same text (here's their first example1.c) but it might be less than the lines of Makefile required to bring in Qt!

Text Editor API. Scintilla for experimental IDE. Do you use something else?

I have discovered Scintilla/Notepad++ API this week end.
As there is a nice Template vcproj for Notepad++ Plugins available on line then I could start to play with some pseudo code-source really really fastly.
I have just looked briefly at the Scintilla documentation which expose the API which looks promising. Sometimes it is still hazy for me, sometimes not as feature-full as I expect/dream, but that's really meaningless details for now.
So now it is time I experiment with a language of my fancy, for the moment I nickname it "Entity". And what best to do than design a light IDE for it.
So I am going to invest much time in Notepad++/Scintilla environement.
I have have not thought about using Emacs because I never got accustomed to it.
But if you use another type of Text Editor API than Scintilla, preferably in C++ since it is my language experience... what other Text Editor API would you use/have you used ?
Just want to be sure of my choice before diving deeper.
I found Scintilla to be very feature-packed, and covered everything I needed. You have to do a bit of work to get all the functionality out of it (ensuring that keyboard short-cuts perform the desired effect, etceteras), but it was incredibly easy to compile, include and get working, though as I said you have to do a bit of legwork to get everything out of it, but this is better than having to tear your hair out getting an "all-purpose" control to stop doing something you don't want to. It is as if the authors have given you a toolbox to work with.

I want to make my own source code editor, what are the good choices to make? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've had it of those dozens of editors which never provides simple things like:
distinguish type keywords and instruction keywords so I can put different colors on them.
being cross platform using a standard GUI lib like qt gtk etc (notepad++, yes, I almost hate you).
enough keyboard shortcut like duplicate line, comment selection, and a decent find-replace.
Decent task-easing features like single-click-on-the-number-line-margin to select the entire line.
Scintilla or another good-enough lexer that highlights enough different things, because brain-compiling code is one thing, quickly identify with the eyes what is what is something I find important.
I just want to support very basic languages like C, C++, maybe Python, not HTML or CSS.
Is Scintilla a good choice to just highlight those languages, and is a lexer really necessary ?
Isn't QT enough to program a text editor such as the one I want to do ? I know there is QScintilla, but is there a reason I shouldn't use a lib that integrates a lexer ? Why is Scintilla such a good lib ?
Is QT a good choice for such an editor ? (I also want to hard embed ProFont in the editor to kill any reluctant font problem between OSes).
EDIT:
In short, I want to make an editor, only with the same syntax highlight features of notepad++. That's my main goal, and the use of QScintilla might be a little harder than I thought...
EDIT2:
Well I found textadept, it's not so known but is quite awesome. I didn't manage to make my lexer, since I have other to do which I do under windows, unfortunately it's slow on the mac. Apparently there isn't any Scite official build for the mac.
C++ is not a "very basic language" by any stretch of the imagination.
Why do you really want to do this? There are SOOO many open source code editors out there.
If you must write your own editor, I suggest looking at the other open source editors and examine which pieces you port to your editor.
Porting pieces of existing working and tested code is usually much better than writing your own code and debugging it.
After perusing a couple serious open source editors: Emacs, Eclips, CodeBlocks, CodeLight, etc., I believe you will start changing your mind about writing an editor from scratch.
-- Thomas Matthews
My Info
If you really want to do this (and it sounds like a lot of work) I would look at ANTLR for parsing the code. You may get some ideas from their ANTLRWorks display.
To link the parse tree to a display could be a fair amount of work so I'd see what an IDE platform such as Eclipse has to offer
Are you OK with Java?
If so, go for Eclipse technologies: SWT and JFace. The latter provides you with org.eclipse.jface.text package with a lot of features. Then you can roll own editor easily basing on that. (I prefer Eclipse-based editors to Scintilla-based, I believe they tend to be more advanced and feature-rich, but that's my personal opinion.)
But then, you might want to go a step further and use the Eclipse RCP framework for you application... But then why not use the Eclipse IDE itself and just add whatever you want as plug-ins.
The Eclipse codebase is huge and it's up to you how much you want to reuse.
I would expend some effort experimenting with the emacs colour theme package and the various langauge modes; see if you can bend the lisp to do what you want. You almost certainly can. to my mind emacs and a bit of effort on your part will get you your ultimate editor (remember emacs is really just a DIY editor toolkit). If you cant bend emacs into the shape you want you will be well placed to expend the effort in writing your own.
I have tried to do something similar myself for a project I'm working on at the moment, I looked into the QScintilla and had to remove it from my project because when you embedded inside a QGraphicsView I can't control the resolution of the widgets image, it seems to paint the text as an image and that's what we see, I played with increasing the smoothness of the QFont and that improved it but still a no-go.
So I found a simple code editor inside QT's code base it comes with every installation of QT if you look
into:
C:\Qt\4.7.3\src\scripttools\debugging\qscriptedit.h
C:\Qt\4.7.3\src\scripttools\debugging\qscriptedit.cpp
If you go to the source code of OpenShapeFactory where I'm trying to embed a Code Editor: check how I got the syntax Highlighter and the autocomplete :
this widget uses the qscriptedit widget that ships with qt, you can add your own keywords to the syntax hightlighter from a file as well as for the auto-complete dropdownlist.
this is the header, scriptwidget.h and the implementation scriptwidget.cpp are available as part of the whole project code.
the next stage is to look into the QTCreator and see the code they already have all if not most of these features after you get to compile their version, just find where to add your little mods and you might be getting closer to the simple code editor.
I wish you the best of luck on this direction and if you find a solution please send it over, :)
heads-up keep a lookout for the repository link above, if I find a way of making it first, I might chase you to the answer.
Like everyone else is saying, it's probably more trouble than it's worth, but if you really want to do it, Qt's a good choice since it's cross platform. Use QSyntaxHighlighter to do your keyword/type highlighting, and take full advantage Qt's support for keyboard shortcuts.
use something like C, QT and Lua for the scripting engine.

Spell checker for comments, strings, maybe more

I am looking for a spell checker for c++ source code. Unfortunately all I can find is Visual Studio specific. I would like something which works on Linux.
Edit:
Ultimately I want to automate it in some way. I am not very proficient in spell checking, but what I am thinking of is a not-interactive console tool which prints error messages, or something like that.
Personally I use vim, but not everyone on the project does of course.
Currently we are using svn so it is possible to integrate it into the pre-commit-hook maybe?
Don't you guys do something similar?
Eclipse (Java based so will do mac, linux etc.) has spellcheckers built in. With the CDT plugin you can edit and build C++ code.
Vim also supports spell checking.
See the other question for more.
Emacs too has spell checking, flyspell-prog-mode, is the one I use, it is a (very!) personal preference which one works best for you.
The automating the spell check idea is a much trickier one. The best you can hope for is one that will tell you if there are spelling errors. That's trickier than it sounds, especially with code comments which may have all sorts of valid abbreviations which are not real words.
Having a company policy that whatever people have their EDITOR environment variable set to has a spell check enabled, should cut down on the spelling errors in commit messages, for example.
I found something!
svn co svn://anonsvn.kde.org/home/kde/trunk/quality/krazy2 krazy2
this is part of the quality management of KDE.
Besides a multitude of checks (KDE-specific, qt-specific, cpp-specific, ...) there is automated spell checking.
hope this helps
Which editors do you use? Many of them have spell checking abilities. E.g., gedit just needs to have the spellcheck plugin enabled.
You can check out some alpha code I just whipped up for a similar purpose: pyspellcode. It's Zlib licensed and uses clang and hunspell.
No idea how pyspellcode compares to what KDE does/provides but am happy to receive comparisons and will prioritize its development more if there's interest it.
At just over 200 lines, I'm guessing pyspellcode is at least lighter weight than KDE's solution though KDE's solution I imagine is way more tested.