~ubuntu-branches/debian/lenny/ipe/lenny

« back to all changes in this revision

Viewing changes to src/figtoipe/figtoipe.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2007-01-09 23:14:51 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20070109231451-3nd095g7ishc108l
Tags: 6.0pre27-3
* debian/gsfonts-fontmap.xml: New.  Fontmap for fonts from gsfonts package.
* debian/rules: Use gsfonts-fontmap.xml instead of tetex-fontmap.xml.
* debian/control: Add texlive-latex-base dependency as alternative to
  tetex-bin (for pdflatex) and replace tetex-extra by gsfonts (for font
  files).  Patch courtesy of Norbert Preining.  Closes: #378537.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 
3
3
    This file is part of the extensible drawing editor Ipe.
4
 
    Copyright (C) 1993-2004  Otfried Cheong
 
4
    Copyright (C) 1993-2005  Otfried Cheong
5
5
 
6
6
    Ipe is free software; you can redistribute it and/or modify it
7
7
    under the terms of the GNU General Public License as published by
35
35
 *
36
36
 * This program can read only versions 3.0, 3.1, and 3.2.
37
37
 *
 
38
 * Changes:
 
39
 *
 
40
 * 2005/10/31 - replace double backslash by single one in text.
 
41
 * 2005/11/14 - generate correct header for Ipe 6.0 preview 25.
 
42
 *
38
43
 */
39
44
 
40
45
#include <stdlib.h>
44
49
#include <vector>
45
50
#include <algorithm>
46
51
 
47
 
#define FIGTOIPE_VERSION "figtoipe 2004/11/20"
 
52
#define FIGTOIPE_VERSION "figtoipe 2005/11/14"
48
53
 
49
54
const int MEDIABOX_WIDTH = 595;
50
55
const int MEDIABOX_HEIGHT = 842;
147
152
int FigReader::GetInt()
148
153
{
149
154
  int num = -1;
150
 
  fscanf(iFig, "%d", &num);
 
155
  (void) fscanf(iFig, "%d", &num);
151
156
  return num;
152
157
}
153
158
 
154
159
double FigReader::GetDouble()
155
160
{
156
161
  double num;
157
 
  fscanf(iFig, "%lg", &num);
 
162
  (void) fscanf(iFig, "%lg", &num);
158
163
  return num;
159
164
}
160
165
 
336
341
{
337
342
  int colorNum = GetInt();    // color number
338
343
  int rgb;
339
 
  fscanf(iFig," #%x", &rgb);  // RGB string in hex
 
344
  (void) fscanf(iFig," #%x", &rgb);  // RGB string in hex
340
345
  iUserColors[colorNum - 32] = rgb;
341
346
}
342
347
 
380
385
  GetArrows(obj);
381
386
  if (obj.iSubtype == 5) { // Imported image
382
387
    // orientation and filename
383
 
    fscanf(iFig, "%*d %*s");
 
388
    (void) fscanf(iFig, "%*d %*s");
384
389
  }
385
390
  for (int i = 0; i < nPoints; ++i) {
386
391
    Point p = GetPoint();
469
474
      string.resize(string.size() - 4);
470
475
      break;
471
476
    }
 
477
    // fig seems to store "\" as "\\"
 
478
    if (string.size() >= 2 &&
 
479
        !strncmp(&string[string.size() - 2], "\\\\", 2)) {
 
480
      string.resize(string.size() - 1);
 
481
    }
472
482
  }
473
483
  string.push_back('\0');
474
484
  obj.iString = string;
891
901
 
892
902
  FigWriter fw(xml, fr.Magnification(), fr.UnitsPerPoint(), fr.UserColors());
893
903
 
894
 
  fprintf(xml, "<ipe creator=\"%s\" media=\"%d %d %d %d\">\n",
 
904
  fprintf(xml, "<ipe creator=\"%s\">\n<info media=\"%d %d %d %d\"/>\n",
895
905
          FIGTOIPE_VERSION, 0, 0, MEDIABOX_WIDTH, MEDIABOX_HEIGHT);
896
906
  fprintf(xml, "<page>\n");
897
907