Skip to content

Commit

Permalink
5.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
philstopford committed Sep 1, 2022
1 parent af02595 commit 450f309
Show file tree
Hide file tree
Showing 207 changed files with 2,573 additions and 7,776 deletions.
64 changes: 38 additions & 26 deletions Common/Variance/UI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Eto.Forms;
using Eto.Veldrid;
using geoWrangler;
using shapeEngine;
using Veldrid;
using VeldridEto;
using PixelFormat = Veldrid.PixelFormat;
Expand All @@ -29,6 +30,7 @@ public partial class MainForm
private VarianceContextGUI varianceContext;

private Command quitCommand, helpCommand, aboutCommand, clearLayer, copyLayer, pasteLayer, newSim, openSim, revertSim, saveSim, saveAsSim;
private Command expExpandersCommand, collExpandersCommand;

private List<string> notList, booleanList;

Expand All @@ -42,10 +44,10 @@ private void setupUIDataContext(List<string> notList_, List<string> booleanList_
DataContext = new UIStringLists
{
subShapeList = commonVars.subshapes,
shapes = commonVars.getAvailableShapes(),
noiseTypeList = commonVars.getNoiseTypes(),
subShapePos = commonVars.getAvailableSubShapePositions(),
tipLocs = commonVars.getAvailableTipsLocations(),
shapes = ShapeLibrary.getAvailableShapes(CentralProperties.shapeTable),
noiseTypeList = NoiseC.noiseTypes,
subShapePos = ShapeSettings.getAvailableSubShapePositions(),
tipLocs = ShapeSettings.getAvailableTipsLocations(),
rngTypeList = commonRNG.rngTypes,
externalTypeList = commonVars.getExternalTypes(),
externalFilterList = commonVars.getExternalFilterList(),
Expand All @@ -54,7 +56,7 @@ private void setupUIDataContext(List<string> notList_, List<string> booleanList_
openGLMode = commonVars.getOpenGLModeList(),
notList = notList_,
fallOffList = RayCast.fallOffList,
polyFillList = commonVars.getPolyFillTypes(),
polyFillList = ShapeSettings.getPolyFillTypes(),
geoCoreStructureList = commonVars.structureList,
geoCoreLDList = commonVars.activeStructure_LayerDataTypeList,
geoCoreStructureList_exp = commonVars.structureList_exp,
Expand Down Expand Up @@ -197,6 +199,15 @@ private void loadPrefs()
{
}

try
{
varianceContext.vc.expandUI = Convert.ToBoolean(prefs.Descendants("expandUI").First().Value);
}
catch (Exception)
{
}


varianceContext.vc.rngMappingEquations.Clear();
varianceContext.vc.rngMappingEquations.Add("Box-Muller");
try
Expand Down Expand Up @@ -607,6 +618,8 @@ private void savePrefs()

prefsXML.Root.Add(new XElement("friendlyNumber", varianceContext.vc.friendlyNumber));

prefsXML.Root.Add(new XElement("expandUI", varianceContext.vc.expandUI));

string equationString = "";
for (int i = 0; i < commonVars.rngCustomMapping.Count; i++)
{
Expand Down Expand Up @@ -833,10 +846,7 @@ private void uiVars()
simulationSettingsGroupBoxHeight = 180;
userGuidanceWidth = 395;
userGuidanceHeight = simulationOutputGroupBoxHeight + simulationSettingsGroupBoxHeight + 22;

simButtonWidth = 64;
simButtonHeight = 55;


replayNumWidth = 80;

multiThreadWarnWidth = 300;
Expand Down Expand Up @@ -1588,7 +1598,7 @@ private void setup_tabs()
tabPage_2D_PASearch_table = new TableLayout();
tabPage_2D_PASearch_scrollable = new Scrollable {Content = tabPage_2D_PASearch_table};

tabPage_2D_PASearch = new TabPage {Text = "PA Search", Content = tabPage_2D_PASearch_scrollable};
tabPage_2D_PASearch = new TabPage {Text = "Process Assumptions Search", Content = tabPage_2D_PASearch_scrollable};


tabControl_2D_simsettings.Pages.Add(tabPage_2D_PASearch);
Expand All @@ -1597,7 +1607,7 @@ private void setup_tabs()
private void setup_layout()
{
// mainPanel is tab UI.
Panel mainPanel = new() {Size = new Size(920, 800), Content = mainTable};
Panel mainPanel = new() {Size = new Size(920, 750), Content = mainTable};
// force the UI out to contain the panel. Hope this will be redundant eventually with the table UI.
// rightPanel will take viewport and controls.
Panel rightPanel = new();
Expand Down Expand Up @@ -1717,14 +1727,21 @@ private void commands()

saveAsSim = new Command { MenuText = "Save As", ToolBarText = "Save As", Shortcut = Application.Instance.CommonModifier | Keys.Shift | Keys.S };
saveAsSim.Executed += saveAsHandler;

expExpandersCommand = new Command {MenuText = "Unfold All", ToolBarText = "Unfold All", Shortcut = Application.Instance.CommonModifier | Keys.Shift | Keys.X };
expExpandersCommand.Executed += expandExpanders;

collExpandersCommand = new Command {MenuText = "Fold All", ToolBarText = "Fold All", Shortcut = Application.Instance.CommonModifier | Keys.Shift | Keys.C };
collExpandersCommand.Executed += collapseExpanders;

// create menu
Menu = new MenuBar
{
Items = {
//File submenu
new ButtonMenuItem { Text = "&File", Items = { newSim, openSim, revertSim, saveSim, saveAsSim } },
new ButtonMenuItem { Text = "&Edit", Items = { copyLayer, pasteLayer, clearLayer } }
new ButtonMenuItem { Text = "&Edit", Items = { copyLayer, pasteLayer, clearLayer } },
new ButtonMenuItem { Text = "&View", Items = { expExpandersCommand, collExpandersCommand } },
},
QuitItem = quitCommand,
HelpItems = {
Expand All @@ -1742,26 +1759,21 @@ private void setup_buttons(TableCell tc)
tc.Control = TableLayout.AutoSized(p, centered: true);

TableLayout buttons_table = new();
p.Content = buttons_table;
p.Content = TableLayout.AutoSized(buttons_table);
buttons_table.Rows.Add(new TableRow());

btn_singleCPU = new Button {Text = "Single\r\nCPU"};
btn_singleCPU.Click += monteCarloSingleThreadEventHandler;
setSize(btn_singleCPU, simButtonWidth, simButtonHeight);
// buttons_table.Rows[0].Cells.Add(new TableCell() { Control = btn_singleCPU });

btn_multiCPU = new Button {Text = "Multi\r\nCPU"};
setSize(btn_multiCPU, simButtonWidth, simButtonHeight);
btn_multiCPU.Click += monteCarloMultipleThreadEventHandler;
buttons_table.Rows[0].Cells.Add(new TableCell { Control = btn_multiCPU });

btn_Run = new Button {Text = "Run"};
//setSize(btn_Run, simButtonWidth, simButtonHeight);
btn_Run.Click += monteCarloMultipleThreadEventHandler;
buttons_table.Rows[0].Cells.Add(new TableCell { Control = btn_Run });

btn_Cancel = new Button {Text = "Cancel"};
setSize(btn_Cancel, simButtonWidth, simButtonHeight);
btn_Cancel.Click += btnCancel;
// setSize(btn_Cancel, simButtonWidth, simButtonHeight);
//btn_Cancel.Click += btnCancel;
buttons_table.Rows[0].Cells.Add(new TableCell { Control = btn_Cancel });

btn_STOP = new Button {Text = "STOP"};
setSize(btn_STOP, simButtonWidth, simButtonHeight);
//setSize(btn_STOP, simButtonWidth, simButtonHeight);
btn_STOP.Click += btnSTOP;
buttons_table.Rows[0].Cells.Add(new TableCell { Control = btn_STOP });
}
Expand Down
34 changes: 27 additions & 7 deletions Common/Variance/UI/UIHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ private void aboutMe(object sender, EventArgs e)
creditText += varianceContext.vc.licenceName;
creditText += "\r\n\r\n";
creditText += "Libraries used:\r\n";
creditText += " Eto.Forms : UI framework\r\n\thttps://github.com/picoe/Eto/wiki\r\n";
creditText += " Eto.Forms : UI framework\r\n\thttps://github.com/picoe/Eto\r\n";
creditText += " Eto.Veldrid : Eto Veldrid viewport\r\n\thttps://github.com/picoe/Eto.Veldrid\r\n";
creditText += " DesignLibs : Design libraries\r\n\thttps://github.com/philstopford/DesignLibs_GPL\r\n";
creditText += " clipperLib : geometry processing, area, SVG output reference\r\n\thttp://sourceforge.net/projects/polyclipping/\r\n";
creditText += " Clipper2 : geometry processing\r\n\thttps://github.com/AngusJohnson/Clipper2\r\n";
creditText += " KD-Sharp : for spacing/enclosure\r\n\thttps://code.google.com/p/kd-sharp/\r\n";
creditText += " LibTessDotNet : for Delauney triangulation (tone inversion of n polygons)\r\n\thttps://github.com/speps/LibTessDotNet\r\n";
creditText += " Mersenne Twister : \r\n\thttp://www.centerspace.net/resources/free-stuff/mersenne-twister\r\n";
creditText += " ExpressionParser : \r\n\thttp://lundin.info/mathparser\r\n";
creditText += " MiscUtil : \r\n\thttp://yoda.arachsys.com/csharp/miscutil/\r\n";
creditText += " ExpressionParser : \r\n\thttps://github.com/plundin/Mathparser\r\n";
creditText += " MiscUtil : \r\n\thttps://github.com/loory/MiscUtil\r\n";
aboutBox = new CreditsScreen(this, creditText);
}
Point location = new(Location.X + (Width - aboutBox.Width) / 2,
Expand Down Expand Up @@ -93,9 +93,7 @@ private void mcPreviewSettingsChanged(object sender, EventArgs e)

private void mainTabChanged(object sender, EventArgs e)
{
btn_singleCPU.Enabled = false;

btn_multiCPU.Enabled = false;
btn_Run.Enabled = false;
btn_STOP.Enabled = false;

// statusProgressBar.Visible = false;
Expand Down Expand Up @@ -423,4 +421,26 @@ private void getComment()
globalUIFrozen = false;
});
}

private void collapseExpanders(object sender, EventArgs e)
{
changeExpanders(false);
}

private void expandExpanders(object sender, EventArgs e)
{
changeExpanders(true);
}

private void changeExpanders(bool toState)
{
gadgets_exp.Expanded = toState;
expander_gadgets.Expanded = toState;
twoD_LayerUISetup_biasEtch_expanders(toState);
twoD_LayerUISetup_boolean_expanders(toState);
twoD_LayerUISetup_geoCore_expanders(toState);
twoD_LayerUISetup_litho_expanders(toState);
twoD_LayerUISetup_layoutOriginParameters_expanders(toState);
twoD_LayerUISetup_subShape_expanders(toState);
}
}
6 changes: 4 additions & 2 deletions Common/Variance/UI/UIHandlers_doe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,16 @@ private void doeSettingsChanged()
int colorIndex = tile % varianceContext.vc.colors.resultColors.Length; // map our result into the available colors.
PointF[] currentTile = tilePoly.ToArray();
int length = currentTile.Length;
int col1 = col;
int row1 = row;
#if !VARIANCESINGLETHREADED
Parallel.For(0, length, pt =>
#else
for (int pt = 0; pt < length; pt++)
#endif
{
currentTile[pt].X += (float)(col * commonVars.getSimulationSettings().getDOESettings().getDouble(DOESettings.properties_d.colPitch));
currentTile[pt].Y += (float)(row * commonVars.getSimulationSettings().getDOESettings().getDouble(DOESettings.properties_d.rowPitch));
currentTile[pt].X += (float)(col1 * commonVars.getSimulationSettings().getDOESettings().getDouble(DOESettings.properties_d.colPitch));
currentTile[pt].Y += (float)(row1 * commonVars.getSimulationSettings().getDOESettings().getDouble(DOESettings.properties_d.rowPitch));
}
#if !VARIANCESINGLETHREADED
);
Expand Down
13 changes: 11 additions & 2 deletions Common/Variance/UI/UIHandlers_email.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Globalization;
using EmailNS;
using Error;

namespace Variance;

Expand All @@ -19,7 +21,7 @@ private void emailSettingsChanged(object sender, EventArgs e)
varianceContext.vc.host = commonVars.getNonSimulationSettings().host = text_server.Text;
varianceContext.vc.emailPwd = commonVars.getNonSimulationSettings().emailPwd = varianceContext.vc.aes.EncryptToString(text_emailPwd.Text);
varianceContext.vc.port = commonVars.getNonSimulationSettings().port = num_port.Value.ToString(CultureInfo.InvariantCulture);
varianceContext.vc.ssl = commonVars.getNonSimulationSettings().ssl = (bool)checkBox_SSL.Checked;
varianceContext.vc.ssl = commonVars.getNonSimulationSettings().ssl = (bool)checkBox_SSL.Checked!;

bool emailOK = validateEmailSettings();
checkBox_EmailCompletion.Enabled = emailOK;
Expand All @@ -32,7 +34,14 @@ private void emailSettingsChanged(object sender, EventArgs e)

private void emailTest(object sender, EventArgs e)
{
Email.Send(varianceContext.vc.host, varianceContext.vc.port, varianceContext.vc.ssl, "Variance Email Test", "Testing 1 2 3", varianceContext.vc.emailAddress, varianceContext.vc.aes.DecryptString(varianceContext.vc.emailPwd));
try
{
Email.Send(varianceContext.vc.host, varianceContext.vc.port, varianceContext.vc.ssl, "Variance Email Test", "Testing 1 2 3", varianceContext.vc.emailAddress, varianceContext.vc.aes.DecryptString(varianceContext.vc.emailPwd));
}
catch (Exception ex)
{
ErrorReporter.showMessage_OK(ex.Message, "Error sending mail");
}
}

}
12 changes: 7 additions & 5 deletions Common/Variance/UI/UIHandlers_file.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ private void pNew(bool prompt)
commonVars.setGCCDV(varianceContext.vc.geoCoreCDVariation);
commonVars.setLayerPreviewDOETile(varianceContext.vc.layerPreviewDOETile);
commonVars.setFriendly(varianceContext.vc.friendlyNumber);
commonVars.setExpandedUI(varianceContext.vc.expandUI);
setupGUI();
resetViewPorts();
set2DSelectedIndex(storeIndex);
Expand Down Expand Up @@ -337,7 +338,8 @@ await Application.Instance.InvokeAsync(() =>
MultiSelect = false,
Filters =
{
new FileFilter("Layout Files (*.gds; *.gdsii; *.oas; *.oasis; *.gds.gz; *.gdsii.gz; *.oas.gz; *.oasis.gz)", ".gds", ".gdsii", "*.oas", "*.oasis", ".gds.gz", ".gdsii.gz", "*.oas.gz", "*.oasis.gz")
new FileFilter("Layout Files (*.gds; *.gdsii; *.oas; *.oasis; *.gds.gz; *.gdsii.gz; *.oas.gz; *.oasis.gz)", ".gds", ".gdsii", "*.oas", "*.oasis", ".gds.gz", ".gdsii.gz", "*.oas.gz", "*.oasis.gz"
, ".GDS", ".GDSII", "*.OAS", "*.OASIS", ".GDS.GZ", ".GDSII.GZ", "*.OAS.GZ", "*.OASIS.GZ")
}
};

Expand Down Expand Up @@ -387,13 +389,13 @@ await Application.Instance.InvokeAsync(() =>
commonVars.getLayerSettings(settingsIndex).setString(EntropyLayerSettings.properties_s.file, commonVars.getGeoCoreHandler(settingsIndex).getFilename());
// Clear tracking for external point data.
commonVars.getLayerSettings(settingsIndex).setReloaded(false);

try
{
comboBox_structureList_geoCore.SelectedIndex = commonVars.getGeoCoreHandler(settingsIndex).getGeo().activeStructure;
}
catch (Exception)
{

}
try
{
Expand Down Expand Up @@ -471,7 +473,7 @@ private bool layoutLoad(int settingsIndex, string filename)
{
commonVars.getGeoCoreHandler(settingsIndex).updateGeoCoreHandler(filename, GeoCore.fileType.oasis);
}

return commonVars.getGeoCoreHandler(settingsIndex).isValid();
}
default:
Expand All @@ -487,7 +489,7 @@ private void iDRMFileChooser_Handler(object sender, EventArgs e)
MultiSelect = false,
Filters =
{
new FileFilter("CSV Files (*.csv)", ".csv")
new FileFilter("CSV Files (*.csv)", ".csv", ".CSV")
}
};
bool reading = false;
Expand Down Expand Up @@ -534,7 +536,7 @@ private void QuiltFileChooser_Handler(object sender, EventArgs e)
MultiSelect = false,
Filters =
{
new FileFilter("CSV Files (*.csv)", ".csv")
new FileFilter("CSV Files (*.csv)", ".csv", ".CSV")
}
};
bool reading = false;
Expand Down
11 changes: 5 additions & 6 deletions Common/Variance/UI/UIHandlers_geoCore.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Eto.Forms;
Expand All @@ -28,10 +27,10 @@ private async void exportActiveLayerToLayout()
Title = "Enter file to save",
Filters =
{
new FileFilter("GDS file", "*.gds", ".gdsii"),
new FileFilter("GDS file, GZIP compressed", "*.gds.gz", "*.gdsii.gz"),
new FileFilter("OAS file", "*.oas", "*.oasis"),
new FileFilter("OAS file. GZIP compressed", "*.oas.gz", "*.oasis.gz")
new FileFilter("GDS file", "*.gds", ".gdsii", "*.GDS", ".GDSII"),
new FileFilter("GDS file, GZIP compressed", "*.gds.gz", "*.gdsii.gz", "*.GDS.GZ", "*.GDSII.GZ"),
new FileFilter("OAS file", "*.oas", "*.oasis", "*.OAS", "*.OASIS"),
new FileFilter("OAS file. GZIP compressed", "*.oas.gz", "*.oasis.gz", "*.OAS.GZ", "*.OASIS.GZ")
}
};
if (sfd.ShowDialog(ParentWindow) != DialogResult.Ok)
Expand Down Expand Up @@ -166,7 +165,7 @@ private void toGeoCore(int type, string file)

