227
227
m_FileFormatChoice = XRCCTRL(*this, "pano_choice_file_format", wxChoice);
228
228
DEBUG_ASSERT(m_FileFormatChoice);
229
m_FileFormatPanelJPEG = XRCCTRL(*this, "pano_output_normal_opts_jpeg", wxPanel);
230
DEBUG_ASSERT(m_FileFormatPanelJPEG);
229
m_FileFormatOptionsLabel = XRCCTRL(*this, "pano_output_ldr_format_options_label", wxStaticText);
231
231
m_FileFormatJPEGQualityText = XRCCTRL(*this, "pano_output_normal_opts_jpeg_quality", wxTextCtrl);
232
232
DEBUG_ASSERT(m_FileFormatJPEGQualityText);
233
233
m_FileFormatJPEGQualityText->PushEventHandler(new TextKillFocusHandler(this));
235
m_FileFormatPanelTIFF = XRCCTRL(*this, "pano_output_normal_opts_tiff", wxPanel);
236
DEBUG_ASSERT(m_FileFormatPanelTIFF);
237
235
m_FileFormatTIFFCompChoice = XRCCTRL(*this, "pano_output_normal_opts_tiff_compression", wxChoice);
238
236
DEBUG_ASSERT(m_FileFormatTIFFCompChoice);
240
238
m_HDRFileFormatChoice = XRCCTRL(*this, "pano_choice_hdr_file_format", wxChoice);
241
239
DEBUG_ASSERT(m_HDRFileFormatChoice);
242
m_HDRFileFormatPanelTIFF = XRCCTRL(*this, "pano_output_hdr_opts_tiff", wxPanel);
243
DEBUG_ASSERT(m_HDRFileFormatPanelTIFF);
240
m_HDRFileFormatLabelTIFFCompression = XRCCTRL(*this, "pano_output_hdr_opts_tiff_compression_label", wxStaticText);
241
DEBUG_ASSERT(m_HDRFileFormatLabelTIFFCompression);
244
242
m_FileFormatHDRTIFFCompChoice = XRCCTRL(*this, "pano_output_hdr_opts_tiff_compression", wxChoice);
245
243
DEBUG_ASSERT(m_FileFormatHDRTIFFCompChoice);
464
454
opt.outputLDRExposureLayers ||
465
455
opt.outputHDRBlended;
467
m_BlenderChoice->Show(blenderEnabled);
468
XRCCTRL(*this, "pano_button_blender_opts", wxButton)->Show(blenderEnabled);
469
XRCCTRL(*this, "pano_text_blender", wxStaticText)->Show(blenderEnabled);
457
m_BlenderChoice->Enable(blenderEnabled);
458
XRCCTRL(*this, "pano_button_blender_opts", wxButton)->Enable(blenderEnabled);
459
XRCCTRL(*this, "pano_text_blender", wxStaticText)->Enable(blenderEnabled);
471
461
bool fusionEnabled = (opt.outputLDRExposureBlended || opt.outputLDRExposureLayersFused);
472
m_FusionChoice->Show(fusionEnabled);
473
XRCCTRL(*this, "pano_button_fusion_opts", wxButton)->Show(fusionEnabled);
474
XRCCTRL(*this, "pano_text_fusion", wxStaticText)->Show(fusionEnabled);
462
m_FusionChoice->Enable(fusionEnabled);
463
XRCCTRL(*this, "pano_button_fusion_opts", wxButton)->Enable(fusionEnabled);
464
XRCCTRL(*this, "pano_text_fusion", wxStaticText)->Enable(fusionEnabled);
476
466
bool hdrMergeEnabled = opt.outputHDRBlended || opt.outputHDRStacks;
477
m_HDRMergeChoice->Show(hdrMergeEnabled);
478
XRCCTRL(*this, "pano_button_hdrmerge_opts", wxButton)->Show(hdrMergeEnabled);
479
XRCCTRL(*this, "pano_text_hdrmerge", wxStaticText)->Show(hdrMergeEnabled);
467
m_HDRMergeChoice->Enable(hdrMergeEnabled);
468
XRCCTRL(*this, "pano_button_hdrmerge_opts", wxButton)->Enable(hdrMergeEnabled);
469
XRCCTRL(*this, "pano_text_hdrmerge", wxStaticText)->Enable(hdrMergeEnabled);
481
471
// output file mode
472
bool ldr_pano_enabled = opt.outputLDRBlended ||
473
opt.outputLDRExposureBlended ||
474
opt.outputLDRExposureLayersFused;
476
XRCCTRL(*this, "pano_output_ldr_format_label", wxStaticText)->Enable(ldr_pano_enabled);
477
m_FileFormatOptionsLabel->Enable(ldr_pano_enabled);
478
m_FileFormatChoice->Enable(ldr_pano_enabled);
479
m_FileFormatJPEGQualityText->Enable(ldr_pano_enabled);
480
m_FileFormatTIFFCompChoice->Enable(ldr_pano_enabled);
483
483
if (opt.outputImageType == "tif") {
485
m_FileFormatPanelJPEG->Hide();
486
m_FileFormatPanelTIFF->Show();
485
m_FileFormatOptionsLabel->Show();
486
m_FileFormatOptionsLabel->SetLabel(_("Compression:"));
487
m_FileFormatJPEGQualityText->Hide();
488
m_FileFormatTIFFCompChoice->Show();
487
489
if (opt.outputImageTypeCompression == "PACKBITS") {
488
490
m_FileFormatTIFFCompChoice->SetSelection(1);
489
491
} else if (opt.outputImageTypeCompression == "LZW") {
490
492
m_FileFormatTIFFCompChoice->SetSelection(2);
491
} else if (opt.outputImageTypeCompression == "DEFLATE") {
493
} else if (opt.outputImageTypeCompression == "DEFLATE") {
492
494
m_FileFormatTIFFCompChoice->SetSelection(3);
494
496
m_FileFormatTIFFCompChoice->SetSelection(0);
496
498
} else if (opt.outputImageType == "jpg") {
498
m_FileFormatPanelJPEG->Show();
499
m_FileFormatPanelTIFF->Hide();
500
m_FileFormatOptionsLabel->Show();
501
m_FileFormatOptionsLabel->SetLabel(_("Quality:"));
502
m_FileFormatJPEGQualityText->Show();
503
m_FileFormatTIFFCompChoice->Hide();
500
504
m_FileFormatJPEGQualityText->SetValue(wxString::Format(wxT("%d"), opt.quality));
501
505
} else if (opt.outputImageType == "png") {
502
m_FileFormatPanelJPEG->Hide();
503
m_FileFormatPanelTIFF->Hide();
506
m_FileFormatOptionsLabel->Hide();
507
m_FileFormatJPEGQualityText->Hide();
508
m_FileFormatTIFFCompChoice->Hide();
505
510
} else if (opt.outputImageType == "exr") {
506
m_FileFormatPanelJPEG->Hide();
507
m_FileFormatPanelTIFF->Hide();
511
/// @todo Is this right? I don't see a 4th item in the combo box, and exr is a confusing LDR format.
512
m_FileFormatOptionsLabel->Hide();
513
m_FileFormatJPEGQualityText->Hide();
514
m_FileFormatTIFFCompChoice->Hide();
510
517
wxLogError(wxT("INTERNAL error: unknown output image type"));
512
519
m_FileFormatChoice->SetSelection(i);
521
bool hdr_pano_enabled = opt.outputHDRBlended;
523
XRCCTRL(*this, "pano_output_hdr_format_label", wxStaticText)->Enable(hdr_pano_enabled);
524
m_HDRFileFormatChoice->Enable(hdr_pano_enabled);
525
m_HDRFileFormatLabelTIFFCompression->Enable(hdr_pano_enabled);
526
m_FileFormatHDRTIFFCompChoice->Enable(hdr_pano_enabled);
515
529
if (opt.outputImageTypeHDR == "exr") {
517
m_HDRFileFormatPanelTIFF->Hide();
531
m_HDRFileFormatLabelTIFFCompression->Hide();
532
m_FileFormatHDRTIFFCompChoice->Hide();
518
533
} else if (opt.outputImageTypeHDR == "tif") {
520
m_HDRFileFormatPanelTIFF->Show();
535
m_HDRFileFormatLabelTIFFCompression->Show();
536
m_FileFormatHDRTIFFCompChoice->Show();
521
537
if (opt.outputImageTypeHDRCompression == "PACKBITS") {
522
538
m_FileFormatHDRTIFFCompChoice->SetSelection(1);
523
539
} else if (opt.outputImageTypeHDRCompression == "LZW") {
524
540
m_FileFormatHDRTIFFCompChoice->SetSelection(2);
525
} else if (opt.outputImageTypeHDRCompression == "DEFLATE") {
541
} else if (opt.outputImageTypeHDRCompression == "DEFLATE") {
526
542
m_FileFormatHDRTIFFCompChoice->SetSelection(3);
528
544
m_FileFormatHDRTIFFCompChoice->SetSelection(0);
1004
1025
wxString hugin_stitch_project = wxT("hugin_stitch_project");
1008
wxFileName prefixFN(ptofile);
1028
// Derive a default output prefix from the project filename if set, otherwise default project filename
1029
wxString ptofile = MainFrame::Get()->getProjectName();
1009
1030
wxString outputPrefix;
1010
if (prefixFN.GetExt() == wxT("pto")) {
1011
outputPrefix = prefixFN.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, wxPATH_NATIVE) + prefixFN.GetName();
1031
if (ptofile == wxT("")) {
1032
outputPrefix = getDefaultProjectName(*pano);
1013
outputPrefix = ptofile;
1017
//TODO: don't overwrite files without warning!
1018
// wxString command = hugin_stitch_project + wxT(" -o ") + wxQuoteFilename(outputPrefix) + wxT(" ") + wxQuoteFilename(ptofile);
1019
wxString command = hugin_stitch_project + wxT(" -d ") + wxQuoteFilename(currentPTOfn);
1034
wxFileName prefixFN(ptofile);
1035
if (prefixFN.GetExt() == wxT("pto")) {
1036
outputPrefix = prefixFN.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, wxPATH_NATIVE) + prefixFN.GetName();
1038
outputPrefix = ptofile;
1042
// Show a file save dialog so user can confirm/change the prefix.
1043
// (We don't have to worry about overwriting existing files, since hugin_switch_project checks this.)
1044
// TODO: The following code is similar to stitchApp::OnInit in hugin_switch_project.cpp. Should be refactored.
1045
// TODO: We should save the output prefix somewhere, so we can recall it as the default if the user stitches this project again.
1047
wxFileDialog dlg(this,_("Specify output prefix"),
1048
wxConfigBase::Get()->Read(wxT("/actualPath"),wxT("")),
1049
outputPrefix, wxT(""),
1050
wxFD_SAVE, wxDefaultPosition);
1051
dlg.SetDirectory(wxConfigBase::Get()->Read(wxT("/actualPath"),wxT("")));
1053
if (dlg.ShowModal() != wxID_OK)
1055
if (containsInvalidCharacters(dlg.GetPath())) {
1056
wxMessageBox(wxString::Format(_("The given filename contains one of the following invalid characters: %s\nHugin can not work with this filename. Please enter a valid filename."),getInvalidCharacters().c_str()),
1057
_("Error"),wxOK | wxICON_EXCLAMATION);
1058
} else { // successful
1059
wxConfig::Get()->Write(wxT("/actualPath"), dlg.GetDirectory()); // remember for later
1060
outputPrefix = dlg.GetPath();
1066
wxString command = hugin_stitch_project + wxT(" -o ") + wxQuoteFilename(outputPrefix) + wxT(" ") + wxQuoteFilename(currentPTOfn);
1021
1068
wxConfigBase::Get()->Flush();
1022
1069
#ifdef __WXGTK__
1316
bool PanoPanel::CheckGoodSize()
1318
vigra::Rect2D cropped_region = pano->getOptions().getROI();
1319
unsigned long long int area = ((unsigned long int) cropped_region.width()) * ((unsigned long int) cropped_region.height());
1320
// Argh, more than half a gigapixel!
1321
if (area > 500000000)
1323
// Tell the user the stitch will be really big, and give them a
1324
// chance to reduce the size.
1325
#if wxCHECK_VERSION(2,9,0)
1326
wxMessageDialog dialog(this,
1327
_("Are you sure you want to stitch such a large panorama?"),
1333
wxICON_EXCLAMATION | wxYES_NO);
1334
dialog.SetExtendedMessage(
1335
wxString::Format(_("The panorama you are trying to stitch is %.1f gigapixels.\nIf this is too big, reduce the panorama Canvas Size and the cropped region and stitch from the Stitcher tab. Stitching a panorama this size could take a long time and a large amount of memory."),
1336
area / 1000000000.0));
1337
dialog.SetYesNoLabels(_("Stitch anyway"), _("Let me fix that"));
1338
#else // replacement for old wxWidgets versions.
1339
// wxMessageDialog derives from wxDialog, but I don't understand
1340
// why because on most platforms wxMessageDialog uses the native
1341
// message box, and trying to make descriptive buttons through
1342
// wxDialog::CreateStdButtonSizer causes a crash on wxGTK.
1343
// Descriptive buttons are recommended by the Windows, Gnome, KDE,
1344
// and Apple user interface guidelines.
1345
// Due to this wxWidgets WTF, the buttons will are labeled Yes and
1346
// No on wxWidgets 2.8 and earlier. This makes it a little
1347
// confusing, and it is more likely someone will just click yes
1348
// without reading the message and then wonder why their computer
1349
// has ground to a halt.
1350
/** @todo (Possibly) make a dialog manually with properly labelled
1353
wxMessageDialog dialog(this,
1354
wxString::Format(_("Are you sure you want to stitch such a large panorama?\n\nThe panorama you are trying to stitch is %.1f gigapixels.\nIf this is too big, reduce the panorama Canvas Size and the cropped region and stitch from the Stitcher tab. Stitching a panorama this size could take a long time and a large amount of memory."),
1355
area / 1000000000.0),
1361
wxICON_EXCLAMATION | wxYES_NO);
1364
switch (dialog.ShowModal())
1372
// bring the user towards the approptiate controls.
1373
MainFrame::Get()->ShowStitcherTab();
1377
// I see nothing wrong with this...
1283
1382
IMPLEMENT_DYNAMIC_CLASS(PanoPanel, wxPanel)