Skip to content

Commit

Permalink
Merge pull request #888 from codemanyak/master
Browse files Browse the repository at this point in the history
Version 3.30-12 candidate
  • Loading branch information
fesch authored Dec 16, 2020
2 parents e6d479c + 02a7a49 commit dcba23f
Show file tree
Hide file tree
Showing 43 changed files with 3,838 additions and 820 deletions.
8 changes: 6 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="._*.*|lu/fisch/structorizer/gui/icons_128/|lu/fisch/structorizer/gui/icons_16/|lu/fisch/structorizer/gui/icons_256/" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry excluding="._*.*|lu/fisch/structorizer/gui/icons_128/|lu/fisch/structorizer/gui/icons_16/|lu/fisch/structorizer/gui/icons_256/|test/lu/fisch/structorizer/syntax/ExpressionTest.java" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/swing-layout-1.0.3.jar"/>
<classpathentry kind="lib" path="lib/freehep-graphics2d-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/freehep-graphicsio-2.1.1.jar"/>
Expand Down
4 changes: 2 additions & 2 deletions buildapp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
name="Structorizer"
displayname="Structorizer"
identifier="lu.fisch.Structorizer"
shortversion="3.30-11"
version="3.30-11"
shortversion="3.30-12"
version="3.30-12"
icon="icons/Structorizer.icns"
mainclassname="Structorizer"
copyright="Bob Fisch"
Expand Down
37 changes: 26 additions & 11 deletions src/lu/fisch/diagrcontrol/DiagramController.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
* Kay Gürtzig 2018-03-21 Issue #463: console output replaced by standard JDK4 (= j.u.l.) logging
* Kay Gürtzig 2018-10-12 Issue #622: Logging of API calls introduced (level CONFIG)
* Kay Gürtzig 2019-03-02 Issue #366: New methods isFocused() and requestFocus() in analogy to Window
* Kay Gürtzig 2020-12-11 Enh. #443: deprecated methods removed
* Kay Gürtzig 2020-12-14 References to lu.fisch.util.StringList and java.awt.Color eliminated
*
******************************************************************************************************
*
Expand All @@ -51,14 +53,11 @@
*
******************************************************************************************************///

import java.awt.Color;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import lu.fisch.utils.StringList;

/**
* Interface for classes that provide an API for being controlled e.g. by executed Structorizer
* diagrams.<br/>
Expand Down Expand Up @@ -245,11 +244,25 @@ public default Object execute(String name, Object[] arguments) throws FunctionEx
try {
// START KGU#597 2018-10-12: Issue #622 - better monitoring of controller activity
if (logger.isLoggable(Level.CONFIG)) {
StringList argStrings = new StringList();
for (Object arg: arguments) {
argStrings.add(String.valueOf(arg));
// START KGU#591/KGU#685 2020-12-14: Issues #622, #704: StringList replaced
//StringList argStrings = new StringList();
//for (Object arg: arguments) {
// argStrings.add(String.valueOf(arg));
//}
//logger.config("Executing " + name + "(" + argStrings.concatenate(",") + ")");
StringBuilder sb = new StringBuilder();
sb.append("Executing ");
sb.append(name);
sb.append("(");
for (int i = 0; i < arguments.length; i++) {
if (i > 0) {
sb.append(",");
}
sb.append(String.valueOf(arguments[i]));
}
logger.config("Executing " + name + "(" + argStrings.concatenate(",") + ")");
sb.append(")");
logger.config(sb.toString());
// END KGU#597/KGU#685 2020-12-14
}
// END KGU#597 2018-10-12
result = method.invoke(this, arguments);
Expand Down Expand Up @@ -324,8 +337,10 @@ public default boolean isFocused()
public default void requestFocus() {}
// END KGU#356 2019-03-02

@Deprecated
public String execute(String message);
@Deprecated
public String execute(String message, Color color);
// START KGU#448/KGU#673 2020-12-11: Enh. #443, eventually deleted
// @Deprecated
// public String execute(String message);
// @Deprecated
// public String execute(String message, Color color);
// END KGU#448/KGU#673 2020-12-11
}
31 changes: 19 additions & 12 deletions src/lu/fisch/structorizer/arranger/Arranger.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
* Kay Gürtzig 2019-03-28 Enh. #657: New argument for subdiagram retrieval methods
* Kay Gürtzig 2019-10-05 Bugfix #759: Exception catch in routinePoolChanged() as emergency workaround
* Kay Gürtzig 2020-01-20 Enh. #801: Key F1 now tries to open the PDF help file if offline
* Kay Gürtzig 2020-12-14 Adapted to the no longer reverted meaning of surface.getZoom()
*
******************************************************************************************************
*
Expand Down Expand Up @@ -141,10 +142,6 @@
* one and the same drawing area.
* @author robertfisch
*/
/**
* @author kay
*
*/
@SuppressWarnings("serial")
public class Arranger extends LangFrame implements WindowListener, KeyListener, IRoutinePool, IRoutinePoolListener, LangEventListener {

Expand Down Expand Up @@ -728,6 +725,7 @@ private void initPopupMenu() {
public void actionPerformed(ActionEvent e) {
expandRootSetOrSelection(null, Arranger.this, null);
}});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupExpandSelection.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0));

