fixed issue with cutting off of long names in pdf export + minor changes
authorcmzmasek <cmzmasek@yahoo.com>
Fri, 1 Jul 2016 01:00:31 +0000 (18:00 -0700)
committercmzmasek <cmzmasek@yahoo.com>
Fri, 1 Jul 2016 01:00:31 +0000 (18:00 -0700)
12 files changed:
forester/aptx/aptx_configuration_files/_aptx_configuration_file
forester/java/build.xml
forester/java/src/org/forester/archaeopteryx/AptxConstants.java
forester/java/src/org/forester/archaeopteryx/AptxUtil.java
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/MainFrame.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java
forester/java/src/org/forester/archaeopteryx/Options.java
forester/java/src/org/forester/archaeopteryx/PdfExporter.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java

index 2ca3dc7..8236aa2 100644 (file)
@@ -40,15 +40,6 @@ native_ui: ?
 #                                    ext_node_sum_dep
 #                                    total_node_sum_dep (for "uniform" branch lengths)
 #
-#  Default size for graphics export and printing: 'graphics_export_x' and 'graphics_export_y':
-#     (Archaeopteryx tries to guess the locale, so setting these is not always necessary)
-#     Example: For A4 (portrait):
-#               'graphics_export_x: 595'
-#               'graphics_export_y: 845'
-#             For US Letter (portrait):
-#               'graphics_export_x: 612'
-#               'graphics_export_y: 792'
-#
 #  Default line width for PDF export: 'pdf_export_line_wdith':
 #     Example: 'pdf_export_line_width: 0.5'
 #
@@ -177,8 +168,6 @@ show_node_shapes_for_nodes_with_vis_data:  yes
 default_node_size:                         4
 default_node_shape:                        rectangle
 default_node_fill:                         solid
-#graphics_export_x:                         595
-#graphics_export_y:                         792
 pdf_export_line_width:                     0.5
 show_overview:                             yes
 overview_width:                            120
index 41380d2..812c56a 100644 (file)
@@ -21,9 +21,6 @@
         <copy verbose="true"
           file="../resources/phyloxml_schema/1.10/phyloxml.xsd"
           todir="${classes.dir}/resources"/>
-        <copy verbose="true"
-          file="../resources/synth_laf/synth_look_and_feel_1.xml"
-          todir="${classes.dir}/resources"/>
     </target>
 
        <target name="compile" description="Compiles the Task" depends="clean">