GeoLibPoint[] ePoly = GeoWrangler.resize_to_int(polys[poly], scale);

gcell_root.addPolygon(ePoly.ToArray(), layerIndex + 1, 0); // layer is 1-index based for output, so need to offset value accordingly.
gcell_root.addPolygon(ePoly, layerIndex + 1, 0); // layer is 1-index based for output, so need to offset value accordingly.
}
}

Expand Down
6 changes: 3 additions & 3 deletions Common/Variance/UI/UIHandlers_layer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ private void customRNGContextMenu()
private void omitLayerCheckboxChanged(object sender, EventArgs e)
{
// Establish which sender raised the event so that we can push the value to the correct layer.
int index = Array.IndexOf(cB_omit, sender);
setOmitLayer(index, (bool)((CheckBox)sender).Checked);
int index = Array.IndexOf(cB_omit, (CheckBox)sender);
setOmitLayer(index, (bool)((CheckBox)sender).Checked!);
}

private void setOmitLayer(int index, bool status)
Expand Down Expand Up @@ -196,7 +196,7 @@ private void bgLayerCheckboxChanged(int settingsIndex)
{
for (int i = 0; i < cB_bg.Length; i++)
{
if ((bool)cB_bg[i].Checked && cB_bg[i].Enabled)
if ((bool)cB_bg[i].Checked! && cB_bg[i].Enabled)
{
commonVars.getLayerSettings(settingsIndex).setIntArrayValue(EntropyLayerSettings.properties_intarray.bglayers, i, 1);
}
Expand Down
Loading

0 comments on commit 450f309

Please sign in to comment.