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