return;
}
+ //=====================================================================
+ /// test if the type is a date
+ bool AttributeDescriptor::isDateEntry() const
+ {
+
+ bool btest = false;
+ // Retrieve the name from gdcm dict
+ GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(GetGroup(),GetElement());
+ if( entry != 0)
+ {
+ if( entry->GetVR().str() == "DA" )
+ {
+ btest = true;
+ }
+ }
+ return btest;
+ }
+
+ //=====================================================================
+ /// test if the type is a time
+ bool AttributeDescriptor::isTimeEntry() const
+ {
+
+ bool btest = false;
+ // Retrieve the name from gdcm dict
+ GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(GetGroup(),GetElement());
+ if( entry != 0)
+ {
+ if( entry->GetVR().str() == "TM" )
+ {
+ btest = true;
+ }
+ }
+ return btest;
+ }
+
+
//=====================================================================
/// Decodes the type of the attribute
void AttributeDescriptor::DecodeType(unsigned int& typ) const
/// Destructor
WxGimmickView::~WxGimmickView()
{
+ // stop the viewer before application exit.
+ mViewer->StopPlayer();
GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView"
<<std::endl);
}
{
bool recurse = false;
+
if (wxMessageBox(_T("Recurse into sub-directories ?"),
_T("Scan directory"),
wxYES_NO,this ) == wxYES)
{
char mess[200];
- sprintf(mess,"%i dirs - %i files - %i handled - %i added",
+
+ sprintf(mess,"%i dirs : %i files :\n %i handled - %i added",
p.GetNumberScannedDirs(),
p.GetNumberScannedFiles(),
p.GetNumberHandledFiles(),
#include <creaImageIOSystem.h>
#include <wx/splitter.h>
#include <wx/gdicmn.h>
+#include <boost/date_time/gregorian/gregorian.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/local_time_adjustor.hpp>
+#include <boost/date_time/c_local_time_adjustor.hpp>
+
+
+
const std::string empty_string("");
int col_style = wxLIST_FORMAT_LEFT;
// Creating the ListCtrl for the levels > 0 (not for Root level)
- for (int i = 1;
- i < handler->GetTree().GetNumberOfLevels();
+ for (int i = 0;
+ i < handler->GetTree().GetNumberOfLevels() -1;
++i)
{
// If the first level : parent = this
wxWindow* sparent = this;
// else parent = last splitter
- if (i>1) sparent = mLevelList[i-2].wxSplitter;
+ if (i>0)
+ sparent = mLevelList[i-1].wxSplitter;
level.wxSplitter = new wxSplitterWindow( sparent , -1);
- if(i!=1)
+ if(i!=0)
{
level.wxSplitter->Show(false);
}
int col = 0;
std::string title;
tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
- for (a = handler->GetTree().GetAttributeDescriptorList(i).begin();
- a != handler->GetTree().GetAttributeDescriptorList(i).end();
+ for (a = handler->GetTree().GetAttributeDescriptorList(i+1).begin();
+ a != handler->GetTree().GetAttributeDescriptorList(i+1).end();
++a)
- {
+
+{
GimmickDebugMessage(5,"Creating column "<<col<<" : "
<<a->GetName()
{
title=a->GetName();
}
-
+ std::string temp = a->GetKey();
+ if (temp.compare("ID") != 0)
+ {
ctrl->InsertColumn(col,
crea::std2wx(title),
col_style);
+ col++;
+ }
level.key.push_back(a->GetKey());
// ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE );
- col++;
+
}
}
for (int k=0; k<GetCtrl(l)->GetColumnCount(); k++)
{
- std::string val = (*j)->GetAttribute(mLevelList[l].key[k]);
- if (val.size()==0) val = "?";
- item.SetText( crea::std2wx(val));
- item.SetColumn(k);
- GetCtrl(l)->SetItem(item);
+ std::string val = (*j)->GetAttribute(mLevelList[l].key[k]);
+ if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isDateEntry())
+ {
+ boost::gregorian::date d1(boost::gregorian::from_undelimited_string(val));
+ val = to_iso_extended_string(d1);
+ }
+ else if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isTimeEntry())
+ {
+ if (val != "" || val != " ")
+ val = val.substr(0,2) + " : " + val.substr(2,2) + " : " + val.substr(4,2);
+ }
+ else
+ {
+
+ }
+ if (val.size()==0) val = "?";
+ item.SetText( crea::std2wx(val));
+ item.SetColumn(k);
+ GetCtrl(l)->SetItem(item);
}
}
}
}
+ }
+ //================================================================
+ //=================================================
+ void WxTreeView::OnKeyDown(wxListEvent &event)
+ {
+ if(event.GetKeyCode() == WXK_DELETE)
+ {
+ RemoveSelected();
+ // ClearSelection();
+ }
+
}
//================================================================
EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
#endif
*/
+ EVT_LIST_KEY_DOWN(-1, WxTreeView::OnKeyDown)
EVT_LIST_ITEM_SELECTED(-1, WxTreeView::OnItemSelected)
EVT_LIST_ITEM_DESELECTED(-1, WxTreeView::OnItemDeSelected)