Skip to content

Commit

Permalink
It's alive
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias.pueski@sick.de committed Dec 16, 2020
1 parent edad433 commit 005d6bd
Show file tree
Hide file tree
Showing 17 changed files with 173 additions and 21 deletions.
13 changes: 12 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
<classpathentry kind="lib" path="lib/swingx-beaninfo-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/autocomplete.jar"/>
<classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-15">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/org.springframework.asm-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/org.springframework.beans-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/org.springframework.context-3.0.5.RELEASE.jar"/>
Expand All @@ -29,5 +33,12 @@
<classpathentry kind="lib" path="lib/jcommon-1.0.17.jar"/>
<classpathentry kind="lib" path="lib/jfreechart-1.0.14.jar"/>
<classpathentry kind="lib" path="lib/jcas.jar" sourcepath="C:/devel/indigo_workspace/jcas"/>
<classpathentry kind="lib" path="lib/RXTXcomm.jar">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="BlackBoard/lib/native"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/jaxb-api-2.3.0.jar"/>
<classpathentry kind="lib" path="lib/javax.activation-1.2.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
7 changes: 4 additions & 3 deletions MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.6.0_26-b03 (Sun Microsystems Inc.)
Built-By: pueskma
Ant-Version: Apache Ant 1.9.14
Created-By: 1.8.0_212-20190603180034.buildslave.jdk8u-src-tar--b03 (Or
acle Corporation)
Built-By: mpue
Main-Class: org.pmedv.blackboard.app.BlackBoard
Class-Path: lib/commons-beanutils-1.8.3.jar lib/beansbinding-1.2.
1.jar lib/commons-collections-3.2.jar lib/commons-io-1.3.1.ja
Expand Down
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Fri Jul 31 15:01:36 CEST 2015
build.number=0
#Sun Sep 29 10:28:42 CEST 2019
build.number=2
Binary file added lib/RXTXcomm.jar
Binary file not shown.
Binary file added lib/javax.activation-1.2.0.jar
Binary file not shown.
Binary file added lib/jaxb-api-2.3.0.jar
Binary file not shown.
Binary file added lib/native/rxtxParallel.dll
Binary file not shown.
Binary file added lib/native/rxtxSerial.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions resources/MessageResources_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ EditPropertiesCommand.diode.title = Diode bearbeiten
EditPropertiesCommand.diode.subtitle = Eigenschaften der DIode ändern
EditPropertiesCommand.part.title = Bauteil bearbeiten
EditPropertiesCommand.part.subtitle = Ändern der Eigenschaften eines Bauteils
ExportGCodeCommand.name = GCode exportieren
ExportGCodeCommand.description = Exportiert GCode für die aktuelle Datei
ExportImageCommand.name = Bild exportieren
ExportImageCommand.description = Exportiert die aktuelle Platine als Bild
ExportImageCommand.dialog.subtitle = Wählen Sie den Ausgabepfad und die Eigenschaften des Bildes
Expand Down
2 changes: 2 additions & 0 deletions resources/MessageResources_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ ToggleMagneticCommand.name = Toggle magnetic mode
ToggleMagneticCommand.description = let wires and symbols behave magnetic
EditSymbolCommand.name = Edit symbol
EditSymbolCommand.description = Edits the properties of a symbol
ExportGCodeCommand.name = Export GCode
ExportGCodeCommand.description = Exports GCode for the current selected file
EditPartPanel.partData = Part properties
EditPartPanel.partName = Part name
EditPartPanel.packageType = Package type
Expand Down
3 changes: 2 additions & 1 deletion resources/commands.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@
<bean id="importLibraryCommand" class="org.pmedv.blackboard.commands.ImportLibraryCommand"/>
<bean id="setDrawMeasureModeCommand" class="org.pmedv.blackboard.commands.SetDrawMeasureModeCommand"/>
<bean id="setMoveModeCommand" class="org.pmedv.blackboard.commands.SetMoveModeCommand"/>

<bean id="exportGCodeCommand" class="org.pmedv.blackboard.commands.ExportGCodeCommand"/>

</beans>
5 changes: 5 additions & 0 deletions resources/menus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
<items>
<actionClass>org.pmedv.blackboard.commands.ExportNetlistCommand</actionClass>
<bean>true</bean>
</items>
<items>
<actionClass>org.pmedv.blackboard.commands.ExportGCodeCommand</actionClass>
<bean>true</bean>
</items>

<items>
<actionClass>org.pmedv.blackboard.commands.BBExitCommand</actionClass>
<bean>true</bean>
Expand Down
67 changes: 67 additions & 0 deletions src/org/pmedv/blackboard/commands/ExportGCodeCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package org.pmedv.blackboard.commands;

import java.awt.event.ActionEvent;
import java.util.ArrayList;

import javax.swing.Action;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rtextarea.RTextScrollPane;
import org.pmedv.blackboard.EditorUtils;
import org.pmedv.blackboard.components.BoardEditor;
import org.pmedv.blackboard.components.Item;
import org.pmedv.blackboard.components.Layer;
import org.pmedv.blackboard.components.Line;
import org.pmedv.core.commands.AbstractOpenEditorCommand;


import net.infonode.docking.View;

public class ExportGCodeCommand extends AbstractOpenEditorCommand{

public ExportGCodeCommand() {
putValue(Action.NAME, resources.getResourceByKey("ExportGCodeCommand.name"));
putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("ExportGCodeCommand.description"));
}