index f2e803a..bd7cd3f 100644 (file)
@@ -68,10 +68,6 @@ public final class AptxConstants {
     static final String         APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE                  = "homology_type_analysis_query_sequence";
     static final String         APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE          = "homology_type_analysis_initial_relation_type";
     static final int            MAX_TREES_TO_LOAD                                             = 100;
-    static final int            US_LETTER_SIZE_X                                              = 612;
-    static final int            US_LETTER_SIZE_Y                                              = 792;
-    static final int            A4_SIZE_X                                                     = 595;
-    static final int            A4_SIZE_Y                                                     = 845;
     final static float          PDF_LINE_WIDTH_DEFAULT                                        = 0.5f;
     final static String         APTX_WEB_SITE                                                 = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx";
     final static String         APTX_DOC_SITE                                                 = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/documentation";
index 5b3dafa..5f94b35 100644 (file)
@@ -902,14 +902,7 @@ public final class AptxUtil {
                                                                        final ControlPanel ac,
                                                                        final GraphicsExportType type,
                                                                        final Options options ) throws IOException {
-        if ( !options.isGraphicsExportUsingActualSize() ) {
-            if ( options.isGraphicsExportVisibleOnly() ) {
-                throw new IllegalArgumentException( "cannot export visible rectangle only without exporting in actual size" );
-            }
-            tree_panel.calcParametersForPainting( options.getPrintSizeX(), options.getPrintSizeY() );
-            tree_panel.resetPreferredSize();
-            tree_panel.repaint();
-        }
+        
         final RenderingHints rendering_hints = new RenderingHints( RenderingHints.KEY_RENDERING,
                                                                    RenderingHints.VALUE_RENDER_QUALITY );
         rendering_hints.put( RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY );
@@ -926,11 +919,11 @@ public final class AptxUtil {
             return "";
         }
         Rectangle visible = null;
-        if ( !options.isGraphicsExportUsingActualSize() ) {
-            width = options.getPrintSizeX();
-            height = options.getPrintSizeY();
-        }
-        else if ( options.isGraphicsExportVisibleOnly() ) {
+//        if ( !options.isGraphicsExportUsingActualSize() ) {
+//            width = options.getPrintSizeX();
+//            height = options.getPrintSizeY();
+//        }
+       /* else*/ if ( options.isGraphicsExportVisibleOnly() ) {
             visible = tree_panel.getVisibleRect();
             width = visible.width;
             height = visible.height;
@@ -967,14 +960,7 @@ public final class AptxUtil {
                                                       final ControlPanel ac,
                                                       final GraphicsExportType type,
                                                       final Options options ) throws IOException {
-        if ( !options.isGraphicsExportUsingActualSize() ) {
-            if ( options.isGraphicsExportVisibleOnly() ) {
-                throw new IllegalArgumentException( "cannot export visible rectangle only without exporting in actual size" );
-            }
-            tree_panel.calcParametersForPainting( options.getPrintSizeX(), options.getPrintSizeY() );
-            tree_panel.resetPreferredSize();
-            tree_panel.repaint();
-        }
+       
         final RenderingHints rendering_hints = new RenderingHints( RenderingHints.KEY_RENDERING,
                                                                    RenderingHints.VALUE_RENDER_QUALITY );
         rendering_hints.put( RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY );
@@ -995,11 +981,11 @@ public final class AptxUtil {
             throw new IOException( "\"" + file_name + "\" is a directory" );
         }
         Rectangle visible = null;
-        if ( !options.isGraphicsExportUsingActualSize() ) {
-            width = options.getPrintSizeX();
-            height = options.getPrintSizeY();
-        }
-        else if ( options.isGraphicsExportVisibleOnly() ) {
+//        if ( !options.isGraphicsExportUsingActualSize() ) {
+//            width = options.getPrintSizeX();
+//            height = options.getPrintSizeY();
+//        }
+        /*else*/ if ( options.isGraphicsExportVisibleOnly() ) {
             visible = tree_panel.getVisibleRect();
             width = visible.width;
             height = visible.height;
index 6743505..1612aba 100644 (file)
@@ -154,9 +154,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
     private JCheckBoxMenuItem           _graphics_export_visible_only_cbmi;
     private JCheckBoxMenuItem           _antialias_print_cbmi;
     private JCheckBoxMenuItem           _print_black_and_white_cbmi;
-    private JCheckBoxMenuItem           _print_using_actual_size_cbmi;
-    private JCheckBoxMenuItem           _graphics_export_using_actual_size_cbmi;
-    private JMenuItem                   _print_size_mi;
     private JMenuItem                   _choose_pdf_width_mi;
 
     @Override
@@ -492,15 +489,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         else if ( o == _print_black_and_white_cbmi ) {
             updateOptions( getOptions() );
         }
-        else if ( o == _print_using_actual_size_cbmi ) {
-            updateOptions( getOptions() );
-        }
-        else if ( o == _graphics_export_using_actual_size_cbmi ) {
-            updateOptions( getOptions() );
-        }
-        else if ( o == _print_size_mi ) {
-            choosePrintSize();
-        }
         else if ( o == _choose_pdf_width_mi ) {
             choosePdfWidth();
         }
@@ -905,53 +893,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
     }
 
-    private void choosePrintSize() {
-        final String s = ( String ) JOptionPane.showInputDialog( this,
-                                                                 "Please enter values for width and height,\nseparated by a comma.\n"
-                                                                         + "[current values: "
-                                                                         + getOptions().getPrintSizeX() + ", "
-                                                                         + getOptions().getPrintSizeY() + "]\n"
-                                                                         + "[A4: " + AptxConstants.A4_SIZE_X + ", "
-                                                                         + AptxConstants.A4_SIZE_Y + "]\n" + "[US Letter: "
-                                                                         + AptxConstants.US_LETTER_SIZE_X + ", "
-                                                                         + AptxConstants.US_LETTER_SIZE_Y + "]",
-                                                                         "Default Size for Graphics Export",
-                                                                         JOptionPane.QUESTION_MESSAGE,
-                                                                         null,
-                                                                         null,
-                                                                         getOptions().getPrintSizeX() + ", "
-                                                                                 + getOptions().getPrintSizeY() );
-        if ( !ForesterUtil.isEmpty( s ) && ( s.indexOf( ',' ) > 0 ) ) {
-            boolean success = true;
-            int x = 0;
-            int y = 0;
-            final String[] str_ary = s.split( "," );
-            if ( str_ary.length == 2 ) {
-                final String x_str = str_ary[ 0 ].trim();
-                final String y_str = str_ary[ 1 ].trim();
-                if ( !ForesterUtil.isEmpty( x_str ) && !ForesterUtil.isEmpty( y_str ) ) {
-                    try {
-                        x = Integer.parseInt( x_str );
-                        y = Integer.parseInt( y_str );
-                    }
-                    catch ( final Exception ex ) {
-                        success = false;
-                    }
-                }
-                else {
-                    success = false;
-                }
-            }
-            else {
-                success = false;
-            }
-            if ( success && ( x > 1 ) && ( y > 1 ) ) {
-                getOptions().setPrintSizeX( x );
-                getOptions().setPrintSizeY( y );
-            }
-        }
-    }
-
     private void customizeRadioButtonMenuItem( final JRadioButtonMenuItem item, final boolean is_selected ) {
         if ( item != null ) {
             item.setFont( MainFrame.menu_font );
@@ -1105,7 +1046,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
                         .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
                 MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, MainFrame
                         .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) );
-                setTextForGraphicsSizeChooserMenuItem( _print_size_mi, getOptions() );
                 setTextForPdfLineWidthChooserMenuItem( _choose_pdf_width_mi, getOptions() );
                 MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
                 MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
@@ -1179,21 +1119,12 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         _options_jmenu.add( _antialias_print_cbmi = new JCheckBoxMenuItem( "Antialias" ) );
         _options_jmenu.add( _print_black_and_white_cbmi = new JCheckBoxMenuItem( "Export in Black and White" ) );
         _options_jmenu
-                .add( _print_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PDF export and Printing" ) );
-        _options_jmenu
-                .add( _graphics_export_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PNG, JPG, and GIF export" ) );
-        _options_jmenu
                 .add( _graphics_export_visible_only_cbmi = new JCheckBoxMenuItem( "Limit to Visible ('Screenshot') for PNG, JPG, and GIF export" ) );
-        _options_jmenu.add( _print_size_mi = new JMenuItem( "" ) );
         _options_jmenu.add( _choose_pdf_width_mi = new JMenuItem( "" ) );
         //
         customizeCheckBoxMenuItem( _antialias_print_cbmi, getOptions().isAntialiasPrint() );
         customizeCheckBoxMenuItem( _print_black_and_white_cbmi, getOptions().isPrintBlackAndWhite() );
         customizeCheckBoxMenuItem( _graphics_export_visible_only_cbmi, getOptions().isGraphicsExportVisibleOnly() );
-        customizeCheckBoxMenuItem( _print_using_actual_size_cbmi, getOptions().isPrintUsingActualSize() );
-        customizeCheckBoxMenuItem( _graphics_export_using_actual_size_cbmi, getOptions()
-                .isGraphicsExportUsingActualSize() );
-        customizeJMenuItem( _print_size_mi );
         customizeJMenuItem( _choose_pdf_width_mi );
         //
         customizeJMenuItem( _choose_font_mi );
@@ -1781,10 +1712,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         options.setSearchWithRegex( ( _search_with_regex_cbmi != null ) && _search_with_regex_cbmi.isSelected() );
         options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )
                 && _inverse_search_result_cbmi.isSelected() );
-        options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null )
-                                         && ( _print_using_actual_size_cbmi.isSelected() ) );
-        options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )
-                                                  && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );
         options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );
         options.setPrintBlackAndWhite( ( _print_black_and_white_cbmi != null )
                                        && _print_black_and_white_cbmi.isSelected() );
@@ -1823,13 +1750,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
         if ( _graphics_export_visible_only_cbmi != null ) {
             options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() );
-            if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) {
-                _graphics_export_using_actual_size_cbmi.setSelected( true );
-                _graphics_export_using_actual_size_cbmi.setEnabled( false );
-            }
-            else {
-                _graphics_export_using_actual_size_cbmi.setEnabled( true );
-            }
         }
     }
 
