diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt index b68b488..1983d23 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt @@ -409,6 +409,14 @@ class EOCVSim(val params: Parameters = Parameters()) { if(!config.flags.contains("hasShownIamA") || config.flags["hasShownIamA"] == false) { DialogFactory.createIAmA(visualizer) + } else if(!config.flags.contains("hasShownIamPaperVision") || config.flags["hasShownIamPaperVision"] == false) { + DialogFactory.createIAmAPaperVision(visualizer, false) // in case the user missed the PaperVision dialog + } else if(config.flags["prefersPaperVision"] == true) { + // if the user prefers PaperVision, switch to it upon start up + val indexOfTab = visualizer.pipelineOpModeSwitchablePanel.indexOfTab("PaperVision") + if(indexOfTab >= 0) { + visualizer.pipelineOpModeSwitchablePanel.selectedIndex = indexOfTab + } } while (!eocvSimThread.isInterrupted && !destroying) { diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java index 59c57d0..3095bfe 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/DialogFactory.java @@ -28,6 +28,7 @@ import com.github.serivesmejia.eocvsim.gui.dialog.*; import com.github.serivesmejia.eocvsim.gui.dialog.SplashScreen; import com.github.serivesmejia.eocvsim.gui.dialog.iama.IAmA; +import com.github.serivesmejia.eocvsim.gui.dialog.iama.IAmAPaperVision; import com.github.serivesmejia.eocvsim.gui.dialog.source.CreateCameraSource; import com.github.serivesmejia.eocvsim.gui.dialog.source.CreateImageSource; import com.github.serivesmejia.eocvsim.gui.dialog.source.CreateSource; @@ -166,6 +167,10 @@ public static void createIAmA(Visualizer visualizer) { invokeLater(() -> new IAmA(visualizer.frame, visualizer)); } + public static void createIAmAPaperVision(Visualizer visualizer, boolean showWorkspacesButton) { + invokeLater(() -> new IAmAPaperVision(visualizer.frame, visualizer, false, showWorkspacesButton)); + } + public static void createWorkspace(Visualizer visualizer) { invokeLater(() -> new CreateWorkspace(visualizer.frame, visualizer)); } diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/pipeline/PipelineSelectorButtonsPanel.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/pipeline/PipelineSelectorButtonsPanel.kt index 7020f34..bb52622 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/pipeline/PipelineSelectorButtonsPanel.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/component/visualizer/pipeline/PipelineSelectorButtonsPanel.kt @@ -44,7 +44,7 @@ class PipelineSelectorButtonsPanel(eocvSim: EOCVSim) : JPanel(GridBagLayout()) { val pipelineWorkspaceBtt = JButton("Workspace") val workspaceButtonsPanel = JPanel(GridBagLayout()) - val pipelineCompileBtt = JButton("Build java files") + val pipelineCompileBtt = JButton("Build Java Files") private var lastWorkspacePopup: PopupX? = null diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/Configuration.java b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/Configuration.java index eda46e8..77dc7bf 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/Configuration.java +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/Configuration.java @@ -45,6 +45,7 @@ public class Configuration { public JPanel contents = new JPanel(new GridBagLayout()); public JComboBox themeComboBox = new JComboBox<>(); public JCheckBox superAccessCheckBox = new JCheckBox("Auto Accept SuperAccess on Trusted Plugins"); + public JCheckBox prefersPaperVisionCheckbox = new JCheckBox("Focus on PaperVision Upon Startup"); public JButton acceptButton = new JButton("Accept"); @@ -82,7 +83,7 @@ private void initConfiguration() { UI TAB */ - JPanel uiPanel = new JPanel(new GridLayout(2, 1, 1, 8)); + JPanel uiPanel = new JPanel(new GridLayout(3, 1, 1, 8)); /* THEME SETTING */ JPanel themePanel = new JPanel(new FlowLayout()); @@ -104,11 +105,17 @@ private void initConfiguration() { JPanel superAccessPanel = new JPanel(new FlowLayout()); superAccessCheckBox.setSelected(config.autoAcceptSuperAccessOnTrusted); - superAccessPanel.add(superAccessCheckBox); - uiPanel.add(superAccessPanel); + /* FOCUS ON PAPERVISION UPON STARTUP */ + + JPanel prefersPaperVisionPanel = new JPanel(new FlowLayout()); + + prefersPaperVisionCheckbox.setSelected(config.flags.get("prefersPaperVision")); + prefersPaperVisionPanel.add(prefersPaperVisionCheckbox); + uiPanel.add(prefersPaperVisionPanel); + tabbedPane.addTab("Interface", uiPanel); /* @@ -226,6 +233,8 @@ private void applyChanges() { config.videoRecordingFps = videoRecordingFpsComboBox.getSelectedEnum(); config.autoAcceptSuperAccessOnTrusted = superAccessCheckBox.isSelected(); + config.flags.put("prefersPaperVision", prefersPaperVisionCheckbox.isSelected()); + eocvSim.configManager.saveToFile(); //update config file if (userSelectedTheme != beforeTheme) diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmA.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmA.kt index f2a249a..c5b416c 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmA.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmA.kt @@ -98,6 +98,8 @@ class IAmA( dialog.defaultCloseOperation = JDialog.DISPOSE_ON_CLOSE dialog.setLocationRelativeTo(null) + + visualizer.eocvSim.config.flags["hasShownIamA"] = true dialog.isVisible = true } diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmAPaperVision.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmAPaperVision.kt index d7cdf0a..e5f254a 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmAPaperVision.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/iama/IAmAPaperVision.kt @@ -15,13 +15,15 @@ import javax.swing.JButton import javax.swing.JDialog import javax.swing.JFrame import javax.swing.JLabel +import javax.swing.JOptionPane import javax.swing.JPanel import javax.swing.SwingConstants class IAmAPaperVision( parent: JFrame, visualizer: Visualizer, - specificallyInterested: Boolean = false + specificallyInterested: Boolean = false, + showWorkspacesButton: Boolean = true ) { companion object { @@ -89,7 +91,7 @@ class IAmAPaperVision( add(Box.createHorizontalStrut(10)) // Add some space between the buttons - if(!specificallyInterested) { + if(!specificallyInterested && showWorkspacesButton) { add(JButton("Use Workspaces Instead").apply { addActionListener { dialog.dispose() // Close the dialog on click @@ -103,7 +105,45 @@ class IAmAPaperVision( add(JButton("Use PaperVision").apply { addActionListener { dialog.dispose() // Close the dialog on click - visualizer.pipelineOpModeSwitchablePanel.selectedIndex = visualizer.pipelineOpModeSwitchablePanel.indexOfTab("PaperVision") + + // if the user prefers PaperVision, switch to it upon start up + val indexOfTab = visualizer.pipelineOpModeSwitchablePanel.indexOfTab("PaperVision") + if(indexOfTab >= 0) { + visualizer.pipelineOpModeSwitchablePanel.selectedIndex = indexOfTab + } + + fun openPaperVisionByDefault() { + visualizer.eocvSim.config.flags["prefersPaperVision"] = true + + JOptionPane.showConfirmDialog( + parent, + "From now on, EOCV-Sim will focus on PaperVision upon startup.\nYou can change this in the settings.", + "PaperVision", + JOptionPane.DEFAULT_OPTION, + JOptionPane.INFORMATION_MESSAGE + ) + } + + if(specificallyInterested) { + openPaperVisionByDefault() + } else { + JOptionPane.showOptionDialog( + parent, + "Would you like to focus on PaperVision by default?\nThis is useful if you're not interested on the other pipeline development tools.", + "PaperVision", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE, + null, + arrayOf("Yes", "No"), + "No" + ).let { + if(it == JOptionPane.YES_OPTION) { + openPaperVisionByDefault() + } else { + visualizer.eocvSim.config.flags["prefersPaperVision"] = false + } + } + } } }) @@ -113,8 +153,8 @@ class IAmAPaperVision( buttonsPanel.alignmentX = JPanel.CENTER_ALIGNMENT // Align the panel in the BoxLayout dialog.contentPane.add(buttonsPanel) - visualizer.eocvSim.config.flags["hasShownIamA"] = true + visualizer.eocvSim.config.flags["hasShownIamPaperVision"] = true dialog.isVisible = true }