Blame view

GUI/SW1/SRC/PLACE_CABLE.cpp 5.64 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
/////////////////////////////////////////////////////////////////////////////////
//
// This file is part of SACAMOS, cable models for EMI simulations in SPICE.
// It was developed by the University of Nottingham and the Netherlands Aerospace
// Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
//
7ba34678   Steve Greedy   Update Copyright ...
7
// Copyright (C) 2015 - 2018 University of Nottingham
886c558b   Steve Greedy   SACAMOS Public Re...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// SACAMOS is free software: you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// SACAMOS is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// A copy of the GNU General Public License version 3 can be found in the
// file GNU_GPL_v3 in the root or at <http://www.gnu.org/licenses/>.
//
// wxWidgets is currently licenced under the "wxWindows Library Licence".
// A copy of the wxWindows Library Licence, Version 3.1 can be found in the file
// wxWindows_Library_Licence_v3-1 in the root or at:
// <https://www.wxwidgets.org/about/licence/>
//
// The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
//
// File Contents:
//
// NAME
//     BUNDLEBLDR.cpp
//
// DESCRIPTION
//     GUI for placing cable component within a bundle
//
// AUTHOR(S)
//     Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////
#include "PLACE_CABLE.h"

//(*InternalHeaders(PLACE_CABLE)
#include <wx/intl.h>
#include <wx/string.h>
//*)

//(*IdInit(PLACE_CABLE)
const long PLACE_CABLE::ID_STATICTEXT1 = wxNewId();
const long PLACE_CABLE::ID_TEXTCTRL1 = wxNewId();
const long PLACE_CABLE::ID_STATICTEXT2 = wxNewId();
const long PLACE_CABLE::ID_TEXTCTRL2 = wxNewId();
const long PLACE_CABLE::ID_STATICTEXT3 = wxNewId();
const long PLACE_CABLE::ID_TEXTCTRL3 = wxNewId();
const long PLACE_CABLE::ID_BUTTON1 = wxNewId();
const long PLACE_CABLE::ID_BUTTON2 = wxNewId();
//*)

BEGIN_EVENT_TABLE(PLACE_CABLE,wxDialog)
	//(*EventTable(PLACE_CABLE)
	//*)
END_EVENT_TABLE()

PLACE_CABLE::PLACE_CABLE(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(PLACE_CABLE)
	wxStaticBoxSizer* StaticBoxSizer1;
	wxFlexGridSizer* FlexGridSizer1;

	Create(parent, wxID_ANY, _("Position Cable"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
	StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Position Cable"));
	FlexGridSizer1 = new wxFlexGridSizer(0, 2, 0, 0);
	FlexGridSizer1->AddGrowableCol(1);
	StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Origin +/- X (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
	FlexGridSizer1->Add(StaticText1, 1, wxALL|wxEXPAND, 5);
	TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	FlexGridSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Origin +/- Y (m)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	FlexGridSizer1->Add(StaticText2, 1, wxALL|wxEXPAND, 5);
	TextCtrl2 = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
	FlexGridSizer1->Add(TextCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Rotation (degrees)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
	FlexGridSizer1->Add(StaticText3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	TextCtrl3 = new wxTextCtrl(this, ID_TEXTCTRL3, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
	FlexGridSizer1->Add(TextCtrl3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	Button1 = new wxButton(this, ID_BUTTON1, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	FlexGridSizer1->Add(Button1, 1, wxALL|wxEXPAND, 5);
	Button2 = new wxButton(this, ID_BUTTON2, _("CLOSE"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
	FlexGridSizer1->Add(Button2, 1, wxALL|wxEXPAND, 5);
	StaticBoxSizer1->Add(FlexGridSizer1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SetSizer(StaticBoxSizer1);
	StaticBoxSizer1->Fit(this);
	StaticBoxSizer1->SetSizeHints(this);

2e55c776   Steve Greedy   SW1_GUI Updates
95
96
97
	Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&PLACE_CABLE::OnTextCtrl1Text);
	Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&PLACE_CABLE::OnTextCtrl2Text);
	Connect(ID_TEXTCTRL3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&PLACE_CABLE::OnTextCtrl3Text);
886c558b   Steve Greedy   SACAMOS Public Re...
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
	Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PLACE_CABLE::OnButton1Click);
	Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PLACE_CABLE::OnButton2Click);
	//*)
}

PLACE_CABLE::~PLACE_CABLE()
{
	//(*Destroy(PLACE_CABLE)
	//*)
}


void PLACE_CABLE::OnButton1Click(wxCommandEvent& event)
{
    SetReturnCode(wxID_OK);
    EndModal(wxID_OK);
}

void PLACE_CABLE::OnButton2Click(wxCommandEvent& event)
{

    Close();

}

2e55c776   Steve Greedy   SW1_GUI Updates
123
void PLACE_CABLE::OnTextCtrl1Text(wxCommandEvent& event)
886c558b   Steve Greedy   SACAMOS Public Re...
124
{
2e55c776   Steve Greedy   SW1_GUI Updates
125
126
    int IsError = 0;
    check_is_numeric_list(TextCtrl1, &IsError);
886c558b   Steve Greedy   SACAMOS Public Re...
127
}
2e55c776   Steve Greedy   SW1_GUI Updates
128
129
130
131
132
133
134
135
136
137
138
139

void PLACE_CABLE::OnTextCtrl2Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl2, &IsError);
}

void PLACE_CABLE::OnTextCtrl3Text(wxCommandEvent& event)
{
    int IsError = 0;
    check_is_numeric_list(TextCtrl3, &IsError);
}