@Override
public void execute(ActionEvent e) {
BoardEditor editor = EditorUtils.getCurrentActiveEditor();

if (editor != null) {

StringBuffer data = new StringBuffer();

RSyntaxTextArea textArea = new RSyntaxTextArea();
textArea.getPopupMenu().addSeparator();

ArrayList<Layer> layers = editor.getModel().getLayers();

for (Layer layer : layers) {
ArrayList<Item> items = layer.getItems();

for (Item item : items) {
if (item instanceof Line) {
Line line = (Line)item;
data.append("G01 X" + (float)(line.getStart().x / 16) + " Y" + (float)(line.getStart().y / 16) + " F100");
data.append("\n");
data.append("G01 X" + (float)(line.getEnd().x / 16)+ " Y" + (float)(line.getEnd().y / 16) +" F100");
data.append("\n");
}
}

}

textArea.setText(data.toString());

RTextScrollPane textScrollPane = new RTextScrollPane(textArea);
View view = new View("GCode for "+editor.getCurrentFile().getName(),null,textScrollPane);
openEditor(view, editor.getCurrentFile().getName().hashCode());

}


}

}
4 changes: 0 additions & 4 deletions src/org/pmedv/blackboard/commands/ExportNetlistCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,4 @@ public void execute(ActionEvent e) {

}





}
51 changes: 51 additions & 0 deletions src/org/pmedv/blackboard/components/BoardEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ of the License, or (at your option) any later version.
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.undo.UndoManager;
import javax.swing.undo.UndoableEdit;
Expand Down Expand Up @@ -400,6 +402,55 @@ else if (mouseOverLine != null) {

}
});


MouseAdapter ma = new MouseAdapter() {

private Point origin;

private Rectangle oldView = null;
private int lastZoomIndex = Integer.MAX_VALUE;

@Override
public void mousePressed(MouseEvent e) {
origin = new Point(e.getPoint());
}

@Override
public void mouseReleased(MouseEvent e) {
}

@Override
public void mouseDragged(MouseEvent e) {
if (origin != null && SwingUtilities.isMiddleMouseButton(e) ) {
JViewport viewPort = (JViewport) SwingUtilities.getAncestorOfClass(JViewport.class, BoardEditor.this);
if (viewPort != null) {
int deltaX = origin.x - e.getX();
int deltaY = origin.y - e.getY();

Rectangle view = viewPort.getViewRect();

if (oldView == null || lastZoomIndex != currentZoomIndex) {
oldView = new Rectangle(view);
lastZoomIndex = currentZoomIndex;
}

view.x = (int) (oldView.x + (deltaX * zoomLevels[currentZoomIndex]));
view.y = (int) (oldView.y + (deltaY * zoomLevels[currentZoomIndex]));

scrollRectToVisible(view);

oldView = view;

}
}
}

};

addMouseListener(ma);
addMouseMotionListener(ma);

addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
Expand Down
10 changes: 5 additions & 5 deletions src/org/pmedv/core/gui/ApplicationWindowAdvisorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ of the License, or (at your option) any later version.

import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
import com.jgoodies.looks.plastic.theme.SkyBluer;
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
//import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;


public class ApplicationWindowAdvisorImpl implements ApplicationWindowAdvisor {
Expand Down Expand Up @@ -142,10 +142,10 @@ public void preWindowCreate() {
String laf = (String) Preferences.values.get("org.pmedv.blackboard.BoardDesignerPerspective.lookAndFeel");

try {
if (laf.equals("Nimbus")) {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
}
else if (laf.equals("SkyBlue")) {
// if (laf.equals("Nimbus")) {
// UIManager.setLookAndFeel(new NimbusLookAndFeel());
// }
if (laf.equals("SkyBlue")) {
Plastic3DLookAndFeel.setPlasticTheme(new SkyBluer());
UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.pmedv.core.preferences.commands;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
Expand All @@ -25,8 +26,9 @@

import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
import com.jgoodies.looks.plastic.theme.SkyBluer;
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
//import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;

@SuppressWarnings("deprecation")
public class EditPreferencesCommand extends AbstractCommand {

private static final Log log = LogFactory.getLog(EditPreferencesCommand.class);
Expand Down Expand Up @@ -57,10 +59,24 @@ public void execute(ActionEvent e) {
if (!laf.equals(oldlaf)) {

try {
if (laf.equals("Nimbus")) {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
}
else if (laf.equals("SkyBlue")) {
// if (laf.equals("Nimbus")) {
// UIManager.setLookAndFeel(new NimbusLookAndFeel());
// UIManager.put( "control", new Color( 128, 128, 128) );
// UIManager.put( "info", new Color(128,128,128) );
// UIManager.put( "nimbusBase", new Color( 18, 30, 49) );
// UIManager.put( "nimbusAlertYellow", new Color( 248, 187, 0) );
// UIManager.put( "nimbusDisabledText", new Color( 128, 128, 128) );
// UIManager.put( "nimbusFocus", new Color(115,164,209) );
// UIManager.put( "nimbusGreen", new Color(176,179,50) );
// UIManager.put( "nimbusInfoBlue", new Color( 66, 139, 221) );
// UIManager.put( "nimbusLightBackground", new Color( 18, 30, 49) );
// UIManager.put( "nimbusOrange", new Color(191,98,4) );
// UIManager.put( "nimbusRed", new Color(169,46,34) );
// UIManager.put( "nimbusSelectedText", new Color( 255, 255, 255) );
// UIManager.put( "nimbusSelectionBackground", new Color( 104, 93, 156) );
// UIManager.put( "text", new Color( 230, 230, 230) );
// }
if (laf.equals("SkyBlue")) {
Plastic3DLookAndFeel.setPlasticTheme(new SkyBluer());
UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
com.jgoodies.looks.Options.setPopupDropShadowEnabled(true);
Expand Down

0 comments on commit 005d6bd

Please sign in to comment.