Permalink
Browse files

removed obsolete classes

  • Loading branch information...
1 parent 3fdf0d2 commit 630a3468ad9445e4a296c0a4bb99bccf500ee922 @ribomation ribomation committed Mar 25, 2012
@@ -1,95 +0,0 @@
-/*
- * Project: droidAtScreen
- * File: FrameRateCommand.java
- * Modified: 2011-10-04
- *
- * Copyright (C) 2011, Ribomation AB (Jens Riboe).
- * http://blog.ribomation.com/
- *
- * You are free to use this software and the source code as you like.
- * We do appreciate if you attribute were it came from.
- */
-
-package com.ribomation.droidAtScreen.cmd;
-
-import com.ribomation.droidAtScreen.Application;
-
-import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-
-/**
- * DESCRIPTION
- *
- * @user jens
- * @date 2010-jan-18 10:35:20
- */
-@Deprecated
-public class FrameRateCommand extends Command {
-
-
- public FrameRateCommand() {
- updateView(getApplication().getSettings().getFrameRate());
- setTooltip("Sets the rate of how many screen-shots should be taken per second");
- setIcon("rate");
- }
-
- public void updateView(int rate) {
- setLabel(String.format("Frame Rate (%d frames/min)", rate));
- }
-
- @Override
- protected void doExecute(Application app) {
- JDialog dialog = new JDialog(app.getAppFrame(), "Set Frame Rate", true);
- JOptionPane optPane = new JOptionPane(createPane(dialog), JOptionPane.QUESTION_MESSAGE);
- dialog.setContentPane(optPane);
- dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- dialog.pack();
- dialog.setLocationByPlatform(true);
- dialog.setVisible(true);
- }
-
- private JPanel createPane(final JDialog dialog) {
- JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
- panel.setBorder(BorderFactory.createTitledBorder("Frame Rate (frames / minute)"));
-
- ActionListener action = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- int rate = Integer.parseInt( e.getActionCommand() );
- dialog.dispose();
- getApplication().getSettings().setFrameRate(rate);
- updateView(rate);
- getApplication().setFrameRate(rate); //todo: fix this
- }
- };
-
- ButtonGroup group = new ButtonGroup();
- for (int count : getApplication().getSettings().getFrameRates()) {
- JRadioButton rb = createButton(count, action);
- group.add(rb);
- panel.add(rb);
- }
-
- return panel;
- }
-
- private JRadioButton createButton(int numUpdates, ActionListener action) {
- String lbl = Integer.toString(numUpdates);
-
- JRadioButton r = new JRadioButton(numUpdates == 100 ? "Fastest" : lbl);
- r.setActionCommand(lbl);
- r.addActionListener(action);
- if (numUpdates == getApplication().getSettings().getFrameRate()) {
- r.setSelected(true);
- }
-
- return r;
- }
-
-
-}
@@ -1,64 +0,0 @@
-/*
- * Project: droidAtScreen
- * File: OrientationCommand.java
- * Modified: 2011-10-04
- *
- * Copyright (C) 2011, Ribomation AB (Jens Riboe).
- * http://blog.ribomation.com/
- *
- * You are free to use this software and the source code as you like.
- * We do appreciate if you attribute were it came from.
- */
-
-package com.ribomation.droidAtScreen.cmd;
-
-import com.ribomation.droidAtScreen.Application;
-
-import javax.swing.*;
-
-/**
- * Flips the device frame orientation.
- *
- * @user jens
- * @date 30 september 2011, 14:19
- */
-@Deprecated
-public class OrientationCommand extends CheckBoxCommand {
-
- public OrientationCommand() {
- updateView(getPreferenceValue());
- setTooltip("Flip the orientation (portrait | landscape)");
- setEnabledOnlyWithDevice(true);
- }
-
- @Override
- protected void notifyApplication(Application app, boolean landscape) {
- app.setLandscapeMode(landscape);
- updateView(landscape);
- app.getAppFrame().validate();
- }
-
- @Override
- protected boolean getPreferenceValue() {
- return getApplication().getSettings().isLandscape();
- }
-
- @Override
- protected void setPreferenceValue(boolean value) {
- getApplication().getSettings().setLandscape(value);
- }
-
- private void updateView(boolean landscape) {
- setLabel(landscape ? "Landscape" : "Portrait ");
- setIcon("orientation-" + getLabel().toLowerCase().trim());
- }
-
- @Override
- public AbstractButton newButton() {
- JToggleButton b = new JToggleButton(this);
- b.setVerticalTextPosition(AbstractButton.BOTTOM);
- b.setHorizontalTextPosition(AbstractButton.CENTER);
- b.setSelected(getPreferenceValue());
- return b;
- }
-}
@@ -1,90 +0,0 @@
-/*
- * Project: droidAtScreen
- * File: ScaleCommand.java
- * Modified: 2011-10-04
- *
- * Copyright (C) 2011, Ribomation AB (Jens Riboe).
- * http://blog.ribomation.com/
- *
- * You are free to use this software and the source code as you like.
- * We do appreciate if you attribute were it came from.
- */
-
-package com.ribomation.droidAtScreen.cmd;
-
-import com.ribomation.droidAtScreen.Application;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * Set the device frame projection scale, as a percentage.
- *
- * @user jens
- * @date 30 september 2011, 14:19
- */
-@Deprecated
-public class ScaleCommand extends Command {
-
- public ScaleCommand() {
- int scale = getApplication().getSettings().getScale();
- updateView(scale);
- setIcon("zoom");
- setTooltip("Sets the projection scale % of the Android Device. 100% is normal size");
- setMnemonic('Q');
- setEnabledOnlyWithDevice(true);
- }
-
- private void updateView(int scale) {
- setLabel(String.format("Scale (%d%%)", scale));
- }
-
- @Override
- protected void doExecute(Application app) {
- JDialog dialog = new JDialog(app.getAppFrame(), "Set the Device Frame Scale", true);
- JOptionPane optPane = new JOptionPane(createScalePane(dialog), JOptionPane.QUESTION_MESSAGE);
- dialog.setContentPane(optPane);
- dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- dialog.pack();
- dialog.setLocationByPlatform(true);
- dialog.setVisible(true);
- }
-
- private JPanel createScalePane(final JDialog dialog) {
- JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
- p.setBorder( BorderFactory.createTitledBorder("Projection Scale") );
-
- ActionListener action = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- int percentage = Integer.parseInt( e.getActionCommand() );
- dialog.dispose();
- getApplication().getSettings().setScale(percentage);
- updateView(percentage);
- getApplication().setScale(percentage);
- }
- };
-
- ButtonGroup scale = new ButtonGroup();
- for (int s : getApplication().getSettings().getScales()) {
- JRadioButton rb = createScaleRadioButton(s, action);
- scale.add(rb);
- p.add(rb);
- }
-
- return p;
- }
-
- private JRadioButton createScaleRadioButton(int percentage, ActionListener action) {
- JRadioButton r = new JRadioButton(percentage + "%");
- r.setActionCommand( Integer.toString(percentage) );
- r.addActionListener(action);
- if (percentage == getApplication().getSettings().getScale()) {
- r.setSelected(true);
- }
- return r;
- }
-
-}
@@ -1,101 +0,0 @@
-/*
- * Project: droidAtScreen
- * File: ScreenShotCommand.java
- * Modified: 2011-10-04
- *
- * Copyright (C) 2011, Ribomation AB (Jens Riboe).
- * http://blog.ribomation.com/
- *
- * You are free to use this software and the source code as you like.
- * We do appreciate if you attribute were it came from.
- */
-
-package com.ribomation.droidAtScreen.cmd;
-
-import com.ribomation.droidAtScreen.Application;
-import com.ribomation.droidAtScreen.Settings;
-import com.ribomation.droidAtScreen.dev.AndroidDevice;
-import com.ribomation.droidAtScreen.dev.ScreenImage;
-import com.ribomation.droidAtScreen.gui.DeviceFrame;
-
-import javax.imageio.ImageIO;
-import javax.swing.*;
-import javax.swing.filechooser.FileNameExtensionFilter;
-import java.io.File;
-import java.util.Arrays;
-
-/**
- * Takes a screen-shot of the current device image.
- *
- * @user jens
- * @date 30 september 2011, 14:19
- */
-@Deprecated
-public class ScreenShotCommand extends Command {
- private int count = 1;
-
- public ScreenShotCommand() {
- setLabel("Capture");
- setIcon("camera");
- setTooltip("Takes a screen-shot of the current device and saves it as a PNG file.");
- setEnabledOnlyWithDevice(true);
- }
-
- @Override
- protected void doExecute(final Application app) {
- final DeviceFrame device = app.getSelectedDevice();
- if (device == null) return;
-
- final Settings settings = app.getSettings();
-
- File suggestedFile = new File(String.format("droidAtScreen-%d.%s", count++, settings.getImageFormat().toLowerCase()));
- if (settings.isAskBeforeScreenshot()) {
- final JFileChooser chooser = new JFileChooser();
- chooser.setCurrentDirectory(settings.getImageDirectory());
- chooser.setSelectedFile(suggestedFile);
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- chooser.addChoosableFileFilter(new FileNameExtensionFilter("Image Files", settings.getImageFormats()));
-
- int rc = chooser.showSaveDialog(app.getAppFrame());
- if (rc != JFileChooser.APPROVE_OPTION) return;
-
- suggestedFile = chooser.getSelectedFile();
- }
-
- if (suggestedFile.exists()) {
- int rc = JOptionPane.showConfirmDialog(app.getAppFrame(),
- "File '" + suggestedFile + "' already exist. Do you want to overwrite?",
- "Overwrite file",
- JOptionPane.YES_NO_OPTION);
- if (rc != JOptionPane.YES_OPTION) return;
- }
-
- final File imageFile = suggestedFile;
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- try {
- ScreenImage screenShot = device.getLastScreenshot();
- ImageIO.write(screenShot.toBufferedImage(), getFormat(imageFile), imageFile);
- app.getAppFrame().getStatusBar().message("Written", imageFile.getAbsolutePath());
- } catch (Exception e) {
- JOptionPane.showMessageDialog(app.getAppFrame(),
- "Failed to save file " + imageFile + ". " + e.getMessage(),
- "Failure",
- JOptionPane.ERROR_MESSAGE);
- }
- }
-
- String getFormat(File f) {
- final String name = f.getName();
- final int dot = name.lastIndexOf('.');
- if (dot > 0) {
- String ext = name.substring(dot + 1).toUpperCase();
- if (Arrays.asList(settings.getImageFormats()).contains(ext)) return ext;
- }
- throw new RuntimeException("Invalid extension: " + name);
- }
- });
-
- }
-}
Oops, something went wrong.

0 comments on commit 630a346

Please sign in to comment.