]> granicus.if.org Git - openjpeg/commitdiff
Reload image doesn't crash in OPJViewer; more settings saved to registry
authorGiuseppe Baruffa <gbaruffa@users.noreply.github.com>
Mon, 18 Jun 2007 13:05:28 +0000 (13:05 +0000)
committerGiuseppe Baruffa <gbaruffa@users.noreply.github.com>
Mon, 18 Jun 2007 13:05:28 +0000 (13:05 +0000)
ChangeLog
OPJViewer/OPJViewer.dsp
OPJViewer/source/OPJViewer.cpp
OPJViewer/source/OPJViewer.h
OPJViewer/source/build.h

index cfc8f683c48330561b6c5b391d102dd70ae46188..f8d3aab42f9648b5e42f9c75ed243feef96e6a0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@ What's New for OpenJPEG
 ! : changed
 + : added
 
+June 18, 2007
+* [GB] Reload image doesn't crash in OPJViewer; more settings saved to registry
 June 16, 2007
 + [GB] Possibility to disable parsing in OPJViewer; also, saves common settings to the registry
 
index 31f4c1eb4ec42e3b6a467a9f2704cc4181cdf17e..b34985850fdda116a9e51c5e0e790d2e4c000597 100644 (file)
@@ -42,16 +42,21 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /c\r
+# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /c\r
 # ADD BASE RSC /l 0x410 /d "NDEBUG"\r
-# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"\r
+# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"\r
 BSC32=bscmake.exe\r
 # ADD BASE BSC32 /nologo\r
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089\r
 # SUBTRACT LINK32 /pdb:none\r
+# Begin Special Build Tool\r
+SOURCE="$(InputPath)"\r
+PostBuild_Desc=Update build number\r
+PostBuild_Cmds=buildupdate.bat\r
+# End Special Build Tool\r
 \r
 !ELSEIF  "$(CFG)" == "OPJViewer - Win32 Debug"\r
 \r
@@ -67,15 +72,15 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0\r
 # PROP Target_Dir ""\r
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "d:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c\r
 # ADD BASE RSC /l 0x410 /d "_DEBUG"\r
-# ADD RSC /l 0x410 /i "c:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"\r
+# ADD RSC /l 0x410 /i "d:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"\r
 BSC32=bscmake.exe\r
 # ADD BASE BSC32 /nologo\r
 # ADD BSC32 /nologo\r
 LINK32=link.exe\r
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug"\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug"\r
 # SUBTRACT LINK32 /pdb:none\r
 \r
 !ENDIF \r
index 6d53d292be1789e6561b137c3d9118b6800ec890..942d08b56ddc94fe6e910abaf2d63e7c86831f97 100644 (file)
@@ -227,6 +227,14 @@ bool OPJViewerApp::OnInit(void)
        OPJconfig->Write(wxT("teststring"), wxT("This is a test value"));\r
        OPJconfig->Write(wxT("testbool"), (bool) true);\r
        OPJconfig->Write(wxT("testlong"), (long) 245);\r
+\r
+       OPJconfig->Read(wxT("showtoolbar"), &m_showtoolbar, (bool) true);\r
+       OPJconfig->Read(wxT("showbrowser"), &m_showbrowser, (bool) true);\r
+       OPJconfig->Read(wxT("showpeeker"), &m_showpeeker, (bool) true);\r
+       OPJconfig->Read(wxT("browserwidth"), &m_browserwidth, (long) OPJ_BROWSER_WIDTH);\r
+       OPJconfig->Read(wxT("peekerheight"), &m_peekerheight, (long) OPJ_PEEKER_HEIGHT);\r
+       OPJconfig->Read(wxT("framewidth"), &m_framewidth, (long) OPJ_FRAME_WIDTH);\r
+       OPJconfig->Read(wxT("frameheight"), &m_frameheight, (long) OPJ_FRAME_HEIGHT);\r
 #else\r
        // set decoding engine parameters\r
        m_enabledeco = true;\r
@@ -241,11 +249,18 @@ bool OPJViewerApp::OnInit(void)
        m_expcomps = JPWL_EXPECTED_COMPONENTS;\r
        m_maxtiles = JPWL_MAXIMUM_TILES;\r
 #endif // USE_JPWL\r
+       m_showtoolbar = true;\r
+       m_showbrowser = true;\r
+       m_showpeeker = true;\r
+       m_browserwidth = OPJ_BROWSER_WIDTH;\r
+       m_peekerheight = OPJ_PEEKER_HEIGHT;\r
+       m_framewidth = OPJ_FRAME_WIDTH;\r
+       m_frameheight = OPJ_FRAME_HEIGHT;\r
 #endif // OPJ_INICONFIG\r
 \r
        // Create the main frame window\r
   OPJFrame *frame = new OPJFrame(NULL, wxID_ANY, OPJ_APPLICATION_TITLEBAR,\r
-                                         wxDefaultPosition, wxSize(800, 600),\r
+                                         wxDefaultPosition, wxSize(wxGetApp().m_framewidth, wxGetApp().m_frameheight),\r
                       wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE |\r
                       wxHSCROLL | wxVSCROLL);\r
 \r
@@ -288,6 +303,13 @@ int OPJViewerApp::OnExit()
        OPJconfig->Write(wxT("expcomps"), m_expcomps);\r
        OPJconfig->Write(wxT("maxtiles"), m_maxtiles);\r
 #endif // USE_JPWL\r
+       OPJconfig->Write(wxT("showtoolbar"), m_showtoolbar);\r
+       OPJconfig->Write(wxT("showbrowser"), m_showbrowser);\r
+       OPJconfig->Write(wxT("showpeeker"), m_showpeeker);\r
+       OPJconfig->Write(wxT("browserwidth"), m_browserwidth);\r
+       OPJconfig->Write(wxT("peekerheight"), m_peekerheight);\r
+       OPJconfig->Write(wxT("framewidth"), m_framewidth);\r
+       OPJconfig->Write(wxT("frameheight"), m_frameheight);\r
 #endif // OPJ_INICONFIG\r
 \r
        return 1;\r
@@ -429,17 +451,29 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
        // associate the toolbar with the frame\r
        SetToolBar(tool_bar);\r
 \r
+       // show the toolbar?\r
+       if (!wxGetApp().m_showtoolbar)\r
+               tool_bar->Show(false);\r
+       else\r
+               tool_bar->Show(true);\r
+\r
        // the logging window\r
        loggingWindow = new wxSashLayoutWindow(this, OPJFRAME_LOGWIN,\r
-                                                                                       wxDefaultPosition, wxSize(400, 130),\r
+                                                                                       wxDefaultPosition, wxSize(400, wxGetApp().m_peekerheight),\r
                                                                                        wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN\r
                                                                                        );\r
-       loggingWindow->SetDefaultSize(wxSize(1000, 130));\r
+       loggingWindow->SetDefaultSize(wxSize(1000, wxGetApp().m_peekerheight));\r
        loggingWindow->SetOrientation(wxLAYOUT_HORIZONTAL);\r
        loggingWindow->SetAlignment(wxLAYOUT_BOTTOM);\r
        //loggingWindow->SetBackgroundColour(wxColour(0, 0, 255));\r
        loggingWindow->SetSashVisible(wxSASH_TOP, true);\r
 \r
+       // show the logging?\r
+       if (!wxGetApp().m_showpeeker)\r
+               loggingWindow->Show(false);\r
+       else\r
+               loggingWindow->Show(true);\r
+\r
        // create the bottom notebook\r
        m_bookCtrlbottom = new wxNotebook(loggingWindow, BOTTOM_NOTEBOOK_ID,\r
                                                                wxDefaultPosition, wxDefaultSize,\r
@@ -470,10 +504,10 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
 \r
        // the browser window\r
        markerTreeWindow = new wxSashLayoutWindow(this, OPJFRAME_BROWSEWIN,\r
-                                                                                         wxDefaultPosition, wxSize(300, 30),\r
+                                                                                         wxDefaultPosition, wxSize(wxGetApp().m_browserwidth, 30),\r
                                                                                          wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN\r
                                                                                          );\r
-       markerTreeWindow->SetDefaultSize(wxSize(300, 1000));\r
+       markerTreeWindow->SetDefaultSize(wxSize(wxGetApp().m_browserwidth, 1000));\r
        markerTreeWindow->SetOrientation(wxLAYOUT_VERTICAL);\r
        markerTreeWindow->SetAlignment(wxLAYOUT_LEFT);\r
        //markerTreeWindow->SetBackgroundColour(wxColour(0, 255, 0));\r
@@ -485,6 +519,12 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
                                                                wxDefaultPosition, wxDefaultSize,\r
                                                                wxBK_TOP);\r
 \r
+       // show the browser?\r
+       if (!wxGetApp().m_showbrowser)\r
+               markerTreeWindow->Show(false);\r
+       else\r
+               markerTreeWindow->Show(true);\r
+\r
 #ifdef __WXMOTIF__\r
        // For some reason, we get a memcpy crash in wxLogStream::DoLogStream\r
        // on gcc/wxMotif, if we use wxLogTextCtl. Maybe it's just gcc?\r
@@ -503,6 +543,9 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
 // this is the frame destructor\r
 OPJFrame::~OPJFrame(void)\r
 {\r
+       // save size settings\r
+       GetSize(&(wxGetApp().m_framewidth), &(wxGetApp().m_frameheight));\r
+\r
        // delete all possible things\r
        delete m_bookCtrl;\r
        m_bookCtrl = NULL;\r
@@ -662,17 +705,19 @@ void OPJFrame::OnReload(wxCommandEvent& event)
 {\r
        OPJChildFrame *currframe = (OPJChildFrame *) GetActiveChild();\r
 \r
-    OPJDecoThread *dthread = currframe->m_canvas->CreateDecoThread();\r
+       if (currframe) {\r
+               OPJDecoThread *dthread = currframe->m_canvas->CreateDecoThread();\r
 \r
-    if (dthread->Run() != wxTHREAD_NO_ERROR)\r
-        wxLogMessage(wxT("Can't start deco thread!"));\r
-    else\r
-               wxLogMessage(wxT("New deco thread started."));\r
+               if (dthread->Run() != wxTHREAD_NO_ERROR)\r
+                       wxLogMessage(wxT("Can't start deco thread!"));\r
+               else\r
+                       wxLogMessage(wxT("New deco thread started."));\r
 \r
-       currframe->m_canvas->Refresh();\r
+               currframe->m_canvas->Refresh();\r
 \r
-       // update zoom\r
-       //currframe->m_canvas->m_zooml = zooml;\r
+               // update zoom\r
+               //currframe->m_canvas->m_zooml = zooml;\r
+       }\r
 }\r
 \r
 \r
@@ -742,6 +787,11 @@ void OPJFrame::OnToggleBrowser(wxCommandEvent& WXUNUSED(event))
 \r
     wxLayoutAlgorithm layout;\r
     layout.LayoutMDIFrame(this);\r
+\r
+       wxGetApp().m_showbrowser = markerTreeWindow->IsShown();\r
+\r
+    // Leaves bits of itself behind sometimes\r
+    GetClientWindow()->Refresh();\r
 }\r
 \r
 void OPJFrame::OnTogglePeeker(wxCommandEvent& WXUNUSED(event))\r
@@ -753,6 +803,11 @@ void OPJFrame::OnTogglePeeker(wxCommandEvent& WXUNUSED(event))
 \r
     wxLayoutAlgorithm layout;\r
     layout.LayoutMDIFrame(this);\r
+\r
+       wxGetApp().m_showpeeker = loggingWindow->IsShown();\r
+\r
+    // Leaves bits of itself behind sometimes\r
+    GetClientWindow()->Refresh();\r
 }\r
 \r
 void OPJFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))\r
@@ -764,10 +819,17 @@ void OPJFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
 \r
     wxLayoutAlgorithm layout;\r
     layout.LayoutMDIFrame(this);\r
+\r
+       wxGetApp().m_showtoolbar = tool_bar->IsShown();\r
+\r
+    // Leaves bits of itself behind sometimes\r
+    GetClientWindow()->Refresh();\r
 }\r
 \r
 void OPJFrame::OnSashDrag(wxSashEvent& event)\r
 {\r
+       int wid, hei;\r
+\r
     if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)\r
         return;\r
 \r
@@ -789,6 +851,14 @@ void OPJFrame::OnSashDrag(wxSashEvent& event)
 \r
     // Leaves bits of itself behind sometimes\r
     GetClientWindow()->Refresh();\r
+\r
+       // update dimensions\r
+       markerTreeWindow->GetSize(&wid, &hei);\r
+       wxGetApp().m_browserwidth = wid;\r
+\r
+       loggingWindow->GetSize(&wid, &hei);\r
+       wxGetApp().m_peekerheight = hei;\r
+\r
 }\r
 \r
 // physically open the files\r
index bbd0b50156d7d7013af5f565744a0d4a516f54e3..9d954b9ad757f34eba927d87de9d6e09c33c9827 100644 (file)
@@ -141,6 +141,12 @@ typedef unsigned long long int8byte;
 #define OPJ_APPLICATION_PLATFORM    wxT("Linux")\r
 #endif\r
 \r
+#define OPJ_FRAME_WIDTH   800\r
+#define OPJ_FRAME_HEIGHT  600\r
+\r
+#define OPJ_BROWSER_WIDTH 300\r
+#define OPJ_PEEKER_HEIGHT 130\r
+\r
 #define OPJ_CANVAS_BORDER 10\r
 #define OPJ_CANVAS_COLOUR *wxWHITE\r
 \r
@@ -193,8 +199,13 @@ class OPJViewerApp: public wxApp
 #ifdef USE_JPWL\r
                bool m_enablejpwl;\r
                int m_expcomps, m_maxtiles;\r
+               int m_framewidth, m_frameheight;\r
 #endif // USE_JPWL\r
 \r
+               // some layout settings\r
+               bool m_showtoolbar, m_showbrowser, m_showpeeker;\r
+               int m_browserwidth, m_peekerheight;\r
+\r
                // application configuration\r
                wxConfig *OPJconfig; \r
 \r
index b200df0a2199a51afbad189883f4725e25175e43..58f481933e7214a66cc9933c29fdb287f60c7b26 100644 (file)
@@ -1 +1 @@
-wxT("42") \r
+wxT("48") \r