90 const bool drawInfoRow =
95 if (
type_ == _T(
"FU:")) {
97 if (
info_.StartsWith(_T(
"{ AS:"))) {
98 dc->SetBrush(wxBrush(wxColour(170,255,170),wxSOLID));
100 dc->SetBrush(wxBrush(wxColour(205,205,255),wxSOLID));
103 if (
info_.StartsWith(_T(
"{ AS:"))) {
104 dc->SetBrush(wxBrush(wxColour((53+
highlight_.Red()*2)/3,
109 dc->SetBrush(wxBrush(wxColour((68+
highlight_.Red()*2)/3,
115 dc->DrawRoundedRectangle(
118 }
else if (
type_ == _T(
"GCU:")) {
119 dc->SetBrush(wxBrush(wxColour(250,145,255), wxSOLID));
120 dc->DrawRoundedRectangle(
123 }
else if (
type_ == _T(
"IMM:")) {
124 dc->SetBrush(wxBrush(wxColour(255,168,140),wxSOLID));
126 points[0] = wxPoint(
size_.GetWidth()/2-10,
size_.GetHeight());
127 points[1] = wxPoint(
size_.GetWidth()/2+10,
size_.GetHeight());
128 points[2] = wxPoint(
size_.GetWidth(),0);
129 points[3] = wxPoint(0,0);
135 dc->SetBrush(wxBrush(wxColour(240,230,150),wxSOLID));
141 dc->SetBackgroundMode(wxTRANSPARENT);
147 dc->GetTextExtent(
type_, &typeWidth, &typeHeight);
152 dc->DrawText(
type_, typeX, typeY);
158 wxFont oldFont = dc->GetFont();
162 dc->SetFont(wxFont(16, wxDEFAULT, wxNORMAL, wxNORMAL));
164 dc->GetTextExtent(
name_, &nameWidth, &nameHeight);
168 dc->DrawText(
name_, nameX, nameY);
171 dc->SetFont(oldFont);
179 dc->GetTextExtent(
info_, &infoWidth, &infoHeight);
186 dc->DrawText(
info_, infoX, infoY);
201 map<std::string, Figure*> inputPorts;
202 map<std::string, Figure*> outputPorts;
203 map<std::string, Figure*> bidirPorts;
204 map<std::string, Figure*> trigPorts;
205 map<std::string, Figure*> nodirPorts;
207 vector<Figure*>::iterator i =
children_.begin();
213 for (
int j = 0; j < (fig->
childCount()); j++) {
222 trigPorts[fig->
name()] = fig;
223 }
else if (input && output) {
224 bidirPorts[fig->
name()] = fig;
226 inputPorts[fig->
name()] = fig;
228 outputPorts[fig->
name()] = fig;
230 nodirPorts[fig->
name()] = fig;
243 map<std::string, Figure*>::iterator inIter = inputPorts.begin();
244 for (; inIter != inputPorts.end(); inIter++) {
245 portY -= (*inIter).second->bounds().GetHeight()/2;
246 (*inIter).second->setLocation(wxPoint(portX, portY));
247 (*inIter).second->layout(dc);
249 portX += (*inIter).second->bounds().GetWidth() +
254 map<std::string, Figure*>::iterator trigIter = trigPorts.begin();
255 for (; trigIter != trigPorts.end(); trigIter++) {
256 portY -= (*trigIter).second->bounds().GetHeight()/2;
257 (*trigIter).second->setLocation(wxPoint(portX, portY));
258 (*trigIter).second->layout(dc);
260 portX += (*trigIter).second->bounds().GetWidth() +
265 map<std::string, Figure*>::iterator bdIter = bidirPorts.begin();
266 for (; bdIter != bidirPorts.end(); bdIter++) {
267 portY -= (*bdIter).second->bounds().GetHeight()/2;
268 (*bdIter).second->setLocation(wxPoint(portX, portY));
269 (*bdIter).second->layout(dc);
271 portX += (*bdIter).second->bounds().GetWidth() +
276 map<std::string, Figure*>::iterator outIter = outputPorts.begin();
277 for (; outIter != outputPorts.end(); outIter++) {
278 portY -= (*outIter).second->bounds().GetHeight()/2;
279 (*outIter).second->setLocation(wxPoint(portX, portY));
280 (*outIter).second->layout(dc);
282 portX += (*outIter).second->bounds().GetWidth() +
287 map<std::string, Figure*>::iterator ndIter = nodirPorts.begin();
288 for (; ndIter != nodirPorts.end(); ndIter++) {
289 portY -= (*ndIter).second->bounds().GetHeight()/2;
290 (*ndIter).second->setLocation(wxPoint(portX, portY));
291 (*ndIter).second->layout(dc);
293 portX += (*ndIter).second->bounds().GetWidth() +
305 int index = name.Find(
':');
310 type_ = name.Mid(0, index + 1);
312 name_ = name.Mid(index + 2);
357 vector<Figure*>::const_iterator i =
children_.begin();
359 portsWidth += (*i)->bounds().GetWidth();
372 dc->GetTextExtent(
name_, &nameWidth, &nameHeight);
373 dc->GetTextExtent(
type_, &typeWidth, &typeHeight);
375 dc->GetTextExtent(
info_, &infoWidth, &infoHeight);
383 if (portsWidth > maxWidth) {
384 maxWidth = portsWidth;
387 if ((nameWidth + 2 *
MARGIN) > maxWidth) {
389 unsigned int chars = 0;
392 while ((charsExtent + 2 *
MARGIN) < maxWidth) {
395 dc->GetTextExtent(
name_.GetChar(chars), &charWidth, &charHeight);
396 charsExtent += charWidth;
398 if (chars >
name_.Len()) {
403 name_.Truncate(chars - 5);
404 name_.Append(_T(
"..."));
405 dc->GetTextExtent(
name_, &nameWidth, &nameHeight);
409 if (showInfo && (infoWidth + 2 *
MARGIN) > maxWidth) {
411 unsigned int chars = 0;
414 while ((charsExtent + 2 *
MARGIN) < maxWidth) {
417 dc->GetTextExtent(
info_.GetChar(chars), &charWidth, &charHeight);
418 charsExtent += charWidth;
420 if (chars >
info_.Len()) {
425 info_.Truncate(chars - 5);
426 info_.Append(_T(
"..."));
427 dc->GetTextExtent(
info_, &infoWidth, &infoHeight);
431 if (infoWidth >
size_.GetWidth() &&
432 infoWidth >= nameWidth && infoWidth > portsWidth) {
434 size_.SetWidth(infoWidth);
436 }
else if (nameWidth >
size_.GetWidth() &&
437 nameWidth > infoWidth && nameWidth > portsWidth) {
439 size_.SetWidth(nameWidth);
441 }
else if (portsWidth >
size_.GetWidth()) {
442 size_.SetWidth(portsWidth);
450 height += typeHeight +
SPACING + infoHeight;
452 if (height >
minSize_.GetHeight()) {
453 size_.SetHeight(height);