31
30
* RasMol 2.7.4 Nov 07 *
32
31
* RasMol 2.7.4.1 Jan 08 *
33
32
* RasMol 2.7.4.2 Mar 08 *
35
* RasMol 2.7.3 incorporates changes by Clarice Chigbo, Ricky Chachra, *
36
* and Mamoru Yamanishi. Work on RasMol 2.7.3 supported in part by *
37
* grants DBI-0203064, DBI-0315281 and EF-0312612 from the U.S. National *
38
* Science Foundation and grant DE-FG02-03ER63601 from the U.S. Department *
39
* of Energy. RasMol 2.7.4 incorporates changes by G. Todorov, Nan Jia, *
40
* N. Darakev, P. Kamburov, G. McQuillan, J. Jemilawon. Work on RasMol *
41
* 2.7.4 supported in part by grant 1R15GM078077-01 from the National *
42
* Institute of General Medical Sciences (NIGMS). The content is solely *
43
* the responsibility of the authors and does not necessarily represent *
44
* the official views of the funding organizations. *
46
* The code for use of RasMol under GTK in RasMol 2.7.4.2 was written by *
33
* RasMol 2.7.5 May 09 *
35
* RasMol 2.7.5 incorporates changes by T. Ikonen, G. McQuillan, N. Darakev*
36
* and L. Andrews (via the neartree package). Work on RasMol 2.7.5 *
37
* supported in part by grant 1R15GM078077-01 from the National Institute *
38
* of General Medical Sciences (NIGMS), U.S. National Institutes of Health *
39
* and by grant ER63601-1021466-0009501 from the Office of Biological & *
40
* Environmental Research (BER), Office of Science, U. S. Department of *
41
* Energy. RasMol 2.7.4 incorporated changes by G. Todorov, Nan Jia, *
42
* N. Darakev, P. Kamburov, G. McQuillan, and J. Jemilawon. Work on RasMol *
43
* 2.7.4 supported in part by grant 1R15GM078077-01 from the NIGMS/NIH and *
44
* grant ER63601-1021466-0009501 from BER/DOE. RasMol 2.7.3 incorporates *
45
* changes by Clarice Chigbo, Ricky Chachra, and Mamoru Yamanishi. Work *
46
* on RasMol 2.7.3 supported in part by grants DBI-0203064, DBI-0315281 *
47
* and EF-0312612 from the U.S. National Science Foundation and grant *
48
* DE-FG02-03ER63601 from BER/DOE. The content is solely the responsibility*
49
* of the authors and does not necessarily represent the official views of *
50
* the funding organizations. *
52
* The code for use of RasMol under GTK in RasMol 2.7.4.2 and 2.7.5 was *
53
* written by Teemu Ikonen. *
49
55
* and Incorporating Translations by *
50
56
* Author Item Language *
71
77
*package and for license terms (GPL or RASLIC). *
72
78
***************************************************************************/
81
Revision 1.8 2008/06/27 02:47:58 yaya
82
Finished update of windows code for 32-bit color -- HJB
84
Revision 1.7 2008/06/11 01:40:54 yaya
85
Improve gradient for map surfaces and brighten image;
86
Add parenthesized selections before all commands;
87
Change saveSelection and loadSelection to
88
SaveAtomSelection and LoadAtomSelection -- HJB
75
90
Revision 1.6 2008/03/22 17:06:49 yaya
76
91
Post release cleanup with credits to Ikonen in file headers. -- HJB
1393
1408
register int i;
1395
1410
if( format==CF_PALETTE )
1396
1412
{ if( ColourMap )
1397
1413
{ return CreatePalette(Palette);
1398
1414
} else return NULL;
1401
1420
if( !PixMap || (format!=CF_DIB) )
1404
1423
len = (long)XRange*YRange*sizeof(Pixel);
1405
size = sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD);
1425
size = sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD);
1427
size = sizeof(BITMAPINFOHEADER);
1406
1429
if( !(result=GlobalAlloc(GHND,size+len)) ) return NULL;
1408
1431
bitmap = (BITMAPINFO __far *)GlobalLock(result);
1410
1433
bitmap->bmiHeader.biWidth = XRange;
1411
1434
bitmap->bmiHeader.biHeight = YRange;
1412
1435
bitmap->bmiHeader.biPlanes = 1;
1413
1437
bitmap->bmiHeader.biBitCount = 8;
1439
bitmap->bmiHeader.biBitCount = 32;
1414
1441
bitmap->bmiHeader.biCompression = BI_RGB;
1415
1442
bitmap->bmiHeader.biSizeImage = len;
1416
1443
bitmap->bmiHeader.biXPelsPerMeter = 0;
1418
1445
bitmap->bmiHeader.biClrImportant = 0;
1419
1446
bitmap->bmiHeader.biClrUsed = 0;
1421
1449
for( i=0; i<256; i++ )
1423
1451
{ bitmap->bmiColors[Lut[i]].rgbBlue = BLut[i];
1424
1452
bitmap->bmiColors[Lut[i]].rgbGreen = GLut[i];
1425
1453
bitmap->bmiColors[Lut[i]].rgbRed = RLut[i];
1429
1457
src = (Pixel __huge*)GlobalLock(FBufHandle);
1430
1459
dst = ((Pixel __huge*)bitmap)+size;
1461
dst = ((Pixel __huge*)bitmap)+size/4;
1432
1464
/* Transfer the frame buffer */
1433
1465
while( len-- ) *dst++ = *src++;
1734
1766
void RefreshScreen( void )
1736
1769
ReDrawFlag &= ~RFTransZ;
1739
{ if( RasWinDDEReady )
1740
{ RasWinDDEReady = False;
1772
if( RasWinDDEReady ) {
1773
RasWinDDEReady = False;
1744
if( ReDrawFlag & RFReSize )
1777
if( ReDrawFlag & RFReSize )
1745
1778
ReSizeScreen();
1747
if( ReDrawFlag & RFColour )
1780
if( ReDrawFlag & RFColour )
1754
if( ReDrawFlag & RFApply )
1786
ReDrawFlagSave = ReDrawFlag;
1789
if( ReDrawFlag & RFApply )
1798
if ((ReDrawFlagSave & RFApply) && record_on[0] && !RecordPause ) {
1801
record_frame[1] = 0;
1802
} else if ((ReDrawFlagSave & RFAppear) && record_on[1] && !RecordPause) {
1806
if ((double)(record_frame[1]) <= record_fps*record_dwell) {
1807
NextReDrawFlag |= RFRefresh;
1810
record_frame[1] = 0;
3095
3151
case(WM_QUERYNEWPALETTE):
3096
3153
if( ColourMap )
3097
3154
{ hDC = GetDC(hWin);
3098
3155
hCMap = SelectPalette(hDC,ColourMap,False);
3099
3156
status = RealizePalette(hDC);
3100
3157
if( hCMap ) SelectPalette(hDC,hCMap,False);
3101
3158
ReleaseDC(hWin,hDC);
3104
3160
{ InvalidateRect(hWin,NULL,True);
3110
3167
case(WM_PALETTECHANGED):
3111
3169
if( ColourMap && ((HWND)wArg != hWin) )
3112
3170
{ hDC = GetDC(hWin);
3113
3171
hCMap = SelectPalette(hDC,ColourMap,False);
3236
3295
case(WM_PAINT): hDC = BeginPaint(hWin,&ps);
3237
3296
SetBkMode(hDC,TRANSPARENT);
3239
3299
{ hCMap = SelectPalette(hDC,ColourMap,False);
3240
3300
RealizePalette(hDC);
3242
3303
SetWindowOrgEx(hDC,0,0,NULL);
3248
3309
BitBlt(hDC,0,0,XRange,YRange,
3249
3310
hMemDC,0,0,SRCCOPY);
3251
SelectPalette(hDC,hCMap,False);
3313
SelectPalette(hDC,hCMap,False);
3252
3315
DeleteDC(hMemDC);
3253
3317
} else /* Erase Update Region */
3255
3322
{ hCMap=SelectPalette(hDC,ColourMap,0);
3323
BackColRef = RGB(BackR,BackG,BackB);
3256
3324
RealizePalette(hDC);
3326
BackColRef = RGB(0,0,0);
3258
3329
BackColRef = RGB(BackR,BackG,BackB);
3259
3331
hand = CreateSolidBrush(BackColRef);
3260
3332
GetUpdateRect(hWin,&rc,False);
3261
3333
FillRect( hDC, &rc, hand );
3262
3335
if( ColourMap && hCMap )
3263
3336
SelectPalette(hDC,hCMap,False);
3264
3338
DeleteObject(hand);
3266
3340
EndPaint(hWin,&ps);