2007-02-22 18:05:58 +01:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<EFBFBD> degli studi di Perugia (UPG), Italy
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Name: sashtest.h
|
|
|
|
|
// Purpose: Layout window/sash sample
|
|
|
|
|
// Author: Julian Smart
|
|
|
|
|
// Modified by:
|
|
|
|
|
// Created: 04/01/98
|
|
|
|
|
// RCS-ID: $Id: sashtest.h,v 1.5 2005/06/02 12:04:24 JS Exp $
|
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
|
// Licence: wxWindows license
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Name: treectrl.h
|
|
|
|
|
// Purpose: wxTreeCtrl sample
|
|
|
|
|
// Author: Julian Smart
|
|
|
|
|
// Modified by:
|
|
|
|
|
// Created: 04/01/98
|
|
|
|
|
// RCS-ID: $Id: treetest.h,v 1.50 2006/11/04 11:26:51 VZ Exp $
|
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
|
// Licence: wxWindows license
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2007-03-01 01:01:37 +01:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Name: dialogs.h
|
|
|
|
|
// Purpose: Common dialogs demo
|
|
|
|
|
// Author: Julian Smart
|
|
|
|
|
// Modified by: ABX (2004) - adjustementd for conditional building
|
|
|
|
|
// Created: 04/01/98
|
|
|
|
|
// RCS-ID: $Id: dialogs.h,v 1.50 2006/10/08 14:12:59 VZ Exp $
|
|
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
|
// Licence: wxWindows license
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
|
|
|
|
#ifndef __OPJ_VIEWER_H__
|
|
|
|
|
#define __OPJ_VIEWER_H__
|
|
|
|
|
|
|
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
|
#pragma hdrstop
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
|
#include "wx/wx.h"
|
|
|
|
|
#include "wx/mdi.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "wx/toolbar.h"
|
|
|
|
|
#include "wx/laywin.h"
|
|
|
|
|
#include "wx/treectrl.h"
|
|
|
|
|
|
|
|
|
|
#include "icon1.xpm"
|
|
|
|
|
#include "icon2.xpm"
|
|
|
|
|
#include "icon3.xpm"
|
|
|
|
|
#include "icon4.xpm"
|
|
|
|
|
#include "icon5.xpm"
|
|
|
|
|
|
|
|
|
|
#include "wx/filedlg.h"
|
|
|
|
|
#include "wx/toolbar.h"
|
|
|
|
|
#include <wx/filename.h>
|
|
|
|
|
#include <wx/busyinfo.h>
|
|
|
|
|
#include <wx/cmdline.h>
|
|
|
|
|
#include <wx/file.h>
|
|
|
|
|
#include "wx/notebook.h"
|
2007-03-01 01:01:37 +01:00
|
|
|
|
#include <wx/numdlg.h>
|
|
|
|
|
|
|
|
|
|
#include "wx/propdlg.h"
|
|
|
|
|
#include "wx/spinctrl.h"
|
|
|
|
|
|
|
|
|
|
#include <wx/dnd.h>
|
|
|
|
|
#include "wx/wxhtml.h"
|
|
|
|
|
#include "wx/statline.h"
|
2007-03-27 14:48:17 +02:00
|
|
|
|
#include <wx/fs_mem.h>
|
|
|
|
|
|
2007-03-29 10:27:03 +02:00
|
|
|
|
#include <wx/imaglist.h>
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
2007-06-18 01:13:04 +02:00
|
|
|
|
#include "wx/toolbar.h"
|
|
|
|
|
#include "wx/artprov.h"
|
|
|
|
|
|
2007-03-29 10:27:03 +02:00
|
|
|
|
#include "libopenjpeg/openjpeg.h"
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
|
|
|
|
#include "imagj2k.h"
|
|
|
|
|
#include "imagjp2.h"
|
|
|
|
|
#include "imagmj2.h"
|
|
|
|
|
|
2007-03-01 01:01:37 +01:00
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
|
typedef unsigned __int64 int8byte;
|
|
|
|
|
#endif // __WXMSW__
|
|
|
|
|
|
|
|
|
|
#ifdef __WXGTK__
|
|
|
|
|
typedef unsigned long long int8byte;
|
|
|
|
|
#endif // __WXGTK__
|
|
|
|
|
|
2007-02-22 18:05:58 +01:00
|
|
|
|
#define USE_GENERIC_TREECTRL 0
|
2007-04-27 19:20:26 +02:00
|
|
|
|
#define USE_PENCIL_ON_CANVAS 0
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
|
|
|
|
#if USE_GENERIC_TREECTRL
|
|
|
|
|
#include "wx/generic/treectlg.h"
|
|
|
|
|
#ifndef wxTreeCtrl
|
|
|
|
|
#define wxTreeCtrl wxGenericTreeCtrl
|
|
|
|
|
#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-03-27 14:48:17 +02:00
|
|
|
|
#define OPJ_APPLICATION wxT("OPJViewer")
|
2007-02-22 18:05:58 +01:00
|
|
|
|
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
|
2007-04-27 19:20:26 +02:00
|
|
|
|
#define OPJ_APPLICATION_VERSION wxT("0.3 alpha")
|
2007-02-22 18:05:58 +01:00
|
|
|
|
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
|
|
|
|
|
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007, Giuseppe Baruffa")
|
2007-06-16 19:28:47 +02:00
|
|
|
|
#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG")
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
2007-03-27 14:48:17 +02:00
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
|
#define OPJ_APPLICATION_PLATFORM wxT("Windows")
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __WXGTK__
|
|
|
|
|
#define OPJ_APPLICATION_PLATFORM wxT("Linux")
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-06-18 15:05:28 +02:00
|
|
|
|
#define OPJ_FRAME_WIDTH 800
|
|
|
|
|
#define OPJ_FRAME_HEIGHT 600
|
|
|
|
|
|
|
|
|
|
#define OPJ_BROWSER_WIDTH 300
|
|
|
|
|
#define OPJ_PEEKER_HEIGHT 130
|
|
|
|
|
|
2007-02-22 18:05:58 +01:00
|
|
|
|
#define OPJ_CANVAS_BORDER 10
|
|
|
|
|
#define OPJ_CANVAS_COLOUR *wxWHITE
|
|
|
|
|
|
|
|
|
|
class OPJDecoThread;
|
|
|
|
|
class OPJParseThread;
|
|
|
|
|
WX_DEFINE_ARRAY_PTR(wxThread *, wxArrayThread);
|
|
|
|
|
class OPJChildFrame;
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////
|
|
|
|
|
// this is our main application //
|
|
|
|
|
//////////////////////////////////
|
|
|
|
|
class OPJViewerApp: public wxApp
|
|
|
|
|
{
|
|
|
|
|
// public methods and variables
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// class constructor
|
|
|
|
|
OPJViewerApp() { m_showImages = true; m_showButtons = false; }
|
|
|
|
|
|
|
|
|
|
// other methods
|
|
|
|
|
bool OnInit(void);
|
2007-06-16 19:28:47 +02:00
|
|
|
|
int OnExit(void);
|
2007-02-22 18:05:58 +01:00
|
|
|
|
void SetShowImages(bool show) { m_showImages = show; }
|
|
|
|
|
bool ShowImages() const { return m_showImages; }
|
|
|
|
|
void ShowCmdLine(const wxCmdLineParser& parser);
|
|
|
|
|
|
|
|
|
|
// all the threads currently alive - as soon as the thread terminates, it's
|
|
|
|
|
// removed from the array
|
|
|
|
|
wxArrayThread m_deco_threads, m_parse_threads;
|
|
|
|
|
|
|
|
|
|
// crit section protects access to all of the arrays below
|
|
|
|
|
wxCriticalSection m_deco_critsect, m_parse_critsect;
|
|
|
|
|
|
|
|
|
|
// semaphore used to wait for the threads to exit, see OPJFrame::OnQuit()
|
|
|
|
|
wxSemaphore m_deco_semAllDone, m_parse_semAllDone;
|
|
|
|
|
|
|
|
|
|
// the last exiting thread should post to m_semAllDone if this is true
|
|
|
|
|
// (protected by the same m_critsect)
|
|
|
|
|
bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone;
|
|
|
|
|
|
|
|
|
|
// the list of all filenames written in the command line
|
|
|
|
|
wxArrayString m_filelist;
|
|
|
|
|
|
2007-03-27 14:48:17 +02:00
|
|
|
|
// displaying engine parameters
|
|
|
|
|
int m_resizemethod;
|
|
|
|
|
|
2007-03-01 01:01:37 +01:00
|
|
|
|
// decoding engine parameters
|
2007-06-16 19:28:47 +02:00
|
|
|
|
bool m_enabledeco, m_enableparse;
|
2007-03-27 14:48:17 +02:00
|
|
|
|
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
2007-03-01 01:01:37 +01:00
|
|
|
|
#ifdef USE_JPWL
|
|
|
|
|
bool m_enablejpwl;
|
|
|
|
|
int m_expcomps, m_maxtiles;
|
2007-06-18 15:05:28 +02:00
|
|
|
|
int m_framewidth, m_frameheight;
|
2007-03-01 01:01:37 +01:00
|
|
|
|
#endif // USE_JPWL
|
|
|
|
|
|
2007-06-18 15:05:28 +02:00
|
|
|
|
// some layout settings
|
|
|
|
|
bool m_showtoolbar, m_showbrowser, m_showpeeker;
|
|
|
|
|
int m_browserwidth, m_peekerheight;
|
|
|
|
|
|
2007-06-16 19:28:47 +02:00
|
|
|
|
// application configuration
|
|
|
|
|
wxConfig *OPJconfig;
|
|
|
|
|
|
2007-02-22 18:05:58 +01:00
|
|
|
|
// private methods and variables
|
|
|
|
|
private:
|
|
|
|
|
bool m_showImages, m_showButtons;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DECLARE_APP(OPJViewerApp)
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////
|
|
|
|
|
// this canvas is used to draw the image //
|
|
|
|
|
///////////////////////////////////////////
|
|
|
|
|
class OPJCanvas: public wxScrolledWindow
|
|
|
|
|
{
|
|
|
|
|
// public methods and variables
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// class constructor
|
|
|
|
|
OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
|
|
|
|
|
|
|
|
|
virtual void OnDraw(wxDC& dc);
|
|
|
|
|
void OnEvent(wxMouseEvent& event);
|
2007-03-30 11:27:08 +02:00
|
|
|
|
void WriteText(const wxString& text) {
|
|
|
|
|
#ifndef __WXGTK__
|
|
|
|
|
wxMutexGuiEnter();
|
|
|
|
|
#endif //__WXGTK__
|
|
|
|
|
wxLogMessage(text);
|
|
|
|
|
#ifndef __WXGTK__
|
|
|
|
|
wxMutexGuiLeave();
|
|
|
|
|
#endif //__WXGTK__
|
|
|
|
|
}
|
2007-02-22 18:05:58 +01:00
|
|
|
|
OPJDecoThread *CreateDecoThread(void);
|
2007-03-01 01:01:37 +01:00
|
|
|
|
OPJChildFrame *m_childframe;
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
2007-03-01 01:01:37 +01:00
|
|
|
|
wxBitmap m_image, m_image100;
|
2007-02-22 18:05:58 +01:00
|
|
|
|
wxFileName m_fname;
|
2007-03-01 01:01:37 +01:00
|
|
|
|
long m_zooml;
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
|
// the data associated to each tree leaf or node //
|
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
|
class OPJMarkerData : public wxTreeItemData
|
|
|
|
|
{
|
|
|
|
|
// public methods and variables
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// class constructor
|
|
|
|
|
OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""), wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc), m_filestring(fname) { m_start = start; m_length = length; }
|
|
|
|
|
|
|
|
|
|
void ShowInfo(wxTreeCtrl *tree);
|
|
|
|
|
const wxChar *GetDesc1() const { return m_desc.c_str(); }
|
|
|
|
|
const wxChar *GetDesc2() const { return m_filestring.c_str(); }
|
|
|
|
|
wxFileOffset m_start, m_length;
|
|
|
|
|
|
|
|
|
|
// private methods and variables
|
|
|
|
|
private:
|
|
|
|
|
wxString m_desc;
|
|
|
|
|
wxString m_filestring;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OPJMarkerTree : public wxTreeCtrl
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
TreeCtrlIcon_File,
|
|
|
|
|
TreeCtrlIcon_FileSelected,
|
|
|
|
|
TreeCtrlIcon_Folder,
|
|
|
|
|
TreeCtrlIcon_FolderSelected,
|
|
|
|
|
TreeCtrlIcon_FolderOpened
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
OPJMarkerTree() { };
|
2007-03-27 14:48:17 +02:00
|
|
|
|
OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id,
|
2007-02-22 18:05:58 +01:00
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
|
long style);
|
|
|
|
|
virtual ~OPJMarkerTree(){};
|
2007-03-27 14:48:17 +02:00
|
|
|
|
OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00, OPJChildFrame *subframe = NULL);
|
2007-02-22 18:05:58 +01:00
|
|
|
|
void WriteText(const wxString& text) { wxMutexGuiEnter(); wxLogMessage(text); wxMutexGuiLeave(); }
|
|
|
|
|
|
|
|
|
|
wxFileName m_fname;
|
|
|
|
|
wxTextCtrl *m_peektextCtrl;
|
2007-03-27 14:48:17 +02:00
|
|
|
|
OPJChildFrame *m_childframe;
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
|
|
|
|
/*void OnBeginDrag(wxTreeEvent& event);
|
|
|
|
|
void OnBeginRDrag(wxTreeEvent& event);
|
|
|
|
|
void OnEndDrag(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnBeginLabelEdit(wxTreeEvent& event);
|
|
|
|
|
void OnEndLabelEdit(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnDeleteItem(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnContextMenu(wxContextMenuEvent& event);*/
|
2007-03-01 01:01:37 +01:00
|
|
|
|
void OnItemMenu(wxTreeEvent& event);
|
2007-02-22 18:05:58 +01:00
|
|
|
|
/*void OnGetInfo(wxTreeEvent& event);
|
|
|
|
|
void OnSetInfo(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnItemExpanded(wxTreeEvent& event);*/
|
|
|
|
|
void OnItemExpanding(wxTreeEvent& event);
|
|
|
|
|
/*void OnItemCollapsed(wxTreeEvent& event);
|
|
|
|
|
void OnItemCollapsing(wxTreeEvent& event);*/
|
|
|
|
|
void OnSelChanged(wxTreeEvent& event);
|
|
|
|
|
/*void OnSelChanging(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnTreeKeyDown(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnItemActivated(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnItemRClick(wxTreeEvent& event);*/
|
|
|
|
|
/*void OnRMouseDown(wxMouseEvent& event);
|
|
|
|
|
void OnRMouseUp(wxMouseEvent& event);
|
|
|
|
|
void OnRMouseDClick(wxMouseEvent& event);*/
|
|
|
|
|
/*void GetItemsRecursively(const wxTreeItemId& idParent,
|
|
|
|
|
wxTreeItemIdValue cookie = 0);*/
|
|
|
|
|
|
|
|
|
|
void CreateImageList(int size = 16);
|
|
|
|
|
void CreateButtonsImageList(int size = 11);
|
|
|
|
|
|
|
|
|
|
/*void AddTestItemsToTree(size_t numChildren, size_t depth);*/
|
|
|
|
|
/*void DoSortChildren(const wxTreeItemId& item, bool reverse = false)
|
|
|
|
|
{ m_reverseSort = reverse; wxTreeCtrl::SortChildren(item); }*/
|
|
|
|
|
/*void DoEnsureVisible() { if (m_lastItem.IsOk()) EnsureVisible(m_lastItem); }*/
|
|
|
|
|
/*void DoToggleIcon(const wxTreeItemId& item);*/
|
|
|
|
|
/*void ShowMenu(wxTreeItemId id, const wxPoint& pt);*/
|
|
|
|
|
|
|
|
|
|
int ImageSize(void) const { return m_imageSize; }
|
|
|
|
|
|
|
|
|
|
void SetLastItem(wxTreeItemId id) { m_lastItem = id; }
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
/*virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);*/
|
|
|
|
|
|
|
|
|
|
// is this the test item which we use in several event handlers?
|
|
|
|
|
/*bool IsTestItem(const wxTreeItemId& item)
|
|
|
|
|
{
|
|
|
|
|
// the test item is the first child folder
|
|
|
|
|
return GetItemParent(item) == GetRootItem() && !GetPrevSibling(item);
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/*void AddItemsRecursively(const wxTreeItemId& idParent,
|
|
|
|
|
size_t nChildren,
|
|
|
|
|
size_t depth,
|
|
|
|
|
size_t folder);*/
|
|
|
|
|
|
|
|
|
|
void LogEvent(const wxChar *name, const wxTreeEvent& event);
|
|
|
|
|
|
|
|
|
|
int m_imageSize; // current size of images
|
|
|
|
|
bool m_reverseSort; // flag for OnCompareItems
|
|
|
|
|
wxTreeItemId m_lastItem, // for OnEnsureVisible()
|
|
|
|
|
m_draggedItem; // item being dragged right now
|
|
|
|
|
|
|
|
|
|
// NB: due to an ugly wxMSW hack you _must_ use DECLARE_DYNAMIC_CLASS()
|
|
|
|
|
// if you want your overloaded OnCompareItems() to be called.
|
|
|
|
|
// OTOH, if you don't want it you may omit the next line - this will
|
|
|
|
|
// make default (alphabetical) sorting much faster under wxMSW.
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(OPJMarkerTree)
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// this hash map stores all the trees of currently opened images, with an integer key
|
|
|
|
|
WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual, OPJMarkerTreeHash);
|
|
|
|
|
|
|
|
|
|
// this hash map stores all the children of currently opened images, with an integer key
|
|
|
|
|
WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual, OPJChildFrameHash);
|
|
|
|
|
|
|
|
|
|
// Define a new frame
|
|
|
|
|
class OPJFrame: public wxMDIParentFrame
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
|
|
|
|
|
|
|
|
|
~OPJFrame(void);
|
2007-03-27 14:48:17 +02:00
|
|
|
|
void OnSize(wxSizeEvent& WXUNUSED(event));
|
2007-02-22 18:05:58 +01:00
|
|
|
|
void OnAbout(wxCommandEvent& WXUNUSED(event));
|
|
|
|
|
void OnFileOpen(wxCommandEvent& WXUNUSED(event));
|
|
|
|
|
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
2007-03-01 01:01:37 +01:00
|
|
|
|
void OnClose(wxCommandEvent& WXUNUSED(event));
|
|
|
|
|
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
|
|
|
|
void OnFit(wxCommandEvent& WXUNUSED(event));
|
2007-03-27 14:48:17 +02:00
|
|
|
|
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
|
|
|
|
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
2007-06-18 01:13:04 +02:00
|
|
|
|
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
2007-03-27 14:48:17 +02:00
|
|
|
|
void OnReload(wxCommandEvent& event);
|
2007-06-21 16:00:32 +02:00
|
|
|
|
void OnPrevFrame(wxCommandEvent& event);
|
|
|
|
|
void OnHomeFrame(wxCommandEvent& event);
|
|
|
|
|
void OnNextFrame(wxCommandEvent& event);
|
2007-06-03 19:34:46 +02:00
|
|
|
|
void OnSetsEnco(wxCommandEvent& event);
|
2007-03-01 01:01:37 +01:00
|
|
|
|
void OnSetsDeco(wxCommandEvent& event);
|
2007-02-22 18:05:58 +01:00
|
|
|
|
void OnSashDrag(wxSashEvent& event);
|
|
|
|
|
void OpenFiles(wxArrayString paths, wxArrayString filenames);
|
|
|
|
|
void OnNotebook(wxNotebookEvent& event);
|
2007-03-01 01:01:37 +01:00
|
|
|
|
void Rescale(int scale, OPJChildFrame *child);
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
|
|
|
|
OPJMarkerTreeHash m_treehash;
|
|
|
|
|
OPJChildFrameHash m_childhash;
|
|
|
|
|
wxSashLayoutWindow* markerTreeWindow;
|
|
|
|
|
wxSashLayoutWindow* loggingWindow;
|
2007-06-18 01:13:04 +02:00
|
|
|
|
wxToolBar* tool_bar;
|
2007-02-22 18:05:58 +01:00
|
|
|
|
void Resize(int number);
|
|
|
|
|
wxNotebook *m_bookCtrl;
|
|
|
|
|
wxNotebook *m_bookCtrlbottom;
|
|
|
|
|
wxTextCtrl *m_textCtrlbrowse;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void TogStyle(int id, long flag);
|
|
|
|
|
|
|
|
|
|
void DoSort(bool reverse = false);
|
|
|
|
|
|
|
|
|
|
wxPanel *m_panel;
|
|
|
|
|
wxTextCtrl *m_textCtrl;
|
|
|
|
|
|
|
|
|
|
void DoSetBold(bool bold = true);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
wxSashLayoutWindow* m_topWindow;
|
|
|
|
|
wxSashLayoutWindow* m_leftWindow2;
|
|
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class OPJChildFrame: public wxMDIChildFrame
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
OPJCanvas *m_canvas;
|
|
|
|
|
OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
|
|
|
|
~OPJChildFrame(void);
|
|
|
|
|
void OnActivate(wxActivateEvent& event);
|
|
|
|
|
/*void OnQuit(wxCommandEvent& WXUNUSED(event));*/
|
|
|
|
|
void OnClose(wxCloseEvent& event);
|
|
|
|
|
void OnGotFocus(wxFocusEvent& event);
|
2007-03-01 01:01:37 +01:00
|
|
|
|
void OnLostFocus(wxFocusEvent& event);
|
2007-02-22 18:05:58 +01:00
|
|
|
|
OPJFrame *m_frame;
|
|
|
|
|
wxFileName m_fname;
|
|
|
|
|
int m_winnumber;
|
|
|
|
|
|
2007-03-27 14:48:17 +02:00
|
|
|
|
unsigned long m_twidth, m_theight, m_tx, m_ty;
|
|
|
|
|
|
2007-03-01 01:01:37 +01:00
|
|
|
|
DECLARE_EVENT_TABLE()
|
2007-02-22 18:05:58 +01:00
|
|
|
|
};
|
|
|
|
|
|
2007-03-01 01:01:37 +01:00
|
|
|
|
// frame and main menu ids
|
|
|
|
|
enum {
|
|
|
|
|
OPJFRAME_FILEEXIT = wxID_EXIT,
|
|
|
|
|
OPJFRAME_HELPABOUT = wxID_ABOUT,
|
|
|
|
|
OPJFRAME_FILEOPEN,
|
2007-06-18 01:13:04 +02:00
|
|
|
|
OPJFRAME_FILESAVEAS,
|
2007-03-27 14:48:17 +02:00
|
|
|
|
OPJFRAME_FILETOGGLEB,
|
|
|
|
|
OPJFRAME_FILETOGGLEP,
|
2007-06-18 01:13:04 +02:00
|
|
|
|
OPJFRAME_FILETOGGLET,
|
2007-03-01 01:01:37 +01:00
|
|
|
|
OPJFRAME_VIEWZOOM,
|
|
|
|
|
OPJFRAME_VIEWFIT,
|
2007-03-27 14:48:17 +02:00
|
|
|
|
OPJFRAME_VIEWRELOAD,
|
2007-06-21 16:00:32 +02:00
|
|
|
|
OPJFRAME_VIEWPREVFRAME,
|
|
|
|
|
OPJFRAME_VIEWHOMEFRAME,
|
|
|
|
|
OPJFRAME_VIEWNEXTFRAME,
|
2007-03-01 01:01:37 +01:00
|
|
|
|
OPJFRAME_FILECLOSE,
|
2007-06-03 19:34:46 +02:00
|
|
|
|
OPJFRAME_SETSENCO,
|
2007-03-01 01:01:37 +01:00
|
|
|
|
OPJFRAME_SETSDECO,
|
|
|
|
|
|
|
|
|
|
OPJFRAME_BROWSEWIN = 10000,
|
2007-06-18 01:13:04 +02:00
|
|
|
|
OPJFRAME_LOGWIN,
|
|
|
|
|
OPJFRAME_TOOLBAR
|
2007-03-01 01:01:37 +01:00
|
|
|
|
};
|
2007-02-22 18:05:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// menu and control ids
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
TreeTest_Quit = wxID_EXIT,
|
|
|
|
|
TreeTest_About = wxID_ABOUT,
|
|
|
|
|
TreeTest_TogButtons = wxID_HIGHEST,
|
|
|
|
|
TreeTest_TogTwist,
|
|
|
|
|
TreeTest_TogLines,
|
|
|
|
|
TreeTest_TogEdit,
|
|
|
|
|
TreeTest_TogHideRoot,
|
|
|
|
|
TreeTest_TogRootLines,
|
|
|
|
|
TreeTest_TogBorder,
|
|
|
|
|
TreeTest_TogFullHighlight,
|
|
|
|
|
TreeTest_SetFgColour,
|
|
|
|
|
TreeTest_SetBgColour,
|
|
|
|
|
TreeTest_ResetStyle,
|
|
|
|
|
TreeTest_Highlight,
|
|
|
|
|
TreeTest_Dump,
|
|
|
|
|
TreeTest_DumpSelected,
|
|
|
|
|
TreeTest_Count,
|
|
|
|
|
TreeTest_CountRec,
|
|
|
|
|
TreeTest_Sort,
|
|
|
|
|
TreeTest_SortRev,
|
|
|
|
|
TreeTest_SetBold,
|
|
|
|
|
TreeTest_ClearBold,
|
|
|
|
|
TreeTest_Rename,
|
|
|
|
|
TreeTest_Delete,
|
|
|
|
|
TreeTest_DeleteChildren,
|
|
|
|
|
TreeTest_DeleteAll,
|
|
|
|
|
TreeTest_Recreate,
|
|
|
|
|
TreeTest_ToggleImages,
|
|
|
|
|
TreeTest_ToggleButtons,
|
|
|
|
|
TreeTest_SetImageSize,
|
|
|
|
|
TreeTest_ToggleSel,
|
|
|
|
|
TreeTest_CollapseAndReset,
|
|
|
|
|
TreeTest_EnsureVisible,
|
|
|
|
|
TreeTest_AddItem,
|
|
|
|
|
TreeTest_InsertItem,
|
|
|
|
|
TreeTest_IncIndent,
|
|
|
|
|
TreeTest_DecIndent,
|
|
|
|
|
TreeTest_IncSpacing,
|
|
|
|
|
TreeTest_DecSpacing,
|
|
|
|
|
TreeTest_ToggleIcon,
|
|
|
|
|
TreeTest_Select,
|
|
|
|
|
TreeTest_Unselect,
|
|
|
|
|
TreeTest_SelectRoot,
|
|
|
|
|
TreeTest_Ctrl = 1000,
|
|
|
|
|
BOTTOM_NOTEBOOK_ID,
|
|
|
|
|
LEFT_NOTEBOOK_ID
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class OPJDecoThread : public wxThread
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
OPJDecoThread(OPJCanvas *canvas);
|
|
|
|
|
|
|
|
|
|
// thread execution starts here
|
|
|
|
|
virtual void *Entry();
|
|
|
|
|
|
|
|
|
|
// called when the thread exits - whether it terminates normally or is
|
|
|
|
|
// stopped with Delete() (but not when it is Kill()ed!)
|
|
|
|
|
virtual void OnExit();
|
|
|
|
|
|
|
|
|
|
// write something to the text control
|
|
|
|
|
void WriteText(const wxString& text);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
unsigned m_count;
|
|
|
|
|
OPJCanvas *m_canvas;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class OPJParseThread : public wxThread
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid = 0x00);
|
|
|
|
|
|
|
|
|
|
// thread execution starts here
|
|
|
|
|
virtual void *Entry();
|
|
|
|
|
|
|
|
|
|
// called when the thread exits - whether it terminates normally or is
|
|
|
|
|
// stopped with Delete() (but not when it is Kill()ed!)
|
|
|
|
|
virtual void OnExit();
|
|
|
|
|
|
|
|
|
|
// write something to the text control
|
|
|
|
|
void WriteText(const wxString& text);
|
|
|
|
|
void LoadFile(wxFileName fname);
|
|
|
|
|
void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, wxTreeItemId parentid);
|
|
|
|
|
void ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid);
|
|
|
|
|
|
|
|
|
|
unsigned m_count;
|
|
|
|
|
OPJMarkerTree *m_tree;
|
|
|
|
|
wxTreeItemId m_parentid;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
|
|
|
|
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
|
|
|
|
int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
|
|
|
|
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2007-03-01 01:01:37 +01:00
|
|
|
|
|
|
|
|
|
// Drag and drop files target
|
|
|
|
|
class OPJDnDFile: public wxFileDropTarget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
OPJDnDFile(OPJFrame *pOwner) { m_pOwner = pOwner; }
|
|
|
|
|
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
OPJFrame *m_pOwner;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-06-03 19:34:46 +02:00
|
|
|
|
// Property sheet dialog: encoder
|
|
|
|
|
class OPJEncoderDialog: public wxPropertySheetDialog
|
|
|
|
|
{
|
|
|
|
|
DECLARE_CLASS(OPJEncoderDialog)
|
|
|
|
|
public:
|
|
|
|
|
OPJEncoderDialog(wxWindow* parent, int dialogType);
|
|
|
|
|
~OPJEncoderDialog();
|
|
|
|
|
|
|
|
|
|
wxBookCtrlBase* m_settingsNotebook;
|
|
|
|
|
|
|
|
|
|
wxPanel* CreateMainSettingsPage(wxWindow* parent);
|
|
|
|
|
wxPanel* CreatePart1SettingsPage(wxWindow* parent);
|
|
|
|
|
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
|
|
|
|
|
#ifdef USE_JPWL
|
|
|
|
|
void OnEnableJPWL(wxCommandEvent& event);
|
|
|
|
|
/* wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
|
|
|
|
wxCheckBox *m_enablejpwlCheck;*/
|
|
|
|
|
#endif // USE_JPWL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
OPJENCO_ENABLEJPWL = 100,
|
|
|
|
|
OPJENCO_RATEFACTOR,
|
|
|
|
|
OPJENCO_QUALITYFACTOR,
|
|
|
|
|
OPJENCO_RESNUMBER,
|
|
|
|
|
OPJENCO_CODEBLOCKSIZE,
|
|
|
|
|
OPJENCO_PRECINCTSIZE,
|
|
|
|
|
OPJENCO_TILESIZE,
|
|
|
|
|
OPJENCO_PROGRESSION,
|
|
|
|
|
OPJENCO_SUBSAMPLING,
|
|
|
|
|
OPJENCO_ENABLESOP,
|
|
|
|
|
OPJENCO_ENABLEEPH,
|
|
|
|
|
OPJENCO_ENABLEBYPASS,
|
|
|
|
|
OPJENCO_ENABLERESET,
|
|
|
|
|
OPJENCO_ENABLERESTART,
|
|
|
|
|
OPJENCO_ENABLEVSC,
|
|
|
|
|
OPJENCO_ENABLEERTERM,
|
|
|
|
|
OPJENCO_ENABLESEGMARK,
|
|
|
|
|
OPJENCO_ROICOMP,
|
|
|
|
|
OPJENCO_ROISHIFT,
|
|
|
|
|
OPJENCO_IMORIG,
|
|
|
|
|
OPJENCO_TILORIG,
|
|
|
|
|
OPJENCO_ENABLEIRREV,
|
|
|
|
|
OPJENCO_ENABLEINDEX,
|
|
|
|
|
OPJENCO_INDEXNAME
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Property sheet dialog: decoder
|
2007-03-01 01:01:37 +01:00
|
|
|
|
class OPJDecoderDialog: public wxPropertySheetDialog
|
|
|
|
|
{
|
|
|
|
|
DECLARE_CLASS(OPJDecoderDialog)
|
|
|
|
|
public:
|
|
|
|
|
OPJDecoderDialog(wxWindow* parent, int dialogType);
|
|
|
|
|
~OPJDecoderDialog();
|
|
|
|
|
|
2007-04-23 00:41:01 +02:00
|
|
|
|
wxBookCtrlBase* m_settingsNotebook;
|
2007-06-16 19:28:47 +02:00
|
|
|
|
wxCheckBox *m_enabledecoCheck, *m_enableparseCheck;
|
2007-03-01 01:01:37 +01:00
|
|
|
|
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
|
2007-03-27 14:48:17 +02:00
|
|
|
|
wxRadioBox* m_resizeBox;
|
2007-03-01 01:01:37 +01:00
|
|
|
|
|
2007-04-23 00:41:01 +02:00
|
|
|
|
void OnEnableDeco(wxCommandEvent& event);
|
|
|
|
|
|
2007-03-01 01:01:37 +01:00
|
|
|
|
wxPanel* CreateMainSettingsPage(wxWindow* parent);
|
2007-03-27 14:48:17 +02:00
|
|
|
|
wxPanel* CreatePart1SettingsPage(wxWindow* parent);
|
|
|
|
|
wxPanel* CreatePart3SettingsPage(wxWindow* parent);
|
2007-03-01 01:01:37 +01:00
|
|
|
|
#ifdef USE_JPWL
|
|
|
|
|
void OnEnableJPWL(wxCommandEvent& event);
|
2007-03-27 14:48:17 +02:00
|
|
|
|
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
|
|
|
|
wxSpinCtrl *m_expcompsCtrl, *m_framenumCtrl, *m_maxtilesCtrl;
|
2007-03-01 01:01:37 +01:00
|
|
|
|
wxCheckBox *m_enablejpwlCheck;
|
|
|
|
|
#endif // USE_JPWL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
enum {
|
2007-03-27 14:48:17 +02:00
|
|
|
|
OPJDECO_RESMETHOD = 100,
|
|
|
|
|
OPJDECO_REDUCEFACTOR,
|
2007-03-01 01:01:37 +01:00
|
|
|
|
OPJDECO_QUALITYLAYERS,
|
|
|
|
|
OPJDECO_NUMCOMPS,
|
2007-04-23 00:41:01 +02:00
|
|
|
|
OPJDECO_ENABLEDECO,
|
2007-06-16 19:28:47 +02:00
|
|
|
|
OPJDECO_ENABLEPARSE,
|
2007-03-01 01:01:37 +01:00
|
|
|
|
OPJDECO_ENABLEJPWL,
|
|
|
|
|
OPJDECO_EXPCOMPS,
|
2007-03-27 14:48:17 +02:00
|
|
|
|
OPJDECO_MAXTILES,
|
|
|
|
|
OPJDECO_FRAMENUM
|
2007-03-01 01:01:37 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
};
|
|
|
|
|
|
2007-02-22 18:05:58 +01:00
|
|
|
|
#endif //__OPJ_VIEWER_H__
|
2007-03-01 01:01:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|