FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

tabs to spaces, some (but not all) formatting fixed · bernardoprd/processing@9c35049 · GitHub

Repository navigation

Commit 9c35049

Browse files
committed
tabs to spaces, some (but not all) formatting fixed
1 parent 49838ef commit 9c35049

8 files changed

Lines changed: 1906 additions & 1924 deletions

File tree

‎java/src/processing/mode/java/tweak/ColorControlBox.java‎

Lines changed: 365 additions & 368 deletions
Large diffs are not rendered by default.
Lines changed: 95 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,108 @@
11
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
22

33
/*
4-
Part of the Processing project - http://processing.org
5-
Copyright (c) 2012-15 The Processing Foundation
4+
Part of the Processing project - http://processing.org
5+
Copyright (c) 2012-15 The Processing Foundation
66
7-
This program is free software; you can redistribute it and/or modify
8-
it under the terms of the GNU General Public License version 2
9-
as published by the Free Software Foundation.
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License version 2
9+
as published by the Free Software Foundation.
1010
11-
This program is distributed in the hope that it will be useful,
12-
but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
GNU General Public License for more details.
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
1515
16-
You should have received a copy of the GNU General Public License
17-
along with this program; if not, write to the Free Software Foundation, Inc.
18-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software Foundation, Inc.
18+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1919
*/
2020

2121
package processing.mode.java.tweak;
2222

2323

2424
public class ColorMode {
25-
final static int RGB = 0;
26-
final static int HSB = 1;
27-
28-
float v1Max, v2Max, v3Max, aMax;
29-
int modeType;
30-
31-
boolean unrecognizedMode;
32-
String drawContext;
33-
34-
public ColorMode(String context)
35-
{
36-
this.drawContext = context;
37-
modeType = RGB;
38-
v1Max = 255;
39-
v2Max = 255;
40-
v3Max = 255;
41-
aMax = 255;
42-
43-
unrecognizedMode = false;
44-
}
45-
46-
public ColorMode(String context, int type, float v1, float v2, float v3, float a)
47-
{
48-
this.drawContext = context;
49-
modeType = type;
50-
v1Max = v1;
51-
v2Max = v2;
52-
v3Max = v3;
53-
aMax = a;
54-
55-
unrecognizedMode = false;
56-
}
57-
58-
public static ColorMode fromString(String context, String mode)
59-
{
60-
try
61-
{
62-
String[] elements = mode.split(",");
63-
64-
// determine the type of the color mode
65-
int type = RGB;
66-
if (elements[0].trim().equals("HSB")) {
67-
type = HSB;
68-
}
69-
70-
if (elements.length == 1) {
71-
// colorMode in the form of colorMode(type)
72-
return new ColorMode(context, type, 255, 255, 255, 255);
73-
}
74-
else if (elements.length == 2) {
75-
// colorMode in the form of colorMode(type, max)
76-
float max = Float.parseFloat(elements[1].trim());
77-
return new ColorMode(context, type, max, max, max, max);
78-
}
79-
else if (elements.length == 4) {
80-
// colorMode in the form of colorMode(type, max1, max2, max3)
81-
float r = Float.parseFloat(elements[1].trim());
82-
float g = Float.parseFloat(elements[2].trim());
83-
float b = Float.parseFloat(elements[3].trim());
84-
return new ColorMode(context, type, r, g, b, 255);
85-
}
86-
else if (elements.length == 5) {
87-
// colorMode in the form of colorMode(type, max1, max2, max3, maxA)
88-
float r = Float.parseFloat(elements[1].trim());
89-
float g = Float.parseFloat(elements[2].trim());
90-
float b = Float.parseFloat(elements[3].trim());
91-
float a = Float.parseFloat(elements[4].trim());
92-
return new ColorMode(context, type, r, g, b, a);
93-
}
94-
}
95-
catch(Exception e) { }
96-
97-
/* if we failed to parse this mode (uses variables etc..)
98-
* we should still keep it so we'll know there is a mode declaration
99-
* and we should mark it as unrecognizable
100-
*/
101-
ColorMode newMode = new ColorMode(context);
102-
newMode.unrecognizedMode = true;
103-
return newMode;
104-
}
105-
106-
public String toString()
107-
{
108-
String type;
109-
if (modeType == RGB) {
110-
type = "RGB";
111-
}
112-
else {
113-
type = "HSB";
114-
}
115-
116-
return "ColorMode: " + type + ": (" + v1Max + ", " + v2Max + ", " + v3Max + ", " + aMax + ")";
117-
}
25+
final static int RGB = 0;
26+
final static int HSB = 1;
27+
28+
float v1Max, v2Max, v3Max, aMax;
29+
int modeType;
30+
31+
boolean unrecognizedMode;
32+
String drawContext;
33+
34+
35+
public ColorMode(String context) {
36+
this.drawContext = context;
37+
modeType = RGB;
38+
v1Max = 255;
39+
v2Max = 255;
40+
v3Max = 255;
41+
aMax = 255;
42+
unrecognizedMode = false;
43+
}
44+
45+
46+
public ColorMode(String context, int type,
47+
float v1, float v2, float v3, float a) {
48+
this.drawContext = context;
49+
modeType = type;
50+
v1Max = v1;
51+
v2Max = v2;
52+
v3Max = v3;
53+
aMax = a;
54+
unrecognizedMode = false;
55+
}
56+
57+
58+
static public ColorMode fromString(String context, String mode) {
59+
try {
60+
String[] elements = mode.split(",");
61+
62+
// determine the type of the color mode
63+
int type = RGB;
64+
if (elements[0].trim().equals("HSB")) {
65+
type = HSB;
66+
}
67+
68+
if (elements.length == 1) {
69+
// colorMode in the form of colorMode(type)
70+
return new ColorMode(context, type, 255, 255, 255, 255);
71+
72+
} else if (elements.length == 2) {
73+
// colorMode in the form of colorMode(type, max)
74+
float max = Float.parseFloat(elements[1].trim());
75+
return new ColorMode(context, type, max, max, max, max);
76+
77+
} else if (elements.length == 4) {
78+
// colorMode in the form of colorMode(type, max1, max2, max3)
79+
float r = Float.parseFloat(elements[1].trim());
80+
float g = Float.parseFloat(elements[2].trim());
81+
float b = Float.parseFloat(elements[3].trim());
82+
return new ColorMode(context, type, r, g, b, 255);
83+
84+
} else if (elements.length == 5) {
85+
// colorMode in the form of colorMode(type, max1, max2, max3, maxA)
86+
float r = Float.parseFloat(elements[1].trim());
87+
float g = Float.parseFloat(elements[2].trim());
88+
float b = Float.parseFloat(elements[3].trim());
89+
float a = Float.parseFloat(elements[4].trim());
90+
return new ColorMode(context, type, r, g, b, a);
91+
}
92+
} catch (Exception e) { }
93+
94+
// if we failed to parse this mode (uses variables etc..)
95+
// we should still keep it so we'll know there is a mode declaration
96+
// and we should mark it as unrecognizable
97+
ColorMode newMode = new ColorMode(context);
98+
newMode.unrecognizedMode = true;
99+
return newMode;
100+
}
101+
102+
103+
public String toString() {
104+
String type = (modeType == RGB) ? "RGB" : "HSB";
105+
return "ColorMode: " + type +
106+
": (" + v1Max + ", " + v2Max + ", " + v3Max + ", " + aMax + ")";
107+
}
118108
}
Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
22

