m_statusBar.setText(null);
}
});
JMenuItem menuItem;
menuItem = new JStatusMenuItem(Main.getString("menu_img_rotate_90"), Main.getString("statusbar_menuimg_rotate90_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
int orientation = JImgView.getNextOrientation(m_imgView.getOrientation(), true);
if (orientation != 0)
m_imgView.setOrientation(orientation);
}
});
menuItem = new JStatusMenuItem(Main.getString("menu_img_rotate_-90"), Main.getString("statusbar_menuimg_rotate-90_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
int orientation = JImgView.getNextOrientation(m_imgView.getOrientation(), false);
if (orientation != 0)
m_imgView.setOrientation(orientation);
}
});
menuItem = new JStatusMenuItem(Main.getString("menu_img_rotate_180"), Main.getString("statusbar_menuimg_rotate180_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
int orientation = JImgView.getNextOrientation(m_imgView.getOrientation(), true);
orientation = JImgView.getNextOrientation(orientation, true);
if (orientation != 0)
m_imgView.setOrientation(orientation);
}
});
menuItem = new JStatusMenuItem(Main.getString("menu_img_rotate_flip"), Main.getString("statusbar_menuimg_rotateflip_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
int orientation = JImgView.getNextFlipOrientation(m_imgView.getOrientation());
if (orientation != 0)
m_imgView.setOrientation(orientation);
}
});
if (m_imgView.getCustomOrientation() != 0)
{
menu.addSeparator();
menuItem = new JStatusMenuItem(Main.getString("menu_img_rotate_original"), Main.getString("statusbar_menuimg_original_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setOrientation(0);
}
});
}
menu.addSeparator();
JMenu sizeMenu = new JMenu(Main.getString("menu_img_size"));
float zoom = m_imgView.getZoom();
JStatusRadioButtonMenuItem radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_fit"), Main.getString("statusbar_menuimg_size_fit_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 0.0f);
radioMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK));
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.resetZoom();
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_8"), Main.getString("statusbar_menuimg_size_8_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 8.0f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(8.0f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_4"), Main.getString("statusbar_menuimg_size_4_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 4.0f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(4.0f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_2"), Main.getString("statusbar_menuimg_size_2_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 2.0f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(2.0f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_1"), Main.getString("statusbar_menuimg_size_1_help"), m_statusBar);
radioMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MULTIPLY, InputEvent.CTRL_DOWN_MASK));
radioMenuItem.setSelected(zoom == 1.0f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(1.0f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_075"), Main.getString("statusbar_menuimg_size_075_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 0.75f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(0.75f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_050"), Main.getString("statusbar_menuimg_size_050_help"), m_statusBar);
radioMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DIVIDE, InputEvent.CTRL_DOWN_MASK));
radioMenuItem.setSelected(zoom == 0.5f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(0.5f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_025"), Main.getString("statusbar_menuimg_size_025_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 0.25f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(.25f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_0125"), Main.getString("statusbar_menuimg_size_0125_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 0.125f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(.125f);
}
});
sizeMenu.add(radioMenuItem);
radioMenuItem = new JStatusRadioButtonMenuItem(Main.getString("menu_img_size_00625"), Main.getString("statusbar_menuimg_size_00625_help"), m_statusBar);
radioMenuItem.setSelected(zoom == 0.0625f);
radioMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoom(.0625f);
}
});
sizeMenu.add(radioMenuItem);
sizeMenu.addSeparator();
menuItem = new JStatusMenuItem(Main.getString("menu_img_size_down"), Main.getString("statusbar_menuimg_size_down_help"), m_statusBar);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_DOWN_MASK));
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoomDown();
}
});
sizeMenu.add(menuItem);
menuItem = new JStatusMenuItem(Main.getString("menu_img_size_up"), Main.getString("statusbar_menuimg_size_up_help"), m_statusBar);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_DOWN_MASK));
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.setZoomUp();
}
});
sizeMenu.add(menuItem);
menu.add(sizeMenu);
menu.addSeparator();
menuItem = new JStatusMenuItem(Main.getString("menu_img_print"), Main.getString("statusbar_menuimg_print_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
final PrinterJob printerJob = PrinterJob.getPrinterJob();
if (m_pageFormat == null) m_pageFormat = printerJob.defaultPage();
PageFormat pf = printerJob.pageDialog(m_pageFormat);
if (pf != m_pageFormat)
{
m_pageFormat = pf;
printerJob.setPrintable(m_imgView, m_pageFormat);
printerJob.setJobName(Main.getString("caption"));
if (printerJob.printDialog())
{
Thread thread = new Thread ()
{
@Override
public void run()
{
try
{
printerJob.print();
}
catch (PrinterException ex)
{}
finally
{
SwingUtilities.invokeLater( new Runnable()
{
public void run()
{
m_statusBar.setText(Main.getString("statusbar_print_end"));
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
});
}
}
};
m_statusBar.setText(Main.getString("statusbar_print_start"));
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
thread.start();
}
}
}
});
final JIfdData ifdData = m_imgView.getIfdData();
if (ifdData != null && m_imgView.getCustomOrientation() != 0)
{
menuItem = new JStatusMenuItem(Main.getString("menu_img_save"), Main.getString("statusbar_menuimg_save_help"), m_statusBar);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.saveOrientation(true);
}
});
menu.addSeparator();
menu.add(menuItem);
}
menu.addSeparator();
menuItem = new JStatusMenuItem(Main.getString("menu_img_export"), Main.getString("statusbar_menuimg_export_help"), m_statusBar); menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
m_imgView.export();
}
});
menu.addSeparator();
menuItem = new JStatusMenuItem(Main.getString("cancel"), Main.getString("statusbar_menuimg_cancel_help"), m_statusBar);
menu.add(menuItem);
m_statusBar.saveText();
menu.show(m_imgView, ev.getX(), ev.getY());
}
}