Skip to content

Commit a5727ba

Browse files
committed
what *should* have been the initial commit
1 parent f2518c7 commit a5727ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3499
-1492
lines changed

GHUI.sln

+37-36
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30011.22
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GHUI", "GHUI\GHUI.csproj", "{4961F23B-4C99-4F28-A227-05629C88FD0C}"
7-
EndProject
8-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77EB629A-D99F-457C-9125-2723FE578139}"
9-
ProjectSection(SolutionItems) = preProject
10-
README.md = README.md
11-
EndProjectSection
12-
EndProject
13-
Global
14-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15-
Debug|Any CPU = Debug|Any CPU
16-
Debug|x64 = Debug|x64
17-
Release|Any CPU = Release|Any CPU
18-
Release|x64 = Release|x64
19-
EndGlobalSection
20-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.ActiveCfg = Debug|x64
22-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.Build.0 = Debug|x64
23-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.ActiveCfg = Debug|x64
24-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.Build.0 = Debug|x64
25-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.ActiveCfg = Release|x64
26-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.Build.0 = Release|x64
27-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.ActiveCfg = Release|x64
28-
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.Build.0 = Release|x64
29-
EndGlobalSection
30-
GlobalSection(SolutionProperties) = preSolution
31-
HideSolutionNode = FALSE
32-
EndGlobalSection
33-
GlobalSection(ExtensibilityGlobals) = postSolution
34-
SolutionGuid = {66917442-78A4-4CB2-B5C7-A6140A2EF379}
35-
EndGlobalSection
36-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30011.22
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GHUI", "GHUI\GHUI.csproj", "{4961F23B-4C99-4F28-A227-05629C88FD0C}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77EB629A-D99F-457C-9125-2723FE578139}"
9+
ProjectSection(SolutionItems) = preProject
10+
LICENSE = LICENSE
11+
README.md = README.md
12+
EndProjectSection
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|Any CPU = Debug|Any CPU
17+
Debug|x64 = Debug|x64
18+
Release|Any CPU = Release|Any CPU
19+
Release|x64 = Release|x64
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.ActiveCfg = Debug|x64
23+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.Build.0 = Debug|x64
24+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.ActiveCfg = Debug|x64
25+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.Build.0 = Debug|x64
26+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.ActiveCfg = Release|x64
27+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.Build.0 = Release|x64
28+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.ActiveCfg = Release|x64
29+
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.Build.0 = Release|x64
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {66917442-78A4-4CB2-B5C7-A6140A2EF379}
36+
EndGlobalSection
37+
EndGlobal

GHUI/BuildButtonComponent.cs

-9
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ protected override void SolveInstance(IGH_DataAccess da)
5252
$"<input type='button' id='{id}' name='{name}' value='{value}' style='{cssStyle}'>";
5353

5454
da.SetData(0, buttonString);
55-
56-
GH_Document doc = OnPingDocument();
57-
doc?.ScheduleSolution(500, ScheduleCallback);
58-
}
59-
60-
61-
private void ScheduleCallback(GH_Document document)
62-
{
63-
ExpireSolution(false);
6455
}
6556

6657
protected override System.Drawing.Bitmap Icon => Properties.Resources.button;

GHUI/BuildCheckBoxComponent.cs

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using System;
2+
using Grasshopper.Kernel;
3+
4+
namespace GHUI
5+
{
6+
public class BuildCheckBoxComponent : GH_Component
7+
{
8+
/// <summary>
9+
/// Component for building a HTML checkbox input component.
10+
/// </summary>
11+
public BuildCheckBoxComponent()
12+
: base("Create Checkbox Input", "checkbox",
13+
"Create a HTML checkbox Input.",
14+
"UI", "Create")
15+
{
16+
}
17+
18+
protected override void RegisterInputParams(GH_InputParamManager pManager)
19+
{
20+
pManager.AddTextParameter("Name", "name", "The name of the checkbox input component.", GH_ParamAccess.item,
21+
"checkbox");
22+
pManager.AddTextParameter("ID", "id", "The id of the checkbox input component.", GH_ParamAccess.item,
23+
"checkbox");
24+
pManager.AddBooleanParameter("Value", "val", "The starting value of the checkbox input component.",
25+
GH_ParamAccess.item, false);
26+
pManager.AddTextParameter("Label", "label", "The starting label of the checkbox input component.",
27+
GH_ParamAccess.item, "");
28+
pManager.AddTextParameter("CSS", "css", "The `style` attribute to apply to the element and its children.",
29+
GH_ParamAccess.item,
30+
"");
31+
}
32+
33+
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
34+
{
35+
pManager.AddTextParameter("HTML", "html", "The HTML code for the created checkbox input.",
36+
GH_ParamAccess.list);
37+
}
38+
39+
protected override void SolveInstance(IGH_DataAccess da)
40+
{
41+
// get input from gh component inputs
42+
string name = null;
43+
string id = null;
44+
bool value = false;
45+
string label = null;
46+
string cssStyle = null;
47+
48+
da.GetData(0, ref name);
49+
da.GetData(1, ref id);
50+
da.GetData(2, ref value);
51+
da.GetData(3, ref label);
52+
da.GetData(4, ref cssStyle);
53+
54+
string textString =
55+
$"<input type='checkbox' id='{id}' name='{name}' checked='{value}' style='{cssStyle}'>";
56+
57+
if (label != "")
58+
{
59+
textString = textString + $"<label for='{id}' id='{id}-label' >{label}</label>";
60+
}
61+
62+
da.SetData(0, textString);
63+
}
64+
65+
protected override System.Drawing.Bitmap Icon => Properties.Resources.checkbox;
66+
67+
public override Guid ComponentGuid => new Guid("d1123685-f181-40aa-8f75-d88bcbc49498");
68+
}
69+
}

