calder@uluru.stanford.edu (Paul Calder) (05/11/91)
This patch fixes three bugs in Doc. It is archived as
'pub/3.0-fixes/fix6' on 'interviews.stanford.edu'.
1. Some documents were incorrectly positioned when printed.
Add a new Patch to DocumentViewer. Affects DocumentViewer.[ch]
2. Tables with hidden column separators were read incorrectly.
Fix it! Affects Document.c
3. Non-ASCII characters in Idraw drawings were read incorrently.
Check for \ddd characters. Affects IdrawImage.c
============
Apply with ``patch -p -N < fix6'' at the top of the source tree.
*** iv/src/bin/doc/DocumentViewer.h.beta Thu Apr 11 23:21:10 1991
--- iv/src/bin/doc/DocumentViewer.h Fri May 10 11:11:33 1991
***************
*** 116,121 ****
--- 116,122 ----
class Patch* _top;
class Patch* _header_patch;
+ class Patch* _body_patch;
class Patch* _footer_patch;
class Patch* _page_patch;
class Telltale* _prev_page;
*** iv/src/bin/doc/DocumentViewer.c.beta Mon Apr 15 10:58:11 1991
--- iv/src/bin/doc/DocumentViewer.c Fri May 10 11:10:23 1991
***************
*** 180,185 ****
--- 180,196 ----
_header_patch = new Patch(nil);
_page_patch = new Patch(nil);
_footer_patch = new Patch(new LRBox(_prev_page, _next_page));
+ _body_patch = new Patch(
+ new TBBox(
+ new Margin(
+ new PageBorder(
+ new Margin(_page_patch, 1, 5, 5, 1), fg
+ ),
+ 0, 0, 0, 0, fil, 0, 5, fil, 0, 0, 0, 0
+ ),
+ _footer_patch
+ )
+ );
float leftmargin = _document->document_metric("leftsidemargin");
float rightmargin = _document->document_metric("rightsidemargin");
***************
*** 190,210 ****
new Background(
new TBBox(
new VCenter(_header_patch, 1.0),
! new VGlue(3, 0, 0),
! new HMargin(
! new PageBorder(
! new Margin(
! _page_patch,
! leftmargin + 1, 0, leftmargin - 1,
! rightmargin + 5, fil, rightmargin - 1,
! bottommargin + 5, 0, bottommargin - 1,
! topmargin + 1, 0, topmargin - 1
! ), fg
! ), 8.0
! ),
! new VGlue(5, 0, 0),
! new HCenter(new RMargin(_footer_patch, 0, fil, 0), 0.0),
! new VGlue(0, fil, 0)
), bg
), this
);
--- 201,207 ----
new Background(
new TBBox(
new VCenter(_header_patch, 1.0),
! new Margin(_body_patch, 5)
), bg
), this
);
***************
*** 219,225 ****
_view->update();
_page = new Page(_view);
! _page_patch->body(_page);
_starting_page = int(_document->document_metric("startingpage"));
_current_page = -1;
--- 216,224 ----
_view->update();
_page = new Page(_view);
! _page_patch->body(
! new Margin(_page, leftmargin, rightmargin, bottommargin, topmargin)
! );
_starting_page = int(_document->document_metric("startingpage"));
_current_page = -1;
***************
*** 490,499 ****
page_to(_current_page - 1);
return false;
} else if (strncmp(command, "page", 4) == 0) {
! int p = atoi(command + 4);
! if (p > 0) {
! page_to(p);
! }
return false;
} else {
return _application->command(command);
--- 489,495 ----
page_to(_current_page - 1);
return false;
} else if (strncmp(command, "page", 4) == 0) {
! page_to(atoi(command + 4));
return false;
} else {
return _application->command(command);
***************
*** 672,678 ****
}
ViewerFloatInfo& info = _float_info->item(i);
_page->change(i);
! _page_patch->reallocate();
_reshaped = true;
}
--- 668,675 ----
}
ViewerFloatInfo& info = _float_info->item(i);
_page->change(i);
! _body_patch->change(0);
! _body_patch->reallocate();
_reshaped = true;
}
***************
*** 719,726 ****
if (info._x != x || info._y != y) {
_page->move(i, x, y);
}
- _page_patch->reallocate();
_page->change(i);
_reshaped = true;
info._x = x;
info._y = y;
--- 716,724 ----
if (info._x != x || info._y != y) {
_page->move(i, x, y);
}
_page->change(i);
+ _body_patch->change(0);
+ _body_patch->reallocate();
_reshaped = true;
info._x = x;
info._y = y;
***************
*** 811,816 ****
--- 809,815 ----
}
LRBox* buttons = new LRBox();
+ buttons->append(nil);
buttons->append(
new Button(new Command(this, "page backward"), _prev_page)
);
***************
*** 817,823 ****
buttons->append(
new Button(new Command(this, "page forward"), _next_page)
);
! buttons->append(new HGlue(5));
Coord width = _document->document_metric("textwidth");
LRComposition* comp = new LRComposition(
--- 816,822 ----
buttons->append(
new Button(new Command(this, "page forward"), _next_page)
);
! buttons->append(new HGlue(5, 0, 0));
Coord width = _document->document_metric("textwidth");
LRComposition* comp = new LRComposition(
***************
*** 836,844 ****
}
comp->repair();
buttons->append(comp);
_footer_patch->redraw();
_footer_patch->body(buttons);
! _footer_patch->reallocate();
}
page = max(0, page);
page = min(page_count-1, page);
--- 835,846 ----
}
comp->repair();
buttons->append(comp);
+ buttons->append(new HGlue());
_footer_patch->redraw();
_footer_patch->body(buttons);
! _body_patch->change(1);
! _top->change(1);
! _top->reallocate();
}
page = max(0, page);
page = min(page_count-1, page);
*** iv/src/bin/doc/Document.c.beta Sun Apr 14 21:51:25 1991
--- iv/src/bin/doc/Document.c Fri May 10 10:59:08 1991
***************
*** 1057,1082 ****
) {
int c;
RowSeparator rsep = RowSeparatorOff;
if ((c = in.get()) == '{') {
int column = 0;
while ((c = in.get()) != '}') {
if (c == 'l') {
tabular->insert_column(column, "", ColumnAlignLeft);
++column;
} else if (c == 'c') {
tabular->insert_column(column, "", ColumnAlignCenter);
++column;
} else if (c == 'r') {
tabular->insert_column(column, "", ColumnAlignRight);
++column;
} else if (c == '|') {
! tabular->change_column_separator(
! column, ColumnSeparatorSingle
! );
}
}
while ((c = in.get()) == '\n') { }
in.putback(c);
} else {
tabular->change_row_separator(0, RowSeparatorSingle);
tabular->insert_column(0, "", ColumnAlignLeft);
--- 1057,1088 ----
) {
int c;
RowSeparator rsep = RowSeparatorOff;
+ ColumnSeparator csep = ColumnSeparatorOff;
if ((c = in.get()) == '{') {
int column = 0;
while ((c = in.get()) != '}') {
if (c == 'l') {
tabular->insert_column(column, "", ColumnAlignLeft);
+ tabular->change_column_separator(column, csep);
++column;
+ csep = ColumnSeparatorOff;
} else if (c == 'c') {
tabular->insert_column(column, "", ColumnAlignCenter);
+ tabular->change_column_separator(column, csep);
++column;
+ csep = ColumnSeparatorOff;
} else if (c == 'r') {
tabular->insert_column(column, "", ColumnAlignRight);
+ tabular->change_column_separator(column, csep);
++column;
+ csep = ColumnSeparatorOff;
} else if (c == '|') {
! csep = ColumnSeparatorSingle;
}
}
while ((c = in.get()) == '\n') { }
in.putback(c);
+ tabular->change_column_separator(column, csep);
} else {
tabular->change_row_separator(0, RowSeparatorSingle);
tabular->insert_column(0, "", ColumnAlignLeft);
*** iv/src/bin/doc/IdrawImage.c.beta Thu Apr 11 23:21:20 1991
--- iv/src/bin/doc/IdrawImage.c Fri May 10 11:14:05 1991
***************
*** 44,49 ****
--- 44,50 ----
#include <InterViews/world.h>
#include <string.h>
+ #include <ctype.h>
static boolean _idraw_font_metrics;
***************
*** 450,455 ****
--- 451,461 ----
} else if (c != ')' && c != '(') {
if (c == '\\') {
c = getc(file);
+ if (isdigit(c)) {
+ c = c - '0';
+ c = (c * 8) + getc(file) - '0';
+ c = (c * 8) + getc(file) - '0';
+ }
}
line->append(new Character(c, f, fg));
}
--
Paul Calder
Computer Systems Lab
Stanford University
calder@lurch.stanford.edu