graphics/panoglview: use wx30-gtk2 as a default wxWidgets toolkit

PR:		233752
Submitted by:	Iouri V. Ivliev <ii@any.com.ru> (maintainer)
This commit is contained in:
Steve Wills
2018-12-04 17:46:22 +00:00
parent a075fd6aa4
commit e4f8fefbea
7 changed files with 253 additions and 1 deletions

View File

@@ -20,7 +20,7 @@ CFLAGS+= -I${LOCALBASE}/include
CXXFLAGS+= -I${LOCALBASE}/include -ftemplate-depth-64
LIBS+= -L${LOCALBASE}/lib -lGLU -lGL
USE_WX= 2.8
USE_WX= 2.8 3.0
WX_COMPS= wx
WX_CONF_ARGS= relative

View File

@@ -0,0 +1,98 @@
--- src/panocanvas.cpp.orig 2008-07-23 21:09:12 UTC
+++ src/panocanvas.cpp
@@ -41,12 +41,20 @@
BEGIN_EVENT_TABLE(panoCanvas, wxGLCanvas)
EVT_PAINT(panoCanvas::OnPaint)
+#if wxCHECK_VERSION(3,0,0)
+ EVT_SIZE (panoCanvas::resized)
+#else //wxCHECK_VERSION(3,0,0)
EVT_SIZE (panoCanvas::OnSize)
+#endif //wxCHECK_VERSION(3,0,0)
EVT_ERASE_BACKGROUND(panoCanvas::OnEraseBackground)
END_EVENT_TABLE()
panoCanvas::panoCanvas(wxWindow *parent, int id, const wxPoint &position, const wxSize &size) :
+#if wxCHECK_VERSION(3,0,0)
+wxGLCanvas(parent,id,0,position,size),
+#else //wxCHECK_VERSION(3,0,0)
wxGLCanvas(parent,id,position,size),
+#endif //wxCHECK_VERSION(3,0,0)
m_position(0.0,0.0,50.0),
m_aspectratio(size.GetWidth()/(double) size.GetHeight()),
m_initialized(false),
@@ -56,6 +64,9 @@ m_currentboundaries(CPanRange (-m_position.getFov()*m
CAngleRange( -m_position.getFov() / 2.0, m_position.getFov() / 2.0),
CAngleRange( 0.0, 180.0 )),
m_imageboundaries(CPanRange(-180.0,180.0),CAngleRange(-90.0,90.0),CAngleRange(0.0,180.0)),
+#if wxCHECK_VERSION(3,0,0)
+m_context(new wxGLContext(this)),
+#endif //wxCHECK_VERSION(3,0,0)
m_divisions(128)
{
for(int i=0;i<16;++i)
@@ -68,24 +79,40 @@ panoCanvas::~panoCanvas()
{
if(m_hasimage)
deletePanorama();
+#if wxCHECK_VERSION(3,0,0)
+ delete m_context;
+#endif //wxCHECK_VERSION(3,0,0)
}
void panoCanvas::OnEraseBackground(wxEraseEvent& event)
{
}
+#if wxCHECK_VERSION(3,0,0)
+void panoCanvas::resized(wxSizeEvent &event)
+#else //wxCHECK_VERSION(3,0,0)
void panoCanvas::OnSize(wxSizeEvent &event)
+#endif //wxCHECK_VERSION(3,0,0)
{
+#if !wxCHECK_VERSION(3,0,0)
wxGLCanvas::OnSize(event);
+#endif //!wxCHECK_VERSION(3,0,0)
int w,h;
GetClientSize(&w,&h);
+#if wxCHECK_VERSION(3,0,0)
+ if (GetXWindow()) SetCurrent(*m_context);
+#else //wxCHECK_VERSION(3,0,0)
SetCurrent();
+#endif //wxCHECK_VERSION(3,0,0)
glViewport(0,0,(GLint) w, (GLint) h);
m_aspectratio = (GLdouble) w/(GLdouble) h;
m_winsize = wxSize(w,h);
+#if wxCHECK_VERSION(3,0,0)
+ Refresh();
+#endif //wxCHECK_VERSION(3,0,0)
}
void panoCanvas::OnPaint(wxPaintEvent &event)
@@ -93,7 +120,11 @@ void panoCanvas::OnPaint(wxPaintEvent &event)
/* must always be here */
wxPaintDC dc(this);
+#if wxCHECK_VERSION(3,0,0)
+ SetCurrent(*m_context);
+#else //wxCHECK_VERSION(3,0,0)
SetCurrent();
+#endif //wxCHECK_VERSION(3,0,0)
if(!m_initialized){
initGL();
@@ -125,7 +156,11 @@ void panoCanvas::position()
void panoCanvas::deletePanorama()
{
+#if wxCHECK_VERSION(3,0,0)
+ SetCurrent(*m_context);
+#else //wxCHECK_VERSION(3,0,0)
SetCurrent();
+#endif //wxCHECK_VERSION(3,0,0)
glDeleteTextures(m_numOfTexPatches.x*m_numOfTexPatches.y,m_textures);
m_hasimage = false;
delete [] m_viewableTexPatches;

View File

@@ -0,0 +1,24 @@
--- src/panocanvas.h.orig 2008-07-23 21:09:11 UTC
+++ src/panocanvas.h
@@ -148,7 +148,11 @@ class panoCanvas : public wxGLCanvas { (public)
panoCanvas(wxWindow *parent, int id, const wxPoint &position=wxDefaultPosition, const wxSize &size=wxDefaultSize);
virtual ~panoCanvas();
void OnPaint(wxPaintEvent &event);
+#if wxCHECK_VERSION(3,0,0)
+ void resized(wxSizeEvent &event);
+#else //wxCHECK_VERSION(3,0,0)
void OnSize(wxSizeEvent &event);
+#endif //wxCHECK_VERSION(3,0,0)
void OnEraseBackground(wxEraseEvent& event);
CBoundaries calculateViewBoundaries(const CPosition &offset = CPosition());
@@ -198,6 +202,9 @@ class panoCanvas : public wxGLCanvas { (public)
CBoundaries m_currentboundaries;
CBoundaries m_imageboundaries;
bool m_initialized;
+#if wxCHECK_VERSION(3,0,0)
+ wxGLContext *m_context;
+#endif //wxCHECK_VERSION(3,0,0)
DECLARE_EVENT_TABLE();
};

View File

@@ -0,0 +1,47 @@
--- src/panoframe.cpp.orig 2008-07-23 21:09:11 UTC
+++ src/panoframe.cpp
@@ -136,7 +136,13 @@ PCX files (*.pcx)|*.pcx|\
PNM files (*.pnm)|*.pnm|\
TIFF files (*.tif)|*.tif|\
XPM files (*.xpm)|*.xpm|\
-All files (*.*)|*.*"),wxOPEN|wxFILE_MUST_EXIST);
+All files (*.*)|*.*"),
+#if wxCHECK_VERSION(3,0,0)
+ wxFD_OPEN|wxFD_FILE_MUST_EXIST
+#else //wxCHECK_VERSION(3,0,0)
+ wxOPEN|wxFILE_MUST_EXIST
+#endif //wxCHECK_VERSION(3,0,0)
+ );
if (imagename !=wxT(""))
openImage(imagename);
}
@@ -153,7 +159,13 @@ void panoFrame::OnFullScreen(wxCommandEvent &event)
void panoFrame::OnOpenProject(wxCommandEvent &event)
{
- wxString filename = wxFileSelector(_("Open Project"),wxEmptyString,wxEmptyString,wxT("paf"),_("Panorama files (*.paf)|*.paf|All files (*.*)|*.*"),wxOPEN|wxFILE_MUST_EXIST);
+ wxString filename = wxFileSelector(_("Open Project"),wxEmptyString,wxEmptyString,wxT("paf"),_("Panorama files (*.paf)|*.paf|All files (*.*)|*.*"),
+#if wxCHECK_VERSION(3,0,0)
+ wxFD_OPEN|wxFD_FILE_MUST_EXIST
+#else //wxCHECK_VERSION(3,0,0)
+ wxOPEN|wxFILE_MUST_EXIST
+#endif //wxCHECK_VERSION(3,0,0)
+ );
if (filename !=wxT("")){
openProject(filename);
}
@@ -292,7 +304,13 @@ void panoFrame::openArgumentFile(const wxString &filen
void panoFrame::OnSaveProject(wxCommandEvent &event)
{
- wxString filename = wxFileSelector(_("Save Project"),wxEmptyString,wxEmptyString,wxT("paf"),_("Panorama files (*.paf)|*.paf|All files (*.*)|*.*"),wxOVERWRITE_PROMPT|wxSAVE);
+ wxString filename = wxFileSelector(_("Save Project"),wxEmptyString,wxEmptyString,wxT("paf"),_("Panorama files (*.paf)|*.paf|All files (*.*)|*.*"),
+#if wxCHECK_VERSION(3,0,0)
+ wxFD_OPEN|wxFD_FILE_MUST_EXIST
+#else //wxCHECK_VERSION(3,0,0)
+ wxOPEN|wxFILE_MUST_EXIST
+#endif //wxCHECK_VERSION(3,0,0)
+ );
if (filename != wxT("")){
if (wxFileExists(filename))
wxRemoveFile(filename);

View File

@@ -0,0 +1,60 @@
--- src/panointeractivecanvas.cpp.orig 2008-07-23 21:09:12 UTC
+++ src/panointeractivecanvas.cpp
@@ -62,7 +62,11 @@ BEGIN_EVENT_TABLE(panoInteractiveCanvas, panoCanvas)
EVT_KEY_DOWN (panoInteractiveCanvas::OnKeyDown )
EVT_KEY_UP (panoInteractiveCanvas::OnKeyUp )
EVT_PAINT (panoInteractiveCanvas::OnPaint )
+#if wxCHECK_VERSION(3,0,0)
+ EVT_SIZE (panoInteractiveCanvas::resized )
+#else //wxCHECK_VERSION(3,0,0)
EVT_SIZE (panoInteractiveCanvas::OnSize )
+#endif //wxCHECK_VERSION(3,0,0)
END_EVENT_TABLE()
panoInteractiveCanvas::panoInteractiveCanvas(wxWindow* parent, int id, const wxPoint& position, const wxSize& size):
@@ -96,13 +100,23 @@ panoInteractiveCanvas::~panoInteractiveCanvas()
{
}
+#if wxCHECK_VERSION(3,0,0)
+void panoInteractiveCanvas::resized(wxSizeEvent &event)
+#else //wxCHECK_VERSION(3,0,0)
void panoInteractiveCanvas::OnSize(wxSizeEvent &event)
+#endif //wxCHECK_VERSION(3,0,0)
{
+#if !wxCHECK_VERSION(3,0,0)
wxGLCanvas::OnSize(event);
+#endif //!wxCHECK_VERSION(3,0,0)
int w,h;
GetClientSize(&w,&h);
+#if wxCHECK_VERSION(3,0,0)
+ if (GetXWindow()) SetCurrent(*m_context);
+#else //wxCHECK_VERSION(3,0,0)
SetCurrent();
+#endif //wxCHECK_VERSION(3,0,0)
// TODO: opengl needs to be initialized here.
if(m_initialized){
@@ -121,6 +135,9 @@ void panoInteractiveCanvas::OnSize(wxSizeEvent &event)
m_aspectratio = (GLdouble) w/(GLdouble) h;
m_winsize = wxSize(w,h);
+#if wxCHECK_VERSION(3,0,0)
+ Refresh();
+#endif //wxCHECK_VERSION(3,0,0)
}
void panoInteractiveCanvas::OnPaint(wxPaintEvent &event)
@@ -128,7 +145,11 @@ void panoInteractiveCanvas::OnPaint(wxPaintEvent &even
/* must always be here */
wxPaintDC dc(this);
+#if wxCHECK_VERSION(3,0,0)
+ SetCurrent(*m_context);
+#else //wxCHECK_VERSION(3,0,0)
SetCurrent();
+#endif //wxCHECK_VERSION(3,0,0)
if(!m_initialized){
initGL();

View File

@@ -0,0 +1,14 @@
--- src/panointeractivecanvas.h.orig 2008-07-23 21:09:11 UTC
+++ src/panointeractivecanvas.h
@@ -39,7 +39,11 @@ class panoInteractiveCanvas : public panoCanvas (publi
void OnMouse(wxMouseEvent& event);
void OnTimer(wxTimerEvent &event);
void OnPaint(wxPaintEvent &event);
+#if wxCHECK_VERSION(3,0,0)
+ void resized(wxSizeEvent &event);
+#else //wxCHECK_VERSION(3,0,0)
void OnSize(wxSizeEvent &event);
+#endif //wxCHECK_VERSION(3,0,0)
void setBoundaryMode(int boundarymode);
void enableShowBoundaries(bool show);
void enableUseBoundaries(bool use);

View File

@@ -0,0 +1,9 @@
--- src/smallicon.xpm.orig 2008-07-23 21:09:10 UTC
+++ src/smallicon.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static char *smallicon[]={
+static char const *smallicon[]={
"16 16 9 1",
". c None",
"# c #0058c0",