lam@uxe.cso.uiuc.edu (10/17/88)
I am trying to write a color paint program. I would love to know how I can make use of TextEdit to implement the text tool in the tool palette (the 'A' icon). Specifically: [1] How do I prevent existing graphics that is in the view rect of text edit record from being erased? [2] When the user types <backspace>, how do I erase the last character and restore the background graphics that was replaced by the character? All existing paint programs seem to be able to do this quite well and I suspect they make use of text edit since they have the blinking text caret to prompt users to enter text. Is this true? Thanks in advance, Chih-Chao Lam lam@sumex-aim.stanford.edu
rick@Jessica.stanford.edu (Rick Wong) (10/19/88)
In article <900011@newton> clam@newton.ncsa.uiuc.edu writes: > >I am trying to write a color paint program. I would love to know how I can >make use of TextEdit to implement the text tool in the tool palette (the 'A' >icon). Specifically: Don't bother using TextEdit. For all but the most simple applications, it inevitably forces you to kludge up your code. I hate it. Vehemently. For a paint program, which has limited text editing, it is at least as easy to write your own code for storing strings, drawing them on screen, blinking the caret, and so on. > > [1] How do I prevent existing graphics that is in the view rect of text >edit record from being erased? > Don't use TextEdit. For paint programs, you generally need at two offscreen bitmaps, one for a backup image and one to do work in. When the text changes, copy the backup image to the work bitmap, then redraw the text on top of it. Since you won't be handling much text, the speed is adequate. > [2] When the user types <backspace>, how do I erase the last character >and restore the background graphics that was replaced by the character? > See [1]. > All existing paint programs seem to be able to do this quite well and >I suspect they make use of text edit since they have the blinking text caret >to prompt users to enter text. Is this true? > Any program that did text editing well wouldn't be using TextEdit (it's getting mighty hot around here . . .). MacPaint and HyperCard don't use TextEdit for painted text (try to have MacsBug break on TEIdle -- nothing happens). >Thanks in advance, >Chih-Chao Lam >lam@sumex-aim.stanford.edu Rick "Cheesy Spam Jello" Wong Courseware Authoring Tools Project, Stanford University rick@jessica.stanford.edu "Ask not what your country can do for you, but what you can do for George Bush."
wilson@csli.STANFORD.EDU (Nathan Wilson) (10/20/88)
In a similar vein, I am interested in doing TextEdit like stuff for a free drawing program that I've been slowly working on for about two years now, mostly for my own amusement but ultimately for general consumption. The original text editing hacks that I came up with were truely brain damaged and are in desperate need of rewriting. They did, however, do multiple fonts, sizes, and styles. I've been reading all the stuff on Capps and don't think I can use it since I really want to distribute the final product with complete source. If this is incorrect, please tell me and I'll run out and buy it (or could someone just send me the source? (-:) If I can't use it, does anyone have any pointers to free source for a better than TextEdit package or anything to help me get started on writing one myself. I need it to support multiple fonts etc. and redraw reasonably politely. Thanks in advance, Nathan Wilson PS I would like to receive wish lists for graphics editors. I make no promises but I love to receive mail. Also does anyone have some code for free rotation of bitmaps lying around getting dusty?