@@ -1872,11 +1792,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
     }
 
-    static void setTextForGraphicsSizeChooserMenuItem( final JMenuItem mi, final Options o ) {
-        mi.setText( "Enter Default Size for Graphics Export... (current: " + o.getPrintSizeX() + ", "
-                + o.getPrintSizeY() + ")" );
-    }
-
     static void setTextForPdfLineWidthChooserMenuItem( final JMenuItem mi, final Options o ) {
         mi.setText( "Enter Default Line Width for PDF Export... (current: " + o.getPrintLineWidth() + ")" );
     }
index 3bb5d27..79fec13 100644 (file)
@@ -207,8 +207,6 @@ public final class Configuration {
     private EXT_NODE_DATA_RETURN_ON         _ext_node_data_return_on                               = EXT_NODE_DATA_RETURN_ON.WINODW;
     private int                             _frame_x_size;
     private int                             _frame_y_size;
-    private int                             _graphics_export_x                                     = -1;
-    private int                             _graphics_export_y                                     = -1;
     private Color                           _gui_background_color                                  = AptxConstants.GUI_BACKGROUND_DEFAULT;
     private Color                           _gui_button_background_color                           = AptxConstants.BUTTON_BACKGROUND_COLOR_DEFAULT;
     private Color                           _gui_button_border_color                               = AptxConstants.BUTTON_BORDER_COLOR_DEFAULT;
@@ -853,13 +851,13 @@ public final class Configuration {
         _ext_node_data_return_on = ext_node_data_return_on;
     }
 
-    private void setGraphicsExportX( final int graphics_export_x ) {
-        _graphics_export_x = graphics_export_x;
-    }
+    //private void setGraphicsExportX( final int graphics_export_x ) {
+    //    _graphics_export_x = graphics_export_x;
+    //}
 
-    private void setGraphicsExportY( final int graphics_export_y ) {
-        _graphics_export_y = graphics_export_y;
-    }
+    //private void setGraphicsExportY( final int graphics_export_y ) {
+    //    _graphics_export_y = graphics_export_y;
+    //}
 
     private void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
         _internal_number_are_confidence_for_nh_parsing = internal_number_are_confidence_for_nh_parsing;
@@ -971,18 +969,18 @@ public final class Configuration {
             }
         }
         else if ( key.equals( "graphics_export_x" ) ) {
-            final String str = ( ( String ) st.nextElement() ).trim();
-            final int i = parseInt( str );
-            if ( i > 0 ) {
-                setGraphicsExportX( i );
-            }
+           // final String str = ( ( String ) st.nextElement() ).trim();
+           // final int i = parseInt( str );
+           // if ( i > 0 ) {
+           //     setGraphicsExportX( i );
+           // }
         }
         else if ( key.equals( "graphics_export_y" ) ) {
-            final String str = ( ( String ) st.nextElement() ).trim();
-            final int i = parseInt( str );
-            if ( i > 0 ) {
-                setGraphicsExportY( i );
-            }
+            //final String str = ( ( String ) st.nextElement() ).trim();
+           // final int i = parseInt( str );
+            //if ( i > 0 ) {
+            //    setGraphicsExportY( i );
+            //}
         }
         else if ( key.equals( "pdf_export_line_width" ) ) {
             final String str = ( ( String ) st.nextElement() ).trim();
@@ -1633,14 +1631,7 @@ public final class Configuration {
         return _domain_colors;
     }
 
-    int getGraphicsExportX() {
-        return _graphics_export_x;
-    }
-
-    int getGraphicsExportY() {
-        return _graphics_export_y;
-    }
-
     Color getGuiBackgroundColor() {
         return _gui_background_color;
     }
index 4c85a4a..100bfbb 100644 (file)
@@ -234,9 +234,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     JCheckBoxMenuItem                _graphics_export_visible_only_cbmi;\r
     JCheckBoxMenuItem                _antialias_print_cbmi;\r
     JCheckBoxMenuItem                _print_black_and_white_cbmi;\r
-    JCheckBoxMenuItem                _print_using_actual_size_cbmi;\r
-    JCheckBoxMenuItem                _graphics_export_using_actual_size_cbmi;\r
-    JMenuItem                        _print_size_mi;\r
+    //JMenuItem                        _print_size_mi;\r
     JMenuItem                        _choose_pdf_width_mi;\r
     // _  parsing\r
     JCheckBoxMenuItem                _internal_number_are_confidence_for_nh_parsing_cbmi;\r
@@ -725,15 +723,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         else if ( o == _print_black_and_white_cbmi ) {\r
             updateOptions( getOptions() );\r
         }\r
-        else if ( o == _print_using_actual_size_cbmi ) {\r
-            updateOptions( getOptions() );\r
-        }\r
-        else if ( o == _graphics_export_using_actual_size_cbmi ) {\r
-            updateOptions( getOptions() );\r
-        }\r
-        else if ( o == _print_size_mi ) {\r
-            choosePrintSize();\r
-        }\r
         else if ( o == _choose_pdf_width_mi ) {\r
             choosePdfWidth();\r
         }\r
@@ -1266,53 +1255,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }\r
     }\r
 \r
