From 1f2808e6b581c31ce863f877c5c09777e711f587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anian=20B=C3=BChler?= <anian.buehler@reutlingen-university.de> Date: Wed, 29 Sep 2021 16:49:10 +0200 Subject: [PATCH] changed block-highlighting for errors to red --- src/main/java/com/ardublock/core/Context.java | 1 + .../com/ardublock/ui/OpenblocksFrame.java | 15 ++++++++------ .../listener/GenerateCodeButtonListener.java | 9 +++++++++ .../listener/SimulateCodeButtonListener.java | 9 +++++++++ .../com/ardublock/block/ardublock.properties | 6 ++++-- .../com/ardublock/block/ardublock.xml | 20 +++++++++++++++++-- .../ardublock/block/ardublock_de.properties | 7 ++++--- 7 files changed, 54 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/ardublock/core/Context.java b/src/main/java/com/ardublock/core/Context.java index cc420f0..048d514 100644 --- a/src/main/java/com/ardublock/core/Context.java +++ b/src/main/java/com/ardublock/core/Context.java @@ -235,6 +235,7 @@ public class Context { for (RenderableBlock rb : highlightBlockSet) { + rb.getBlock().setBad(false); //reset bad-state after error - added by letsgoING rb.updateInSearchResults(false); } highlightBlockSet.clear(); diff --git a/src/main/java/com/ardublock/ui/OpenblocksFrame.java b/src/main/java/com/ardublock/ui/OpenblocksFrame.java index c1c1cd1..52d1e40 100644 --- a/src/main/java/com/ardublock/ui/OpenblocksFrame.java +++ b/src/main/java/com/ardublock/ui/OpenblocksFrame.java @@ -460,27 +460,30 @@ public class OpenblocksFrame extends JFrame //***************************************** //bottomPanel.add(blockreferenceButton); - bottomPanel.add(Box.createRigidArea(new Dimension(10, 0))); //std value 30,0 bottomPanel.add(modeBasicButton); bottomPanel.add(modeProButton); bottomPanel.add(modeSimButton); - bottomPanel.add(Box.createRigidArea(new Dimension(10, 0))); //std value 30,0 + bottomPanel.add(Box.createRigidArea(new Dimension(5, 0))); //std value 30,0 + bottomPanel.add(context.getWorkspaceController().getSearchBar()); + + bottomPanel.add(Box.createRigidArea(new Dimension(5, 0))); //std value 30,0 //bottomPanel.add(zoomSlider); //bottomPanel.add(zoomInButton); //bottomPanel.add(zoomResetButton); //bottomPanel.add(zoomOutButton); - bottomPanel.add(Box.createRigidArea(new Dimension(10, 0)));//std value 30,0 + bottomPanel.add(Box.createRigidArea(new Dimension(5, 0)));//std value 30,0 bottomPanel.add(copyButton); bottomPanel.add(pasteButton); - bottomPanel.add(Box.createRigidArea(new Dimension(10, 0))); //std value 30,0 + bottomPanel.add(Box.createRigidArea(new Dimension(5, 0))); //std value 30,0 bottomPanel.add(saveImageButton); bottomPanel.add(saveDefaultButton); - bottomPanel.add(Box.createRigidArea(new Dimension(10, 0))); //std value 30,0 + bottomPanel.add(Box.createRigidArea(new Dimension(5, 0))); //std value 30,0 bottomPanel.add(versionLabel); - bottomPanel.add(Box.createRigidArea(new Dimension(10, 0))); //std value 30,0 + bottomPanel.add(Box.createRigidArea(new Dimension(5, 0))); //std value 30,0 bottomPanel.add(websiteButton); + //bottomPanel.add(lmssiteButton); this.add(topPanel, BorderLayout.NORTH); diff --git a/src/main/java/com/ardublock/ui/listener/GenerateCodeButtonListener.java b/src/main/java/com/ardublock/ui/listener/GenerateCodeButtonListener.java index 51820b8..7d65287 100644 --- a/src/main/java/com/ardublock/ui/listener/GenerateCodeButtonListener.java +++ b/src/main/java/com/ardublock/ui/listener/GenerateCodeButtonListener.java @@ -101,6 +101,7 @@ public class GenerateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -117,6 +118,7 @@ public class GenerateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -133,6 +135,7 @@ public class GenerateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -149,6 +152,7 @@ public class GenerateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -165,6 +169,7 @@ public class GenerateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -185,6 +190,7 @@ public class GenerateCodeButtonListener implements ActionListener if (loopBlockSet.size() > 1) { for (RenderableBlock rb : loopBlockSet) { + rb.getBlock().setBad(true); //added by letsgoING context.highlightBlock(rb); } JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.multipleLoopFound"), "Error", JOptionPane.ERROR_MESSAGE); @@ -237,6 +243,7 @@ public class GenerateCodeButtonListener implements ActionListener Block block2 = renderableBlock2.getBlock(); if (block2.getBlockID().equals(blockId)) { + block2.setBad(true); //added by letsgoING context.highlightBlock(renderableBlock2); errorMessage = "\n\n"+uiMessageBundle.getString("ardublock.translator.exception.socketNull.consolePrint")+" "+block2.getBlockLabel(); break; @@ -256,6 +263,7 @@ public class GenerateCodeButtonListener implements ActionListener Block block2 = renderableBlock2.getBlock(); if (block2.getBlockID().equals(blockId)) { + block2.setBad(true); //added by letsgoING context.highlightBlock(renderableBlock2); break; } @@ -274,6 +282,7 @@ public class GenerateCodeButtonListener implements ActionListener Block block2 = renderableBlock3.getBlock(); if (block2.getBlockID().equals(blockId)) { + block2.setBad(true); //added by letsgoING context.highlightBlock(renderableBlock3); errorMessage = "\n\n"+uiMessageBundle.getString("ardublock.translator.exception.subroutineNotDeclared.consolePrint")+" "+block2.getBlockLabel(); break; diff --git a/src/main/java/com/ardublock/ui/listener/SimulateCodeButtonListener.java b/src/main/java/com/ardublock/ui/listener/SimulateCodeButtonListener.java index 8310e60..bbb083b 100644 --- a/src/main/java/com/ardublock/ui/listener/SimulateCodeButtonListener.java +++ b/src/main/java/com/ardublock/ui/listener/SimulateCodeButtonListener.java @@ -108,6 +108,7 @@ public class SimulateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -124,6 +125,7 @@ public class SimulateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -140,6 +142,7 @@ public class SimulateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -156,6 +159,7 @@ public class SimulateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -172,6 +176,7 @@ public class SimulateCodeButtonListener implements ActionListener } catch (SubroutineNameDuplicatedException e1) { + renderableBlock.getBlock().setBad(true); //added by letsgoING context.highlightBlock(renderableBlock); //find the second subroutine whose name is defined, and make it highlight. though it cannot happen due to constraint of OpenBlocks -_- JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.subroutineNameDuplicated"), "Error", JOptionPane.ERROR_MESSAGE); @@ -192,6 +197,7 @@ public class SimulateCodeButtonListener implements ActionListener if (loopBlockSet.size() > 1) { for (RenderableBlock rb : loopBlockSet) { + rb.getBlock().setBad(true); //added by letsgoING context.highlightBlock(rb); } JOptionPane.showMessageDialog(parentFrame, uiMessageBundle.getString("ardublock.translator.exception.multipleLoopFound"), "Error", JOptionPane.ERROR_MESSAGE); @@ -252,6 +258,7 @@ public class SimulateCodeButtonListener implements ActionListener Block block2 = renderableBlock2.getBlock(); if (block2.getBlockID().equals(blockId)) { + block2.setBad(true); //added by letsgoING context.highlightBlock(renderableBlock2); errorMessage = "\n\n"+uiMessageBundle.getString("ardublock.translator.exception.socketNull.consolePrint")+" "+block2.getBlockLabel(); break; @@ -270,6 +277,7 @@ public class SimulateCodeButtonListener implements ActionListener Block block2 = renderableBlock2.getBlock(); if (block2.getBlockID().equals(blockId)) { + block2.setBad(true); //added by letsgoING context.highlightBlock(renderableBlock2); break; } @@ -288,6 +296,7 @@ public class SimulateCodeButtonListener implements ActionListener Block block2 = renderableBlock3.getBlock(); if (block2.getBlockID().equals(blockId)) { + block2.setBad(true); //added by letsgoING context.highlightBlock(renderableBlock3); errorMessage = "\n\n"+uiMessageBundle.getString("ardublock.translator.exception.subroutineNotDeclared.consolePrint")+" "+block2.getBlockLabel(); break; diff --git a/src/main/resources/com/ardublock/block/ardublock.properties b/src/main/resources/com/ardublock/block/ardublock.properties index 9351739..212bcea 100644 --- a/src/main/resources/com/ardublock/block/ardublock.properties +++ b/src/main/resources/com/ardublock/block/ardublock.properties @@ -26,7 +26,7 @@ ardublock.ui.add_comment=Add Comment ardublock.ui.delete_comment=Delete Comment ardublock.ui.organize_blocks=Organize all blocks ardublock.ui.create_refer=create reference -ardublock.ui.website=letsgoING Project +ardublock.ui.website=letsgoING ardublock.ui.website.domain=https://letsgoing.org ardublock.ui.website.tooltip=goto letsgoING project-page ardublock.ui.lmssite=Online LMS @@ -70,7 +70,7 @@ ardublock.ui.simulatorHelp.tooltip=About the letsgoING-simulator ardublock.ui.simulatorHelp.title=About the letsgoING-simulator ardublock.ui.simulatorHelp.text= -ardublock.ui.version=v2.2 beta3 newBlockFormat +ardublock.ui.version=v2.2 beta3 nBF ardublock.ui.appprefix.standard= ardublock.ui.appprefix.pro=Pro @@ -627,6 +627,8 @@ bg.setter_variable_analog== bg.setter_variable_analog.description= bg.create_variable_analog== bg.create_variable_analog.description= +bg.create_array_analog== +bg.create_array_analog.description= #ARRAYS #**************************** diff --git a/src/main/resources/com/ardublock/block/ardublock.xml b/src/main/resources/com/ardublock/block/ardublock.xml index 50b408a..2ebe67c 100644 --- a/src/main/resources/com/ardublock/block/ardublock.xml +++ b/src/main/resources/com/ardublock/block/ardublock.xml @@ -1876,6 +1876,7 @@ </BlockGenus> + <!--TESTESTEST--> <BlockGenus name="setter_variable_analog" kind="command" color="255 0 0" initlabel="bg.setter_variable_analog" editable-label="no"> <description> <text>TESTTEST</text> @@ -1890,6 +1891,19 @@ </BlockGenus> <BlockGenus name="create_variable_analog" kind="command" color="255 0 0" initlabel="bg.create_variable_analog" editable-label="no"> + <description> + <text>TESTTEST</text> + </description> + <BlockConnectors> + <BlockConnector connector-type="number" connector-kind="socket" label="int" position-type="bottom"> + <DefaultArg genus-name="variable_number" label="analoge_Variable" /> + </BlockConnector> + <BlockConnector connector-type="number" connector-kind="socket" position-type="bottom"> + </BlockConnector> + </BlockConnectors> + </BlockGenus> + + <BlockGenus name="create_array_analog" kind="command" color="255 0 0" initlabel="bg.create_array_analog" editable-label="no"> <description> <text>TESTTEST</text> </description> @@ -3062,13 +3076,15 @@ </BlockDrawer> <BlockDrawer button-color="255 0 0" name="bd.number" type="default"> + <BlockGenusMember>setter_variable_analog</BlockGenusMember> + <BlockGenusMember>create_variable_analog</BlockGenusMember> + <BlockGenusMember>create_array_analog</BlockGenusMember> + <BlockGenusMember>numberDivider1</BlockGenusMember> <BlockGenusMember>millis</BlockGenusMember> <BlockGenusMember>numberDivider2</BlockGenusMember> - <!-- <BlockGenusMember>setter_variable_analog</BlockGenusMember> - <BlockGenusMember>create_variable_analog</BlockGenusMember>--> <BlockGenusMember>setter_variable_digital</BlockGenusMember> <BlockGenusMember>variable_digital</BlockGenusMember> diff --git a/src/main/resources/com/ardublock/block/ardublock_de.properties b/src/main/resources/com/ardublock/block/ardublock_de.properties index d47c5ff..e35de1c 100644 --- a/src/main/resources/com/ardublock/block/ardublock_de.properties +++ b/src/main/resources/com/ardublock/block/ardublock_de.properties @@ -26,7 +26,7 @@ ardublock.ui.add_comment=Kommentar hinzuf ardublock.ui.delete_comment=Kommentar löschen ardublock.ui.organize_blocks=Alle Blöcke neu anordnen ardublock.ui.create_refer=Verweis erstellen -ardublock.ui.website=letsgoING Projekt +ardublock.ui.website=letsgoING ardublock.ui.website.domain=https://letsgoing.org ardublock.ui.website.tooltip=öffnet die letsgoING-Homepage ardublock.ui.lmssite=Online Lernen @@ -72,7 +72,7 @@ ardublock.ui.simulatorHelp.tooltip=Infos zum letsgoING-Simulator ardublock.ui.simulatorHelp.title=Infos zum letsgoING-Simulator ardublock.ui.simulatorHelp.text=TASTER\n**********************\nlinke Maustaste -> Taster-Funktion\nrechte oder mittlere Maustaste -> Schalterfunktion (bleibt aktiv)\n\n\n\nPOTI\n**********************\nSlider ziehen oder mit Mausrad verstellen (Mauszeiger über Slider)\n\n\nSERIALMONITOR\n**********************\nHier werden die Nachrichten vom "Serial.Print"-Block ausgegeben\nAutoscroll:\n an -> neueste Nachrichten werden angezeigt\n aus -> Ausgabe kann manuell ausgewählt werden\nReset SerialMonitor: bisherige Ausgabe wird gelöscht\n\n\n\RESET ARDUINO\n**********************\nTaster startet das Programm neu\n\n\n\ONBOARD LED\n**********************\nLED kann über Pin13 angesteuert werden -ardublock.ui.version=v2.2 beta3 newBlockFormat +ardublock.ui.version=v2.2 beta3 nBF ardublock.ui.appprefix.standard= ardublock.ui.appprefix.pro=Pro @@ -623,7 +623,8 @@ bg.setter_variable_analog== bg.setter_variable_analog.description=Schreibe neuen Wert in analoge Variable bg.create_variable_analog== bg.create_variable_analog.description=Erstelle neue analoge Variable\nOptional mit Startwert - +bg.create_array_analog== +bg.create_array_analog.description=Erstelle neues analoge Array\nOptional mit Startwert #ARRAYS #**************************** -- GitLab