# 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'
#
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
<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">
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";
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 );
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;
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 );
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;
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
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();
}
}
}
- 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 );
.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() );
_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 );
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() );
}
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 );
- }
}
}
}
}
- 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() + ")" );
}
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;
_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;
}
}
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();
return _domain_colors;
}
- int getGraphicsExportX() {
- return _graphics_export_x;
- }
-
- int getGraphicsExportY() {
- return _graphics_export_y;
- }
-
+
Color getGuiBackgroundColor() {
return _gui_background_color;
}
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
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
}\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
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
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
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
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
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
.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() );
_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 );
.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
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
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
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
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;
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;
_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;
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;
}
_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 ) {
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;
}
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() ) );
}
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() ) {
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 ) );
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 );
//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;
}
_longest_ext_node_info = longest;
}
_length_of_longest_text = calcLengthOfLongestText();
- System.out.println( "_length_of_longest_text=" + _length_of_longest_text );
- //~~
}
final void calculateScaleDistance() {