From: Morten Kjeldgaard Subject: modification to source code --- a/src/main.cpp +++ b/src/main.cpp @@ -52,7 +52,7 @@ # include #endif -//#include "sample.xpm" +#include "sample.xpm" typedef unsigned char Byte; typedef unsigned int uint; @@ -115,9 +115,9 @@ wxBitmap *LoadPngImage(wxString st){ -#ifdef __DARWIN__ - wxString basePath = wxStandardPaths::Get().GetResourcesDir(); - wxBitmap* res=new wxBitmap(basePath+_T("/image/")+st+_T(".png"),wxBITMAP_TYPE_PNG); +#ifndef _WIN32 + wxString basePath = wxStandardPaths::Get().GetResourcesDir(); + wxBitmap* res=new wxBitmap(_T(PKGDATADIR"/image/")+st+_T(".png"),wxBITMAP_TYPE_PNG); #else wxBitmap* res=new wxBitmap(_T("image/")+st+_T(".png"),wxBITMAP_TYPE_PNG); #endif @@ -162,7 +162,7 @@ } void MyToolbar::SetTitleText(wxString s){ -#ifndef __DARWIN__ +#ifdef _WIN32 titleText->SetLabel(s); titleTextSizer->Layout(); #endif @@ -249,7 +249,7 @@ parent->SetBackgroundColour(notebook->GetBackgroundColour()); } -#ifndef __DARWIN__ +#ifdef _WIN32 wxBitmapButton *snapButton = new wxBitmapButton(this, SnapButton, *LoadPngImage(_T("snap_off2")), wxDefaultPosition, wxSize(48,48),0); snapButton->SetBitmapSelected(*LoadPngImage(_T("snap_on"))); @@ -280,7 +280,7 @@ titleText = new wxStaticText(this, wxID_ANY, wxT("")); titleText->Disable(); -#ifndef __DARWIN__ +#ifdef _WIN32 wxSizer *linesizer1 = new wxBoxSizer(wxVERTICAL); linesizer1->Add(new wxStaticLine(this),0,wxALL| wxEXPAND, 1); @@ -321,10 +321,10 @@ imgsizer->Add(gearS, 0, wxALL|wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL, 2); // LOGO wxSizer *topRsizer = new wxBoxSizer(wxVERTICAL); -#ifndef __DARWIN__ - topRsizer->Add(titleTextSizer,0, wxALL| wxEXPAND, 0); +#ifdef _WIN32 + topRsizer->Add(titleTextSizer,0, wxALL| wxEXPAND, 0); #endif - topRsizer->Add(imgsizer,1, wxALL| wxEXPAND, 0); + topRsizer->Add(imgsizer,1, wxALL| wxEXPAND, 0); topsizer = new wxBoxSizer(wxHORIZONTAL); topsizer->Add(sizerButtons, 0, wxALL, 5); @@ -359,7 +359,7 @@ // Create the main frame window MyFrame *frame = new MyFrame(NULL, wxT("QuteMol"), // wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE //wxRESIZE_BORDER -#ifdef __DARWIN__ +#ifndef _WIN32 wxDefaultPosition, wxDefaultSize,wxDEFAULT_FRAME_STYLE| wxRESIZE_BORDER #else wxDefaultPosition, wxDefaultSize,wxRESIZE_BORDER @@ -411,7 +411,7 @@ sizer->Add(frame->GetToolbar(), 0, wxGROW); frame->SetSizer(sizer); - int tbsize=frame->GetToolbar()->GetBestFittingSize().x; + int tbsize=frame->GetToolbar()->GetEffectiveMinSize().x; frame->GetToolbar()->SetSize(tbsize,winy); frame->GetToolbar()->Layout(); @@ -454,7 +454,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 + _T("\"")), _T("Error reading art file"), wxOK | wxICON_EXCLAMATION, frame); exit(0); @@ -519,9 +519,12 @@ { m_canvas = NULL; m_tb= NULL; -#ifndef __DARWIN__ - SetIcon(wxIcon(_T("sample"),wxBITMAP_TYPE_ICO_RESOURCE,32,32)); +#if WIN32 + SetIcon(wxIcon(_T("sample"),wxBITMAP_TYPE_ICO_RESOURCE,32,32)); +#else + SetIcon(wxIcon(sample_xpm)); #endif + resize_mode=NATURAL; } @@ -576,7 +579,7 @@ static int oldw=0,oldh=0; - int w1=m_tb->GetBestFittingSize().x; + int w1=m_tb->GetEffectiveMinSize().x; // int sx=w-w1, sy=h , s; @@ -676,7 +679,9 @@ } } +#ifdef _WIN32 if (!initdone) wxGLCanvas::OnPaint(event); else +#endif if (mol.IsReady()) { if (mustDoHQ) { drawFrame( hardSettings.STILL_QUALITY ); @@ -714,15 +719,19 @@ } +#if defined(_WIN32) void MyFrame::OnEraseBackground(wxEraseEvent& event) { wxFrame::OnEraseBackground(event); /* Do nothing, to avoid flashing on MSW */ } +#endif void TestGLCanvas::OnEraseBackground(wxEraseEvent& event) { +#if defined(_WIN32) if (!initdone) wxGLCanvas::OnEraseBackground(event); +#endif /* Do else do nothing, to avoid flashing on MSW */ } @@ -737,17 +746,17 @@ void TestGLCanvas::OnKeyDown( wxKeyEvent& event ){ wxConsumeTrackBallEvent(event,true,track); -#ifdef __DARWIN__ - wxString path = wxStandardPaths::Get().GetResourcesDir() + "/presets/new.preset"; +#ifndef _WIN32 + wxString path = wxStandardPaths::Get().GetResourcesDir() + _T("/presets/new.preset"); #else wxString path = "presets\\new.preset"; #endif if (event.GetKeyCode() == WXK_F7 ) { - cgSettings.Save(path.c_str()); + cgSettings.Save((const char *)path.c_str()); } if (event.GetKeyCode() == WXK_F6 ) { - if (cgSettings.Load(path.c_str())) { + if (cgSettings.Load((const char *)path.c_str())) { MyTab::UpdateAll(); cgSettings.ResetHalo(); @@ -858,7 +867,7 @@ int jj=saveSnapDialog->GetFilterIndex(); lastFilterIndex=jj; - Byte* snap; + Byte* snap = 0; int AAMult=(hardSettings.SNAP_ANTIALIAS)?2:1; bool useTransp=(hardSettings.PNG_TRANSPARENT==1) && (jj==0); if (jj!=2) { @@ -916,8 +925,8 @@ break; case 2: { GifWrapper gifw; - int N; - double totalTime; + int N = 0; + double totalTime = 0; double subStepTime=0; double startTime;startTime=hardSettings.GIF_INITIAL_PAUSE/1000.0; if (hardSettings.GIF_ANIMATION_MODE==0) {