Skip to content

Commit

Permalink
what *should* have been the initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mitevpi committed Mar 27, 2021
1 parent f2518c7 commit a5727ba
Show file tree
Hide file tree
Showing 53 changed files with 3,499 additions and 1,492 deletions.
73 changes: 37 additions & 36 deletions GHUI.sln
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GHUI", "GHUI\GHUI.csproj", "{4961F23B-4C99-4F28-A227-05629C88FD0C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77EB629A-D99F-457C-9125-2723FE578139}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.ActiveCfg = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.Build.0 = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.ActiveCfg = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.Build.0 = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.ActiveCfg = Release|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.Build.0 = Release|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.ActiveCfg = Release|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {66917442-78A4-4CB2-B5C7-A6140A2EF379}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GHUI", "GHUI\GHUI.csproj", "{4961F23B-4C99-4F28-A227-05629C88FD0C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77EB629A-D99F-457C-9125-2723FE578139}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.ActiveCfg = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|Any CPU.Build.0 = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.ActiveCfg = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Debug|x64.Build.0 = Debug|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.ActiveCfg = Release|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|Any CPU.Build.0 = Release|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.ActiveCfg = Release|x64
{4961F23B-4C99-4F28-A227-05629C88FD0C}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {66917442-78A4-4CB2-B5C7-A6140A2EF379}
EndGlobalSection
EndGlobal
9 changes: 0 additions & 9 deletions GHUI/BuildButtonComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ protected override void SolveInstance(IGH_DataAccess da)
$"<input type='button' id='{id}' name='{name}' value='{value}' style='{cssStyle}'>";

da.SetData(0, buttonString);

GH_Document doc = OnPingDocument();
doc?.ScheduleSolution(500, ScheduleCallback);
}


private void ScheduleCallback(GH_Document document)
{
ExpireSolution(false);
}

protected override System.Drawing.Bitmap Icon => Properties.Resources.button;
Expand Down
69 changes: 69 additions & 0 deletions GHUI/BuildCheckBoxComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System;
using Grasshopper.Kernel;

namespace GHUI
{
public class BuildCheckBoxComponent : GH_Component
{
/// <summary>
/// Component for building a HTML checkbox input component.
/// </summary>
public BuildCheckBoxComponent()
: base("Create Checkbox Input", "checkbox",
"Create a HTML checkbox Input.",
"UI", "Create")
{
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddTextParameter("Name", "name", "The name of the checkbox input component.", GH_ParamAccess.item,
"checkbox");
pManager.AddTextParameter("ID", "id", "The id of the checkbox input component.", GH_ParamAccess.item,
"checkbox");
pManager.AddBooleanParameter("Value", "val", "The starting value of the checkbox input component.",
GH_ParamAccess.item, false);
pManager.AddTextParameter("Label", "label", "The starting label of the checkbox input component.",
GH_ParamAccess.item, "");
pManager.AddTextParameter("CSS", "css", "The `style` attribute to apply to the element and its children.",
GH_ParamAccess.item,
"");
}

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddTextParameter("HTML", "html", "The HTML code for the created checkbox input.",
GH_ParamAccess.list);
}

protected override void SolveInstance(IGH_DataAccess da)
{
// get input from gh component inputs
string name = null;
string id = null;
bool value = false;
string label = null;
string cssStyle = null;

da.GetData(0, ref name);
da.GetData(1, ref id);
da.GetData(2, ref value);
da.GetData(3, ref label);
da.GetData(4, ref cssStyle);

string textString =
$"<input type='checkbox' id='{id}' name='{name}' checked='{value}' style='{cssStyle}'>";

if (label != "")
{
textString = textString + $"<label for='{id}' id='{id}-label' >{label}</label>";
}

da.SetData(0, textString);
}

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

public override Guid ComponentGuid => new Guid("d1123685-f181-40aa-8f75-d88bcbc49498");
}
}
60 changes: 60 additions & 0 deletions GHUI/BuildColorComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using Grasshopper.Kernel;

