00001
00002
00027 #include <wx/listctrl.h>
00028 #include <wx/xrc/xh_listc.h>
00029 #include "ProjectArray.h"
00030 #include "Batch.h"
00031
00032 class ProjectListBox : public wxListCtrl
00033 {
00034 public:
00035
00036 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"));
00037
00038
00039 void AppendProject(Project* project);
00040 void ChangePrefix(int index, wxString newPrefix);
00041 void Deselect(int index);
00042 void Fill(Batch* batch);
00043 int GetIndex(int id);
00044 int GetProjectCountByPath(wxString path);
00045 int GetProjectId(int index);
00046 int GetSelectedIndex();
00047 wxString GetSelectedProject();
00049 wxString GetSelectedProjectPrefix();
00051 Project::Target GetSelectedProjectTarget();
00052 wxString GetText(int row, int column);
00053 void ReloadProject(int index, Project* project);
00054 void Select(int index);
00055 void SetMissing(int index);
00056 void SwapProject(int index);
00057 bool UpdateStatus(int index, Project* project);
00058
00059 protected:
00060 void OnContextMenu(wxContextMenuEvent& e);
00061 void OnChangePrefix(wxCommandEvent& e);
00062 void OnResetProject(wxCommandEvent& e);
00063 void OnEditProject(wxCommandEvent& e);
00064 void OnRemoveProject(wxCommandEvent& e);
00065
00066 private:
00067 int m_selected;
00068 Batch* m_batch;
00069 IntArray columns;
00070
00071 wxString GetAttributeString(int i, Project* project);
00072 wxString GetLongerFormatName(std::string str);
00073 void OnColumnWidthChange(wxListEvent& event);
00074 void OnDeselect(wxListEvent& event);
00075 void OnSelect(wxListEvent& event);
00076
00077 enum ColumnName
00078 {
00079 ID,
00080 PROJECT,
00081 PREFIX,
00082 MODDATE,
00083 FORMAT,
00084 PROJECTION,
00085 SIZE,
00086 STATUS
00087 };
00088
00089
00090 static const wxString fileFormat[];
00091 static const wxString outputMode[];
00092 static const wxString HDRMergeType[];
00093 static const wxString blendingMechanism[];
00094 static const wxString colorCorrection[];
00095
00096 DECLARE_EVENT_TABLE()
00097 DECLARE_DYNAMIC_CLASS(ProjectListBox)
00098 };
00099
00101 class ProjectListBoxXmlHandler : public wxListCtrlXmlHandler
00102 {
00103 DECLARE_DYNAMIC_CLASS(ProjectListBoxXmlHandler)
00104
00105 public:
00106 ProjectListBoxXmlHandler();
00107 virtual wxObject* DoCreateResource();
00108 virtual bool CanHandle(wxXmlNode* node);
00109 };