-    void choosePrintSize() {\r
-        final String s = ( String ) JOptionPane.showInputDialog( this,\r
-                                                                 "Please enter values for width and height,\nseparated by a comma.\n"\r
-                                                                         + "[current values: "\r
-                                                                         + getOptions().getPrintSizeX() + ", "\r
-                                                                         + getOptions().getPrintSizeY() + "]\n"\r
-                                                                         + "[A4: " + AptxConstants.A4_SIZE_X + ", "\r
-                                                                         + AptxConstants.A4_SIZE_Y + "]\n" + "[US Letter: "\r
-                                                                         + AptxConstants.US_LETTER_SIZE_X + ", "\r
-                                                                         + AptxConstants.US_LETTER_SIZE_Y + "]",\r
-                                                                 "Default Size for Graphics Export",\r
-                                                                 JOptionPane.QUESTION_MESSAGE,\r
-                                                                 null,\r
-                                                                 null,\r
-                                                                 getOptions().getPrintSizeX() + ", "\r
-                                                                         + getOptions().getPrintSizeY() );\r
-        if ( !ForesterUtil.isEmpty( s ) && ( s.indexOf( ',' ) > 0 ) ) {\r
-            boolean success = true;\r
-            int x = 0;\r
-            int y = 0;\r
-            final String[] str_ary = s.split( "," );\r
-            if ( str_ary.length == 2 ) {\r
-                final String x_str = str_ary[ 0 ].trim();\r
-                final String y_str = str_ary[ 1 ].trim();\r
-                if ( !ForesterUtil.isEmpty( x_str ) && !ForesterUtil.isEmpty( y_str ) ) {\r
-                    try {\r
-                        x = Integer.parseInt( x_str );\r
-                        y = Integer.parseInt( y_str );\r
-                    }\r
-                    catch ( final Exception ex ) {\r
-                        success = false;\r
-                    }\r
-                }\r
-                else {\r
-                    success = false;\r
-                }\r
-            }\r
-            else {\r
-                success = false;\r
-            }\r
-            if ( success && ( x > 1 ) && ( y > 1 ) ) {\r
-                getOptions().setPrintSizeX( x );\r
-                getOptions().setPrintSizeY( y );\r
-            }\r
-        }\r
-    }\r
-\r
     void close() {\r
         removeAllTextFrames();\r
         if ( _mainpanel != null ) {\r
@@ -1893,10 +1835,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         if ( ( _color_by_taxonomic_group_cbmi != null ) && _color_by_taxonomic_group_cbmi.isEnabled() ) {\r
             options.setColorByTaxonomicGroup( _color_by_taxonomic_group_cbmi.isSelected() );\r
         }\r
-        options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null )\r
-                && ( _print_using_actual_size_cbmi.isSelected() ) );\r
-        options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )\r
-                && ( _graphics_export_using_actual_size_cbmi.isSelected() ) );\r
         options.setAntialiasPrint( ( _antialias_print_cbmi != null ) && _antialias_print_cbmi.isSelected() );\r
         if ( ( _use_brackets_for_conf_in_nh_export_cbmi != null )\r
                 && _use_brackets_for_conf_in_nh_export_cbmi.isSelected() ) {\r
@@ -1935,14 +1873,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         options.setInverseSearchResult( ( _inverse_search_result_cbmi != null )\r
                 && _inverse_search_result_cbmi.isSelected() );\r
         if ( _graphics_export_visible_only_cbmi != null ) {\r
-            options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() );\r
-            if ( _graphics_export_visible_only_cbmi.isSelected() && ( _graphics_export_using_actual_size_cbmi != null ) ) {\r
-                _graphics_export_using_actual_size_cbmi.setSelected( true );\r
-                _graphics_export_using_actual_size_cbmi.setEnabled( false );\r
-            }\r
-            else {\r
-                _graphics_export_using_actual_size_cbmi.setEnabled( true );\r
-            }\r
+            options.setGraphicsExportVisibleOnly( _graphics_export_visible_only_cbmi.isSelected() );    \r
         }\r
         if ( ( _rectangular_type_cbmi != null ) && _rectangular_type_cbmi.isSelected() ) {\r
             options.setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );\r
