Package: qutemol / 0.4.1~cvs20081111-15

20_main.cpp.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
From: Morten Kjeldgaard <mok@bioxray.au.dk>
Subject: modification to source code


--- a/src/main.cpp
+++ b/src/main.cpp
@@ -52,7 +52,7 @@
 #  include <GL/glu.h>
 #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) {