[aacb50]: src / hugin1 / ptbatcher / RunStitchFrame.cpp  Maximize  Restore  History

Download this file

167 lines (146 with data), 5.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// -*- c-basic-offset: 4 -*-
/** @file RunStitchFrame.cpp
*
* @brief Batch processor for Hugin
*
* @author Marko Kuder <marko.kuder@gmail.com>
*
* $Id: RunStitchFrame.cpp 3322 2008-08-16 5:00:07Z mkuder $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "RunStitchFrame.h"
BEGIN_EVENT_TABLE(RunStitchFrame, wxFrame)
EVT_BUTTON(wxID_CANCEL, RunStitchFrame::OnCancel)
EVT_END_PROCESS(-1, RunStitchFrame::OnProcessTerminate)
END_EVENT_TABLE()
RunStitchFrame::RunStitchFrame(wxWindow * parent, const wxString& title, const wxPoint& pos, const wxSize& size) //ProjectArray projList, wxListBox *projListBox)
: wxFrame(parent, -1, title, pos, size, wxRESIZE_BORDER | wxCAPTION | wxCLIP_CHILDREN), m_isStitching(false)
{
wxBoxSizer * topsizer = new wxBoxSizer( wxVERTICAL );
m_stitchPanel = new RunStitchPanel(this);
topsizer->Add(m_stitchPanel, 1, wxEXPAND | wxALL, 2);
topsizer->Add( new wxButton(this, wxID_CANCEL, _("Cancel")),
0, wxALL | wxALIGN_RIGHT, 10);
#ifdef __WXMSW__
// wxFrame does have a strange background color on Windows..
this->SetBackgroundColour(m_stitchPanel->GetBackgroundColour());
#endif
SetSizer( topsizer );
// topsizer->SetSizeHints( this ); // set size hints to honour minimum size
}
int RunStitchFrame::GetProcessId()
{
if(m_projectId<0) //if a fake stitchframe is used (for a command), it doesn't have a stitch panel
return m_pid;
else
return m_stitchPanel->GetPid();
}
int RunStitchFrame::GetProjectId()
{
return m_projectId;
}
void RunStitchFrame::SetProcessId(int pid)
{
if(m_projectId<0) //if a fake stitchframe is used (for a command), it doesn't have a stitch panel
m_pid = pid;
else
m_pid = m_stitchPanel->GetPid();
}
void RunStitchFrame::SetProjectId(int id)
{
m_projectId=id;
}
void RunStitchFrame::OnCancel(wxCommandEvent& WXUNUSED(event))
{
DEBUG_TRACE("");
if (m_isStitching) {
m_stitchPanel->CancelStitch();
m_isStitching = false;
} else {
Close();
}
}
void RunStitchFrame::OnProcessTerminate(wxProcessEvent & event)
{
if (! m_isStitching) {
// canceled stitch
/*if (GetParent()) { //send process notification to parent window
event.SetEventObject( this );
event.m_exitcode = 1;
event.SetId(m_processId);
DEBUG_TRACE("Sending wxProcess event");
this->GetParent()->ProcessEvent( event );
}*/
event.SetEventObject( this );
event.m_exitcode = 1;
event.SetId(m_projectId);
DEBUG_TRACE("Sending wxProcess event");
this->GetParent()->GetEventHandler()->ProcessEvent( event );
// TODO: Cleanup files?
Close();
} else {
m_isStitching = false;
if (event.GetExitCode() != 0) {
event.SetEventObject( this );
event.SetId(m_projectId);
//this->GetParent()->ProcessEvent( event );
this->GetParent()->GetEventHandler()->ProcessEvent( event );
Close();
} else {
//if (GetParent()) { //send process notification to parent window
event.SetEventObject( this );
event.SetId(m_projectId);
DEBUG_TRACE("Sending wxProcess event");
//m_evtParent->ProcessEvent( event );
this->GetParent()->GetEventHandler()->ProcessEvent( event );
//this->GetParent()->ProcessEvent( event );
//}
/*if(!m_projList.IsEmpty()) //returns true if batch list is not empty yet after removing the first
{
wxGetApp().OnStitch(wxGetApp().projList.Item(0).path, wxGetApp().projList.Item(0).prefix);
m_projList.RemoveAt(0);
m_projListBox->Delete(0);
}*/
Close();
}
}
}
bool RunStitchFrame::StitchProject(wxString scriptFile, wxString outname,
HuginBase::PanoramaMakefilelibExport::PTPrograms progs)
{
if (! m_stitchPanel->StitchProject(scriptFile, outname, progs)) {
return false;
}
m_isStitching = true;
m_isDetecting = false;
return true;
}
bool RunStitchFrame::DetectProject(wxString scriptFile,
HuginBase::AssistantMakefilelibExport::AssistantPrograms progs)
{
if (! m_stitchPanel->DetectProject(scriptFile, progs))
{
return false;
}
m_isStitching = true;
m_isDetecting = true;
return true;
}
bool RunStitchFrame::SaveLog(const wxString &filename)
{
return m_stitchPanel->SaveLog(filename);
};

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks