Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting network visualizer rewrite #74

Merged
merged 23 commits into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions src/frames/UtilFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import utils.SortingNetworkGenerator;
import utils.Sounds;
import utils.Timer;

/*
*
*
MIT License

Copyright (c) 2019 w0rthy
Expand Down Expand Up @@ -66,7 +66,7 @@ final public class UtilFrame extends javax.swing.JFrame {
private boolean jCheckBox9WarningShown = true; //set to false to enable warning

private int[] array;

private ArrayManager ArrayManager;
private ArrayVisualizer ArrayVisualizer;
private Delays Delays;
Expand All @@ -78,16 +78,16 @@ final public class UtilFrame extends javax.swing.JFrame {

public UtilFrame(int[] array, ArrayVisualizer arrayVisualizer) {
this.array = array;

this.ArrayVisualizer = arrayVisualizer;
this.ArrayManager = ArrayVisualizer.getArrayManager();

this.Delays = ArrayVisualizer.getDelays();
this.Frame = ArrayVisualizer.getMainWindow();
this.Highlights = ArrayVisualizer.getHighlights();
this.RealTimer = ArrayVisualizer.getTimer();
this.Sounds = ArrayVisualizer.getSounds();

setUndecorated(true);
initComponents();
setLocation(Math.min((int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() - getWidth(), Frame.getX() + Frame.getWidth()), Frame.getY() + 29);
Expand Down Expand Up @@ -440,7 +440,7 @@ public void jButton2ResetText() {

private void jButton3ActionPerformed() {//GEN-FIRST:event_jButton3ActionPerformed
boolean speedPromptAllowed;

if(this.abstractFrame == null) {
speedPromptAllowed = true;
}
Expand All @@ -450,7 +450,7 @@ else if(!this.abstractFrame.isVisible()) {
else {
speedPromptAllowed = false;
}

if(speedPromptAllowed) {
boolean showPrompt = true;
while(showPrompt) {
Expand Down Expand Up @@ -595,12 +595,13 @@ private void jComboBox1ActionPerformed() {//GEN-FIRST:event_jButton4ActionPerfor
break;
jButton6.setEnabled(true);
ArrayVisualizer.setComparator(4);
if (!SortingNetworkGenerator.verifyPythonVersionAndDialog())
jComboBox1.setSelectedIndex(0); // Failure to find Python installation
if (ArrayVisualizer.getCurrentLength() > 256) {
JOptionPane.showMessageDialog(null, "Large sorting networks take too long and will not be generated. Array lengths less than or equal to 256 are recommended.",
"Sorting Network Visualizer", JOptionPane.WARNING_MESSAGE);
ArrayVisualizer.getArrayFrame().setLengthSlider(256);
if (ArrayVisualizer.getCurrentLength() > 1024) {
JOptionPane.showMessageDialog(
null,
"Large sorting networks can take a long time (and high RAM usage) to visualize.\n" +
"A length of 1024 or less is recommended.",
"Sorting Network Visualizer", JOptionPane.WARNING_MESSAGE
);
}
break;

Expand Down
Loading