branch:
details: http://hugin.hg.sourceforge.net/hgweb/hugin/hugin/hgrepo/h/hu/hugin/hugin/rev/d528dcbe129b
changeset: 4917:d528dcbe129b
user: tmodes
date: Sun Jan 30 18:39:15 2011 +0100
description:
Fixes bugs in 3ca9b1031705
* opts.outputImageTypeCompression and opts.tiffCompression are strings and not numbers
* Modify Panorama object only in PanoCommands, otherwise the undo/redo functionality is broken
diffstat:
src/hugin1/hugin/CommandHistory.cpp | 1 +
src/hugin1/hugin/MainFrame.cpp | 41 +-----------------------
src/hugin1/hugin/huginApp.cpp | 33 +-----------------
src/hugin1/hugin/wxPanoCommand.cpp | 64 +++++++++++++++++++++++++++++++++++++
src/hugin1/hugin/wxPanoCommand.h | 16 +++++++++
5 files changed, 84 insertions(+), 71 deletions(-)
diffs (212 lines):
diff -r a6303b14b4e8 -r d528dcbe129b src/hugin1/hugin/CommandHistory.cpp
--- a/src/hugin1/hugin/CommandHistory.cpp Sun Jan 30 15:48:28 2011 +0100
+++ b/src/hugin1/hugin/CommandHistory.cpp Sun Jan 30 18:39:15 2011 +0100
@@ -54,6 +54,7 @@
delete *it;
}
commands.clear();
+ nextCmd=0;
}
diff -r a6303b14b4e8 -r d528dcbe129b src/hugin1/hugin/MainFrame.cpp
--- a/src/hugin1/hugin/MainFrame.cpp Sun Jan 30 15:48:28 2011 +0100
+++ b/src/hugin1/hugin/MainFrame.cpp Sun Jan 30 18:39:15 2011 +0100
@@ -812,53 +812,14 @@
if(!CloseProject(true)) return; //if closing current project is canceled
m_filename = wxT("");
- GlobalCmdHist::getInstance().addCommand( new NewPanoCmd(pano));
+ GlobalCmdHist::getInstance().addCommand( new wxNewProjectCmd(pano));
// remove old images from cache
ImageCache::getInstance().flush();
this->SetTitle(_("Hugin - Panorama Stitcher"));
pano.clearDirty();
- // Setup pano with options from preferences
- PanoramaOptions opts = pano.getOptions();
- wxConfigBase* config = wxConfigBase::Get();
- opts.quality = config->Read(wxT("/output/jpeg_quality"),HUGIN_JPEG_QUALITY);
- opts.outputImageTypeCompression = config->Read(wxT("/output/tiff_compression"), HUGIN_TIFF_COMPRESSION);
- opts.tiffCompression = config->Read(wxT("/output/tiff_compression"), HUGIN_TIFF_COMPRESSION);
- switch (config->Read(wxT("/output/ldr_format"), HUGIN_LDR_OUTPUT_FORMAT)) {
- case 1:
- opts.outputImageType ="jpg";
- break;
- case 2:
- opts.outputImageType ="png";
- break;
- case 3:
- opts.outputImageType ="exr";
- break;
- default:
- case 0:
- opts.outputImageType ="tif";
- break;
- }
- // HDR disabled because there is no real choice at the moment: HDR TIFF is broken and there is only EXR
- // opts.outputImageTypeHDR = config->Read(wxT("/output/hdr_format"), HUGIN_HDR_OUTPUT_FORMAT);
- opts.outputFormat = PanoramaOptions::TIFF_m;
- opts.blendMode = PanoramaOptions::ENBLEND_BLEND;
- opts.enblendOptions = config->Read(wxT("Enblend/Args"),wxT(HUGIN_ENBLEND_ARGS)).mb_str(wxConvLocal);
- opts.enfuseOptions = config->Read(wxT("Enfuse/Args"),wxT(HUGIN_ENFUSE_ARGS)).mb_str(wxConvLocal);
- opts.interpolator = (vigra_ext::Interpolator)config->Read(wxT("Nona/Interpolator"),HUGIN_NONA_INTERPOLATOR);
- opts.remapUsingGPU = config->Read(wxT("Nona/useGPU"),HUGIN_NONA_USEGPU)!=0;
- opts.tiff_saveROI = config->Read(wxT("Nona/CroppedImages"),HUGIN_NONA_CROPPEDIMAGES)!=0;
- opts.hdrMergeMode = PanoramaOptions::HDRMERGE_AVERAGE;
- opts.hdrmergeOptions = HUGIN_HDRMERGE_ARGS;
- pano.setOptions(opts);
-
wxCommandEvent dummy;
preview_frame->OnUpdate(dummy);
-
- // since we changed the file format options and the Stitcher tab is dynamic based on it
- // we need to refresh the Stitcher tab as well.
- pano_panel->panoramaChanged(pano);
-
}
void MainFrame::OnAddImages( wxCommandEvent& event )
diff -r a6303b14b4e8 -r d528dcbe129b src/hugin1/hugin/huginApp.cpp
--- a/src/hugin1/hugin/huginApp.cpp Sun Jan 30 15:48:28 2011 +0100
+++ b/src/hugin1/hugin/huginApp.cpp Sun Jan 30 18:39:15 2011 +0100
@@ -339,37 +339,8 @@
DEBUG_DEBUG("using temp dir: " << m_workDir.mb_str(wxConvLocal));
// set some suitable defaults
- PanoramaOptions opts = pano.getOptions();
- opts.quality = config->Read(wxT("/output/jpeg_quality"),HUGIN_JPEG_QUALITY);
- opts.outputImageTypeCompression = config->Read(wxT("/output/tiff_compression"), HUGIN_TIFF_COMPRESSION);
- opts.tiffCompression = config->Read(wxT("/output/tiff_compression"), HUGIN_TIFF_COMPRESSION);
- switch (config->Read(wxT("/output/ldr_format"), HUGIN_LDR_OUTPUT_FORMAT)) {
- case 1:
- opts.outputImageType ="jpg";
- break;
- case 2:
- opts.outputImageType ="png";
- break;
- case 3:
- opts.outputImageType ="exr";
- break;
- default:
- case 0:
- opts.outputImageType ="tif";
- break;
- }
- // HDR disabled because there is no real choice at the moment: HDR TIFF is broken and there is only EXR
- // opts.outputImageTypeHDR = config->Read(wxT("/output/hdr_format"), HUGIN_HDR_OUTPUT_FORMAT);
- opts.outputFormat = PanoramaOptions::TIFF_m;
- opts.blendMode = PanoramaOptions::ENBLEND_BLEND;
- opts.enblendOptions = config->Read(wxT("Enblend/Args"),wxT(HUGIN_ENBLEND_ARGS)).mb_str(wxConvLocal);
- opts.enfuseOptions = config->Read(wxT("Enfuse/Args"),wxT(HUGIN_ENFUSE_ARGS)).mb_str(wxConvLocal);
- opts.interpolator = (vigra_ext::Interpolator)config->Read(wxT("Nona/Interpolator"),HUGIN_NONA_INTERPOLATOR);
- opts.remapUsingGPU = (bool)config->Read(wxT("Nona/useGPU"),HUGIN_NONA_USEGPU);
- opts.tiff_saveROI = (bool)config->Read(wxT("Nona/CroppedImages"),HUGIN_NONA_CROPPEDIMAGES);
- opts.hdrMergeMode = PanoramaOptions::HDRMERGE_AVERAGE;
- opts.hdrmergeOptions = HUGIN_HDRMERGE_ARGS;
- pano.setOptions(opts);
+ GlobalCmdHist::getInstance().addCommand(new wxNewProjectCmd(pano));
+ GlobalCmdHist::getInstance().clear();
if (argc > 1) {
wxFileName file(argv[1]);
diff -r a6303b14b4e8 -r d528dcbe129b src/hugin1/hugin/wxPanoCommand.cpp
--- a/src/hugin1/hugin/wxPanoCommand.cpp Sun Jan 30 15:48:28 2011 +0100
+++ b/src/hugin1/hugin/wxPanoCommand.cpp Sun Jan 30 18:39:15 2011 +0100
@@ -507,6 +507,70 @@
pano.changeFinished();
}
+void wxNewProjectCmd::execute()
+{
+ PanoCommand::execute();
+#ifdef _Hgn1_PANOCOMMAND_H
+ Panorama& pano = o_pano;
+#endif
+
+ pano.reset();
+
+ // Setup pano with options from preferences
+ PanoramaOptions opts = pano.getOptions();
+ wxConfigBase* config = wxConfigBase::Get();
+ opts.quality = config->Read(wxT("/output/jpeg_quality"),HUGIN_JPEG_QUALITY);
+ switch(config->Read(wxT("/output/tiff_compression"), HUGIN_TIFF_COMPRESSION))
+ {
+ case 0:
+ default:
+ opts.outputImageTypeCompression = "NONE";
+ opts.tiffCompression = "NONE";
+ break;
+ case 1:
+ opts.outputImageTypeCompression = "PACKBITS";
+ opts.tiffCompression = "PACKBITS";
+ break;
+ case 2:
+ opts.outputImageTypeCompression = "LZW";
+ opts.tiffCompression = "LZW";
+ break;
+ case 3:
+ opts.outputImageTypeCompression = "DEFLATE";
+ opts.tiffCompression = "DEFLATE";
+ break;
+ }
+ switch (config->Read(wxT("/output/ldr_format"), HUGIN_LDR_OUTPUT_FORMAT)) {
+ case 1:
+ opts.outputImageType ="jpg";
+ break;
+ case 2:
+ opts.outputImageType ="png";
+ break;
+ case 3:
+ opts.outputImageType ="exr";
+ break;
+ default:
+ case 0:
+ opts.outputImageType ="tif";
+ break;
+ }
+ // HDR disabled because there is no real choice at the moment: HDR TIFF is broken and there is only EXR
+ // opts.outputImageTypeHDR = config->Read(wxT("/output/hdr_format"), HUGIN_HDR_OUTPUT_FORMAT);
+ opts.outputFormat = PanoramaOptions::TIFF_m;
+ opts.blendMode = PanoramaOptions::ENBLEND_BLEND;
+ opts.enblendOptions = config->Read(wxT("Enblend/Args"),wxT(HUGIN_ENBLEND_ARGS)).mb_str(wxConvLocal);
+ opts.enfuseOptions = config->Read(wxT("Enfuse/Args"),wxT(HUGIN_ENFUSE_ARGS)).mb_str(wxConvLocal);
+ opts.interpolator = (vigra_ext::Interpolator)config->Read(wxT("Nona/Interpolator"),HUGIN_NONA_INTERPOLATOR);
+ opts.remapUsingGPU = config->Read(wxT("Nona/useGPU"),HUGIN_NONA_USEGPU)!=0;
+ opts.tiff_saveROI = config->Read(wxT("Nona/CroppedImages"),HUGIN_NONA_CROPPEDIMAGES)!=0;
+ opts.hdrMergeMode = PanoramaOptions::HDRMERGE_AVERAGE;
+ opts.hdrmergeOptions = HUGIN_HDRMERGE_ARGS;
+ pano.setOptions(opts);
+
+ pano.changeFinished();
+}
+
void wxApplyTemplateCmd::execute()
{
diff -r a6303b14b4e8 -r d528dcbe129b src/hugin1/hugin/wxPanoCommand.h
--- a/src/hugin1/hugin/wxPanoCommand.h Sun Jan 30 15:48:28 2011 +0100
+++ b/src/hugin1/hugin/wxPanoCommand.h Sun Jan 30 18:39:15 2011 +0100
@@ -92,6 +92,22 @@
const bool markAsOptimized;
};
+/** start a new project, reset options to values in preferences
+ *
+ */
+class wxNewProjectCmd : public PanoCommand
+{
+public:
+ wxNewProjectCmd(Panorama & p) : PanoCommand(p){};
+
+ virtual void execute();
+
+ virtual std::string getName() const
+ {
+ return "new project";
+ }
+};
+
/** dump the current project and load a new one.
*
|