cupcake Tcl Application

cupcake is a Tcl/Tk text editor application. The program is graphical and uses the Tk toolkit along with Future Lab graphical library modules. The program is run using the graphical wish shell. Before attempting to run this program, edit the main program file (cupcake.tcl) and set the Tcl directory structure so that the program can locate the required Future Lab library files.

The cupcake editor contains the following features:

- insert/merge a file into the current one
- undo/redo (Tcl 8.4 and higher)
- selectable fonts (for display only, one font for entire document)
- word wrap
- text search as well as goto line number
- saved preferences
  - window size
  - window position on screen
  - open/save directory
  - current font
  - word wrap
  - status line
- selectable on/off status line
  - current line number
  - current column number
  - total number of lines in the file
- print file (Windows platform only for now)

Cupcake preferences are saved to a file in the prefs directory which is part of the Tcl directory structure. This directory is not included as part of the Future Lab GPL Tcl package. You must create this directory yourself.

# Running Under Windows and File Associations

You can get cupcake to lauch automatically when you double-click on a file or right-click and choose edit from the context menu. Here is how you do this:

- install Tcl as documented here
- install the Future Lab Tcl GPL package as instructed in the package readme
- compose a batch file to act as a bridge between the file association, the Tcl environment and cupcake
- modify the Windows file associations to call the batch file for any file extension you desire

## The Batch File as a Bridge

The batch file you construct will be one of two types depending on whether you are using the development version of Tcl or Freewrap. Using a batch file does have one drawback. You will see a momentary DOS prompt appear when you launch cupcake through an association. In the example batch files below, I have numbered each line as a reference. Do not use the line numbers in your batch file.

### Batch File With the Development Version of Tcl

When you installed the development version of Tcl, the installer created file associations for the tcl file extension. You can launch any Tcl program by just double-clicking on it. The batch file we will construct will simply call cupcake directly. Here is the batch file:

    1 @echo off
    2 rem Launch the cupcake editor and load a file
    3 rem into it. May/2006, Rick Smereka
    4 c:
    5 cd \gpl\tcl\apps\cupcake
    6 start cupcake.tcl %1

On line 5 of the above batch file, we change the directory to where you installed the Future Lab Tcl GPL package. Make sure you cd right into the cupcake directory.

### Batch File Using Freewrap

There are two ways to use Freewrap. It can be used as a compiler to build executable programs or it can be used as a wish shell or environment. I use it as a wish shell. In the following batch file, I am making the following assumptions:

- the Future Lab Tcl GPL package is installed in the directory \gpl\tcl
- Freewrap is installed in \gpl\freewrap
- you have copyied freewrap.exe to \gpl\tcl\bin as tclaunch.exe

Here is the batch file for use with Freewrap:

    1 @echo off
    2 rem Launch the cupcake editor and load a file into it.
    3 rem For use with 'Freewrap'. May/2006, Rick Smereka
    4 c:
    5 cd \gpl\tcl\bin
    6 start tclaunch ..\apps\cupcake\cupcake.tcl %1

On line 5 of the above batch file, notice that I have changed the directory to where tclaunch.exe resides. On line 6, I execute the tclaunch program supplying the path and name of the cupcake program.

Goto Top | Tcl Applications | Tcl Software Overview | Tcl Library Overview
| Future Lab Home | Contact Webmaster | Feedback

Copyright © 2005-2006 Future Lab, Last Updated Jun 30, 2006