@@ -2212,11 +2143,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         if ( ( tp == null ) || ( tp.getPhylogeny() == null ) || tp.getPhylogeny().isEmpty() ) {\r
             return;\r
         }\r
-        if ( !op.isPrintUsingActualSize() ) {\r
-            tp.calcParametersForPainting( op.getPrintSizeX() - 80, op.getPrintSizeY() - 140 );\r
-            tp.resetPreferredSize();\r
-            tp.repaint();\r
-        }\r
         final String job_name = AptxConstants.PRG_NAME;\r
         boolean error = false;\r
         String printer_name = null;\r
@@ -2243,22 +2169,15 @@ public abstract class MainFrame extends JFrame implements ActionListener {
                                      final Options opts,\r
                                      final TreePanel tp,\r
                                      final Component comp ) {\r
-        if ( !opts.isPrintUsingActualSize() ) {\r
-            tp.calcParametersForPainting( opts.getPrintSizeX(), opts.getPrintSizeY() );\r
-            tp.resetPreferredSize();\r
-            tp.repaint();\r
-        }\r
+       \r
         String pdf_written_to = "";\r
         boolean error = false;\r
         try {\r
             if ( opts.isPrintUsingActualSize() ) {\r
-                pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name, tp, tp.getWidth(), tp.getHeight() );\r
+                pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name, tp, tp.getWidth() , tp.getHeight()  );\r
             }\r
             else {\r
-                pdf_written_to = PdfExporter.writePhylogenyToPdf( file_name,\r
-                                                                  tp,\r
-                                                                  opts.getPrintSizeX(),\r
-                                                                  opts.getPrintSizeY() );\r
+                // Never false.\r
             }\r
         }\r
         catch ( final IOException e ) {\r
@@ -2337,11 +2256,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         mi.setText( "Select Default Font... (current: " + font_desc + ")" );\r
     }\r
 \r
-    static void setTextForGraphicsSizeChooserMenuItem( final JMenuItem mi, final Options o ) {\r
-        mi.setText( "Enter Default Size for Graphics Export... (current: " + o.getPrintSizeX() + ", "\r
-                + o.getPrintSizeY() + ")" );\r
-    }\r
-\r
     static void setTextForPdfLineWidthChooserMenuItem( final JMenuItem mi, final Options o ) {\r
         mi.setText( "Enter Default Line Width for PDF Export... (current: " + o.getPrintLineWidth() + ")" );\r
     }\r
index 5d753af..bc5b737 100644 (file)
@@ -186,7 +186,7 @@ public final class MainFrameApplet extends MainFrame {
                 .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );
                 MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, createCurrentFontDesc( getMainPanel()
                                                                                                  .getTreeFontSet() ) );
-                setTextForGraphicsSizeChooserMenuItem( _print_size_mi, getOptions() );
+               // setTextForGraphicsSizeChooserMenuItem( _print_size_mi, getOptions() );
                 setTextForPdfLineWidthChooserMenuItem( _choose_pdf_width_mi, getOptions() );
                 MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );
                 MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );
@@ -251,30 +251,20 @@ public final class MainFrameApplet extends MainFrame {
         _options_jmenu.add( _search_with_regex_cbmi = new JCheckBoxMenuItem( MainFrame.SEARCH_REGEX_LABEL ) );
         _search_with_regex_cbmi.setToolTipText( MainFrame.SEARCH_WITH_REGEX_TIP );
         _options_jmenu.add( _inverse_search_result_cbmi = new JCheckBoxMenuItem( INVERSE_SEARCH_RESULT_LABEL ) );
-        //
+      
         _options_jmenu.addSeparator();
         _options_jmenu.add( customizeMenuItemAsLabel( new JMenuItem( "Graphics Export & Printing:" ),
                                                       getConfiguration() ) );
         _options_jmenu.add( _antialias_print_cbmi = new JCheckBoxMenuItem( "Antialias" ) );
         _options_jmenu.add( _print_black_and_white_cbmi = new JCheckBoxMenuItem( "Export in Black and White" ) );
         _options_jmenu
-        .add( _print_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PDF export and Printing" ) );
-        _options_jmenu
-        .add( _graphics_export_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PNG, JPG, and GIF export" ) );
-        _options_jmenu
         .add( _graphics_export_visible_only_cbmi = new JCheckBoxMenuItem( "Limit to Visible ('Screenshot') for PNG, JPG, and GIF export" ) );
-        _options_jmenu.add( _print_size_mi = new JMenuItem( "" ) );
         _options_jmenu.add( _choose_pdf_width_mi = new JMenuItem( "" ) );
-        //
+    
         customizeCheckBoxMenuItem( _antialias_print_cbmi, getOptions().isAntialiasPrint() );
         customizeCheckBoxMenuItem( _print_black_and_white_cbmi, getOptions().isPrintBlackAndWhite() );
-        customizeCheckBoxMenuItem( _graphics_export_visible_only_cbmi, getOptions().isGraphicsExportVisibleOnly() );
-        customizeCheckBoxMenuItem( _print_using_actual_size_cbmi, getOptions().isPrintUsingActualSize() );
-        customizeCheckBoxMenuItem( _graphics_export_using_actual_size_cbmi, getOptions()
-                                   .isGraphicsExportUsingActualSize() );
-        customizeJMenuItem( _print_size_mi );
         customizeJMenuItem( _choose_pdf_width_mi );
-        //
+      
         customizeJMenuItem( _choose_font_mi );
         customizeJMenuItem( _switch_colors_mi );
         customizeJMenuItem( _choose_minimal_confidence_mi );
index d78cf09..1d36727 100644 (file)
@@ -1776,7 +1776,7 @@ public final class MainFrameApplication extends MainFrame {
                 .setTextMinSupportMenuItem( _choose_minimal_confidence_mi, getOptions(), getCurrentTreePanel() );\r
                 MainFrame.setTextForFontChooserMenuItem( _choose_font_mi, MainFrame\r
                                                          .createCurrentFontDesc( getMainPanel().getTreeFontSet() ) );\r
-                MainFrame.setTextForGraphicsSizeChooserMenuItem( _print_size_mi, getOptions() );\r
+              //  MainFrame.setTextForGraphicsSizeChooserMenuItem( _print_size_mi, getOptions() );\r
                 MainFrame.setTextForPdfLineWidthChooserMenuItem( _choose_pdf_width_mi, getOptions() );\r
                 MainFrame.setCycleNodeFillMenuItem( _cycle_node_fill_mi, getOptions() );\r
                 MainFrame.setCycleNodeShapeMenuItem( _cycle_node_shape_mi, getOptions() );\r
@@ -1845,13 +1845,13 @@ public final class MainFrameApplication extends MainFrame {
                                                       getConfiguration() ) );\r
         _options_jmenu.add( _antialias_print_cbmi = new JCheckBoxMenuItem( "Antialias" ) );\r
         _options_jmenu.add( _print_black_and_white_cbmi = new JCheckBoxMenuItem( "Export in Black and White" ) );\r
-        _options_jmenu\r
-        .add( _print_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PDF export and Printing" ) );\r
-        _options_jmenu\r
-        .add( _graphics_export_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PNG, JPG, and GIF export" ) );\r
+        //_options_jmenu\r
+        //.add( _print_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PDF export and Printing" ) );\r
+        //_options_jmenu\r
+        //.add( _graphics_export_using_actual_size_cbmi = new JCheckBoxMenuItem( "Use Current Image Size for PNG, JPG, and GIF export" ) );\r
         _options_jmenu\r
         .add( _graphics_export_visible_only_cbmi = new JCheckBoxMenuItem( "Limit to Visible ('Screenshot') for PNG, JPG, and GIF export" ) );\r
-        _options_jmenu.add( _print_size_mi = new JMenuItem( "" ) );\r
+       // _options_jmenu.add( _print_size_mi = new JMenuItem( "" ) );\r
         _options_jmenu.add( _choose_pdf_width_mi = new JMenuItem( "" ) );\r
         _options_jmenu.addSeparator();\r
         _options_jmenu.add( customizeMenuItemAsLabel( new JMenuItem( "Newick/NHX/Nexus Read:" ), getConfiguration() ) );\r
@@ -1888,7 +1888,7 @@ public final class MainFrameApplication extends MainFrame {
         customizeJMenuItem( _choose_font_mi );\r
         customizeJMenuItem( _choose_minimal_confidence_mi );\r
         customizeJMenuItem( _switch_colors_mi );\r
-        customizeJMenuItem( _print_size_mi );\r
+       // customizeJMenuItem( _print_size_mi );\r
         customizeJMenuItem( _choose_pdf_width_mi );\r
         customizeJMenuItem( _overview_placment_mi );\r
         customizeCheckBoxMenuItem( _show_default_node_shapes_external_cbmi, getOptions()\r
@@ -1939,9 +1939,6 @@ public final class MainFrameApplication extends MainFrame {
         customizeCheckBoxMenuItem( _inverse_search_result_cbmi, getOptions().isInverseSearchResult() );\r
         customizeCheckBoxMenuItem( _color_all_found_nodes_when_coloring_subtree_cbmi, getOptions().isColorAllFoundNodesWhenColoringSubtree() ); \r
         customizeCheckBoxMenuItem( _graphics_export_visible_only_cbmi, getOptions().isGraphicsExportVisibleOnly() );\r
-        customizeCheckBoxMenuItem( _print_using_actual_size_cbmi, getOptions().isPrintUsingActualSize() );\r
-        customizeCheckBoxMenuItem( _graphics_export_using_actual_size_cbmi, getOptions()\r
-                                   .isGraphicsExportUsingActualSize() );\r
         customizeCheckBoxMenuItem( _show_confidence_stddev_cbmi, getOptions().isShowConfidenceStddev() );\r
         customizeCheckBoxMenuItem( _use_brackets_for_conf_in_nh_export_cbmi, getOptions()\r
                                    .getNhConversionSupportValueStyle() == NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS );\r
index 4172c52..1143288 100644 (file)
@@ -88,7 +88,7 @@ final public class Options {
     private short                             _default_node_shape_size;
     private boolean                           _editable;
     private NodeDataField                     _ext_desc_data_to_return;
-    private boolean                           _graphics_export_using_actual_size;
+    private final boolean                     _graphics_export_using_actual_size = true;
     private boolean                           _graphics_export_visible_only;
     private boolean                           _internal_number_are_confidence_for_nh_parsing;
     private boolean                           _inverse_search_result;
@@ -104,9 +104,7 @@ final public class Options {
     private PHYLOGENY_GRAPHICS_TYPE           _phylogeny_graphics_type;
     private boolean                           _print_black_and_white;
     private float                             _print_line_width;
-    private int                               _print_size_x;
-    private int                               _print_size_y;
-    private boolean                           _print_using_actual_size;
+    private final boolean                     _print_using_actual_size = true;
     private double                            _scale_bar_length;
     private boolean                           _search_case_sensitive;
     private boolean                           _show_annotation_ref_source;
@@ -197,18 +195,8 @@ final public class Options {
         _show_default_node_shapes_external = false;
         _show_default_node_shapes_for_marked_nodes = false;
         _color_all_found_nodes_when_coloring_subtree = false;
-        if ( AptxUtil.isUsOrCanada() ) {
-            _print_size_x = AptxConstants.US_LETTER_SIZE_X;
-            _print_size_y = AptxConstants.US_LETTER_SIZE_Y;
-        }
-        else {
-            _print_size_x = AptxConstants.A4_SIZE_X;
-            _print_size_y = AptxConstants.A4_SIZE_Y;
-        }
         _min_confidence_value = MIN_CONFIDENCE_DEFAULT;
         _print_black_and_white = false;
-        _print_using_actual_size = true;
-        _graphics_export_using_actual_size = true;
         _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
         _base_font = new Font( Configuration.getDefaultFontFamilyName(), Font.PLAIN, 10 );
         _match_whole_terms_only = false;
@@ -296,14 +284,6 @@ final public class Options {
         return _print_line_width;
     }
 
-    final int getPrintSizeX() {
-        return _print_size_x;
-    }
-
-    final int getPrintSizeY() {
-        return _print_size_y;
-    }
-
     final double getScaleBarLength() {
         return _scale_bar_length;
     }
@@ -448,18 +428,8 @@ final public class Options {
         _editable = editable;
     }
 
-    final void setGraphicsExportUsingActualSize( final boolean graphics_export_using_actual_size ) {
-        _graphics_export_using_actual_size = graphics_export_using_actual_size;
-        if ( !graphics_export_using_actual_size ) {
-            setGraphicsExportVisibleOnly( false );
-        }
-    }
-
     final void setGraphicsExportVisibleOnly( final boolean graphics_export_visible_only ) {
         _graphics_export_visible_only = graphics_export_visible_only;
-        if ( graphics_export_visible_only ) {
-            setGraphicsExportUsingActualSize( true );
-        }
     }
 
     final void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
@@ -501,19 +471,7 @@ final public class Options {
     final void setPrintLineWidth( final float print_line_width ) {
         _print_line_width = print_line_width;
     }
-
-    final void setPrintSizeX( final int print_size_x ) {
-        _print_size_x = print_size_x;
-    }
-
-    final void setPrintSizeY( final int print_size_y ) {
-        _print_size_y = print_size_y;
-    }
-
-    final void setPrintUsingActualSize( final boolean print_using_actual_size ) {
-        _print_using_actual_size = print_using_actual_size;
-    }
-
+    
     final void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
         _nh_parsing_replace_underscores = nh_parsing_replace_underscores;
     }
@@ -590,12 +548,6 @@ final public class Options {
             if ( configuration.getMinConfidenceValue() != MIN_CONFIDENCE_DEFAULT ) {
                 instance.setMinConfidenceValue( configuration.getMinConfidenceValue() );
             }
-            if ( configuration.getGraphicsExportX() > 0 ) {
-                instance.setPrintSizeX( configuration.getGraphicsExportX() );
-            }
-            if ( configuration.getGraphicsExportY() > 0 ) {
-                instance.setPrintSizeY( configuration.getGraphicsExportY() );
-            }
             if ( configuration.getBaseFontSize() > 0 ) {
                 instance.setBaseFont( instance.getBaseFont().deriveFont( ( float ) configuration.getBaseFontSize() ) );
             }
index 2d5bcb0..56b41d6 100644 (file)
@@ -61,18 +61,28 @@ final class PdfExporter {
 
     private static final int HEIGHT_LIMIT = 100;
     private static final int WIDTH_LIMIT  = 60;
-
+    private static final int MARGIN_X = 20;
+    private static final int MARGIN_Y = 10;
+    
     private PdfExporter() {
         // Empty constructor.
     }
 
-    static String writePhylogenyToPdf( final String file_name, final TreePanel tree_panel, int width, int height )
+    static String writePhylogenyToPdf( final String file_name, final TreePanel tree_panel, final int width, final int height )
             throws IOException {
+        final int my_height;
+        final int my_width;
         if ( height < HEIGHT_LIMIT ) {
-            height = HEIGHT_LIMIT;
+            my_height = HEIGHT_LIMIT + 2 * MARGIN_Y;
+        }
+        else {
+            my_height = height + 2 * MARGIN_Y;
         }
         if ( width < WIDTH_LIMIT ) {
-            width = WIDTH_LIMIT;
+            my_width = WIDTH_LIMIT +  2 * MARGIN_X;
+        }
+        else {
+            my_width = width +  2 * MARGIN_X;
         }
         final Phylogeny phylogeny = tree_panel.getPhylogeny();
         if ( ( phylogeny == null ) || phylogeny.isEmpty() ) {
@@ -81,13 +91,16 @@ final class PdfExporter {
         if ( tree_panel.getMainPanel().getTreeFontSet().getSmallFont().getSize() < 1 ) {
             throw new IOException( "fonts are too small for PDF export" );
         }
+        if ( tree_panel.getMainPanel().getTreeFontSet().getLargeFont().getSize() < 1 ) {
+            throw new IOException( "fonts are too small for PDF export" );
+        }
         final File file = new File( file_name );
         if ( file.isDirectory() ) {
             throw new IOException( "[" + file_name + "] is a directory" );
         }
         final Document document = new Document();
-        document.setPageSize( new Rectangle( width, height ) );
-        document.setMargins( WIDTH_LIMIT / 2, WIDTH_LIMIT / 2, HEIGHT_LIMIT / 2, HEIGHT_LIMIT / 2 );
+        document.setPageSize( new Rectangle( my_width, my_height ) );
+        document.setMargins( MARGIN_X, MARGIN_X, MARGIN_Y, MARGIN_Y );
         PdfWriter writer = null;
         try {
             writer = PdfWriter.getInstance( document, new FileOutputStream( file_name ) );
@@ -115,10 +128,10 @@ final class PdfExporter {
         enableUnicode( mapper );
         final PdfContentByte cb = writer.getDirectContent();
         
-        final Graphics2D g2 = new PdfGraphics2D(cb, width, height, mapper); 
+        final Graphics2D g2 = new PdfGraphics2D(cb, my_width, my_height, mapper); 
     
         try {
-            tree_panel.paintPhylogeny( g2, true, false, width, height, 0, 0 );
+            tree_panel.paintPhylogeny( g2, true, false, my_width, my_height, 0, 0 );
         }
         catch ( final Exception e ) {
             AptxUtil.unexpectedException( e );
@@ -132,10 +145,7 @@ final class PdfExporter {
                 //Do nothing.
             }
         }
-        String msg = file.toString();
-        if ( ( width > 0 ) && ( height > 0 ) ) {
-            msg += " [size: " + width + ", " + height + "]";
-        }
+        final String msg = file.toString() +  " [size: " + my_width + ", " + my_height + "]";
         return msg;
     }
 
index ff41db5..4b0bf09 100644 (file)
@@ -4505,8 +4505,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             _longest_ext_node_info = longest;
         }
         _length_of_longest_text = calcLengthOfLongestText();
-        System.out.println( "_length_of_longest_text=" + _length_of_longest_text );
-        //~~
     }
 
     final void calculateScaleDistance() {