33
/*
4-
Part of the Processing project - http://processing.org
5-
Copyright (c) 2012-15 The Processing Foundation
4+
Part of the Processing project - http://processing.org
5+
Copyright (c) 2012-15 The Processing Foundation
66
7-
This program is free software; you can redistribute it and/or modify
8-
it under the terms of the GNU General Public License version 2
9-
as published by the Free Software Foundation.
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License version 2
9+
as published by the Free Software Foundation.
1010
11-
This program is distributed in the hope that it will be useful,
12-
but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
GNU General Public License for more details.
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
1515
16-
You should have received a copy of the GNU General Public License
17-
along with this program; if not, write to the Free Software Foundation, Inc.
18-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software Foundation, Inc.
18+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1919
*/
2020

2121
package processing.mode.java.tweak;
@@ -24,29 +24,27 @@
2424

2525

2626
public class ColorScheme {
27-
private static ColorScheme instance = null;
28-
public Color redStrokeColor;
29-
public Color progressFillColor;
30-
public Color progressEmptyColor;
31-
public Color markerColor;
32-
public Color whitePaneColor;
33-
34-
35-
private ColorScheme() {
36-
redStrokeColor = new Color(160, 20, 20); // dark red
37-
progressEmptyColor = new Color(180, 180, 180, 200);
38-
progressFillColor = new Color(0, 0, 0, 200);
39-
markerColor = new Color(228, 200, 91, 127);
40-
whitePaneColor = new Color(255, 255, 255, 120);
41-
}
42-
43-
44-
public static ColorScheme getInstance() {
45-
if (instance == null) {
46-
instance = new ColorScheme();
47-
}
48-
return instance;
49-
}
27+
private static ColorScheme instance = null;
28+
public Color redStrokeColor;
29+
public Color progressFillColor;
30+
public Color progressEmptyColor;
31+
public Color markerColor;
32+
public Color whitePaneColor;
33+
34+
35+
private ColorScheme() {
36+
redStrokeColor = new Color(160, 20, 20); // dark red
37+
progressEmptyColor = new Color(180, 180, 180, 200);
38+
progressFillColor = new Color(0, 0, 0, 200);
39+
markerColor = new Color(228, 200, 91, 127);
40+
whitePaneColor = new Color(255, 255, 255, 120);
41+
}
42+
43+
44+
public static ColorScheme getInstance() {
45+
if (instance == null) {
46+
instance = new ColorScheme();
47+
}
48+
return instance;
49+
}
5050
}
51-
52-

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL