Commit 00c8775f0fb0d038763bcf6f3914b880464991f0
1 parent
9f24e090
Exists in
master
and in
3 other branches
Update SW1
Updates to SW1 prior to merge with master branch.
Showing
17 changed files
with
73 additions
and
33 deletions
Show diff stats
GUI/SW1/SRC/BUNDLEBLDR.cpp
| ... | ... | @@ -486,6 +486,7 @@ void BUNDLEBLDR::OnCheckListBox1Toggled(wxCommandEvent& event) |
| 486 | 486 | void BUNDLEBLDR::OnPanel1Paint(wxPaintEvent& event) |
| 487 | 487 | { |
| 488 | 488 | DrawPanel(); |
| 489 | + DrawBundleCsection(); | |
| 489 | 490 | } |
| 490 | 491 | |
| 491 | 492 | void BUNDLEBLDR::DrawPanel() |
| ... | ... | @@ -558,6 +559,8 @@ void BUNDLEBLDR::FormatPanel(double maxDimension) |
| 558 | 559 | |
| 559 | 560 | dc.DrawText("scale (m)", (size_h/2+50), size_v-70); |
| 560 | 561 | dc.DrawText(scale, (size_h/2+55), size_v-40); |
| 562 | + | |
| 563 | + | |
| 561 | 564 | } |
| 562 | 565 | |
| 563 | 566 | void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxString rot) |
| ... | ... | @@ -664,7 +667,7 @@ void BUNDLEBLDR::DrawBundleCable(wxString cable, wxString x, wxString y, wxStrin |
| 664 | 667 | dc.SetPen( wxPen( wxColor(0,0,0),1 ) ); |
| 665 | 668 | dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); |
| 666 | 669 | dc.DrawCircle( wxPoint(size_h/2+scaledxCoord,size_v/2+scaledyCoord), inner_conductor_Scaledradius ); |
| 667 | - | |
| 670 | + DrawBundleCsection(); | |
| 668 | 671 | } |
| 669 | 672 | |
| 670 | 673 | if (str.compare("Twinax") == 0 ){ |
| ... | ... | @@ -1409,10 +1412,10 @@ void BUNDLEBLDR::WriteBundleFile(wxString fileName) |
| 1409 | 1412 | |
| 1410 | 1413 | if (CheckBox1->GetValue()) |
| 1411 | 1414 | { |
| 1412 | - cableFile << "gp_mesh_edge_length\n"; | |
| 1415 | + cableFile << "gp_edge_length\n"; | |
| 1413 | 1416 | cableFile << TextCtrl10->GetValue() <<"\n"; |
| 1414 | 1417 | } |
| 1415 | - CheckBox3 ->SetValue(false); | |
| 1418 | + //CheckBox3 ->SetValue(false); | |
| 1416 | 1419 | } |
| 1417 | 1420 | } |
| 1418 | 1421 | cableFile.close(); | ... | ... |
GUI/SW1/SRC/BUNDLEBLDR.h
| ... | ... | @@ -126,7 +126,7 @@ class BUNDLEBLDR: public wxDialog |
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | //wxGenericDirCtrl *tree; |
| 129 | - wxSpecificDirCtrl *tree2; | |
| 129 | + wxSpecificDirCtrl *tree2 = NULL; //NULL used to remain consistent with wxWidgets use of the standard NULL macro | |
| 130 | 130 | |
| 131 | 131 | wxString PathToMOD; |
| 132 | 132 | wxString MODname; | ... | ... |
GUI/SW1/SRC/COAXIAL.cpp
| ... | ... | @@ -329,6 +329,8 @@ void COAXIAL::OnInit(wxInitDialogEvent& event) |
| 329 | 329 | TextCtrl8->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&COAXIAL::OnHighlightSchematic, this); |
| 330 | 330 | TextCtrl9->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&COAXIAL::OnHighlightSchematic, this); |
| 331 | 331 | CheckBox1->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&COAXIAL::OnHighlightSchematic, this); |
| 332 | + | |
| 333 | + Logger::instance().log("Create Coaxial Cable Model", Logger::kLogLevelInfo); | |
| 332 | 334 | } |
| 333 | 335 | |
| 334 | 336 | void COAXIAL::OnPaint(wxPaintEvent& event) | ... | ... |
GUI/SW1/SRC/COAXIAL.h
GUI/SW1/SRC/CYLINDRICAL.cpp
| ... | ... | @@ -184,6 +184,8 @@ void CYLINDRICAL::OnInit(wxInitDialogEvent& event) |
| 184 | 184 | TextCtrl4->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&CYLINDRICAL::OnHighlightSchematic, this); |
| 185 | 185 | TextCtrl5->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&CYLINDRICAL::OnHighlightSchematic, this); |
| 186 | 186 | CheckBox1->Bind(wxEVT_SET_FOCUS,(wxObjectEventFunction)&CYLINDRICAL::OnHighlightSchematic, this); |
| 187 | + | |
| 188 | + Logger::instance().log("Create Cylindrical Cable Model", Logger::kLogLevelInfo); | |
| 187 | 189 | } |
| 188 | 190 | |
| 189 | 191 | void CYLINDRICAL::OnPaint(wxPaintEvent& event) | ... | ... |
GUI/SW1/SRC/CYLINDRICAL.h
GUI/SW1/SRC/DCONN.cpp
| ... | ... | @@ -348,7 +348,7 @@ void DCONN::WriteCableFile(wxString fileName) |
| 348 | 348 | cableFile << TextCtrl2->GetValue() <<" # parameter 1: conductor radius\n"; |
| 349 | 349 | cableFile << TextCtrl3->GetValue() <<" # parameter 2: conductor pitch (separation in x)\n"; |
| 350 | 350 | cableFile << TextCtrl4->GetValue() <<" # parameter 3: conductor separation in y \n"; |
| 351 | - cableFile << TextCtrl2->GetValue() <<" # offset from conductors to shell \n"; | |
| 351 | + cableFile << TextCtrl5->GetValue() <<" # offset from conductors to shell \n"; | |
| 352 | 352 | cableFile <<"0 # number of frequency dependent parameters\n"; |
| 353 | 353 | cableFile <<"0 # number of transfer impedance models \n"; |
| 354 | 354 | cableFile <<"use_laplace \n"; | ... | ... |
GUI/SW1/SRC/FLEXCABLE.cpp
| ... | ... | @@ -107,7 +107,7 @@ FLEXCABLE::FLEXCABLE(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxS |
| 107 | 107 | StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Flex Cable Parameters")); |
| 108 | 108 | FlexGridSizer2 = new wxFlexGridSizer(0, 1, 0, 0); |
| 109 | 109 | BoxSizer1 = new wxBoxSizer(wxHORIZONTAL); |
| 110 | - StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Cabe Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); | |
| 110 | + StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Cable Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); | |
| 111 | 111 | BoxSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); |
| 112 | 112 | TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); |
| 113 | 113 | BoxSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); | ... | ... |
GUI/SW1/SRC/SPICEMODEL.cpp
| ... | ... | @@ -321,7 +321,7 @@ void SPICEMODEL::PopulateTheDirectoryTree (wxString Path) |
| 321 | 321 | wxDefaultPosition, |
| 322 | 322 | wxSize(size_h, size_v), |
| 323 | 323 | wxSIMPLE_BORDER,//wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, |
| 324 | - wxEmptyString, 0, | |
| 324 | + "*.bundle_spec", 0, | |
| 325 | 325 | _T("Directory Listing")); |
| 326 | 326 | |
| 327 | 327 | Connect(tree->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &SPICEMODEL::OnTreeSelectionChanged); | ... | ... |
GUI/SW1/SRC/SPICEMODEL.h
| ... | ... | @@ -87,7 +87,7 @@ class SPICEMODEL: public wxDialog |
| 87 | 87 | wxString PathToMOD; |
| 88 | 88 | wxString MODname; |
| 89 | 89 | |
| 90 | - wxSpecificDirCtrl *tree; | |
| 90 | + wxSpecificDirCtrl *tree = NULL; //NULL used to remain consistent with wxWidgets use of the standard NULL macro | |
| 91 | 91 | |
| 92 | 92 | void renderBundle(wxString); |
| 93 | 93 | void FormatPanel(wxString); | ... | ... |
GUI/SW1/SRC/SW1_GUIApp.cpp
| ... | ... | @@ -110,15 +110,13 @@ bool SW1_GUIApp::OnInit() |
| 110 | 110 | |
| 111 | 111 | if ( wxsOK ) |
| 112 | 112 | { |
| 113 | - SW1_GUIFrame* Frame = new SW1_GUIFrame(0); | |
| 114 | - | |
| 115 | 113 | // Display splash screen |
| 116 | 114 | |
| 117 | 115 | if (splashimage.LoadFile("resources/Sacamos_About.png", wxBITMAP_TYPE_PNG)) |
| 118 | 116 | { |
| 119 | 117 | wxSplashScreen *splashscrn = new wxSplashScreen(splashimage, |
| 120 | 118 | wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, |
| 121 | - 2000, Frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, | |
| 119 | + 2000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, | |
| 122 | 120 | wxSIMPLE_BORDER|wxSTAY_ON_TOP); |
| 123 | 121 | } |
| 124 | 122 | |
| ... | ... | @@ -126,13 +124,15 @@ bool SW1_GUIApp::OnInit() |
| 126 | 124 | { |
| 127 | 125 | wxYield(); |
| 128 | 126 | wxSleep(2); |
| 129 | - Frame->Show(true); | |
| 127 | + //Frame->Show(true); | |
| 130 | 128 | } |
| 131 | 129 | else |
| 132 | 130 | { |
| 133 | - Frame->Show(true); | |
| 134 | - wxYield(); | |
| 135 | - wxSleep(2); | |
| 131 | + for (int i=0;i<20;i++) | |
| 132 | + { | |
| 133 | + wxYield(); | |
| 134 | + wxMilliSleep(10); | |
| 135 | + } | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | } |
| ... | ... | @@ -141,39 +141,49 @@ bool SW1_GUIApp::OnInit() |
| 141 | 141 | // Compare current version against latest release version |
| 142 | 142 | Logger::instance().log("Checking for Software Update...", Logger::kLogLevelInfo); |
| 143 | 143 | |
| 144 | - wxHTTP checkupdate; | |
| 145 | - | |
| 146 | - wxInputStream *latest_versioninfo; | |
| 144 | + std::string latest_version,latest_version_number, latest_version_date; | |
| 145 | + std::string current_version,current_version_number, current_version_date; | |
| 147 | 146 | |
| 148 | 147 | wxString version_temp = ""; |
| 149 | 148 | |
| 150 | 149 | wxStringOutputStream out_stream(&version_temp); |
| 151 | 150 | |
| 151 | + wxHTTP checkupdate; | |
| 152 | 152 | checkupdate.SetHeader(_T("Content-type"), _T("text/html; charset=utf-8")); |
| 153 | + checkupdate.SetTimeout(5); | |
| 154 | + checkupdate.Connect(_T("128.243.70.77")); | |
| 153 | 155 | |
| 154 | - std::string latest_version,latest_version_number, latest_version_date; | |
| 155 | - std::string current_version,current_version_number, current_version_date; | |
| 156 | + wxApp::IsMainLoopRunning(); | |
| 157 | + | |
| 158 | + wxInputStream *latest_versioninfo; | |
| 156 | 159 | |
| 157 | - if (checkupdate.Connect(_T("128.243.70.77"))) // only the server, no pages here yet ... | |
| 160 | + latest_versioninfo = checkupdate.GetInputStream(_T("/UoN/SACAMOS/raw/master/version_information.inc")); | |
| 161 | + | |
| 162 | + if (checkupdate.GetError() == wxPROTO_NOERR) | |
| 158 | 163 | { |
| 159 | 164 | Logger::instance().log("Connected to SACAMOS Repository", Logger::kLogLevelInfo); |
| 160 | 165 | |
| 161 | - latest_versioninfo = checkupdate.GetInputStream(_T("/UoN/SACAMOS/raw/master/version_information.inc")); | |
| 162 | - | |
| 163 | 166 | latest_versioninfo->Read(out_stream); |
| 164 | 167 | |
| 165 | 168 | latest_version = version_temp.ToStdString(); |
| 166 | - | |
| 167 | - wxDELETE(latest_versioninfo); | |
| 168 | 169 | } |
| 170 | + | |
| 169 | 171 | else |
| 170 | 172 | { |
| 171 | 173 | //fail silently & log event |
| 172 | 174 | Logger::instance().log("Could not connect to SACAMOS Repository", Logger::kLogLevelInfo); |
| 173 | 175 | } |
| 174 | 176 | |
| 177 | + wxDELETE(latest_versioninfo); | |
| 178 | + | |
| 175 | 179 | checkupdate.Close(); |
| 176 | 180 | |
| 181 | + if (wxsOK) | |
| 182 | + { | |
| 183 | + SW1_GUIFrame* Frame = new SW1_GUIFrame(0); | |
| 184 | + Frame->Show(true); | |
| 185 | + } | |
| 186 | + | |
| 177 | 187 | std::istringstream stream{latest_version}; |
| 178 | 188 | |
| 179 | 189 | if (latest_version != "") |
| ... | ... | @@ -204,9 +214,12 @@ bool SW1_GUIApp::OnInit() |
| 204 | 214 | Logger::instance().log("SACAMOS Update Available", Logger::kLogLevelInfo); |
| 205 | 215 | |
| 206 | 216 | } |
| 217 | + else | |
| 218 | + { | |
| 219 | + Logger::instance().log("SACAMOS Uptodate", Logger::kLogLevelInfo); | |
| 220 | + } | |
| 207 | 221 | } |
| 208 | 222 | |
| 209 | - | |
| 210 | 223 | return wxsOK; |
| 211 | 224 | |
| 212 | 225 | } | ... | ... |
GUI/SW1/SRC/SW1_GUIApp.h
| ... | ... | @@ -67,8 +67,10 @@ class SW1_GUIApp : public wxApp |
| 67 | 67 | |
| 68 | 68 | wxBitmap splashimage; |
| 69 | 69 | |
| 70 | - std::string SACAMOS_V_NUMBER = "SPICE_CABLE_MODEL_BUILDER_version=\"v3.1.0\""; | |
| 71 | - std::string SACAMOS_V_DATE = "SPICE_CABLE_MODEL_BUILDER_date=\"16th April 2018\""; | |
| 70 | + std::string SACAMOS_V_NUMBER = "SPICE_CABLE_MODEL_BUILDER_version=\"v4.0.0\""; | |
| 71 | + std::string SACAMOS_V_DATE = "SPICE_CABLE_MODEL_BUILDER_date=\"27th September 2018\""; | |
| 72 | + | |
| 73 | + | |
| 72 | 74 | |
| 73 | 75 | }; |
| 74 | 76 | ... | ... |
GUI/SW1/SRC/SW1_GUIMain.cpp
| ... | ... | @@ -251,6 +251,9 @@ SW1_GUIFrame::SW1_GUIFrame(wxWindow* parent,wxWindowID id) |
| 251 | 251 | |
| 252 | 252 | // Set status bar message text |
| 253 | 253 | StatusBar1 -> SetStatusText(wxT("Please Select MOD Directory")); |
| 254 | + | |
| 255 | + //Write to log file | |
| 256 | + CreateLogFile(); | |
| 254 | 257 | } |
| 255 | 258 | |
| 256 | 259 | SW1_GUIFrame::~SW1_GUIFrame() |
| ... | ... | @@ -308,7 +311,8 @@ void SW1_GUIFrame::OnSelectMOD(wxCommandEvent& event) |
| 308 | 311 | |
| 309 | 312 | void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event) |
| 310 | 313 | { |
| 311 | - // Create a new wxDirDialog dialog | |
| 314 | + | |
| 315 | + // Create a new wxDirDialog dialog | |
| 312 | 316 | wxDirDialog* dirDialog = new wxDirDialog(this); |
| 313 | 317 | |
| 314 | 318 | wxString separator(wxFileName::GetPathSeparator()); |
| ... | ... | @@ -357,6 +361,8 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event) |
| 357 | 361 | dirDialog->Destroy(); |
| 358 | 362 | |
| 359 | 363 | PopulateTheDirectoryTree (PathToMOD); |
| 364 | + | |
| 365 | + | |
| 360 | 366 | } |
| 361 | 367 | |
| 362 | 368 | void SW1_GUIFrame::PopulateTheDirectoryTree ( wxString RootFolder) |
| ... | ... | @@ -377,7 +383,7 @@ void SW1_GUIFrame::PopulateTheDirectoryTree ( wxString RootFolder) |
| 377 | 383 | wxDefaultPosition, |
| 378 | 384 | wxSize(size_h,size_v), |
| 379 | 385 | wxSIMPLE_BORDER, |
| 380 | - "*.cable_spec;*.bundle_spec;*.spice_model_spec", 0, | |
| 386 | + "*.cable_spec;*.bundle_spec;*.spice_model_spec;*.asy;*.sym", 0, | |
| 381 | 387 | _T("Directory Listing")); |
| 382 | 388 | |
| 383 | 389 | //Connect tree item activated e.g. single click and tree item selected e.g. double click events |
| ... | ... | @@ -669,6 +675,11 @@ void SW1_GUIFrame::OnEXPORTSPICE(wxCommandEvent& event) |
| 669 | 675 | exportspice->ShowModal(); |
| 670 | 676 | } |
| 671 | 677 | |
| 678 | +void SW1_GUIFrame::CreateLogFile() | |
| 679 | +{ | |
| 680 | + Logger::instance().log("Main GUI Initialised", Logger::kLogLevelInfo); | |
| 681 | +} | |
| 682 | + | |
| 672 | 683 | void SW1_GUIFrame::OnPanel1Paint(wxPaintEvent& event) |
| 673 | 684 | { |
| 674 | 685 | ... | ... |
GUI/SW1/SRC/SW1_GUIMain.h
| ... | ... | @@ -80,6 +80,7 @@ |
| 80 | 80 | #include "BUNDLE_SCHEMATIC.h" |
| 81 | 81 | #include "EXPORT_SPICE.h" |
| 82 | 82 | #include "UTILITIES.h" |
| 83 | +#include "LOGGER.h" | |
| 83 | 84 | |
| 84 | 85 | // Standard Library Header Files |
| 85 | 86 | #include <iostream> |
| ... | ... | @@ -102,12 +103,16 @@ class SW1_GUIFrame: public wxFrame |
| 102 | 103 | void OnTreeSelection ( wxTreeEvent& evt ); |
| 103 | 104 | void CreateCable (wxString, wxString, bool); |
| 104 | 105 | |
| 106 | + void CreateLogFile(); | |
| 107 | + | |
| 105 | 108 | wxSpecificDirCtrl *tree = NULL; //NULL used to remain consistent with wxWidgets use of the standard NULL macro |
| 106 | 109 | |
| 107 | 110 | wxString PathToMOD; |
| 108 | 111 | wxString SelectedFile; |
| 109 | 112 | wxString MODname; |
| 110 | 113 | |
| 114 | + | |
| 115 | + | |
| 111 | 116 | bool Edit; |
| 112 | 117 | |
| 113 | 118 | //(*Handlers(SW1_GUIFrame) | ... | ... |
GUI/SW1/SRC/resources/Build
GUI/SW1/SRC/resources/Sacamos_About.png
version_information.inc