Reload image doesn't crash in OPJViewer; more settings saved to registry

This commit is contained in:
Giuseppe Baruffa 2007-06-18 13:05:28 +00:00
parent c647671607
commit 92398409a5
5 changed files with 109 additions and 20 deletions

View File

@ -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

View File

@ -42,16 +42,21 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# 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
# 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
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# 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
# 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
# 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
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Update build number
PostBuild_Cmds=buildupdate.bat
# End Special Build Tool
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
@ -67,15 +72,15 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# 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
# 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
# ADD BASE RSC /l 0x410 /d "_DEBUG"
# ADD RSC /l 0x410 /i "c:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"
# ADD RSC /l 0x410 /i "d:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# 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
# 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"
# 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"
# SUBTRACT LINK32 /pdb:none
!ENDIF

View File

@ -227,6 +227,14 @@ bool OPJViewerApp::OnInit(void)
OPJconfig->Write(wxT("teststring"), wxT("This is a test value"));
OPJconfig->Write(wxT("testbool"), (bool) true);
OPJconfig->Write(wxT("testlong"), (long) 245);
OPJconfig->Read(wxT("showtoolbar"), &m_showtoolbar, (bool) true);
OPJconfig->Read(wxT("showbrowser"), &m_showbrowser, (bool) true);
OPJconfig->Read(wxT("showpeeker"), &m_showpeeker, (bool) true);
OPJconfig->Read(wxT("browserwidth"), &m_browserwidth, (long) OPJ_BROWSER_WIDTH);
OPJconfig->Read(wxT("peekerheight"), &m_peekerheight, (long) OPJ_PEEKER_HEIGHT);
OPJconfig->Read(wxT("framewidth"), &m_framewidth, (long) OPJ_FRAME_WIDTH);
OPJconfig->Read(wxT("frameheight"), &m_frameheight, (long) OPJ_FRAME_HEIGHT);
#else
// set decoding engine parameters
m_enabledeco = true;
@ -241,11 +249,18 @@ bool OPJViewerApp::OnInit(void)
m_expcomps = JPWL_EXPECTED_COMPONENTS;
m_maxtiles = JPWL_MAXIMUM_TILES;
#endif // USE_JPWL
m_showtoolbar = true;
m_showbrowser = true;
m_showpeeker = true;
m_browserwidth = OPJ_BROWSER_WIDTH;
m_peekerheight = OPJ_PEEKER_HEIGHT;
m_framewidth = OPJ_FRAME_WIDTH;
m_frameheight = OPJ_FRAME_HEIGHT;
#endif // OPJ_INICONFIG
// Create the main frame window
OPJFrame *frame = new OPJFrame(NULL, wxID_ANY, OPJ_APPLICATION_TITLEBAR,
wxDefaultPosition, wxSize(800, 600),
wxDefaultPosition, wxSize(wxGetApp().m_framewidth, wxGetApp().m_frameheight),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE |
wxHSCROLL | wxVSCROLL);
@ -288,6 +303,13 @@ int OPJViewerApp::OnExit()
OPJconfig->Write(wxT("expcomps"), m_expcomps);
OPJconfig->Write(wxT("maxtiles"), m_maxtiles);
#endif // USE_JPWL
OPJconfig->Write(wxT("showtoolbar"), m_showtoolbar);
OPJconfig->Write(wxT("showbrowser"), m_showbrowser);
OPJconfig->Write(wxT("showpeeker"), m_showpeeker);
OPJconfig->Write(wxT("browserwidth"), m_browserwidth);
OPJconfig->Write(wxT("peekerheight"), m_peekerheight);
OPJconfig->Write(wxT("framewidth"), m_framewidth);
OPJconfig->Write(wxT("frameheight"), m_frameheight);
#endif // OPJ_INICONFIG
return 1;
@ -429,17 +451,29 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
// associate the toolbar with the frame
SetToolBar(tool_bar);
// show the toolbar?
if (!wxGetApp().m_showtoolbar)
tool_bar->Show(false);
else
tool_bar->Show(true);
// the logging window
loggingWindow = new wxSashLayoutWindow(this, OPJFRAME_LOGWIN,
wxDefaultPosition, wxSize(400, 130),
wxDefaultPosition, wxSize(400, wxGetApp().m_peekerheight),
wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN
);
loggingWindow->SetDefaultSize(wxSize(1000, 130));
loggingWindow->SetDefaultSize(wxSize(1000, wxGetApp().m_peekerheight));
loggingWindow->SetOrientation(wxLAYOUT_HORIZONTAL);
loggingWindow->SetAlignment(wxLAYOUT_BOTTOM);
//loggingWindow->SetBackgroundColour(wxColour(0, 0, 255));
loggingWindow->SetSashVisible(wxSASH_TOP, true);
// show the logging?
if (!wxGetApp().m_showpeeker)
loggingWindow->Show(false);
else
loggingWindow->Show(true);
// create the bottom notebook
m_bookCtrlbottom = new wxNotebook(loggingWindow, BOTTOM_NOTEBOOK_ID,
wxDefaultPosition, wxDefaultSize,
@ -470,10 +504,10 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
// the browser window
markerTreeWindow = new wxSashLayoutWindow(this, OPJFRAME_BROWSEWIN,
wxDefaultPosition, wxSize(300, 30),
wxDefaultPosition, wxSize(wxGetApp().m_browserwidth, 30),
wxNO_BORDER | wxSW_3D | wxCLIP_CHILDREN
);
markerTreeWindow->SetDefaultSize(wxSize(300, 1000));
markerTreeWindow->SetDefaultSize(wxSize(wxGetApp().m_browserwidth, 1000));
markerTreeWindow->SetOrientation(wxLAYOUT_VERTICAL);
markerTreeWindow->SetAlignment(wxLAYOUT_LEFT);
//markerTreeWindow->SetBackgroundColour(wxColour(0, 255, 0));
@ -485,6 +519,12 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
wxDefaultPosition, wxDefaultSize,
wxBK_TOP);
// show the browser?
if (!wxGetApp().m_showbrowser)
markerTreeWindow->Show(false);
else
markerTreeWindow->Show(true);
#ifdef __WXMOTIF__
// For some reason, we get a memcpy crash in wxLogStream::DoLogStream
// on gcc/wxMotif, if we use wxLogTextCtl. Maybe it's just gcc?
@ -503,6 +543,9 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
// this is the frame destructor
OPJFrame::~OPJFrame(void)
{
// save size settings
GetSize(&(wxGetApp().m_framewidth), &(wxGetApp().m_frameheight));
// delete all possible things
delete m_bookCtrl;
m_bookCtrl = NULL;
@ -662,17 +705,19 @@ void OPJFrame::OnReload(wxCommandEvent& event)
{
OPJChildFrame *currframe = (OPJChildFrame *) GetActiveChild();
OPJDecoThread *dthread = currframe->m_canvas->CreateDecoThread();
if (currframe) {
OPJDecoThread *dthread = currframe->m_canvas->CreateDecoThread();
if (dthread->Run() != wxTHREAD_NO_ERROR)
wxLogMessage(wxT("Can't start deco thread!"));
else
wxLogMessage(wxT("New deco thread started."));
if (dthread->Run() != wxTHREAD_NO_ERROR)
wxLogMessage(wxT("Can't start deco thread!"));
else
wxLogMessage(wxT("New deco thread started."));
currframe->m_canvas->Refresh();
currframe->m_canvas->Refresh();
// update zoom
//currframe->m_canvas->m_zooml = zooml;
// update zoom
//currframe->m_canvas->m_zooml = zooml;
}
}
@ -742,6 +787,11 @@ void OPJFrame::OnToggleBrowser(wxCommandEvent& WXUNUSED(event))
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
wxGetApp().m_showbrowser = markerTreeWindow->IsShown();
// Leaves bits of itself behind sometimes
GetClientWindow()->Refresh();
}
void OPJFrame::OnTogglePeeker(wxCommandEvent& WXUNUSED(event))
@ -753,6 +803,11 @@ void OPJFrame::OnTogglePeeker(wxCommandEvent& WXUNUSED(event))
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
wxGetApp().m_showpeeker = loggingWindow->IsShown();
// Leaves bits of itself behind sometimes
GetClientWindow()->Refresh();
}
void OPJFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
@ -764,10 +819,17 @@ void OPJFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
wxLayoutAlgorithm layout;
layout.LayoutMDIFrame(this);
wxGetApp().m_showtoolbar = tool_bar->IsShown();
// Leaves bits of itself behind sometimes
GetClientWindow()->Refresh();
}
void OPJFrame::OnSashDrag(wxSashEvent& event)
{
int wid, hei;
if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)
return;
@ -789,6 +851,14 @@ void OPJFrame::OnSashDrag(wxSashEvent& event)
// Leaves bits of itself behind sometimes
GetClientWindow()->Refresh();
// update dimensions
markerTreeWindow->GetSize(&wid, &hei);
wxGetApp().m_browserwidth = wid;
loggingWindow->GetSize(&wid, &hei);
wxGetApp().m_peekerheight = hei;
}
// physically open the files

View File

@ -141,6 +141,12 @@ typedef unsigned long long int8byte;
#define OPJ_APPLICATION_PLATFORM wxT("Linux")
#endif
#define OPJ_FRAME_WIDTH 800
#define OPJ_FRAME_HEIGHT 600
#define OPJ_BROWSER_WIDTH 300
#define OPJ_PEEKER_HEIGHT 130
#define OPJ_CANVAS_BORDER 10
#define OPJ_CANVAS_COLOUR *wxWHITE
@ -193,8 +199,13 @@ class OPJViewerApp: public wxApp
#ifdef USE_JPWL
bool m_enablejpwl;
int m_expcomps, m_maxtiles;
int m_framewidth, m_frameheight;
#endif // USE_JPWL
// some layout settings
bool m_showtoolbar, m_showbrowser, m_showpeeker;
int m_browserwidth, m_peekerheight;
// application configuration
wxConfig *OPJconfig;

View File

@ -1 +1 @@
wxT("42")
wxT("48")