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

« back to all changes in this revision

Viewing changes to latexDraw/ui/codeEditorPane/PSTricksEditorPane.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:
49
49
        
50
50
        
51
51
        
52
 
 
 
52
        
53
53
        @Override
54
 
        public void updateText()
55
 
        {
56
 
                String seol = System.getProperty("line.separator");//$NON-NLS-1$ 
 
54
        public String getCode(boolean withLatexParams, boolean withComments) {
 
55
                String seol = System.getProperty("line.separator");//$NON-NLS-1$
 
56
                String code;
57
57
                
58
58
                if(body==null || body=="") //$NON-NLS-1$
59
 
                        setText(codePanel.getComments());
 
59
                        code = withComments ? codePanel.getComments() : "" ;
60
60
                else
61
61
                {
62
62
                        boolean addEntete;
63
63
                        StringBuffer entete = new StringBuffer();
64
64
                        StringBuffer end    = new StringBuffer();
 
65
                        String packages         = codePanel.getDocumentPackages();
65
66
                        
66
 
                        if(!codePanel.getCaption().equals("") || !codePanel.getLabel().equals("") || //$NON-NLS-1$ //$NON-NLS-2$
67
 
                           !codePanel.getPositionVertToken().equals("")) //$NON-NLS-1$
 
67
                        if(withLatexParams && (!codePanel.getCaption().equals("") || !codePanel.getLabel().equals("") || //$NON-NLS-1$ //$NON-NLS-2$
 
68
                           !codePanel.getPositionVertToken().equals(""))) //$NON-NLS-1$
68
69
                        {
69
70
                                 addEntete = true;
70
71
                                 entete.append("\\begin{figure}"); //$NON-NLS-1$
92
93
                                end.append("\\end{figure}").append(seol); //$NON-NLS-1$
93
94
                        }
94
95
                        
95
 
                        if(codePanel.getPositionHoriToken().equals(TOKEN_HORI_CENTER_START))
 
96
                        if(withLatexParams && codePanel.getPositionHoriToken().equals(TOKEN_HORI_CENTER_START))
96
97
                                end.insert(0, TOKEN_HORI_CENTER_END);
97
98
                        
98
99
                        StringBuffer madeBy = new StringBuffer();
121
122
                        stringBuffer.append(madeBy);
122
123
                        stringBuffer.append(codePanel.getComments());
123
124
                        stringBuffer.append(PACKAGE_PSTRICKS);
 
125
                        if(packages!=null && packages.length()>0) {
 
126
                                packages = "% User packages:" + seol + packages;
 
127
                                packages = packages.replace(seol, seol+"%");
 
128
                                stringBuffer.append(packages).append(seol);
 
129
                        }
124
130
                        stringBuffer.append(entete);
125
 
                        stringBuffer.append(codePanel.getPositionHoriToken());
 
131
                        if(withLatexParams)
 
132
                                stringBuffer.append(codePanel.getPositionHoriToken());
126
133
                        stringBuffer.append(begin);
127
134
                        stringBuffer.append(text);
128
135
                        
129
 
                        setText(stringBuffer.toString());
 
136
                        code = stringBuffer.toString();
130
137
                }
 
138
                
 
139
                return code;
131
140
        }
132
 
 
 
141
        
133
142
 
134
143
 
135
144
        @Override