formattation and removed commented code

This commit is contained in:
aster94
2019-02-27 18:20:35 +01:00
parent 4cfe2d684a
commit ef501ff4c3
5 changed files with 39 additions and 214 deletions

View File

@@ -155,9 +155,6 @@ class Box
} }
} }
//boolean box_left_drawn = false; //boolean box_left_drawn = false;
Box box_pin_names = new Box(); // box for the pin names and number Box box_pin_names = new Box(); // box for the pin names and number
Box box_scroll_bar = new Box(); // a narrow box for the scroll bar Box box_scroll_bar = new Box(); // a narrow box for the scroll bar
@@ -182,8 +179,6 @@ class Button
} }
} }
Button button_start = new Button(); Button button_start = new Button();
Button button_time_draw = new Button(); Button button_time_draw = new Button();
Button button_time_format = new Button(); Button button_time_format = new Button();
@@ -527,13 +522,13 @@ void draw()
draw_boxes(); draw_boxes();
} }
ScrollingBarPressed(); ScrollingBarPressed();
} }
void getChannelCursorCurrentEvent(int index) void getChannelCursorCurrentEvent(int index)
{ {
float compare1; float compare1;
CurrentEventFloat = -(xShift - mouseX + xEdge ); CurrentEventFloat = -(xShift - mouseX + xEdge);
ChannelCursor1CurrentEvent0[1] = index; ChannelCursor1CurrentEvent0[1] = index;
if (index != 16) if (index != 16)
{ {
@@ -542,13 +537,13 @@ void getChannelCursorCurrentEvent(int index)
index2 = s.charAt(0) - '1'; index2 = s.charAt(0) - '1';
ChannelCursor1CurrentEvent0[0] = 0; // Keep records of the event we are in. ChannelCursor1CurrentEvent0[0] = 0; // Keep records of the event we are in.
//println (abs(xTime[46]+xShift)); //println (abs(xTime[46]+xShift));
if (CurrentEventFloat < 0 || CurrentEventFloat > xTime[samples - 1] ) if (CurrentEventFloat < 0 || CurrentEventFloat > xTime[samples - 1])
{ {
if (CurrentEventFloat <= 0) if (CurrentEventFloat <= 0)
{ {
ChannelCursor1CurrentEvent0[0] = 0; ChannelCursor1CurrentEvent0[0] = 0;
} }
if (CurrentEventFloat >= xTime[samples - 1] ) if (CurrentEventFloat >= xTime[samples - 1])
{ {
ChannelCursor1CurrentEvent0[0] = samples - 1; ChannelCursor1CurrentEvent0[0] = samples - 1;
} }
@@ -557,7 +552,7 @@ void getChannelCursorCurrentEvent(int index)
{ {
for (int i = 1; i < samples - 1; i++) for (int i = 1; i < samples - 1; i++)
{ {
compare1 = ((xTime[i] ) + (xTime[i + 1] ) - (2 * CurrentEventFloat)); compare1 = ((xTime[i]) + (xTime[i + 1]) - (2 * CurrentEventFloat));
if (compare1 < 0) if (compare1 < 0)
{ {
if (state[i][index1][index2]) if (state[i][index1][index2])

View File

@@ -68,8 +68,8 @@ void draw_boxes()
} }
y += 36; y += 36;
} }
text(" ALL ", x, 610); text(" ALL ", x, 610);
text("EVENTS", x, 625); text("EVENTS", x, 625);
} }
void drawCursorChannel(boolean CursorEnable) void drawCursorChannel(boolean CursorEnable)
@@ -149,8 +149,8 @@ void DrawChannelSignals()
// finally we draw the lines // finally we draw the lines
line(xPos[n] + xShift, yPos, xTime[i] + xShift, yPos); // straight line line(xPos[n] + xShift, yPos, xTime[i] + xShift, yPos); // straight line
line(xTime[i] + xShift, yPos, xTime[i] + xShift, yDiff); // vertical line line(xTime[i] + xShift, yPos, xTime[i] + xShift, yDiff); // vertical line
xPos[n] = xTime[i]; // save last position of the line for the pin xPos[n] = xTime[i]; // save last position of the line for the pin
yPos = ySave; // load the initial value of the y yPos = ySave; // load the initial value of the y
} }
} }
yPos += 36; // go to the next pin yPos += 36; // go to the next pin
@@ -191,7 +191,7 @@ void ScrollingBarPressed()
} }
} }
float[] spacing = {5, 8}; //used for the dashline function, pixels float[] spacing = {5, 8}; //used for the dashline function, pixels
float[] spacinggrid = {1, 50}; //used for the background reference lines float[] spacinggrid = {1, 50}; //used for the background reference lines
void dashline(float x0, float y0, float x1, float y1, float[] spacing) void dashline(float x0, float y0, float x1, float y1, float[] spacing)
{ {

View File

@@ -12,25 +12,27 @@ boolean mouse_over_button(Button b)
boolean mouse_over_channel(byte c) boolean mouse_over_channel(byte c)
{ {
if (c<16){ if (c < 16)
if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * c && mouseY < yEdge + 36 * c + 30 && PinAssignment[c] != 0) {
{ if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * c && mouseY < yEdge + 36 * c + 30 && PinAssignment[c] != 0)
return true; {
} return true;
else }
{ else
return false; {
} return false;
}
} }
else{ else
if (mouseX > xEdge && mouseX < width && mouseY > yBottom - 36 && mouseY < yBottom) {
{ if (mouseX > xEdge && mouseX < width && mouseY > yBottom - 36 && mouseY < yBottom)
return true; {
} return true;
else }
{ else
return false; {
} return false;
}
} }
} }
@@ -190,105 +192,6 @@ void mouseClicked()
} }
} }
/*
if (mouseX > xEdge && mouseX < width && mouseY > yEdge && mouseY < yEdge + 30 && PinAssignment[0] != 0)
{
getChannelCursorCurrentEvent(0);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 && mouseY < yEdge + 36 + 30 && PinAssignment[1] != 0)
{
getChannelCursorCurrentEvent(1);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 2 && mouseY < yEdge + 36 * 2 + 30 && PinAssignment[2] != 0)
{
getChannelCursorCurrentEvent(2);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 3 && mouseY < yEdge + 36 * 3 + 30 && PinAssignment[3] != 0)
{
getChannelCursorCurrentEvent(3);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 4 && mouseY < yEdge + 36 * 4 + 30 && PinAssignment[4] != 0)
{
getChannelCursorCurrentEvent(4);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 5 && mouseY < yEdge + 36 * 5 + 30 && PinAssignment[5] != 0)
{
getChannelCursorCurrentEvent(5);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 6 && mouseY < yEdge + 36 * 6 + 30 && PinAssignment[6] != 0)
{
getChannelCursorCurrentEvent(6);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 7 && mouseY < yEdge + 36 * 7 + 30 && PinAssignment[7] != 0)
{
getChannelCursorCurrentEvent(7);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 8 && mouseY < yEdge + 36 * 8 + 30 && PinAssignment[8] != 0)
{
getChannelCursorCurrentEvent(8);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 9 && mouseY < yEdge + 36 * 9 + 30 && PinAssignment[9] != 0)
{
getChannelCursorCurrentEvent(9);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 10 && mouseY < yEdge + 36 * 10 + 30 && PinAssignment[10] != 0)
{
getChannelCursorCurrentEvent(10);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 11 && mouseY < yEdge + 36 * 11 + 30 && PinAssignment[11] != 0)
{
getChannelCursorCurrentEvent(11);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 12 && mouseY < yEdge + 36 * 12 + 30 && PinAssignment[12] != 0)
{
getChannelCursorCurrentEvent(12);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 13 && mouseY < yEdge + 36 * 13 + 30 && PinAssignment[13] != 0)
{
getChannelCursorCurrentEvent(13);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 14 && mouseY < yEdge + 36 * 14 + 30 && PinAssignment[14] != 0)
{
getChannelCursorCurrentEvent(14);
IsAnyChannelMarked = true;
movepos();
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 15 && mouseY < yEdge + 36 * 15 + 30 && PinAssignment[15] != 0)
{
getChannelCursorCurrentEvent(15);
IsAnyChannelMarked = true;
movepos();
}
*/
if (mouse_over_button(button_time_draw)) if (mouse_over_button(button_time_draw))
{ {
drawTimes = !drawTimes; drawTimes = !drawTimes;
@@ -375,8 +278,8 @@ void mouseClicked()
} }
else else
{ {
IsAnyChannelMarked = false; IsAnyChannelMarked = false;
dataComplete = true; dataComplete = true;
} }
} }
@@ -468,85 +371,13 @@ void mouseMoved()
if (mouse_over_channel(channel)) if (mouse_over_channel(channel))
{ {
cursor(HAND); cursor(HAND);
return; return; // exit from the for loop
// exit from the for loop
} }
else else
{ {
cursor(ARROW); cursor(ARROW);
} }
} }
/*
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge && mouseY < yEdge + 30 && PinAssignment[0] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 && mouseY < yEdge + 36 + 30 && PinAssignment[1] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 2 && mouseY < yEdge + 36 * 2 + 30 && PinAssignment[2] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 3 && mouseY < yEdge + 36 * 3 + 30 && PinAssignment[3] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 4 && mouseY < yEdge + 36 * 4 + 30 && PinAssignment[4] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 5 && mouseY < yEdge + 36 * 5 + 30 && PinAssignment[5] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 6 && mouseY < yEdge + 36 * 6 + 30 && PinAssignment[6] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 7 && mouseY < yEdge + 36 * 7 + 30 && PinAssignment[7] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 8 && mouseY < yEdge + 36 * 8 + 30 && PinAssignment[8] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 9 && mouseY < yEdge + 36 * 9 + 30 && PinAssignment[9] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 10 && mouseY < yEdge + 36 * 10 + 30 && PinAssignment[10] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 11 && mouseY < yEdge + 36 * 11 + 30 && PinAssignment[11] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 12 && mouseY < yEdge + 36 * 12 + 30 && PinAssignment[12] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 13 && mouseY < yEdge + 36 * 13 + 30 && PinAssignment[13] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 14 && mouseY < yEdge + 36 * 14 + 30 && PinAssignment[14] != 0)
{
cursor(HAND);
}
else if (mouseX > xEdge && mouseX < width && mouseY > yEdge + 36 * 15 && mouseY < yEdge + 36 * 15 + 30 && PinAssignment[15] != 0)
{
cursor(HAND);
}
else
{
cursor(ARROW);
}
*/
} }
// this function is called every time a mouse button is pressed // this function is called every time a mouse button is pressed
@@ -555,7 +386,6 @@ void mousePressed()
if (mouse_over_button(scroll_bar)) if (mouse_over_button(scroll_bar))
{ {
isDraggable = true; isDraggable = true;
//scroll_bar_color = color(100, 200, 255); change color of the scroll bar //scroll_bar_color = color(100, 200, 255); change color of the scroll bar
} }
} }

View File

@@ -1,5 +1,6 @@
/* /*
* Created: 11/12/2016 19.35.51 * MEGA.ino
*
* Author : sancho / Vincenzo * Author : sancho / Vincenzo
*/ */

View File

@@ -1,7 +1,6 @@
/* /*
* UNO.ino * UNO.ino
* *
* Created: 11/12/2016 19.35.51
* Author : Vincenzo * Author : Vincenzo
* Led on A0 * Led on A0
*/ */