~phlash/powermonitor

e0b0368f2e1f6ecb9a430ab645c90e848a1bf787 — Phil Ashby 5 months ago e62f68a
revert to Swing now we have a Swingland wrapper mechanism
3 files changed, 32 insertions(+), 36 deletions(-)

M Makefile
M com/ashbysoft/power_meter/PowerMeter.java
M com/ashbysoft/power_meter/RmsView.java
M Makefile => Makefile +4 -9
@@ 10,8 10,6 @@ SDCCLDFLAGS=--out-fmt-s19
SCALE=0.16825378278904
# Java base path
JBASE=com/ashbysoft/power_meter
# Swingland dependency
SWINGLAND=../swingland/bin/swingland.jar
# Java tools
JAR=jar
JAVAC=javac


@@ 21,10 19,10 @@ all: $(BIN) $(BIN)/powermonitor.s19 $(BIN)/unhex $(BIN)/serio $(BIN)/serdump $(B
clean:
	rm -rf $(BIN)

$(BIN)/power_meter.jar: $(BIN)/$(JBASE)/Constants.class $(BIN)/$(JBASE)/PowerMeter.class $(BIN)/swingland.jar
$(BIN)/power_meter.jar: $(BIN)/$(JBASE)/Constants.class $(BIN)/$(JBASE)/PowerMeter.class
	cd $(BIN); $(JAR) cfme $(notdir $@) ../MANIFEST.MF com.ashbysoft.power_meter.PowerMeter $(JBASE)/PowerMeter.class $(JBASE)/Constants.class

$(BIN)/rms_view.jar: $(BIN)/$(JBASE)/Constants.class $(BIN)/$(JBASE)/RmsView.class $(BIN)/swingland.jar
$(BIN)/rms_view.jar: $(BIN)/$(JBASE)/Constants.class $(BIN)/$(JBASE)/RmsView.class
	cd $(BIN); $(JAR) cfme $(notdir $@) ../MANIFEST.MF com.ashbysoft.power_meter.RmsView $(JBASE)/RmsView*.class $(JBASE)/Constants.class

$(BIN)/average.jar: $(BIN)/$(JBASE)/Constants.class $(BIN)/$(JBASE)/Average.class


@@ 34,14 32,11 @@ $(BIN)/$(JBASE)/Constants.class: Makefile $(JBASE)/Constants.java.in
	sed -e 's/(SCALE_FACTOR)/$(SCALE)/' < $(JBASE)/Constants.java.in > $(BIN)/$(JBASE)/Constants.java
	$(JAVAC) -d $(BIN) $(BIN)/$(JBASE)/Constants.java

 $(BIN)/swingland.jar: $(SWINGLAND)
	cp -p $< $@

$(BIN)/$(JBASE)/PowerMeter.class: $(JBASE)/PowerMeter.java
	$(JAVAC) -d $(BIN) -cp $(SWINGLAND) -sourcepath $(BIN) $<
	$(JAVAC) -d $(BIN) -sourcepath $(BIN) $<

$(BIN)/$(JBASE)/RmsView.class: $(JBASE)/RmsView.java
	$(JAVAC) -d $(BIN) -cp $(SWINGLAND) -sourcepath $(BIN) $<
	$(JAVAC) -d $(BIN) -sourcepath $(BIN) $<

$(BIN)/%.class: %.java
	$(JAVAC) -d $(BIN) -sourcepath $(BIN) $<

M com/ashbysoft/power_meter/PowerMeter.java => com/ashbysoft/power_meter/PowerMeter.java +7 -7
@@ 9,13 9,13 @@ import java.io.BufferedReader;
import java.net.URLDecoder;
import java.net.Socket;

import com.ashbysoft.swingland.Color;
import com.ashbysoft.swingland.Component;
import com.ashbysoft.swingland.Graphics;
import com.ashbysoft.swingland.JFrame;
import com.ashbysoft.swingland.SwingUtilities;
import com.ashbysoft.swingland.event.KeyEvent;
import com.ashbysoft.swingland.event.KeyListener;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class PowerMeter extends Component implements Runnable, KeyListener {
	private JFrame frame;

M com/ashbysoft/power_meter/RmsView.java => com/ashbysoft/power_meter/RmsView.java +21 -20
@@ 14,23 14,23 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileInputStream;

import com.ashbysoft.swingland.Color;
import com.ashbysoft.swingland.Component;
import com.ashbysoft.swingland.Font;
import com.ashbysoft.swingland.Graphics;
import com.ashbysoft.swingland.JFrame;
import com.ashbysoft.swingland.SwingUtilities;
import com.ashbysoft.swingland.Timer;
import com.ashbysoft.swingland.event.ActionEvent;
import com.ashbysoft.swingland.event.ActionListener;
import com.ashbysoft.swingland.event.InputEvent;
import com.ashbysoft.swingland.event.KeyEvent;
import com.ashbysoft.swingland.event.KeyListener;
import com.ashbysoft.swingland.event.MouseEvent;
import com.ashbysoft.swingland.event.MouseInputListener;
import com.ashbysoft.swingland.event.MouseWheelEvent;
import com.ashbysoft.swingland.event.MouseWheelListener;
import com.ashbysoft.swingland.geom.AffineTransform;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import javax.swing.event.MouseInputListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.geom.AffineTransform;

public class RmsView extends Component
	implements Runnable, MouseInputListener, MouseWheelListener, KeyListener, ActionListener {


@@ 99,7 99,8 @@ public class RmsView extends Component
		//appframe.setSize(1000, 600);
		appframe.add(this);
		appframe.setVisible(true);
		appframe.getContentPane().addMouseInputListener(this);
		appframe.getContentPane().addMouseListener(this);
		appframe.getContentPane().addMouseMotionListener(this);
		appframe.getContentPane().addMouseWheelListener(this);
		appframe.addKeyListener(this);
	}


@@ 413,7 414,7 @@ public class RmsView extends Component
		} else if(k.getKeyCode()==KeyEvent.VK_T) {
			dotail=!dotail;
			appframe.setTitle( (dotail ? "RMS Viewer (tailing): " : "RMS Viewer: ") + rmslog.getName());
		} else if(k.getKeyCode()==KeyEvent.VK_LEFTCTRL) {
		} else if(k.getKeyCode()==KeyEvent.VK_CONTROL) {
			dohrz=true;
		} else if(k.getKeyCode()==KeyEvent.VK_F1) {
			shelp=!shelp;


@@ 423,7 424,7 @@ public class RmsView extends Component
	}

	public void keyReleased(KeyEvent k) {
		if (k.getKeyCode()==KeyEvent.VK_LEFTCTRL)
		if (k.getKeyCode()==KeyEvent.VK_CONTROL)
			dohrz=false;
	}