[Rojav-commits] rocgui/dialogs trackdialog.cpp,NONE,1.1 trackdialog.h,NONE,1.1
Brought to you by:
robvrs
|
From: rob v. <ro...@us...> - 2005-11-28 17:07:12
|
Update of /cvsroot/rojav/rocgui/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28096 Added Files: trackdialog.cpp trackdialog.h Log Message: --- NEW FILE: trackdialog.h --- /** ------------------------------------------------------------ * Module: * Object: * ------------------------------------------------------------ * $Source: /cvsroot/rojav/rocgui/dialogs/trackdialog.h,v $ * $Author: robvrs $ * $Date: 2005/11/28 17:06:57 $ * $Revision: 1.1 $ * $Name: $ */ #ifndef _TRACKDIALOG_H_ #define _TRACKDIALOG_H_ #if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "trackdialog.cpp" #endif /*! * Includes */ ////@begin includes #include "wx/notebook.h" ////@end includes #include "rocs/public/node.h" /*! * Forward declarations */ ////@begin forward declarations class wxNotebook; ////@end forward declarations /*! * Control identifiers */ ////@begin control identifiers #define ID_DIALOG 10124 #define SYMBOL_TRACKDIALOG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX #define SYMBOL_TRACKDIALOG_TITLE _("Dialog") #define SYMBOL_TRACKDIALOG_IDNAME ID_DIALOG #define SYMBOL_TRACKDIALOG_SIZE wxSize(400, 300) #define SYMBOL_TRACKDIALOG_POSITION wxDefaultPosition #define ID_NOTEBOOK_TRACK 10125 #define ID_PANEL_TK_GENERAL 10000 #define wxID_STATIC_SW_ID 10001 #define ID_TEXTCTRL_TK_ID 10002 #define wxID_STATIC_TK_TYPE 10007 #define ID_COMBOBOX_TK_TYPE 10008 #define ID_PANEL_TK_LOCATION 10009 #define wxID_STATIC_TK_X 10010 #define ID_TEXTCTRL_TK_X 10011 #define wxID_STATIC_TK_Y 10012 #define ID_TEXTCTRL_TK_Y 10013 #define wxID_STATIC_TK_Z 10014 #define ID_TEXTCTRL_TK_Z 10015 #define ID_RADIOBOX_TK_ORI 10016 ////@end control identifiers /*! * Compatibility */ #ifndef wxCLOSE_BOX #define wxCLOSE_BOX 0x1000 #endif #ifndef wxFIXED_MINSIZE #define wxFIXED_MINSIZE 0 #endif /*! * TrackDialog class declaration */ class TrackDialog: public wxDialog { DECLARE_DYNAMIC_CLASS( TrackDialog ) DECLARE_EVENT_TABLE() void initValues(); void evaluate(); public: /// Constructors TrackDialog( ); TrackDialog( wxWindow* parent, iONode p_Props ); /// Creation bool Create( wxWindow* parent, wxWindowID id = SYMBOL_TRACKDIALOG_IDNAME, const wxString& caption = SYMBOL_TRACKDIALOG_TITLE, const wxPoint& pos = SYMBOL_TRACKDIALOG_POSITION, const wxSize& size = SYMBOL_TRACKDIALOG_SIZE, long style = SYMBOL_TRACKDIALOG_STYLE ); /// Creates the controls and sizers void CreateControls(); ////@begin TrackDialog event handler declarations /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK void OnOkClick( wxCommandEvent& event ); /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL void OnCancelClick( wxCommandEvent& event ); ////@end TrackDialog event handler declarations ////@begin TrackDialog member function declarations iONode GetProps() const { return m_Props ; } void SetProps(iONode value) { m_Props = value ; } /// Retrieves bitmap resources wxBitmap GetBitmapResource( const wxString& name ); /// Retrieves icon resources wxIcon GetIconResource( const wxString& name ); ////@end TrackDialog member function declarations /// Should we show tooltips? static bool ShowToolTips(); ////@begin TrackDialog member variables wxNotebook* m_Notebook; wxPanel* m_GeneralPanel; wxStaticText* m_LabelID; wxTextCtrl* m_ID; wxStaticText* m_LabelType; wxComboBox* m_Type; wxPanel* m_LocationPanel; wxStaticText* m_LabelX; wxTextCtrl* m_x; wxStaticText* m_LabelY; wxTextCtrl* m_y; wxStaticText* m_LabelZ; wxTextCtrl* m_z; wxRadioBox* m_ori; wxButton* m_OK; wxButton* m_Cancel; iONode m_Props; ////@end TrackDialog member variables }; #endif // _TRACKDIALOG_H_ --- NEW FILE: trackdialog.cpp --- /** ------------------------------------------------------------ * Module: * Object: * ------------------------------------------------------------ * $Source: /cvsroot/rojav/rocgui/dialogs/trackdialog.cpp,v $ * $Author: robvrs $ * $Date: 2005/11/28 17:06:57 $ * $Revision: 1.1 $ * $Name: $ */ #if defined(__GNUG__) && !defined(__APPLE__) #pragma implementation "trackdialog.cpp" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif ////@begin includes ////@end includes #include "trackdialog.h" #include "rocrail/wrapper/public/Track.h" #include "rocrail/wrapper/public/Item.h" #include "rocrail/wrapper/public/Plan.h" #include "rocgui/public/guiapp.h" ////@begin XPM images ////@end XPM images /*! * TrackDialog type definition */ IMPLEMENT_DYNAMIC_CLASS( TrackDialog, wxDialog ) /*! * TrackDialog event table definition */ BEGIN_EVENT_TABLE( TrackDialog, wxDialog ) ////@begin TrackDialog event table entries EVT_BUTTON( wxID_OK, TrackDialog::OnOkClick ) EVT_BUTTON( wxID_CANCEL, TrackDialog::OnCancelClick ) ////@end TrackDialog event table entries END_EVENT_TABLE() /*! * TrackDialog constructors */ TrackDialog::TrackDialog( ) { } TrackDialog::TrackDialog( wxWindow* parent, iONode l_Props ) { Create(parent, -1, "TrackDialog"); m_Props = l_Props; initValues(); } void TrackDialog::initValues() { // General m_ID->SetValue( wTrack.getid( m_Props ) ); m_Type->Append( wTrack.straight ); m_Type->Append( wTrack.curve ); m_Type->SetStringSelection( wTrack.gettype( m_Props ) ); // Location char* str = StrOp.fmt( "%d", wTrack.getx( m_Props ) ); m_x->SetValue( str ); StrOp.free( str ); str = StrOp.fmt( "%d", wTrack.gety( m_Props ) ); m_y->SetValue( str ); StrOp.free( str ); str = StrOp.fmt( "%d", wTrack.getz( m_Props ) ); m_z->SetValue( str ); StrOp.free( str ); if( StrOp.equals( wItem.north, wTrack.getori( m_Props ) ) ) m_ori->SetSelection( 0 ); else if( StrOp.equals( wItem.east, wTrack.getori( m_Props ) ) || wTrack.getori( m_Props ) == NULL ) m_ori->SetSelection( 1 ); else if( StrOp.equals( wItem.south, wTrack.getori( m_Props ) ) ) m_ori->SetSelection( 2 ); else if( StrOp.equals( wItem.west, wTrack.getori( m_Props ) ) ) m_ori->SetSelection( 3 ); } void TrackDialog::evaluate() { // General wTrack.setid( m_Props, m_ID->GetValue() ); wTrack.settype( m_Props, m_Type->GetStringSelection() ); // Location wTrack.setx( m_Props, atoi( m_x->GetValue() ) ); wTrack.sety( m_Props, atoi( m_y->GetValue() ) ); wTrack.setz( m_Props, atoi( m_z->GetValue() ) ); int ori = m_ori->GetSelection(); if( ori == 0 ) wTrack.setori( m_Props, wItem.north ); else if( ori == 1 ) wTrack.setori( m_Props, wItem.east ); else if( ori == 2 ) wTrack.setori( m_Props, wItem.south ); else if( ori == 3 ) wTrack.setori( m_Props, wItem.west ); } /*! * MyDialog creator */ bool TrackDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { ////@begin TrackDialog member initialisation m_Props = NULL; m_Notebook = NULL; m_GeneralPanel = NULL; m_LabelID = NULL; m_ID = NULL; m_LabelType = NULL; m_Type = NULL; m_LocationPanel = NULL; m_LabelX = NULL; m_x = NULL; m_LabelY = NULL; m_y = NULL; m_LabelZ = NULL; m_z = NULL; m_ori = NULL; m_OK = NULL; m_Cancel = NULL; ////@end TrackDialog member initialisation ////@begin TrackDialog creation SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); Centre(); ////@end TrackDialog creation return true; } /*! * Control creation for MyDialog */ void TrackDialog::CreateControls() { ////@begin TrackDialog content construction TrackDialog* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(itemBoxSizer2); m_Notebook = new wxNotebook( itemDialog1, ID_NOTEBOOK_TRACK, wxDefaultPosition, wxDefaultSize, wxNB_TOP ); m_GeneralPanel = new wxPanel( m_Notebook, ID_PANEL_TK_GENERAL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); wxFlexGridSizer* itemFlexGridSizer5 = new wxFlexGridSizer(2, 2, 0, 0); itemFlexGridSizer5->AddGrowableCol(1); m_GeneralPanel->SetSizer(itemFlexGridSizer5); m_LabelID = new wxStaticText( m_GeneralPanel, wxID_STATIC_SW_ID, _("id"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer5->Add(m_LabelID, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); m_ID = new wxTextCtrl( m_GeneralPanel, ID_TEXTCTRL_TK_ID, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer5->Add(m_ID, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); m_LabelType = new wxStaticText( m_GeneralPanel, wxID_STATIC_TK_TYPE, _("type"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer5->Add(m_LabelType, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxString* m_TypeStrings = NULL; m_Type = new wxComboBox( m_GeneralPanel, ID_COMBOBOX_TK_TYPE, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_TypeStrings, wxCB_DROPDOWN ); itemFlexGridSizer5->Add(m_Type, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); m_Notebook->AddPage(m_GeneralPanel, _("General")); m_LocationPanel = new wxPanel( m_Notebook, ID_PANEL_TK_LOCATION, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL); m_LocationPanel->SetSizer(itemBoxSizer11); wxFlexGridSizer* itemFlexGridSizer12 = new wxFlexGridSizer(2, 2, 0, 0); itemBoxSizer11->Add(itemFlexGridSizer12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_LabelX = new wxStaticText( m_LocationPanel, wxID_STATIC_TK_X, _("x"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer12->Add(m_LabelX, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); m_x = new wxTextCtrl( m_LocationPanel, ID_TEXTCTRL_TK_X, _("0"), wxDefaultPosition, wxDefaultSize, wxTE_CENTRE ); itemFlexGridSizer12->Add(m_x, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); m_LabelY = new wxStaticText( m_LocationPanel, wxID_STATIC_TK_Y, _("y"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer12->Add(m_LabelY, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); m_y = new wxTextCtrl( m_LocationPanel, ID_TEXTCTRL_TK_Y, _("0"), wxDefaultPosition, wxDefaultSize, wxTE_CENTRE ); itemFlexGridSizer12->Add(m_y, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); m_LabelZ = new wxStaticText( m_LocationPanel, wxID_STATIC_TK_Z, _("z"), wxDefaultPosition, wxDefaultSize, 0 ); itemFlexGridSizer12->Add(m_LabelZ, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); m_z = new wxTextCtrl( m_LocationPanel, ID_TEXTCTRL_TK_Z, _("0"), wxDefaultPosition, wxDefaultSize, wxTE_CENTRE ); itemFlexGridSizer12->Add(m_z, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); wxString m_oriStrings[] = { _("&north"), _("&east"), _("&south"), _("&west") }; m_ori = new wxRadioBox( m_LocationPanel, ID_RADIOBOX_TK_ORI, _("Orientation"), wxDefaultPosition, wxDefaultSize, 4, m_oriStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer11->Add(m_ori, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_Notebook->AddPage(m_LocationPanel, _("Location")); itemBoxSizer2->Add(m_Notebook, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStdDialogButtonSizer* itemStdDialogButtonSizerProxy20 = new wxStdDialogButtonSizer; itemBoxSizer2->Add(itemStdDialogButtonSizerProxy20, 0, wxGROW|wxALL, 5); m_OK = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemStdDialogButtonSizerProxy20->AddButton(m_OK); m_Cancel = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemStdDialogButtonSizerProxy20->AddButton(m_Cancel); itemStdDialogButtonSizerProxy20->Realize(); ////@end TrackDialog content construction } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK */ void TrackDialog::OnOkClick( wxCommandEvent& event ) { evaluate(); EndModal( wxID_OK ); } /*! * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL */ void TrackDialog::OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_OK ); } /*! * Should we show tooltips? */ bool TrackDialog::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap TrackDialog::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin TrackDialog bitmap retrieval wxUnusedVar(name); return wxNullBitmap; ////@end TrackDialog bitmap retrieval } /*! * Get icon resources */ wxIcon TrackDialog::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin TrackDialog icon retrieval wxUnusedVar(name); return wxNullIcon; ////@end TrackDialog icon retrieval } |