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

Generated on Tue Sep 16 01:25:38 2014 for Hugintrunk by  doxygen 1.3.9.1