5 #include <FXInputDialog.h> 19 ARRAYNUMBER(SensorDialogMap))
23 : FXDialogBox (a, "
Sensor Editor",DECOR_TITLE|DECOR_BORDER,0,0,400,0),
24 m_Sensors(sc), m_SList(
NULL), m_ImgWin(iw), m_PGeomMutex(NULL)
26 FXHorizontalFrame* contents=
new FXHorizontalFrame(
27 this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
28 m_SList =
new FXListBox(contents,
this, ID_SENSSEL,
29 LISTBOX_NORMAL|LAYOUT_FILL_X);
30 m_SList->setNumVisible(5);
31 m_SList->setWidth(400);
32 new FXButton(contents,
"&Edit",NULL,
this, ID_SENSEDIT);
33 new FXButton(contents,
"&Hide",NULL,
this, ID_HIDE);
39 if(m_SList) {
delete m_SList; m_SList =
NULL; }
44 if(sel == MKUINT(ID_SENSSEL,SEL_COMMAND)) {
46 vuLock(m_PGeomMutex ? *m_PGeomMutex : blah);
47 if(m_ImgWin) m_ImgWin->selectSensor(getSelectedSensor());
49 FXInputDialog inpd(
this,
"Edit Sensor",
"Sensor string");
50 inpd.setText(m_SList->getItem(m_SList->getCurrentItem()));
53 vuLock(m_PGeomMutex ? *m_PGeomMutex : blah);
55 ss << inpd.getText().text();
59 sensor = m_Sensors.addSensor(sensor);
60 m_Sensors.updateModels();
74 m_SList->clearItems();
76 for(SensorCollection::const_iterator s=m_Sensors.begin();
77 s!=m_Sensors.end();s++,sid++)
79 if(s->second->getID() !=
"0" &&
80 s->second->getID() !=
"d0" &&
81 !s->second->getID().empty())
85 m_SList->appendItem(ss.str().c_str());
87 m_SIndices.push_back(sid);
90 m_SList->appendItem(
"# new sensor #");
91 m_SIndices.push_back(sid);
92 m_SList->setNumVisible(m_SList->getNumItems());
97 return shown() ? m_SIndices[m_SList->getCurrentItem()] : -1;
std::shared_ptr< Sensor > sensor_ptr
FXIMPLEMENT(SensorDialog, FXDialogBox, SensorDialogMap, ARRAYNUMBER(SensorDialogMap)) SensorDialog
int getSelectedSensor() const
long onEdit(FXObject *, FXSelector, void *ptr)
FXDEFMAP(SensorDialog) SensorDialogMap[]