]> granicus.if.org Git - openjpeg/commitdiff
added toolbar to OPJViewer
authorGiuseppe Baruffa <gbaruffa@users.noreply.github.com>
Sun, 17 Jun 2007 23:13:04 +0000 (23:13 +0000)
committerGiuseppe Baruffa <gbaruffa@users.noreply.github.com>
Sun, 17 Jun 2007 23:13:04 +0000 (23:13 +0000)
OPJViewer/source/OPJViewer.cpp
OPJViewer/source/OPJViewer.h
OPJViewer/source/build.h

index 2d1e3ac6ef9d784bac03556ff5e997bbdf8fad84..6d53d292be1789e6561b137c3d9118b6800ec890 100644 (file)
@@ -318,6 +318,7 @@ BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
     EVT_MENU(OPJFRAME_VIEWRELOAD, OPJFrame::OnReload)\r
     EVT_MENU(OPJFRAME_FILETOGGLEB, OPJFrame::OnToggleBrowser)\r
     EVT_MENU(OPJFRAME_FILETOGGLEP, OPJFrame::OnTogglePeeker)\r
+    EVT_MENU(OPJFRAME_FILETOGGLET, OPJFrame::OnToggleToolbar)\r
     EVT_MENU(OPJFRAME_SETSENCO, OPJFrame::OnSetsEnco)\r
     EVT_MENU(OPJFRAME_SETSDECO, OPJFrame::OnSetsDeco)\r
     EVT_SASH_DRAGGED_RANGE(OPJFRAME_BROWSEWIN, OPJFRAME_LOGWIN, OPJFrame::OnSashDrag)\r
@@ -335,12 +336,19 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
        file_menu->Append(OPJFRAME_FILEOPEN, wxT("&Open\tCtrl+O"));\r
        file_menu->SetHelpString(OPJFRAME_FILEOPEN, wxT("Open one or more files"));\r
 \r
+       file_menu->Append(OPJFRAME_FILESAVEAS, wxT("&Save as\tCtrl+S"));\r
+       file_menu->SetHelpString(OPJFRAME_FILESAVEAS, wxT("Save the current image"));\r
+       file_menu->Enable(OPJFRAME_FILESAVEAS, false);\r
+\r
        file_menu->Append(OPJFRAME_FILETOGGLEB, wxT("Toggle &browser\tCtrl+B"));\r
        file_menu->SetHelpString(OPJFRAME_FILETOGGLEB, wxT("Toggle the left browsing pane"));\r
 \r
        file_menu->Append(OPJFRAME_FILETOGGLEP, wxT("Toggle &peeker\tCtrl+P"));\r
        file_menu->SetHelpString(OPJFRAME_FILETOGGLEP, wxT("Toggle the bottom peeking pane"));\r
 \r
+       file_menu->Append(OPJFRAME_FILETOGGLET, wxT("Toggle &toolbar\tCtrl+T"));\r
+       file_menu->SetHelpString(OPJFRAME_FILETOGGLET, wxT("Toggle the toolbar"));\r
+\r
        file_menu->Append(OPJFRAME_FILECLOSE, wxT("&Close\tCtrl+C"));\r
        file_menu->SetHelpString(OPJFRAME_FILECLOSE, wxT("Close current image"));\r
 \r
@@ -387,6 +395,40 @@ OPJFrame::OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
        // the status bar\r
        CreateStatusBar();\r
 \r
