| 1 |
From: Morten Kjeldgaard <[email protected]> |
| 2 |
Subject: modification to source code |
| 3 |
|
| 4 |
|
| 5 |
--- a/src/main.cpp |
| 6 |
+++ b/src/main.cpp |
| 7 |
@@ -52,7 +52,7 @@ |
| 8 |
# include <GL/glu.h> |
| 9 |
#endif |
| 10 |
|
| 11 |
|
| 12 |
+#include "sample.xpm" |
| 13 |
|
| 14 |
typedef unsigned char Byte; |
| 15 |
typedef unsigned int uint; |
| 16 |
@@ -115,9 +115,9 @@ |
| 17 |
|
| 18 |
|
| 19 |
wxBitmap *LoadPngImage(wxString st){ |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
+#ifndef _WIN32 |
| 24 |
+ wxString basePath = wxStandardPaths::Get().GetResourcesDir(); |
| 25 |
+ wxBitmap* res=new wxBitmap(_T(PKGDATADIR"/image/")+st+_T(".png"),wxBITMAP_TYPE_PNG); |
| 26 |
#else |
| 27 |
wxBitmap* res=new wxBitmap(_T("image/")+st+_T(".png"),wxBITMAP_TYPE_PNG); |
| 28 |
#endif |
| 29 |
@@ -162,7 +162,7 @@ |
| 30 |
} |
| 31 |
|
| 32 |
void MyToolbar::SetTitleText(wxString s){ |
| 33 |
|
| 34 |
+#ifdef _WIN32 |
| 35 |
titleText->SetLabel(s); |
| 36 |
titleTextSizer->Layout(); |
| 37 |
#endif |
| 38 |
@@ -249,7 +249,7 @@ |
| 39 |
parent->SetBackgroundColour(notebook->GetBackgroundColour()); |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
+#ifdef _WIN32 |
| 44 |
wxBitmapButton *snapButton = new wxBitmapButton(this, SnapButton, |
| 45 |
*LoadPngImage(_T("snap_off2")), wxDefaultPosition, wxSize(48,48),0); |
| 46 |
snapButton->SetBitmapSelected(*LoadPngImage(_T("snap_on"))); |
| 47 |
@@ -280,7 +280,7 @@ |
| 48 |
titleText = new wxStaticText(this, wxID_ANY, wxT("")); |
| 49 |
titleText->Disable(); |
| 50 |
|
| 51 |
|
| 52 |
+#ifdef _WIN32 |
| 53 |
wxSizer *linesizer1 = new wxBoxSizer(wxVERTICAL); |
| 54 |
|
| 55 |
linesizer1->Add(new wxStaticLine(this),0,wxALL| wxEXPAND, 1); |
| 56 |
@@ -321,10 +321,10 @@ |
| 57 |
imgsizer->Add(gearS, 0, wxALL|wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL, 2); // LOGO |
| 58 |
|
| 59 |
wxSizer *topRsizer = new wxBoxSizer(wxVERTICAL); |
| 60 |
|
| 61 |
|
| 62 |
+#ifdef _WIN32 |
| 63 |
+ topRsizer->Add(titleTextSizer,0, wxALL| wxEXPAND, 0); |
| 64 |
#endif |
| 65 |
|
| 66 |
+ topRsizer->Add(imgsizer,1, wxALL| wxEXPAND, 0); |
| 67 |
|
| 68 |
topsizer = new wxBoxSizer(wxHORIZONTAL); |
| 69 |
topsizer->Add(sizerButtons, 0, wxALL, 5); |
| 70 |
@@ -359,7 +359,7 @@ |
| 71 |
// Create the main frame window |
| 72 |
MyFrame *frame = new MyFrame(NULL, wxT("QuteMol"), |
| 73 |
// wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE //wxRESIZE_BORDER |
| 74 |
|
| 75 |
+#ifndef _WIN32 |
| 76 |
wxDefaultPosition, wxDefaultSize,wxDEFAULT_FRAME_STYLE| wxRESIZE_BORDER |
| 77 |
#else |
| 78 |
wxDefaultPosition, wxDefaultSize,wxRESIZE_BORDER |
| 79 |
@@ -411,7 +411,7 @@ |
| 80 |
sizer->Add(frame->GetToolbar(), 0, wxGROW); |
| 81 |
frame->SetSizer(sizer); |
| 82 |
|
| 83 |
|
| 84 |
+ int tbsize=frame->GetToolbar()->GetEffectiveMinSize().x; |
| 85 |
frame->GetToolbar()->SetSize(tbsize,winy); |
| 86 |
frame->GetToolbar()->Layout(); |
| 87 |
|
| 88 |
@@ -454,7 +454,7 @@ |
| 89 |
if (parser.Found(_T("a"),&artFilename)>0) { |
| 90 |
if (!readArtFile(artFilename.ToAscii())) { |
| 91 |
wxMessageBox( |
| 92 |
|
| 93 |
+ wxString(_T("Error reading art file \"") + artFilename + _T("\"")), |
| 94 |
_T("Error reading art file"), |
| 95 |
wxOK | wxICON_EXCLAMATION, frame); |
| 96 |
exit(0); |
| 97 |
@@ -519,9 +519,12 @@ |
| 98 |
{ |
| 99 |
m_canvas = NULL; |
| 100 |
m_tb= NULL; |
| 101 |
|
| 102 |
|
| 103 |
+#if WIN32 |
| 104 |
+ SetIcon(wxIcon(_T("sample"),wxBITMAP_TYPE_ICO_RESOURCE,32,32)); |
| 105 |
+#else |
| 106 |
+ SetIcon(wxIcon(sample_xpm)); |
| 107 |
#endif |
| 108 |
+ |
| 109 |
resize_mode=NATURAL; |
| 110 |
} |
| 111 |
|
| 112 |
@@ -576,7 +579,7 @@ |
| 113 |
static int oldw=0,oldh=0; |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
+ int w1=m_tb->GetEffectiveMinSize().x; |
| 118 |
// |
| 119 |
|
| 120 |
int sx=w-w1, sy=h , s; |
| 121 |
@@ -676,7 +679,9 @@ |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
+#ifdef _WIN32 |
| 126 |
if (!initdone) wxGLCanvas::OnPaint(event); else |
| 127 |
+#endif |
| 128 |
if (mol.IsReady()) { |
| 129 |
if (mustDoHQ) { |
| 130 |
drawFrame( hardSettings.STILL_QUALITY ); |
| 131 |
@@ -714,15 +719,19 @@ |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
+#if defined(_WIN32) |
| 136 |
void MyFrame::OnEraseBackground(wxEraseEvent& event) |
| 137 |
{ |
| 138 |
wxFrame::OnEraseBackground(event); |
| 139 |
/* Do nothing, to avoid flashing on MSW */ |
| 140 |
} |
| 141 |
+#endif |
| 142 |
|
| 143 |
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event) |
| 144 |
{ |
| 145 |
+#if defined(_WIN32) |
| 146 |
if (!initdone) wxGLCanvas::OnEraseBackground(event); |
| 147 |
+#endif |
| 148 |
/* Do else do nothing, to avoid flashing on MSW */ |
| 149 |
} |
| 150 |
|
| 151 |
@@ -737,17 +746,17 @@ |
| 152 |
|
| 153 |
void TestGLCanvas::OnKeyDown( wxKeyEvent& event ){ |
| 154 |
wxConsumeTrackBallEvent(event,true,track); |
| 155 |
|
| 156 |
|
| 157 |
+#ifndef _WIN32 |
| 158 |
+ wxString path = wxStandardPaths::Get().GetResourcesDir() + _T("/presets/new.preset"); |
| 159 |
#else |
| 160 |
wxString path = "presets\\new.preset"; |
| 161 |
#endif |
| 162 |
if (event.GetKeyCode() == WXK_F7 ) { |
| 163 |
|
| 164 |
+ cgSettings.Save((const char *)path.c_str()); |
| 165 |
} |
| 166 |
|
| 167 |
if (event.GetKeyCode() == WXK_F6 ) { |
| 168 |
|
| 169 |
+ if (cgSettings.Load((const char *)path.c_str())) { |
| 170 |
MyTab::UpdateAll(); |
| 171 |
|
| 172 |
cgSettings.ResetHalo(); |
| 173 |
@@ -858,7 +867,7 @@ |
| 174 |
int jj=saveSnapDialog->GetFilterIndex(); |
| 175 |
lastFilterIndex=jj; |
| 176 |
|
| 177 |
|
| 178 |
+ Byte* snap = 0; |
| 179 |
int AAMult=(hardSettings.SNAP_ANTIALIAS)?2:1; |
| 180 |
bool useTransp=(hardSettings.PNG_TRANSPARENT==1) && (jj==0); |
| 181 |
if (jj!=2) { |
| 182 |
@@ -916,8 +925,8 @@ |
| 183 |
break; |
| 184 |
case 2: { |
| 185 |
GifWrapper gifw; |
| 186 |
|
| 187 |
|
| 188 |
+ int N = 0; |
| 189 |
+ double totalTime = 0; |
| 190 |
double subStepTime=0; |
| 191 |
double startTime;startTime=hardSettings.GIF_INITIAL_PAUSE/1000.0; |
| 192 |
if (hardSettings.GIF_ANIMATION_MODE==0) { |