cke: A text editor for PocketPC
version 0.21 alpha
  1. Program features
  2. Editing
  3. General Settings
  4. Document Classes
  5. File Open Dialog
  6. Configurable Commands
  7. Associations


Introduction to cke

cke is a text editor for the PPC, which allows you to create and edit plain text files, encoded in the default ANSI code page. See however the future improvements section later.

The main features of cke are the following:

  1. font customizaton.
  2. wordwrap and normal modes.
  3. bookmarks.
  4. You can edit multiple files at the same time.
  5. Document classes, based on generic filters (such as *.c;*.h) with configurable formatting.
  6. Syntax highlighting based in a modifiable plain text file.
  7. Improved file open / file save dialog
  8. Search and replace.
  9. Configurable commands.


Editing

Inside a document, the behaviour is fairly standard, for a windows editor.



General editing

You can move trhough a document using the usual displacement keys, in adition there are several keyboard shortcuts to help you move faster.

You can select text in several ways: (1) tapping and holding while you move the stylus through the desired text (2) Presing the shift key and tapping in the final part of the selection (3) using the keyboard shortcuts (4) Double-clicking a word will select it (5) double clicking in the left-most part of the screen will select the whole line.

The program keeps a history of the modification made in a document fashion, you can do unlimited undo and redo, even before a saved version, and you can redo up to the first modification after the undos. You can access the undo/redo via the Tools->edit menu , the edit mini-menu in the command bar, or through the shortcuts ctrl-z (redo) and ctrl-y (undo).

Find and Replace

You can go to a specific line using the Tools->find->Goto menu, this will show the find toolbar, and let you edit the line number edit box. This box keeps the actual line number when you browse through the document.

As expected you can copy, cut and paste text in any place, using the corresponding menu items in the Tools->Edit menu, in the edit mini menu or using the keyboard shortcuts. In adition you can also Add to the clipboard with the items "Copy Append" and "Cut Append".

