23 #include "wx/canvas/camcreate.h"
43 EVT_BUTTON( ID_CamCreateOke, a2dCamCreate::OnCamCreateOkeClick )
45 EVT_BUTTON( ID_CamCreateCancel, a2dCamCreate::OnCancel )
56 a2dCamCreate::a2dCamCreate()
64 Create(parent, habitat,
id, caption, pos, size, style);
72 bool a2dCamCreate::Create( wxWindow* parent,
a2dHabitat* habitat, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
76 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
77 wxDialog::Create( parent,
id, caption, pos, size, style );
82 GetSizer()->SetSizeHints(
this);
114 m_instanceSymbol = NULL;
115 m_instanceDiagram = NULL;
134 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
135 itemDialog1->SetSizer(itemBoxSizer2);
137 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
138 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
140 wxStaticText* itemStaticText4 =
new wxStaticText( itemDialog1, ID__CamNameText, _(
"Cameleon Name:"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
141 itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
143 m_camName =
new wxTextCtrl( itemDialog1, ID_CamName, _T(
""), wxDefaultPosition, wxDefaultSize, 0 );
144 m_camName->SetHelpText(_(
"Name of the a2dCameleon to create"));
146 m_camName->SetToolTip(_(
"Name of the a2dCameleon to create"));
147 m_camName->SetName(_T(
"a2dCameleon"));
148 itemBoxSizer3->Add(m_camName, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
150 wxBoxSizer* itemBoxSizer6 =
new wxBoxSizer(wxHORIZONTAL);
151 itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_LEFT|wxALL, 5);
153 wxStaticText* itemStaticText7 =
new wxStaticText( itemDialog1, ID_NrPortsText, _(
"Number of ports:"), wxDefaultPosition, wxDefaultSize, 0 );
154 itemStaticText7->SetHelpText(_(
"Number of port to create on symbol (can be modified later on)\nWhen not 0, a symbol will be automatically created. This the user can modify.\n"));
156 itemStaticText7->SetToolTip(_(
"Number of port to create on symbol (can be modified laterb on)"));
157 itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
159 m_NrPorts =
new wxSpinCtrl( itemDialog1, ID_NrPorts, _T(
"0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
160 m_NrPorts->SetHelpText(_(
"The number of ports to generate on symbol, can be modified later on"));
162 m_NrPorts->SetToolTip(_(
"The number of ports to generate on symbol, can be modified later on"));
163 itemBoxSizer6->Add(m_NrPorts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
165 m_symbol =
new wxCheckBox( itemDialog1, ID_InstSymbol, _(
"Symbol"), wxDefaultPosition, wxDefaultSize, 0 );
166 m_symbol->SetValue(
true);
167 m_symbol->SetHelpText(_(
"Create a symbol appearance"));
169 m_symbol->SetToolTip(_(
"Create a symbol"));
170 m_symbol->SetName(_T(
"symbol"));
171 itemBoxSizer2->Add(m_symbol, 0, wxALIGN_LEFT|wxALL, 5);
173 m_diagram =
new wxCheckBox( itemDialog1, ID__InstDiagram, _(
"Diagram"), wxDefaultPosition, wxDefaultSize, 0 );
174 m_diagram->SetValue(
true);
175 m_diagram->SetHelpText(_(
"Create a diagram appearance"));
177 m_diagram->SetToolTip(_(
"Create a diagram"));
178 m_diagram->SetName(_T(
"diagram"));
179 itemBoxSizer2->Add(m_diagram, 0, wxALIGN_LEFT|wxALL, 5);
181 m_gui =
new wxCheckBox( itemDialog1, ID_InstGui, _(
"Graphical Interface"), wxDefaultPosition, wxDefaultSize, 0 );
182 m_gui->SetValue(
false);
183 m_gui->SetHelpText(_(
"Create a GUI Apperance"));
185 m_gui->SetToolTip(_(
"Create a GUI"));
186 m_gui->SetName(_T(
"gui"));
187 itemBoxSizer2->Add(m_gui, 0, wxALIGN_LEFT|wxALL, 5);
189 wxStaticBox* itemStaticBoxSizer12Static =
new wxStaticBox(itemDialog1, wxID_ANY, _(
"Instanciation"));
190 wxStaticBoxSizer* itemStaticBoxSizer12 =
new wxStaticBoxSizer(itemStaticBoxSizer12Static, wxHORIZONTAL);
191 itemBoxSizer2->Add(itemStaticBoxSizer12, 0, wxALIGN_LEFT|wxALL, 5);
193 m_instanceSymbol =
new wxRadioButton( itemDialog1, ID_RADIOBUTTON, _(
"Instanciate Symbol"), wxDefaultPosition, wxDefaultSize, 0 );
194 m_instanceSymbol->SetValue(
true);
195 m_instanceSymbol->SetHelpText(_(
"Create an instance of the new a2dCameleon in current view, using the symbol"));
197 m_instanceSymbol->SetToolTip(_(
"Create an instance of the new a2dCameleon in current view, using the symbol"));
198 itemStaticBoxSizer12->Add(m_instanceSymbol, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
200 m_instanceDiagram =
new wxRadioButton( itemDialog1, ID_RADIOBUTTON1, _(
"Instanciate Diagram"), wxDefaultPosition, wxDefaultSize, 0 );
201 m_instanceDiagram->SetValue(
false);
202 m_instanceDiagram->SetHelpText(_(
"Create an instance of the new a2dCameleon in current view, using the Diagram"));
204 m_instanceDiagram->SetToolTip(_(
"Create an instance of the new a2dCameleon in current view, using the Diagram"));
205 itemStaticBoxSizer12->Add(m_instanceDiagram, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
207 m_noInst =
new wxRadioButton( itemDialog1, ID_RADIOBUTTON2, _(
"No instance"), wxDefaultPosition, wxDefaultSize, 0 );
208 m_noInst->SetValue(
false);
209 m_noInst->SetHelpText(_(
"No instance will be added"));
211 m_noInst->SetToolTip(_(
"No instance will be added"));
212 itemStaticBoxSizer12->Add(m_noInst, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
214 wxBoxSizer* itemBoxSizer16 =
new wxBoxSizer(wxHORIZONTAL);
215 itemBoxSizer2->Add(itemBoxSizer16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
217 m_oke =
new wxButton( itemDialog1, ID_CamCreateOke, _(
"Oke"), wxDefaultPosition, wxDefaultSize, 0 );
219 m_oke->SetName(_T(
"Oke"));
220 itemBoxSizer16->Add(m_oke, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
222 m_cancel =
new wxButton( itemDialog1, ID_CamCreateCancel, _(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
223 m_cancel->SetName(_T(
"Cancel"));
224 itemBoxSizer16->Add(m_cancel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
272 wxString name = m_camName->GetValue();
273 if ( ! name.IsEmpty() )
280 if ( m_symbol->GetValue() )
283 cam->AddAppearance( diagram );
284 int nrports = m_NrPorts->GetValue();
287 a2dRect* r =
new a2dRect( 0, 0, 30*grid, ( nrports + 2 ) * grid*3 );
289 diagram->AppendToDrawing( r );
291 for (
int i = 0 ; i < nrports; i ++ )
293 wxString strNr = wxString::Format(
"%s_%d", name, i);
297 diagram->AppendToDrawing( p );
303 a2dText* text =
new a2dText(
"No contents yet, draw a symbol wih port here", 0, 0, a2dCanvasModule::GetFontMedBold() );
305 diagram->AppendToDrawing( text );
308 if ( m_diagram->GetValue() )
312 a2dText* text =
new a2dText(
"No contents yet, draw a diagram with port", 0, 0, a2dCanvasModule::GetFontMedBold() );
314 cam->AddAppearance( diagram );
328 EndModal( wxID_CANCEL );
double GetObjectGridSize()
used for objects which depend in size on this grid
void SetGeneratePins(bool value)
set the GeneratePins flag
~a2dCamCreate()
Destructor.
diagram is an appearance for a2dCameleon
void OnCamCreateOkeClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CamCreateOke
Port to be used in a diagram for connecting to symbol.
static bool ShowToolTips()
Should we show tooltips?
object to show several appearance views on what it contains
void AddToRoot(bool autoPlace=true)
add this to ms_centralCameleonRoot at a suitable position
void Init()
Initialises member variables.
a2dText is an abstract base class.
void SetStrokeColour(const wxColour &colour)
set first colour of stroke
void Translate(double x, double y)
relative translate the object to position x,y in world coordinates
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
Symbolic appearance for a2dCameleon.
defines common settinsg for a habitat for a set of a2dCameleons.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
special a2dCanvasObject to make a multi view hierachy.
bool Create(wxWindow *parent, a2dHabitat *habitat=NULL, wxWindowID id=SYMBOL_A2DCAMCREATE_IDNAME, const wxString &caption=SYMBOL_A2DCAMCREATE_TITLE, const wxPoint &pos=SYMBOL_A2DCAMCREATE_POSITION, const wxSize &size=SYMBOL_A2DCAMCREATE_SIZE, long style=SYMBOL_A2DCAMCREATE_STYLE)
Creation.
static a2dPinClass * Standard
Pins of this class can only connect to pins of the same class.
void OnCancel(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CamCreateCancel
void CreateControls()
Creates the controls and sizers.
void Rotate(double rotation)
Rotates this object clockwise.
a2dCamCreate()
Constructors.