diff --git a/GUI/SW1/SRC/BUNDLEBLDR.cpp b/GUI/SW1/SRC/BUNDLEBLDR.cpp index aeb94e9..bea43d9 100644 --- a/GUI/SW1/SRC/BUNDLEBLDR.cpp +++ b/GUI/SW1/SRC/BUNDLEBLDR.cpp @@ -121,6 +121,7 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w wxBoxSizer* BoxSizer6; wxFlexGridSizer* FlexGridSizer4; wxBoxSizer* BoxSizer5; + wxBoxSizer* BoxSizer7; wxStaticBoxSizer* StaticBoxSizer4; wxFlexGridSizer* FlexGridSizer3; wxFlexGridSizer* FlexGridSizer5; @@ -136,12 +137,14 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w wxFlexGridSizer* FlexGridSizer1; wxBoxSizer* BoxSizer3; - Create(parent, wxID_ANY, _("SACAMOS: CABLE BUNDLE BUILDER"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY")); + Create(parent, wxID_ANY, _("SACAMOS: CABLE BUNDLE BUILDER"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY")); FlexGridSizer1 = new wxFlexGridSizer(1, 2, 0, 0); + FlexGridSizer1->AddGrowableCol(0); FlexGridSizer1->AddGrowableCol(1); FlexGridSizer1->AddGrowableRow(0); StaticBoxSizer4 = new wxStaticBoxSizer(wxVERTICAL, this, _("Bundle Specification")); FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0); + FlexGridSizer3->AddGrowableRow(1); BoxSizer2 = new wxBoxSizer(wxHORIZONTAL); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Bundle Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); 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 Panel3 = new wxPanel(Notebook1, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL3")); BoxSizer6 = new wxBoxSizer(wxVERTICAL); StaticBoxSizer2 = new wxStaticBoxSizer(wxVERTICAL, Panel3, _("Cable Component Browser")); - Panel2 = new wxPanel(Panel3, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxTAB_TRAVERSAL, _T("ID_PANEL2")); - Panel2->SetMinSize(wxSize(300,0)); - StaticBoxSizer2->Add(Panel2, 1, wxALL|wxEXPAND, 5); + BoxSizer7 = new wxBoxSizer(wxVERTICAL); + Panel2 = new wxPanel(Panel3, ID_PANEL2, wxDefaultPosition, wxSize(300,140), wxTAB_TRAVERSAL, _T("ID_PANEL2")); + BoxSizer7->Add(Panel2, 1, wxALL|wxEXPAND, 5); + StaticBoxSizer2->Add(BoxSizer7, 1, wxALL|wxEXPAND, 5); BoxSizer6->Add(StaticBoxSizer2, 2, wxALL|wxEXPAND, 5); StaticBoxSizer3 = new wxStaticBoxSizer(wxVERTICAL, Panel3, _("Bundle Component Cables")); BoxSizer3 = new wxBoxSizer(wxVERTICAL); @@ -272,7 +276,7 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w Button3 = new wxButton(this, ID_BUTTON3, _("CLOSE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); BoxSizer1->Add(Button3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); StaticBoxSizer4->Add(BoxSizer1, 1, wxALL, 5); - FlexGridSizer1->Add(StaticBoxSizer4, 3, wxALL|wxEXPAND, 5); + FlexGridSizer1->Add(StaticBoxSizer4, 1, wxALL|wxEXPAND, 5); StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("2D Cross Section")); Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(500,500), wxTAB_TRAVERSAL, _T("ID_PANEL1")); Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); @@ -285,15 +289,13 @@ BUNDLEBLDR::BUNDLEBLDR(wxWindow* parent,wxWindowID id,const wxPoint& pos,const w SpinButton1 = new wxSpinButton(this, ID_SPINBUTTON1, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL|wxSP_ARROW_KEYS, _T("ID_SPINBUTTON1")); SpinButton1->SetRange(0, 100); BoxSizer4->Add(SpinButton1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - StaticBoxSizer1->Add(BoxSizer4, 1, wxALL, 5); - FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL, 5); + StaticBoxSizer1->Add(BoxSizer4, 1, wxALL|wxALIGN_RIGHT, 5); + FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5); SetSizer(FlexGridSizer1); FlexGridSizer1->Fit(this); FlexGridSizer1->SetSizeHints(this); - Panel2->Connect(wxEVT_PAINT,(wxObjectEventFunction)&BUNDLEBLDR::OnPanel2Paint,0,this); Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox1Click); - Connect(ID_CHECKBOX2,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox2Click); Connect(ID_COMBOBOX1,wxEVT_COMMAND_COMBOBOX_SELECTED,(wxObjectEventFunction)&BUNDLEBLDR::OnComboBox1Selected); Connect(ID_CHECKBOX3,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&BUNDLEBLDR::OnCheckBox3Click); Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&BUNDLEBLDR::OnTextCtrl4Text); @@ -410,18 +412,19 @@ void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path) { int size_h, size_v; - tree = (wxSpecificDirCtrl *) NULL; - Panel2->GetSize(&size_h, &size_v ); - tree = new wxSpecificDirCtrl (Panel2, -1, Path, + tree2 = (wxSpecificDirCtrl *) NULL; + + tree2 = new wxSpecificDirCtrl (Panel2, -1, Path, wxDefaultPosition, - wxSize(size_h, size_v), + wxSize(300, 140), wxSIMPLE_BORDER, "*.cable_spec", 0, _T("Directory Listing")); - Connect(tree->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &BUNDLEBLDR::OnTreeSelectionChanged); + + Connect(tree2->GetTreeCtrl()->GetId(),wxEVT_COMMAND_TREE_ITEM_ACTIVATED, (wxObjectEventFunction) (wxEventFunction)(wxCommandEventFunction) &BUNDLEBLDR::OnTreeSelectionChanged); //SetButtonState_FolderSelected(); } @@ -430,7 +433,7 @@ void BUNDLEBLDR::PopulateTheDirectoryTree (wxString Path) void BUNDLEBLDR::OnTreeSelectionChanged(wxTreeEvent& evt) { // A few file functions - wxFileName fname (tree->GetFilePath()); + wxFileName fname (tree2->GetFilePath()); wxString File_Path = fname.GetPath(); wxString File_FullName = fname.GetFullName(); @@ -1613,17 +1616,6 @@ void BUNDLEBLDR::OnSpinButton1ChangeDown(wxSpinEvent& event) DrawBundleCsection(); } -void BUNDLEBLDR::OnCheckBox2Click(wxCommandEvent& event) +void BUNDLEBLDR::OnPanel2Paint1(wxPaintEvent& event) { - if (CheckBox2->GetValue()) - { - TextCtrl8 -> Disable(); - SpinButton1 -> Disable(); - } - - if (!CheckBox2->GetValue()) - { - TextCtrl8 -> Enable(); - SpinButton1 -> Enable(); - } } diff --git a/GUI/SW1/SRC/SW1_GUIMain.cpp b/GUI/SW1/SRC/SW1_GUIMain.cpp index e9c355a..90c38ce 100644 --- a/GUI/SW1/SRC/SW1_GUIMain.cpp +++ b/GUI/SW1/SRC/SW1_GUIMain.cpp @@ -122,6 +122,7 @@ SW1_GUIFrame::SW1_GUIFrame(wxWindow* parent,wxWindowID id) Create(parent, wxID_ANY, _("SACAMOS"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY")); FlexGridSizer1 = new wxFlexGridSizer(1, 2, 0, 5); + FlexGridSizer1->AddGrowableCol(0); FlexGridSizer1->AddGrowableCol(1); FlexGridSizer1->AddGrowableRow(0); StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("MOD Browser")); @@ -289,15 +290,17 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event) // Create a new wxDirDialog dialog wxDirDialog* dirDialog = new wxDirDialog(this); + wxString separator(wxFileName::GetPathSeparator()); + // Display the dialog and transfer the contents to // the wxTextCtrl on the main frame if the user // doesn't cancel if (dirDialog->ShowModal() == wxID_OK) { wxString selectedFile = dirDialog->GetPath(); - PathToMOD << dirDialog->GetPath(); + PathToMOD = dirDialog->GetPath(); - wxStringTokenizer tkz(PathToMOD, wxT("/")); + wxStringTokenizer tkz(PathToMOD, separator); while (tkz.HasMoreTokens()) { @@ -305,22 +308,22 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event) } wxString folder, dirName; - folder = PathToMOD + "/CABLE"; + folder = PathToMOD + separator + "CABLE"; dirName = folder; if (!wxDirExists(dirName)) wxMkdir(dirName, 0); - folder = PathToMOD + "/BUNDLE"; + folder = PathToMOD + separator +"BUNDLE"; dirName = folder; if (!wxDirExists(dirName)) wxMkdir(dirName, 0); - folder = PathToMOD + "/SPICE"; + folder = PathToMOD + separator +"SPICE"; dirName = folder; if (!wxDirExists(dirName)) wxMkdir(dirName, 0); - folder = PathToMOD + "/SPICE/SYMBOL"; + folder = PathToMOD + separator +"SPICE" + separator + "SYMBOL"; dirName = folder; if (!wxDirExists(dirName)) wxMkdir(dirName, 0); @@ -331,6 +334,8 @@ void SW1_GUIFrame::OnCreateMOD(wxCommandEvent& event) MenuBar1->EnableTop(MenuBar1->FindMenu(_("&Spice Model")),true); } dirDialog->Destroy(); + + PopulateTheDirectoryTree (PathToMOD); } void SW1_GUIFrame::PopulateTheDirectoryTree ( wxString RootFolder) diff --git a/GUI/SW1/SRC/UTILITIES.cpp b/GUI/SW1/SRC/UTILITIES.cpp index fedc6a2..eb86af5 100644 --- a/GUI/SW1/SRC/UTILITIES.cpp +++ b/GUI/SW1/SRC/UTILITIES.cpp @@ -62,9 +62,11 @@ void check_is_empty(wxTextCtrl *TxtBox, int *IsError) void check_is_numeric(wxTextCtrl *TxtBox, int *IsError) { - char* non_numeric; + char* non_numeric = NULL; - (void) strtod(TxtBox->GetValue(), &non_numeric); + wxString input = TxtBox->GetValue(); + + (void) strtod(input, &non_numeric); if (*IsError == 0) { @@ -72,7 +74,7 @@ void check_is_numeric(wxTextCtrl *TxtBox, int *IsError) TxtBox->Refresh(); } - if (!*non_numeric || *IsError == 1) + if (*non_numeric || *IsError == 1) { TxtBox->SetBackgroundColour(wxColor(255,153,153)); TxtBox->SetFocus(); @@ -84,12 +86,14 @@ void check_is_numeric(wxTextCtrl *TxtBox, int *IsError) void check_is_numeric_list(wxTextCtrl *TxtBox, int *IsError) { - char* non_numeric; + char* non_numeric = NULL; + + wxString input = TxtBox->GetValue(); TxtBox->SetBackgroundColour("WHITE"); TxtBox->Refresh(); - wxStringTokenizer tokenizer(TxtBox->GetValue(), " "); + wxStringTokenizer tokenizer(input, " "); while ( tokenizer.HasMoreTokens()) { -- libgit2 0.21.2