~ubuntu-branches/debian/sid/latexdraw/sid

« back to all changes in this revision

Viewing changes to latexDraw/ui/LaTeXDrawFrame.java

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2009-07-15 23:35:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090715233552-2bblktyf2lmrkyo3
Tags: 2.0.3+1-1
* New upstream release.
* Add additional Recommended packages for new export features.
* Fix typo in long description, with thanks to Kai Weber (Closes: #529195).
* Bump standards to 3.8.2 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 * This class contains all the elements of the graphic interface.<br>
44
44
 * <br>
45
45
 * This file is part of LaTeXDraw<br>
46
 
 * Copyright (c) 2005-2008 Arnaud BLOUIN<br>
 
46
 * Copyright (c) 2005-2009 Arnaud BLOUIN<br>
47
47
 * <br>
48
48
 *  LaTeXDraw is free software; you can redistribute it and/or modify
49
49
 *  it under the terms of the GNU General Public License as published by
54
54
 *  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
55
55
 *  PURPOSE. See the GNU General Public License for more details.<br>
56
56
 * <br>
57
 
 * 04/05/06<br>
 
57
 * 07/01/09<br>
58
58
 * @author Arnaud BLOUIN<br>
59
 
 * @version 2.0.0<br>
 
59
 * @version 2.0.3<br>
60
60
 */
61
61
public final class LaTeXDrawFrame extends JFrame implements ActionListener, ItemListener, ChangeListener, WindowStateListener
62
62
{
63
63
        private static final long serialVersionUID = 1L;
64
64
        
65
65
        /** The version of the application */
66
 
        public final static String VERSION   = "2.0.2";//$NON-NLS-1$
 
66
        public final static String VERSION   = "2.0.3";//$NON-NLS-1$
67
67
        
68
68
        public final static String VERSION_STABILITY = ""; //$NON-NLS-1$
69
69
        
85
85
        
86
86
        protected transient RecentFilesListener recentFilesListener;
87
87
        
 
88
        private String latexIncludes = null;
 
89
        
 
90
        private String pathDistribLatex = null;
 
91
        
88
92
        /** The path of the location of the LaTeX editor. */
89
93
        private String pathTexEditor = null;
90
94
        
110
114
        protected LMenuBar menuBar;
111
115
        
112
116
        /** The identifier of the build */
113
 
        private static final String ID_BUILD = "20081126";//$NON-NLS-1$
 
117
        private static final String ID_BUILD = "20090701";//$NON-NLS-1$
114
118
        
115
119
        /** Allows to realize undo and redo */
116
120
        protected transient UndoRedoManager undoManager;
927
931
                        updateSplitSeparatorPosition();
928
932
                        toolbar.getSliderDelimitor().setValue(Delimitor.getOpacity());
929
933
                
930
 
                        if(!fileIsOk)
 
934
                        if(!fileIsOk) {
 
935
                                projectName = null;
 
936
                                setTitle();
931
937
                                JOptionPane.showMessageDialog(this, LaTeXDrawLang.getStringLaTeXDrawFrame("LFrame2.18"), //$NON-NLS-1$
932
938
                                            LaTeXDrawLang.getStringLaTeXDrawFrame("LaTeXDrawFrame.86"), JOptionPane.WARNING_MESSAGE); //$NON-NLS-1$
 
939
                        }
933
940
                }
934
941
                catch(Exception e1) 
935
942
                {
1647
1654
        public void setExportAsMenu(boolean state)
1648
1655
        {
1649
1656
                getLMenuBar().getExportAsMenu().setEnabled(state);
 
1657
                getToolbar().getButtonPdfExport().setEnabled(state);
1650
1658
        }
1651
1659
        
1652
1660
        
3193
3201
                                                if(format.equals(LaTeXDrawResources.LABEL_EXPORT_PPM))
3194
3202
                                                        fileChooserExport.setFileFilter(new PPMFilter());
3195
3203
                                                else
3196
 
                                                        return ;
 
3204
                                                        if(format.equals(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX))
 
3205
                                                                fileChooserExport.setFileFilter(new PDFFilter());
 
3206
                                                        else
 
3207
                                                                if(format.equals(LaTeXDrawResources.LABEL_EXPORT_EPS_LATEX))
 
3208
                                                                        fileChooserExport.setFileFilter(new PSFilter());
 
3209
                                                                else
 
3210
                                                                        return ;
3197
3211
                
3198
3212
                if(currentFile==null)
3199
3213
                        fileChooserExport.setSelectedFile(null);
3225
3239
                        ex = LaTeXDrawResources.BMP_EXTENSION;
3226
3240
                else if(format.equals(LaTeXDrawResources.LABEL_EXPORT_PNG))
3227
3241
                        ex = LaTeXDrawResources.PNG_EXTENSION;
3228
 
                else
 
3242
                else if(format.equals(LaTeXDrawResources.LABEL_EXPORT_PPM))
3229
3243
                        ex = LaTeXDrawResources.PPM_EXTENSION;
 
3244
                else if(format.equals(LaTeXDrawResources.LABEL_EXPORT_PDF_LATEX))
 
3245
                        ex = PDFFilter.PDF_EXTENSION;
 
3246
                else
 
3247
                        ex = PSFilter.PS_EXTENSION;
3230
3248
                
3231
3249
                int id = name.toLowerCase().indexOf(ex.toLowerCase());
3232
3250
                
3495
3513
                projectName = null;
3496
3514
                        setTitle();
3497
3515
                drawPanel.newProject();
 
3516
                setZoom(DrawContainer.DEFAULT_ZOOM);
3498
3517
                undoManager = new UndoRedoManager(drawPanel.getDraw().getFigures(), drawPanel.getDraw(), this);
3499
3518
                        reinitializeButtons();
3500
3519
                        setSelection(false);
4672
4691
                                                displayXScale(Boolean.valueOf(n.getTextContent()).booleanValue());
4673
4692
                                        else if(name.endsWith(LaTeXDrawNamespace.XML_DISPLAY_Y))
4674
4693
                                                displayYScale(Boolean.valueOf(n.getTextContent()).booleanValue());
4675
 
                                        else if(name.endsWith(LaTeXDrawNamespace.XML_DELIMITOR_OPACITY))
 
4694
                                        else if(name.endsWith(LaTeXDrawNamespace.XML_DELIMITOR_OPACITY)) {
 
4695
                                                toolbar.getSliderDelimitor().setValue(Delimitor.getOpacity());
4676
4696
                                                Delimitor.setOpacity(Double.valueOf(n.getTextContent()).intValue());
 
4697
                                        }
 
4698
                                        else if(name.endsWith(LaTeXDrawNamespace.XML_MAGNETIC_GRID))
 
4699
                                                setMagneticGrid(Boolean.valueOf(n.getTextContent()).booleanValue());
 
4700
                                        else if(name.endsWith(LaTeXDrawNamespace.XML_ZOOM))
 
4701
                                                setZoom(Double.valueOf(n.getTextContent()).doubleValue());
 
4702
                                        else if(name.endsWith(LaTeXDrawNamespace.XML_GRID_GAP))
 
4703
                                                toolbar.getPersoGridGapField().setValue(Double.valueOf(n.getTextContent()).intValue());
 
4704
                                        else if(name.endsWith(LaTeXDrawNamespace.XML_DRAW_BORDERS))
 
4705
                                                displayBorders(Boolean.valueOf(n.getTextContent()).booleanValue());
4677
4706
                                }
4678
4707
                                catch(Exception e) { e.printStackTrace(); System.out.println(name + ": invalid value."); }//$NON-NLS-1$
4679
4708
                        }
