| 1 |
Description: Modifications to src/HardSettings.cpp |
| 2 |
Fix spelling error: 'tranparent' instead of 'transparent' |
| 3 |
Author: Morten Kjeldgaard <[email protected]> |
| 4 |
Author: Graham Inggs <[email protected]> |
| 5 |
Last-Update: 2017-12-25 |
| 6 |
|
| 7 |
--- a/src/HardSettings.cpp |
| 8 |
+++ b/src/HardSettings.cpp |
| 9 |
@@ -50,8 +50,7 @@ |
| 10 |
}; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
+static const char* names[NNAMES]={ |
| 16 |
"TSIZE", |
| 17 |
"MAX_TSIZE", |
| 18 |
"N_VIEW_DIR", |
| 19 |
@@ -122,7 +121,7 @@ |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
+static const char* comments[NNAMES]={ |
| 25 |
"favoured texture size for molecule", |
| 26 |
"maximal texture size (used when molecule too large for TSIZE)", |
| 27 |
"number of view directions ussed in AO computation", |
| 28 |
@@ -135,7 +134,7 @@ |
| 29 |
|
| 30 |
"snapshots resolution (per side)", |
| 31 |
"if 1, antialias exported snapshots", |
| 32 |
|
| 33 |
+ "if 1, save PNG images with transparent background", |
| 34 |
|
| 35 |
|
| 36 |
"resolution of exported GIF animations", |
| 37 |
@@ -158,8 +157,13 @@ |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
+bool HardSettings::Load(const char *fn){ |
| 44 |
+ char buf[512]; |
| 45 |
+ strcpy(buf, PKGDATADIR); |
| 46 |
+ if (buf[strlen(buf)-1] != '/') { |
| 47 |
+ strcat(buf,"/"); |
| 48 |
+ } |
| 49 |
+ FILE *f=fopen(strcat(buf,fn),"rt"); |
| 50 |
|
| 51 |
bool present[NNAMES]; |
| 52 |
for (int i=0; i<NNAMES; i++) present[i]=false; |
| 53 |
@@ -169,7 +173,7 @@ |
| 54 |
if (!f) return false; |
| 55 |
char token[255]; |
| 56 |
char last[255]; |
| 57 |
|
| 58 |
+ last[0]=0; |
| 59 |
while (1){ |
| 60 |
if (fscanf(f,"%s",token)!=1) break; |
| 61 |
if (token[0]=='=') { |
| 62 |
@@ -197,7 +201,7 @@ |
| 63 |
return true; |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
+bool HardSettings::Save(const char *fn){ |
| 68 |
FILE *f=fopen(fn,"wt"); |
| 69 |
|
| 70 |
static HardSettings defaults; |
| 71 |
@@ -216,7 +220,7 @@ |
| 72 |
return true; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
+void HardSettings::OnStart(){ |
| 77 |
SetDefaults(); |
| 78 |
if (!Load("qutemol.cfg")) { |
| 79 |
Save("qutemol.cfg"); |