Commit 529d6552365500f1c76ea060048e450c896da2ee

Authored by Steve Greedy
1 parent 2f8cca9d

SW1_GUI Bug fixes

MOD create
Check for vaild input applicable to Linux for non decimal input
Sizing of MOD fram in Bundlebldr
GUI/SW1/SRC/BUNDLEBLDR.cpp
... ... @@ -121,6 +121,7 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w
121 121 wxBoxSizer* BoxSizer6;
122 122 wxFlexGridSizer* FlexGridSizer4;
123 123 wxBoxSizer* BoxSizer5;
  124 + wxBoxSizer* BoxSizer7;
124 125 wxStaticBoxSizer* StaticBoxSizer4;
125 126 wxFlexGridSizer* FlexGridSizer3;
126 127 wxFlexGridSizer* FlexGridSizer5;
... ... @@ -136,12 +137,14 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w
136 137 wxFlexGridSizer* FlexGridSizer1;
137 138 wxBoxSizer* BoxSizer3;
138 139  
139   - Create(parent, wxID_ANY, _("SACAMOS: CABLE BUNDLE BUILDER"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY"));
  140 + Create(parent, wxID_ANY, _("SACAMOS: CABLE BUNDLE BUILDER"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
140 141 FlexGridSizer1 = new wxFlexGridSizer(1, 2, 0, 0);
  142 + FlexGridSizer1->AddGrowableCol(0);
141 143 FlexGridSizer1->AddGrowableCol(1);
142 144 FlexGridSizer1->AddGrowableRow(0);
143 145 StaticBoxSizer4 = new wxStaticBoxSizer(wxVERTICAL, this, _("Bundle Specification"));
144 146 FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0);
  147 + FlexGridSizer3->AddGrowableRow(1);
145 148 BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
146 149 StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Bundle Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
147 150 BoxSizer2->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
... ... @@ -153,9 +156,10 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w
153 156 Panel3 = new wxPanel(Notebook1, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL3"));
154 157 BoxSizer6 = new wxBoxSizer(wxVERTICAL);
155 158 StaticBoxSizer2 = new wxStaticBoxSizer(wxVERTICAL, Panel3, _("Cable Component Browser"));
156   - Panel2 = new wxPanel(Panel3, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL, _T("ID_PANEL2"));
157   - Panel2->SetMinSize(wxSize(300,0));
158   - StaticBoxSizer2->Add(Panel2, 1, wxALL|wxEXPAND, 5);
  159 + BoxSizer7 = new wxBoxSizer(wxVERTICAL);
  160 + Panel2 = new wxPanel(Panel3, ID_PANEL2, wxDefaultPosition, wxSize(300,140), wxTAB_TRAVERSAL, _T("ID_PANEL2"));
  161 + BoxSizer7->Add(Panel2, 1, wxALL|wxEXPAND, 5);
  162 + StaticBoxSizer2->Add(BoxSizer7, 1, wxALL|wxEXPAND, 5);
159 163 BoxSizer6->Add(StaticBoxSizer2, 2, wxALL|wxEXPAND, 5);
160 164 StaticBoxSizer3 = new wxStaticBoxSizer(wxVERTICAL, Panel3, _("Bundle Component Cables"));
161 165 BoxSizer3 = new wxBoxSizer(wxVERTICAL);
... ... @@ -272,7 +276,7 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w
272 276 Button3 = new wxButton(this, ID_BUTTON3, _("CLOSE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
273 277 BoxSizer1->Add(Button3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
274 278 StaticBoxSizer4->Add(BoxSizer1, 1, wxALL, 5);
275   - FlexGridSizer1->Add(StaticBoxSizer4, 3, wxALL|wxEXPAND, 5);
  279 + FlexGridSizer1->Add(StaticBoxSizer4, 1, wxALL|wxEXPAND, 5);
276 280 StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("2D Cross Section"));
277 281 Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(500,500), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
278 282 Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
... ... @@ -285,15 +289,13 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w
285 289 SpinButton1 = new wxSpinButton(this, ID_SPINBUTTON1, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL|wxSP_ARROW_KEYS, _T("ID_SPINBUTTON1"));
286 290 SpinButton1->SetRange(0, 100);
287 291 BoxSizer4->Add(SpinButton1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
288   - StaticBoxSizer1->Add(BoxSizer4, 1, wxALL, 5);
289   - FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL, 5);
  292 + StaticBoxSizer1->Add(BoxSizer4, 1, wxALL|wxALIGN_RIGHT, 5);
  293 + FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
290 294 SetSizer(FlexGridSizer1);
291 295 FlexGridSizer1->Fit(this);
292 296 FlexGridSizer1->SetSizeHints(this);
293 297  
294   - Panel2->Connect(wxEVT_PAINT,(wxObjectEventFunction)&BUNDLEBLDR::OnPanel2Paint,0,this);
295 298 Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox1Click);
296   - Connect(ID_CHECKBOX2,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox2Click);
297 299 Connect(ID_COMBOBOX1,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&BUNDLEBLDR::OnComboBox1Selected);
298 300 Connect(ID_CHECKBOX3,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox3Click);
299 301 Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&BUNDLEBLDR::OnTextCtrl4Text);
... ... @@ -410,18 +412,19 @@ void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path)
410 412 {
411 413 int size_h, size_v;
412 414  
413   - tree = (wxSpecificDirCtrl *) NULL;
414   -
415 415 Panel2->GetSize(&size_h, &size_v );
416 416  
417   - tree = new wxSpecificDirCtrl (Panel2, -1, Path,
  417 + tree2 = (wxSpecificDirCtrl *) NULL;
  418 +
  419 + tree2 = new wxSpecificDirCtrl (Panel2, -1, Path,
418 420 wxDefaultPosition,
419   - wxSize(size_h, size_v),
  421 + wxSize(300, 140),
420 422 wxSIMPLE_BORDER,
421 423 "*.cable_spec", 0,
422 424 _T("Directory Listing"));
423 425  
424   - Connect(tree->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &BUNDLEBLDR::OnTreeSelectionChanged);
  426 +
  427 + Connect(tree2->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &BUNDLEBLDR::OnTreeSelectionChanged);
425 428  
426 429 //SetButtonState_FolderSelected();
427 430 }
... ... @@ -430,7 +433,7 @@ void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path)
430 433 void BUNDLEBLDR::OnTreeSelectionChanged(wxTreeEvent& evt)
431 434 {
432 435 // A few file functions
433   - wxFileName fname (tree->GetFilePath());
  436 + wxFileName fname (tree2->GetFilePath());
434 437 wxString File_Path = fname.GetPath();
435 438 wxString File_FullName = fname.GetFullName();
436 439  
... ... @@ -1613,17 +1616,6 @@ void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event)
1613 1616 DrawBundleCsection();
1614 1617 }
1615 1618  
1616   -void BUNDLEBLDR::OnCheckBox2Click(wxCommandEvent& event)
  1619 +void BUNDLEBLDR::OnPanel2Paint1(wxPaintEvent& event)
1617 1620 {
1618   - if (CheckBox2->GetValue())
1619   - {
1620   - TextCtrl8 -> Disable();
1621   - SpinButton1 -> Disable();
1622   - }
1623   -
1624   - if (!CheckBox2->GetValue())
1625   - {
1626   - TextCtrl8 -> Enable();
1627   - SpinButton1 -> Enable();
1628   - }
1629 1621 }
... ...
GUI/SW1/SRC/SW1_GUIMain.cpp
... ... @@ -122,6 +122,7 @@ SW1_GUIFrame::SW1_GUIFrame(wxWindow* parent,wxWindowID id)
122 122  
123 123 Create(parent, wxID_ANY, _("SACAMOS"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
124 124 FlexGridSizer1 = new wxFlexGridSizer(1, 2, 0, 5);
  125 + FlexGridSizer1->AddGrowableCol(0);
125 126 FlexGridSizer1->AddGrowableCol(1);
126 127 FlexGridSizer1->AddGrowableRow(0);
127 128 StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("MOD Browser"));
... ... @@ -289,15 +290,17 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event)
289 290 // Create a new wxDirDialog dialog
290 291 wxDirDialog* dirDialog = new wxDirDialog(this);
291 292  
  293 + wxString separator(wxFileName::GetPathSeparator());
  294 +
292 295 // Display the dialog and transfer the contents to
293 296 // the wxTextCtrl on the main frame if the user
294 297 // doesn't cancel
295 298 if (dirDialog->ShowModal() == wxID_OK)
296 299 {
297 300 wxString selectedFile = dirDialog->GetPath();
298   - PathToMOD << dirDialog->GetPath();
  301 + PathToMOD = dirDialog->GetPath();
299 302  
300   - wxStringTokenizer tkz(PathToMOD, wxT("/"));
  303 + wxStringTokenizer tkz(PathToMOD, separator);
301 304  
302 305 while (tkz.HasMoreTokens())
303 306 {
... ... @@ -305,22 +308,22 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent&amp; event)
305 308 }
306 309 wxString folder, dirName;
307 310  
308   - folder = PathToMOD + "/CABLE";
  311 + folder = PathToMOD + separator + "CABLE";
309 312 dirName = folder;
310 313 if (!wxDirExists(dirName))
311 314 wxMkdir(dirName, 0);
312 315  
313   - folder = PathToMOD + "/BUNDLE";
  316 + folder = PathToMOD + separator +"BUNDLE";
314 317 dirName = folder;
315 318 if (!wxDirExists(dirName))
316 319 wxMkdir(dirName, 0);
317 320  
318   - folder = PathToMOD + "/SPICE";
  321 + folder = PathToMOD + separator +"SPICE";
319 322 dirName = folder;
320 323 if (!wxDirExists(dirName))
321 324 wxMkdir(dirName, 0);
322 325  
323   - folder = PathToMOD + "/SPICE/SYMBOL";
  326 + folder = PathToMOD + separator +"SPICE" + separator + "SYMBOL";
324 327 dirName = folder;
325 328 if (!wxDirExists(dirName))
326 329 wxMkdir(dirName, 0);
... ... @@ -331,6 +334,8 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent&amp; event)
331 334 MenuBar1->EnableTop(MenuBar1->FindMenu(_("&Spice Model")),true);
332 335 }
333 336 dirDialog->Destroy();
  337 +
  338 + PopulateTheDirectoryTree (PathToMOD);