The Wordwrap mode is also controled with the Tools->Edit menu. You can also modify it in the settings (Edit->Settings, and you can fix a default behaviour modifying the "default" class in the classes tab in settings. In the Wordwrap mode, the "relative indent" setting controls the appearance of the second and succesive lines of a wordwrapped paragraph.

by default the tab size is 2, but a larger tab size can be defined in the settings for the actual document, or in the classes settings for document classes. When you press a tab characters it is kept as a single character in the document, but it's effect is to leave whitespace until the first column-multiple of the tabsize, ie a tab character has a variable visual-length. If you press the tab key while a multiple-line selection is active, then the whole selection is indented to the right to the next multiple of the tab length. To unindent press Shift-Tab (note unindenting does not work in certain keyboards, you can also use ctrl-i / ctrl-shift-i to obtain the same effect). There is not a menu item for this functionality.



Find and replace

In the Find menu you can find the different find and replace commands. In order to enter the find text, show the find bar (using the corresponding icon), and enter the text in the middle text box. Presently only single-line search strings are allowed. To find the text, push the corresponding icon or choose the Tools-Find->Search Forward menu item or even the Find->Find->Next item in the Find mini-menu (in the find bar). You can search backwards using the Tools-Find->Search Backwards or the Find->Find->Prev menu items.

You can control the search characteristics through the Tools->Find->Options item. Presently only the Ignore Case and Whole words modalities are implemented.

Enter the replacement text in the rightmost edit box in the find bar, then you can replace using the rightmost button in the find bar. This button has the same effect that the Tools->Find->Replace Next: if the searched text is selected (as the result of a previous find or replace next), then it replaces it. Then it looks for the next apperance of the searched text in the document. You have also the Tools->Find->Replace item to replace the selected text, and the Tools->Find->Replace All item to replace all occurrences of the searched text in the document. These items are also avaliable in the Find->Replace submenu in the find bar.



Keyboard shortcuts

There are a few useful keyboard shortcuts avaliable in cke, you can use them as a substitution of the corresponding menu items.
Command Variables
ShortcutDescription
ctrl-4Closes the active document (same as File->Close)
ctrl-6Toggles to next window (same as Window->Next)
ctrl-aShows the about dialog box (same as Tools->About)
ctrl-bGoes to the beginning of the document
ctrl-shift-bSelects text from present location up to the begining of the document.
ctrl-cCopy the selection to the clipboard (same as Edit->Copy)
ctrl-shift-cAppend the selection to the clipboard(same as Edit->Copy Append)
ctrl-dDeletes to the beginning of next word.
ctrl-eMoves to the end of the document.
ctrl-shift-eExtend selection up to the end of the document.
ctrl-gAllows you to move to a line number (same as Find->Goto Line)
ctrl-iIndents the selection up to the next tab position. (same as tab if there is a multiple selection)
ctrl-shift-iIndents the selection up to the previous tab position. (same as shift-tab if there is a multiple selection)
ctrl-qquits the program and liberates the memory (same as Tools->Exit)
ctrl-sSaves present document (same as File->Save)
ctrl-vPaste clipboard to cursor (same as Edit->Paste)
ctrl-vPaste clipboard to cursor (same as Edit->Paste)
ctrl-xCuts selection to clipboard (same as Edit->Cut)
ctrl-shift-xCuts selection and appends to clipboard (same as Edit->Cut Append)
ctrl-yRedo last undo (same as Edit->Redo)
ctrl-zUndo last undo (same as Edit->Undo)
Shortcuts are not presently customizable.



Bookmarks

You can place bookmarks in a document to facilitate the displacements from one point to other. Bookmarks lasts until the document is closed or until they are explicitly cleared. To place a mark in a given line, use the Tools->Find->Mark while in that line. An arrow will be shown in the leftmost part of the screen, near the beginning of the line. You can remove this mark repeating the same menu command in any point of the line. You can also clear all the marks in a document with the Find->Clear marks menu item. Alternatively you can access this same command through the context menu which is shown when you tap and hold the stylus in the screen.

To move to the next bookmark, use the icon in the command bar, or use the Find->Next Bookmark or the Find->Prev Mark to go backwards to the previous bookmark.



The command bar

The program shows a command bar with a menu in the left (the Tools menu), from which you can access almost any feature in the program.

The rest of the toolbar is dedicated to a set of icons that has been chosen as the 'most useful' for the author.

The non-trivial button icons used in the toolbar are described in the next image:



Leaving the program

There are two ways of leaving the program. If you push the "ok" button in the taskbar, the program will be minimized (in the usual style of PPC programs. And all the opened docs will remain open when you execute again the program. The second way, is with the File->Exit menu option, which will close completely the program and liberate all the occupied memory. If you have changed the settings it is important to use this second option, since only when leaving the program this way will the options be saved in a permanent way.



General Settings

The settings are accesed trough the menu Edit->Settings, which give access to tabbed set of property sheets: Document, General, Classes, Commands and Associations.

The Document Settings refer to the current document, any modification on them will last until the closing of the document and forgotten thereafter, in order to specify persistant settings look at the document classes section below. In opening a new " unclasified" documemt it inherits the settings defined under the "default" class. There are four different customizable groups for an open document, which you choose in the upper-right dropdown list:

In the General tab you can cutomize the following items: the default extension indicates the extension to be added by default to the file name in case you don't specify any. It must be preceded by a dot, excepting if it is blank and then no extension will be added. The Directory follows active document checkcase, indicates that whenever you open the "FileOpen" or "SaveAs" dialogs, they will begin by default in the directory in which the current document resides. The Def. Directory field indicates in what directory the "SaveAs" dialog opens when saving new documents or the "FileOpen" dialogs enters when either the previous checkcase is unchecked or when there is no active document.

Finally in the General tab you can also define the filters to use when opening or saving documents. To enter a new filter write its name in the Filter name combo, its definition in the filter def. text box, and push the Add Button. The definition must be a series of extensions separated by colons, without inner spaces. You could for instance define something like "C++ Source files" with definition "*.c;*.cpp;*.h". In adition you can sort the filters in the combo, selecting one of them and pushing the Up button. The first filter in the list will appear as the default in the FileOpen/SaveAs Dialog. You can also Delete the selected filter, or Modify its definition with the corresponding buttons.

All the program options are saved in the file "cke.opt" (in the same folder where the program resides) when exiting the program through the File->Exit menu option. If you need to do a Hard reset, keep a copy of this file and then copy it to the folder where the program is installed. This will restore the program options to their settings before the hard reset. (with the exception of the associations which must be redone).



Document classes

In the classes tab you define "document classes" which are document settings, such as those described in general settings, which are applied to all the documents which match a given set of patterns.

The only predefined class is the default class which will be used whenever there is no other class whose filter matches the filename.

To create a new class write the desired name in the class name combo and push the new button. Then select the filter subpage in the upper right combo and add the patterns to which you want the settings to be applied. As an example, you could create the c++ class and add the patterns *.cpp and *.h. Patterns refer to program names and can contain the wildcards '?' and '*'. The class selected for a given document will be the first one in the class list with a pattern which matches the file name to be opened.

The remaining items in the document class configuration are identical with those described in general settings paragraph.



File Open Dialog

The "File Open" and "Save As" dialogs have been developed to add certain functionalities lacking in the built-in dialogs of the PPC. By default there is a two panel view, the upper shows the directories while the lower shows the files (and possibly the directories). You can modify the relative area of each panel dragging up and down the central blue bar. In upper combo you can choose between the filters defined in the General settings tab to limit the files shown.

To choose a file you can either double-click on it, select it and push the X button in the upper bar, or write its name (possibly with the directory) in the filename edit box and push enter. For the time being, you can open just one file each time.

In the next figure you can see the effect of the different buttons in the taskbar specific for this dialog:

Configurable commands

In the commands tab you can configure commands which will appear laterin the Tools menu. To define a new command enter its name in the upper left edit-box and press the "new" button, then choose the program name and enter the desired arguments in the corresponding edit boxes.

In both boxes you can enter a variable which will expand to it's corresponding value when executing the command. The present variables are:
Command Variables
var. namedescription
$unixfullnamefull path and filename in unix format (ie "/my documents/home/readme.txt")
$fullnamefull path and filename in windows format (ie "\my documents\home\readme.txt")
$fnamefilename including the extension (ie "readme.txt")
$filenamefilename without the extension (ie "readme")
$fileextfile extension without the dot (ie "txt")
$filepathfile path without the filename and the trailing "\" (ie "\my documents\home")

you can in addition instruct the program to save the present active document or all the opened documents. Note that if you don't activate any of these fields, and if the command operates on the opened files, it will do so in the last saved version.

In the present version there isn't a procedure to capture the standard output or the standard error, you can however, redirect the output to any file and open it later, for exemple, if you have a file \cc.bat wich compiles a single-source c++ file, and expects two parameters, the file name (without extension) and the path to the source, you can define a command with the following parameters:

  name:      Compile c++
  program:   \windows\cmd.exe
  arguments: /c \cc.bat "$filename"
    "$filepath" 2>\temp\error.txt

See the web page to see some useful command configurations.

Associations

In the Associations tab you can associate the program to a given extension, in such a way that when clicking in the explorer a file with the given extension it will open that file using cke.

To associate an extension enter the extension in the upper edit box with a leading dot (such as ".txt"), enter the file type in the "file type" edit box (such as "Text Files") and press "new".

You can also delete a previous association selecting it and pressing the "del" button. This will recover the previous association of the file extension if one exists.

In order that these changes take effect, you must press Ok, exit cke with the file->exit option, and then reset the handheld, be careful with any unsaved data before resetting.