namespace GHUI
{
public class BuildColorComponent : GH_Component
{
/// <summary>
/// Component for building a HTML color input component.
/// </summary>
public BuildColorComponent()
: base("Create Color Input", "Color",
"Create a HTML Color Input.",
"UI", "Create")
{
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddTextParameter("Name", "name", "The name of the color input component.", GH_ParamAccess.item,
"color");
pManager.AddTextParameter("ID", "id", "The id of the color input component.", GH_ParamAccess.item,
"color");
pManager.AddTextParameter("Value", "val", "The starting value of the color input component.",
GH_ParamAccess.item, "");
pManager.AddTextParameter("CSS", "css", "The `style` attribute to apply to the element and its children.",
GH_ParamAccess.item,
"");
}

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddTextParameter("HTML", "html", "The HTML code for the created color input.",
GH_ParamAccess.list);
}

protected override void SolveInstance(IGH_DataAccess da)
{
// get input from gh component inputs
string name = null;
string id = null;
string value = null;
string cssStyle = null;

da.GetData(0, ref name);
da.GetData(1, ref id);
da.GetData(2, ref value);
da.GetData(3, ref cssStyle);

string textString =
$"<input type='color' id='{id}' name='{name}' value='{value}' style='{cssStyle}'>";

da.SetData(0, textString);
}

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

public override Guid ComponentGuid => new Guid("dea8a036-7b2e-4f0b-9e60-ad24894d2b25");
}
}
68 changes: 68 additions & 0 deletions GHUI/BuildDateComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using Grasshopper.Kernel;

namespace GHUI
{
public class BuildDateComponent : GH_Component
{
/// <summary>
/// Component for building a HTML date input component.
/// </summary>
public BuildDateComponent()
: base("Create Date Input", "Date",
"Create a HTML Date Input.",
"UI", "Create")
{
}

protected override void RegisterInputParams(GH_InputParamManager pManager)
{
pManager.AddTextParameter("Name", "name", "The name of the date input component.", GH_ParamAccess.item,
"date");
pManager.AddTextParameter("ID", "id", "The id of the date input component.", GH_ParamAccess.item,
"date");
pManager.AddTextParameter("Value", "val", "The starting value of the date input component.",
GH_ParamAccess.item, "");
pManager.AddTextParameter("Min", "min", "The min value of the date input component.",
GH_ParamAccess.item, "1900-12-31");
pManager.AddTextParameter("Max", "max", "The max value of the date input component.",
GH_ParamAccess.item, "2021-01-02");
pManager.AddTextParameter("CSS", "css", "The `style` attribute to apply to the element and its children.",
GH_ParamAccess.item,
"");
}

protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
pManager.AddTextParameter("HTML", "html", "The HTML code for the created date input.",
GH_ParamAccess.list);
}

protected override void SolveInstance(IGH_DataAccess da)
{
// get input from gh component inputs
string name = null;
string id = null;
string value = null;
string min = null;
string max = null;
string cssStyle = null;

da.GetData(0, ref name);
da.GetData(1, ref id);
da.GetData(2, ref value);
da.GetData(3, ref min);
da.GetData(4, ref max);
da.GetData(4, ref cssStyle);

string textString =
$"<input type='date' id='{id}' name='{name}' value='{value}' min='{min}' max='{max}' style='{cssStyle}'>";

da.SetData(0, textString);
}

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

public override Guid ComponentGuid => new Guid("3164dd20-ddff-4af4-a452-7a5a2bd12caa");
}
}
11 changes: 0 additions & 11 deletions GHUI/BuildDivComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace GHUI
{
public class BuildDivComponent : GH_Component
{
private string _oldString = null;

/// <summary>
/// Component for wrapping some HTML into a <div></div>.
/// </summary>
Expand Down Expand Up @@ -43,15 +41,6 @@ protected override void SolveInstance(IGH_DataAccess da)

string sliderString = $"<div style='{cssStyle}'>{htmlToWrap}</div>";
da.SetData(0, sliderString);

GH_Document doc = OnPingDocument();
doc?.ScheduleSolution(500, ScheduleCallback);
}


private void ScheduleCallback(GH_Document document)
{
ExpireSolution(false);
}

protected override System.Drawing.Bitmap Icon => Properties.Resources.div;
Expand Down
Loading

0 comments on commit a5727ba

Please sign in to comment.