// START KGU#626 2019-01-03: Enh. #657
Expand All @@ -738,6 +736,7 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
makeGroup(Arranger.this);
}});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupGroup.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_DOWN_MASK));

popupExpandGroup = new javax.swing.JMenuItem("Expand and group ...", IconLoader.getIcon(117));
Expand All @@ -748,6 +747,7 @@ public void actionPerformed(ActionEvent e) {
expandRootSetOrSelection(null, null, null);
makeGroup(Arranger.this);
}});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupExpandGroup.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_DOWN_MASK | java.awt.event.InputEvent.SHIFT_DOWN_MASK));
// END KGU#626 201-01-03

Expand All @@ -761,6 +761,7 @@ public void actionPerformed(ActionEvent e) {
inspectAttributes(root);
}
}});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupAttributes.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, java.awt.event.InputEvent.ALT_DOWN_MASK));

popupRemove = new javax.swing.JMenuItem("Remove selected diagrams", IconLoader.getIcon(100));
Expand All @@ -770,6 +771,7 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
btnRemoveDiagramActionPerformed(e, false);
}});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupRemove.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));

popupMenu.addSeparator();
Expand All @@ -783,6 +785,7 @@ public void actionPerformed(ActionEvent e) {
rearrange();
}
});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupRearrange.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_DOWN_MASK));

popupMenu.addSeparator();
Expand All @@ -806,6 +809,7 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
helpArranger(false);
}});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupHelp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));

popupKeyBindings = new javax.swing.JMenuItem("Show key bindings ...", IconLoader.getIcon(89));
Expand All @@ -815,6 +819,7 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
helpArranger(true);
}});
// This doesn't work directly but shows the key binding handled via keyPressed()
popupKeyBindings.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, java.awt.event.InputEvent.ALT_DOWN_MASK));

}
Expand All @@ -832,14 +837,15 @@ protected void updateStatusSize() {
// statusSize.setText(surface.getWidth() + " x " + surface.getHeight());
// statusViewport.setText(vRect.x + ".." + (vRect.x + vRect.width) + " : " +
// vRect.y + ".." + (vRect.y + vRect.height));
double width = surface.getWidth() * surface.getZoom();
double height = surface.getHeight() * surface.getZoom();
Rect visRect = (new Rect(vRect)).scale(surface.getZoom());
double zoom = surface.getZoom();
double width = surface.getWidth() / zoom;
double height = surface.getHeight() / zoom;
Rect visRect = (new Rect(vRect)).scale(1/zoom);
statusSize.setText((int)width + " x " + (int)height);
statusViewport.setText(visRect.left + ".." + visRect.right + " : " +
visRect.top + ".." + visRect.bottom);
// END KGU#624 2019-03-13
statusZoom.setText(String.format("%.1f %%", 100 / surface.getZoom()));
statusZoom.setText(String.format("%.1f %%", 100 * zoom));
}

protected void updateStatusSelection() {
Expand Down Expand Up @@ -947,7 +953,7 @@ private void btnSetCoveredActionPerformed(java.awt.event.ActionEvent evt) {
// START KGU#497 2018-02-17: Enh. #513
protected void btnZoomActionPerformed(ActionEvent evt) {
surface.zoom((evt.getModifiers() & ActionEvent.SHIFT_MASK) != 0);
if (surface.getZoom() <= 1 && this.isShiftPressed) {
if (surface.getZoom() >= 1 && this.isShiftPressed) {
btnZoom.setEnabled(false);
}
}
Expand Down Expand Up @@ -1316,7 +1322,7 @@ public void keyPressed(KeyEvent ev) {
this.routinePoolChanged(this, IRoutinePoolListener.RPC_POSITIONS_CHANGED);
}
else {
scrollarea.getVerticalScrollBar().setValue(newValue);
scrollarea.getVerticalScrollBar().setValue(newValue);
}
}
break;
Expand Down Expand Up @@ -1637,7 +1643,7 @@ private void setShiftPressed(boolean isPressed) {
this.btnRemoveDiagram.setText(btnRemoveAllDiagrams.getText());
// END KGU#534 2018-06-27
this.isShiftPressed = true;
if (surface.getZoom() <= 1) {
if (surface.getZoom() >= 1) {
btnZoom.setEnabled(false);
}
}
Expand Down Expand Up @@ -2043,7 +2049,8 @@ public boolean saveAll(Component initiator, boolean goingToClose) {
*/
public void updateProperties(Ini ini)
{
ini.setProperty("arrangerZoom", Float.toString(surface.getZoom()));
// For historical reasons, the ini property has still reverse meaning
ini.setProperty("arrangerZoom", Float.toString(1/surface.getZoom()));
// START KGU#623 2018-12-20: Enh. #654
ini.setProperty("arrangerDirectory", surface.currentDirectory.getAbsolutePath());
// END KGU#623 2018-12-20
Expand Down
Loading

0 comments on commit dcba23f

Please sign in to comment.