/[fenfire]/fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java
ViewVC logotype

Diff of /fenfire/org/fenfire/spanimages/gl/PageScrollBlockImager.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by tjl, Mon Aug 18 08:07:08 2003 UTC revision 1.11 by tjl, Mon Aug 18 08:32:09 2003 UTC
# Line 69  public class PageScrollBlockImager exten Line 69  public class PageScrollBlockImager exten
69          return m;          return m;
70      }      }
71    
72        class PageFiles {
73            int xreso, yreso;
74            String[] filenames;
75        }
76    
77      public SingleImage getSingleImage(ImageSpan img, PoolManager poolManager) {      public SingleImage getSingleImage(ImageSpan img, PoolManager poolManager) {
78          PageImageSpan span = (PageImageSpan)img;          PageImageSpan span = (PageImageSpan)img;
79          int page = span.getPageIndex();          int page = span.getPageIndex();
# Line 80  public class PageScrollBlockImager exten Line 85  public class PageScrollBlockImager exten
85          if(singleImage == null) {          if(singleImage == null) {
86    
87              try {              try {
88                  String[] pageFiles = getPageFiles(sb);                  int[] res = new int[2];
89                    PageFiles pageFiles = getPageFiles(sb);
90                  singleImage = new SingleImage(                  singleImage = new SingleImage(
91                          sb.getID(),                          sb.getID(),
92                          page,                          page,
93                          pageFiles[page],                          pageFiles.filenames[page],
94                          RESOLUTION,                          pageFiles.xreso,
95                            pageFiles.yreso,
96                          poolManager                          poolManager
97                          );                          );
98              } catch(Exception e) {              } catch(Exception e) {
# Line 96  public class PageScrollBlockImager exten Line 103  public class PageScrollBlockImager exten
103          return singleImage;          return singleImage;
104      }      }
105    
106      private String[] getPageFiles(ScrollBlock pages)      private PageFiles getPageFiles(ScrollBlock pages)
107              throws FileNotFoundException {              throws FileNotFoundException {
108          String[] f = (String[]) block2pagefiles.get(pages);          PageFiles f = (PageFiles) block2pagefiles.get(pages);
109          if(f == null) {          if(f == null) {
110              f = makePageFiles(pages);              f = makePageFiles(pages);
111              block2pagefiles.put(pages, f);              block2pagefiles.put(pages, f);
# Line 108  public class PageScrollBlockImager exten Line 115  public class PageScrollBlockImager exten
115    
116      PythonInterpreter interp;      PythonInterpreter interp;
117    
118      private synchronized String[] makePageFiles(ScrollBlock pages)      private synchronized PageFiles makePageFiles(ScrollBlock pages)
119              throws java.io.FileNotFoundException {              throws java.io.FileNotFoundException {
120          String ct = pages.getContentType();          String ct = pages.getContentType();
121          if(! (ct.equals("application/pdf") ||          if(! (ct.equals("application/pdf") ||
# Line 145  public class PageScrollBlockImager exten Line 152  public class PageScrollBlockImager exten
152              tmppaths[i] = new File(tmp(), "tmp"+base).getPath();              tmppaths[i] = new File(tmp(), "tmp"+base).getPath();
153              if(!f.exists()) exist = false;              if(!f.exists()) exist = false;
154          }          }
155          if(exist) return paths;  
156            PageFiles res = new PageFiles();
157            res.xreso = xreso;
158            res.yreso = yreso;
159            res.filenames = paths;
160    
161            if(exist) return res;
162                    
163          // Need to make them.          // Need to make them.
164          //          //
# Line 177  public class PageScrollBlockImager exten Line 190  public class PageScrollBlockImager exten
190              (new File(tmppaths[i])).delete();              (new File(tmppaths[i])).delete();
191          }          }
192    
193          return paths;          return res;
194      }      }
195    
196    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26