Gtkedit - A notepad clone based on GTK+ |
Well, yes indeed. There are quite a lot of different - and not so different - editors one can download from the Internet. Anyway...
OK, In fact I did found an editor that works fine. It's called gnotepad+, but it too takes too long to load (about 2 seconds) in this old machine. There's plenty of room for improvements here, I thought.
And so gtkedit begun. I only wanted the most basic editing features: cut, copy, paste, basic undo/redo... nothing fancy. The obvious model to copy was, of course, Notepad.
Gtkedit is a simple editor, written using the GTK+ 1.2 toolkit. It aims to be (in that order) light, useful and simple (source code-wise).
Being a simple project, it also can serve as a real world GTK+ tutorial.
To sum it up all: gtkedit is the little unsexy app everybody needs to have ;-).
gtkedit is very simple to use. It understands the basic common shortcut keys, like <Ctrl>C for copy. You will find them listed next to each menu item.
Very basic undo/redo capabilities are provided, because the editor can only undo the very last text insertion or removal.
You can find and replace text, and there is a menu option that will allow you to quickly go to any particular line, which is handy if one is writting a program and wants locate an error line.
One useful feature is the ability to open files by dragging them from your file manager into the editor window, replacing the current open one.
Finally, you can change the font used for text display, or toggle the wrapping of long lines by means of the "Format" menu. Gtkedit will remember those settings, along with the window size (they are saved to a file named ./gtkeditrc in you home directory.)
Gtkedit uses the GNU gettext library for translation. All major Linux distributions are based on the GNU C library, that includes gettext. Other systems may not compile if the gettext library is not installed.
To compile the source, issue the following command from a terminal window:
makeAlternatively you can compile the program with the following command:
gcc $(gtk-config --cflags --libs) -O -o gtkedit gtkedit.c
I assumed you use GNU bash. If you use any other shell, use this instead:
gcc `gtk-config --cflags --libs` -O -o gtkedit gtkedit.c
Beware of the back-quotes (`), as they are not the same as single quotes (') if you happen to be a Unix shell.
Once the compilation finishes you can start the program with the command:
./gtkedit
This opens the editor with a blank unnamed file. You can add the name of a file to have it loaded, if you wish. Alternatively you can use the file manager to drag file over the editor window.
If you like the editor and plan to use it frequently, it would be wise to put it somewhere in your path, for example in /usr/bin or /usr/local/bin, and create a shortcut in your desktop.
If your primary language is not English you may want to install one or more of the translations modules, found in the po subdirectory. Each module name is the ISO code of the language it adds. For instance, ca.mo is the Catalan language module.
For example, to install the Catalan language translation you should issue the following commands:
su password: ***** cp po/ca.mo /usr/share/locale/ca/LC_MESSAGES/gtkedit.mo exit
There are a couple of important things to note:
If you want to collaborate (that's the best part of this thing called Open Source) you can by translating gtkedit to your native language. To do this you should do the following:
Of course, other contributions will be welcomed too.