334 339 }
335 340  
336 341 void SW1_GUIFrame::PopulateTheDirectoryTree ( wxString RootFolder)
... ...
GUI/SW1/SRC/UTILITIES.cpp
... ... @@ -62,9 +62,11 @@ void check_is_empty(wxTextCtrl *TxtBox, int *IsError)
62 62 void check_is_numeric(wxTextCtrl *TxtBox, int *IsError)
63 63 {
64 64  
65   - char* non_numeric;
  65 + char* non_numeric = NULL;
66 66  
67   - (void) strtod(TxtBox->GetValue(), &non_numeric);
  67 + wxString input = TxtBox->GetValue();
  68 +
  69 + (void) strtod(input, &non_numeric);
68 70  
69 71 if (*IsError == 0)
70 72 {
... ... @@ -72,7 +74,7 @@ void check_is_numeric(wxTextCtrl *TxtBox, int *IsError)
72 74 TxtBox->Refresh();
73 75 }
74 76  
75   - if (!*non_numeric || *IsError == 1)
  77 + if (*non_numeric || *IsError == 1)
76 78 {
77 79 TxtBox->SetBackgroundColour(wxColor(255,153,153));
78 80 TxtBox->SetFocus();
... ... @@ -84,12 +86,14 @@ void check_is_numeric(wxTextCtrl *TxtBox, int *IsError)
84 86 void check_is_numeric_list(wxTextCtrl *TxtBox, int *IsError)
85 87 {
86 88  
87   - char* non_numeric;
  89 + char* non_numeric = NULL;
  90 +
  91 + wxString input = TxtBox->GetValue();
88 92  
89 93 TxtBox->SetBackgroundColour("WHITE");
90 94 TxtBox->Refresh();
91 95  
92   - wxStringTokenizer tokenizer(TxtBox->GetValue(), " ");
  96 + wxStringTokenizer tokenizer(input, " ");
93 97  
94 98 while ( tokenizer.HasMoreTokens())
95 99 {
... ...