BatchFrame.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00002 
00027 #include "BatchFrame.h"
00028 #include <wx/stdpaths.h>
00029 #include "PTBatcherGUI.h"
00030 #include "FindPanoDialog.h"
00031 #include "FailedProjectsDialog.h"
00032 
00033 /* file drag and drop handler method */
00034 bool BatchDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames)
00035 {
00036     BatchFrame* MyBatchFrame = wxGetApp().GetFrame();
00037     if (!MyBatchFrame)
00038     {
00039         return false;
00040     }
00041     if(filenames.GetCount()==0)
00042     {
00043         return false;
00044     }
00045     for(unsigned int i=0; i< filenames.GetCount(); i++)
00046     {
00047         wxFileName file(filenames[i]);
00048         if(file.HasExt())
00049         {
00050             if (file.GetExt().CmpNoCase(wxT("pto")) == 0 ||
00051                     file.GetExt().CmpNoCase(wxT("ptp")) == 0 ||
00052                     file.GetExt().CmpNoCase(wxT("pts")) == 0 )
00053             {
00054                 if(file.FileExists())
00055                 {
00056                     MyBatchFrame->AddToList(filenames[i]);
00057                 }
00058             };
00059         }
00060         else
00061         {
00062             if(file.DirExists())
00063             {
00064                 MyBatchFrame->AddDirToList(filenames[i]);
00065             }
00066         };
00067     };
00068     return true;
00069 };
00070 
00071 enum
00072 {
00073     wxEVT_COMMAND_RELOAD_BATCH,
00074     wxEVT_COMMAND_UPDATE_LISTBOX
00075 };
00076 
00077 BEGIN_EVENT_TABLE(BatchFrame, wxFrame)
00078     EVT_TOOL(XRCID("tool_clear"),BatchFrame::OnButtonClear)
00079     EVT_TOOL(XRCID("tool_open"),BatchFrame::OnButtonOpenBatch)
00080     EVT_TOOL(XRCID("tool_save"),BatchFrame::OnButtonSaveBatch)
00081     EVT_TOOL(XRCID("tool_start"),BatchFrame::OnButtonRunBatch)
00082     EVT_TOOL(XRCID("tool_skip"),BatchFrame::OnButtonSkip)
00083     EVT_TOOL(XRCID("tool_pause"),BatchFrame::OnButtonPause)
00084     EVT_TOOL(XRCID("tool_cancel"),BatchFrame::OnButtonCancel)
00085     EVT_TOOL(XRCID("tool_add"),BatchFrame::OnButtonAddToStitchingQueue)
00086     EVT_TOOL(XRCID("tool_remove"),BatchFrame::OnButtonRemoveFromList)
00087     EVT_TOOL(XRCID("tool_adddir"),BatchFrame::OnButtonAddDir)
00088     EVT_MENU(XRCID("menu_add"),BatchFrame::OnButtonAddToStitchingQueue)
00089     EVT_MENU(XRCID("menu_add_assistant"),BatchFrame::OnButtonAddToAssistantQueue)
00090     EVT_MENU(XRCID("menu_remove"),BatchFrame::OnButtonRemoveFromList)
00091     EVT_MENU(XRCID("menu_adddir"),BatchFrame::OnButtonAddDir)
00092     EVT_MENU(XRCID("menu_searchpano"), BatchFrame::OnButtonSearchPano)
00093     EVT_MENU(XRCID("menu_open"),BatchFrame::OnButtonOpenBatch)
00094     EVT_MENU(XRCID("menu_save"),BatchFrame::OnButtonSaveBatch)
00095     EVT_MENU(XRCID("menu_clear"),BatchFrame::OnButtonClear)
00096     EVT_MENU(XRCID("menu_exit"),BatchFrame::OnUserExit)
00097     EVT_MENU(XRCID("menu_help"),BatchFrame::OnButtonHelp)
00098     EVT_BUTTON(XRCID("button_addcommand"),BatchFrame::OnButtonAddCommand)
00099     EVT_BUTTON(XRCID("button_remove"),BatchFrame::OnButtonRemoveComplete)
00100     EVT_BUTTON(XRCID("button_prefix"),BatchFrame::OnButtonChangePrefix)
00101     EVT_BUTTON(XRCID("button_reset"),BatchFrame::OnButtonReset)
00102     EVT_BUTTON(XRCID("button_resetall"),BatchFrame::OnButtonResetAll)
00103     EVT_BUTTON(XRCID("button_edit"),BatchFrame::OnButtonOpenWithHugin)
00104     EVT_BUTTON(XRCID("button_move_up"),BatchFrame::OnButtonMoveUp)
00105     EVT_BUTTON(XRCID("button_move_down"),BatchFrame::OnButtonMoveDown)
00106     EVT_CHECKBOX(XRCID("cb_parallel"), BatchFrame::OnCheckParallel)
00107     EVT_CHECKBOX(XRCID("cb_overwrite"), BatchFrame::OnCheckOverwrite)
00108     EVT_CHECKBOX(XRCID("cb_shutdown"), BatchFrame::OnCheckShutdown)
00109     EVT_CHECKBOX(XRCID("cb_verbose"), BatchFrame::OnCheckVerbose)
00110     EVT_CHECKBOX(XRCID("cb_autoremove"), BatchFrame::OnCheckAutoRemove)
00111     EVT_CHECKBOX(XRCID("cb_autostitch"), BatchFrame::OnCheckAutoStitch)
00112     EVT_CHECKBOX(XRCID("cb_savelog"), BatchFrame::OnCheckSaveLog)
00113     EVT_END_PROCESS(-1, BatchFrame::OnProcessTerminate)
00114     EVT_CLOSE(BatchFrame::OnClose)
00115     EVT_MENU(wxEVT_COMMAND_RELOAD_BATCH, BatchFrame::OnReloadBatch)
00116     EVT_MENU(wxEVT_COMMAND_UPDATE_LISTBOX, BatchFrame::OnUpdateListBox)
00117     EVT_COMMAND(wxID_ANY, EVT_BATCH_FAILED, BatchFrame::OnBatchFailed)
00118     EVT_COMMAND(wxID_ANY, EVT_INFORMATION, BatchFrame::OnBatchInformation)
00119     EVT_COMMAND(wxID_ANY, EVT_UPDATE_PARENT, BatchFrame::OnRefillListBox)
00120     EVT_ICONIZE(BatchFrame::OnMinimize)
00121 END_EVENT_TABLE()
00122 
00123 BatchFrame::BatchFrame(wxLocale* locale, wxString xrc)
00124 {
00125     this->SetLocaleAndXRC(locale,xrc);
00126     m_cancelled = false;
00127     m_closeThread = false;
00128 #ifndef __WXMSW__
00129     m_help=0;
00130 #endif
00131 
00132     //load xrc resources
00133     wxXmlResource::Get()->LoadFrame(this, (wxWindow* )NULL, wxT("batch_frame"));
00134     // load our menu bar
00135 #ifdef __WXMAC__
00136     wxApp::s_macExitMenuItemId = XRCID("menu_exit");
00137     wxApp::s_macHelpMenuTitleName = _("&Help");
00138 #endif
00139     SetMenuBar(wxXmlResource::Get()->LoadMenuBar(this, wxT("batch_menu")));
00140 
00141     // create tool bar
00142     SetToolBar(wxXmlResource::Get()->LoadToolBar(this, wxT("batch_toolbar")));
00143 
00144     CreateStatusBar(1);
00145     SetStatusText(_("Not doing much..."));
00146 
00147     // set the minimize icon
00148 #ifdef __WXMSW__
00149     wxIcon myIcon(m_xrcPrefix + wxT("data/ptbatcher.ico"),wxBITMAP_TYPE_ICO);
00150 #else
00151     wxIcon myIcon(m_xrcPrefix + wxT("data/ptbatcher.png"),wxBITMAP_TYPE_PNG);
00152 #endif
00153     SetIcon(myIcon);
00154 
00155 #if defined __WXMSW__
00156     //show tray icon only on windows
00157     //because not all window manager on *nix provide a usable tray area
00158 #if wxCHECK_VERSION(2,9,0)
00159     if(wxTaskBarIcon::IsAvailable())
00160     {
00161         m_tray=new BatchTaskBarIcon();
00162         m_tray->SetIcon(myIcon,_("Hugin's Batch processor"));
00163     }
00164     else
00165     {
00166         m_tray=NULL;
00167     };
00168 #else
00169     m_tray=new BatchTaskBarIcon();
00170     if(m_tray->IsOk())
00171     {
00172         m_tray->SetIcon(myIcon,_("Hugin's Batch processor"));
00173     }
00174     else
00175     {
00176         m_tray=NULL;
00177     };
00178 #endif
00179 #else
00180     m_tray=NULL;
00181 #endif
00182     m_batch = new Batch(this,wxTheApp->argv[0],true);
00183     m_batch->gui = true;
00184 #if wxCHECK_VERSION(2,9,4)
00185     if(wxGetKeyState(WXK_COMMAND))
00186 #else
00187     if(wxGetKeyState(WXK_CONTROL))
00188 #endif
00189     {
00190 #ifdef __WXMAC__
00191         wxString text(_("You have pressed the Command key."));
00192 #else
00193         wxString text(_("You have pressed the Control key."));
00194 #endif
00195         text.Append(wxT("\n"));
00196         text.Append(_("Should the loading of the batch queue be skipped?"));
00197         if(wxMessageBox(text, 
00198 #ifdef __WXMSW__
00199             wxT("PTBatcherGUI"),
00200 #else
00201             wxEmptyString,
00202 #endif
00203             wxYES_NO | wxICON_EXCLAMATION, NULL)==wxNO)
00204         {
00205             m_batch->LoadTemp();
00206         };
00207     }
00208     else
00209     {
00210         m_batch->LoadTemp();
00211     };
00212     if(m_batch->GetLastFile().length()==0)
00213     {
00214         m_batch->SaveTemp();
00215     }
00216     projListBox = XRCCTRL(*this,"project_listbox",ProjectListBox);
00217 
00218     //wxThreadHelper::Create is deprecated in wxWidgets 2.9+, but its
00219     // replacement, CreateThread, does not exist in 2.8. Pick one
00220     // depending on the version to a avoid compiler warning(2.9) or error(2.8).
00221 #if wxCHECK_VERSION(2, 9, 0)
00222     this->wxThreadHelper::CreateThread();
00223 #else
00224     this->wxThreadHelper::Create();
00225 #endif
00226     this->GetThread()->Run();
00227     //TO-DO: include a batch or project progress gauge?
00228     projListBox->Fill(m_batch);
00229     SetDropTarget(new BatchDropTarget());
00230 }
00231 
00232 void* BatchFrame::Entry()
00233 {
00234     //we constantly poll the working dir for new files and wait a bit on each loop
00235     while(!m_closeThread)
00236     {
00237         //don't access GUI directly in this function (function is running as separate thread)
00238         //check, if ptbt file was changed
00239         wxFileName aFile(m_batch->GetLastFile());
00240         if(!aFile.FileExists())
00241         {
00242             wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxEVT_COMMAND_RELOAD_BATCH);
00243             wxPostEvent(this,evt);
00244         }
00245         else
00246         {
00247             wxDateTime create;
00248             aFile.GetTimes(NULL,NULL,&create);
00249             if(create.IsLaterThan(m_batch->GetLastFileDate()))
00250             {
00251                 wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxEVT_COMMAND_RELOAD_BATCH);
00252                 wxPostEvent(this,evt);
00253             };
00254         };
00255         //update project list box
00256         wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, wxEVT_COMMAND_UPDATE_LISTBOX);
00257         wxPostEvent(this,evt);
00258         GetThread()->Sleep(1000);
00259     }
00260     return 0;
00261 }
00262 
00263 bool BatchFrame::IsRunning()
00264 {
00265     return m_batch->IsRunning();
00266 };
00267 
00268 bool BatchFrame::IsPaused()
00269 {
00270     return m_batch->IsPaused();
00271 };
00272 
00273 void BatchFrame::OnUpdateListBox(wxCommandEvent& event)
00274 {
00275     wxFileName tempFile;
00276     bool change = false;
00277     for(int i = 0; i< m_batch->GetProjectCount(); i++)
00278     {
00279         if(m_batch->GetProject(i)->id >= 0 && m_batch->GetStatus(i)!=Project::FINISHED)
00280         {
00281             tempFile.Assign(m_batch->GetProject(i)->path);
00282             if(tempFile.FileExists())
00283             {
00284                 wxDateTime modify;
00285                 modify=tempFile.GetModificationTime();
00286                 if(m_batch->GetProject(i)->skip)
00287                 {
00288                     change = true;
00289                     m_batch->GetProject(i)->skip = false;
00290                     m_batch->SetStatus(i,Project::WAITING);
00291                     projListBox->ReloadProject(projListBox->GetIndex(m_batch->GetProject(i)->id),m_batch->GetProject(i));
00292                 }
00293                 else if(!modify.IsEqualTo(m_batch->GetProject(i)->modDate))
00294                 {
00295                     change = true;
00296                     m_batch->GetProject(i)->modDate = modify;
00297                     m_batch->GetProject(i)->ResetOptions();
00298                     if(m_batch->GetProject(i)->target==Project::STITCHING)
00299                     {
00300                         m_batch->SetStatus(i,Project::WAITING);
00301                     };
00302                     projListBox->ReloadProject(projListBox->GetIndex(m_batch->GetProject(i)->id),m_batch->GetProject(i));
00303                 }
00304             }
00305             else
00306             {
00307                 if(m_batch->GetStatus(i) != Project::MISSING)
00308                 {
00309                     change = true;
00310                     m_batch->GetProject(i)->skip = true;
00311                     m_batch->SetStatus(i,Project::MISSING);
00312                     projListBox->SetMissing(projListBox->GetIndex(m_batch->GetProject(i)->id));
00313                 }
00314             }
00315         }
00316         if(projListBox->UpdateStatus(i,m_batch->GetProject(i)))
00317         {
00318             change = true;
00319         }
00320     }
00321     if(change)
00322     {
00323         m_batch->SaveTemp();
00324     }
00325 };
00326 
00327 void BatchFrame::OnReloadBatch(wxCommandEvent& event)
00328 {
00329     m_batch->ClearBatch();
00330     m_batch->LoadTemp();
00331     projListBox->DeleteAllItems();
00332     projListBox->Fill(m_batch);
00333     SetStatusText(wxT(""));
00334 };
00335 
00336 void BatchFrame::OnUserExit(wxCommandEvent& event)
00337 {
00338     Close(true);
00339 };
00340 
00341 void BatchFrame::OnButtonAddCommand(wxCommandEvent& event)
00342 {
00343     wxTextEntryDialog dlg(this,_("Please enter the command-line application to execute:"),_("Enter application"));
00344     wxTheApp->SetEvtHandlerEnabled(false);
00345     if(dlg.ShowModal() == wxID_OK)
00346     {
00347         wxString line = dlg.GetValue();
00348         m_batch->AddAppToBatch(line);
00349         //SetStatusText(_T("Added application"));
00350         projListBox->AppendProject(m_batch->GetProject(m_batch->GetProjectCount()-1));
00351         m_batch->SaveTemp();
00352     }
00353     wxTheApp->SetEvtHandlerEnabled(true);
00354 }
00355 
00356 void BatchFrame::OnButtonAddDir(wxCommandEvent& event)
00357 {
00358     wxString defaultdir = wxConfigBase::Get()->Read(wxT("/BatchFrame/actualPath"),wxT(""));
00359     wxDirDialog dlg(this,
00360                     _("Specify a directory to search for projects in"),
00361                     defaultdir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
00362     dlg.SetPath(wxConfigBase::Get()->Read(wxT("/BatchFrame/actualPath"),wxT("")));
00363     if (dlg.ShowModal() == wxID_OK)
00364     {
00365         wxConfig::Get()->Write(wxT("/BatchFrame/actualPath"), dlg.GetPath());  // remember for later
00366         AddDirToList(dlg.GetPath());
00367     };
00368 }
00369 
00370 void BatchFrame::OnButtonSearchPano(wxCommandEvent& e)
00371 {
00372     FindPanoDialog findpano_dlg(this,m_xrcPrefix);
00373     findpano_dlg.ShowModal();
00374 };
00375 
00376 void BatchFrame::OnButtonAddToStitchingQueue(wxCommandEvent& event)
00377 {
00378     wxString defaultdir = wxConfigBase::Get()->Read(wxT("/BatchFrame/actualPath"),wxT(""));
00379     wxFileDialog dlg(0,
00380                      _("Specify project source file(s)"),
00381                      defaultdir, wxT(""),
00382                      _("Project files (*.pto,*.ptp,*.pts,*.oto)|*.pto;*.ptp;*.pts;*.oto;|All files (*)|*"),
00383                      wxFD_OPEN | wxFD_MULTIPLE, wxDefaultPosition);
00384     dlg.SetDirectory(defaultdir);
00385 
00386     if (dlg.ShowModal() == wxID_OK)
00387     {
00388         wxArrayString paths;
00389         dlg.GetPaths(paths);
00390 #ifdef __WXGTK__
00391         //workaround a bug in GTK, see https://bugzilla.redhat.com/show_bug.cgi?id=849692 and http://trac.wxwidgets.org/ticket/14525
00392         wxConfig::Get()->Write(wxT("/BatchFrame/actualPath"), wxPathOnly(paths[0]));  // remember for later
00393 #else
00394         wxConfig::Get()->Write(wxT("/BatchFrame/actualPath"), dlg.GetDirectory());  // remember for later
00395 #endif
00396         for(unsigned int i=0; i<paths.GetCount(); i++)
00397         {
00398             AddToList(paths.Item(i));
00399         }
00400         m_batch->SaveTemp();
00401     };
00402 }
00403 
00404 void BatchFrame::OnButtonAddToAssistantQueue(wxCommandEvent& event)
00405 {
00406     wxString defaultdir = wxConfigBase::Get()->Read(wxT("/BatchFrame/actualPath"),wxT(""));
00407     wxFileDialog dlg(0,
00408                      _("Specify project source file(s)"),
00409                      defaultdir, wxT(""),
00410                      _("Project files (*.pto,*.ptp,*.pts,*.oto)|*.pto;*.ptp;*.pts;*.oto;|All files (*)|*"),
00411                      wxFD_OPEN | wxFD_MULTIPLE, wxDefaultPosition);
00412     dlg.SetDirectory(defaultdir);
00413 
00414     if (dlg.ShowModal() == wxID_OK)
00415     {
00416         wxArrayString paths;
00417         dlg.GetPaths(paths);
00418 #ifdef __WXGTK__
00419         //workaround a bug in GTK, see https://bugzilla.redhat.com/show_bug.cgi?id=849692 and http://trac.wxwidgets.org/ticket/14525
00420         wxConfig::Get()->Write(wxT("/BatchFrame/actualPath"), wxPathOnly(paths[0]));  // remember for later
00421 #else
00422         wxConfig::Get()->Write(wxT("/BatchFrame/actualPath"), dlg.GetDirectory());  // remember for later
00423 #endif
00424 
00425         for(unsigned int i=0; i<paths.GetCount(); i++)
00426         {
00427             AddToList(paths.Item(i),Project::DETECTING);
00428         }
00429         m_batch->SaveTemp();
00430     };
00431 }
00432 
00433 void BatchFrame::AddDirToList(wxString aDir)
00434 {
00435     //we traverse all subdirectories of chosen path
00436     DirTraverser traverser;
00437     wxDir dir(aDir);
00438     dir.Traverse(traverser);
00439     wxArrayString projects = traverser.GetProjectFiles();
00440     for(unsigned int i=0; i<projects.GetCount(); i++)
00441     {
00442         m_batch->AddProjectToBatch(projects.Item(i));
00443         Project* proj=m_batch->GetProject(m_batch->GetProjectCount()-1);
00444         if(!proj->isAligned)
00445         {
00446             proj->target=Project::DETECTING;
00447         };
00448         projListBox->AppendProject(proj);
00449     };
00450     m_batch->SaveTemp();
00451     SetStatusText(_("Added projects from dir ")+aDir);
00452 };
00453 
00454 void BatchFrame::AddToList(wxString aFile,Project::Target target)
00455 {
00456     wxFileName name(aFile);
00457     m_batch->AddProjectToBatch(aFile,wxT(""),target);
00458     wxString s;
00459     switch(target)
00460     {
00461         case Project::STITCHING:
00462             s=wxString::Format(_("Add project %s to stitching queue."),aFile.c_str());
00463             break;
00464         case Project::DETECTING:
00465             s=wxString::Format(_("Add project %s to assistant queue."),aFile.c_str());
00466             break;
00467     };
00468     SetStatusInformation(s,true);
00469     projListBox->AppendProject(m_batch->GetProject(m_batch->GetProjectCount()-1));
00470     m_batch->SaveTemp();
00471 }
00472 
00473 
00474 void BatchFrame::OnButtonCancel(wxCommandEvent& event)
00475 {
00476     GetToolBar()->ToggleTool(XRCID("tool_pause"),false);
00477     m_cancelled = true;
00478     m_batch->CancelBatch();
00479     SetStatusInformation(_("Batch stopped"),true);
00480 }
00481 
00482 void BatchFrame::OnButtonChangePrefix(wxCommandEvent& event)
00483 {
00484     int selIndex = projListBox->GetSelectedIndex();
00485     if(selIndex != -1)
00486     {
00487         if(projListBox->GetSelectedProjectTarget()==Project::STITCHING)
00488         {
00489             wxFileName prefix(projListBox->GetSelectedProjectPrefix());
00490             wxFileDialog dlg(0,_("Specify output prefix for project ")+projListBox->GetSelectedProject(),
00491                              prefix.GetPath(),
00492                              prefix.GetFullName(), wxT(""),
00493                              wxFD_SAVE, wxDefaultPosition);
00494             if (dlg.ShowModal() == wxID_OK)
00495             {
00496                 while(containsInvalidCharacters(dlg.GetPath()))
00497                 {
00498                     wxArrayString list;
00499                     list.Add(dlg.GetPath());
00500                     ShowFilenameWarning(this, list);
00501                     if(dlg.ShowModal()!=wxID_OK)
00502                     {
00503                         return;
00504                     }
00505                 };
00506                 wxString outname(dlg.GetPath());
00507                 ChangePrefix(selIndex,outname);
00508                 //SetStatusText(_T("Changed prefix for "+projListBox->GetSelectedProject()));
00509                 m_batch->SaveTemp();
00510             }
00511         }
00512         else
00513         {
00514             SetStatusText(_("The prefix of an assistant target cannot be changed."));
00515             wxBell();
00516         };
00517     }
00518     else
00519     {
00520         SetStatusText(_("Please select a project"));
00521     }
00522 }
00523 
00524 void BatchFrame::ChangePrefix(int index,wxString newPrefix)
00525 {
00526     int i;
00527     if(index!=-1)
00528     {
00529         i=index;
00530     }
00531     else
00532     {
00533         i=m_batch->GetProjectCount()-1;
00534     }
00535     m_batch->ChangePrefix(i,newPrefix);
00536     projListBox->ChangePrefix(i,newPrefix);
00537 }
00538 
00539 void BatchFrame::OnButtonClear(wxCommandEvent& event)
00540 {
00541     int returnCode = m_batch->ClearBatch();
00542     if(returnCode == 0)
00543     {
00544         projListBox->DeleteAllItems();
00545     }
00546     else if(returnCode == 2)
00547     {
00548         m_cancelled = true;
00549         projListBox->DeleteAllItems();
00550         if(GetToolBar()->GetToolState(XRCID("tool_pause")))
00551         {
00552             GetToolBar()->ToggleTool(XRCID("tool_pause"),false);
00553         }
00554     }
00555     m_batch->SaveTemp();
00556 }
00557 
00558 void BatchFrame::OnButtonHelp(wxCommandEvent& event)
00559 {
00560     DEBUG_TRACE("");
00561 #ifdef __WXMSW__
00562     GetHelpController().DisplaySection(wxT("Hugin_Batch_Processor.html"));
00563 #else
00564     if (m_help == 0)
00565     {
00566 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
00567         // On Mac, xrc/data/help_LOCALE should be in the bundle as LOCALE.lproj/help
00568         // which we can rely on the operating sytem to pick the right locale's.
00569         wxString strFile = MacGetPathToBundledResourceFile(CFSTR("help"));
00570         if(strFile!=wxT(""))
00571         {
00572             strFile += wxT("/hugin.hhp");
00573         }
00574         else
00575         {
00576             wxLogError(wxString::Format(wxT("Could not find help directory in the bundle"), strFile.c_str()));
00577             return;
00578         }
00579 #else
00580         // find base filename
00581         wxString helpFile = wxT("help_") + m_locale->GetCanonicalName() + wxT("/hugin.hhp");
00582         DEBUG_INFO("help file candidate: " << helpFile.mb_str(wxConvLocal));
00583         //if the language is not default, load custom About file (if exists)
00584         wxString strFile = m_xrcPrefix + wxT("data/") + helpFile;
00585         if(wxFile::Exists(strFile))
00586         {
00587             DEBUG_TRACE("Using About: " << strFile.mb_str(wxConvLocal));
00588         }
00589         else
00590         {
00591             // try default
00592             strFile = m_xrcPrefix + wxT("data/help_en_EN/hugin.hhp");
00593         }
00594 #endif
00595 
00596         if(!wxFile::Exists(strFile))
00597         {
00598             wxLogError(wxString::Format(wxT("Could not open help file: %s"), strFile.c_str()));
00599             return;
00600         }
00601         DEBUG_INFO(_("help file: ") << strFile.mb_str(wxConvLocal));
00602         m_help = new wxHtmlHelpController();
00603         m_help->AddBook(strFile);
00604     }
00605     m_help->Display(wxT("Hugin_Batch_Processor.html"));
00606     //DisplayHelp(wxT("Hugin_Batch_Processor.html"));
00607 #endif
00608 }
00609 
00610 void BatchFrame::OnButtonMoveDown(wxCommandEvent& event)
00611 {
00612     SwapProject(projListBox->GetSelectedIndex());
00613     m_batch->SaveTemp();
00614 }
00615 
00616 void BatchFrame::OnButtonMoveUp(wxCommandEvent& event)
00617 {
00618     SwapProject(projListBox->GetSelectedIndex()-1);
00619     m_batch->SaveTemp();
00620 }
00621 
00622 void BatchFrame::OnButtonOpenBatch(wxCommandEvent& event)
00623 {
00624     wxString defaultdir = wxConfigBase::Get()->Read(wxT("/BatchFrame/batchPath"),wxT(""));
00625     wxFileDialog dlg(0,
00626                      _("Specify batch file to open"),
00627                      defaultdir, wxT(""),
00628                      _("Batch files (*.ptb)|*.ptb;|All files (*)|*"),
00629                      wxFD_OPEN, wxDefaultPosition);
00630     if (dlg.ShowModal() == wxID_OK)
00631     {
00632         wxConfig::Get()->Write(wxT("/BatchFrame/batchPath"), dlg.GetDirectory());  // remember for later
00633         int clearCode = m_batch->LoadBatchFile(dlg.GetPath());
00634         //1 is error code for not clearing batch
00635         if(clearCode!=1)
00636         {
00637             /*if(clearCode==2) //we just cancelled the batch, so we need to try loading again
00638                 m_batch->LoadBatchFile(dlg.GetPath());*/
00639             projListBox->DeleteAllItems();
00640             projListBox->Fill(m_batch);
00641             m_batch->SaveTemp();
00642         }
00643     }
00644 }
00645 
00646 void BatchFrame::OnButtonOpenWithHugin(wxCommandEvent& event)
00647 {
00648 #ifdef __WINDOWS__
00649     wxString huginPath = getExePath(wxGetApp().argv[0])+wxFileName::GetPathSeparator();
00650 #else
00651     wxString huginPath = _T("");        //we call hugin directly without path on linux
00652 #endif
00653     if(projListBox->GetSelectedIndex()!=-1)
00654         if(projListBox->GetText(projListBox->GetSelectedIndex(),0).Cmp(_T(""))!=0)
00655 #ifdef __WXMAC__
00656             wxExecute(_T("open -b net.sourceforge.hugin.hugin \"" + projListBox->GetSelectedProject()+_T("\"")));
00657 #else
00658             wxExecute(huginPath+_T("hugin \"" + projListBox->GetSelectedProject()+_T("\" -notips")));
00659 #endif
00660         else
00661         {
00662             SetStatusText(_("Cannot open app in Hugin."));
00663         }
00664     else
00665     {
00666         //ask user if he/she wants to load an empty project
00667         wxMessageDialog message(this,_("No project selected. Open Hugin without project?"),
00668 #ifdef _WINDOWS
00669                                 _("PTBatcherGUI"),
00670 #else
00671                                 wxT(""),
00672 #endif
00673                                 wxYES | wxNO | wxICON_INFORMATION );
00674         if(message.ShowModal() == wxID_YES)
00675         {
00676 #ifdef __WXMAC__
00677             wxExecute(_T("open -b net.sourceforge.hugin.hugin"));
00678 #else
00679             wxExecute(huginPath+_T("hugin"));
00680 #endif
00681         }
00682     }
00683 }
00684 
00685 void BatchFrame::OnButtonPause(wxCommandEvent& event)
00686 {
00687     if(m_batch->GetRunningCount()>0)
00688     {
00689         if(!m_batch->IsPaused())
00690         {
00691             m_batch->PauseBatch();
00692             GetToolBar()->ToggleTool(XRCID("tool_pause"),true);
00693             SetStatusInformation(_("Batch paused"),true);
00694         }
00695         else
00696         {
00697             m_batch->PauseBatch();
00698             GetToolBar()->ToggleTool(XRCID("tool_pause"),false);
00699             SetStatusInformation(_("Continuing batch..."),true);
00700         }
00701     }
00702     else //if no projects are running, we deactivate the button
00703     {
00704         GetToolBar()->ToggleTool(XRCID("tool_pause"),false);
00705     }
00706 }
00707 
00708 void BatchFrame::OnButtonRemoveComplete(wxCommandEvent& event)
00709 {
00710     bool removeErrors=false;
00711     if(!m_batch->NoErrors())
00712     {
00713         wxMessageDialog message(this,_("There are failed projects in the list.\nRemove them too?"),
00714 #ifdef _WINDOWS
00715                                 _("PTBatcherGUI"),
00716 #else
00717                                 wxT(""),
00718 #endif
00719                                 wxYES | wxNO | wxICON_INFORMATION );
00720         if(message.ShowModal()==wxID_YES)
00721         {
00722             removeErrors=true;
00723         }
00724     }
00725     for(int i=projListBox->GetItemCount()-1; i>=0; i--)
00726     {
00727         if(m_batch->GetStatus(i)==Project::FINISHED ||
00728                 (removeErrors && m_batch->GetStatus(i)==Project::FAILED))
00729         {
00730             projListBox->Deselect(i);
00731             projListBox->DeleteItem(i);
00732             m_batch->RemoveProjectAtIndex(i);
00733         }
00734     }
00735     m_batch->SaveTemp();
00736 }
00737 
00738 void BatchFrame::OnButtonRemoveFromList(wxCommandEvent& event)
00739 {
00740     int selIndex = projListBox->GetSelectedIndex();
00741     if(selIndex != -1)
00742     {
00743         if(m_batch->GetStatus(selIndex)==Project::RUNNING || m_batch->GetStatus(selIndex)==Project::PAUSED)
00744         {
00745             wxMessageDialog message(this, _("Cannot remove project in progress.\nDo you want to cancel it?"),
00746 #ifdef _WINDOWS
00747                                     _("PTBatcherGUI"),
00748 #else
00749                                     wxT(""),
00750 #endif
00751                                     wxYES | wxCANCEL | wxICON_INFORMATION);
00752             if(message.ShowModal()==wxID_YES)
00753             {
00754                 OnButtonSkip(event);
00755             }
00756         }
00757         else
00758         {
00759             SetStatusText(_("Removed project ")+projListBox->GetSelectedProject());
00760             projListBox->Deselect(selIndex);
00761             projListBox->DeleteItem(selIndex);
00762             m_batch->RemoveProjectAtIndex(selIndex);
00763             m_batch->SaveTemp();
00764         }
00765     }
00766     else
00767     {
00768         SetStatusText(_("Please select a project to remove"));
00769     }
00770 }
00771 
00772 
00773 void BatchFrame::OnButtonReset(wxCommandEvent& event)
00774 {
00775     int selIndex = projListBox->GetSelectedIndex();
00776     if(selIndex != -1)
00777     {
00778         if(m_batch->GetStatus(selIndex)==Project::RUNNING || m_batch->GetStatus(selIndex)==Project::PAUSED)
00779         {
00780             wxMessageDialog message(this, _("Cannot reset project in progress.\nDo you want to cancel it?"),
00781 #ifdef _WINDOWS
00782                                     _("PTBatcherGUI"),
00783 #else
00784                                     wxT(""),
00785 #endif
00786                                     wxYES | wxCANCEL | wxICON_INFORMATION);
00787             if(message.ShowModal()==wxID_YES)
00788             {
00789                 OnButtonSkip(event);
00790             }
00791         }
00792         else
00793         {
00794             m_batch->SetStatus(selIndex,Project::WAITING);
00795             SetStatusText(_("Reset project ")+projListBox->GetSelectedProject());
00796         }
00797     }
00798     else
00799     {
00800         SetStatusText(_("Please select a project to reset"));
00801     }
00802     m_batch->SaveTemp();
00803 }
00804 
00805 void BatchFrame::OnButtonResetAll(wxCommandEvent& event)
00806 {
00807     if(m_batch->GetRunningCount()!=0)
00808     {
00809         wxMessageDialog message(this, _("Cannot reset projects in progress.\nDo you want to cancel the batch?"),
00810 #ifdef _WINDOWS
00811                                 _("PTBatcherGUI"),
00812 #else
00813                                 wxT(""),
00814 #endif
00815                                 wxYES | wxCANCEL | wxICON_INFORMATION);
00816         if(message.ShowModal()==wxID_YES)
00817         {
00818             OnButtonCancel(event);
00819         }
00820     }
00821     else
00822     {
00823         for(int i=projListBox->GetItemCount()-1; i>=0; i--)
00824         {
00825             m_batch->SetStatus(i,Project::WAITING);
00826         }
00827     }
00828     m_batch->SaveTemp();
00829 }
00830 
00831 void BatchFrame::OnButtonRunBatch(wxCommandEvent& event)
00832 {
00833     if(m_batch->IsPaused())
00834     {
00835         //m_batch->paused = false;
00836         OnButtonPause(event);
00837     }
00838     else
00839     {
00840         RunBatch();
00841     }
00842 }
00843 
00844 void BatchFrame::OnButtonSaveBatch(wxCommandEvent& event)
00845 {
00846     wxString defaultdir = wxConfigBase::Get()->Read(wxT("/BatchFrame/batchPath"),wxT(""));
00847     wxFileDialog dlg(0,
00848                      _("Specify batch file to save"),
00849                      defaultdir, wxT(""),
00850                      _("Batch file (*.ptb)|*.ptb;|All files (*)|*"),
00851                      wxFD_SAVE, wxDefaultPosition);
00852     if (dlg.ShowModal() == wxID_OK)
00853     {
00854         wxConfig::Get()->Write(wxT("/BatchFrame/batchPath"), dlg.GetDirectory());  // remember for later
00855         m_batch->SaveBatchFile(dlg.GetPath());
00856     }
00857 }
00858 
00859 void BatchFrame::OnButtonSkip(wxCommandEvent& event)
00860 {
00861     int selIndex = projListBox->GetSelectedIndex();
00862     if(selIndex != -1)
00863     {
00864         if(m_batch->GetStatus(selIndex)==Project::RUNNING
00865                 ||m_batch->GetStatus(selIndex)==Project::PAUSED)
00866         {
00867             if(m_batch->GetStatus(selIndex)==Project::PAUSED)
00868             {
00869                 if(m_batch->GetRunningCount()==1)
00870                 {
00871                     GetToolBar()->ToggleTool(XRCID("tool_pause"),false);
00872                 }
00873                 for(int i=0; i<m_batch->GetRunningCount(); i++)
00874                 {
00875                     if(m_batch->GetStatus(selIndex)==Project::PAUSED
00876                             && m_batch->CompareProjectsInLists(i,selIndex))
00877                     {
00878                         m_batch->CancelProject(i);
00879                     }
00880                 }
00881             }
00882             else
00883             {
00884                 //we go through all running projects to find the one with the same id as chosen one
00885                 for(int i=0; i<m_batch->GetRunningCount(); i++)
00886                 {
00887                     if(m_batch->GetStatus(selIndex)==Project::RUNNING
00888                             && m_batch->CompareProjectsInLists(i,selIndex))
00889                     {
00890                         m_batch->CancelProject(i);
00891                     }
00892                 }
00893             }
00894         }
00895         else
00896         {
00897             m_batch->SetStatus(selIndex,Project::FAILED);
00898         }
00899     }
00900 }
00901 
00902 void BatchFrame::SetCheckboxes()
00903 {
00904     wxConfigBase* config=wxConfigBase::Get();
00905     int i;
00906     i=config->Read(wxT("/BatchFrame/ParallelCheck"), 0l);
00907     XRCCTRL(*this,"cb_parallel",wxCheckBox)->SetValue(i!=0);
00908     i=config->Read(wxT("/BatchFrame/ShutdownCheck"), 0l);
00909     XRCCTRL(*this,"cb_shutdown",wxCheckBox)->SetValue(i!=0);
00910     i=config->Read(wxT("/BatchFrame/OverwriteCheck"), 0l);
00911     XRCCTRL(*this,"cb_overwrite",wxCheckBox)->SetValue(i!=0);
00912     i=config->Read(wxT("/BatchFrame/VerboseCheck"), 0l);
00913     XRCCTRL(*this,"cb_verbose",wxCheckBox)->SetValue(i!=0);
00914     i=config->Read(wxT("/BatchFrame/AutoRemoveCheck"), 0l);
00915     XRCCTRL(*this,"cb_autoremove",wxCheckBox)->SetValue(i!=0);
00916     i=config->Read(wxT("/BatchFrame/AutoStitchCheck"), 0l);
00917     XRCCTRL(*this,"cb_autostitch",wxCheckBox)->SetValue(i!=0);
00918     i=config->Read(wxT("/BatchFrame/SaveLog"), 0l);
00919     XRCCTRL(*this, "cb_savelog",wxCheckBox)->SetValue(i!=0);
00920 };
00921 
00922 bool BatchFrame::GetCheckParallel()
00923 {
00924     return XRCCTRL(*this,"cb_parallel",wxCheckBox)->IsChecked();
00925 };
00926 
00927 bool BatchFrame::GetCheckShutdown()
00928 {
00929     return XRCCTRL(*this,"cb_shutdown",wxCheckBox)->IsChecked();
00930 };
00931 
00932 bool BatchFrame::GetCheckOverwrite()
00933 {
00934     return XRCCTRL(*this,"cb_overwrite",wxCheckBox)->IsChecked();
00935 };
00936 
00937 bool BatchFrame::GetCheckVerbose()
00938 {
00939     return XRCCTRL(*this,"cb_verbose",wxCheckBox)->IsChecked();
00940 };
00941 
00942 bool BatchFrame::GetCheckAutoRemove()
00943 {
00944     return XRCCTRL(*this,"cb_autoremove",wxCheckBox)->IsChecked();
00945 };
00946 
00947 bool BatchFrame::GetCheckAutoStitch()
00948 {
00949     return XRCCTRL(*this,"cb_autostitch",wxCheckBox)->IsChecked();
00950 };
00951 
00952 bool BatchFrame::GetCheckSaveLog()
00953 {
00954     return XRCCTRL(*this,"cb_savelog",wxCheckBox)->IsChecked();
00955 };
00956 
00957 void BatchFrame::OnCheckOverwrite(wxCommandEvent& event)
00958 {
00959     if(event.IsChecked())
00960     {
00961         m_batch->overwrite = true;
00962         wxConfigBase::Get()->Write(wxT("/BatchFrame/OverwriteCheck"), 1l);
00963     }
00964     else
00965     {
00966         m_batch->overwrite = false;
00967         wxConfigBase::Get()->Write(wxT("/BatchFrame/OverwriteCheck"), 0l);
00968     }
00969 }
00970 
00971 void BatchFrame::OnCheckParallel(wxCommandEvent& event)
00972 {
00973     if(event.IsChecked())
00974     {
00975         m_batch->parallel = true;
00976         wxConfigBase::Get()->Write(wxT("/BatchFrame/ParallelCheck"), 1l);
00977     }
00978     else
00979     {
00980         m_batch->parallel = false;
00981         wxConfigBase::Get()->Write(wxT("/BatchFrame/ParallelCheck"), 0l);
00982     }
00983 }
00984 
00985 void BatchFrame::OnCheckShutdown(wxCommandEvent& event)
00986 {
00987     if(event.IsChecked())
00988     {
00989         m_batch->shutdown = true;
00990         wxConfigBase::Get()->Write(wxT("/BatchFrame/ShutdownCheck"), 1l);
00991     }
00992     else
00993     {
00994         m_batch->shutdown = false;
00995         wxConfigBase::Get()->Write(wxT("/BatchFrame/ShutdownCheck"), 0l);
00996     }
00997 }
00998 
00999 void BatchFrame::OnCheckVerbose(wxCommandEvent& event)
01000 {
01001     if(event.IsChecked())
01002     {
01003         m_batch->verbose = true;
01004         wxConfigBase::Get()->Write(wxT("/BatchFrame/VerboseCheck"), 1l);
01005     }
01006     else
01007     {
01008         m_batch->verbose = false;
01009         wxConfigBase::Get()->Write(wxT("/BatchFrame/VerboseCheck"), 0l);
01010     }
01011     m_batch->ShowOutput(m_batch->verbose);
01012 }
01013 
01014 void BatchFrame::SetInternalVerbose(bool newVerbose)
01015 {
01016     m_batch->verbose=newVerbose;
01017 };
01018 
01019 void BatchFrame::OnCheckAutoRemove(wxCommandEvent& event)
01020 {
01021     m_batch->autoremove=event.IsChecked();
01022     wxConfigBase* config=wxConfigBase::Get();
01023     if(m_batch->autoremove)
01024     {
01025         config->Write(wxT("/BatchFrame/AutoRemoveCheck"), 1l);
01026     }
01027     else
01028     {
01029         config->Write(wxT("/BatchFrame/AutoRemoveCheck"), 0l);
01030     }
01031     config->Flush();
01032 };
01033 
01034 void BatchFrame::OnCheckAutoStitch(wxCommandEvent& event)
01035 {
01036     m_batch->autostitch=event.IsChecked();
01037     wxConfigBase* config=wxConfigBase::Get();
01038     if(m_batch->autostitch)
01039     {
01040         config->Write(wxT("/BatchFrame/AutoStitchCheck"), 1l);
01041     }
01042     else
01043     {
01044         config->Write(wxT("/BatchFrame/AutoStitchCheck"), 0l);
01045     }
01046     config->Flush();
01047 };
01048 
01049 void BatchFrame::OnCheckSaveLog(wxCommandEvent& event)
01050 {
01051     m_batch->saveLog=event.IsChecked();
01052     wxConfigBase* config=wxConfigBase::Get();
01053     if(m_batch->saveLog)
01054     {
01055         config->Write(wxT("/BatchFrame/SaveLog"), 1l);
01056     }
01057     else
01058     {
01059         config->Write(wxT("/BatchFrame/SaveLog"), 0l);
01060     }
01061     config->Flush();
01062 };
01063 
01064 void BatchFrame::OnClose(wxCloseEvent& event)
01065 {
01066     //save windows position
01067     wxConfigBase* config=wxConfigBase::Get();
01068     if(IsMaximized())
01069     {
01070         config->Write(wxT("/BatchFrame/Max"), 1l);
01071         config->Write(wxT("/BatchFrame/Minimized"), 0l);
01072     }
01073     else
01074     {
01075         config->Write(wxT("/BatchFrame/Max"), 0l);
01076         if(m_tray!=NULL && !IsShown())
01077         {
01078             config->Write(wxT("/BatchFrame/Minimized"), 1l);
01079         }
01080         else
01081         {
01082             config->Write(wxT("/BatchFrame/Minimized"), 0l);
01083             config->Write(wxT("/BatchFrame/Width"), GetSize().GetWidth());
01084             config->Write(wxT("/BatchFrame/Height"), GetSize().GetHeight());
01085         };
01086     }
01087     config->Flush();
01088     m_closeThread = true;
01089     this->GetThread()->Wait();
01090 #ifndef __WXMSW__
01091     delete m_help;
01092 #endif
01093     if(m_tray!=NULL)
01094     {
01095         delete m_tray;
01096     }
01097     this->Destroy();
01098 }
01099 
01100 void BatchFrame::PropagateDefaults()
01101 {
01102     m_batch->parallel=GetCheckParallel();
01103     m_batch->shutdown=GetCheckShutdown();
01104     m_batch->overwrite=GetCheckOverwrite();
01105     m_batch->verbose=GetCheckVerbose();
01106     m_batch->autoremove=GetCheckAutoRemove();
01107     m_batch->autostitch=GetCheckAutoStitch();
01108 }
01109 
01110 void BatchFrame::RunBatch()
01111 {
01112     if(!IsRunning())
01113     {
01114         SetStatusInformation(_("Starting batch"),true);
01115     }
01116     m_batch->RunBatch();
01117 }
01118 
01119 void BatchFrame::SetLocaleAndXRC(wxLocale* locale, wxString xrc)
01120 {
01121     m_locale = locale;
01122     m_xrcPrefix = xrc;
01123 }
01124 
01125 void BatchFrame::SwapProject(int index)
01126 {
01127     if(index>=0 && index<(projListBox->GetItemCount()-1))
01128     {
01129         projListBox->SwapProject(index);
01130         m_batch->SwapProject(index);
01131         if(projListBox->GetSelectedIndex()==index)
01132         {
01133             projListBox->Select(index+1);
01134         }
01135         else
01136         {
01137             projListBox->Select(index);
01138         }
01139     }
01140 }
01141 
01142 
01143 void BatchFrame::OnProcessTerminate(wxProcessEvent& event)
01144 {
01145     if(m_batch->GetRunningCount()==1)
01146     {
01147         GetToolBar()->ToggleTool(XRCID("tool_pause"),false);
01148     }
01149     event.Skip();
01150 }
01151 
01152 void BatchFrame::RestoreSize()
01153 {
01154     //get saved size
01155     wxConfigBase* config=wxConfigBase::Get();
01156     int width = config->Read(wxT("/BatchFrame/Width"), -1l);
01157     int height = config->Read(wxT("/BatchFrame/Height"), -1l);
01158     int max = config->Read(wxT("/BatchFrame/Max"), -1l);
01159     int min = config->Read(wxT("/BatchFrame/Minimized"), -1l);
01160     if((width != -1) && (height != -1))
01161     {
01162         SetSize(width,height);
01163     }
01164     else
01165     {
01166         SetSize(600,400);
01167     }
01168 
01169     if(max==1)
01170     {
01171         Maximize();
01172     };
01173     m_startedMinimized=(m_tray!=NULL) && (min==1);
01174 }
01175 
01176 void BatchFrame::OnBatchFailed(wxCommandEvent& event)
01177 {
01178     if(m_batch->GetFailedProjectsCount()>0)
01179     {
01180         FailedProjectsDialog failedProjects_dlg(this,m_batch,m_xrcPrefix);
01181         failedProjects_dlg.ShowModal();
01182     };
01183 };
01184 
01185 void BatchFrame::OnBatchInformation(wxCommandEvent& e)
01186 {
01187     SetStatusInformation(e.GetString(),true);
01188 };
01189 
01190 void BatchFrame::SetStatusInformation(wxString status,bool showBalloon)
01191 {
01192     SetStatusText(status);
01193     if(m_tray!=NULL && showBalloon)
01194     {
01195 #if defined __WXMSW__ && wxUSE_TASKBARICON_BALLOONS && wxCHECK_VERSION(2,9,0)
01196         m_tray->ShowBalloon(_("PTBatcherGUI"),status,5000,wxICON_INFORMATION);
01197 #else
01198 #ifndef __WXMAC__
01199         // the balloon does not work correctly on MacOS; it gets the focus
01200         // and can not be closed
01201         if(!IsShown())
01202         {
01203             TaskBarBalloon* balloon=new TaskBarBalloon(_("PTBatcherGUI"),status);
01204             balloon->showBalloon(5000);
01205         };
01206 #endif
01207 #endif
01208     };
01209 };
01210 
01211 void BatchFrame::OnMinimize(wxIconizeEvent& e)
01212 {
01213     //hide/show window in taskbar when minimizing
01214     if(m_tray!=NULL)
01215     {
01216 #if wxCHECK_VERSION(2,9,0)
01217         Show(!e.IsIconized());
01218         //switch off verbose output if PTBatcherGUI is in tray/taskbar
01219         if(e.IsIconized())
01220 #else
01221         Show(!e.Iconized());
01222         //switch off verbose output if PTBatcherGUI is in tray/taskbar
01223         if(e.Iconized())
01224 #endif
01225         {
01226             m_batch->verbose=false;
01227         }
01228         else
01229         {
01230             m_batch->verbose=XRCCTRL(*this,"cb_verbose",wxCheckBox)->IsChecked();
01231         };
01232         m_batch->ShowOutput(m_batch->verbose);
01233     }
01234     else //don't hide window if no tray icon
01235     {
01236         e.Skip();
01237     };
01238 };
01239 
01240 void BatchFrame::UpdateBatchVerboseStatus()
01241 {
01242     m_batch->verbose=XRCCTRL(*this,"cb_verbose",wxCheckBox)->IsChecked();
01243     m_batch->ShowOutput(m_batch->verbose);
01244 };
01245 
01246 void BatchFrame::OnRefillListBox(wxCommandEvent& event)
01247 {
01248     int index=projListBox->GetSelectedIndex();
01249     int id=-1;
01250     if(index!=-1)
01251     {
01252         id=projListBox->GetProjectId(index);
01253     };
01254     projListBox->DeleteAllItems();
01255     projListBox->Fill(m_batch);
01256     if(id!=-1)
01257     {
01258         index=projListBox->GetIndex(id);
01259         if(index!=-1)
01260         {
01261             projListBox->Select(index);
01262         };
01263     };
01264 };

Generated on Wed May 22 01:25:37 2013 for Hugintrunk by  doxygen 1.3.9.1