#include <creaImageIOGimmickView.h>
#include <creaImageIOSystem.h>
#include <wx/splitter.h>
+#include <wx/gdicmn.h>
///Comparing function for ordering algorithm. Takes parameters as strings.
int wxCALLBACK CompareFunctionStrings(long item1, long item2, long sortData)
{
mColumnSelected=1;
mLastSelected=0;
mDirection=true;
+ mSelectionMade=false;
+ CreateColorPalette();
UpdateLevel(1);
SetSizer( sizer );
<<"'"<<level
<<std::endl);
int _id=0;
- int r=100;
- int g=100;
- int b=100;
+ int colorId=0;
//Adds columns
GetTreeHandler()->LoadChildren(*i,1);
tree::Node::ChildrenListType::reverse_iterator j;
// item.SetTextColour(*wxRED);
//Setting the color according to the parent
- /*
if(l==0)
{
- item.SetBackgroundColour(wxColour(r,g,b));
- mColorMap.insert(NodeColorPair(*j,wxColour(r,g,b)));
+ item.SetBackgroundColour(wxColourDatabase().Find(mColorPalette[colorId]));
+ mColorMap.insert(NodeColorPair(*j,wxColourDatabase().Find(mColorPalette[colorId])));
+ if(colorId<64)
+ {
+ colorId++;
+ }
+ else
+ {
+ colorId=0;
+ }
}
else if(l!=mLevelList.size()-1)
{
{
item.SetBackgroundColour(mColorMap[*i]);
}
- r+=20;
- g+=20;
- b+=20;*/
+
item.SetColumn(0);
-
- //Sets the last level as selected....How to make it select only the first time?
- //if (level==mLevelList.size()) item.SetState(wxLIST_STATE_SELECTED);
-
GetCtrl(l)->SetItem(item);
// GetCtrl(l)->SetItem(id,0, crea::std2wx(s));
// GetCtrl(l)->SetItem(id,k, crea::std2wx(val));
// GetCtrl(l)->SetColumnWidth(k, wxLIST_AUTOSIZE );
- }
-
+ }
}
}
GetCtrl(l)->Show();
-
+
if (level<mLevelList.size()) UpdateLevel(level+1);
+
}
//=====================================================================
" Level "<<level+1
<<std::endl);
-
+ if(level<mLevelList.size()-1)
+ {
mSelected=GetSelected(level+2);
+ }
+ else
+ {
+ mLastLevelSelected=GetSelected(level+2);
+ }
- if (level<mLevelList.size()-1) UpdateLevel( level + 2 );
-
+ if (level<mLevelList.size()-1)
+ {
+ UpdateLevel( level + 2 );
+ GetGimmickView()->ClearSelection();
+ }
+ if (level==mLevelList.size()-2) SelectLowerLevel();
if (level==mLevelList.size()-1) ValidateSelectedImages ();
+
+ }
+ //================================================================
+ //================================================================
+ void WxTreeView::SelectLowerLevel()
+ {
+ long item = -1;
+ int level=mLevelList.size()-1;
+ for ( ;; )
+ {
+ item = GetCtrl(level)->GetNextItem(item,
+ wxLIST_NEXT_ALL);
+ if ( item == -1 )
+ break;
+
+ GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE
+ | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
+ }
+
+
}
+
//================================================================
-//================================================================
+ //================================================================
void WxTreeView::OnColClick(wxListEvent& event)
{
//Obtain the column name and the level that needs to be organized
long item = GetCtrl(level)->GetItemData(it);
GetCtrl(level)->SetItemData(it,((long*)item)[0]);
tree::Node* n= ((ItemData*)((long*)item)[0])->node;
- for(selection=mSelected.begin();selection!=mSelected.end();++selection)
+ if(level<mLevelList.size()-1)
{
- if((*selection)->GetAttribute("ID").compare(n->GetAttribute("ID"))==0)
+ for(selection=mSelected.begin();selection!=mSelected.end();++selection)
{
- change.push_back(it);
+ if((*selection)->GetAttribute("ID").compare(n->GetAttribute("ID"))==0)
+ {
+ change.push_back(it);
+ }
+ }
+ }
+ else
+ {
+ for(selection=mLastLevelSelected.begin();selection!=mLastLevelSelected.end();++selection)
+ {
+ if((*selection)->GetAttribute("ID").compare(n->GetAttribute("ID"))==0)
+ {
+ change.push_back(it);
+ }
}
}
}
+ //Resets the selected items
std::vector<long>::iterator selectedIts;
for(selectedIts=change.begin();selectedIts!=change.end();++selectedIts)
{
"WxTreeView::ValidateSelectedImages"
<<std::endl);
std::vector<tree::Node*> sel(GetSelected(mLevelList.size()+1));
- GetGimmickView()->OnSelectionChange(sel);
- /*
- //Send an event telling wether the selection is valid or not
- wxCommandEvent event( 0, GetId() );
- event.SetEventObject( this );
- std::vector<tree::Node*> sel=GetSelected((mLevelList.size()+1));
- event.SetClientData(&sel);
- GetEventHandler()->ProcessEvent( event );
- */
- //
+ GetGimmickView()->OnSelectionChange(sel);
+
}
//================================================================
std::string filename=(*i)->GetAttribute("FullFileName");
s.push_back(filename);
}
+ }
+
+ //================================================================
+ void WxTreeView::CreateColorPalette()
+ {
+ GimmickDebugMessage(6,"WxTreeView::CreateColorPalette");
+ mColorPalette.push_back("WHITE");
+ mColorPalette.push_back("LIGHT GREY");
+ mColorPalette.push_back("AQUAMARINE");
+ mColorPalette.push_back("MEDIUM FOREST GREEN");
+ mColorPalette.push_back("INDIAN RED");
+ mColorPalette.push_back("KHAKI");
+ mColorPalette.push_back("ORANGE");
+ mColorPalette.push_back("LIGHT BLUE");
+ mColorPalette.push_back("LIGHT STEEL BLUE");
+ mColorPalette.push_back("PINK");
+ mColorPalette.push_back("PLUM");
+ mColorPalette.push_back("PURPLE");
+ mColorPalette.push_back("RED");
+ mColorPalette.push_back("SEA GREEN");
+ mColorPalette.push_back("SIENNA");
+ mColorPalette.push_back("SKY BLUE");
+ mColorPalette.push_back("SLATE BLUE");
+ mColorPalette.push_back("SPRING GREEN");
+ mColorPalette.push_back("TAN");
+ mColorPalette.push_back("THISTLE");
+ mColorPalette.push_back("TURQUOISE");
+ mColorPalette.push_back("VIOLET");
+ mColorPalette.push_back("VIOLET RED");
+ mColorPalette.push_back("WHEAT");
+ mColorPalette.push_back("YELLOW");
+ mColorPalette.push_back("YELLOW GREEN");
+ mColorPalette.push_back("BLUE");
+ mColorPalette.push_back("BLUE VIOLET");
+ mColorPalette.push_back("BROWN");
+ mColorPalette.push_back("CADET BLUE");
+ mColorPalette.push_back("CORAL");
+ mColorPalette.push_back("CORNFLOWER BLUE");
+ mColorPalette.push_back("CYAN");
+ mColorPalette.push_back("DARK GREY");
+ mColorPalette.push_back("DARK GREEN");
+ mColorPalette.push_back("DARK OLIVE GREEN");
+ mColorPalette.push_back("DARK ORCHID");
+ mColorPalette.push_back("DARK SLATE BLUE");
+ mColorPalette.push_back("DARK SLATE GREY");
+ mColorPalette.push_back("DARK TURQUOISE");
+ mColorPalette.push_back("FIREBRICK");
+ mColorPalette.push_back("FOREST GREEN");
+ mColorPalette.push_back("GOLD");
+ mColorPalette.push_back("GOLDENROD");
+ mColorPalette.push_back("GREY");
+ mColorPalette.push_back("GREEN");
+ mColorPalette.push_back("GREEN YELLOW");
+ mColorPalette.push_back("LIME GREEN");
+ mColorPalette.push_back("MAGENTA");
+ mColorPalette.push_back("MAROON");
+ mColorPalette.push_back("MEDIUM AQUAMARINE");
+ mColorPalette.push_back("MEDIUM BLUE");
+ mColorPalette.push_back("MEDIUM GOLDENROD");
+ mColorPalette.push_back("MEDIUM ORCHID");
+ mColorPalette.push_back("MEDIUM SEA GREEN");
+ mColorPalette.push_back("MEDIUM SLATE BLUE");
+ mColorPalette.push_back("MEDIUM SPRING GREEN");
+ mColorPalette.push_back("MEDIUM TURQUOISE");
+ mColorPalette.push_back("MEDIUM VIOLET RED");
+ mColorPalette.push_back("MIDNIGHT BLUE");
+ mColorPalette.push_back("NAVY");
+ mColorPalette.push_back("ORANGE RED");
+ mColorPalette.push_back("ORCHID, PALE GREEN");
+ mColorPalette.push_back("STEEL BLUE");
+ mColorPalette.push_back("BLACK");
+
+
}
//================================================================
BEGIN_EVENT_TABLE(WxTreeView, wxPanel)