28 #include "wx/msw/wrapwin.h"
42 EVT_LIST_COL_END_DRAG(wxID_ANY,
ProjectListBox::OnColumnWidthChange)
52 bool ProjectListBox::Create(wxWindow* parent, wxWindowID
id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
54 if (! wxListCtrl::Create(parent,
id, pos, size, wxLC_REPORT | style) )
64 columns.Add(PROJECTION);
66 columns.Add(USERDEFINEDSEQUENCE);
68 this->InsertColumn(0,_(
"ID"));
69 this->InsertColumn(1,_(
"Project"));
70 this->InsertColumn(2,_(
"Output prefix"));
71 this->InsertColumn(3,_(
"Status"));
72 this->InsertColumn(4,_(
"Last modified"));
73 this->InsertColumn(5,_(
"Output format"));
74 this->InsertColumn(6,_(
"Projection"));
75 this->InsertColumn(7,_(
"Size"));
76 this->InsertColumn(8, _(
"User defined sequence"));
79 for(
int i=0; i < GetColumnCount() ; i++ )
81 int width = wxConfigBase::Get()->Read(wxString::Format(wxT(
"/BatchList/ColumnWidth%d"), columns[i] ), -1);
84 SetColumnWidth(i, width);
102 this->InsertItem(this->GetItemCount(),project->
path);
106 this->InsertItem(this->GetItemCount(),_T(
""));
107 this->SetItem(this->GetItemCount()-1,i,project->
path);
112 this->InsertItem(this->GetItemCount(),_T(
""));
120 for(
unsigned int i=1; i<
columns.GetCount(); i++)
127 this->InsertItem(this->GetItemCount(),_T(
""));
135 if(colIndex!=wxNOT_FOUND)
145 if (colIndex != wxNOT_FOUND)
154 SetItemState(index, 0, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
169 while(index<this->GetItemCount())
171 if(
GetText(index,0).Cmp(wxString::Format(_(
"%d"),
id))==0)
183 for(
int i=0; i<this->GetItemCount(); i++)
196 if(!
GetText(index,0).ToLong(&
id))
198 wxMessageBox(_(
"Error, cannot convert id"),_(
"Error"));
206 for (
int i = 0; i<GetItemCount(); i++)
208 if (GetItemState(i, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED)
220 item.SetColumn(column);
221 item.SetMask(wxLIST_MASK_TEXT);
223 return item.GetText();
228 for(
unsigned int i=0; i<
columns.GetCount(); i++)
236 if(index>=0 && index<this->GetItemCount())
238 SetItemState(index,wxLIST_STATE_SELECTED,wxLIST_STATE_SELECTED);
244 for(
int i=0; i< this->GetColumnCount(); i++)
248 this->SetItem(index,i,_(
"File missing"));
252 this->SetItem(index,i,_T(
""));
260 for(
int i=0; i<GetColumnCount(); i++)
263 SetItem(index,i,
GetText(index+1,i));
264 SetItem(index+1,i,temp);
272 for(
int i=0; i< this->GetColumnCount(); i++)
277 if(newStatus.Cmp(
GetText(index,i))!=0)
280 this->SetItem(index,i,newStatus);
295 return wxString::Format(_T(
"%ld"),project->
id);
297 return project->
path;
302 wxFileName prefix(project->
prefix);
303 wxFileName projectFile(project->
path);
304 prefix.MakeRelativeTo(projectFile.GetPath());
305 return prefix.GetFullPath();
309 return _(
"Assistant");
317 if (project->
modDate.IsValid())
319 return project->
modDate.Format();
322 return wxEmptyString;
330 return wxEmptyString;
334 pano_projection_features proj;
337 wxString str2(proj.name, wxConvLocal);
338 return wxGetTranslation(str2);
345 return wxEmptyString;
354 return wxEmptyString;
360 return wxEmptyString;
392 int col =
event.GetColumn();
393 wxConfigBase::Get()->Write(wxString::Format(wxT(
"/BatchList/ColumnWidth%d"),
columns[col]), GetColumnWidth(col));
400 wxPoint point = e.GetPosition();
402 if ((point.x == -1) && (point.y == -1))
404 wxSize size = GetSize();
405 point.x = size.x / 2;
406 point.y = size.y / 2;
410 point = ScreenToClient(point);
412 if (selected.size() == 1)
420 PopupMenu(&menu, point.x, point.y);
424 if (selected.size() > 1)
429 bool isSameTarget =
true;
430 for (
const auto& i : selected)
434 isSameTarget =
false;
444 PopupMenu(&menu, point.x, point.y);
451 switch (e.GetKeyCode())
454 case WXK_NUMPAD_DELETE:
456 wxCommandEvent ev(wxEVT_TOOL, XRCID(
"tool_remove"));
457 GetParent()->GetEventHandler()->AddPendingEvent(ev);
461 case WXK_NUMPAD_INSERT:
463 wxCommandEvent ev(wxEVT_MENU, XRCID(
"menu_add"));
464 GetParent()->GetEventHandler()->AddPendingEvent(ev);
469 wxCommandEvent ev(wxEVT_TOOL, XRCID(
"tool_cancel"));
470 GetParent()->GetEventHandler()->AddPendingEvent(ev);
479 wxCommandEvent ev(wxEVT_COMMAND_BUTTON_CLICKED, XRCID(
"button_prefix"));
480 GetParent()->GetEventHandler()->AddPendingEvent(ev);
485 wxCommandEvent ev(wxEVT_COMMAND_BUTTON_CLICKED, XRCID(
"button_reset"));
486 GetParent()->GetEventHandler()->AddPendingEvent(ev);
491 wxCommandEvent ev(wxEVT_COMMAND_BUTTON_CLICKED, XRCID(
"button_edit"));
492 GetParent()->GetEventHandler()->AddPendingEvent(ev);
497 wxCommandEvent ev(wxEVT_COMMAND_TOOL_CLICKED, XRCID(
"tool_remove"));
498 GetParent()->GetEventHandler()->AddPendingEvent(ev);
503 wxCommandEvent ev(wxEVT_COMMAND_BUTTON_CLICKED, XRCID(
"button_user_defined"));
504 GetParent()->GetEventHandler()->AddPendingEvent(ev);
514 _T(
"TIFF_multilayer"),
515 _T(
"TIFF_multilayer_mask"),
529 _T(
"FILEFORMAT_NULL")
540 _T(
"HDRMERGE_AVERAGE"),
541 _T(
"HDRMERGE_DEGHOST")
547 _T(
"PTBLENDER_BLEND"),
549 _T(
"SMARTBLEND_BLEND"),
556 : wxListCtrlXmlHandler()
565 cp->Create(m_parentAsWindow,
567 GetPosition(), GetSize(),
568 GetStyle(wxT(
"style")),
578 return IsOfClass(node, wxT(
"ProjectListBox"));
void OnResetProject(wxCommandEvent &e)
PanoramaOptions::ProjectionFormat getProjection() const
int GetProjectCount()
Returns number of projects in batch list.
wxString userDefindSequence
static const wxString outputMode[]
void OnChangeUserDefined(wxCommandEvent &e)
void SetMissing(int index)
int GetProjectCountByPath(wxString path)
unsigned int getHeight() const
get panorama height
static const wxString HDRMergeType[]
void AppendProject(Project *project)
virtual wxObject * DoCreateResource()
wxString GetText(int row, int column)
void OnEditProject(wxCommandEvent &e)
HuginBase::PanoramaOptions options
void ChangePrefix(int index, wxString newPrefix)
void ChangeUserDefined(int index, wxString newUserDefined)
std::set< unsigned int > UIntSet
virtual bool CanHandle(wxXmlNode *node)
void OnContextMenu(wxContextMenuEvent &e)
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
bool UpdateStatus(int index, Project *project)
Batch processor for Hugin with GUI.
void OnRemoveProject(wxCommandEvent &e)
Project * GetProject(int index)
Returns project at index.
void OnChangePrefix(wxCommandEvent &e)
wxString GetLongerFormatName(std::string str)
static const wxString blendingMechanism[]
unsigned int getWidth() const
HuginBase::UIntSet GetSelectedProjects()
wxString GetAttributeString(int i, Project *project)
static const wxString fileFormat[]
std::string outputImageType
void ReloadProject(int index, Project *project)
void OnChar(wxKeyEvent &e)
void OnColumnWidthChange(wxListEvent &event)
int GetProjectId(int index)
void SwapProject(int index)