+       // the toolbar\r
+       tool_bar = new wxToolBar(this, OPJFRAME_TOOLBAR,\r
+                                                               wxDefaultPosition, wxDefaultSize,\r
+                                                               wxTB_HORIZONTAL | wxNO_BORDER);\r
+       wxBitmap bmpOpen = wxArtProvider::GetBitmap(wxART_FILE_OPEN, wxART_TOOLBAR,\r
+                                                                                               wxDefaultSize);\r
+       wxBitmap bmpSaveAs = wxArtProvider::GetBitmap(wxART_FILE_SAVE_AS, wxART_TOOLBAR,\r
+                                                                                               wxDefaultSize);\r
+       wxBitmap bmpZoom = wxArtProvider::GetBitmap(wxART_FIND, wxART_TOOLBAR,\r
+                                                                                               wxDefaultSize);\r
+       wxBitmap bmpFit = wxArtProvider::GetBitmap(wxART_FIND_AND_REPLACE, wxART_TOOLBAR,\r
+                                                                                               wxDefaultSize);\r
+       wxBitmap bmpReload = wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_TOOLBAR,\r
+                                                                                               wxDefaultSize);\r
+       wxBitmap bmpDecosettings = wxArtProvider::GetBitmap(wxART_REPORT_VIEW, wxART_TOOLBAR,\r
+                                                                                               wxDefaultSize);\r
+       wxBitmap bmpEncosettings = wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_TOOLBAR,\r
+                                                                                               wxDefaultSize);\r
+\r
+       tool_bar->AddTool(OPJFRAME_FILEOPEN, bmpOpen, wxT("Open"));\r
+       tool_bar->AddTool(OPJFRAME_FILESAVEAS, bmpSaveAs, wxT("Save as "));\r
+       tool_bar->EnableTool(OPJFRAME_FILESAVEAS, false);\r
+       tool_bar->AddSeparator();\r
+       tool_bar->AddTool(OPJFRAME_VIEWZOOM, bmpZoom, wxT("Zoom"));\r
+       tool_bar->AddTool(OPJFRAME_VIEWFIT, bmpFit, wxT("Zoom to fit"));\r
+       tool_bar->AddTool(OPJFRAME_VIEWRELOAD, bmpReload, wxT("Reload"));\r
+       tool_bar->AddSeparator();\r
+       tool_bar->AddTool(OPJFRAME_SETSDECO, bmpDecosettings, wxT("Decoder settings"));\r
+       tool_bar->AddTool(OPJFRAME_SETSENCO, bmpEncosettings, wxT("Encoder settings"));\r
+       tool_bar->Realize();\r
+       \r
+       // associate the toolbar with the frame\r
+       SetToolBar(tool_bar);\r
+\r
        // the logging window\r
        loggingWindow = new wxSashLayoutWindow(this, OPJFRAME_LOGWIN,\r
                                                                                        wxDefaultPosition, wxSize(400, 130),\r
@@ -713,6 +755,17 @@ void OPJFrame::OnTogglePeeker(wxCommandEvent& WXUNUSED(event))
     layout.LayoutMDIFrame(this);\r
 }\r
 \r
+void OPJFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))\r
+{\r
+    if (tool_bar->IsShown())\r
+        tool_bar->Show(false);\r
+    else\r
+        tool_bar->Show(true);\r
+\r
+    wxLayoutAlgorithm layout;\r
+    layout.LayoutMDIFrame(this);\r
+}\r
+\r
 void OPJFrame::OnSashDrag(wxSashEvent& event)\r
 {\r
     if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)\r
index c69c55db4abb14202f4b548f7361e81cb1380b87..bbd0b50156d7d7013af5f565744a0d4a516f54e3 100644 (file)
@@ -98,6 +98,9 @@
 \r
 #include <wx/imaglist.h>\r
 \r
+#include "wx/toolbar.h"\r
+#include "wx/artprov.h"\r
+\r
 #include "libopenjpeg/openjpeg.h"\r
 \r
 #include "imagj2k.h"\r
@@ -375,6 +378,7 @@ class OPJFrame: public wxMDIParentFrame
        void OnFit(wxCommandEvent& WXUNUSED(event));\r
        void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));\r
        void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));\r
+       void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));\r
        void OnReload(wxCommandEvent& event);\r
        void OnSetsEnco(wxCommandEvent& event);\r
        void OnSetsDeco(wxCommandEvent& event);\r
@@ -387,6 +391,7 @@ class OPJFrame: public wxMDIParentFrame
        OPJChildFrameHash m_childhash;\r
     wxSashLayoutWindow* markerTreeWindow;\r
     wxSashLayoutWindow* loggingWindow;\r
+       wxToolBar* tool_bar;\r
     void Resize(int number);\r
        wxNotebook *m_bookCtrl;\r
        wxNotebook *m_bookCtrlbottom;\r
@@ -434,8 +439,10 @@ enum {
        OPJFRAME_FILEEXIT = wxID_EXIT,\r
        OPJFRAME_HELPABOUT = wxID_ABOUT,\r
        OPJFRAME_FILEOPEN,\r
+       OPJFRAME_FILESAVEAS,\r
        OPJFRAME_FILETOGGLEB,\r
        OPJFRAME_FILETOGGLEP,\r
+       OPJFRAME_FILETOGGLET,\r
        OPJFRAME_VIEWZOOM,\r
        OPJFRAME_VIEWFIT,\r
        OPJFRAME_VIEWRELOAD,\r
@@ -444,7 +451,8 @@ enum {
        OPJFRAME_SETSDECO,\r
 \r
        OPJFRAME_BROWSEWIN = 10000,\r
-       OPJFRAME_LOGWIN\r
+       OPJFRAME_LOGWIN,\r
+       OPJFRAME_TOOLBAR\r
 };\r
 \r
 \r
index d944e63698b88db6b5225a9fb34c1967c26dcf3c..b200df0a2199a51afbad189883f4725e25175e43 100644 (file)
@@ -1 +1 @@
-wxT("20") \r
+wxT("42") \r