diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/PSEditModel.cxx | 6 | ||||
-rw-r--r-- | src/PSEditor.cxx | 9 | ||||
-rw-r--r-- | src/Postscript.H | 9 | ||||
-rw-r--r-- | src/Postscript.cxx | 40 |
4 files changed, 6 insertions, 58 deletions
diff --git a/src/PSEditModel.cxx b/src/PSEditModel.cxx index e0028ce..3906ab6 100644 --- a/src/PSEditModel.cxx +++ b/src/PSEditModel.cxx @@ -1,5 +1,5 @@ // -// "$Id: PSEditModel.cxx,v 1.14 2005/06/17 18:20:42 hofmann Exp $" +// "$Id: PSEditModel.cxx,v 1.15 2005/06/17 18:24:34 hofmann Exp $" // // PSEditWidget routines. // @@ -256,7 +256,6 @@ int PSEditModel::load(FILE *fp) { char tmpname[256]; char linebuf[1024]; ssize_t ret; - PSParser *p1 = new PSParser_1(this); PSParser *p2 = new PSParser_2(this); int tmp_fd; @@ -271,7 +270,7 @@ int PSEditModel::load(FILE *fp) { clear(); while (fgets(linebuf, sizeof(linebuf), fp) != NULL) { - if (!p2->parse(linebuf) && !p1->parse(linebuf)) { + if (!p2->parse(linebuf)) { ret = write(tmp_fd, linebuf, strlen(linebuf)); if (ret != strlen(linebuf)) { fprintf(stderr, "Error while writing to temporary file\n"); @@ -281,7 +280,6 @@ int PSEditModel::load(FILE *fp) { lseek(tmp_fd, 0L, SEEK_SET); - delete(p1); delete(p2); return tmp_fd; diff --git a/src/PSEditor.cxx b/src/PSEditor.cxx index 54875c1..665adfc 100644 --- a/src/PSEditor.cxx +++ b/src/PSEditor.cxx @@ -1,5 +1,5 @@ // -// "$Id: PSEditor.cxx,v 1.24 2005/02/07 17:54:03 hofmann Exp $" +// "$Id: PSEditor.cxx,v 1.25 2005/06/17 18:24:34 hofmann Exp $" // // PSEditor routines. // @@ -181,7 +181,6 @@ int PSEditor::save(const char* savefile) { int PSEditor::import(char *f) { FILE *fp; char linebuf[1024]; - PSParser *p1; PSParser *p2; if (!file_loaded()) { @@ -194,15 +193,11 @@ int PSEditor::import(char *f) { return 1; } - p1 = new PSParser_1(model); p2 = new PSParser_2(model); while (fgets(linebuf, 1024, fp) != NULL) { - if (!p2->parse(linebuf)) { - p1->parse(linebuf); - } + p2->parse(linebuf); } - delete(p1); delete(p2); mod = 1; diff --git a/src/Postscript.H b/src/Postscript.H index fd32103..dd53fa3 100644 --- a/src/Postscript.H +++ b/src/Postscript.H @@ -1,5 +1,5 @@ // -// "$Id: Postscript.H,v 1.7 2005/06/17 18:20:42 hofmann Exp $" +// "$Id: Postscript.H,v 1.8 2005/06/17 18:24:34 hofmann Exp $" // // X11 header file for the Fast Light Tool Kit (FLTK). // @@ -42,13 +42,6 @@ class PSParser { virtual int parse(char *line); }; - -class PSParser_1 : public PSParser { - public: - PSParser_1(PSEditModel *p); - - int parse(char *line); -}; class PSParser_2 : public PSParser { private: diff --git a/src/Postscript.cxx b/src/Postscript.cxx index 691e994..a896fc0 100644 --- a/src/Postscript.cxx +++ b/src/Postscript.cxx @@ -1,5 +1,5 @@ // -// "$Id: Postscript.cxx,v 1.16 2005/06/17 18:20:42 hofmann Exp $" +// "$Id: Postscript.cxx,v 1.17 2005/06/17 18:24:34 hofmann Exp $" // // Postscript handling routines. // @@ -202,43 +202,6 @@ int PSParser::parse(char *line) { return 0; } - -PSParser_1::PSParser_1(PSEditModel *p) : PSParser(p) { - page = 1; -} - -int PSParser_1::parse(char *line) { - int x1, y1, size; - char *s, *e, glyph[1024]; - PSEditColor c; - - if (strcmp(line, "showpage\n") == 0) { - page++; - } - - if (strstr(line, "% PSEditWidget")) { - if (sscanf(line, PS_SIZE_FORMAT, &size) == 1) { - cur_size = size; - return 1; // line was recognized - } else if (sscanf(line, PS_POS_FORMAT, &x1, &y1) == 2) { - pse->new_text(x1, y1, "", cur_size, page, &c); - return 1; - } else if (sscanf(line, PS_GLYPH_FORMAT, glyph) == 1) { - pse->append_text(glyph_to_char(glyph)); - return 1; - } else if ((s = strchr(line, '(')) && - (e = strrchr(line, ')'))) { - *e = '\0'; - s++; - pse->append_text(s); - return 1; - } - return 0; // line not recognized - } else { - return 0; - } -} - PSParser_2::PSParser_2(PSEditModel *p) : PSParser(p) { page = 1; inside = 0; @@ -262,7 +225,6 @@ int PSParser_2::parse(char *line) { return 1; } else if (inside && sscanf(line, PSEDIT_COLOR_FORMAT, &c.r, &c.g, &c.b) == 3) { - fprintf(stderr, "==> c %f %f %f\n", c.r, c.g, c.b); cur_text_color.set(&c); return 1; } else if (inside && sscanf(line, PSEDIT_POS_FORMAT, &x1, &y1) == 2) { |