diff -crNP ../siag-3.3.4/ChangeLog ./ChangeLog *** ../siag-3.3.4/ChangeLog Fri Apr 28 14:44:16 2000 --- ./ChangeLog Sat May 6 09:12:24 2000 *************** *** 1,4 **** --- 1,30 ---- + 000506 Tsiag: removed tsiag/selection.c and tsiag/forminput.c. + Rewrote Image widget to redisplay more efficiently, including + the timeout hack used in Richtext and Table. + Released 3.3.5. + + 000505 PW: Made GridButtonAction take top_col into account. + Added optional ruler resource to Richtext, so that Richtext can + automatically adjust the top_col resource of the Ruler widget. + + 000504 Richtext scrolls sideways. + Siag: replaced text1 with Richtext. + + 000503 New features by Werner Frieder: + Siag, PW: Colour printing! + Siag: New modes for making grid lines. + Siag: When editing cell width/height, use old size as default. + Bug fix in siag/cmds.c: Make sure that borders are drawn on the right + sheet when selection is not on the current sheet. + + 000502 Siag: Bug in ci.c caused crash for expressions containing long symbols. + Siag: Resized to 700x420. + + 000501 Rewrote Richtext widget so it can be used as a replacement for + TextField. + Siag: use Richtext for in-place editing instead of TextField. + 000428 Siag: Zoom. XawM: Define NeedFunctionPrototypes in Xaw/Makefile.am to make sure that prototypes are used. *************** *** 6,11 **** --- 32,38 ---- Spanish translation updated by criptos@criptos.com.mx. Richtext and Table widgets make clever use of a short timeout (50 ms) to avoid sluggishness when events are coming in rapidly. + Released (the somewhat half-finished) 3.3.4. 000427 PW: Moved label1 to the status bar. diff -crNP ../siag-3.3.4/TODO ./TODO *** ../siag-3.3.4/TODO Fri Apr 28 13:42:01 2000 --- ./TODO Tue May 2 15:53:41 2000 *************** *** 1,6 **** Since the TextField widget can't zoom, in-place editing in Siag will have ! to be done using another widget. The Richtext widget is an obious candidate, but needs some work before it can be used as a general-purpose text widget. --- 1,59 ---- + + + Plugins should go into $prefix/lib rather than $prefix/libexec + in order to be FHS compliant. + + What is needed to use Richtext standalone as a single line text + widget that can replace Textfield? The resources are: + +top_row: top row, default 1. No changes needed. + +top_col: top col, default 1. No changes needed. + +sel_top_row, sel_top_col, sel_bottom_row, sel_bottom_col: selection, + + default 0 (no selection). No changes needed. + +point_row, point_col: default (0,0). Must be handled by widget. + +row_height: function which returns the height of a given row. + + Must be set to a function that returns some dummy height. + +adj_horiz: function which returns the horizontal adjustment. + + Must be set to a function which returns HADJ_LEFT. + +style: function which returns the style. Must be set to a + + function which returns 0. + +bop: function which returns True if a line is a bop. Must be set + + to a function which returns False. + +text: function which returns the text of a line (?). Must be set + + to a function which returns the internally managed data. + +data: pointer to some arbitrary data, a window structure in PW's + + case. Can be left as the default NULL + +redisplay: boolean which causes the widget to redraw itself when + + set to True. No need to change. + +visible_cursor: boolean which causes the cursor to be drawn if True. + + Should be True to be used as a text widget. + +paper_width: default is 595, but that is totally inappropriate. + + Should probably be the widget width, or infinity, or something. + +left_margin: default is 72, but 0 seems much better. + +right_margin: ditto. + +tab_distance: the default 36 is just fine. + +plugin_coords: function which returns the coordinates of a plugin. + + We're not going to have any, so this resource can be anything. + +zoom: this will be used exactly as in PW; the default 1.0 can be kept + + unless we want to change it. + +In addition, SelfInsertChar should be returned to pw application code + +and replaced with one that operates on the widget's own data. + More actions must be written, e.g. to move the point. New functions + +RichtextSetString and RichtextGetString work as the Textfield + +equivalents and take plain C strings as arguments. + +A new resource called format specifies what format should be used for + +characters that are entered. Defaults to 0. Another resource, rc_string, + +stores the richtext string being edited. + It seems that this will result in a widget that does much of what + pw does already. It would be a good idea to integrate as much as + possible. Another good idea would be to replace all TextField widgets + with Richtext. + + + Siag: row and column headings are off. + Since the TextField widget can't zoom, in-place editing in Siag will have ! to be done using another widget. The Richtext widget is an obvious candidate, but needs some work before it can be used as a general-purpose text widget. diff -crNP ../siag-3.3.4/common/bitmaps/Makefile.am ./common/bitmaps/Makefile.am *** ../siag-3.3.4/common/bitmaps/Makefile.am Thu Jan 27 03:15:49 2000 --- ./common/bitmaps/Makefile.am Tue May 2 22:58:44 2000 *************** *** 6,14 **** egon.xpm fld_open.xpm fld_closed.xpm fld_up.xpm fld_new.xpm \ save.xpm grid.xpm hcenter.xpm hleft.xpm \ hright.xpm info.xpm insert.xpm \ ! italic.xpm new.xpm next.xpm none.xpm overwrite.xpm paste.xpm \ play.xpm plotter.xpm preview.xpm previous.xpm printer.xpm pw.xpm \ ! redo.xpm siag.xpm siagoffice.xpm \ sigma.xpm sortaz.xpm sortza.xpm spell.xpm \ stop.xpm uchar.xpm uline.xpm undo.xpm vbottom.xpm vtop.xpm \ back.xpm cancel.xpm home.xpm quit.xpm reload.xpm search.xpm \ --- 6,14 ---- egon.xpm fld_open.xpm fld_closed.xpm fld_up.xpm fld_new.xpm \ save.xpm grid.xpm hcenter.xpm hleft.xpm \ hright.xpm info.xpm insert.xpm \ ! italic.xpm lline.xpm new.xpm next.xpm none.xpm overwrite.xpm paste.xpm \ play.xpm plotter.xpm preview.xpm previous.xpm printer.xpm pw.xpm \ ! redo.xpm rline.xpm siag.xpm siagoffice.xpm \ sigma.xpm sortaz.xpm sortza.xpm spell.xpm \ stop.xpm uchar.xpm uline.xpm undo.xpm vbottom.xpm vtop.xpm \ back.xpm cancel.xpm home.xpm quit.xpm reload.xpm search.xpm \ diff -crNP ../siag-3.3.4/common/bitmaps/Makefile.in ./common/bitmaps/Makefile.in *** ../siag-3.3.4/common/bitmaps/Makefile.in Fri Apr 28 14:47:38 2000 --- ./common/bitmaps/Makefile.in Sat May 6 09:24:55 2000 *************** *** 86,92 **** SUBDIRS = kde gnome xpmdir = $(datadir)/siag/common/bitmaps ! xpm_DATA = blank.xpm bold.xpm borders.xpm copy.xpm copyright.xpm cut.xpm egon.xpm fld_open.xpm fld_closed.xpm fld_up.xpm fld_new.xpm save.xpm grid.xpm hcenter.xpm hleft.xpm hright.xpm info.xpm insert.xpm italic.xpm new.xpm next.xpm none.xpm overwrite.xpm paste.xpm play.xpm plotter.xpm preview.xpm previous.xpm printer.xpm pw.xpm redo.xpm siag.xpm siagoffice.xpm sigma.xpm sortaz.xpm sortza.xpm spell.xpm stop.xpm uchar.xpm uline.xpm undo.xpm vbottom.xpm vtop.xpm back.xpm cancel.xpm home.xpm quit.xpm reload.xpm search.xpm xterm16.xpm viewmode.xpm sortmode.xpm xedplus.xpm netscape.xpm icons.xpm image.xpm ghost.xpm compress.xpm fonts.xpm data.xpm unknown.xpm center.xpm larger.xpm smaller.xpm portrait.xpm landscape.xpm editor.xpm SO3.xpm book-closed.xpm book-open.xpm handlebg.xpm xfiler.xpm gvu.xpm xedplus.xpm gifdir = $(prefix)/doc/siag/common/bitmaps --- 86,92 ---- SUBDIRS = kde gnome xpmdir = $(datadir)/siag/common/bitmaps ! xpm_DATA = blank.xpm bold.xpm borders.xpm copy.xpm copyright.xpm cut.xpm egon.xpm fld_open.xpm fld_closed.xpm fld_up.xpm fld_new.xpm save.xpm grid.xpm hcenter.xpm hleft.xpm hright.xpm info.xpm insert.xpm italic.xpm lline.xpm new.xpm next.xpm none.xpm overwrite.xpm paste.xpm play.xpm plotter.xpm preview.xpm previous.xpm printer.xpm pw.xpm redo.xpm rline.xpm siag.xpm siagoffice.xpm sigma.xpm sortaz.xpm sortza.xpm spell.xpm stop.xpm uchar.xpm uline.xpm undo.xpm vbottom.xpm vtop.xpm back.xpm cancel.xpm home.xpm quit.xpm reload.xpm search.xpm xterm16.xpm viewmode.xpm sortmode.xpm xedplus.xpm netscape.xpm icons.xpm image.xpm ghost.xpm compress.xpm fonts.xpm data.xpm unknown.xpm center.xpm larger.xpm smaller.xpm portrait.xpm landscape.xpm editor.xpm SO3.xpm book-closed.xpm book-open.xpm handlebg.xpm xfiler.xpm gvu.xpm xedplus.xpm gifdir = $(prefix)/doc/siag/common/bitmaps diff -crNP ../siag-3.3.4/common/bitmaps/lline.xpm ./common/bitmaps/lline.xpm *** ../siag-3.3.4/common/bitmaps/lline.xpm Thu Jan 1 01:00:00 1970 --- ./common/bitmaps/lline.xpm Tue May 2 23:14:44 2000 *************** *** 0 **** --- 1,30 ---- + /* XPM */ + static char * uline_xpm[] = { + "24 24 3 1", + " s None c None", + ". c black", + "X c white", + " ", + " ", + " ", + " ", + " ", + " .............. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " ..XXXXXXXXXXX. ", + " .............. ", + " ", + " ", + " ", + " ", + " "}; diff -crNP ../siag-3.3.4/common/bitmaps/rline.xpm ./common/bitmaps/rline.xpm *** ../siag-3.3.4/common/bitmaps/rline.xpm Thu Jan 1 01:00:00 1970 --- ./common/bitmaps/rline.xpm Tue May 2 23:14:44 2000 *************** *** 0 **** --- 1,30 ---- + /* XPM */ + static char * uline_xpm[] = { + "24 24 3 1", + " s None c None", + ". c black", + "X c white", + " ", + " ", + " ", + " ", + " ", + " .............. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .XXXXXXXXXXX.. ", + " .............. ", + " ", + " ", + " ", + " ", + " "}; diff -crNP ../siag-3.3.4/configure ./configure *** ../siag-3.3.4/configure Thu Apr 27 03:54:37 2000 --- ./configure Sat May 6 09:14:23 2000 *************** *** 706,712 **** PACKAGE=siag ! VERSION=3.3.4 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } --- 706,712 ---- PACKAGE=siag ! VERSION=3.3.5 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } diff -crNP ../siag-3.3.4/configure.in ./configure.in *** ../siag-3.3.4/configure.in Sat Apr 22 22:04:27 2000 --- ./configure.in Tue May 2 23:51:57 2000 *************** *** 1,7 **** dnl Process this file with autoconf to produce a configure script. AC_INIT(README) AM_CONFIG_HEADER(config.h) ! AM_INIT_AUTOMAKE(siag, 3.3.4) dnl Set of available languages dnl ALL_LINGUAS="" --- 1,7 ---- dnl Process this file with autoconf to produce a configure script. AC_INIT(README) AM_CONFIG_HEADER(config.h) ! AM_INIT_AUTOMAKE(siag, 3.3.5) dnl Set of available languages dnl ALL_LINGUAS="" diff -crNP ../siag-3.3.4/egon/cmds.c ./egon/cmds.c *** ../siag-3.3.4/egon/cmds.c Thu Apr 6 14:53:11 2000 --- ./egon/cmds.c Fri May 5 11:53:22 2000 *************** *** 560,575 **** /* --- */ - static LISP bell(void) - { - #if 0 - XBell(XtDisplay(pLevel), 100); - #endif - return NIL; - } - - /* --- - */ static LISP lask_for_str(LISP prompt, LISP buf) { char *p, b[256]; --- 560,565 ---- *************** *** 1260,1266 **** {"quit-program", quit_egon}, /* low level functions */ - {"bell", bell}, {"ani-begin", ani_begin}, {"ani-end", ani_end}, --- 1250,1255 ---- diff -crNP ../siag-3.3.4/gvu/Makefile.in ./gvu/Makefile.in *** ../siag-3.3.4/gvu/Makefile.in Fri Apr 28 14:48:50 2000 --- ./gvu/Makefile.in Sat May 6 09:26:00 2000 *************** *** 303,323 **** || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done - callbacks.o: callbacks.c ../common/common.h ../common/cmalloc.h \ - ../xcommon/filesel.h ../xcommon/dialogs.h ../xcommon/xcommon.h \ - gv.h ../xcommon/Ghostview.h ../Nws/cvt.h ../common/ps.h - main.o: main.c blank.xpm dot.xpm ../Nws/utils.h ../Nws/cvt.h \ - ../Nws/Menu.h ../Nws/MenuBar.h ../Nws/Row.h ../Nws/BaseConst.h \ - ../Nws/MBButton.h ../Nws/LabelME.h ../Nws/BaseME.h \ - ../Nws/LineME.h ../Nws/SubME.h ../common/common.h \ - ../xcommon/xcommon.h ../xcommon/dialogs.h ../xcommon/Rudegrid.h \ - ../xcommon/Frame.h ../xcommon/Tooltip.h ../xcommon/Handle.h \ - ../xcommon/../XawM/Label.h gv.h ../xcommon/Ghostview.h \ - ../common/ps.h ../xcommon/xcommon-ad.h ../xcommon/filesel-ad.h \ - ../xcommon/dialogs-ad.h ../xcommon/nws-ad.h gvu-ad.h - misc.o: misc.c ../Nws/Menu.h ../Nws/cvt.h ../Nws/MBButton.h \ - ../Nws/LabelME.h ../Nws/BaseME.h ../Nws/LineME.h gv.h \ - ../xcommon/Ghostview.h ../common/ps.h info-am: info: info-am --- 303,308 ---- diff -crNP ../siag-3.3.4/pw/cmds.c ./pw/cmds.c *** ../siag-3.3.4/pw/cmds.c Tue Apr 25 07:56:40 2000 --- ./pw/cmds.c Fri May 5 13:03:07 2000 *************** *** 2192,2197 **** --- 2192,2199 ---- static LISP lset_zoom(LISP n) { zoom = get_c_double(n); + if (zoom < .1) zoom = .1; + if (zoom > 10) zoom = 10; pr_scr_flag = 1; return NIL; } diff -crNP ../siag-3.3.4/pw/menu.scm ./pw/menu.scm *** ../siag-3.3.4/pw/menu.scm Sun Feb 6 00:27:15 2000 --- ./pw/menu.scm Fri May 5 12:39:10 2000 *************** *** 57,62 **** --- 57,63 ---- (add-menu-entry "Format" "Cleanup" "(cleanup-style)") (add-menu "Window") + (add-menu-entry "Window" "Zoom" "(zoom-adjust)") (add-menu-entry "Window" "Change Buffer" "(switch-to-buffer)") (add-menu-entry "Window" "Delete Buffer" "(kill-buffer)") (add-menu-entry "Window" "-" "-") diff -crNP ../siag-3.3.4/pw/pw.scm ./pw/pw.scm *** ../siag-3.3.4/pw/pw.scm Thu Apr 6 20:04:52 2000 --- ./pw/pw.scm Fri May 5 13:06:27 2000 *************** *** 562,564 **** --- 562,567 ---- "*.rtf" "2rtf %s %s" nil nil))) + (define (zoom-adjust) + (set-zoom (/ (string->number (ask-for-str "Zoom %:" "130")) 100))) + diff -crNP ../siag-3.3.4/siag/ci.c ./siag/ci.c *** ../siag-3.3.4/siag/ci.c Thu Apr 6 14:53:19 2000 --- ./siag/ci.c Tue May 2 18:07:41 2000 *************** *** 1,6 **** /* Siag, Scheme In A Grid ! Copyright (C) 1996-1999 Ulric Eriksson This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,6 ---- /* Siag, Scheme In A Grid ! Copyright (C) 1996-2000 Ulric Eriksson This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by *************** *** 120,126 **** static int isrange(buffer *b, char *par) { int res; ! char expr[21]; ref_expander(b, par, expr, " ", "%d%d", "RANGE%d%d%d%d"); res = !strncmp("RANGE", expr, 5); --- 120,126 ---- static int isrange(buffer *b, char *par) { int res; ! char expr[1024]; ref_expander(b, par, expr, " ", "%d%d", "RANGE%d%d%d%d"); res = !strncmp("RANGE", expr, 5); diff -crNP ../siag-3.3.4/siag/cmds.c ./siag/cmds.c *** ../siag-3.3.4/siag/cmds.c Fri Apr 28 10:37:17 2000 --- ./siag/cmds.c Fri May 5 13:02:36 2000 *************** *** 643,649 **** if (block_upper(w_list).row < 1 || block_upper(w_list).col < 1) return NIL; ! s = w_list->sht; for (r = block_upper(w_list).row; r <= block_lower(w_list).row; r++) { cval value; value.number = 0.0; --- 643,649 ---- if (block_upper(w_list).row < 1 || block_upper(w_list).col < 1) return NIL; ! s = w_list->bsht; for (r = block_upper(w_list).row; r <= block_lower(w_list).row; r++) { cval value; value.number = 0.0; *************** *** 669,676 **** fmt.borders |= BORDER_MASK; break; case 3: /* underline */ ! if (r == block_lower(w_list).row) ! fmt.borders |= BORDER_BOTTOM; break; default: /* none */ fmt.borders &= ~BORDER_MASK; --- 669,684 ---- fmt.borders |= BORDER_MASK; break; case 3: /* underline */ ! fmt.borders ^= BORDER_BOTTOM; ! break; ! case 4: /* border top */ ! fmt.borders ^= BORDER_TOP; ! break; ! case 5: /* border left */ ! fmt.borders ^= BORDER_LEFT; ! break; ! case 6: /* border right */ ! fmt.borders ^= BORDER_RIGHT; break; default: /* none */ fmt.borders &= ~BORDER_MASK; *************** *** 804,811 **** --- 812,826 ---- { char b[256]; int width = 0; + int ccw; b[0] = 0; + + /* current cell width as default */ + ccw = cell_width(buffer_of_window(w_list), w_list->sht, + w_list->buf->sht[w_list->sht].point_pos.col); + sprintf(b, "%d", ccw); + if (ask_for_str("Width:", b)) sscanf(b, "%d", &width); *************** *** 862,869 **** --- 877,891 ---- { char b[256]; int height = 0; + int cch; b[0] = 0; + + /* current cell heigth as default */ + cch = cell_height(buffer_of_window(w_list), w_list->sht, + w_list->buf->sht[w_list->sht].point_pos.row); + sprintf(b, "%d", cch); + if (ask_for_str("Height:", b)) sscanf(b, "%d", &height); *************** *** 2276,2281 **** --- 2298,2305 ---- static LISP lset_zoom(LISP n) { zoom = get_c_double(n); + if (zoom < .1) zoom = .1; + if (zoom > 10) zoom = 10; pr_scr_flag = 1; return NIL; } diff -crNP ../siag-3.3.4/siag/fileio_ps.c ./siag/fileio_ps.c *** ../siag-3.3.4/siag/fileio_ps.c Thu Apr 6 14:53:20 2000 --- ./siag/fileio_ps.c Tue May 2 23:09:05 2000 *************** *** 133,138 **** --- 133,139 ---- b[0] = '\0'; if (ret_type(buf, s, row, col) != EMPTY) ps_set_font(fp, fmt); + ret_pvalue(b, buf, s, row, col, -1); font_index = ret_font(buf, s, row, col); *************** *** 176,181 **** --- 177,184 ---- } fprintf(fp, ")\n"); fprintf(fp, "show\n"); + fprintf(fp, "0 0 0 setrgbcolor\n"); + } } diff -crNP ../siag-3.3.4/siag/menu.scm ./siag/menu.scm *** ../siag-3.3.4/siag/menu.scm Thu Apr 6 14:53:21 2000 --- ./siag/menu.scm Fri May 5 12:38:34 2000 *************** *** 169,174 **** --- 169,177 ---- (add-menu-entry "Block" "Borders" "(block-borders 1)") (add-menu-entry "Block" "Grid" "(block-borders 2)") (add-menu-entry "Block" "Underline" "(block-borders 3)") + (add-menu-entry "Block" "Top" "(block-borders 4)") + (add-menu-entry "Block" "Left" "(block-borders 5)") + (add-menu-entry "Block" "Right" "(block-borders 6)") (add-menu-entry "Block" "None" "(block-borders 0)") (add-menu "Format") *************** *** 228,233 **** --- 231,237 ---- (add-menu-entry "Data" "Recalculate" "(recalc-matrix)") (add-menu "Window") + (add-menu-entry "Window" "Zoom" "(zoom-adjust)") (add-menu-entry "Window" "Change Buffer" "(switch-to-buffer)") (add-menu-entry "Window" "Delete Buffer" "(kill-buffer 1)") (add-menu-entry "Window" "-" "-") *************** *** 365,370 **** --- 369,375 ---- (add-pseudo-menu "Shortcuts") + ;(add-menu-entry "Shortcuts" "Unset Block" "(unset-block)") (add-menu-entry "Shortcuts" "Open" "(load-buffer)") (add-menu-entry "Shortcuts" "Save" "(save-buffer-as)") (add-menu-entry "Shortcuts" "-" "-") diff -crNP ../siag-3.3.4/siag/siag.scm ./siag/siag.scm *** ../siag-3.3.4/siag/siag.scm Thu Apr 6 15:22:38 2000 --- ./siag/siag.scm Fri May 5 12:45:35 2000 *************** *** 1034,1036 **** --- 1034,1039 ---- "*.txt" "blaha < '%s' > '%s'" "*.txt" "blaha < '%s' > '%s'"))) + (define (zoom-adjust) + (set-zoom (/ (string->number (ask-for-str "Zoom %:" "130")) 100))) + diff -crNP ../siag-3.3.4/siag/window.c ./siag/window.c *** ../siag-3.3.4/siag/window.c Thu Apr 6 14:53:23 2000 --- ./siag/window.c Fri May 5 10:27:03 2000 *************** *** 156,183 **** *cell_y = 0; for (i = 1; i < get_prot(w).row; i++) ! *cell_y += cell_height(w->buf, w->sht, i); while (cell_row < top_row) { cell_row = cell_next_row(w, cell_row); ! *cell_y -= cell_height(w->buf, w->sht, cell_row); } while (cell_row > top_row) { cell_row = cell_prev_row(w, cell_row); ! *cell_y += cell_height(w->buf, w->sht, cell_row); } *cell_x = 0; for (i = 1; i < get_prot(w).col; i++) ! *cell_x += cell_width(w->buf, w->sht, i); while (cell_col < top_col) { cell_col = cell_next_col(w, cell_col); ! *cell_x -= cell_width(w->buf, w->sht, cell_col); } while (cell_col > top_col) { cell_col = cell_prev_col(w, cell_col); ! *cell_x += cell_width(w->buf, w->sht, cell_col); } } /* --- --- 156,185 ---- *cell_y = 0; for (i = 1; i < get_prot(w).row; i++) ! *cell_y += zoom*cell_height(w->buf, w->sht, i); while (cell_row < top_row) { cell_row = cell_next_row(w, cell_row); ! *cell_y -= zoom*cell_height(w->buf, w->sht, cell_row); } while (cell_row > top_row) { cell_row = cell_prev_row(w, cell_row); ! *cell_y += zoom*cell_height(w->buf, w->sht, cell_row); } *cell_x = 0; for (i = 1; i < get_prot(w).col; i++) ! *cell_x += zoom*cell_width(w->buf, w->sht, i); while (cell_col < top_col) { cell_col = cell_next_col(w, cell_col); ! *cell_x -= zoom*cell_width(w->buf, w->sht, cell_col); } while (cell_col > top_col) { cell_col = cell_prev_col(w, cell_col); ! *cell_x += zoom*cell_width(w->buf, w->sht, cell_col); } + *cell_x /= zoom; + *cell_y /= zoom; } /* --- diff -crNP ../siag-3.3.4/tsiag/Makefile.am ./tsiag/Makefile.am *** ../siag-3.3.4/tsiag/Makefile.am Tue Mar 23 09:10:30 1999 --- ./tsiag/Makefile.am Sat May 6 09:11:50 2000 *************** *** 1,7 **** bin_PROGRAMS = tsiag ! tsiag_SOURCES = fonts.c forminput.c window.c selection.c tsiag.c noinst_HEADERS = tsiag.h fonts.h --- 1,7 ---- bin_PROGRAMS = tsiag ! tsiag_SOURCES = fonts.c window.c tsiag.c noinst_HEADERS = tsiag.h fonts.h diff -crNP ../siag-3.3.4/tsiag/Makefile.in ./tsiag/Makefile.in *** ../siag-3.3.4/tsiag/Makefile.in Fri Apr 28 14:48:15 2000 --- ./tsiag/Makefile.in Sat May 6 09:25:25 2000 *************** *** 85,91 **** bin_PROGRAMS = tsiag ! tsiag_SOURCES = fonts.c forminput.c window.c selection.c tsiag.c noinst_HEADERS = tsiag.h fonts.h --- 85,91 ---- bin_PROGRAMS = tsiag ! tsiag_SOURCES = fonts.c window.c tsiag.c noinst_HEADERS = tsiag.h fonts.h *************** *** 110,116 **** X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ ! tsiag_OBJECTS = fonts.o forminput.o window.o selection.o tsiag.o tsiag_DEPENDENCIES = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) --- 110,116 ---- X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ ! tsiag_OBJECTS = fonts.o window.o tsiag.o tsiag_DEPENDENCIES = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) *************** *** 233,242 **** done fonts.o: fonts.c ../common/common.h ../common/cmalloc.h \ ../common/oldfonts.h ../common/fonts.h fonts.h - forminput.o: forminput.c ../siod/siod.h ../common/cmalloc.h \ - ../common/common.h - selection.o: selection.c ../siag/calc.h ../siag/../common/traceme.h \ - ../siag/user_interface.h tsiag.h tsiag.o: tsiag.c ../common/common.h ../common/cmalloc.h ../siod/siod.h \ ../siag/calc.h ../siag/../common/traceme.h \ ../siag/user_interface.h tsiag.h --- 233,238 ---- diff -crNP ../siag-3.3.4/tsiag/fonts.c ./tsiag/fonts.c *** ../siag-3.3.4/tsiag/fonts.c Thu Apr 6 14:53:26 2000 --- ./tsiag/fonts.c Fri May 5 11:38:02 2000 *************** *** 361,374 **** char *x_fmt, *ps_fmt; int i = 0; int res_x, res_y; /* screen resolution */ - #if 0 - int screen = DefaultScreen(dpy); - - res_x = DisplayWidth(dpy, screen)/(DisplayWidthMM(dpy, screen)/25.4); - res_y = DisplayHeight(dpy, screen)/(DisplayHeightMM(dpy, screen)/25.4); - #else /* cheat to get ps right */ res_x = res_y = 72; - #endif if (bold) i += 2; if (italic) i += 1; --- 361,367 ---- diff -crNP ../siag-3.3.4/tsiag/forminput.c ./tsiag/forminput.c *** ../siag-3.3.4/tsiag/forminput.c Thu Apr 6 14:53:26 2000 --- ./tsiag/forminput.c Thu Jan 1 01:00:00 1970 *************** *** 1,179 **** - /* - Scheme In A Grid - Copyright (C) 1998 Ulric Eriksson - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - /* - * forminput.c - */ - - #include - #include - #include "../siod/siod.h" - #include "../common/cmalloc.h" - #include "../common/common.h" - - #define TEXT 1 - #define OKBUTTON 2 - #define CANCELBUTTON 3 - #define MENU 4 - - #define ANYWHERE 0 - #define LEFT 1 - #define RIGHT 2 - - #if 0 - typedef struct s_control { - int type; - char *name; - struct s_control *next, *prev; - } control; - - static control *c_list; - - static void *vert = NULL, *horiz = NULL, *lastw = NULL, *menu = NULL; - - static int status; - - static LISP form_begin() - { - vert = NULL, horiz = NULL; - c_list = NULL; - return NIL; - } - - static LISP form_label(LISP text) - { - char *label = get_c_string(text); - return NIL; - } - - static control *new_control(int type, char *name) - { - control *c = (control *)cmalloc(sizeof(control)); - if (!c_list) { - c_list = c; - c->next = c; - c->prev = c; - } else { - c->prev = c_list->prev; - c->next = c_list; - c_list->prev->next = c; - c_list->prev = c; - } - c->type = type; - c->name = cstrdup(name); - return c; - } - - static LISP form_text(LISP n) - { - char *name = get_c_string(n); - control *c = new_control(TEXT, name); - return NIL; - } - - static LISP form_menu(LISP n) - { - char *name = get_c_string(n); - control *c = new_control(MENU, name); - - return NIL; - } - - static LISP form_menuentry(LISP n) - { - char *name = get_c_string(n); - return NIL; - } - - static LISP form_okbutton(LISP text) - { - char *name = get_c_string(text); - return NIL; - } - - static LISP form_cancelbutton(LISP text) - { - char *name = get_c_string(text); - return NIL; - } - - static LISP form_property(LISP name, LISP value) - { - char *n = get_c_string(name); - char *tv; - long lv; - - if (!lastw) err("Last widget is NULL", NIL); - - if (FLONUMP(value)) { - lv = get_c_long(value); - } else { - tv = get_c_string(value); - } - - return NIL; - } - - static LISP form_newline() - { - vert = horiz; - horiz = NULL; - return NIL; - } - - static LISP form_end() - { - control *c; - LISP result; - /* collect values and free resources */ - result = NIL; - c = c_list; - if (!c) return NIL; - do { - char *value; - switch (c->type) { - case TEXT: - break; - case MENU: - break; - } - result = cons(cons(strcons(strlen(c->name), c->name), - strcons(strlen(value), value)), - result); - c = c->next; - } while (c != c_list); - lastw = NULL; - if (status == ABORT) return NIL; - return result; - } - - void init_form(void) - { - init_subr_0("form-begin", form_begin); - init_subr_1("form-label", form_label); - init_subr_1("form-text", form_text); - init_subr_1("form-menu", form_menu); - init_subr_1("form-menuentry", form_menuentry); - init_subr_1("form-okbutton", form_okbutton); - init_subr_1("form-cancelbutton", form_cancelbutton); - init_subr_2("form-property", form_property); - init_subr_0("form-newline", form_newline); - init_subr_0("form-end", form_end); - } - #endif --- 0 ---- diff -crNP ../siag-3.3.4/tsiag/selection.c ./tsiag/selection.c *** ../siag-3.3.4/tsiag/selection.c Thu Apr 6 14:53:26 2000 --- ./tsiag/selection.c Thu Jan 1 01:00:00 1970 *************** *** 1,161 **** - /* - Siag, Scheme In A Grid - Copyright (C) 1996 Ulric Eriksson - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - /* - Module name: selection.c - - This module handles selection: grabbing, releasing, cutting, pasting. - - The selection uses a custom target SIAG_BLOCK which has this format: - - \0\0\0\0... - - HEIGHT = numbers of rows in selection - WIDTH = number of columns in selection - TYPE = type char where: - '"' = label - '#' = empty - '=' = expression - '$' = string - '+' = expression with named interpreter - 'm' = image - TEXT = verbatim text from the cell - - This is pretty similar to the file format but different enough to - be confusing. - */ - - #include - #include - - #include "../siag/calc.h" - #include "tsiag.h" - - #if 0 /* Doesn't seem to be used...*/ - int pack_selection(buffer *b, char *data, - int r1, int c1, int r2, int c2) - { - int row, col; - char *q = data; - - sprintf(data, "%d", r2-r1+1); - data += strlen(data)+1; - sprintf(data, "%d", c2-c1+1); - data += strlen(data)+1; - - for (row = r1; row <= r2; row++) { - if (data-q > 30000) goto toolong; - for (col = c1; col <= c2; col++) { - switch (ret_type(b, row, col)) { - case EMPTY: - sprintf(data, "#"); - break; - case LABEL: - sprintf(data, "\"%s", - ret_text(b, row, col)); - break; - case EMBED: - sprintf(data, "m%s", - ret_text(b, row, col)); - break; - default: /* incl. STRING and ERROR */ - sprintf(data, "+%s,%s", - interpreter2name(ret_interpreter(b, - row, col)), - ret_text(b, row, col)); - } - data += strlen(data)+1; - } - } - toolong: - *data = '\0'; - return 0; - } - #endif - - void transfer_done_proc() - { - ; /* no need to do anything at all */ - } - - #if 0 /* Again, I don't think this is even used */ - int unpack_selection(buffer *b, char *data, int row, int col) - { - int height, width, i, j, intp; - char *texti, *comma; - cval value; - - value.number = 0; - - sscanf(data, "%d", &height); - data += strlen(data)+1; - sscanf(data, "%d", &width); - data += strlen(data)+1; - - undo_save(b, row, col, row+height-1, col+width-1); - - for (i = 0; i < height; i++) { - for (j = 0; j < width; j++) { - switch (data[0]) { - case '"': - texti = (data+1); - ins_data(b, - siod_interpreter, - texti, value, - LABEL, row+i, col+j); - break; - case '=': - texti = (data+1); - ins_data(b, - siod_interpreter, - texti, value, - EXPRESSION, row+i, col+j); - break; - case '$': - texti = (data+1); - ins_data(b, - siod_interpreter, - texti, value, - STRING, row+i, col+j); - break; - case '+': - comma = strchr(data, ','); - if (comma) { - *comma = '\0'; - } - intp = name2interpreter(data+1); - if (intp < 0) intp = siod_interpreter; - data = comma+1; - ins_data(b, intp, data, value, - EXPRESSION, row+i, col+j); - break; - default: - ins_data(b, - siod_interpreter, - NULL, value, - EMPTY, row+i, col+j); - } - data += strlen(data)+1; - } - } - pr_scr_flag = TRUE; - TRACEME((f, "unpack_selection is calling show_cur")); show_cur(w_list); - return 0; - } - #endif --- 0 ---- diff -crNP ../siag-3.3.4/xcommon/Animator.c ./xcommon/Animator.c *** ../siag-3.3.4/xcommon/Animator.c Thu Apr 27 04:12:26 2000 --- ./xcommon/Animator.c Fri May 5 02:19:48 2000 *************** *** 455,461 **** /* set font */ if (!actor->string) break; /* sanity */ p = rc_makerich(actor->string, actor->fmt); ! rc_strdraw(scribble, ani_gc, x, y, p, -1, 1.0); cfree(p); break; case ANI_POINT: --- 455,461 ---- /* set font */ if (!actor->string) break; /* sanity */ p = rc_makerich(actor->string, actor->fmt); ! rc_strdraw(scribble, ani_gc, 0, 0, x, y, p, -1, 1.0); cfree(p); break; case ANI_POINT: diff -crNP ../siag-3.3.4/xcommon/Frame.c ./xcommon/Frame.c *** ../siag-3.3.4/xcommon/Frame.c Thu Apr 6 14:53:29 2000 --- ./xcommon/Frame.c Fri May 5 11:45:15 2000 *************** *** 304,317 **** { FrameWidget fw = (FrameWidget) w; - #if 0 - /* TODO: shouldn't this chain to the parent's realize instead? */ - XtCreateWindow( w, (unsigned)InputOutput, (Visual *)CopyFromParent, - *valueMask, attributes); - #else (*superclass->core_class.realize)(w, valueMask, attributes); - #endif - FrameAllocGCs(fw) ; } --- 304,310 ---- diff -crNP ../siag-3.3.4/xcommon/Image.c ./xcommon/Image.c *** ../siag-3.3.4/xcommon/Image.c Thu Apr 6 14:53:29 2000 --- ./xcommon/Image.c Sat May 6 08:58:40 2000 *************** *** 1,5 **** /* ! Copyright (C) 1999 Ulric Eriksson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public --- 1,5 ---- /* ! Copyright (C) 1999-2000 Ulric Eriksson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public *************** *** 112,120 **** /* --- */ ! static Pixmap scale_pixmap(Display *dpy, GC gc, Pixmap old, ! unsigned int neww, unsigned int newh) { Pixmap new; unsigned int x, y, ox, oy; unsigned long pixel; --- 112,125 ---- /* --- */ ! static void scale_pixmap(Widget w) { + Display *dpy = XtDisplay(w); + ImageWidget iw = (ImageWidget)w; + GC gc = iw->image.gc; + Pixmap old = iw->image.bitmap; + unsigned int neww = iw->core.width; + unsigned int newh = iw->core.height; Pixmap new; unsigned int x, y, ox, oy; unsigned long pixel; *************** *** 122,139 **** unsigned int oldw, oldh, border, depth; XImage *im_in, *im_out; ! if (old == None) return None; XGetGeometry(dpy, old, &root, &x, &y, &oldw, &oldh, &border, &depth); new = XCreatePixmap(dpy, root, neww, newh, depth); ! if (new == None) return None; if (neww == oldw && newh == oldh) { /* just copy the old pixmap */ XCopyArea(dpy, old, new, gc, 0, 0, oldw, oldh, 0, 0); ! return new; } im_in = XGetImage(dpy, old, 0, 0, oldw, oldh, ~0, ZPixmap); --- 127,151 ---- unsigned int oldw, oldh, border, depth; XImage *im_in, *im_out; ! if (old == None) { ! iw->image.bg = None; ! return; ! } XGetGeometry(dpy, old, &root, &x, &y, &oldw, &oldh, &border, &depth); new = XCreatePixmap(dpy, root, neww, newh, depth); ! if (new == None) { ! iw->image.bg = None; ! return; ! } if (neww == oldw && newh == oldh) { /* just copy the old pixmap */ XCopyArea(dpy, old, new, gc, 0, 0, oldw, oldh, 0, 0); ! iw->image.bg = new; ! return; } im_in = XGetImage(dpy, old, 0, 0, oldw, oldh, ~0, ZPixmap); *************** *** 152,158 **** XDestroyImage(im_in); XDestroyImage(im_out); ! return new; } #define superclass (&coreClassRec) --- 164,170 ---- XDestroyImage(im_in); XDestroyImage(im_out); ! iw->image.bg = new; } #define superclass (&coreClassRec) *************** *** 166,211 **** (*superclass->core_class.realize)(w, valueMask, attributes); iw->image.gc = XCreateGC(XtDisplay(w), XtWindow(w), valuemask, &values); iw->image.bg = None; } static void Destroy(Widget w) { ImageWidget iw = (ImageWidget)w; XFreeGC(XtDisplay(w), iw->image.gc); } ! static void Redisplay(Widget w, XEvent *event, Region r) { ImageWidget iw = (ImageWidget)w; ! if (iw->image.bg == None) Resize(w); if (iw->image.bg == None) return; XCopyArea(XtDisplay(w), iw->image.bg, XtWindow(w), iw->image.gc, 0, 0, iw->core.width, iw->core.height, 0, 0); } static void Resize(Widget w) { - unsigned int x, y, ow, oh, nw, nh, brd, dpt; - Pixmap op; - Window root; ImageWidget aw = (ImageWidget) w; ! op = aw->image.bitmap; ! XGetGeometry(XtDisplay(w), op, &root, ! &x, &y, &ow, &oh, &brd, &dpt); ! nw = aw->core.width; ! nh = aw->core.height; ! ! if (XtIsRealized(w)) { ! Pixmap oldbg = aw->image.bg; ! aw->image.bg = scale_pixmap(XtDisplay(w), ! aw->image.gc, aw->image.bitmap, nw, nh); ! if (oldbg != None) ! XFreePixmap(XtDisplay(w), oldbg); ! } else { ! aw->image.bg = None; ! } } static Boolean SetValues(Widget current, Widget request, Widget new, --- 178,226 ---- (*superclass->core_class.realize)(w, valueMask, attributes); iw->image.gc = XCreateGC(XtDisplay(w), XtWindow(w), valuemask, &values); iw->image.bg = None; + iw->image.timeout = None; } static void Destroy(Widget w) { ImageWidget iw = (ImageWidget)w; XFreeGC(XtDisplay(w), iw->image.gc); + if (iw->image.bg) XFreePixmap(XtDisplay(w), iw->image.bg); } ! static void do_redisplay(XtPointer client_data, XtIntervalId *id) { + Widget w = (Widget)client_data; ImageWidget iw = (ImageWidget)w; ! if (!XtIsRealized(w) || iw->image.bitmap == None) return; ! ! if (iw->image.bg == None) scale_pixmap(w); if (iw->image.bg == None) return; + XCopyArea(XtDisplay(w), iw->image.bg, XtWindow(w), iw->image.gc, 0, 0, iw->core.width, iw->core.height, 0, 0); + + iw->image.timeout = None; + } + + static void Redisplay(Widget w, XEvent *event, Region r) + { + ImageWidget iw = (ImageWidget)w; + if (iw->image.timeout) return; /* already set */ + iw->image.timeout = XtAppAddTimeOut( + XtWidgetToApplicationContext(w), + 50, do_redisplay, (XtPointer)w); } static void Resize(Widget w) { ImageWidget aw = (ImageWidget) w; ! if (!XtIsRealized(w)) return; ! ! if (aw->image.bg) XFreePixmap(XtDisplay(w), aw->image.bg); ! aw->image.bg = None; } static Boolean SetValues(Widget current, Widget request, Widget new, diff -crNP ../siag-3.3.4/xcommon/ImageP.h ./xcommon/ImageP.h *** ../siag-3.3.4/xcommon/ImageP.h Thu Apr 6 14:53:30 2000 --- ./xcommon/ImageP.h Sat May 6 08:49:26 2000 *************** *** 1,5 **** /* ! Copyright (C) 1996, 1997 Ulric Eriksson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public --- 1,5 ---- /* ! Copyright (C) 1996-2000 Ulric Eriksson This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public *************** *** 45,50 **** --- 45,51 ---- /* private state */ GC gc; Pixmap bg; + XtIntervalId timeout; } ImagePart; typedef struct s_ImageRec { diff -crNP ../siag-3.3.4/xcommon/Makefile.in ./xcommon/Makefile.in *** ../siag-3.3.4/xcommon/Makefile.in Fri Apr 28 14:47:56 2000 --- ./xcommon/Makefile.in Sat May 6 09:25:08 2000 *************** *** 342,351 **** Notebook.o: Notebook.c ../common/common.h ../common/cmalloc.h \ NotebookP.h Notebook.h Richtext.o: Richtext.c ../common/cmalloc.h ../common/fonts.h xfonts.h \ ! ../config.h ../common/richchar.h embed.h ../common/traceme.h \ ! RichtextP.h Richtext.h ../pw/pw.h ../pw/../common/richchar.h \ ! ../pw/../common/fonts.h ../pw/../common/traceme.h \ ! ../pw/user_interface.h Rudegrid.o: Rudegrid.c RudegridP.h Rudegrid.h Ruler.o: Ruler.c xfonts.h ../config.h ../common/richchar.h RulerP.h \ Ruler.h --- 342,349 ---- Notebook.o: Notebook.c ../common/common.h ../common/cmalloc.h \ NotebookP.h Notebook.h Richtext.o: Richtext.c ../common/cmalloc.h ../common/fonts.h xfonts.h \ ! ../config.h ../common/richchar.h embed.h Ruler.h \ ! ../common/traceme.h RichtextP.h Richtext.h Rudegrid.o: Rudegrid.c RudegridP.h Rudegrid.h Ruler.o: Ruler.c xfonts.h ../config.h ../common/richchar.h RulerP.h \ Ruler.h diff -crNP ../siag-3.3.4/xcommon/Richtext.c ./xcommon/Richtext.c *** ../siag-3.3.4/xcommon/Richtext.c Fri Apr 28 14:34:34 2000 --- ./xcommon/Richtext.c Fri May 5 12:00:45 2000 *************** *** 30,35 **** --- 30,36 ---- #include "xfonts.h" #include #include "embed.h" + #include "Ruler.h" #include "../common/richchar.h" #include "../common/traceme.h" *************** *** 37,42 **** --- 38,47 ---- #include "RichtextP.h" static void plugin_coords(Widget, XtPointer, int *, int *); + static int default_row_height(XtPointer, int); + static int default_adj_horiz(XtPointer, int); + static int default_style(XtPointer, int); + static rich_char *default_text(XtPointer, int); static Boolean default_bop(XtPointer, int); static float floatOne = 1.0; *************** *** 98,104 **** sizeof(int), offset(point_row), XtRImmediate, ! (XtPointer)0 }, { XtNrichtextPointCol, XtCRichtextPointCol, --- 103,109 ---- sizeof(int), offset(point_row), XtRImmediate, ! (XtPointer)1 }, { XtNrichtextPointCol, XtCRichtextPointCol, *************** *** 114,120 **** sizeof(XtPointer), offset(row_height), XtRImmediate, ! (XtPointer)NULL }, { XtNrichtextAdjHoriz, XtCRichtextAdjHoriz, --- 119,125 ---- sizeof(XtPointer), offset(row_height), XtRImmediate, ! (XtPointer)default_row_height }, { XtNrichtextAdjHoriz, XtCRichtextAdjHoriz, *************** *** 122,128 **** sizeof(XtPointer), offset(adj_horiz), XtRImmediate, ! (XtPointer)NULL }, { XtNrichtextStyle, XtCRichtextStyle, --- 127,133 ---- sizeof(XtPointer), offset(adj_horiz), XtRImmediate, ! (XtPointer)default_adj_horiz }, { XtNrichtextStyle, XtCRichtextStyle, *************** *** 130,136 **** sizeof(XtPointer), offset(style), XtRImmediate, ! (XtPointer)NULL }, { XtNrichtextBop, XtCRichtextBop, --- 135,141 ---- sizeof(XtPointer), offset(style), XtRImmediate, ! (XtPointer)default_style }, { XtNrichtextBop, XtCRichtextBop, *************** *** 146,152 **** sizeof(XtPointer), offset(text), XtRImmediate, ! (XtPointer)NULL }, { XtNrichtextData, XtCRichtextData, --- 151,157 ---- sizeof(XtPointer), offset(text), XtRImmediate, ! (XtPointer)default_text }, { XtNrichtextData, XtCRichtextData, *************** *** 170,176 **** sizeof(Boolean), offset(visible_cursor), XtRImmediate, ! (XtPointer)False }, { XtNrichtextPaperWidth, XtCRichtextPaperWidth, --- 175,181 ---- sizeof(Boolean), offset(visible_cursor), XtRImmediate, ! (XtPointer)True }, { XtNrichtextPaperWidth, XtCRichtextPaperWidth, *************** *** 178,184 **** sizeof(int), offset(paper_width), XtRImmediate, ! (XtPointer)595 }, { XtNrichtextLeftMargin, XtCRichtextLeftMargin, --- 183,189 ---- sizeof(int), offset(paper_width), XtRImmediate, ! (XtPointer)0 }, { XtNrichtextLeftMargin, XtCRichtextLeftMargin, *************** *** 186,192 **** sizeof(int), offset(left_margin), XtRImmediate, ! (XtPointer)72 }, { XtNrichtextRightMargin, XtCRichtextRightMargin, --- 191,197 ---- sizeof(int), offset(left_margin), XtRImmediate, ! (XtPointer)0 }, { XtNrichtextRightMargin, XtCRichtextRightMargin, *************** *** 194,200 **** sizeof(int), offset(right_margin), XtRImmediate, ! (XtPointer)72 }, { XtNrichtextTabDistance, XtCRichtextTabDistance, --- 199,205 ---- sizeof(int), offset(right_margin), XtRImmediate, ! (XtPointer)0 }, { XtNrichtextTabDistance, XtCRichtextTabDistance, *************** *** 219,225 **** offset(zoom), XtRFloat, (XtPointer)&floatOne ! } }; #undef offset --- 224,261 ---- offset(zoom), XtRFloat, (XtPointer)&floatOne ! }, { ! XtNrichtextDelay, ! XtCRichtextDelay, ! XtRInt, ! sizeof(int), ! offset(delay), ! XtRImmediate, ! (XtPointer)0 ! }, { ! XtNrichtextFormat, ! XtCRichtextFormat, ! XtRInt, ! sizeof(int), ! offset(format), ! XtRImmediate, ! (XtPointer)0 ! }, { ! XtNrichtextString, ! XtCRichtextString, ! XtRPointer, ! sizeof(XtPointer), ! offset(rc_string), ! XtRImmediate, ! (XtPointer)NULL ! }, { ! XtNrichtextRuler, ! XtCRichtextRuler, ! XtRWidget, ! sizeof(Widget), ! offset(ruler), ! XtRImmediate, ! (XtPointer)None, } }; #undef offset *************** *** 231,240 **** --- 267,303 ---- XtWidgetGeometry *, XtWidgetGeometry *); static void ChangeManaged(Widget); static void Redisplay(Widget, XEvent *, Region); + static void Initialize(Widget, Widget, ArgList, Cardinal *); static void Realize(Widget, XtValueMask *, XSetWindowAttributes *); static void Destroy(Widget); static Boolean SetValues(Widget, Widget, Widget, ArgList, Cardinal *); + static int default_row_height(XtPointer p, int i) + { + RichtextWidget rtw = (RichtextWidget)p; + + if (rtw->richtext.rc_string == NULL || rtw->richtext.rc_string[0].c == '\0') + return 20; + return rc_strheight(rtw->richtext.rc_string, -1); + } + + static int default_adj_horiz(XtPointer p, int i) + { + return HADJ_LEFT; + } + + static int default_style(XtPointer p, int i) + { + return 0; + } + + static rich_char *default_text(XtPointer p, int i) + { + RichtextWidget rw = (RichtextWidget)p; + if (i != 1) return NULL; + return rw->richtext.rc_string; + } + /* by default, do not display Beginning Of Paragraph marks */ static Boolean default_bop(XtPointer p, int i) { *************** *** 247,268 **** } /* actions */ ! static void RichtextAction(Widget, XEvent *, String *, Cardinal *); ! #if 1 ! static void SelfInsertChar(Widget, XEvent *, String *, Cardinal *); ! #endif static XtActionsRec actions[] = { ! {"richtext-action", RichtextAction}, ! #if 1 ! {"self-insert-char", SelfInsertChar}, ! #endif }; /* translations */ static char translations[] = ! ": self-insert-char()\n"; RichtextClassRec richtextClassRec = { { /* core fields */ --- 310,372 ---- } /* actions */ ! static void MoveForwardChar(Widget, XEvent *, String *, Cardinal *); ! static void MoveBackwardChar(Widget, XEvent *, String *, Cardinal *); ! static void MoveToLineStart(Widget, XEvent *, String *, Cardinal *); ! static void MoveToLineEnd(Widget, XEvent *, String *, Cardinal *); ! static void DeleteForwardChar(Widget, XEvent *, String *, Cardinal *); ! static void DeleteBackwardChar(Widget, XEvent *, String *, Cardinal *); ! static void InsertChar(Widget, XEvent *, String *, Cardinal *); ! static void DeleteToEnd(Widget, XEvent *, String *, Cardinal *); ! static void DeleteHighlighted(Widget, XEvent *, String *, Cardinal *); ! static void SelectStart(Widget, XEvent *, String *, Cardinal *); ! static void ExtendAdjust(Widget, XEvent *, String *, Cardinal *); ! static void ExtendEnd(Widget, XEvent *, String *, Cardinal *); ! static void InsertSelection(Widget, XEvent *, String *, Cardinal *); static XtActionsRec actions[] = { ! {"forward-character", MoveForwardChar}, ! {"backward-character", MoveBackwardChar}, ! {"beginning-of-line", MoveToLineStart}, ! {"end-of-line", MoveToLineEnd}, ! {"delete-next-character", DeleteForwardChar}, ! {"delete-previous-character", DeleteBackwardChar}, ! {"insert-char", InsertChar}, ! {"delete-to-end", DeleteToEnd}, ! {"delete-highlighted", DeleteHighlighted}, ! {"select-start", SelectStart}, ! {"extend-adjust", ExtendAdjust}, ! {"extend-end", ExtendEnd}, ! {"insert-selection", InsertSelection}, }; /* translations */ static char translations[] = ! "Home: beginning-of-line() \n" ! ":KP_Home: beginning-of-line() \n" ! "Ctrla: beginning-of-line() \n" ! "End: end-of-line() \n" ! ":KP_End: end-of-line() \n" ! "Ctrle: end-of-line() \n" ! "Right: forward-character() \n" ! ":KP_Right: forward-character() \n" ! "Ctrlf: forward-character() \n" ! "Left: backward-character() \n" ! ":KP_Left: backward-character() \n" ! "Ctrlb: backward-character() \n" ! "Delete: delete-next-character() \n" ! ":KP_Delete: delete-next-character() \n" ! "Ctrld: delete-next-character() \n" ! "BackSpace: delete-previous-character() \n" ! "Ctrlk: delete-to-end() \n" ! "Ctrlw: delete-highlighted() \n" ! ": insert-char()\n" ! ": select-start() \n" ! ": extend-adjust() \n" ! ": extend-end() \n" ! ": insert-selection() \n" ! ; RichtextClassRec richtextClassRec = { { /* core fields */ *************** *** 272,278 **** /* class_initialize */ NULL, /* class_part_initialize */ NULL, /* class_inited */ FALSE, ! /* initialize */ NULL, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ actions, --- 376,382 ---- /* class_initialize */ NULL, /* class_part_initialize */ NULL, /* class_inited */ FALSE, ! /* initialize */ Initialize, /* initialize_hook */ NULL, /* realize */ Realize, /* actions */ actions, *************** *** 340,414 **** /* supporting code copied directly from window.c */ ! static void RichtextAction(Widget w, XEvent *event, String *params, Cardinal *n) { ! ; } ! /* ! This action is extremely messy, being copied from the application code ! of Pathetic Writer. We need to do it like this instead: ! 1. Copy the whole paragraph from pw using copy_line and delete_line. ! The result should be a single richtext string with tabs and newlines ! embedded as needed. ! 2. Convert the point position to an offset within the string. ! 3. Insert the character. ! 4. Move point forward one step. ! 5. Calculate the point position from the offset. ! 6. Repaint the whole paragraph. As we go along, the single string is ! broken up into lines again. ! 7. Insert the paragraph using insert_line. ! ! Any of these events will cause the entire window to be repainted: ! - Point ends up outside the window. ! - The total height of the paragraph changes. ! */ ! #if 1 ! #define ret_hadj ZzZzZ ! #define ret_style XxXxX ! #define line_width CcCcC ! #define line_length VvVvV ! #include "../pw/pw.h" ! #undef ret_hadj ! #undef ret_style ! #undef line_width ! #undef line_length ! static void SelfInsertChar(Widget w, XEvent *event, String *params, Cardinal *n) { - int count, bufsiz = 10; - unsigned char buf[12]; - KeySym keysym; RichtextWidget rw = (RichtextWidget)w; - hide_cur(w_list); count = RichtextLookupString(w, event, buf, bufsiz, &keysym); if (keysym >= ' ' && count == 1) { - int s = w_list->sht; - sheet *st = w_list->buf->sht; buf[count] = '\0'; ! ins_text(w_list->buf, s, ! st[s].point_pos, buf, w_list->current_fmt); ! rebreak_line(w_list->buf, s, st[s].point_pos.row); ! st[s].point_pos.col += count; ! /* point position may now be hosed */ ! if (st[s].point_pos.col > ! line_length(rw, st[s].point_pos.row)) { ! st[s].point_pos.col -= ! line_length(rw, st[s].point_pos.row); ! st[s].point_pos.col -= 1; /* we deleted a space too */ ! st[s].point_pos.row++; ! } ! /* and if that didn't help... */ ! if (st[s].point_pos.col > ! line_length(rw, st[s].point_pos.row)) { ! st[s].point_pos.col = ! line_length(rw, st[s].point_pos.row); ! } ! pr_line_flag = TRUE; } - show_cur(w_list); } ! #endif static GC get_gc(Widget w, unsigned long fg, unsigned long bg, Font font) { --- 444,578 ---- /* supporting code copied directly from window.c */ ! static void MoveForwardChar(Widget w, XEvent *event, String *params, Cardinal *n) { ! RichtextWidget rw = (RichtextWidget)w; ! int i = rw->richtext.point_col; ! rich_char *p = rw->richtext.rc_string; ! ! if (p[i].c) i++; ! rw->richtext.point_col = i; ! Redisplay(w, NULL, None); } ! static void MoveBackwardChar(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! RichtextWidget rw = (RichtextWidget)w; ! int i = rw->richtext.point_col; ! ! if (i) i--; ! rw->richtext.point_col = i; ! Redisplay(w, NULL, None); ! } ! ! static void MoveToLineStart(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! RichtextWidget rw = (RichtextWidget)w; ! rw->richtext.point_col = 0; ! Redisplay(w, NULL, None); ! } ! ! static void MoveToLineEnd(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! RichtextWidget rw = (RichtextWidget)w; ! rw->richtext.point_col = rc_strlen(rw->richtext.rc_string); ! Redisplay(w, NULL, None); ! } ! ! static void DeleteForwardChar(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! RichtextWidget rw = (RichtextWidget)w; ! int i = rw->richtext.point_col; ! rich_char *p = rw->richtext.rc_string; ! if (!p[i].c) return; ! ! rc_strcpy(p+i, p+i+1); ! Redisplay(w, NULL, None); ! } ! ! static void DeleteBackwardChar(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! RichtextWidget rw = (RichtextWidget)w; ! int i = rw->richtext.point_col; ! rich_char *p = rw->richtext.rc_string; ! ! if (!i) return; ! ! i--; ! rc_strcpy(p+i, p+i+1); ! rw->richtext.point_col = i; ! Redisplay(w, NULL, None); ! } ! ! static void InsertChar(Widget w, XEvent *event, String *params, Cardinal *n) { RichtextWidget rw = (RichtextWidget)w; + int count, bufsiz = 100; + unsigned char buf[120]; + rich_char *rp; + KeySym keysym; count = RichtextLookupString(w, event, buf, bufsiz, &keysym); if (keysym >= ' ' && count == 1) { buf[count] = '\0'; ! rp = rc_makerich(buf, rw->richtext.format); ! RichtextInsertText(w, rp, count); ! cfree(rp); ! rw->richtext.point_col += count; ! Redisplay(w, NULL, None); } } ! ! static void DeleteToEnd(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! RichtextWidget rw = (RichtextWidget)w; ! int i = rw->richtext.point_col; ! rich_char *p = rw->richtext.rc_string; ! ! p[i].c = '\0'; ! Redisplay(w, NULL, None); ! } ! ! static void DeleteHighlighted(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! RichtextWidget rw = (RichtextWidget)w; ! rich_char *p = rw->richtext.rc_string; ! ! if (rw->richtext.sel_top_col < 0) return; ! rc_strcpy(p+rw->richtext.sel_top_col, p+rw->richtext.sel_bottom_col); ! rw->richtext.point_col = rw->richtext.sel_top_col; ! rw->richtext.sel_top_col = rw->richtext.sel_bottom_col = -1; ! ! Redisplay(w, NULL, None); ! } ! ! static void SelectStart(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! /*RichtextWidget rw = (RichtextWidget)w;*/ ! ! Redisplay(w, NULL, None); ! } ! ! static void ExtendAdjust(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! /*RichtextWidget rw = (RichtextWidget)w;*/ ! ! Redisplay(w, NULL, None); ! } ! ! static void ExtendEnd(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! /*RichtextWidget rw = (RichtextWidget)w;*/ ! ! Redisplay(w, NULL, None); ! } ! ! static void InsertSelection(Widget w, XEvent *event, String *params, Cardinal *n) ! { ! /*RichtextWidget rw = (RichtextWidget)w;*/ ! ! Redisplay(w, NULL, None); ! } static GC get_gc(Widget w, unsigned long fg, unsigned long bg, Font font) { *************** *** 430,436 **** RichtextWidget rtw = (RichtextWidget)w; unsigned long fg, bg, blockbg; XColor screen_color, exact_color; ! Display *dpy; char *name, *class; XIMStyles *styles; int i; --- 594,600 ---- RichtextWidget rtw = (RichtextWidget)w; unsigned long fg, bg, blockbg; XColor screen_color, exact_color; ! Display *dpy = XtDisplay(w); char *name, *class; XIMStyles *styles; int i; *************** *** 438,458 **** (*superclass->core_class.realize)(w, valueMask, attributes); fg = BlackPixelOfScreen(XtScreen(w)); bg = rtw->core.background_pixel; ! XAllocNamedColor(XtDisplay(w), ! DefaultColormap(XtDisplay(w), DefaultScreen(XtDisplay(w))), "grey", &screen_color, &exact_color); blockbg = screen_color.pixel; rtw->richtext.clear_gc = get_gc(w, bg, fg, -1); rtw->richtext.cell_gc = get_gc(w, fg, blockbg, -1/*get_font(0)*/); rtw->richtext.cursor_gc = get_gc(w, fg^bg, 0, -1); ! XSetFunction(XtDisplay(w), rtw->richtext.cursor_gc, GXxor); ! XSetLineAttributes(XtDisplay(w), rtw->richtext.cursor_gc, 1, LineSolid, CapButt, JoinMiter); #ifdef HAVE_XCREATEIC /* Set up input methods */ - dpy = XtDisplay(w); XtGetApplicationNameAndClass(dpy, &name, &class); rtw->richtext.xim = XOpenIM(dpy, XtDatabase(dpy), name, class); XGetIMValues(rtw->richtext.xim, --- 602,621 ---- (*superclass->core_class.realize)(w, valueMask, attributes); fg = BlackPixelOfScreen(XtScreen(w)); bg = rtw->core.background_pixel; ! XAllocNamedColor(dpy, ! DefaultColormap(dpy, DefaultScreen(dpy)), "grey", &screen_color, &exact_color); blockbg = screen_color.pixel; rtw->richtext.clear_gc = get_gc(w, bg, fg, -1); rtw->richtext.cell_gc = get_gc(w, fg, blockbg, -1/*get_font(0)*/); rtw->richtext.cursor_gc = get_gc(w, fg^bg, 0, -1); ! XSetFunction(dpy, rtw->richtext.cursor_gc, GXxor); ! XSetLineAttributes(dpy, rtw->richtext.cursor_gc, 1, LineSolid, CapButt, JoinMiter); #ifdef HAVE_XCREATEIC /* Set up input methods */ XtGetApplicationNameAndClass(dpy, &name, &class); rtw->richtext.xim = XOpenIM(dpy, XtDatabase(dpy), name, class); XGetIMValues(rtw->richtext.xim, *************** *** 468,474 **** --- 631,646 ---- XNClientWindow, XtWindow(w), (char *)0); #endif + } + + static void Initialize(Widget request, Widget new, ArgList args, Cardinal *n) + { + RichtextWidget rtw = (RichtextWidget)new; + rtw->richtext.timeout = None; + rtw->richtext.plain = NULL; + if (rtw->richtext.data == NULL) + rtw->richtext.data = (XtPointer)new; } static void Destroy(Widget w) *************** *** 574,580 **** else if (hadj == HADJ_RIGHT) x = w-line_width(rtw, row, line_length(rtw, row)); ! return x+rtw->richtext.left_margin; } /* --- --- 746,752 ---- else if (hadj == HADJ_RIGHT) x = w-line_width(rtw, row, line_length(rtw, row)); ! return x+rtw->richtext.left_margin+rtw->richtext.top_col; } /* --- *************** *** 618,629 **** *cur_col = c; } static Boolean move_top(RichtextWidget rtw) { Boolean pr_scr_flag = False; int cur_x, cur_y; ! unsigned int width, height; float zoom = rtw->richtext.zoom; if (rtw->richtext.point_row < rtw->richtext.top_row) { rtw->richtext.top_row = rtw->richtext.point_row; --- 790,807 ---- *cur_col = c; } + /* + Change top_row and top_col so that point is visible. + The unit for top_row is lines of text from the start of the document. + The unit for top_col is unzoomed pixels from the left edge of the paper. + */ static Boolean move_top(RichtextWidget rtw) { Boolean pr_scr_flag = False; int cur_x, cur_y; ! int width, height; float zoom = rtw->richtext.zoom; + int prh; if (rtw->richtext.point_row < rtw->richtext.top_row) { rtw->richtext.top_row = rtw->richtext.point_row; *************** *** 635,647 **** richtext_char2coords(rtw, rtw->richtext.point_row, rtw->richtext.point_col, &cur_x, &cur_y); /* this isn't efficient, but it will work */ while (cur_y < 0) { /* this should never happen */ rtw->richtext.top_row--; cur_y += row_height(rtw, rtw->richtext.top_row); pr_scr_flag = TRUE; } ! while (cur_y + row_height(rtw, rtw->richtext.point_row) > height) { cur_y -= row_height(rtw, rtw->richtext.top_row); rtw->richtext.top_row++; pr_scr_flag = TRUE; --- 813,835 ---- richtext_char2coords(rtw, rtw->richtext.point_row, rtw->richtext.point_col, &cur_x, &cur_y); + /* cur_x and cur_y are in unzoomed pixels */ + + if (cur_x < 0) { + rtw->richtext.top_col -= cur_x; + pr_scr_flag = TRUE; + } else if (cur_x-width > 0) { + rtw->richtext.top_col -= cur_x-width; + pr_scr_flag = TRUE; + } /* this isn't efficient, but it will work */ while (cur_y < 0) { /* this should never happen */ rtw->richtext.top_row--; cur_y += row_height(rtw, rtw->richtext.top_row); pr_scr_flag = TRUE; } ! prh = row_height(rtw, rtw->richtext.point_row); ! while (cur_y + prh > height) { cur_y -= row_height(rtw, rtw->richtext.top_row); rtw->richtext.top_row++; pr_scr_flag = TRUE; *************** *** 725,735 **** XSetForeground(display, gc, color); if (inblock(rtw, row, i)) { rc_draw(cell_win, gc, ! x_base, y_base+height, line[i], 1, zoom); } else { rc_draw(cell_win, gc, ! x_base, y_base+height, line[i], 0, zoom); } if (b[0] == '\t') { --- 913,923 ---- XSetForeground(display, gc, color); if (inblock(rtw, row, i)) { rc_draw(cell_win, gc, ! 0, 0, x_base, y_base+height, line[i], 1, zoom); } else { rc_draw(cell_win, gc, ! 0, 0, x_base, y_base+height, line[i], 0, zoom); } if (b[0] == '\t') { *************** *** 773,778 **** --- 961,967 ---- { int i, y_base; unsigned int height; + float zoom = rtw->richtext.zoom; height = rtw->core.height; y_base = 0; *************** *** 807,826 **** return scribble; } - #if 0 - static void Redisplay(Widget w, XEvent *xevent, Region r) - { - #else static void do_redisplay(XtPointer client_data, XtIntervalId *id) { Widget w = (Widget)client_data; - #endif Pixmap scribble; GC gc; unsigned long valuemask = 0; XGCValues values; RichtextWidget rtw = (RichtextWidget)w; scribble = richtext_pixmap(rtw); if (scribble == None) return; gc = XCreateGC(XtDisplay(w), XtWindow(w), --- 996,1012 ---- return scribble; } static void do_redisplay(XtPointer client_data, XtIntervalId *id) { Widget w = (Widget)client_data; Pixmap scribble; GC gc; unsigned long valuemask = 0; XGCValues values; RichtextWidget rtw = (RichtextWidget)w; + move_top(rtw); + scribble = richtext_pixmap(rtw); if (scribble == None) return; gc = XCreateGC(XtDisplay(w), XtWindow(w), *************** *** 837,851 **** /* clear the timeout */ rtw->richtext.timeout = None; } static void Redisplay(Widget w, XEvent *event, Region r) { RichtextWidget tw = (RichtextWidget)w; if (tw->richtext.timeout) return; /* already set */ ! tw->richtext.timeout = XtAppAddTimeOut( ! XtWidgetToApplicationContext(w), ! 50, do_redisplay, (XtPointer)w); } static Boolean SetValues(Widget current, Widget request, Widget new, --- 1023,1046 ---- /* clear the timeout */ rtw->richtext.timeout = None; + if (rtw->richtext.ruler) { + XtVaSetValues(rtw->richtext.ruler, + XtNrulerTopCol, rtw->richtext.top_col, + (char *)0); + } } static void Redisplay(Widget w, XEvent *event, Region r) { RichtextWidget tw = (RichtextWidget)w; if (tw->richtext.timeout) return; /* already set */ ! if (tw->richtext.delay) { ! tw->richtext.timeout = XtAppAddTimeOut( ! XtWidgetToApplicationContext(w), ! tw->richtext.delay, do_redisplay, (XtPointer)w); ! } else { ! do_redisplay((XtPointer)w, NULL); ! } } static Boolean SetValues(Widget current, Widget request, Widget new, *************** *** 956,960 **** --- 1151,1190 ---- rw->richtext.zoom = zoom; Redisplay(w, NULL, None); } + } + + /* + Functions that allow this widget to replace TextField with a minimum of effort. + */ + void RichtextSetString(Widget w, char *p) + { + RichtextWidget rw = (RichtextWidget)w; + + cfree(rw->richtext.rc_string); + rw->richtext.rc_string = rc_makerich((unsigned char *)p, + rw->richtext.format); + Redisplay(w, NULL, None); + } + + char *RichtextGetString(Widget w) + { + RichtextWidget rw = (RichtextWidget)w; + cfree(rw->richtext.plain); + rw->richtext.plain = (char *)rc_makeplain(rw->richtext.rc_string); + return rw->richtext.plain; + } + + void RichtextInsertText(Widget w, rich_char *buf, int count) + { + RichtextWidget rw = (RichtextWidget)w; + int i = rw->richtext.point_col; + rich_char *p = rw->richtext.rc_string; + int n = rc_strlen(p); + rich_char *q = cmalloc((n+count+1)*sizeof *q); + rc_strncpy(q, p, i); + rc_strncpy(q+i, buf, count); + rc_strcpy(q+i+count, p+i); + rw->richtext.rc_string = q; + cfree(p); } diff -crNP ../siag-3.3.4/xcommon/Richtext.h ./xcommon/Richtext.h *** ../siag-3.3.4/xcommon/Richtext.h Tue Apr 25 05:45:12 2000 --- ./xcommon/Richtext.h Fri May 5 02:35:46 2000 *************** *** 69,74 **** --- 69,78 ---- #define XtNrichtextTabDistance "richtextTabDistance" #define XtNrichtextPluginCoords "richtextPluginCoords" #define XtNrichtextBop "richtextBop" + #define XtNrichtextFormat "richtextFormat" + #define XtNrichtextString "richtextString" + #define XtNrichtextDelay "richtextDelay" + #define XtNrichtextRuler "richtextRuler" #define XtNzoom "zoom" #define XtCRichtextTopRow "RichtextTopRow" *************** *** 92,97 **** --- 96,105 ---- #define XtCRichtextTabDistance "RichtextTabDistance" #define XtCRichtextPluginCoords "RichtextPluginCoords" #define XtCRichtextBop "RichtextBop" + #define XtCRichtextFormat "RichtextFormat" + #define XtCRichtextString "RichtextString" + #define XtCRichtextDelay "RichtextDelay" + #define XtCRichtextRuler "RichtextRuler" #define XtCZoom "Zoom" /* declare specific RichtextWidget class and instance datatypes */ *************** *** 107,112 **** --- 115,123 ---- extern void rt_pr_line(Widget, int); extern int RichtextLookupString(Widget, XEvent *, char *, int, KeySym *); extern void RichtextSetZoom(Widget, float); + extern void RichtextSetString(Widget, char *); + extern char *RichtextGetString(Widget); + extern void RichtextInsertText(Widget, rich_char *, int); #endif /* s_Richtext_h */ diff -crNP ../siag-3.3.4/xcommon/RichtextP.h ./xcommon/RichtextP.h *** ../siag-3.3.4/xcommon/RichtextP.h Fri Apr 28 14:29:59 2000 --- ./xcommon/RichtextP.h Fri May 5 02:31:22 2000 *************** *** 60,70 **** --- 60,75 ---- void (*plugin_coords)(Widget, XtPointer, int *, int *); Boolean (*bop)(XtPointer, int); float zoom; + int format; + rich_char *rc_string; + int delay; + Widget ruler; /* private state */ GC clear_gc; GC cell_gc; GC cursor_gc; XtIntervalId timeout; + char *plain; #ifdef HAVE_XCREATEIC XIM xim; XIC xic; diff -crNP ../siag-3.3.4/xcommon/Ruler.c ./xcommon/Ruler.c *** ../siag-3.3.4/xcommon/Ruler.c Fri Apr 28 11:12:32 2000 --- ./xcommon/Ruler.c Fri May 5 10:20:36 2000 *************** *** 67,72 **** --- 67,80 ---- XtRImmediate, (XtPointer)36 }, { + XtNrulerTopCol, + XtCRulerTopCol, + XtRInt, + sizeof(int), + offset(top_col), + XtRImmediate, + (XtPointer)0 + }, { XtNzoom, XtCZoom, XtRFloat, *************** *** 169,175 **** float zoom = aw->ruler.zoom; o = -1; ! for (i = aw->ruler.left_margin+1; i < aw->ruler.paper_width-aw->ruler.right_margin; i += aw->ruler.tab_distance) { XSetForeground(dpy, gc, white); --- 177,183 ---- float zoom = aw->ruler.zoom; o = -1; ! for (i = aw->ruler.left_margin+aw->ruler.top_col+1; i < aw->ruler.paper_width-aw->ruler.right_margin; i += aw->ruler.tab_distance) { XSetForeground(dpy, gc, white); *************** *** 194,199 **** --- 202,208 ---- Boolean do_redisplay = (rw1->ruler.tab_distance != rw2->ruler.tab_distance) || (rw1->ruler.zoom != rw2->ruler.zoom) + || (rw1->ruler.top_col != rw2->ruler.top_col) || (rw1->ruler.left_margin != rw2->ruler.left_margin) || (rw1->ruler.right_margin != rw2->ruler.right_margin) || (rw1->ruler.paper_width != rw2->ruler.paper_width); diff -crNP ../siag-3.3.4/xcommon/Ruler.h ./xcommon/Ruler.h *** ../siag-3.3.4/xcommon/Ruler.h Tue Apr 25 05:44:01 2000 --- ./xcommon/Ruler.h Fri May 5 02:32:29 2000 *************** *** 63,68 **** --- 63,72 ---- #define XtNtabDistance "tabDistance" #define XtCTabDistance "TabDistance" #endif + #ifndef XtNrulerTopCol + #define XtNrulerTopCol "rulerTopCol" + #define XtCRulerTopCol "RulerTopCol" + #endif #ifndef XtNzoom #define XtNzoom "zoom" #define XtCZoom "Zoom" diff -crNP ../siag-3.3.4/xcommon/RulerP.h ./xcommon/RulerP.h *** ../siag-3.3.4/xcommon/RulerP.h Tue Apr 25 05:42:39 2000 --- ./xcommon/RulerP.h Fri May 5 02:31:49 2000 *************** *** 45,50 **** --- 45,51 ---- int paper_width; int tab_distance; float zoom; + int top_col; /* private state */ GC gc; } RulerPart; diff -crNP ../siag-3.3.4/xcommon/Table.c ./xcommon/Table.c *** ../siag-3.3.4/xcommon/Table.c Fri Apr 28 14:19:44 2000 --- ./xcommon/Table.c Sat May 6 08:18:01 2000 *************** *** 418,424 **** && c >= tw->table.sel_left_col && c <= tw->table.sel_right_col; } ! static void draw_cell(TableWidget tw, Drawable scribble, int row, int col, int x_base, int y_base) { --- 418,426 ---- && c >= tw->table.sel_left_col && c <= tw->table.sel_right_col; } ! /* ! x_base and y_base are in zoomed pixel coordinates ! */ static void draw_cell(TableWidget tw, Drawable scribble, int row, int col, int x_base, int y_base) { *************** *** 496,536 **** } rc_strdraw(scribble, cell_gc, ! x_base+x_pos, y_base+y_pos, rcp, -1, zoom); cfree(rcp); XSetForeground(dpy, grid_gc, tw->table.black); if (tw->table.grid_lines) { ! int x1 = zoom*x_base, y1 = zoom*y_base; ! int x2 = zoom*(x_base+cw-1), y2 = zoom*(y_base+ch-1); XDrawLine(dpy, scribble, grid_gc, x1, y2, x2, y2); XDrawLine(dpy, scribble, grid_gc, x2, y2, x2, y1); } /* these lines are from the format */ if (siagfmt & BORDER_LEFT) ! XDrawLine(dpy, scribble, grid_gc, zoom*x_base, zoom*y_base, ! zoom*x_base, zoom*(y_base+ch-2)); if (siagfmt & BORDER_RIGHT) XDrawLine(dpy, scribble, grid_gc, ! zoom*(x_base+cw-2), zoom*(y_base), ! zoom*(x_base+cw-2), zoom*(y_base+ch-2)); if (siagfmt & BORDER_TOP) XDrawLine(dpy, scribble, grid_gc, ! zoom*x_base, zoom*y_base, ! zoom*(x_base+cw-2), zoom*y_base); if (siagfmt & BORDER_BOTTOM) XDrawLine(dpy, scribble, grid_gc, ! zoom*x_base, zoom*(y_base+ch-2), ! zoom*(x_base+cw-2), zoom*(y_base+ch-2)); XSetForeground(dpy, grid_gc, WhitePixelOfScreen(XtScreen(w))); if (tw->table.threeD) { XDrawLine(dpy, scribble, grid_gc, ! zoom*x_base, zoom*y_base, ! zoom*x_base, zoom*(y_base+ch-2)); XDrawLine(dpy, scribble, grid_gc, ! zoom*x_base, zoom*y_base, ! zoom*(x_base+cw-2), zoom*y_base); } } --- 498,538 ---- } rc_strdraw(scribble, cell_gc, ! x_base, y_base, x_pos, y_pos, rcp, -1, zoom); cfree(rcp); XSetForeground(dpy, grid_gc, tw->table.black); if (tw->table.grid_lines) { ! int x1 = x_base, y1 = y_base; ! int x2 = x_base+zoom*(cw-1), y2 = y_base+zoom*(ch-1); XDrawLine(dpy, scribble, grid_gc, x1, y2, x2, y2); XDrawLine(dpy, scribble, grid_gc, x2, y2, x2, y1); } /* these lines are from the format */ if (siagfmt & BORDER_LEFT) ! XDrawLine(dpy, scribble, grid_gc, x_base, y_base, ! x_base, y_base+zoom*(ch-2)); if (siagfmt & BORDER_RIGHT) XDrawLine(dpy, scribble, grid_gc, ! x_base+zoom*(cw-2), y_base, ! x_base+zoom*(cw-2), y_base+zoom*(ch-2)); if (siagfmt & BORDER_TOP) XDrawLine(dpy, scribble, grid_gc, ! x_base, y_base, ! x_base+zoom*(cw-2), y_base); if (siagfmt & BORDER_BOTTOM) XDrawLine(dpy, scribble, grid_gc, ! x_base, y_base+zoom*(ch-2), ! x_base+zoom*(cw-2), y_base+zoom*(ch-2)); XSetForeground(dpy, grid_gc, WhitePixelOfScreen(XtScreen(w))); if (tw->table.threeD) { XDrawLine(dpy, scribble, grid_gc, ! x_base, y_base, ! x_base, y_base+zoom*(ch-2)); XDrawLine(dpy, scribble, grid_gc, ! x_base, y_base, ! x_base+zoom*(cw-2), y_base); } } *************** *** 550,565 **** if (inblock(tw, row, col)) { XFillRectangle(XtDisplay(w), scribble, tw->table.block_gc, ! zoom*x_base, zoom*y_base, zoom*cw, zoom*ch); } else { color_index = return_bgcolor(w, row, col); color = get_color(color_index); XSetForeground(XtDisplay(w), tw->table.cell_gc, color); XFillRectangle(XtDisplay(w), scribble, tw->table.cell_gc, ! zoom*x_base, zoom*y_base, zoom*cw, zoom*ch); } } static void cell_row(TableWidget tw, Drawable scribble, int width, int y_base, int i) { --- 552,569 ---- if (inblock(tw, row, col)) { XFillRectangle(XtDisplay(w), scribble, tw->table.block_gc, ! x_base, y_base, zoom*cw, zoom*ch); } else { color_index = return_bgcolor(w, row, col); color = get_color(color_index); XSetForeground(XtDisplay(w), tw->table.cell_gc, color); XFillRectangle(XtDisplay(w), scribble, tw->table.cell_gc, ! x_base, y_base, zoom*cw, zoom*ch); } } + /* + y_base is in zoomed pixels */ static void cell_row(TableWidget tw, Drawable scribble, int width, int y_base, int i) { *************** *** 567,589 **** float zoom = tw->table.zoom; x_base = 0; ! for (j = 1; (j < tw->table.prot_col) && (zoom*x_base < width); j++) { erase_cell(tw, scribble, i, j, x_base, y_base); ! x_base += cell_width(tw, j); } ! for (j = tw->table.top_col; zoom*x_base < width; j++) { erase_cell(tw, scribble, i, j, x_base, y_base); ! x_base += cell_width(tw, j); } x_base = 0; ! for (j = 1; (j < tw->table.prot_col) && (zoom*x_base < width); j++) { draw_cell(tw, scribble, i, j, x_base, y_base); ! x_base += cell_width(tw, j); } ! for (j = tw->table.top_col; zoom*x_base < width; j++) { draw_cell(tw, scribble, i, j, x_base, y_base); ! x_base += cell_width(tw, j); } } --- 571,593 ---- float zoom = tw->table.zoom; x_base = 0; ! for (j = 1; (j < tw->table.prot_col) && (x_base < width); j++) { erase_cell(tw, scribble, i, j, x_base, y_base); ! x_base += zoom*cell_width(tw, j); } ! for (j = tw->table.top_col; x_base < width; j++) { erase_cell(tw, scribble, i, j, x_base, y_base); ! x_base += zoom*cell_width(tw, j); } x_base = 0; ! for (j = 1; (j < tw->table.prot_col) && (x_base < width); j++) { draw_cell(tw, scribble, i, j, x_base, y_base); ! x_base += zoom*cell_width(tw, j); } ! for (j = tw->table.top_col; x_base < width; j++) { draw_cell(tw, scribble, i, j, x_base, y_base); ! x_base += zoom*cell_width(tw, j); } } *************** *** 595,607 **** int i; float zoom = tw->table.zoom; ! for (i = 1; (i < tw->table.prot_row) && (zoom*y_base < height); i++) { cell_row(tw, d, width, y_base, i); ! y_base += cell_height(tw, i); } ! for (i = tw->table.top_row; zoom*y_base < height; i++) { cell_row(tw, d, width, y_base, i); ! y_base += cell_height(tw, i); } } --- 599,611 ---- int i; float zoom = tw->table.zoom; ! for (i = 1; (i < tw->table.prot_row) && (y_base < height); i++) { cell_row(tw, d, width, y_base, i); ! y_base += zoom*cell_height(tw, i); } ! for (i = tw->table.top_row; y_base < height; i++) { cell_row(tw, d, width, y_base, i); ! y_base += zoom*cell_height(tw, i); } } *************** *** 631,640 **** /* --- */ ! void table_cell2coords(TableWidget tw, int cell_row, int cell_col, int *cell_x, int *cell_y) { int i; *cell_y = 0; for (i = 1; i < tw->table.prot_row; i++) --- 635,645 ---- /* --- */ ! void table_cell2coords(Widget w, int cell_row, int cell_col, int *cell_x, int *cell_y) { + TableWidget tw = (TableWidget)w; int i; *cell_y = 0; for (i = 1; i < tw->table.prot_row; i++) *************** *** 662,667 **** --- 667,709 ---- } } + void table_zoomed_cell2coords(Widget w, + int cell_row, int cell_col, + int *cell_x, int *cell_y) + { + TableWidget tw = (TableWidget)w; + float zoom = tw->table.zoom; + int i; + *cell_y = 0; + + for (i = 1; i < tw->table.prot_row; i++) + *cell_y += zoom*cell_height(tw, i); + + while (cell_row < tw->table.top_row) { + *cell_y -= zoom*cell_height(tw, cell_row); + cell_row = cell_next_row(tw, cell_row); + } + + while (cell_row > tw->table.top_row) { + cell_row = cell_prev_row(tw, cell_row); + *cell_y += zoom*cell_height(tw, cell_row); + } + + *cell_x = 0; + for (i = 1; i < tw->table.prot_col; i++) + *cell_x += zoom*cell_width(tw, i); + + while (cell_col < tw->table.top_col) { + *cell_x -= zoom*cell_width(tw, cell_col); + cell_col = cell_next_col(tw, cell_col); + } + + while (cell_col > tw->table.top_col) { + cell_col = cell_prev_col(tw, cell_col); + *cell_x += zoom*cell_width(tw, cell_col); + } + } + /* --- */ void table_coords2cell(TableWidget tw, *************** *** 803,809 **** width = tw->core.width/zoom; /* unzoomed size */ height = tw->core.height/zoom; ! table_cell2coords(tw, tw->table.point_row, tw->table.point_col, &cur_x, &cur_y); /* this isn't efficient, but it will work */ --- 845,851 ---- width = tw->core.width/zoom; /* unzoomed size */ height = tw->core.height/zoom; ! table_cell2coords((Widget)tw, tw->table.point_row, tw->table.point_col, &cur_x, &cur_y); /* this isn't efficient, but it will work */ *************** *** 838,844 **** unsigned long bg; float zoom = tw->table.zoom; ! table_cell2coords(tw, row, col, &cur_x, &cur_y); if (row >= tw->table.sel_top_row && row <= tw->table.sel_bottom_row && col >= tw->table.sel_left_col && col <= tw->table.sel_right_col) { bg = tw->table.grey; --- 880,886 ---- unsigned long bg; float zoom = tw->table.zoom; ! table_zoomed_cell2coords((Widget)tw, row, col, &cur_x, &cur_y); if (row >= tw->table.sel_top_row && row <= tw->table.sel_bottom_row && col >= tw->table.sel_left_col && col <= tw->table.sel_right_col) { bg = tw->table.grey; *************** *** 848,865 **** XSetForeground(XtDisplay((Widget)tw), gc, tw->table.black^bg); XDrawRectangle(XtDisplay((Widget)tw), XtWindow((Widget)tw), tw->table.cursor_gc, ! zoom*(cur_x+2), zoom*(cur_y+2), ! zoom*(cell_width(tw, col)-5), zoom*(cell_height(tw, row)-5)); } - #if 0 - static void Redisplay(Widget w, XEvent *event, Region r) - { - #else static void do_redisplay(XtPointer client_data, XtIntervalId *id) { Widget w = (Widget)client_data; - #endif Pixmap scribble; GC gc; unsigned long valuemask = 0; --- 890,902 ---- XSetForeground(XtDisplay((Widget)tw), gc, tw->table.black^bg); XDrawRectangle(XtDisplay((Widget)tw), XtWindow((Widget)tw), tw->table.cursor_gc, ! cur_x+2, cur_y+2, ! zoom*cell_width(tw, col)-5, zoom*cell_height(tw, row)-5); } static void do_redisplay(XtPointer client_data, XtIntervalId *id) { Widget w = (Widget)client_data; Pixmap scribble; GC gc; unsigned long valuemask = 0; *************** *** 952,973 **** static void DoLayout(TableWidget sw) { int i; ! int x, y, top_x, top_y, prot_x, prot_y; ! float zoom = sw->table.zoom; - if (sw->composite.num_children) { - table_global_coords(sw, - sw->table.prot_row, sw->table.prot_col, - &prot_x, &prot_y); - table_global_coords(sw, - sw->table.top_row, sw->table.top_col, - &top_x, &top_y); - } for (i = 0; i < sw->composite.num_children; i++) { (*sw->table.plugin_coords)(sw->composite.children[i], sw->table.data, &x, &y); ! XtMoveWidget(sw->composite.children[i], ! zoom*(x-top_x+prot_x), zoom*(y-top_y+prot_y)); } } --- 989,1000 ---- static void DoLayout(TableWidget sw) { int i; ! int x, y; for (i = 0; i < sw->composite.num_children; i++) { (*sw->table.plugin_coords)(sw->composite.children[i], sw->table.data, &x, &y); ! XtMoveWidget(sw->composite.children[i], x, y); } } diff -crNP ../siag-3.3.4/xcommon/Table.h ./xcommon/Table.h *** ../siag-3.3.4/xcommon/Table.h Thu Apr 27 17:13:32 2000 --- ./xcommon/Table.h Fri May 5 11:06:04 2000 *************** *** 141,146 **** --- 141,148 ---- extern WidgetClass tableWidgetClass; + extern void table_cell2coords(Widget, int, int, int *, int *); + extern void table_zoomed_cell2coords(Widget, int, int, int *, int *); extern Pixmap table_pixmap(Widget); extern void TableSetZoom(Widget, float); diff -crNP ../siag-3.3.4/xcommon/fonts.c ./xcommon/fonts.c *** ../siag-3.3.4/xcommon/fonts.c Fri Apr 28 13:45:25 2000 --- ./xcommon/fonts.c Fri May 5 11:47:04 2000 *************** *** 375,388 **** char *x_fmt; int i = 0; int res_x, res_y; /* screen resolution */ - #if 0 - int screen = DefaultScreen(dpy); - - res_x = DisplayWidth(dpy, screen)/(DisplayWidthMM(dpy, screen)/25.4); - res_y = DisplayHeight(dpy, screen)/(DisplayHeightMM(dpy, screen)/25.4); - #else /* cheat to get ps right */ res_x = res_y = 72*zoom; - #endif if (bold) i += 2; if (italic) i += 1; --- 375,381 ---- *************** *** 800,805 **** --- 793,808 ---- return; lastfont = newfont; if (newfont == -1) return; /* starter mark */ + + /* set color */ + name = color_table[format_table[newfont].fg].red; + fprintf(fp, "%f ", (float) name / 65535.0); + name = color_table[format_table[newfont].fg].green; + fprintf(fp, "%f ", (float) name / 65535.0); + name = color_table[format_table[newfont].fg].blue; + fprintf(fp, "%f ", (float) name / 65535.0); + fprintf(fp, "setrgbcolor\n"); + name = font_table[newfont].name; fprintf(fp, "/%s%s findfont\n", ps_fontname(newfont), *************** *** 886,893 **** x and y are the unzoomed coordinates, i.e. if x=10 and zoom=2.0, the text will be drawn at x=20. */ ! int rc_draw(Drawable d, GC gc, int x, int y, rich_char c, int opaque, ! float zoom) { static int format_index = -1; static sfmt fmt; --- 889,896 ---- x and y are the unzoomed coordinates, i.e. if x=10 and zoom=2.0, the text will be drawn at x=20. */ ! int rc_draw(Drawable d, GC gc, int xo, int yo, ! int x, int y, rich_char c, int opaque, float zoom) { static int format_index = -1; static sfmt fmt; *************** *** 936,963 **** } else { XSetFont(t1_dpy, gc, font); if (opaque) XDrawImageString(t1_dpy, d, gc, ! zoom*x, zoom*(y+vadj), &c.c, 1); else XDrawString(t1_dpy, d, gc, ! zoom*x, zoom*(y+vadj), &c.c, 1); } if (format_table[c.fmt].uline) { width = rc_width(c); XDrawLine(t1_dpy, d, gc, ! zoom*x, zoom*(y+1), zoom*(x+width), zoom*(y+1)); } return 0; } ! int rc_strdraw(Drawable d, GC gc, int x, int y, rich_char *p, int len, ! float zoom) { int i; if (len == -1) len = rc_strlen(p); for (i = 0; i < len; i++) { ! rc_draw(d, gc, x, y, p[i], 0, zoom); x += rc_width(p[i]); } return 0; --- 939,967 ---- } else { XSetFont(t1_dpy, gc, font); if (opaque) XDrawImageString(t1_dpy, d, gc, ! xo+zoom*x, yo+zoom*(y+vadj), &c.c, 1); else XDrawString(t1_dpy, d, gc, ! xo+zoom*x, yo+zoom*(y+vadj), &c.c, 1); } if (format_table[c.fmt].uline) { width = rc_width(c); XDrawLine(t1_dpy, d, gc, ! xo+zoom*x, yo+zoom*(y+1), ! xo+zoom*(x+width), yo+zoom*(y+1)); } return 0; } ! int rc_strdraw(Drawable d, GC gc, int xo, int yo, ! int x, int y, rich_char *p, int len, float zoom) { int i; if (len == -1) len = rc_strlen(p); for (i = 0; i < len; i++) { ! rc_draw(d, gc, xo, yo, x, y, p[i], 0, zoom); x += rc_width(p[i]); } return 0; diff -crNP ../siag-3.3.4/xcommon/xfonts.h ./xcommon/xfonts.h *** ../siag-3.3.4/xcommon/xfonts.h Thu Apr 27 02:23:41 2000 --- ./xcommon/xfonts.h Fri May 5 02:10:08 2000 *************** *** 81,88 **** extern int rc_strwidth(rich_char *, int); extern int rc_strheight(rich_char *, int); extern void rc_strgeom(rich_char *, int, int *, int *); ! extern int rc_draw(Drawable, GC, int, int, rich_char, int, float); ! extern int rc_strdraw(Drawable, GC, int, int, rich_char *, int, float); extern int t1_getfontid(char *); extern char *t1_getfontname(int); extern int t1_init(Widget); --- 81,88 ---- extern int rc_strwidth(rich_char *, int); extern int rc_strheight(rich_char *, int); extern void rc_strgeom(rich_char *, int, int *, int *); ! extern int rc_draw(Drawable, GC, int, int, int, int, rich_char, int, float); ! extern int rc_strdraw(Drawable, GC, int, int, int, int, rich_char *, int, float); extern int t1_getfontid(char *); extern char *t1_getfontname(int); extern int t1_init(Widget); diff -crNP ../siag-3.3.4/xpw/Pw.ad ./xpw/Pw.ad *** ../siag-3.3.4/xpw/Pw.ad Thu Apr 27 08:47:42 2000 --- ./xpw/Pw.ad Tue May 2 17:39:20 2000 *************** *** 83,88 **** --- 83,89 ---- Pw*grid.gridWidth: 4 Pw*grid.background: white Pw*grid.borderWidth: 0 + Pw*grid.richtextDelay: 50 Pw*vscroll.gridx: 4 Pw*vscroll.gridHeight: 2 *************** *** 183,191 **** c: self-insert-char() \n\ :F4: execute(more complicated test) \n\ :a: self-insert-char() \n\ ! :A: self-insert-char() - ! : self-insert-char() Pw*plugin-parent.translations:\ : plugin-resize() \n\ --- 184,192 ---- c: self-insert-char() \n\ :F4: execute(more complicated test) \n\ :a: self-insert-char() \n\ ! :A: self-insert-char() \n\ ! : self-insert-char() Pw*plugin-parent.translations:\ : plugin-resize() \n\ diff -crNP ../siag-3.3.4/xpw/app-defaults.h ./xpw/app-defaults.h *** ../siag-3.3.4/xpw/app-defaults.h Thu Apr 27 08:47:44 2000 --- ./xpw/app-defaults.h Tue May 2 17:39:22 2000 *************** *** 59,64 **** --- 59,65 ---- "Pw*grid.gridWidth: 4", "Pw*grid.background: white", "Pw*grid.borderWidth: 0", + "Pw*grid.richtextDelay: 50", "Pw*vscroll.gridx: 4", "Pw*vscroll.gridHeight: 2", "Pw*vscroll.orientation: vertical", *************** *** 148,154 **** c: self-insert-char() \\n\ :F4: execute(more complicated test) \\n\ :a: self-insert-char() \\n\ ! :A: self-insert-char()", "Pw*plugin-parent.translations:\ : plugin-resize() \\n\ :: plugin-cursor()", --- 149,156 ---- c: self-insert-char() \\n\ :F4: execute(more complicated test) \\n\ :a: self-insert-char() \\n\ ! :A: self-insert-char() \\n\ ! : self-insert-char()", "Pw*plugin-parent.translations:\ : plugin-resize() \\n\ :: plugin-cursor()", diff -crNP ../siag-3.3.4/xpw/window.c ./xpw/window.c *** ../siag-3.3.4/xpw/window.c Fri Apr 28 13:46:15 2000 --- ./xpw/window.c Fri May 5 07:28:39 2000 *************** *** 622,627 **** --- 622,680 ---- show_cur(w_list); } + /* + This action is extremely messy, being copied from the application code + of Pathetic Writer. We need to do it like this instead: + 1. Copy the whole paragraph from pw using copy_line and delete_line. + The result should be a single richtext string with tabs and newlines + embedded as needed. + 2. Convert the point position to an offset within the string. + 3. Insert the character. + 4. Move point forward one step. + 5. Calculate the point position from the offset. + 6. Repaint the whole paragraph. As we go along, the single string is + broken up into lines again. + 7. Insert the paragraph using insert_line. + + Any of these events will cause the entire window to be repainted: + - Point ends up outside the window. + - The total height of the paragraph changes. + */ + static void SelfInsertChar(Widget w, XEvent *event, String *params, Cardinal *n) + { + int count, bufsiz = 10; + unsigned char buf[12]; + KeySym keysym; + + hide_cur(w_list); + count = RichtextLookupString(w, event, buf, bufsiz, &keysym); + if (keysym >= ' ' && count == 1) { + int s = w_list->sht; + sheet *st = w_list->buf->sht; + buf[count] = '\0'; + ins_text(w_list->buf, s, + st[s].point_pos, buf, w_list->current_fmt); + rebreak_line(w_list->buf, s, st[s].point_pos.row); + st[s].point_pos.col += count; + /* point position may now be hosed */ + if (st[s].point_pos.col > + line_length(w_list->buf, s, st[s].point_pos.row)) { + st[s].point_pos.col -= + line_length(w_list->buf, s, st[s].point_pos.row); + st[s].point_pos.col -= 1; /* we deleted a space too */ + st[s].point_pos.row++; + } + /* and if that didn't help... */ + if (st[s].point_pos.col > + line_length(w_list->buf, s, st[s].point_pos.row)) { + st[s].point_pos.col = + line_length(w_list->buf, s, st[s].point_pos.row); + } + pr_line_flag = TRUE; + } + show_cur(w_list); + } + static LISP ltooltip_mode(LISP newmode) { int mode = get_c_long(newmode); *************** *** 727,732 **** --- 780,786 ---- XtNrichtextPointRow, st[s].point_pos.row, XtNrichtextPointCol, st[s].point_pos.col, XtNrichtextPluginCoords, tplugin_coordinates, + XtNrichtextRuler, w->ui->ruler, (char *)0); XDefineCursor(display, XtWindow(w->ui->grid), grid_cursor); w->ui->vscroll = XtVaCreateManagedWidget("vscroll", *************** *** 1374,1379 **** --- 1428,1434 ---- static XtActionsRec actions[] = { {"grid-button", GridButtonAction}, + {"self-insert-char", SelfInsertChar}, {"siaghelp", siaghelp_action}, {"place-shortcuts", place_shortcuts}, {"popup-shortcuts", popup_shortcuts}, *************** *** 1797,1804 **** int *cur_row, int *cur_col, int cur_x, int cur_y) { ! int r, c, h; int s = w->sht; r = top_row; h = line_height(w->buf, s, r); while (cur_y > h) { --- 1852,1865 ---- int *cur_row, int *cur_col, int cur_x, int cur_y) { ! int r, c, h, ll; int s = w->sht; + int real_top_col; + + XtVaGetValues(w->ui->grid, + XtNrichtextTopCol, &real_top_col, + (char *)0); + top_col = real_top_col; r = top_row; h = line_height(w->buf, s, r); while (cur_y > h) { *************** *** 1809,1818 **** c = 0; cur_x -= line_start(w->buf, s, r); ! cur_x += top_col; /* it's in pixels, y'know */ ! while (c < line_length(w->buf, s, r) && ! cur_x > line_width(w->buf, s, r, c)) { c++; } *cur_col = c; --- 1870,1880 ---- c = 0; cur_x -= line_start(w->buf, s, r); ! cur_x -= top_col; /* it's in pixels, y'know */ ! /* this is fantastically unefficient */ ! ll = line_length(w->buf, s, r); ! while (c < ll && cur_x > line_width(w->buf, s, r, c)) { c++; } *cur_col = c; diff -crNP ../siag-3.3.4/xpw/xpw.c ./xpw/xpw.c *** ../siag-3.3.4/xpw/xpw.c Thu Apr 27 02:29:36 2000 --- ./xpw/xpw.c Fri May 5 06:51:48 2000 *************** *** 127,144 **** int line_width(buffer *buf, int s, int row, int col) { rich_char *line; - char *p; int i, l; unsigned int width; if (row > buf->sht[s].used_lines) return 0; line = buf->sht[s].text[row].p; if (line == NULL) return 0; /* do not dump core */ - p = (char *)rc_makeplain(line); if (buf->sht[s].text[row].sty == STY_EMBED) { if (col == 0) return 0; embed_size(p, &width, NULL); return width; } --- 127,145 ---- int line_width(buffer *buf, int s, int row, int col) { rich_char *line; int i, l; unsigned int width; if (row > buf->sht[s].used_lines) return 0; line = buf->sht[s].text[row].p; if (line == NULL) return 0; /* do not dump core */ if (buf->sht[s].text[row].sty == STY_EMBED) { + char *p; if (col == 0) return 0; + p = (char *)rc_makeplain(line); embed_size(p, &width, NULL); + cfree(p); return width; } *************** *** 153,159 **** width += rc_width(line[i]); } } - cfree(p); return width; } --- 154,159 ---- diff -crNP ../siag-3.3.4/xsiag/Makefile.in ./xsiag/Makefile.in *** ../siag-3.3.4/xsiag/Makefile.in Fri Apr 28 14:48:13 2000 --- ./xsiag/Makefile.in Sat May 6 09:25:23 2000 *************** *** 251,257 **** ../xcommon/embed.h ../xcommon/dialogs.h \ ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h \ ../xcommon/icon.h ../xcommon/xcommon.h ../xcommon/plugin.h \ ! ../xcommon/../common/plugin.h ../xcommon/TextField.h \ ../xcommon/Tabbing.h ../xcommon/Combo.h ../xcommon/Frame.h \ ../xcommon/Rudegrid.h ../xcommon/Tooltip.h ../xcommon/Handle.h \ ../xcommon/../XawM/Label.h ../siag/calc.h \ --- 251,257 ---- ../xcommon/embed.h ../xcommon/dialogs.h \ ../xcommon/DragAndDrop.h ../xcommon/DragAndDropTypes.h \ ../xcommon/icon.h ../xcommon/xcommon.h ../xcommon/plugin.h \ ! ../xcommon/../common/plugin.h ../xcommon/Richtext.h \ ../xcommon/Tabbing.h ../xcommon/Combo.h ../xcommon/Frame.h \ ../xcommon/Rudegrid.h ../xcommon/Tooltip.h ../xcommon/Handle.h \ ../xcommon/../XawM/Label.h ../siag/calc.h \ diff -crNP ../siag-3.3.4/xsiag/Siag.ad ./xsiag/Siag.ad *** ../siag-3.3.4/xsiag/Siag.ad Thu Apr 6 14:53:40 2000 --- ./xsiag/Siag.ad Wed May 3 18:12:31 2000 *************** *** 1,7 **** ! General settings for the whole application ! Siag.geometry: 640x400 ! Settings for individual widgets --- 1,7 ---- ! General settings for the whole application ! Siag.geometry: 700x420 ! Settings for individual widgets *************** *** 50,55 **** --- 50,56 ---- Siag*text1.borderWidth: 0 + siag*text1.background: white Siag*textbox.borderWidth: 0 Siag*textbox.gridy: 3 *************** *** 151,156 **** --- 152,159 ---- Siag*label1.label: + Siag*edit_text.background: white + Siag*edit_text.richtextLeftMargin: 5 Siag*edit_text.translations: #override\n\ Return: celledit-done()\n\ KP_Enter: celledit-done()\n\ diff -crNP ../siag-3.3.4/xsiag/app-defaults.h ./xsiag/app-defaults.h *** ../siag-3.3.4/xsiag/app-defaults.h Thu Apr 6 14:53:40 2000 --- ./xsiag/app-defaults.h Wed May 3 18:12:32 2000 *************** *** 1,4 **** ! "Siag.geometry: 640x400", "Siag*topbox.xLayout: 100%", "Siag*topbox.yLayout: 30 30 30 30 100% 30", "Siag*textframe.topShadowContrast: -40", --- 1,4 ---- ! "Siag.geometry: 700x420", "Siag*topbox.xLayout: 100%", "Siag*topbox.yLayout: 30 30 30 30 100% 30", "Siag*textframe.topShadowContrast: -40", *************** *** 35,40 **** --- 35,41 ---- "Siag*Box.handle.label:", "Siag*Rudegrud.handle.label:", "Siag*text1.borderWidth: 0", + "siag*text1.background: white", "Siag*textbox.borderWidth: 0", "Siag*textbox.gridy: 3", "Siag*gridpane.borderWidth: 0", *************** *** 115,120 **** --- 116,123 ---- : siag-highlight(1 1) \\n\ : siag-unhighlight(0 1)", "Siag*label1.label:", + "Siag*edit_text.background: white", + "Siag*edit_text.richtextLeftMargin: 5", "Siag*edit_text.translations: #override\\n\ Return: celledit-done()\\n\ KP_Enter: celledit-done()\\n\ diff -crNP ../siag-3.3.4/xsiag/window.c ./xsiag/window.c *** ../siag-3.3.4/xsiag/window.c Fri Apr 28 10:57:16 2000 --- ./xsiag/window.c Sat May 6 08:15:12 2000 *************** *** 109,115 **** #include "../xcommon/icon.h" #include "../xcommon/xcommon.h" #include "../xcommon/plugin.h" ! #include "../xcommon/TextField.h" #include "../xcommon/Tabbing.h" #include "../xcommon/Combo.h" #include "../xcommon/Frame.h" --- 109,115 ---- #include "../xcommon/icon.h" #include "../xcommon/xcommon.h" #include "../xcommon/plugin.h" ! #include "../xcommon/Richtext.h" #include "../xcommon/Tabbing.h" #include "../xcommon/Combo.h" #include "../xcommon/Frame.h" *************** *** 186,192 **** static Widget btnFont, btnSize, btnStyle, btnColor; static Widget cmdBold, cmdItalic, cmdHLeft, cmdHCenter, cmdHRight; ! static Widget cmdBorders, cmdGrid, cmdUline, cmdNone; static Widget shortcuts, tooltip; float zoom = 1.0; --- 186,192 ---- static Widget btnFont, btnSize, btnStyle, btnColor; static Widget cmdBold, cmdItalic, cmdHLeft, cmdHCenter, cmdHRight; ! static Widget cmdBorders, cmdGrid, cmdUline, cmdLline, cmdRline, cmdNone; static Widget shortcuts, tooltip; float zoom = 1.0; *************** *** 260,266 **** strcpy(b, "ERROR"); } label_set(label3, b); ! TextFieldSetString(text1, text); } static void draw_status(char *text) --- 260,266 ---- strcpy(b, "ERROR"); } label_set(label3, b); ! RichtextSetString(text1, text); } static void draw_status(char *text) *************** *** 321,327 **** draw_hbar(w); } ! /* This is a wrapper, so that colum_text can be shared */ static char *colnum_text_wrapper(XtPointer p, int row, int col) { window *w = (window *)p; --- 321,327 ---- draw_hbar(w); } ! /* This is a wrapper, so that colnum_text can be shared */ static char *colnum_text_wrapper(XtPointer p, int row, int col) { window *w = (window *)p; *************** *** 336,342 **** static void draw_colnums(window *w) { if (w->ui->colnum != None) { - TableSetZoom(w->ui->colnum, zoom); XtVaSetValues(w->ui->colnum, XtNtableProtCol, get_prot(w).col, XtNtableTopCol, get_top(w).col, --- 336,341 ---- *************** *** 349,355 **** static void draw_rownums(window *w) { if (w->ui->rownum != None) { - TableSetZoom(w->ui->rownum, zoom); XtVaSetValues(w->ui->rownum, XtNtableProtRow, get_prot(w).row, XtNtableTopRow, get_top(w).row, --- 348,353 ---- *************** *** 397,402 **** --- 395,410 ---- return cell_height(w->buf, w->sht, row); } + static int tcolnum_width(XtPointer p, int col) + { + return zoom*tcell_width(p, col); + } + + static int trownum_height(XtPointer p, int row) + { + return zoom*tcell_height(p, row); + } + static int cell_type(XtPointer p, int row, int col) { window *w = (window *)p; *************** *** 493,500 **** --- 501,540 ---- } /* --- + edit_text is the Richtext widget. + winw is the total zoomed width of the grid widget. + x is the zoomed offset. + tw is the unzoomed width of the text plus the unzoomed width of the left margin. + + 1. If the current width of edit_text is >= the zoomed text width, + set top_col to 0 and return. + 2. Otherwise calculate the required zoomed width for edit_text. + 3. If the required width will fit in the grid, resize edit_text and set + top_col to 0. + 4. Otherwise make edit_text as large as possible. */ + static void resize_edit_text(Widget edit_text, int winw, int x, int tw, int h) + { + Dimension w; + + XtVaGetValues(edit_text, + XtNwidth, &w, + (char *)0); + if (zoom*tw < w) { + XtVaSetValues(edit_text, + XtNrichtextTopCol, 0, + (char *)0); + } else if (zoom*tw < winw-x) { + XtResizeWidget(edit_text, zoom*tw, h, 1); + XtVaSetValues(edit_text, + XtNrichtextTopCol, 0, + (char *)0); + } else { + XtResizeWidget(edit_text, winw-x, h, 1); + } + } + int edit_cell(char *prompt, char *buffr) { XtAppContext app_context = XtWidgetToApplicationContext(topLevel); *************** *** 507,618 **** int c = get_point(w_list).col; int s = w_list->sht; char *p = ret_text(buf, s, r, c); ! XFontStruct *fs; Dimension winw; - fs = font_table[format_table[ret_format(buf, s, r, c)].font].fs; x = y = 0; ! get_cell_coords(w_list, get_top(w_list).row, get_top(w_list).col, r, c, &x, &y); x--; y--; w = cell_width(buf, s, c)-1; ! h = cell_height(buf, s, r)-1; if (!p) p = ""; XtVaGetValues(w_list->ui->grid, XtNwidth, &winw, (char *)0); ! tw = XTextWidth(fs, p, strlen(p))+4; if (tw > winw-x) tw = winw-x; - if (tw > w) w = tw; edit_text = XtVaCreateManagedWidget("edit_text", ! textfieldWidgetClass, w_list->ui->grid, XtNx, x, XtNy, y, ! XtNwidth, w, XtNheight, h, ! XtNfont, fs, (char *)0); status = WAITING; ! XtVaSetValues(edit_text, ! XtNx, x, ! XtNy, y, ! XtNwidth, w, ! XtNheight, h, (char *)0); ! TextFieldSetString(edit_text, buffr); XtVaSetValues(edit_text, ! XtNdisplayCaret, True, ! XtNinsertPosition, strlen(buffr), (char *)NULL); XtAddGrab(edit_text, False, False); XtSetKeyboardFocus(topLevel, edit_text); XtVaSetValues(edit_text, ! XtNinsertPosition, strlen(buffr), (char *)0); if (text1 == None) { buffr[0] = '\0'; while (status == WAITING) { XEvent event_return; - int n; ! string = TextFieldGetString(edit_text); ! XtVaGetValues(edit_text, ! XtNinsertPosition, &n, ! (char *)NULL); if (strcmp(string, buffr)) { ! tw = XTextWidth(fs, string, strlen(string))+4; ! if (tw > winw-x) tw = winw-x; ! if (tw > w) w = tw; ! XtResizeWidget(edit_text, w, h, 1); } strcpy(buffr, string); XtAppNextEvent(app_context, &event_return); XtDispatchEvent(&event_return); } } else { ! TextFieldSetString(text1, buffr); XtVaSetValues(text1, ! XtNinsertPosition, strlen(buffr), (char *)0); while (status == WAITING) { XEvent event_return; int n, n1; label_set(label1, prompt); ! string = TextFieldGetString(edit_text); XtVaGetValues(edit_text, ! XtNinsertPosition, &n, (char *)NULL); ! string1 = TextFieldGetString(text1); XtVaGetValues(text1, ! XtNinsertPosition, &n1, (char *)NULL); if (strcmp(string, string1)) { ! TextFieldSetString(text1, string); XtVaSetValues(text1, ! XtNinsertPosition, n, (char *)NULL); ! tw = XTextWidth(fs, string, strlen(string))+4; ! if (tw > winw-x) tw = winw-x; ! if (tw > w) w = tw; ! XtResizeWidget(edit_text, w, h, 1); } XtAppNextEvent(app_context, &event_return); XtDispatchEvent(&event_return); } ! TextFieldSetString(text1, ""); XtVaSetValues(text1, ! XtNdisplayCaret, False, (char *)NULL); } ! string = TextFieldGetString(edit_text); strcpy(buffr, string); /* no check on length... */ XtRemoveGrab(edit_text); --- 547,667 ---- int c = get_point(w_list).col; int s = w_list->sht; char *p = ret_text(buf, s, r, c); ! rich_char *rp; ! int lm; Dimension winw; + int fmt = ret_format(buf, s, r, c); x = y = 0; ! /* make x the zoomed x coordinate of edit_text */ ! table_zoomed_cell2coords(w_list->ui->grid, r, c, &x, &y); x--; y--; + /* make w (approximately) the unzoomed cell width */ w = cell_width(buf, s, c)-1; ! h = zoom*cell_height(buf, s, r)-1; if (!p) p = ""; + + /* make winw the total zoomed grid width */ XtVaGetValues(w_list->ui->grid, XtNwidth, &winw, (char *)0); ! ! /* make tw the zoomed cell width */ ! tw = zoom*w; ! ! /* if tw is too big, shrink to fit */ if (tw > winw-x) tw = winw-x; edit_text = XtVaCreateManagedWidget("edit_text", ! richtextWidgetClass, w_list->ui->grid, XtNx, x, XtNy, y, ! XtNwidth, tw, XtNheight, h, ! XtNrichtextFormat, fmt, (char *)0); + RichtextSetZoom(edit_text, zoom); status = WAITING; ! RichtextSetString(edit_text, buffr); ! XtVaGetValues(edit_text, ! XtNrichtextLeftMargin, &lm, ! XtNrichtextString, &rp, (char *)0); ! resize_edit_text(edit_text, winw, x, lm+rc_strwidth(rp, -1), h); XtVaSetValues(edit_text, ! XtNrichtextVisibleCursor, True, ! XtNrichtextPointCol, strlen(buffr), (char *)NULL); XtAddGrab(edit_text, False, False); XtSetKeyboardFocus(topLevel, edit_text); XtVaSetValues(edit_text, ! XtNrichtextPointCol, strlen(buffr), (char *)0); if (text1 == None) { buffr[0] = '\0'; while (status == WAITING) { XEvent event_return; ! string = RichtextGetString(edit_text); if (strcmp(string, buffr)) { ! XtVaGetValues(edit_text, ! XtNrichtextLeftMargin, &lm, ! XtNrichtextString, &rp, ! (char *)0); ! resize_edit_text(edit_text, winw, ! x, lm+rc_strwidth(rp, -1), h); } strcpy(buffr, string); XtAppNextEvent(app_context, &event_return); XtDispatchEvent(&event_return); } } else { ! RichtextSetString(text1, buffr); XtVaSetValues(text1, ! XtNrichtextPointCol, strlen(buffr), (char *)0); while (status == WAITING) { XEvent event_return; int n, n1; label_set(label1, prompt); ! string = RichtextGetString(edit_text); XtVaGetValues(edit_text, ! XtNrichtextPointCol, &n, (char *)NULL); ! string1 = RichtextGetString(text1); XtVaGetValues(text1, ! XtNrichtextPointCol, &n1, (char *)NULL); if (strcmp(string, string1)) { ! RichtextSetString(text1, string); XtVaSetValues(text1, ! XtNrichtextPointCol, n, (char *)NULL); ! XtVaGetValues(edit_text, ! XtNrichtextLeftMargin, &lm, ! XtNrichtextString, &rp, ! (char *)0); ! resize_edit_text(edit_text, winw, ! x, lm+rc_strwidth(rp, -1), h); } XtAppNextEvent(app_context, &event_return); XtDispatchEvent(&event_return); } ! RichtextSetString(text1, ""); XtVaSetValues(text1, ! XtNrichtextVisibleCursor, False, (char *)NULL); } ! string = RichtextGetString(edit_text); ! strcpy(buffr, string); /* no check on length... */ XtRemoveGrab(edit_text); *************** *** 702,708 **** if (event_return.type == ButtonRelease) { waiting = False; } else if (event_return.type == MotionNotify) { ! x = event_return.xmotion.x; } else { XtDispatchEvent(&event_return); } --- 751,757 ---- if (event_return.type == ButtonRelease) { waiting = False; } else if (event_return.type == MotionNotify) { ! x = event_return.xmotion.x/zoom; } else { XtDispatchEvent(&event_return); } *************** *** 718,724 **** int s; static Time oldtime = 0; ! x = event->xbutton.x; y = 0; hide_cur(w_list); activate_window(find_window_by_widget(w)); --- 767,773 ---- int s; static Time oldtime = 0; ! x = event->xbutton.x/zoom; y = 0; hide_cur(w_list); activate_window(find_window_by_widget(w)); *************** *** 802,808 **** if (event_return.type == ButtonRelease) { waiting = False; } else if (event_return.type == MotionNotify) { ! y = event_return.xmotion.y; } else { XtDispatchEvent(&event_return); } --- 851,857 ---- if (event_return.type == ButtonRelease) { waiting = False; } else if (event_return.type == MotionNotify) { ! y = event_return.xmotion.y/zoom; } else { XtDispatchEvent(&event_return); } *************** *** 822,828 **** static Time oldtime = 0; x = 0; ! y = event->xbutton.y; hide_cur(w_list); activate_window(find_window_by_widget(w)); get_coords_cell(w_list, get_top(w_list).row, get_top(w_list).col, --- 871,877 ---- static Time oldtime = 0; x = 0; ! y = event->xbutton.y/zoom; hide_cur(w_list); activate_window(find_window_by_widget(w)); get_coords_cell(w_list, get_top(w_list).row, get_top(w_list).col, *************** *** 997,1004 **** state = STOP; } else if (event_return.type == MotionNotify) { /* figure out where we are an set selection */ ! x = event_return.xmotion.x; ! y = event_return.xmotion.y; get_coords_cell(w_list, get_top(w_list).row, get_top(w_list).col, &row, &col, x, y); set_point_row(w_list, row); --- 1046,1053 ---- state = STOP; } else if (event_return.type == MotionNotify) { /* figure out where we are an set selection */ ! x = event_return.xmotion.x/zoom; ! y = event_return.xmotion.y/zoom; get_coords_cell(w_list, get_top(w_list).row, get_top(w_list).col, &row, &col, x, y); set_point_row(w_list, row); *************** *** 1085,1092 **** if (event_return.type == ButtonRelease) { waiting = False; } else if (event_return.type == MotionNotify) { ! *rx = event_return.xmotion.x; ! *ry = event_return.xmotion.y; } else { XtDispatchEvent(&event_return); } --- 1134,1141 ---- if (event_return.type == ButtonRelease) { waiting = False; } else if (event_return.type == MotionNotify) { ! *rx = event_return.xmotion.x/zoom; ! *ry = event_return.xmotion.y/zoom; } else { XtDispatchEvent(&event_return); } *************** *** 1100,1107 **** int col, row; int x, y; ! x = event->xbutton.x; ! y = event->xbutton.y; hide_cur(w_list); activate_window(find_window_by_widget(w)); get_coords_cell(w_list, get_top(w_list).row, get_top(w_list).col, --- 1149,1156 ---- int col, row; int x, y; ! x = event->xbutton.x/zoom; ! y = event->xbutton.y/zoom; hide_cur(w_list); activate_window(find_window_by_widget(w)); get_coords_cell(w_list, get_top(w_list).row, get_top(w_list).col, *************** *** 1647,1652 **** --- 1696,1705 ---- "grid.xpm", "Draw grid lines in the block"); cmdUline = make_command("(block-borders 3)", toolbox, "uline.xpm", "Underline the block"); + cmdLline = make_command("(block-borders 5)", toolbox, + "lline.xpm", "Leftline the block"); + cmdRline = make_command("(block-borders 6)", toolbox, + "rline.xpm", "Rightline the block"); cmdNone = make_command("(block-borders 0)", toolbox, "none.xpm", "Remove grid lines from the block"); } *************** *** 1948,1955 **** XtNheight, 24, (char *)0); text1 = XtVaCreateManagedWidget("text1", ! textfieldWidgetClass, textframe, ! XtNdisplayCaret, False, XtNwidth, 492, XtNheight, 24, (char *)NULL); --- 2001,2008 ---- XtNheight, 24, (char *)0); text1 = XtVaCreateManagedWidget("text1", ! richtextWidgetClass, textframe, ! XtNrichtextVisibleCursor, False, XtNwidth, 492, XtNheight, 24, (char *)NULL); *************** *** 2108,2127 **** if (ph == -1) { /* not a plugin; must be editing in place */ if (w_list == NULL) *x = *y = 0; ! else buffer_global_coords(b, win->sht, ! get_point(win).row, ! get_point(win).col, x, y); (*x)--; (*y)--; return; } n = buffer_plugin2index(b, win->sht, ph); if (n == -1) return; ! /* FIXME: surely this can't be right? */ ! buffer_global_coords(b, win->sht, ! b->sht[win->sht].plugin[n].row, ! b->sht[win->sht].plugin[n].col, x, y); } static Cursor lr_cursor, ud_cursor, sizing_cursor; --- 2161,2180 ---- if (ph == -1) { /* not a plugin; must be editing in place */ if (w_list == NULL) *x = *y = 0; ! else table_zoomed_cell2coords(w_list->ui->grid, ! get_point(win).row, get_point(win).col, x, y); (*x)--; (*y)--; + return; } n = buffer_plugin2index(b, win->sht, ph); if (n == -1) return; ! table_zoomed_cell2coords(w_list->ui->grid, ! b->sht[win->sht].plugin[n].row, ! b->sht[win->sht].plugin[n].col, ! x, y); } static Cursor lr_cursor, ud_cursor, sizing_cursor; *************** *** 2131,2137 **** int col, row, x, y, x1, y1, w1; window *win = find_window_by_widget(w); ! x = event->xmotion.x; y = 0; get_coords_cell(win, get_top(win).row, get_top(win).col, &row, &col, x, y); --- 2184,2190 ---- int col, row, x, y, x1, y1, w1; window *win = find_window_by_widget(w); ! x = event->xmotion.x/zoom; y = 0; get_coords_cell(win, get_top(win).row, get_top(win).col, &row, &col, x, y); *************** *** 2150,2156 **** int col, row, x, y, x1, y1, h1; window *win = find_window_by_widget(w); ! y = event->xmotion.y; x = 0; get_coords_cell(win, get_top(win).row, get_top(win).col, &row, &col, x, y); --- 2203,2209 ---- int col, row, x, y, x1, y1, h1; window *win = find_window_by_widget(w); ! y = event->xmotion.y/zoom; x = 0; get_coords_cell(win, get_top(win).row, get_top(win).col, &row, &col, x, y); *************** *** 2169,2176 **** int col, row, x, y, x1, y1, w1, h1, wd, hd; window *win = find_window_by_widget(w); ! y = event->xmotion.y; ! x = event->xmotion.x; get_coords_cell(win, get_top(win).row, get_top(win).col, &row, &col, x, y); get_cell_coords(win, get_top(win).row, get_top(win).col, --- 2222,2229 ---- int col, row, x, y, x1, y1, w1, h1, wd, hd; window *win = find_window_by_widget(w); ! y = event->xmotion.y/zoom; ! x = event->xmotion.x/zoom; get_coords_cell(win, get_top(win).row, get_top(win).col, &row, &col, x, y); get_cell_coords(win, get_top(win).row, get_top(win).col, *************** *** 2299,2305 **** w->ui->colnum = XtVaCreateManagedWidget("colnum", tableWidgetClass, w->ui->viewport, XtNtableDefaultHeight, h1, ! XtNtableColWidth, tcell_width, XtNtableFormat, rowcol_format, XtNtableText, colnum_text_wrapper, XtNtableMaxRow, 1, --- 2352,2358 ---- w->ui->colnum = XtVaCreateManagedWidget("colnum", tableWidgetClass, w->ui->viewport, XtNtableDefaultHeight, h1, ! XtNtableColWidth, tcolnum_width, XtNtableFormat, rowcol_format, XtNtableText, colnum_text_wrapper, XtNtableMaxRow, 1, *************** *** 2314,2320 **** w->ui->rownum = XtVaCreateManagedWidget("rownum", tableWidgetClass, w->ui->viewport, XtNtableDefaultWidth, w1, ! XtNtableRowHeight, tcell_height, XtNtableFormat, rowcol_format, XtNtableText, rownum_text, XtNtableMaxRow, BUFFER_ROWS, --- 2367,2373 ---- w->ui->rownum = XtVaCreateManagedWidget("rownum", tableWidgetClass, w->ui->viewport, XtNtableDefaultWidth, w1, ! XtNtableRowHeight, trownum_height, XtNtableFormat, rowcol_format, XtNtableText, rownum_text, XtNtableMaxRow, BUFFER_ROWS,