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
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
// 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
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
\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
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
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
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
OPJFRAME_SETSDECO,\r
\r
OPJFRAME_BROWSEWIN = 10000,\r
- OPJFRAME_LOGWIN\r
+ OPJFRAME_LOGWIN,\r
+ OPJFRAME_TOOLBAR\r
};\r
\r
\r