On Tue, Jun 19, 2007 at 10:30:56PM +0200, Paolo Cignoni wrote: > Hi, thanks for the diff, but that patch is a little outdated. > similar changes have been already done for allowing the compilation > under MacOS.
I tried to build Qutemol (latest CVS) again on GNU/Linux today, and had to find out that some parts of Teemu's patch are still needed. Some files still do not get built by the Makefile and the linker line is missing libgif/libungif. Apart from some porting in main.cpp which was in Teemu's patch already, the other changes are either due to missing case-sensitivity in Windows or are probably due to a more strict g++ I'm using (g++-4.3), you might be able to reproduce them if you upgrade as well. I am not totally sure about the change in ShadowMap.cpp. > Obviously you need a good graphic card with updated drivers to > succesfully run QuteMol. Yeah, unfortunately I am not able to test it, either. I've attached my current patch; I think some more patching will be needed so Qutemol finds the icons and presets in the standard Unix file system location (under /usr/share/qutemol/). cheers, Michael
diff -Naur qutemol/Makefile qutemol.newer/Makefile --- qutemol/Makefile 2006-09-19 11:31:42.000000000 +0200 +++ qutemol.newer/Makefile 2008-11-08 23:52:08.000000000 +0100 @@ -3,7 +3,7 @@ OPTFLAGS = -Os -Wall -g CXXFLAGS = $(INCDIRS) $(OPTFLAGS) `wx-config --cppflags` -LIBS = $(CXXFLAGS) `wx-config --libs core,base --gl-libs` -lGLEW -lGLU -lGL +LIBS = $(CXXFLAGS) `wx-config --libs core,base --gl-libs` -lGLEW -lGLU -lGL -lgif OBJS = \ src/AO.o \ @@ -16,6 +16,11 @@ src/MyTab.o \ src/Sampling.o \ src/ShadowMap.o \ + src/progress.o \ + src/MyCanvas.o \ + src/saveSnapDialog.o \ + src/pngSave.o \ + src/gifSave.o \ src/main.o \ src/wx_trackball.o \ vcg/wrap/gui/trackball.o \ diff -Naur qutemol/src/Mol.cpp qutemol.newer/src/Mol.cpp --- qutemol/src/Mol.cpp 2007-07-04 11:34:23.000000000 +0200 +++ qutemol.newer/src/Mol.cpp 2008-11-08 22:25:56.000000000 +0100 @@ -5,6 +5,7 @@ #include <vector> #include <string> #include <algorithm> +#include <cstring> #include <vcg/space/point3.h> #include <vcg/space/color4.h> @@ -16,7 +17,7 @@ #include "Mol.h" #include "HardSettings.h" -#include "Progress.h" +#include "progress.h" #include "AtomColor.h" #include "MyCanvas.h" diff -Naur qutemol/src/Mol.h qutemol.newer/src/Mol.h --- qutemol/src/Mol.h 2007-06-18 17:23:52.000000000 +0200 +++ qutemol.newer/src/Mol.h 2008-11-08 22:19:56.000000000 +0100 @@ -1,3 +1,4 @@ +#include <string> class MyString{ public: diff -Naur qutemol/src/MyTab.cpp qutemol.newer/src/MyTab.cpp --- qutemol/src/MyTab.cpp 2007-06-15 09:59:23.000000000 +0200 +++ qutemol.newer/src/MyTab.cpp 2008-11-08 23:23:42.000000000 +0100 @@ -818,8 +818,8 @@ for (int i=0; i<x.Length(); i++){ if ((x[i]=='-')&&(x[i+1]=='\n')) i++; else - if (x[i]=='\n') res.sprintf("%s ",res.ToAscii()); - else res.sprintf("%s%c",res.ToAscii(),x[i]); + if (x[i]=='\n') res.sprintf((wxChar *)"%s ",res.ToAscii()); + else res.sprintf((wxChar *)"%s%c",res.ToAscii(),x[i]); } return res; } diff -Naur qutemol/src/ShadowMap.cpp qutemol.newer/src/ShadowMap.cpp --- qutemol/src/ShadowMap.cpp 2007-06-11 16:38:35.000000000 +0200 +++ qutemol.newer/src/ShadowMap.cpp 2008-11-08 22:28:46.000000000 +0100 @@ -95,7 +95,7 @@ Point3f lastL(0,0,0); // last used light void ShadowMap::Update(){ - lastL.Zero(); + lastL.SetZero(); } void ShadowMap::computeAsTexture(vcg::Point3f L, bool makeboth, MyCanvas &canvas){ diff -Naur qutemol/src/ShadowMap.h qutemol.newer/src/ShadowMap.h --- qutemol/src/ShadowMap.h 2006-09-28 02:44:17.000000000 +0200 +++ qutemol.newer/src/ShadowMap.h 2008-11-08 22:24:37.000000000 +0100 @@ -12,7 +12,7 @@ // adapt to current PVMatrix - static void ShadowMap::GetCurrentPVMatrix(); + static void GetCurrentPVMatrix(); // feed parametmers to FP static void FeedParameters(); diff -Naur qutemol/src/main.cpp qutemol.newer/src/main.cpp --- qutemol/src/main.cpp 2007-06-14 19:15:31.000000000 +0200 +++ qutemol.newer/src/main.cpp 2008-11-08 23:37:55.000000000 +0100 @@ -56,6 +56,7 @@ typedef unsigned char Byte; typedef unsigned int uint; +typedef Byte byte; #include "CgUtil.h" @@ -173,8 +174,9 @@ public: MyDropTarget(MyFrame *_parent) { parent = _parent; } - virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames){ + virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) { parent->OnReadFile(filenames[0]); + return true; }; private: @@ -238,9 +240,9 @@ parent=_parent; // let's build notebook - /*wxNotebook **/notebook = new wxNotebook( + notebook = new wxNotebook( this, id, pos, size, - 0,/*style/*|wxNO_FULL_REPAINT_ON_RESIZE|wxNB_TOP,*/ + 0,/*style|wxNO_FULL_REPAINT_ON_RESIZE|wxNB_TOP,*/ name); for (int i=0; i<MyTab::Count(); i++) { @@ -454,7 +456,7 @@ if (parser.Found(_T("a"),&artFilename)>0) { if (!readArtFile(artFilename.ToAscii())) { wxMessageBox( - wxString(_T("Error reading art file \"") + artFilename +"\""), + wxString(_T("Error reading art file \"") + artFilename +wxT("\"")), _T("Error reading art file"), wxOK | wxICON_EXCLAMATION, frame); exit(0); @@ -614,7 +616,9 @@ BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) EVT_SIZE(TestGLCanvas::OnSize) EVT_PAINT(TestGLCanvas::OnPaint) +#if defined(_WIN32) EVT_ERASE_BACKGROUND(TestGLCanvas::OnEraseBackground) +#endif EVT_MOUSE_EVENTS(TestGLCanvas::OnMouse) EVT_KEY_DOWN(TestGLCanvas::OnKeyDown) EVT_KEY_UP(TestGLCanvas::OnKeyUp) @@ -676,22 +680,26 @@ } } - if (!initdone) wxGLCanvas::OnPaint(event); else - if (mol.IsReady()) { - if (mustDoHQ) { - drawFrame( hardSettings.STILL_QUALITY ); - shownHQ=true; - mustDoHQ=false; - } else { - drawFrame( hardSettings.MOVING_QUALITY ); - shownHQ=false; - } - SwapBuffers(); - } + if (!initdone) { +// wxGLCanvas::OnPaint(event); + } else { - clearFrame(); - SwapBuffers(); - } + if (mol.IsReady()) { + if (mustDoHQ) { + drawFrame( hardSettings.STILL_QUALITY ); + shownHQ=true; + mustDoHQ=false; + } else { + drawFrame( hardSettings.MOVING_QUALITY ); + shownHQ=false; + } + SwapBuffers(); + } + else { + clearFrame(); + SwapBuffers(); + } + } } void TestGLCanvas::OnSize(wxSizeEvent& event) @@ -713,7 +721,7 @@ } } - +#if defined(_WIN32) void MyFrame::OnEraseBackground(wxEraseEvent& event) { wxFrame::OnEraseBackground(event); @@ -722,9 +730,11 @@ void TestGLCanvas::OnEraseBackground(wxEraseEvent& event) { - if (!initdone) wxGLCanvas::OnEraseBackground(event); + if (!initdone) + wxGLCanvas::OnEraseBackground(event); /* Do else do nothing, to avoid flashing on MSW */ } +#endif bool wxConsumeTrackBallEvent(wxMouseEvent& event, Trackball &track); bool wxConsumeTrackBallEvent(wxKeyEvent& event, bool down, Trackball &track); @@ -739,15 +749,17 @@ wxConsumeTrackBallEvent(event,true,track); #ifdef __DARWIN__ wxString path = wxStandardPaths::Get().GetResourcesDir() + "/presets/new.preset"; -#else +#elif defined (_WIN32) wxString path = "presets\\new.preset"; +#else + wxString path = wxT("presets/new.preset"); #endif if (event.GetKeyCode() == WXK_F7 ) { - cgSettings.Save(path.c_str()); + cgSettings.Save((char *)path.c_str()); } if (event.GetKeyCode() == WXK_F6 ) { - if (cgSettings.Load(path.c_str())) { + if (cgSettings.Load((char *)path.c_str())) { MyTab::UpdateAll(); cgSettings.ResetHalo(); diff -Naur qutemol/src/progress.cpp qutemol.newer/src/progress.cpp --- qutemol/src/progress.cpp 2006-12-19 21:14:22.000000000 +0100 +++ qutemol.newer/src/progress.cpp 2008-11-08 22:29:43.000000000 +0100 @@ -13,7 +13,8 @@ void StartProgress(char* str, int N){ EndProgress(); - wxString st; st.Printf("QuteMol: %s...",str); + wxString st; + st.Printf((const wxChar*) "QuteMol: %s...", str); globalProgress= new wxProgressDialog( //_T("QuteMol"), st, st, _T(""), diff -Naur qutemol/src/saveSnapDialog.cpp qutemol.newer/src/saveSnapDialog.cpp --- qutemol/src/saveSnapDialog.cpp 2007-06-14 07:46:21.000000000 +0200 +++ qutemol.newer/src/saveSnapDialog.cpp 2008-11-08 22:30:53.000000000 +0100 @@ -3,15 +3,17 @@ #endif #include <vector> -#include "SaveSnapDialog.h" +#include "saveSnapDialog.h" #include "HardSettings.h" enum{ ID_ResUp=500, ID_ResDown, ID_Res, ID_AntiAlias, ID_Alpha}; -static wxString title[]={"PNG snapshot options","JPG snapshot options","GIF animation options"}; -static wxTextCtrl * resText; -static wxCheckBox *wxCheckAntia, *wxTransp ; +static wxString title[] = { wxString((wxChar) "PNG snapshot options"), + wxString((wxChar) "JPG snapshot options"), + wxString((wxChar) "GIF animation options") }; +//static wxTextCtrl * resText; +//static wxCheckBox *wxCheckAntia, *wxTransp ; class EventTableEntry{ public: @@ -134,10 +136,12 @@ bool EndEnableGroup(){ enableif=NULL; + return true; } bool StartEnableGroup(){ enableif=lastRadio; + return true; } bool pressButton(wxWindowID x){ @@ -210,7 +214,7 @@ //checkButton but=new } - void AddNewInt(wxString label, int *dataz, int min, int max, bool pow2=false, int delta){ + void AddNewInt(wxString label, int *dataz, int min, int max, bool pow2, int delta) { EventTableEntry e; e.idText=newID(); diff -Naur qutemol/src/wx_trackball.cpp qutemol.newer/src/wx_trackball.cpp --- qutemol/src/wx_trackball.cpp 2007-06-11 16:38:36.000000000 +0200 +++ qutemol.newer/src/wx_trackball.cpp 2008-11-08 23:35:15.000000000 +0100 @@ -1,4 +1,4 @@ - +#include <GL/gl.h> #include <wx/defs.h> #include <wx/app.h>