2 * Copyright (c) 1992, 1993, 1994 by Hellmuth Michaelis
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Hellmuth Michaelis.
17 * 4. The name of the developer may not be used to endorse or promote
18 * products derived from this software without specific prior written
21 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * edit.c, 3.00, last edit-date: [Sun Jan 2 20:08:27 1994]
35 /*---------------------------------------------------------------------------
37 * edit.c font editor edit character
38 * ------------------------------------------
40 * written by Hellmuth Michaelis, hm@hcshh.hcs.de
42 * -hm first public release
43 * -hm some debugging & cleanup
45 *---------------------------------------------------------------------------*/
54 /*---------------------------------------------------------------------------*
55 * fill edit mode command window
56 *---------------------------------------------------------------------------*/
59 mvwprintw(cmd_win,1,1,"(W)hite ");
60 mvwprintw(cmd_win,2,1,"(Black ");
61 mvwprintw(cmd_win,3,1,"(I)nvert ");
62 mvwprintw(cmd_win,4,1,"(R)ow BLACK ");
63 mvwprintw(cmd_win,5,1,"(r)ow WHITE ");
64 mvwprintw(cmd_win,6,1,"(C)ol BLACK ");
65 mvwprintw(cmd_win,7,1,"(c)ol WHITE ");
66 mvwprintw(cmd_win,8,1,"(Q)uit/Save ");
68 mvwprintw(cmd_win,9 ,1,"e(X)it/undo ");
69 mvwprintw(cmd_win,10,1,"Pen (U)p ");
70 mvwprintw(cmd_win,11,1,"Pen (D)own ");
71 mvwprintw(cmd_win,12,1," ");
72 mvwprintw(cmd_win,13,1,"(^P)rev Line");
73 mvwprintw(cmd_win,14,1,"(^N)ext Line");
74 mvwprintw(cmd_win,15,1,"(^F)orwd Col");
75 mvwprintw(cmd_win,16,1,"(^B)ack Col");
79 /*---------------------------------------------------------------------------*
80 * edit mode command loop
81 *---------------------------------------------------------------------------*/
95 dis_cmd(" Edit Mode, the Pen is DOWN");
97 dis_cmd(" Edit Mode, the Pen is UP");
99 l = ((mvwinch(ch_win,(r+1),(c+1))) & A_CHARTEXT);
100 wattron(ch_win,A_REVERSE);
101 mvwprintw(ch_win,(r+1),(c+1),"%c",l);
102 wattroff(ch_win,A_REVERSE);
103 wmove(ch_win,(r+1),(c+1));
106 k_ch = wgetch(ch_win);
121 if(r < (ch_height-1))
230 /*---------------------------------------------------------------------------*
232 *---------------------------------------------------------------------------*/
233 void normal_ch(int r, int c)
235 char l = ((mvwinch(ch_win,(r+1),(c+1))) & A_CHARTEXT);
236 wattroff(ch_win,A_REVERSE);
238 mvwprintw(ch_win,(r+1),(c+1),"*");
240 mvwprintw(ch_win,(r+1),(c+1),"%c",l);
241 wmove(ch_win,(r+1),(c+1));
244 /*---------------------------------------------------------------------------*
246 *---------------------------------------------------------------------------*/
247 void chg_pt(int r, int c)
250 l = ((mvwinch(ch_win,(r+1),(c+1))) & A_CHARTEXT);
255 mvwprintw(ch_win,(r+1),(c+1),"%c",l);
256 wmove(ch_win,(r+1),(c+1));
259 /*---------------------------------------------------------------------------*
260 * invert current character
261 *---------------------------------------------------------------------------*/
268 while(r <= ch_height)
273 if(WHITE == mvwinch(ch_win, r, c))
274 mvwaddch(ch_win, r, c, BLACK);
276 mvwaddch(ch_win, r, c, WHITE);
283 /*---------------------------------------------------------------------------*
284 * fill current character black/white
285 *---------------------------------------------------------------------------*/
286 void setchr(char type)
292 while(r <= ch_height)
297 mvwaddch(ch_win, r, c, type);
304 /*---------------------------------------------------------------------------*
305 * set current row to black/white
306 *---------------------------------------------------------------------------*/
307 void setrow(char type)
317 mvwaddch(ch_win, r, c, type);
322 /*---------------------------------------------------------------------------*
323 * set current column to black/white
324 *---------------------------------------------------------------------------*/
325 void setcol(char type)
333 while(r <= ch_height)
335 mvwaddch(ch_win, r, c, type);
340 /*---------------------------------- E O F ----------------------------------*/