GHUI/BuildColorComponent.cs

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using Grasshopper.Kernel;
3+
4+
namespace GHUI
5+
{
6+
public class BuildColorComponent : GH_Component
7+
{
8+
/// <summary>
9+
/// Component for building a HTML color input component.
10+
/// </summary>
11+
public BuildColorComponent()
12+
: base("Create Color Input", "Color",
13+
"Create a HTML Color Input.",
14+
"UI", "Create")
15+
{
16+
}
17+
18+
protected override void RegisterInputParams(GH_InputParamManager pManager)
19+
{
20+
pManager.AddTextParameter("Name", "name", "The name of the color input component.", GH_ParamAccess.item,
21+
"color");
22+
pManager.AddTextParameter("ID", "id", "The id of the color input component.", GH_ParamAccess.item,
23+
"color");
24+
pManager.AddTextParameter("Value", "val", "The starting value of the color input component.",
25+
GH_ParamAccess.item, "");
26+
pManager.AddTextParameter("CSS", "css", "The `style` attribute to apply to the element and its children.",
27+
GH_ParamAccess.item,
28+
"");
29+
}
30+
31+
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
32+
{
33+
pManager.AddTextParameter("HTML", "html", "The HTML code for the created color input.",
34+
GH_ParamAccess.list);
35+
}
36+
37+
protected override void SolveInstance(IGH_DataAccess da)
38+
{
39+
// get input from gh component inputs
40+
string name = null;
41+
string id = null;
42+
string value = null;
43+
string cssStyle = null;
44+
45+
da.GetData(0, ref name);
46+
da.GetData(1, ref id);
47+
da.GetData(2, ref value);
48+
da.GetData(3, ref cssStyle);
49+
50+
string textString =
51+
$"<input type='color' id='{id}' name='{name}' value='{value}' style='{cssStyle}'>";
52+
53+
da.SetData(0, textString);
54+
}
55+
56+
protected override System.Drawing.Bitmap Icon => Properties.Resources.color;
57+
58+
public override Guid ComponentGuid => new Guid("dea8a036-7b2e-4f0b-9e60-ad24894d2b25");
59+
}
60+
}

GHUI/BuildDateComponent.cs

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using Grasshopper.Kernel;
3+
4+
namespace GHUI
5+
{
6+
public class BuildDateComponent : GH_Component
7+
{
8+
/// <summary>
9+
/// Component for building a HTML date input component.
10+
/// </summary>
11+
public BuildDateComponent()
12+
: base("Create Date Input", "Date",
13+
"Create a HTML Date Input.",
14+
"UI", "Create")
15+
{
16+
}
17+
18+
protected override void RegisterInputParams(GH_InputParamManager pManager)
19+
{
20+
pManager.AddTextParameter("Name", "name", "The name of the date input component.", GH_ParamAccess.item,
21+
"date");
22+
pManager.AddTextParameter("ID", "id", "The id of the date input component.", GH_ParamAccess.item,
23+
"date");
24+
pManager.AddTextParameter("Value", "val", "The starting value of the date input component.",
25+
GH_ParamAccess.item, "");
26+
pManager.AddTextParameter("Min", "min", "The min value of the date input component.",
27+
GH_ParamAccess.item, "1900-12-31");
28+
pManager.AddTextParameter("Max", "max", "The max value of the date input component.",
29+
GH_ParamAccess.item, "2021-01-02");
30+
pManager.AddTextParameter("CSS", "css", "The `style` attribute to apply to the element and its children.",
31+
GH_ParamAccess.item,
32+
"");
33+
}
34+
35+
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
36+
{
37+
pManager.AddTextParameter("HTML", "html", "The HTML code for the created date input.",
38+
GH_ParamAccess.list);
39+
}
40+
41+
protected override void SolveInstance(IGH_DataAccess da)
42+
{
43+
// get input from gh component inputs
44+
string name = null;
45+
string id = null;
46+
string value = null;
47+
string min = null;
48+
string max = null;
49+
string cssStyle = null;
50+
51+
da.GetData(0, ref name);
52+
da.GetData(1, ref id);
53+
da.GetData(2, ref value);
54+
da.GetData(3, ref min);
55+
da.GetData(4, ref max);
56+
da.GetData(4, ref cssStyle);
57+
58+
string textString =
59+
$"<input type='date' id='{id}' name='{name}' value='{value}' min='{min}' max='{max}' style='{cssStyle}'>";
60+
61+
da.SetData(0, textString);
62+
}
63+
64+
protected override System.Drawing.Bitmap Icon => Properties.Resources.date;
65+
66+
public override Guid ComponentGuid => new Guid("3164dd20-ddff-4af4-a452-7a5a2bd12caa");
67+
}
68+
}

GHUI/BuildDivComponent.cs

-11
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ namespace GHUI
55
{
66
public class BuildDivComponent : GH_Component
77
{
8-
private string _oldString = null;
9-
108
/// <summary>
119
/// Component for wrapping some HTML into a <div></div>.
1210
/// </summary>
@@ -43,15 +41,6 @@ protected override void SolveInstance(IGH_DataAccess da)
4341

4442
string sliderString = $"<div style='{cssStyle}'>{htmlToWrap}</div>";
4543
da.SetData(0, sliderString);
46-
47-
GH_Document doc = OnPingDocument();
48-
doc?.ScheduleSolution(500, ScheduleCallback);
49-
}
50-
51-
52-
private void ScheduleCallback(GH_Document document)
53-
{
54-
ExpireSolution(false);
5544
}
5645

5746
protected override System.Drawing.Bitmap Icon => Properties.Resources.div;

0 commit comments

Comments
 (0)