From 167fb6337b005fd16e6015b695ec01421f8182e5 Mon Sep 17 00:00:00 2001 From: Giuseppe Baruffa Date: Thu, 21 Jun 2007 14:00:32 +0000 Subject: [PATCH] Previous, home, and next frame buttons for exploring MJ2 files in OPJViewer --- ChangeLog | 1 + OPJViewer/source/OPJViewer.cpp | 53 ++++++++++++++++++++++++++++++++++ OPJViewer/source/OPJViewer.h | 6 ++++ OPJViewer/source/build.h | 2 +- 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fa3e4832..30b97754 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ What's New for OpenJPEG June 21, 2007 * [FOD] Output image color space set when decoding a JP2 file in jp2.c ++ [GB] Previous, home, and next frame buttons for exploring MJ2 files in OPJViewer June 18, 2007 * [GB] Reload image doesn't crash in OPJViewer; more settings saved to registry diff --git a/OPJViewer/source/OPJViewer.cpp b/OPJViewer/source/OPJViewer.cpp index 942d08b5..1e1ef647 100644 --- a/OPJViewer/source/OPJViewer.cpp +++ b/OPJViewer/source/OPJViewer.cpp @@ -338,6 +338,9 @@ BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame) EVT_MENU(OPJFRAME_VIEWZOOM, OPJFrame::OnZoom) EVT_MENU(OPJFRAME_VIEWFIT, OPJFrame::OnFit) EVT_MENU(OPJFRAME_VIEWRELOAD, OPJFrame::OnReload) + EVT_MENU(OPJFRAME_VIEWPREVFRAME, OPJFrame::OnPrevFrame) + EVT_MENU(OPJFRAME_VIEWHOMEFRAME, OPJFrame::OnHomeFrame) + EVT_MENU(OPJFRAME_VIEWNEXTFRAME, OPJFrame::OnNextFrame) EVT_MENU(OPJFRAME_FILETOGGLEB, OPJFrame::OnToggleBrowser) EVT_MENU(OPJFRAME_FILETOGGLEP, OPJFrame::OnTogglePeeker) EVT_MENU(OPJFRAME_FILETOGGLET, OPJFrame::OnToggleToolbar) @@ -389,6 +392,18 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, view_menu->Append(OPJFRAME_VIEWRELOAD, wxT("&Reload image\tCtrl+R")); view_menu->SetHelpString(OPJFRAME_VIEWRELOAD, wxT("Reload the current image")); + view_menu->AppendSeparator(); + + view_menu->Append(OPJFRAME_VIEWPREVFRAME, wxT("&Prev frame\tLeft")); + view_menu->SetHelpString(OPJFRAME_VIEWPREVFRAME, wxT("View previous frame")); + + view_menu->Append(OPJFRAME_VIEWHOMEFRAME, wxT("&Start frame\tHome")); + view_menu->SetHelpString(OPJFRAME_VIEWHOMEFRAME, wxT("View starting frame")); + + view_menu->Append(OPJFRAME_VIEWNEXTFRAME, wxT("&Next frame\tRight")); + view_menu->SetHelpString(OPJFRAME_VIEWNEXTFRAME, wxT("View next frame")); + + // settings menu and its items wxMenu *sets_menu = new wxMenu; @@ -435,6 +450,12 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, wxDefaultSize); wxBitmap bmpEncosettings = wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_TOOLBAR, wxDefaultSize); + wxBitmap bmpPrevframe = wxArtProvider::GetBitmap(wxART_GO_BACK, wxART_TOOLBAR, + wxDefaultSize); + wxBitmap bmpHomeframe = wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_TOOLBAR, + wxDefaultSize); + wxBitmap bmpNextframe = wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_TOOLBAR, + wxDefaultSize); tool_bar->AddTool(OPJFRAME_FILEOPEN, bmpOpen, wxT("Open")); tool_bar->AddTool(OPJFRAME_FILESAVEAS, bmpSaveAs, wxT("Save as ")); @@ -446,6 +467,10 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, tool_bar->AddSeparator(); tool_bar->AddTool(OPJFRAME_SETSDECO, bmpDecosettings, wxT("Decoder settings")); tool_bar->AddTool(OPJFRAME_SETSENCO, bmpEncosettings, wxT("Encoder settings")); + tool_bar->AddSeparator(); + tool_bar->AddTool(OPJFRAME_VIEWPREVFRAME, bmpPrevframe, wxT("Previous frame")); + tool_bar->AddTool(OPJFRAME_VIEWHOMEFRAME, bmpHomeframe, wxT("Starting frame")); + tool_bar->AddTool(OPJFRAME_VIEWNEXTFRAME, bmpNextframe, wxT("Next frame")); tool_bar->Realize(); // associate the toolbar with the frame @@ -720,6 +745,34 @@ void OPJFrame::OnReload(wxCommandEvent& event) } } +void OPJFrame::OnPrevFrame(wxCommandEvent& event) +{ + if (--wxGetApp().m_framenum < 0) + wxGetApp().m_framenum = 0; + + //wxLogMessage(wxT("================Go prev, dude!=======================")); + wxCommandEvent e; + OnReload(e); +} + +void OPJFrame::OnHomeFrame(wxCommandEvent& event) +{ + wxGetApp().m_framenum = 0; + + //wxLogMessage(wxT("================Go home, dude!=======================")); + + wxCommandEvent e; + OnReload(e); +} + +void OPJFrame::OnNextFrame(wxCommandEvent& event) +{ + ++wxGetApp().m_framenum; + + //wxLogMessage(wxT("================Go next, dude!=======================")); + wxCommandEvent e; + OnReload(e); +} // about window for the frame void OPJFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) diff --git a/OPJViewer/source/OPJViewer.h b/OPJViewer/source/OPJViewer.h index 9d954b9a..8904c9ee 100644 --- a/OPJViewer/source/OPJViewer.h +++ b/OPJViewer/source/OPJViewer.h @@ -391,6 +391,9 @@ class OPJFrame: public wxMDIParentFrame void OnTogglePeeker(wxCommandEvent& WXUNUSED(event)); void OnToggleToolbar(wxCommandEvent& WXUNUSED(event)); void OnReload(wxCommandEvent& event); + void OnPrevFrame(wxCommandEvent& event); + void OnHomeFrame(wxCommandEvent& event); + void OnNextFrame(wxCommandEvent& event); void OnSetsEnco(wxCommandEvent& event); void OnSetsDeco(wxCommandEvent& event); void OnSashDrag(wxSashEvent& event); @@ -457,6 +460,9 @@ enum { OPJFRAME_VIEWZOOM, OPJFRAME_VIEWFIT, OPJFRAME_VIEWRELOAD, + OPJFRAME_VIEWPREVFRAME, + OPJFRAME_VIEWHOMEFRAME, + OPJFRAME_VIEWNEXTFRAME, OPJFRAME_FILECLOSE, OPJFRAME_SETSENCO, OPJFRAME_SETSDECO, diff --git a/OPJViewer/source/build.h b/OPJViewer/source/build.h index 58f48193..42c7d4db 100644 --- a/OPJViewer/source/build.h +++ b/OPJViewer/source/build.h @@ -1 +1 @@ -wxT("48") +wxT("59")