27 #include "hugin_config.h"
46 EVT_LIST_ITEM_SELECTED(-1,
ImagesList::OnItemSelected)
47 EVT_LIST_ITEM_DESELECTED(-1,
ImagesList::OnItemDeselected)
48 EVT_LIST_COL_END_DRAG(-1,
ImagesList::OnColumnWidthChange)
65 if (! wxListCtrl::Create(parent,
id, pos, size, wxLC_REPORT | style) ) {
72 InsertColumn( 0, wxT(
"#"), wxLIST_FORMAT_RIGHT, 35 );
76 sz = ConvertDialogToPixels(sz);
83 m_degDigits = wxConfigBase::Get()->Read(wxT(
"/General/DegreeFractionalDigits"),1);
84 m_pixelDigits = wxConfigBase::Get()->Read(wxT(
"/General/PixelFractionalDigits"),1);
85 m_distDigits = wxConfigBase::Get()->Read(wxT(
"/General/DistortionFractionalDigits"),3);
118 unsigned int nrItems = GetItemCount();
121 for (
int i=nrItems-1; i>=(int)nrImages; i--)
126 DEBUG_DEBUG(
"item state before: " << GetItemState(i,wxLIST_STATE_SELECTED));
127 SetItemState(i,0, wxLIST_STATE_SELECTED);
128 DEBUG_DEBUG(
"item state after: " << GetItemState(i,wxLIST_STATE_SELECTED));
139 for (HuginBase::UIntSet::const_iterator it = changed.begin(); it != changed.end(); ++it){
140 if (*it >= nrItems) {
158 ImageCache::getInstance().softFlush();
176 e.SetEventType(wxEVT_COMMAND_LIST_ITEM_SELECTED);
178 GetEventHandler()->ProcessEvent(e);
187 void ImagesList::createIcon(wxBitmap & bitmap,
unsigned int imgNr,
unsigned int size)
189 ImageCache::Entry * cacheEntry = ImageCache::getInstance().getSmallImage(
194 wxImage * s_img = cacheEntry->image;
199 float w = s_img->GetWidth();
200 float h = s_img->GetHeight();
214 wxImage img = s_img->Scale(bW, bH);
218 temp_dc.SelectObject(bitmap);
229 temp_dc.DrawBitmap(bimg, (size-bW)>>1 ,0);
231 temp_dc.DrawBitmap(bimg,0,(size-bH)>>1);
242 InsertItem ( imgNr, wxString::Format(wxT(
"%d"),imgNr), imgNr );
249 wxListCtrl::DeleteItem(imgNr);
254 unsigned int nrItems = GetItemCount();
255 for (
unsigned int i=0; i < nrItems ; i++) {
256 int selected = GetItemState(i, wxLIST_STATE_SELECTED);
257 if (i != imgNr && selected) {
258 SetItemState(i, 0, wxLIST_STATE_SELECTED);
261 SetItemState(imgNr, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
266 unsigned int nrItems = GetItemCount();
267 for (
unsigned int i=0; i < nrItems ; i++){
270 SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
274 SetItemState(i, 0, wxLIST_STATE_SELECTED);
277 SetItemState(*imgs.begin(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
283 size_t nrItems = GetItemCount();
284 size_t _imgStart=imgStart;
285 size_t _imgEnd=imgEnd;
291 for (
size_t i=0; i < nrItems ; i++)
293 int selected = GetItemState(i, wxLIST_STATE_SELECTED);
294 if ((i < _imgStart || i>_imgEnd ) && selected)
296 SetItemState(i, 0, wxLIST_STATE_SELECTED);
299 for(
size_t i=_imgStart; i<=_imgEnd; i++)
301 SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
307 unsigned int nrItems = GetItemCount();
308 for (
unsigned int i=0; i < nrItems ; i++)
310 SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
316 unsigned int nrItems = GetItemCount();
317 for (
unsigned int i=0; i < nrItems ; i++) {
318 int selected = GetItemState(i, wxLIST_STATE_SELECTED);
320 SetItemState(i, 0, wxLIST_STATE_SELECTED);
328 if(e.GetIndex() < 0)
return;
340 switch(e.GetKeyCode())
344 wxCommandEvent ev(EVT_IMAGE_ADD,wxID_ANY);
345 GetParent()->GetEventHandler()->AddPendingEvent(ev);
350 wxCommandEvent ev(EVT_IMAGE_DEL,wxID_ANY);
351 GetParent()->GetEventHandler()->AddPendingEvent(ev);
370 if(e.GetIndex() < 0)
return;
386 selectedImages.clear();
388 for (
int Nr=GetItemCount()-1 ; Nr>=0 ; --Nr ) {
389 if ( GetItemState( Nr, wxLIST_STATE_SELECTED ) ) {
390 selectedImages.insert(Nr);
405 int colNum = e.GetColumn();
406 wxConfigBase::Get()->Write(
m_configClassName+wxString::Format(wxT(
"/ColumnWidth%d"),colNum), GetColumnWidth(colNum) );
434 const wxString& name)
442 InsertColumn(1, _(
"Filename"), wxLIST_FORMAT_LEFT, 200 );
443 InsertColumn(2, _(
"Number of masks"), wxLIST_FORMAT_RIGHT,120);
444 InsertColumn(3, _(
"Crop"), wxLIST_FORMAT_RIGHT,120);
447 for (
int j=0; j < GetColumnCount() ; j++ )
450 int width = wxConfigBase::Get()->Read(wxString::Format(
m_configClassName+wxT(
"/ColumnWidth%d"), j ), -1);
452 SetColumnWidth(j, width);
467 SetItem(imgNr, 1, fn.GetFullName() );
471 maskstr=wxString::Format(wxT(
"%lu"), (
unsigned long int)
pano->
getImage(imgNr).getMasks().size());
474 SetItem(imgNr, 2, maskstr);
476 wxString cropstr(wxT(
"-"));
479 vigra::Rect2D c = img.getCropRect();
480 cropstr.Printf(wxT(
"%d,%d,%d,%d"), c.left(), c.right(), c.top(), c.bottom());
482 SetItem(imgNr, 3, cropstr);
489 SetSingleStyle(wxLC_SINGLE_SEL,
true);
493 SetSingleStyle(wxLC_SINGLE_SEL,
false);
502 : wxXmlResourceHandler()
511 cp->Create(m_parentAsWindow,
513 GetPosition(), GetSize(),
514 GetStyle(wxT(
"style")),
524 return IsOfClass(node, wxT(
"ImagesListMask"));
wxDEFINE_EVENT(EVT_QUEUE_PROGRESS, wxCommandEvent)
HuginBase::Panorama * pano
void OnItemDeselected(wxListEvent &e)
void SelectImages(const HuginBase::UIntSet imgs)
selects the given images
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
void OnItemSelected(wxListEvent &e)
virtual bool CanHandle(wxXmlNode *node)
bool set_contains(const _Container &c, const typename _Container::key_type &key)
#define DEBUG_ASSERT(cond)
simple class that forward the drop to the mainframe
include file for the hugin project
void DeselectAll()
Deselects all images.
HuginBase::StandardImageVariableGroups * variable_groups
void SetSingleSelect(bool isSingleSelect)
sets the listbox to single item select or multiply item select
virtual wxObject * DoCreateResource()
bool hasMasks() const
returns true, if image has masks associated
std::set< unsigned int > UIntSet
virtual ~ImagesList(void)
void SelectSingleImage(unsigned int imgNr)
Select an image.
const HuginBase::UIntSet & GetSelected() const
get the currently selected images
void OnChar(wxKeyEvent &e)
event handler to capture special key code
virtual void UpdateItem(unsigned int imgNr)
update the information in an already existing list item
std::size_t getNrOfImages() const
number of images.
void OnColumnWidthChange(wxListEvent &e)
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
virtual void UpdateItem(unsigned int imgNr)
update the information in an already existing list item
virtual void RemoveItem(unsigned int imgNr)
remove an existing list item
void Init(HuginBase::Panorama *pano)
void SelectImageRange(unsigned int imgStart, unsigned int imgEnd)
Select an image range.
void SelectAll()
Select all images.
void addObserver(PanoramaObserver *o)
add a panorama observer.
include file for the hugin project
specialized to display the mask aspect of images
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxT("panel"))
virtual void CreateItem(unsigned int imgNr)
create an list item for imgNr
virtual void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
receive the update signal and update display accordingly
virtual void UpdatePartNumbersForItem(unsigned int imgNr)
Update the part numbers (e.g.
void update()
Update part numbers for each variable group.
HuginBase::UIntSet selectedItems
create icons for an image
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxT("panel"))
All variables of a source image.
wxString m_configClassName
void Init(HuginBase::Panorama *pano)