4687
4716
        }
4688
4717
        
4689
4718
        
 
4719
        public void setZoom(double zoom) {
 
4720
                drawPanel.getDraw().setZoom(zoom);
 
4721
                toolbar.getZoomField().setValue(drawPanel.getDraw().getZoom()*100.);
 
4722
        }
 
4723
        
 
4724
        
4690
4725
        /**
4691
4726
         * @return The menu listener.
4692
4727
         * @since 2.0.0
4772
4807
        {
4773
4808
                return formerDividerLocation;
4774
4809
        }
 
4810
 
 
4811
 
 
4812
 
 
4813
        public void setPathDistribLatex(String path)
 
4814
        {
 
4815
                pathDistribLatex = path;
 
4816
        }
 
4817
        
 
4818
        
 
4819
        public String getPathDistribLatex() {
 
4820
                return pathDistribLatex;
 
4821
        }
 
4822
 
 
4823
 
 
4824
 
 
4825
        public void setLatexIncludes(String includes)
 
4826
        {
 
4827
                latexIncludes = includes;
 
4828
        }
 
4829
        
 
4830
        public String getLatexIncludes() {
 
4831
                return latexIncludes;
 
4832
        }
 
4833
        
 
4834
        public void setIsInAutoUpdate(boolean auto) {
 
4835
                menuBar.getMenuAutoUpdate().setSelected(auto);
 
4836
                codePanel.setIsInAutoUpdate(auto);
 
4837
        }
4775
4838
}