From: Jon S. B. <jb...@us...> - 2007-04-13 04:14:23
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10846 Added Files: actuator.cpp actuator.h actuator_dlg.cpp actuator_dlg.h Log Message: Early, non-working, version of actuator dialog. --- NEW FILE: actuator.cpp --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator.cpp // Purpose: support FGActuator in FCSBuilder // Author: Jon Berndt // Created: 06/02/2006 // Copyright: (c) Jon Berndt // Licence: GPL licence // // Functions: // // Actuator - Constructor // OnDraw // Copy // ExportXML // ImportXML // ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ // #pragma implementation #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include <wx/wx.h> #endif #include "wx/deprecated/setup.h" #if wxUSE_PROLOGIO #include "wx/deprecated/wxexpr.h" #endif #include "wx/ogl/ogl.h" #include "FGXMLElement.h" #include "MyApp.h" #include "shape.h" #include "actuator.h" IMPLEMENT_DYNAMIC_CLASS (Actuator, ComponentShape) /** * Actuator Constructor =========================================================== */ Actuator::Actuator (double w, double h, const wxString & Name ) :ComponentShape(w, h, wxT("actuator"), Name), Noise(0.0) { SetAttachmentMode (ATTACHMENT_MODE_EDGE); ClearAttachments (); GetAttachments ().Append (new wxAttachmentPoint (0, w * 0.5, 0.0)); GetAttachments ().Append (new wxAttachmentPoint (1, -w * 0.5, 0.0)); // input_sign_list.Append(new bool(false)); InputIsInverted = false; } /** * OnDraw ======================================================================= */ void Actuator::OnDraw (wxDC & dc) { ComponentShape::OnDraw (dc); wxCoord h,w; h = (int)m_height/2-arr_size - 2; w = (int)m_width/2 - 2; wxCoord r = h<w?h:w; r = r<10?r:10; wxPoint c[2]; c[0].y = 0; c[0].x = 3-w; c[1].y = 0; c[1].x = 3+w; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // left vertical c[0].y = -4*h/5; c[0].x = -3*w/5; c[1].y = 4*h/5; c[1].x = -3*w/5; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // top horizontal c[0].y = -4*h/5; c[0].x = -3*w/5; c[1].y = -4*h/5; c[1].x = 3*w/5; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // bottom horizontal c[0].y = 4*h/5; c[0].x = -3*w/5; c[1].y = 4*h/5; c[1].x = 3*w/5+1; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); // right vertical c[0].y = -4*h/5; c[0].x = 3*w/5; c[1].y = 4*h/5; c[1].x = 3*w/5; dc.DrawLines (2, c, WXROUND (m_xpos), WXROUND (m_ypos)); dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxRED_BRUSH); dc.DrawRoundedRectangle(WXROUND (m_xpos)-w/5-1, WXROUND (m_ypos)-h, 2*w/5+2, 6*h/10, -0.2); dc.SetBrush(*wxGREEN_BRUSH); dc.DrawRoundedRectangle(WXROUND (m_xpos)-w/5-1, WXROUND (m_ypos)-3*h/10+1, 2*w/5+2, 6*h/10, -0.2); dc.SetBrush(*wxBLUE_BRUSH); dc.DrawRoundedRectangle(WXROUND (m_xpos)-w/5-1, WXROUND (m_ypos)+4*h/10+2, 2*w/5+2, 6*h/10, -0.2); } /** * ======================================================================= */ #if wxUSE_PROLOGIO void Actuator::WriteAttributes (wxExpr * clause) { ComponentShape::WriteAttributes (clause); } void Actuator::ReadAttributes (wxExpr * clause) { ComponentShape::ReadAttributes (clause); } #endif /** * Copy ========================================================================= */ void Actuator::Copy (wxShape & copy) { ComponentShape::Copy (copy); wxASSERT (copy.IsKindOf (CLASSINFO (Actuator))); Actuator & ActuatorCopy = (Actuator &) copy; } /** * ExportXML ==================================================================== */ void Actuator::ExportXML(wxTextOutputStream & stream, const wxString & prefix) { ExportHead(stream, prefix); wxString Pre = prefix + wxT(" "); ExportInputs(stream,Pre); if (Lag != 0.0) stream << Pre << wxT("<lag> ") << Lag << wxT(" </lag>") << endl; if (Rate_Limit != 0.0) stream << Pre << wxT("<rate_limit> ") << Rate_Limit << wxT(" </rate_limit>") << endl; if (Bias != 0.0) stream << Pre << wxT("<bias> ") << Bias << wxT(" </bias>") << endl; if (Hysteresis_Width != 0.0) stream << Pre << wxT("<hysteresis_width> ") << Hysteresis_Width << wxT(" </hysteresis_width>") << endl; ExportCliper(stream,Pre); ExportOutput(stream,Pre); ExportTail(stream, prefix); } /** * ImportXML ==================================================================== <actuator name=name> <input> {[-]property} </input> <lag> number </lag> <rate_limit> number <rate_limit> <bias> number </bias> <deadband_width> number </deadband_width> // not modeled now <hysteresis_width> number </hysteresis_width> [<clipto> <min> {property name | value} </min> <max> {property name | value} </max> </clipto>] [<output> {property} </output>] </actuator> */ wxArrayString Actuator::ImportXML(JSBSim::Element * el) { JSBSim::Element* scratch_element=0; wxArrayString strings = ComponentShape::ImportXML(el); if ( el->FindElement("lag") ) Lag = el->FindElementValueAsNumber("lag"); if ( el->FindElement("rate_limit")) Rate_Limit = el->FindElementValueAsNumber("rate_limit"); if ( el->FindElement("bias")) Bias = el->FindElementValueAsNumber("bias"); if ( el->FindElement("hysteresis_width")) Hysteresis_Width = el->FindElementValueAsNumber("hysteresis_width"); InputIsInverted = *((GetInputSignList().Item(0))->GetData()); return strings; } --- NEW FILE: actuator_dlg.h --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator_dlg.h // Purpose: dialog for FGActuator // Author: Jon Berndt // Created: 04/12/2007 // Copyright: (c) Jon Berndt // Licence: GPL licence ///////////////////////////////////////////////////////////////////////////// // -*- C++ -*- generated by wxGlade 0.4.1 on Fri Apr 06 07:40:41 2007 #include <wx/wx.h> #include <wx/image.h> // begin wxGlade: ::dependencies #include <wx/notebook.h> #include <wx/tglbtn.h> // end wxGlade #ifndef ACTUATORCOMPONENTEDITOR_H #define ACTUATORCOMPONENTEDITOR_H class Actuator; class ActuatorComponentEditor: public wxDialog { public: // begin wxGlade: ActuatorComponentEditor::ids // end wxGlade ActuatorComponentEditor(Actuator *actuator, wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE); private: // begin wxGlade: ActuatorComponentEditor::methods void set_properties(); void do_layout(); // end wxGlade protected: // begin wxGlade: ActuatorComponentEditor::attributes wxStaticBox* sizer_inout_staticbox; wxStaticBox* sizer_actuator_properties_staticbox; wxStaticBox* sizer_clip_staticbox; wxStaticBox* sizer_basic_staticbox; wxStaticText* label_name; wxTextCtrl* txtEd_Name; wxStaticText* label_type; wxTextCtrl* txtEd_Type; wxStaticText* label_order; wxTextCtrl* txtEd_Order; wxCheckBox* chx_Clip; wxStaticText* label_clip_min; wxTextCtrl* txtEd_MinClip; wxStaticText* label_clip_max; wxTextCtrl* txtEd_MaxClip; wxStaticText* label_7; wxTextCtrl* txtEd_Lag; wxStaticText* label_10; wxTextCtrl* txtEd_RateLimit; wxStaticText* label_11; wxTextCtrl* txtEd_Hysteresis; wxStaticText* label_17; wxTextCtrl* txtEd_Bias; wxStaticText* label_1; wxToggleButton* button_invert_input; wxTextCtrl* txtEd_InputProperty; wxStaticText* label_output_property; wxTextCtrl* txtEd_OutputProperty; wxPanel* notebook_1_pane_1; wxTextCtrl* txtEd_Description; wxNotebook* nbk_Properties; wxButton* button_OK; wxButton* button_Cancel; wxButton* button_Help; // end wxGlade DECLARE_EVENT_TABLE(); public: void OnCheckboxClip(wxCommandEvent &event); // wxGlade: <event_handler> void OnClickInvertInput(wxCommandEvent &event); // wxGlade: <event_handler> void OnButtonPressOK(wxCommandEvent &event); // wxGlade: <event_handler> void OnButtonPressCancel(wxCommandEvent &event); // wxGlade: <event_handler> void OnButtonPressHelp(wxCommandEvent &event); // wxGlade: <event_handler> }; // wxGlade: end class #endif // ACTUATORCOMPONENTEDITOR_H --- NEW FILE: actuator.h --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator.h // Purpose: shape for FGActuator // Author: Jon Berndt // Created: 07/18/2006 // Copyright: (c) Jon Berndt // Licence: GPL licence ///////////////////////////////////////////////////////////////////////////// #ifndef _FCSBUILDER_ACTUATOR_H_ #define _FCSBUILDER_ACTUATOR_H_ #if defined(__GNUG__) && !defined(__APPLE__) // #pragma interface #endif /* * FGActuator Componment */ class Actuator: public ComponentShape { DECLARE_DYNAMIC_CLASS (Actuator) protected: double Lag; double Bias; double Rate_Limit; double Hysteresis_Width; // double Deadband_Width; bool InputIsInverted; public: Actuator (double w = 0.0, double h = 0.0, const wxString & Name = wxT("actuator")); void OnDraw (wxDC & dc); #if wxUSE_PROLOGIO void WriteAttributes (wxExpr * clause); void ReadAttributes (wxExpr * clause); #endif virtual void ExportXML(wxTextOutputStream & stream, const wxString & prefix); virtual wxArrayString ImportXML(JSBSim::Element * el); // Does the copying for this object void Copy (wxShape & copy); double GetLag(void) const {return Lag;} double GetBias(void) const {return Bias;} double GetRate_Limit(void) const {return Rate_Limit;} double GetHysteresis_Width(void) const {return Hysteresis_Width;} // double GetDeadband_Width(void) const {return Deadband_Width;} void SetLag(const double n) {Lag = n;} void SetBias(const double n) {Bias = n;} void SetRate_Limit(const double n) {Rate_Limit = n;} void SetHysteresis_Width(const double n) {Hysteresis_Width = n;} // void SetDeadband_Width(const double & n) {Deadband_Width = n;} inline bool GetInputIsInverted(void) {return InputIsInverted;} inline void SetInputIsInverted(bool s) {InputIsInverted = s;} }; #endif // _FCSBUILDER_ACTUATOR_H_ --- NEW FILE: actuator_dlg.cpp --- ///////////////////////////////////////////////////////////////////////////// // Name: actuator_dlg.cpp // Purpose: dialog for FGActuator // Author: Jon Berndt // Created: 04/12/2007 // Copyright: (c) Jon Berndt // Licence: GPL licence // // Functions: // // do_layout // GetDataIn // OnButtonPressCancel // OnButtonPressHelp // OnButtonPressOK // OnCheckboxClip // OnButtonPressCancel // OnButtonPressHelp // OnClickInvertInput // SensorComponentEditor - Constructor // set_properties // SetDataOut // Show // ///////////////////////////////////////////////////////////////////////////// // -*- C++ -*- generated by wxGlade 0.4.1 on Fri Apr 06 07:40:41 2007 #include "actuator_dlg.h" ActuatorComponentEditor::ActuatorComponentEditor(Actuator *actuator, wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxTHICK_FRAME|wxSTAY_ON_TOP|wxFULL_REPAINT_ON_RESIZE) { // begin wxGlade: ActuatorComponentEditor::ActuatorComponentEditor nbk_Properties = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL|wxWS_EX_VALIDATE_RECURSIVELY); notebook_1_pane_1 = new wxPanel(nbk_Properties, -1); sizer_clip_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Clipping")); sizer_actuator_properties_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Actuator Properties")); sizer_inout_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Input / Output")); sizer_basic_staticbox = new wxStaticBox(notebook_1_pane_1, -1, wxT("Basic Properties")); label_name = new wxStaticText(notebook_1_pane_1, -1, wxT("Name:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_Name = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_type = new wxStaticText(notebook_1_pane_1, -1, wxT("Type:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_Type = new wxTextCtrl(notebook_1_pane_1, -1, wxT("Actuator Component"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); label_order = new wxStaticText(notebook_1_pane_1, -1, wxT("Order:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_Order = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); chx_Clip = new wxCheckBox(notebook_1_pane_1, -1, wxT("Clip")); label_clip_min = new wxStaticText(notebook_1_pane_1, -1, wxT("Minimum:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_MinClip = new wxTextCtrl(notebook_1_pane_1, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); label_clip_max = new wxStaticText(notebook_1_pane_1, -1, wxT("Maximum:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); txtEd_MaxClip = new wxTextCtrl(notebook_1_pane_1, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); label_7 = new wxStaticText(notebook_1_pane_1, -1, wxT("Lag")); txtEd_Lag = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_10 = new wxStaticText(notebook_1_pane_1, -1, wxT("Rate limit")); txtEd_RateLimit = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_11 = new wxStaticText(notebook_1_pane_1, -1, wxT("Hysteresis")); txtEd_Hysteresis = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_17 = new wxStaticText(notebook_1_pane_1, -1, wxT("Bias")); txtEd_Bias = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_1 = new wxStaticText(notebook_1_pane_1, -1, wxT("Input Property:")); button_invert_input = new wxToggleButton(notebook_1_pane_1, -1, wxT("+")); txtEd_InputProperty = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); label_output_property = new wxStaticText(notebook_1_pane_1, -1, wxT("Output Property:")); txtEd_OutputProperty = new wxTextCtrl(notebook_1_pane_1, -1, wxT("")); txtEd_Description = new wxTextCtrl(nbk_Properties, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER|wxTE_PROCESS_TAB|wxTE_MULTILINE|wxTE_WORDWRAP); button_OK = new wxButton(this, -1, wxT("OK")); button_Cancel = new wxButton(this, -1, wxT("Cancel")); button_Help = new wxButton(this, -1, wxT("Help")); set_properties(); do_layout(); // end wxGlade GetDataIn(actuator); } BEGIN_EVENT_TABLE(ActuatorComponentEditor, wxDialog) // begin wxGlade: ActuatorComponentEditor::event_table EVT_CHECKBOX(-1, ActuatorComponentEditor::OnCheckboxClip) EVT_TOGGLEBUTTON(-1, ActuatorComponentEditor::OnClickInvertInput) EVT_BUTTON(-1, ActuatorComponentEditor::OnButtonPressOK) EVT_BUTTON(-1, ActuatorComponentEditor::OnButtonPressCancel) EVT_BUTTON(-1, ActuatorComponentEditor::OnButtonPressHelp) // end wxGlade END_EVENT_TABLE(); void ActuatorComponentEditor::OnCheckboxClip(wxCommandEvent &event) { event.Skip(); } void ActuatorComponentEditor::OnClickInvertInput(wxCommandEvent &event) { event.Skip(); } void ActuatorComponentEditor::OnButtonPressOK(wxCommandEvent &event) { if (nbk_Properties->Validate()) nbk_Properties->TransferDataFromWindow(); event.Skip(); } void ActuatorComponentEditor::OnButtonPressCancel(wxCommandEvent &event) { event.Skip(); } void ActuatorComponentEditor::OnButtonPressHelp(wxCommandEvent &event) { event.Skip(); } // wxGlade: add ActuatorComponentEditor event handlers void ActuatorComponentEditor::set_properties() { // begin wxGlade: ActuatorComponentEditor::set_properties SetTitle(wxT("Actuator Component Editor")); txtEd_Name->SetToolTip(wxT("This is the name of the component. It can be a property name, or a human readable name, such as \"Pitch Feedback PID Control\". In the latter case, the name will be converted internally to a property name. In the given example, this will be \"fcs/pitch-feedback-pid-control\".")); txtEd_Name->SetFocus(); txtEd_Type->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_Order->SetToolTip(wxT("This number represents the order in which the component will be \"executed\".")); label_clip_min->SetMinSize(wxSize(60, -1)); txtEd_MinClip->SetMinSize(wxSize(100,-1)); txtEd_MinClip->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_MinClip->SetToolTip(wxT("This is the minimum value allowed for the component output. ")); label_clip_max->SetMinSize(wxSize(60, -1)); txtEd_MaxClip->SetMinSize(wxSize(100,-1)); txtEd_MaxClip->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_MaxClip->SetToolTip(wxT("This is the maximum value allowed for the component output. ")); button_invert_input->SetMinSize(wxSize(21, 21)); button_invert_input->SetToolTip(wxT("Depress this button to invert the input property.")); button_invert_input->Enable(false); txtEd_InputProperty->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_InputProperty->SetToolTip(wxT("This is the input property to the component. This is selected via connecting up the components in the editor.")); txtEd_OutputProperty->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION)); txtEd_OutputProperty->SetToolTip(wxT("This is the output property to the component. This is selected via connecting up the components in the editor.")); button_OK->SetToolTip(wxT("Clicking this button will save the changes made.")); button_Cancel->SetToolTip(wxT("Clicking on the Cancel button will abandon changes made.")); // end wxGlade } void ActuatorComponentEditor::do_layout() { // begin wxGlade: ActuatorComponentEditor::do_layout wxFlexGridSizer* grid_sizer_toplevel = new wxFlexGridSizer(2, 1, 5, 0); wxBoxSizer* sizer_buttons = new wxBoxSizer(wxHORIZONTAL); wxFlexGridSizer* grid_sizer_2 = new wxFlexGridSizer(5, 1, 5, 0); wxStaticBoxSizer* sizer_inout = new wxStaticBoxSizer(sizer_inout_staticbox, wxHORIZONTAL); wxFlexGridSizer* grid_sizer_inout = new wxFlexGridSizer(2, 2, 5, 5); wxFlexGridSizer* grid_sizer_1 = new wxFlexGridSizer(1, 2, 0, 2); wxStaticBoxSizer* sizer_actuator_properties = new wxStaticBoxSizer(sizer_actuator_properties_staticbox, wxVERTICAL); wxGridSizer* grid_sizer_7 = new wxGridSizer(4, 2, 3, 3); wxStaticBoxSizer* sizer_clip = new wxStaticBoxSizer(sizer_clip_staticbox, wxHORIZONTAL); wxFlexGridSizer* grid_sizer_clip = new wxFlexGridSizer(2, 2, 5, 10); wxBoxSizer* sizer_clip_min = new wxBoxSizer(wxHORIZONTAL); wxStaticBoxSizer* sizer_basic = new wxStaticBoxSizer(sizer_basic_staticbox, wxHORIZONTAL); wxFlexGridSizer* grid_sizer_basic_interior = new wxFlexGridSizer(3, 2, 5, 5); grid_sizer_basic_interior->Add(label_name, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(txtEd_Name, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(label_type, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(txtEd_Type, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(label_order, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_basic_interior->Add(txtEd_Order, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxFIXED_MINSIZE, 0); grid_sizer_basic_interior->AddGrowableCol(1); sizer_basic->Add(grid_sizer_basic_interior, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_2->Add(sizer_basic, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_clip->Add(chx_Clip, 0, wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); sizer_clip_min->Add(label_clip_min, 0, wxLEFT|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); sizer_clip_min->Add(txtEd_MinClip, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxFIXED_MINSIZE, 0); sizer_clip_min->Add(label_clip_max, 0, wxLEFT|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); sizer_clip_min->Add(txtEd_MaxClip, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxFIXED_MINSIZE, 0); grid_sizer_clip->Add(sizer_clip_min, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_clip->AddGrowableCol(1); sizer_clip->Add(grid_sizer_clip, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_2->Add(sizer_clip, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_7, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_Lag, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_10, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_RateLimit, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_11, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_Hysteresis, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(label_17, 0, wxADJUST_MINSIZE, 0); grid_sizer_7->Add(txtEd_Bias, 0, wxADJUST_MINSIZE, 0); sizer_actuator_properties->Add(grid_sizer_7, 1, wxEXPAND, 0); grid_sizer_2->Add(sizer_actuator_properties, 1, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_inout->Add(label_1, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_1->Add(button_invert_input, 0, wxADJUST_MINSIZE, 0); grid_sizer_1->Add(txtEd_InputProperty, 0, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_1->AddGrowableCol(1); grid_sizer_inout->Add(grid_sizer_1, 1, wxEXPAND, 0); grid_sizer_inout->Add(label_output_property, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0); grid_sizer_inout->Add(txtEd_OutputProperty, 0, wxEXPAND|wxADJUST_MINSIZE, 0); grid_sizer_inout->AddGrowableCol(1); sizer_inout->Add(grid_sizer_inout, 1, wxEXPAND, 0); grid_sizer_2->Add(sizer_inout, 1, wxEXPAND, 0); notebook_1_pane_1->SetAutoLayout(true); notebook_1_pane_1->SetSizer(grid_sizer_2); grid_sizer_2->Fit(notebook_1_pane_1); grid_sizer_2->SetSizeHints(notebook_1_pane_1); grid_sizer_2->AddGrowableCol(0); nbk_Properties->AddPage(notebook_1_pane_1, wxT("Properties")); nbk_Properties->AddPage(txtEd_Description, wxT("Comments")); grid_sizer_toplevel->Add(nbk_Properties, 1, wxEXPAND, 0); sizer_buttons->Add(button_OK, 0, wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); sizer_buttons->Add(button_Cancel, 0, wxLEFT|wxRIGHT, 5); sizer_buttons->Add(button_Help, 0, wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); grid_sizer_toplevel->Add(sizer_buttons, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5); SetAutoLayout(true); SetSizer(grid_sizer_toplevel); grid_sizer_toplevel->Fit(this); grid_sizer_toplevel->SetSizeHints(this); grid_sizer_toplevel->AddGrowableRow(0); grid_sizer_toplevel->AddGrowableCol(0); Layout(); Centre(); // end wxGlade } /** * Show ========================================================================= */ bool ActuatorComponentEditor::Show( bool show) { bool tmp = wxDialog::Show(show); if (show) nbk_Properties->InitDialog(); return tmp; } /** * GetDataIn ==================================================================== */ void ActuatorComponentEditor::GetDataIn(Sensor * g) { //name = g->GetName(); *txtEd_name << g->GetName(); description = g->GetDescription(); order = wxString::Format(wxT("%ld"), g->GetOrder()); clipable = g->IsClipable(); clip_max = g->GetClipMax(); clip_min = g->GetClipMin(); *txtEd_order << order; if (clipable) { txtEd_MaxClip->Enable(true); txtEd_MaxClip->SetBackgroundColour(*wxWHITE); txtEd_MinClip->Enable(true); txtEd_MinClip->SetBackgroundColour(*wxWHITE); } else { txtEd_MaxClip->Enable(false); txtEd_MaxClip->SetBackgroundColour(wxSYS_COLOUR_INACTIVECAPTION); txtEd_MinClip->Enable(false); txtEd_MinClip->SetBackgroundColour(wxSYS_COLOUR_INACTIVECAPTION); } wxArrayString inputs = g->GetInputNames(); txtEd_OutputProperty->SetValue(g->GetOutputName()); /* if (inputs.GetCount() > 0) { if (inputs[0] != wxT("NULL")) { button_invert_input->Enable(); if (g->GetInputIsInverted()) { button_invert_input->SetValue(true); button_invert_input->SetLabel(wxT("-")); } else { button_invert_input->SetValue(false); button_invert_input->SetLabel(wxT("+")); } } text_ctrl_input_prop->SetValue(inputs[0]); } text_ctrl_1->SetValue(g->GetDescription()); */ } /** * SetDataOut =================================================================== */ void ActuatorComponentEditor::SetDataOut(Sensor * g) { g->SetName(txtEd_Name->GetValue()); long int tmpl; order.ToLong(&tmpl); g->SetOrder(tmpl); g->SetClipable(clipable); double tmpd; g->SetClipMax(clip_max); g->SetClipMin(clip_min); g->SetDescription(text_ctrl_1->GetValue()); g->SetInputIsInverted(false); if (text_ctrl_input_prop->GetValue() != wxT("NULL")) // true if input prop is present if (button_invert_input->GetValue()) // true if inverted g->SetInputIsInverted(true); } |