From 02d9f438027038877d74824966bce8819d0c3cc9 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Tue, 20 Dec 2011 18:33:45 +0000 Subject: [PATCH] Reactivate the opjviewer in cmake --- CMakeLists.txt | 2 ++ applications/CMakeLists.txt | 4 +++ applications/OPJViewer/CMakeLists.txt | 23 ++++++++++++++ applications/OPJViewer/source/OPJDialogs.cpp | 32 ++++++++++---------- applications/OPJViewer/source/OPJViewer.cpp | 2 ++ applications/OPJViewer/source/OPJViewer.h | 5 +-- 6 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 applications/OPJViewer/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2847a4dc..b1f27de5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,6 +179,8 @@ ADD_SUBDIRECTORY(libopenjpeg) OPTION(BUILD_CODEC "Build the CODEC executables" ON) OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF) OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF) +OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF) +MARK_AS_ADVANCED(BUILD_VIEWER) IF(BUILD_JPIP) FIND_PACKAGE(CURL) diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt index d26e26db..9c0bbb20 100644 --- a/applications/CMakeLists.txt +++ b/applications/CMakeLists.txt @@ -11,3 +11,7 @@ ENDIF(BUILD_MJ2) IF(BUILD_JPIP) ADD_SUBDIRECTORY(jpip) ENDIF(BUILD_JPIP) + +IF(BUILD_VIEWER) + ADD_SUBDIRECTORY(OPJViewer) +ENDIF(BUILD_VIEWER) diff --git a/applications/OPJViewer/CMakeLists.txt b/applications/OPJViewer/CMakeLists.txt new file mode 100644 index 00000000..a03b370d --- /dev/null +++ b/applications/OPJViewer/CMakeLists.txt @@ -0,0 +1,23 @@ +PROJECT(viewer CXX) + +FIND_PACKAGE(wxWidgets REQUIRED) +INCLUDE(${wxWidgets_USE_FILE}) + +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR}/../.. + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ) + +ADD_DEFINITIONS(-DwxUSE_LIBOPENJPEG -DOPENJPEG_VERSION="1.5.0") +SET(OPJV_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/source/imagjpeg2000.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/source/wxj2kparser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJViewer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/source/wxjp2parser.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJDialogs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJThreads.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/source/OPJAbout.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../codec/index.c + ) +ADD_EXECUTABLE(opjviewer ${OPJV_SRCS}) +TARGET_LINK_LIBRARIES(opjviewer ${wxWidgets_LIBRARIES} openjpeg) diff --git a/applications/OPJViewer/source/OPJDialogs.cpp b/applications/OPJViewer/source/OPJDialogs.cpp index ed68ef3f..36490d40 100644 --- a/applications/OPJViewer/source/OPJDialogs.cpp +++ b/applications/OPJViewer/source/OPJDialogs.cpp @@ -360,6 +360,22 @@ wxPanel* OPJDecoderDialog::CreatePart11SettingsPage(wxWindow* parent) return panel; } +void OPJDecoderDialog::OnEnableJPWL(wxCommandEvent& event) +{ + if (event.IsChecked()) { + wxLogMessage(wxT("JPWL enabled")); + m_expcompsCtrl->Enable(true); + m_maxtilesCtrl->Enable(true); + } else { + wxLogMessage(wxT("JPWL disabled")); + m_expcompsCtrl->Enable(false); + m_maxtilesCtrl->Enable(false); + } + +} + +#endif // USE_JPWL + void OPJDecoderDialog::OnEnableDeco(wxCommandEvent& event) { size_t pp; @@ -384,22 +400,6 @@ void OPJDecoderDialog::OnEnableDeco(wxCommandEvent& event) } -void OPJDecoderDialog::OnEnableJPWL(wxCommandEvent& event) -{ - if (event.IsChecked()) { - wxLogMessage(wxT("JPWL enabled")); - m_expcompsCtrl->Enable(true); - m_maxtilesCtrl->Enable(true); - } else { - wxLogMessage(wxT("JPWL disabled")); - m_expcompsCtrl->Enable(false); - m_maxtilesCtrl->Enable(false); - } - -} - -#endif // USE_JPWL - diff --git a/applications/OPJViewer/source/OPJViewer.cpp b/applications/OPJViewer/source/OPJViewer.cpp index 8f2c86e8..1bc170b4 100644 --- a/applications/OPJViewer/source/OPJViewer.cpp +++ b/applications/OPJViewer/source/OPJViewer.cpp @@ -1373,6 +1373,8 @@ void OPJFrame::OnFileSaveAs(wxCommandEvent& WXUNUSED(event)) wxT("JPEG 2000 codestream (*.j2k)|*.j2k") wxT("|JPEG 2000 file format (*.jp2)|*.jp2"); #endif +#else + wxT("Houston we have a problem"); #endif wxFileDialog dialog(this, _T("Save image file"), diff --git a/applications/OPJViewer/source/OPJViewer.h b/applications/OPJViewer/source/OPJViewer.h index 3574dac1..e0e615bf 100644 --- a/applications/OPJViewer/source/OPJViewer.h +++ b/applications/OPJViewer/source/OPJViewer.h @@ -214,8 +214,8 @@ class OPJViewerApp: public wxApp #ifdef USE_JPWL bool m_enablejpwl, m_enablejpwle; int m_expcomps, m_maxtiles; - int m_framewidth, m_frameheight; #endif // USE_JPWL + int m_framewidth, m_frameheight; // encoding engine parameters wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality; @@ -782,9 +782,10 @@ public: #ifdef USE_JPWL void OnEnableJPWL(wxCommandEvent& event); wxPanel* CreatePart11SettingsPage(wxWindow* parent); - wxSpinCtrl *m_expcompsCtrl, *m_framenumCtrl, *m_maxtilesCtrl; + wxSpinCtrl *m_expcompsCtrl, *m_maxtilesCtrl; wxCheckBox *m_enablejpwlCheck; #endif // USE_JPWL + wxSpinCtrl *m_framenumCtrl; protected: