DIALOGS.C

Go to the documentation of this file.
00001 /*  file DIALOGS.C  contains all the dialog handler functions */
00002 
00003 // This file contains most of the code for the dialogs in the animation
00004 // program. Most dialogs are modal and their "window" procedure contains
00005 // all the action code.
00006 
00007 #define MODULE_DIALOGS 1
00008 
00009 #include "animate.h"
00010 #include "spin_dll.h"
00011 
00012 #define D_BORDER 4
00013 
00014 typedef struct tag_dlghdr1 {
00015   HWND hwndDlg1;
00016   HWND hwndDlg2;
00017   HWND hwndDlg3;
00018   HWND hwndDlg4;
00019   HWND hwndDlg5;
00020   HWND hwndDlg6;
00021   RECT rcTab;
00022 } DLGHDR1;
00023 
00024 static void DisplayImageFile(char *);
00025 static void EditImageFile(char *);
00026 
00027 static DLGHDR1 DlgHdr,*lpDlgHdr;
00028 static HWND    hwndTab;
00029 
00030 #include "..\design\loadview.c"
00031 
00032 long GetCharListID(char *item, char **list, long n){
00033  long i;
00034  for(i=0;i<n;i++){
00035    if(strcmp(item,list[i]) == 0)return i;
00036  }
00037  return -1;
00038 }
00039 
00040 static void UpdateGroundDialog(HWND hwnd, object *op){
00041  char txt[64];
00042  BOOL enable=FALSE,enable_shader=FALSE;
00043  int gt;
00044  gt=(int)op->groundtype;
00045  SendDlgItemMessage(hwnd,DLG_GROUND_PLAIN, BM_SETCHECK,0,0);
00046  SendDlgItemMessage(hwnd,DLG_GROUND_SHADER,BM_SETCHECK,0,0);
00047  SendDlgItemMessage(hwnd,DLG_GROUND_MAPPED,BM_SETCHECK,0,0);
00048  SetDlgItemText(hwnd,DLG_GROUND_SHADER_NAME,(LPCTSTR)"None");
00049  SendDlgItemMessage(hwnd,DLG_GROUND_MAP_SINGLE,BM_SETCHECK,0,0);
00050  SendDlgItemMessage(hwnd,DLG_GROUND_MAP_TILE,  BM_SETCHECK,0,0);
00051  SendDlgItemMessage(hwnd,DLG_GROUND_MAP_MOZAIC,BM_SETCHECK,0,0);
00052  SetDlgItemText(hwnd,DLG_GROUND_MAP_NAME,(LPCTSTR)"None");
00053  SetDlgItemText(hwnd,DLG_GROUND_MAP_PATH,(LPCTSTR)" ");
00054  if(gt >= 128){
00055    gt -= 128;
00056    SendDlgItemMessage(hwnd,DLG_GROUND_SHADER,BM_SETCHECK,1,0);
00057    SetDlgItemText(hwnd,DLG_GROUND_SHADER_NAME,(LPCTSTR)GroundTextList[gt]);
00058    enable_shader=TRUE;
00059  }
00060  else if(gt == BRUM || gt == TBRUM || gt == MBRUM){
00061    SendDlgItemMessage(hwnd,DLG_GROUND_MAPPED,BM_SETCHECK,1,0);
00062    if     (gt ==  BRUM)SendDlgItemMessage(hwnd,DLG_GROUND_MAP_SINGLE,BM_SETCHECK,1,0);
00063    else if(gt == TBRUM)SendDlgItemMessage(hwnd,DLG_GROUND_MAP_TILE,  BM_SETCHECK,1,0);
00064    else if(gt == MBRUM)SendDlgItemMessage(hwnd,DLG_GROUND_MAP_MOZAIC,BM_SETCHECK,1,0);
00065    SetDlgItemText(hwnd,DLG_GROUND_MAP_NAME,(LPCTSTR)short_form(op->name));
00066    SetDlgItemText(hwnd,DLG_GROUND_MAP_PATH,(LPCTSTR)truncate_path(op->name,40));
00067    enable=TRUE;
00068  }
00069  else {
00070    SendDlgItemMessage(hwnd,DLG_GROUND_PLAIN,BM_SETCHECK,1,0);
00071  }
00072  EnableWindow(GetDlgItem(hwnd,DLG_GROUND_MAP_SINGLE),enable);
00073  EnableWindow(GetDlgItem(hwnd,DLG_GROUND_MAP_TILE),enable);
00074  EnableWindow(GetDlgItem(hwnd,DLG_GROUND_MAP_MOZAIC),enable);
00075  EnableWindow(GetDlgItem(hwnd,DLG_GROUND_CHOOSE),enable);
00076  EnableWindow(GetDlgItem(hwnd,DLG_GROUND_CHOOSE_SHA),enable_shader);
00077  EnableWindow(GetDlgItem(hwnd,DLG_GROUND_VIEW),enable);
00078  EnableWindow(GetDlgItem(hwnd,DLG_GROUND_EDITAPP),enable);
00079 }
00080 
00081 static BOOL CALLBACK GroundDlgProc(HWND hwnd,UINT msg,
00082                                    WPARAM wparam,LPARAM lparam){
00083  static HBITMAP GndBtnBitmaps[3]={NULL,NULL,NULL};
00084  static object *op;
00085  static BOOL noaction;
00086  static short l_limit,u_limit;
00087  char str[32],tt[128];
00088  BOOL err;
00089  int i;
00090  LPDRAWITEMSTRUCT lpdis;
00091  switch( msg ) {
00092    case WM_INITDIALOG:{
00093        op=(object *)lparam;
00094        noaction=TRUE;
00095        GndBtnBitmaps[0]=LoadBitmap(ghinst_main,MAKEINTRESOURCE(IDBM_GROUND1));
00096        GndBtnBitmaps[1]=LoadBitmap(ghinst_main,MAKEINTRESOURCE(IDBM_GROUND2));
00097        GndBtnBitmaps[2]=LoadBitmap(ghinst_main,MAKEINTRESOURCE(IDBM_GROUND3));
00098        SendMessage(GetDlgItem(hwnd,DLG_GROUND_MAP_SINGLE),BM_SETIMAGE,
00099                  (WPARAM)IMAGE_BITMAP,(LPARAM)GndBtnBitmaps[0]);
00100        SendMessage(GetDlgItem(hwnd,DLG_GROUND_MAP_TILE),BM_SETIMAGE,
00101                  (WPARAM)IMAGE_BITMAP,(LPARAM)GndBtnBitmaps[1]);
00102        SendMessage(GetDlgItem(hwnd,DLG_GROUND_MAP_MOZAIC),BM_SETIMAGE,
00103                  (WPARAM)IMAGE_BITMAP,(LPARAM)GndBtnBitmaps[2]);
00104        UpdateGroundDialog(hwnd,op);
00105        noaction=FALSE;
00106        SetDlgItemInt(hwnd,DLG_GROUND_FRAME_FROM,op->firstframe,FALSE);
00107        SetDlgItemInt(hwnd,DLG_GROUND_FRAME_TO  ,op->lastframe, FALSE);
00108        if(op->last != NULL)l_limit=op->last->lastframe+1;
00109        else l_limit=1;
00110        if(op->next != NULL)u_limit=op->next->firstframe-1;
00111        else u_limit=Nframes;
00112        SendDlgItemMessage(hwnd,DLG_GROUND_FRAME_SPINF,SPNM_SETRANGE,0,
00113                           MAKELPARAM(l_limit,u_limit));
00114        SendDlgItemMessage(hwnd,DLG_GROUND_FRAME_SPINF,SPNM_SETCRNTVALUE,
00115                           (WPARAM)op->firstframe,0);
00116        SendDlgItemMessage(hwnd,DLG_GROUND_FRAME_SPINF,SPNM_SETEDITCTRL,0,
00117                           (LPARAM)GetDlgItem(hwnd,DLG_GROUND_FRAME_FROM));
00118        SendDlgItemMessage(hwnd,DLG_GROUND_FRAME_SPINT,SPNM_SETRANGE,0,
00119                           MAKELPARAM(l_limit,u_limit));
00120        SendDlgItemMessage(hwnd,DLG_GROUND_FRAME_SPINT,SPNM_SETCRNTVALUE,
00121                           (WPARAM)op->lastframe,0);
00122        SendDlgItemMessage(hwnd,DLG_GROUND_FRAME_SPINT,SPNM_SETEDITCTRL,0,
00123                           (LPARAM)GetDlgItem(hwnd,DLG_GROUND_FRAME_TO));
00124        sprintf(str,"%.2lf",op->grefl);
00125        SetDlgItemText(hwnd,DLG_GROUND_REFL,(LPCTSTR)str);
00126        sprintf(str,"%.2lf",op->groundTemperature);
00127        SetDlgItemText(hwnd,DLG_GROUND_TEMPERATURE,(LPCTSTR)str);
00128        SendDlgItemMessage(hwnd,DLG_GROUND_REFL,EM_LIMITTEXT,(WPARAM)12,0);
00129        sprintf(str,"%.2lf",op->groundTemperature);
00130        SetDlgItemText(hwnd,DLG_GROUND_TEMPERATURE,(LPCTSTR)str);
00131        CentreDialogOnScreen(hwnd);
00132      }
00133      return (TRUE);
00134    case WM_DESTROY:
00135      for(i=0;i<3;i++){
00136        if(GndBtnBitmaps[i] != NULL){
00137          if(!DeleteObject(GndBtnBitmaps[i]))MessageBox(NULL,"Bad Delete",NULL,MB_OK);
00138          GndBtnBitmaps[i]=NULL;
00139        }
00140      }
00141      break;
00142    case WM_DRAWITEM:{
00143        HBRUSH   hbr,hbrold;
00144        BYTE r,g,b;
00145        lpdis=(LPDRAWITEMSTRUCT)lparam;
00146        if(lpdis->CtlID == DLG_GROUND_GC || lpdis->CtlID == DLG_GROUND_SC){
00147          if(lpdis->CtlID == DLG_GROUND_SC){
00148            r=op->acolour[0]; g=op->acolour[1]; b=op->acolour[2];
00149          }
00150          else {
00151            r=op->colour[0]; g=op->colour[1]; b=op->colour[2];
00152          }
00153          if(lpdis->itemState & ODS_SELECTED)InvertRect(lpdis->hDC,&(lpdis->rcItem));
00154          else{
00155            hbr=CreateSolidBrush(RGB(r,g,b));
00156            hbrold=SelectObject(lpdis->hDC,hbr);
00157            Rectangle(lpdis->hDC,lpdis->rcItem.left,lpdis->rcItem.top,
00158                          lpdis->rcItem.right,lpdis->rcItem.bottom);
00159            SelectObject(lpdis->hDC,hbrold);
00160            DeleteObject(hbr);
00161          }
00162        }
00163      }
00164      return TRUE;
00165    case WM_PAINT:
00166      PaintDialogBackground(hwnd,ghinst_main);
00167      break;
00168    case WM_COMMAND:
00169       switch(LOWORD(wparam)){
00170         case DLG_GROUND_CHOOSE_SHA:
00171           EnableWindow(hwnd,FALSE);
00172           i=SelectScrolledItemList((int)NoGroundTexts,GroundTextList,
00173                                    "Texture",FALSE,hwnd);
00174           EnableWindow(hwnd,TRUE);
00175           if(i < 0)break;
00176           if(i > 0)op->groundtype=128+i;
00177           else     op->groundtype=PLAIN;
00178           noaction=TRUE;
00179           UpdateGroundDialog(hwnd,op);
00180           noaction=FALSE;
00181           break;
00182         case DLG_GROUND_CHOOSE:
00183           if(op->groundtype == BRUM  ||
00184              op->groundtype == TBRUM ||
00185              op->groundtype == MBRUM){
00186             EnableWindow(hwnd,FALSE);
00187             if(SelectSfxFileName(0,gszMAPfile,gszMAPdir,IDX_MISC_SELIMAGEMAP,
00188               "All formats|*.bmp;*.gif;*.tga;*.dib;*.jpg;*.tif;*.png|"
00189               "(*.GIF)|*.gif|(*.TGA)|*.tga|(*.TIF)|*.tif|(*.JPG)|*.jpg|(*.PNG)|*.png|",hwnd) == TRUE){
00190               strcpy(op->name,gszMAPfile);
00191               UnloadRamImage(&(op->image));
00192               LoadRamImage(&(op->image),op->name);
00193             }
00194             SetActiveWindow(hwnd);
00195             EnableWindow(hwnd,TRUE);
00196             noaction=TRUE;
00197             UpdateGroundDialog(hwnd,op);
00198             noaction=FALSE;
00199           }
00200           break;
00201         case DLG_GROUND_VIEW:
00202           if(op->groundtype == BRUM  ||
00203              op->groundtype == TBRUM ||
00204              op->groundtype == MBRUM)DisplayImageFromStore(&(op->image),op->name); //DisplayImageFile(op->name);
00205           break;
00206         case DLG_GROUND_EDITAPP:
00207           if(op->groundtype == BRUM  ||
00208              op->groundtype == TBRUM ||
00209              op->groundtype == MBRUM)EditImageFile(op->name);
00210           break;
00211         case DLG_GROUND_MAP_SINGLE:
00212           if(noaction)break;
00213           if(op->groundtype == PLAIN || op->groundtype >= 128)break;
00214           op->groundtype=BRUM;
00215           noaction=TRUE;
00216           UpdateGroundDialog(hwnd,op);
00217           noaction=FALSE;
00218           break;
00219         case DLG_GROUND_MAP_TILE:
00220           if(noaction)break;
00221           if(op->groundtype == PLAIN || op->groundtype >= 128)break;
00222           op->groundtype=TBRUM;
00223           noaction=TRUE;
00224           UpdateGroundDialog(hwnd,op);
00225           noaction=FALSE;
00226           break;
00227         case DLG_GROUND_MAP_MOZAIC:
00228           if(noaction)break;
00229           if(op->groundtype == PLAIN || op->groundtype >= 128)break;
00230           op->groundtype=MBRUM;
00231           noaction=TRUE;
00232           UpdateGroundDialog(hwnd,op);
00233           noaction=FALSE;
00234           break;
00235         case DLG_GROUND_PLAIN:
00236           if(noaction)break;
00237           op->groundtype=PLAIN;
00238           UnloadRamImage(&(op->image));
00239           noaction=TRUE;
00240           UpdateGroundDialog(hwnd,op);
00241           noaction=FALSE;
00242           break;
00243         case DLG_GROUND_SHADER:
00244           if(noaction)break;
00245           if(HIWORD(wparam) == BN_CLICKED){
00246             EnableWindow(hwnd,FALSE);
00247             i=SelectScrolledItemList((int)NoGroundTexts,GroundTextList,
00248                                      "Texture",FALSE,hwnd);
00249             EnableWindow(hwnd,TRUE);
00250             if(i < 0)break;
00251             if(i > 0)op->groundtype=128+i;
00252             else     op->groundtype=PLAIN;
00253             UnloadRamImage(&(op->image));
00254             noaction=TRUE;
00255             UpdateGroundDialog(hwnd,op);
00256             noaction=FALSE;
00257           }
00258           break;
00259         case DLG_GROUND_MAPPED:
00260           if(noaction)break;
00261           EnableWindow(hwnd,FALSE);
00262           if(SelectSfxFileName(0,gszMAPfile,gszMAPdir,IDX_MISC_SELIMAGEMAP,
00263             "All formats|*.bmp;*.gif;*.tga;*.dib;*.jpg;*.tif;*.png|"
00264             "(*.GIF)|*.gif|(*.TGA)|*.tga|(*.TIF)|*.tif|(*.JPG)|*.jpg|(*.PNG)|*.png|",hwnd) == TRUE){
00265             strcpy(op->name,gszMAPfile);
00266             op->groundtype=BRUM;
00267             LoadRamImage(&(op->image),op->name);
00268           }
00269           SetActiveWindow(hwnd);
00270           EnableWindow(hwnd,TRUE);
00271           noaction=TRUE;
00272           UpdateGroundDialog(hwnd,op);
00273           noaction=FALSE;
00274           break;
00275         case DLG_GROUND_GC:
00276           SetSfxColour(op->colour,IDX_MISC_GROUND_COLOUR,hwnd);
00277           InvalidateRect(GetDlgItem(hwnd,DLG_GROUND_GC),NULL,FALSE);
00278           UpdateGroundDialog(hwnd,op);
00279           break;
00280         case DLG_GROUND_SC:
00281           SetSfxColour(op->acolour,IDX_MISC_GROUND_SHADER,hwnd);
00282           InvalidateRect(GetDlgItem(hwnd,DLG_GROUND_SC),NULL,FALSE);
00283           UpdateGroundDialog(hwnd,op);
00284           break;
00285         case IDCANCEL:
00286         case DLG_GROUND_CANCEL:
00287           EndDialog(hwnd,FAIL);
00288           return(TRUE);
00289         case IDOK:
00290         case DLG_GROUND_OK:
00291           if(GetDlgItemText(hwnd,DLG_GROUND_REFL,str,10) == 0){
00292             EndDialog(hwnd,FAIL);
00293             return TRUE;
00294           }
00295           op->grefl=atof(str);
00296           if(op->grefl < 0.0 || op->grefl > 100.0){
00297             EndDialog(hwnd,FAIL);
00298             return TRUE;
00299           }
00300           if(GetDlgItemText(hwnd,DLG_GROUND_TEMPERATURE,str,10) == 0){
00301             EndDialog(hwnd,FAIL);
00302             return TRUE;
00303           }
00304           op->groundTemperature=atof(str);
00305           i=GetDlgItemInt(hwnd,DLG_GROUND_FRAME_FROM,&err,FALSE);
00306           if(!err || i < (short)l_limit ||
00307                      i > (short)u_limit)goto CANCELX;
00308           op->firstframe = (short)i;
00309           i=GetDlgItemInt(hwnd,DLG_GROUND_FRAME_TO,&err,FALSE);
00310           if(!err || i < (short)l_limit ||
00311                      i > (short)u_limit)goto CANCELX;
00312           op->lastframe = (short)i;
00313           if(op->firstframe > op->lastframe)goto CANCELX;
00314           EndDialog(hwnd,OK);
00315           return(TRUE);
00316           CANCELX:
00317           EndDialog(hwnd,FAIL);
00318           return TRUE;
00319         default:
00320           break;
00321       }
00322       break;
00323     default: break;
00324  }
00325  return(FALSE);
00326 }
00327 
00328 short EditGroundDialog(object *op, short in_script){
00329  int i;
00330  object actor;
00331  HWND hwnd;
00332  RAMIMAGE tempimage;
00333  memcpy(&actor,op,sizeof(object));
00334  CopyRamImage(&tempimage,&(op->image));
00335  EnableToolPannels(ALL_PANNELS,FALSE);
00336  if(in_script)hwnd=ghwndTimeline; else hwnd=ghwnd_main;
00337  if((i=DialogBoxParam(ghinst_main,MAKEINTRESOURCE(DLG_GROUND),hwnd,
00338             (DLGPROC)GroundDlgProc,(LPARAM)&actor)) == OK){
00339    EDIT_ACTION=YES;
00340    memcpy(op,&actor,sizeof(object));
00341  }
00342  else {
00343    if(actor.image.filename != NULL)UnloadRamImage(&(actor.image));
00344    CopyRamImage(&(op->image),&tempimage);
00345  }
00346  if(tempimage.filename != NULL)UnloadRamImage(&tempimage);
00347  EnableToolPannels(ALL_PANNELS,TRUE);
00348  return (short)i;
00349 }
00350 
00351 static void UpdateSkyDialog(HWND hwnd, sky *sp){
00352  BOOL enable=FALSE;
00353  int show=SW_HIDE;
00354  int st;
00355  st=(int)sp->type;
00356  if(st == SKYMAPPED   ||
00357     st == SKYANIMATED ||
00358     st == SKYCUBE     ||
00359     st == BACKDROP)enable=TRUE;
00360  if(st == SKYANIMATED)show=SW_SHOW;
00361  EnableWindow(GetDlgItem(hwnd,DLG_SKY_CHOOSE),enable);
00362  EnableWindow(GetDlgItem(hwnd,DLG_SKY_VIEW),enable);
00363  EnableWindow(GetDlgItem(hwnd,DLG_SKY_EDITAPP),enable);
00364  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_START),show);
00365  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_START_S),show);
00366  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_START_T),show);
00367  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_END),show);
00368  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_END_S),show);
00369  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_END_T),show);
00370  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_STEP),show);
00371  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_STEP_S),show);
00372  ShowWindow(GetDlgItem(hwnd,DLG_SKY_ANIM_STEP_T),show);
00373  return;
00374 }
00375 
00376 static BOOL CALLBACK SkyDlgProc(HWND hwnd,UINT msg,
00377                                 WPARAM wparam,LPARAM lparam){
00378  char str[32],nomaptext[]="No image map in use";
00379  char tt[128];
00380  static sky *sp;
00381  BOOL err;
00382  int i;
00383  LPDRAWITEMSTRUCT lpdis;
00384  static short l_limit,u_limit;
00385  switch( msg ) {
00386    case WM_INITDIALOG:{
00387        int dlg_list[6]={DLG_SKY_PLAIN,DLG_SKY_GRADED,
00388                         DLG_SKY_ENVIRON,DLG_SKY_BACKDROP,
00389                         DLG_SKY_CUBE,DLG_SKY_ANIMATED};
00390        sp=(sky *)lparam;
00391        SendDlgItemMessage(hwnd,dlg_list[sp->type],BM_SETCHECK,1,0);
00392        if(sp->type == SKYCOLOURED || sp->type == SKYGRADED){
00393          SetDlgItemText(hwnd,DLG_SKY_MAP_NAME,(LPCTSTR)nomaptext);
00394          SetDlgItemText(hwnd,DLG_SKY_MAP_PATH,(LPCTSTR)" ");
00395        }
00396        else{
00397          SetDlgItemText(hwnd,DLG_SKY_MAP_NAME,(LPCTSTR)short_form(sp->name));
00398          SetDlgItemText(hwnd,DLG_SKY_MAP_PATH,(LPCTSTR)truncate_path(sp->name,40));
00399        }
00400        SetDlgItemInt(hwnd,DLG_SKY_FRAME_FROM,sp->firstframe,FALSE);
00401        SetDlgItemInt(hwnd,DLG_SKY_FRAME_TO  ,sp->lastframe, FALSE);
00402        if(sp->last != NULL)l_limit=sp->last->lastframe+1;
00403        else l_limit=1;
00404        if(sp->next != NULL)u_limit=sp->next->firstframe-1;
00405        else u_limit=Nframes;
00406        SendDlgItemMessage(hwnd,DLG_SKY_FRAME_SPINF,SPNM_SETRANGE,0,
00407                           MAKELPARAM(l_limit,u_limit));
00408        SendDlgItemMessage(hwnd,DLG_SKY_FRAME_SPINF,SPNM_SETCRNTVALUE,
00409                           (WPARAM)sp->firstframe,0);
00410        SendDlgItemMessage(hwnd,DLG_SKY_FRAME_SPINF,SPNM_SETEDITCTRL,0,
00411                           (LPARAM)GetDlgItem(hwnd,DLG_SKY_FRAME_FROM));
00412        SendDlgItemMessage(hwnd,DLG_SKY_FRAME_SPINT,SPNM_SETRANGE,0,
00413                           MAKELPARAM(l_limit,u_limit));
00414        SendDlgItemMessage(hwnd,DLG_SKY_FRAME_SPINT,SPNM_SETCRNTVALUE,
00415                           (WPARAM)sp->lastframe,0);
00416        SendDlgItemMessage(hwnd,DLG_SKY_FRAME_SPINT,SPNM_SETEDITCTRL,0,
00417                           (LPARAM)GetDlgItem(hwnd,DLG_SKY_FRAME_TO));
00418        sprintf(str,"%.2lf",sp->gamb*100.0);
00419        SetDlgItemText(hwnd,DLG_SKY_AMB_GROUND,(LPCTSTR)str);
00420        SendDlgItemMessage(hwnd,DLG_SKY_AMB_GROUND,EM_LIMITTEXT,(WPARAM)12,0);
00421        sprintf(str,"%.2lf",sp->oamb*100.0);
00422        SetDlgItemText(hwnd,DLG_SKY_AMB_MODEL,(LPCTSTR)str);
00423        SendDlgItemMessage(hwnd,DLG_SKY_AMB_MODEL,EM_LIMITTEXT,(WPARAM)12,0);
00424        SetDlgItemInt(hwnd,DLG_SKY_ANIM_START,sp->aff,FALSE);
00425        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_START_S,SPNM_SETRANGE,0,
00426                           MAKELPARAM(1,9999));
00427        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_START_S,SPNM_SETCRNTVALUE,
00428                           (WPARAM)sp->aff,0);
00429        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_START_S,SPNM_SETEDITCTRL,0,
00430                           (LPARAM)GetDlgItem(hwnd,DLG_SKY_ANIM_START));
00431        SetDlgItemInt(hwnd,DLG_SKY_ANIM_END,sp->alf,FALSE);
00432        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_END_S,SPNM_SETRANGE,0,
00433                           MAKELPARAM(1,9999));
00434        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_END_S,SPNM_SETCRNTVALUE,
00435                           (WPARAM)sp->alf,0);
00436        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_END_S,SPNM_SETEDITCTRL,0,
00437                           (LPARAM)GetDlgItem(hwnd,DLG_SKY_ANIM_END));
00438        SetDlgItemInt(hwnd,DLG_SKY_ANIM_STEP,sp->ast,FALSE);
00439        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_STEP_S,SPNM_SETRANGE,0,
00440                           MAKELPARAM(1,9999));
00441        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_STEP_S,SPNM_SETCRNTVALUE,
00442                           (WPARAM)sp->ast,0);
00443        SendDlgItemMessage(hwnd,DLG_SKY_ANIM_STEP_S,SPNM_SETEDITCTRL,0,
00444                           (LPARAM)GetDlgItem(hwnd,DLG_SKY_ANIM_STEP));
00445        sprintf(str,"%.1lf",sp->sky_params[0]);
00446        SetDlgItemText(hwnd,DLG_SKY_ENVIRONMENT_T,(LPCTSTR)str);
00447        sprintf(str,"%.1lf",sp->sky_params[1]);
00448        SetDlgItemText(hwnd,DLG_SKY_ZENITH_T,(LPCTSTR)str);
00449        sprintf(str,"%.1lf",sp->sky_params[2]);
00450        SetDlgItemText(hwnd,DLG_SKY_ATENUATION,(LPCTSTR)str);
00451        UpdateSkyDialog(hwnd,sp);
00452        CentreDialogOnScreen(hwnd);
00453      }
00454      return (TRUE);
00455    case WM_DRAWITEM:{
00456        HBRUSH   hbr,hbrold;
00457        HPEN hOldPen;
00458        BYTE r,g,b;
00459        lpdis=(LPDRAWITEMSTRUCT)lparam;
00460        if(lpdis->CtlID == DLG_SKY_ZC || lpdis->CtlID == DLG_SKY_HC){
00461          if(lpdis->CtlID == DLG_SKY_ZC){
00462            r=sp->zcolour[0]; g=sp->zcolour[1]; b=sp->zcolour[2];
00463          }
00464          else {
00465            r=sp->colour[0]; g=sp->colour[1]; b=sp->colour[2];
00466          }
00467          if(lpdis->itemState & ODS_SELECTED)InvertRect(lpdis->hDC,&(lpdis->rcItem));
00468          else{
00469            hbr=CreateSolidBrush(RGB(r,g,b));
00470            hbrold=SelectObject(lpdis->hDC,hbr);
00471            Rectangle(lpdis->hDC,lpdis->rcItem.left,lpdis->rcItem.top,
00472                          lpdis->rcItem.right,lpdis->rcItem.bottom);
00473            SelectObject(lpdis->hDC,hbrold);
00474            DeleteObject(hbr);
00475          }
00476        }
00477      }
00478      return TRUE;
00479    case WM_PAINT:
00480      PaintDialogBackground(hwnd,ghinst_main);
00481      break;
00482    case WM_COMMAND:
00483       switch(LOWORD(wparam)){
00484         case DLG_SKY_CHOOSE:
00485           if(sp->type == SKYMAPPED   ||
00486              sp->type == SKYANIMATED ||
00487              sp->type == SKYCUBE     ||
00488              sp->type == BACKDROP){
00489             EnableWindow(hwnd,FALSE);
00490             if(sp->type == SKYANIMATED)
00491               LoadString(ghinst_main,IDX_MISC_SELANIMAP,tt,128);
00492             else
00493               LoadString(ghinst_main,IDX_MISC_SELIMAGEMAP,tt,128);
00494             if(SelectFileName(0,gszMAPfile,gszMAPdir,tt,
00495               "All file formats|*.bmp;*.gif;*.tga;*.dib;*.jpg;*.tif;*.png|"
00496               "(*.GIF)|*.gif|(*.TGA)|*.tga|(*.TIF)|*.tif|(*.JPG)|*.jpg|(*.PNG)|*.png|",hwnd) == TRUE){
00497               strcpy(sp->name,gszMAPfile);
00498               SetDlgItemText(hwnd,DLG_SKY_MAP_NAME,(LPCTSTR)short_form(sp->name));
00499               SetDlgItemText(hwnd,DLG_SKY_MAP_PATH,(LPCTSTR)truncate_path(sp->name,40));
00500               UnloadRamImage(&(sp->image));
00501               LoadRamImage(&(sp->image),sp->name);
00502             }
00503             SetActiveWindow(hwnd);
00504             EnableWindow(hwnd,TRUE);
00505           }
00506           break;
00507         case DLG_SKY_VIEW:
00508           if(sp->type == SKYMAPPED   ||
00509              sp->type == SKYANIMATED ||
00510              sp->type == SKYCUBE     ||
00511              sp->type == BACKDROP)DisplayImageFromStore(&(sp->image),sp->name);//DisplayImageFile(sp->name);
00512           break;
00513         case DLG_SKY_EDITAPP:
00514           if(sp->type == SKYMAPPED   ||
00515              sp->type == SKYCUBE     ||
00516              sp->type == SKYANIMATED ||
00517              sp->type == BACKDROP)EditImageFile(sp->name);
00518           break;
00519         case DLG_SKY_PLAIN:
00520           sp->type=SKYCOLOURED;
00521           UnloadRamImage(&(sp->image));
00522           SetDlgItemText(hwnd,DLG_SKY_MAP_NAME,nomaptext);
00523           SetDlgItemText(hwnd,DLG_SKY_MAP_PATH,(LPCTSTR)" ");
00524           UpdateSkyDialog(hwnd,sp);
00525           break;
00526         case DLG_SKY_GRADED:
00527           sp->type=SKYGRADED;
00528           UnloadRamImage(&(sp->image));
00529           SetDlgItemText(hwnd,DLG_SKY_MAP_NAME,nomaptext);
00530           SetDlgItemText(hwnd,DLG_SKY_MAP_PATH,(LPCTSTR)" ");
00531           UpdateSkyDialog(hwnd,sp);
00532           break;
00533         case DLG_SKY_ENVIRON:
00534         case DLG_SKY_CUBE:
00535         case DLG_SKY_BACKDROP:
00536         case DLG_SKY_ANIMATED:
00537           EnableWindow(hwnd,FALSE);
00538           if(LOWORD(wparam) == DLG_SKY_ANIMATED)
00539             LoadString(ghinst_main,IDX_MISC_SELANIMAP,tt,128);
00540           else
00541             LoadString(ghinst_main,IDX_MISC_SELIMAGEMAP,tt,128);
00542           if(SelectFileName(0,gszMAPfile,gszMAPdir,tt,
00543             "All file formats|*.bmp;*.gif;*.tga;*.dib;*.jpg;*.tif;*.png|"
00544             "(*.GIF)|*.gif|(*.TGA)|*.tga|(*.TIF)|*.tif|(*.JPG)|*.jpg|(*.PNG)|*.png|",hwnd) == TRUE){
00545             strcpy(sp->name,gszMAPfile);
00546             if(LOWORD(wparam) == DLG_SKY_ENVIRON) sp->type=SKYMAPPED;
00547             if(LOWORD(wparam) == DLG_SKY_BACKDROP)sp->type=BACKDROP;
00548             if(LOWORD(wparam) == DLG_SKY_CUBE)    sp->type=SKYCUBE;
00549             if(LOWORD(wparam) == DLG_SKY_ANIMATED)sp->type=SKYANIMATED;
00550             SetDlgItemText(hwnd,DLG_SKY_MAP_NAME,(LPCTSTR)short_form(sp->name));
00551             SetDlgItemText(hwnd,DLG_SKY_MAP_PATH,(LPCTSTR)truncate_path(sp->name,40));
00552             LoadRamImage(&(sp->image),sp->name);
00553           }
00554           SetActiveWindow(hwnd);
00555           EnableWindow(hwnd,TRUE);
00556           UpdateSkyDialog(hwnd,sp);
00557           break;
00558         case DLG_SKY_HC:
00559           SetSfxColour(sp->colour,IDX_MISC_HORIZON_COLOUR,hwnd);
00560           InvalidateRect(GetDlgItem(hwnd,DLG_SKY_HC),NULL,FALSE);
00561           break;
00562         case DLG_SKY_ZC:
00563           SetSfxColour(sp->zcolour,IDX_MISC_ZENITH_COLOUR,hwnd);
00564           InvalidateRect(GetDlgItem(hwnd,DLG_SKY_ZC),NULL,FALSE);
00565           break;
00566         case IDCANCEL:
00567         case DLG_SKY_CANCEL:
00568           EndDialog(hwnd,FAIL);
00569           return(TRUE);
00570         case IDOK:
00571         case DLG_SKY_OK:
00572           if(GetDlgItemText(hwnd,DLG_SKY_AMB_GROUND,str,10) == 0){
00573             EndDialog(hwnd,FAIL);
00574             return TRUE;
00575           }
00576           sp->gamb=atof(str)/100.0;
00577           if(sp->gamb < 0.0 || sp->gamb > 1.0){
00578             EndDialog(hwnd,FAIL);
00579             return TRUE;
00580           }
00581           if(GetDlgItemText(hwnd,DLG_SKY_AMB_MODEL,str,10) == 0){
00582             EndDialog(hwnd,FAIL);
00583             return TRUE;
00584           }
00585           sp->oamb=atof(str)/100.0;
00586           if(sp->oamb < 0.0 || sp->oamb > 1.0){
00587             EndDialog(hwnd,FAIL);
00588             return TRUE;
00589           }
00590           i=GetDlgItemInt(hwnd,DLG_SKY_FRAME_FROM,&err,FALSE);
00591           if(!err || i < (short)l_limit ||
00592                      i > (short)u_limit)goto CANCELX;
00593           sp->firstframe = (short)i;
00594           i=GetDlgItemInt(hwnd,DLG_SKY_FRAME_TO,&err,FALSE);
00595           if(!err || i < (short)l_limit ||
00596                      i > (short)u_limit)goto CANCELX;
00597           sp->lastframe = (short)i;
00598           if(sp->firstframe > sp->lastframe)goto CANCELX;
00599           sp->aff=GetDlgItemInt(hwnd,DLG_SKY_ANIM_START,&err,FALSE);
00600           sp->alf=GetDlgItemInt(hwnd,DLG_SKY_ANIM_END,&err,FALSE);
00601           sp->ast=GetDlgItemInt(hwnd,DLG_SKY_ANIM_STEP,&err,FALSE);
00602           if(GetDlgItemText(hwnd,DLG_SKY_ENVIRONMENT_T,str,10) == 0){
00603             EndDialog(hwnd,FAIL);
00604             return TRUE;
00605           }
00606           sp->sky_params[0]=atof(str);
00607           if(GetDlgItemText(hwnd,DLG_SKY_ZENITH_T,str,10) == 0){
00608             EndDialog(hwnd,FAIL);
00609             return TRUE;
00610           }
00611           sp->sky_params[1]=atof(str);
00612           if(GetDlgItemText(hwnd,DLG_SKY_ATENUATION,str,10) == 0){
00613             EndDialog(hwnd,FAIL);
00614             return TRUE;
00615           }
00616           sp->sky_params[2]=atof(str);
00617           EndDialog(hwnd,OK);
00618           return(TRUE);
00619           CANCELX:
00620           EndDialog(hwnd,FAIL);
00621           return TRUE;
00622         default:
00623           break;
00624       }
00625       break;
00626     default: break;
00627  }
00628  return(FALSE);
00629 }
00630 
00631 short EditSkyDialog(sky *sp, int in_script){
00632  int i;
00633  sky Sky;
00634  HWND hwnd;
00635  RAMIMAGE tempimage;
00636  memcpy(&Sky,sp,sizeof(sky));
00637  CopyRamImage(&tempimage,&(sp->image));
00638  EnableToolPannels(ALL_PANNELS,FALSE);
00639 // if((hwnd=GetFocus()) != ghwnd_main)hwnd=ghwndTimeline;
00640  if(in_script)hwnd=ghwndTimeline; else hwnd=ghwnd_main;
00641  if((i=DialogBoxParam(ghinst_main,MAKEINTRESOURCE(DLG_SKY),hwnd,
00642             (DLGPROC)SkyDlgProc,(LPARAM)&Sky)) == OK){
00643    EDIT_ACTION=YES;
00644    memcpy(sp,&Sky,sizeof(sky));
00645  }
00646  else {
00647    if(&Sky.image.filename != NULL)UnloadRamImage(&(Sky.image));
00648    CopyRamImage(&(sp->image),&tempimage);
00649  }
00650  if(tempimage.filename != NULL)UnloadRamImage(&tempimage);
00651  EnableToolPannels(ALL_PANNELS,TRUE);
00652  return (short)i;
00653 }
00654 
00655 static BOOL CALLBACK DirectorDlgProc(HWND hwnd,UINT msg,
00656                                 WPARAM wparam,LPARAM lparam){
00657 // char tt[128];
00658  node *Np;
00659  BOOL err;
00660  int i;
00661  static director *dp;
00662  static short l_limit,u_limit;
00663  switch( msg ) {
00664    case WM_INITDIALOG:{
00665        dp=(director *)lparam;
00666        SetDlgItemInt(hwnd,DLG_DIRECTOR_FRAME_FROM,dp->firstframe,FALSE);
00667        SetDlgItemInt(hwnd,DLG_DIRECTOR_FRAME_TO  ,dp->lastframe, FALSE);
00668        if(dp->last != NULL)l_limit=dp->last->lastframe+1;
00669        else l_limit=1;
00670        if(dp->next != NULL)u_limit=dp->next->firstframe-1;
00671        else u_limit=Nframes;
00672        SendDlgItemMessage(hwnd,DLG_DIRECTOR_FRAME_SPINF,SPNM_SETRANGE,0,
00673                           MAKELPARAM(l_limit,u_limit));
00674        SendDlgItemMessage(hwnd,DLG_DIRECTOR_FRAME_SPINF,SPNM_SETCRNTVALUE,
00675                           (WPARAM)dp->firstframe,0);
00676        SendDlgItemMessage(hwnd,DLG_DIRECTOR_FRAME_SPINF,SPNM_SETEDITCTRL,0,
00677                           (LPARAM)GetDlgItem(hwnd,DLG_DIRECTOR_FRAME_FROM));
00678        SendDlgItemMessage(hwnd,DLG_DIRECTOR_FRAME_SPINT,SPNM_SETRANGE,0,
00679                           MAKELPARAM(l_limit,u_limit));
00680        SendDlgItemMessage(hwnd,DLG_DIRECTOR_FRAME_SPINT,SPNM_SETCRNTVALUE,
00681                           (WPARAM)dp->lastframe,0);
00682        SendDlgItemMessage(hwnd,DLG_DIRECTOR_FRAME_SPINT,SPNM_SETEDITCTRL,0,
00683                           (LPARAM)GetDlgItem(hwnd,DLG_DIRECTOR_FRAME_TO));
00684        if((Np=dp->ActiveCamera) != NULL){
00685          SetDlgItemText(hwnd,DLG_DIRECTOR_TARGET,Np->actorname);
00686        }
00687        Np=FirstNp; while(Np != NULL){
00688          if(Np->type == CAMERA){
00689            i=SendDlgItemMessage(hwnd,DLG_DIRECTOR_SELECT,LB_ADDSTRING,0,
00690                               (LPARAM)Np->actorname);
00691            SendDlgItemMessage(hwnd,DLG_DIRECTOR_SELECT,LB_SETITEMDATA,
00692                               i,(LPARAM)Np);
00693          }
00694          Np=Np->next;
00695        }
00696        CentreDialogOnScreen(hwnd);
00697      }
00698      return (TRUE);
00699    case WM_PAINT:
00700      PaintDialogBackground(hwnd,ghinst_main);
00701      break;
00702    case WM_COMMAND:
00703       switch(LOWORD(wparam)){
00704         case IDCANCEL:
00705           EndDialog(hwnd,FAIL);
00706           return(TRUE);
00707         case IDOK:
00708           i=GetDlgItemInt(hwnd,DLG_DIRECTOR_FRAME_FROM,&err,FALSE);
00709           if(!err || i < (short)l_limit ||
00710                      i > (short)u_limit)goto CANCELX;
00711           dp->firstframe = (short)i;
00712           i=GetDlgItemInt(hwnd,DLG_DIRECTOR_FRAME_TO,&err,FALSE);
00713           if(!err || i < (short)l_limit ||
00714                      i > (short)u_limit)goto CANCELX;
00715           dp->lastframe = (short)i;
00716           if(dp->firstframe > dp->lastframe)goto CANCELX;
00717           i=SendDlgItemMessage(hwnd,DLG_DIRECTOR_SELECT,LB_GETCURSEL,0,0);
00718           if(i != LB_ERR){
00719             i=(long)SendDlgItemMessage(hwnd,DLG_DIRECTOR_SELECT,
00720                        LB_GETITEMDATA,i,(LPARAM)0);
00721             if(i != LB_ERR){
00722               Np=(node *)i;
00723               dp->ActiveCamera=Np;
00724             }
00725           }
00726           EndDialog(hwnd,OK);
00727           return(TRUE);
00728           CANCELX:
00729           EndDialog(hwnd,FAIL);
00730           return TRUE;
00731         default:
00732           break;
00733       }
00734       break;
00735     default: break;
00736  }
00737  return(FALSE);
00738 }
00739 
00740 short EditDirectorDialog(director *dp, int in_script){
00741  int i;
00742  director Director;
00743  HWND hwnd;
00744  memcpy(&Director,dp,sizeof(director));
00745  EnableToolPannels(ALL_PANNELS,FALSE);
00746  if(in_script)hwnd=ghwndTimeline; else hwnd=ghwnd_main;
00747  if((i=DialogBoxParam(ghinst_main,MAKEINTRESOURCE(DLG_DIRECTOR),hwnd,
00748             (DLGPROC)DirectorDlgProc,(LPARAM)&Director)) == OK){
00749    EDIT_ACTION=YES;
00750    memcpy(dp,&Director,sizeof(director));
00751  }
00752  EnableToolPannels(ALL_PANNELS,TRUE);
00753  return (short)i;
00754 }
00755 
00756 static BOOL CALLBACK LightDlgProc(HWND hwnd,UINT msg,
00757                                 WPARAM wparam,LPARAM lparam){
00758  object *op;
00759  BOOL err;
00760  int i;
00761  char str[32];
00762  LPDRAWITEMSTRUCT lpdis;
00763  static short l_limit,u_limit;
00764  switch( msg ) {
00765    case WM_PAINT:
00766      PaintDialogBackground(hwnd,ghinst_main);
00767      break;
00768    case WM_INITDIALOG:{
00769        int dlg_list[5]={DLG_LIGHT_NORMAL,DLG_LIGHT_NOSHADOW,
00770                         DLG_LIGHT_SHADOWONLY,DLG_LIGHT_SPOTLIGHT,
00771                         DLG_LIGHT_DUMMY};
00772        SetWindowLong(hwnd,GWL_USERDATA,lparam);
00773        op=(object *)lparam;
00774        if(op->last != NULL)l_limit=op->last->lastframe+1;
00775        else l_limit=1;
00776        if(op->next != NULL)u_limit=op->next->firstframe-1;
00777        else u_limit=Nframes;
00778        SendDlgItemMessage(hwnd,dlg_list[op->lighttype],BM_SETCHECK,1,0);
00779        SetDlgItemInt(hwnd,DLG_LIGHT_FRAME_FROM,op->firstframe,FALSE);
00780        SetDlgItemInt(hwnd,DLG_LIGHT_FRAME_TO  ,op->lastframe, FALSE);
00781        SendDlgItemMessage(hwnd,DLG_LIGHT_FRAME_SPINF,SPNM_SETRANGE,0,
00782                           MAKELPARAM(l_limit,u_limit));
00783        SendDlgItemMessage(hwnd,DLG_LIGHT_FRAME_SPINF,SPNM_SETCRNTVALUE,
00784                           (WPARAM)op->firstframe,0);
00785        SendDlgItemMessage(hwnd,DLG_LIGHT_FRAME_SPINF,SPNM_SETEDITCTRL,0,
00786                           (LPARAM)GetDlgItem(hwnd,DLG_LIGHT_FRAME_FROM));
00787        SendDlgItemMessage(hwnd,DLG_LIGHT_FRAME_SPINT,SPNM_SETRANGE,0,
00788                           MAKELPARAM(l_limit,u_limit));
00789        SendDlgItemMessage(hwnd,DLG_LIGHT_FRAME_SPINT,SPNM_SETCRNTVALUE,
00790                           (WPARAM)op->lastframe,0);
00791        SendDlgItemMessage(hwnd,DLG_LIGHT_FRAME_SPINT,SPNM_SETEDITCTRL,0,
00792                           (LPARAM)GetDlgItem(hwnd,DLG_LIGHT_FRAME_TO));
00793        if(op->depth_cue)
00794          SendDlgItemMessage(hwnd,DLG_LIGHT_DEPTHCUE,BM_SETCHECK,TRUE,0);
00795        sprintf(str,"%.2lf",op->depth_cue_c);
00796        SetDlgItemText(hwnd,DLG_LIGHT_DEPTHCUE_C,str);
00797        sprintf(str,"%.2lf",op->depth_cue_l);
00798        SetDlgItemText(hwnd,DLG_LIGHT_DEPTHCUE_L,str);
00799        sprintf(str,"%.2lf",op->depth_cue_q);
00800        SetDlgItemText(hwnd,DLG_LIGHT_DEPTHCUE_Q,str);
00801 #if __LITE__
00802        EnableWindow(GetDlgItem(hwnd,DLG_LIGHT_DEPTHCUE),FALSE);
00803        EnableWindow(GetDlgItem(hwnd,DLG_LIGHT_DEPTHCUE_C),FALSE);
00804        EnableWindow(GetDlgItem(hwnd,DLG_LIGHT_DEPTHCUE_L),FALSE);
00805        EnableWindow(GetDlgItem(hwnd,DLG_LIGHT_DEPTHCUE_Q),FALSE);
00806 #endif
00807        CentreDialogOnScreen(hwnd);
00808      }
00809      return (TRUE);
00810    case WM_DRAWITEM:{
00811        HBRUSH   hbr,hbrold;
00812        BYTE r,g,b;
00813        lpdis=(LPDRAWITEMSTRUCT)lparam;
00814        if(lpdis->CtlID == DLG_LIGHT_COLOUR){
00815          op=(object *)GetWindowLong(hwnd,GWL_USERDATA);
00816          r=op->colour[0]; g=op->colour[1]; b=op->colour[2];
00817          if(lpdis->itemState & ODS_SELECTED)InvertRect(lpdis->hDC,&(lpdis->rcItem));
00818          else{
00819            hbr=CreateSolidBrush(RGB(r,g,b));
00820            hbrold=SelectObject(lpdis->hDC,hbr);
00821            Rectangle(lpdis->hDC,lpdis->rcItem.left,lpdis->rcItem.top,
00822                          lpdis->rcItem.right,lpdis->rcItem.bottom);
00823            SelectObject(lpdis->hDC,hbrold);
00824            DeleteObject(hbr);
00825          }
00826        }
00827      }
00828      return TRUE;
00829    case WM_COMMAND:
00830       op=(object *)GetWindowLong(hwnd,GWL_USERDATA);
00831       switch(LOWORD(wparam)){
00832         case DLG_LIGHT_NORMAL:
00833           op->lighttype=NORMAL;
00834           break;
00835         case DLG_LIGHT_NOSHADOW:
00836           op->lighttype=NOSHADOW;
00837           break;
00838         case DLG_LIGHT_SHADOWONLY:
00839           op->lighttype=SHADOWONLY;
00840           break;
00841         case DLG_LIGHT_SPOTLIGHT:
00842           op->lighttype=SPOTLIGHT;
00843           break;
00844         case DLG_LIGHT_DUMMY:
00845           op->lighttype=DUMMYL;
00846           break;
00847         case DLG_LIGHT_COLOUR:
00848           SetSfxColour(op->colour,IDX_MISC_LIGHT_COLOUR,hwnd);
00849           InvalidateRect(GetDlgItem(hwnd,DLG_LIGHT_COLOUR),NULL,FALSE);
00850           break;
00851         case IDCANCEL:
00852         case DLG_LIGHT_CANCEL:
00853           EndDialog(hwnd,FAIL);
00854           return(TRUE);
00855         case IDOK:
00856         case DLG_LIGHT_OK:
00857           i=GetDlgItemInt(hwnd,DLG_LIGHT_FRAME_FROM,&err,FALSE);
00858           if(!err || i < (short)l_limit ||
00859                      i > (short)u_limit)goto CANCELX;
00860           op->firstframe = (short)i;
00861           i=GetDlgItemInt(hwnd,DLG_LIGHT_FRAME_TO,&err,FALSE);
00862           if(!err || i < (short)l_limit ||
00863                      i > (short)u_limit)goto CANCELX;
00864           op->lastframe = (short)i;
00865           if(op->firstframe > op->lastframe)goto CANCELX;
00866           if(SendDlgItemMessage(hwnd,DLG_LIGHT_DEPTHCUE,BM_GETCHECK,0,0))
00867                op->depth_cue=1;
00868           else op->depth_cue=0;
00869           if(GetDlgItemText(hwnd,DLG_LIGHT_DEPTHCUE_C,str,31) != 0)
00870             op->depth_cue_c=atof(str);
00871           if(GetDlgItemText(hwnd,DLG_LIGHT_DEPTHCUE_L,str,31) != 0)
00872             op->depth_cue_l=atof(str);
00873           if(GetDlgItemText(hwnd,DLG_LIGHT_DEPTHCUE_Q,str,31) != 0)
00874             op->depth_cue_q=atof(str);
00875           EndDialog(hwnd,OK);
00876           return(TRUE);
00877           CANCELX:
00878           EndDialog(hwnd,FAIL);
00879           return TRUE;
00880         default:
00881           break;
00882       }
00883       break;
00884     default: break;
00885  }
00886  return(FALSE);
00887 }
00888 
00889 short EditLightDialog(object *op, int in_script){
00890  int i;
00891  object actor;
00892  HWND hwnd;
00893  memcpy(&actor,op,sizeof(object));
00894  EnableToolPannels(ALL_PANNELS,FALSE);
00895  if(in_script)hwnd=ghwndTimeline; else hwnd=ghwnd_main;
00896  if((i=DialogBoxParam(ghinst_main,MAKEINTRESOURCE(DLG_LIGHT),hwnd,
00897             (DLGPROC)LightDlgProc,(LPARAM)&actor)) == OK){
00898    EDIT_ACTION=YES;
00899    memcpy(op,&actor,sizeof(object));
00900  }
00901  EnableToolPannels(ALL_PANNELS,TRUE);
00902  return (short)i;
00903 }
00904 
00905 typedef struct tagSIZESTRUCT {
00906   size *sp;
00907   int  d;
00908 } SIZESTRUCT;
00909 
00910 static BOOL CALLBACK SizeDlgProc(HWND hwnd,UINT msg,
00911                                  WPARAM wparam,LPARAM lparam){
00912  char str[32];
00913  SIZESTRUCT *ss;
00914  size *sp;
00915  BOOL err;
00916  static double r,storeX=1.0,storeY=1.0,storeZ=1.0;
00917  static short l_limit,u_limit;
00918  int i;
00919  long range;
00920  switch( msg ) {
00921    case WM_PAINT:
00922      PaintDialogBackground(hwnd,ghinst_main);
00923      break;
00924    case WM_INITDIALOG:{
00925        ss=(SIZESTRUCT *)lparam;
00926        sp=ss->sp;
00927        SetWindowLong(hwnd,GWL_USERDATA,(LONG)sp);
00928        sprintf(str,"%.2lf",sp->Sx);
00929        SetDlgItemText(hwnd,DLG_SCALE_W,(LPCTSTR)str);
00930        SendDlgItemMessage(hwnd,DLG_SCALE_W,EM_LIMITTEXT,(WPARAM)12,0);
00931        sprintf(str,"%.2lf",sp->Sy);
00932        SetDlgItemText(hwnd,DLG_SCALE_L,(LPCTSTR)str);
00933        SendDlgItemMessage(hwnd,DLG_SCALE_L,EM_LIMITTEXT,(WPARAM)12,0);
00934        sprintf(str,"%.2lf",sp->Sz);
00935        SetDlgItemText(hwnd,DLG_SCALE_H,(LPCTSTR)str);
00936        SendDlgItemMessage(hwnd,DLG_SCALE_H,EM_LIMITTEXT,(WPARAM)12,0);
00937        if(sp->tweentype == 0)
00938          SendDlgItemMessage(hwnd,DLG_SCALE_BOUNCY_OFF,BM_SETCHECK,1,0);
00939        else
00940          SendDlgItemMessage(hwnd,DLG_SCALE_BOUNCY_ON,BM_SETCHECK,1,0);
00941        SetDlgItemInt(hwnd,DLG_SCALE_FROM,sp->firstframe,FALSE);
00942        SetDlgItemInt(hwnd,DLG_SCALE_TO,  sp->lastframe,FALSE);
00943        if(sp->last != NULL)l_limit=sp->last->lastframe+1;
00944        else l_limit=1;
00945        if(sp->next != NULL)u_limit=sp->next->firstframe-1;
00946        else u_limit=Nframes;
00947        SendDlgItemMessage(hwnd,DLG_SCALE_FROM_S,SPNM_SETRANGE,0,
00948                           MAKELPARAM(l_limit,u_limit));
00949        SendDlgItemMessage(hwnd,DLG_SCALE_FROM_S,SPNM_SETCRNTVALUE,
00950                           (WPARAM)sp->firstframe,0);
00951        SendDlgItemMessage(hwnd,DLG_SCALE_FROM_S,SPNM_SETEDITCTRL,0,
00952                           (LPARAM)GetDlgItem(hwnd,DLG_SCALE_FROM));
00953        SendDlgItemMessage(hwnd,DLG_SCALE_TO_S,SPNM_SETRANGE,0,
00954                           MAKELPARAM(l_limit,u_limit));
00955        SendDlgItemMessage(hwnd,DLG_SCALE_TO_S,SPNM_SETCRNTVALUE,
00956                           (WPARAM)sp->lastframe,0);
00957        SendDlgItemMessage(hwnd,DLG_SCALE_TO_S,SPNM_SETEDITCTRL,0,
00958                           (LPARAM)GetDlgItem(hwnd,DLG_SCALE_TO));
00959        if(ss->d == 0){
00960          EnableWindow(GetDlgItem(hwnd,DLG_SCALE_DELETE),FALSE);
00961 //         EnableWindow(GetDlgItem(hwnd,DLG_SCALE_CUT),FALSE);
00962        }
00963        CentreDialogOnScreen(hwnd);
00964      }
00965      return (TRUE);
00966    case WM_COMMAND:
00967       sp=(size *)GetWindowLong(hwnd,GWL_USERDATA);
00968       switch(LOWORD(wparam)){
00969         case DLG_SCALE_RESET:
00970           sprintf(str,"%.2lf",1.0);
00971           SetDlgItemText(hwnd,DLG_SCALE_W,(LPCTSTR)str);
00972           SetDlgItemText(hwnd,DLG_SCALE_L,(LPCTSTR)str);
00973           SetDlgItemText(hwnd,DLG_SCALE_H,(LPCTSTR)str);
00974           break;
00975         case DLG_SCALE_SET:
00976           sprintf(str,"%.2lf",storeX);
00977           SetDlgItemText(hwnd,DLG_SCALE_W,(LPCTSTR)str);
00978           sprintf(str,"%.2lf",storeY);
00979           SetDlgItemText(hwnd,DLG_SCALE_L,(LPCTSTR)str);
00980           sprintf(str,"%.2lf",storeZ);
00981           SetDlgItemText(hwnd,DLG_SCALE_H,(LPCTSTR)str);
00982           break;
00983         case DLG_SCALE_STORE:
00984           if(GetDlgItemText(hwnd,DLG_SCALE_W,str,10) != 0)
00985             if((r=atof(str)) != 0.0)storeX=r;
00986           if(GetDlgItemText(hwnd,DLG_SCALE_L,str,10) != 0)
00987             if((r=atof(str)) != 0.0)storeY=r;
00988           if(GetDlgItemText(hwnd,DLG_SCALE_H,str,10) != 0)
00989             if((r=atof(str)) != 0.0)storeZ=r;
00990           break;
00991         case DLG_SCALE_COPY:
00992           if(sp->last != NULL){
00993             sprintf(str,"%.2lf",sp->Sx);
00994             SetDlgItemText(hwnd,DLG_SCALE_W,(LPCTSTR)str);
00995             sprintf(str,"%.2lf",sp->Sy);
00996             SetDlgItemText(hwnd,DLG_SCALE_L,(LPCTSTR)str);
00997             sprintf(str,"%.2lf",sp->Sz);
00998             SetDlgItemText(hwnd,DLG_SCALE_H,(LPCTSTR)str);
00999           }
01000           break;
01001         case DLG_SCALE_DELETE:
01002           EndDialog(hwnd,2);
01003           return(TRUE);
01004 //        case DLG_SCALE_CUT:
01005 //          EndDialog(hwnd,FAIL);
01006 //          return(TRUE);
01007         case IDCANCEL:
01008         case DLG_SCALE_CANCEL:
01009           EndDialog(hwnd,FAIL);
01010           return(TRUE);
01011         case IDOK:
01012         case DLG_SCALE_OK:
01013           if(SendDlgItemMessage(hwnd,DLG_SCALE_BOUNCY_ON,BM_GETCHECK,0,0))
01014              sp->tweentype=1;
01015           else sp->tweentype=0;
01016           range=SendDlgItemMessage(hwnd,DLG_SCALE_FROM_S,SPNM_GETRANGE,0,0);
01017           i=GetDlgItemInt(hwnd,DLG_SCALE_FROM,&err,FALSE);
01018           if(!err || i < LOWORD(range) || i > HIWORD(range))goto CANCELX;
01019           if(err)sp->firstframe=(short)i;
01020           range=SendDlgItemMessage(hwnd,DLG_SCALE_TO_S,SPNM_GETRANGE,0,0);
01021           i=GetDlgItemInt(hwnd,DLG_SCALE_TO,&err,FALSE);
01022           if(!err || i < LOWORD(range) || i > HIWORD(range))goto CANCELX;
01023           if(err)sp->lastframe=(short)i;
01024           if(GetDlgItemText(hwnd,DLG_SCALE_W,str,10) == 0)goto CANCELX;
01025           if((sp->Sx=atof(str)) == 0.0)goto CANCELX;
01026           if(GetDlgItemText(hwnd,DLG_SCALE_L,str,10) == 0)goto CANCELX;
01027           if((sp->Sy=atof(str)) == 0.0)goto CANCELX;
01028           if(GetDlgItemText(hwnd,DLG_SCALE_H,str,10) == 0)goto CANCELX;
01029           if((sp->Sz=atof(str)) == 0.0)goto CANCELX;
01030           EndDialog(hwnd,OK);
01031           return(TRUE);
01032           CANCELX:
01033           EndDialog(hwnd,FAIL);
01034           return TRUE;
01035         default:
01036           break;
01037       }
01038       break;
01039     default: break;
01040  }
01041  return(FALSE);
01042 }
01043 
01044 short RequestEditSize(double *sx, double *sy, double *sz, size *xp, int d){
01045  int i;
01046  size Size;
01047  SIZESTRUCT SS;
01048  HWND original;
01049  memcpy(&Size,xp,sizeof(size));
01050  original=GetActiveWindow();
01051  EnableToolPannels(ALL_PANNELS,FALSE);
01052  SS.sp=&Size; SS.d=d;
01053  if((i=DialogBoxParam(ghinst_main,MAKEINTRESOURCE(DLG_SCALE),ghwnd_main,
01054             (DLGPROC)SizeDlgProc,(LPARAM)&SS)) == OK){
01055    EDIT_ACTION=YES;
01056    if(Size.lastframe >= Size.firstframe){
01057      memcpy(xp,&Size,sizeof(size));
01058      *sx=Size.Sx;
01059      *sy=Size.Sy;
01060      *sz=Size.Sz;
01061    }
01062  }
01063  EnableToolPannels(ALL_PANNELS,TRUE);
01064  if(original != NULL)SetActiveWindow(original);
01065  return (short)i;
01066 }
01067 
01068 static BOOL CALLBACK SizeL_DlgProc(HWND hwnd,UINT msg,
01069                                  WPARAM wparam,LPARAM lparam){
01070  static short l_limit,u_limit;
01071  char str[32];
01072  size *sp;
01073  SIZESTRUCT *ss;
01074  BOOL err;
01075  static double r,storeX=1.0,storeY=1.0;
01076  int i;
01077  long range;
01078  switch( msg ) {
01079    case WM_PAINT:
01080      PaintDialogBackground(hwnd,ghinst_main);
01081      break;
01082    case WM_INITDIALOG:{
01083        ss=(SIZESTRUCT *)lparam;
01084        sp=ss->sp;
01085        SetWindowLong(hwnd,GWL_USERDATA,(LONG)sp);
01086        sprintf(str,"%.2lf",sp->Sx);
01087        SetDlgItemText(hwnd,DLG_SCALEL_CONE,(LPCTSTR)str);
01088        SendDlgItemMessage(hwnd,DLG_SCALEL_CONE,EM_LIMITTEXT,(WPARAM)12,0);
01089        sprintf(str,"%.2lf",sp->Sy);
01090        SetDlgItemText(hwnd,DLG_SCALEL_EDGE,(LPCTSTR)str);
01091        SendDlgItemMessage(hwnd,DLG_SCALEL_EDGE,EM_LIMITTEXT,(WPARAM)12,0);
01092        sprintf(str,"%.2lf",sp->Sz);
01093        SetDlgItemText(hwnd,DLG_SCALEL_RANGE,(LPCTSTR)str);
01094        SendDlgItemMessage(hwnd,DLG_SCALEL_RANGE,EM_LIMITTEXT,(WPARAM)12,0);
01095        SetDlgItemInt(hwnd,DLG_SCALEL_FROM,sp->firstframe,FALSE);
01096        SetDlgItemInt(hwnd,DLG_SCALEL_TO,  sp->lastframe,FALSE);
01097        if(sp->last != NULL)l_limit=sp->last->lastframe+1;
01098        else l_limit=1;
01099        if(sp->next != NULL)u_limit=sp->next->firstframe-1;
01100        else u_limit=Nframes;
01101        SendDlgItemMessage(hwnd,DLG_SCALEL_FROM_S,SPNM_SETRANGE,0,
01102                           MAKELPARAM(l_limit,u_limit));
01103        SendDlgItemMessage(hwnd,DLG_SCALEL_FROM_S,SPNM_SETCRNTVALUE,
01104                           (WPARAM)sp->firstframe,0);
01105        SendDlgItemMessage(hwnd,DLG_SCALEL_FROM_S,SPNM_SETEDITCTRL,0,
01106                           (LPARAM)GetDlgItem(hwnd,DLG_SCALEL_FROM));
01107        SendDlgItemMessage(hwnd,DLG_SCALEL_TO_S,SPNM_SETRANGE,0,
01108                           MAKELPARAM(l_limit,u_limit));
01109        SendDlgItemMessage(hwnd,DLG_SCALEL_TO_S,SPNM_SETCRNTVALUE,
01110                           (WPARAM)sp->lastframe,0);
01111        SendDlgItemMessage(hwnd,DLG_SCALEL_TO_S,SPNM_SETEDITCTRL,0,
01112                           (LPARAM)GetDlgItem(hwnd,DLG_SCALEL_TO));
01113        if(ss->d == 0){
01114          EnableWindow(GetDlgItem(hwnd,DLG_SCALEL_DELETE),FALSE);
01115        }
01116        CentreDialogOnScreen(hwnd);
01117      }
01118      return (TRUE);
01119    case WM_COMMAND:
01120       sp=(size *)GetWindowLong(hwnd,GWL_USERDATA);
01121       switch(LOWORD(wparam)){
01122         case DLG_SCALEL_DELETE:
01123           EndDialog(hwnd,2);
01124           return(TRUE);
01125         case IDCANCEL:
01126         case DLG_SCALEL_CANCEL:
01127           EndDialog(hwnd,FAIL);
01128           return(TRUE);
01129         case IDOK:
01130         case DLG_SCALEL_OK:
01131           range=SendDlgItemMessage(hwnd,DLG_SCALEL_FROM_S,SPNM_GETRANGE,0,0);
01132           i=GetDlgItemInt(hwnd,DLG_SCALEL_FROM,&err,FALSE);
01133           if(!err || i < LOWORD(range) || i > HIWORD(range))goto CANCELX;
01134           if(err)sp->firstframe=(short)i;
01135           range=SendDlgItemMessage(hwnd,DLG_SCALEL_TO_S,SPNM_GETRANGE,0,0);
01136           i=GetDlgItemInt(hwnd,DLG_SCALEL_TO,&err,FALSE);
01137           if(!err || i < LOWORD(range) || i > HIWORD(range))goto CANCELX;
01138           if(err)sp->lastframe=(short)i;
01139           if(GetDlgItemText(hwnd,DLG_SCALEL_CONE,str,10) == 0)goto CANCELX;
01140           if((sp->Sx=atof(str)) < 1.0)goto CANCELX;
01141           if(sp->Sx > 179.0)goto CANCELX;
01142           if(GetDlgItemText(hwnd,DLG_SCALEL_EDGE,str,10) == 0)goto CANCELX;
01143           if((sp->Sy=atof(str)) < 1.0)goto CANCELX;
01144           if(sp->Sy > 179.0)goto CANCELX;
01145           if(GetDlgItemText(hwnd,DLG_SCALEL_RANGE,str,10) == 0)goto CANCELX;
01146           sp->Sz=atof(str);
01147           EndDialog(hwnd,OK);
01148           return(TRUE);
01149           CANCELX:
01150           EndDialog(hwnd,FAIL);
01151           return TRUE;
01152         default:
01153           break;
01154       }
01155       break;
01156     default: break;
01157  }
01158  return(FALSE);
01159 }
01160 
01161 short RequestEditLightSize(double *sx, double *sy, double *sz, size *xp, int d){
01162  int i;
01163  size Size;
01164  SIZESTRUCT SS;
01165  HWND original;
01166  memcpy(&Size,xp,sizeof(size));
01167  SS.sp=&Size; SS.d=d;
01168  original=GetActiveWindow();
01169  EnableToolPannels(ALL_PANNELS,FALSE);
01170  if((i=DialogBoxParam(ghinst_main,MAKEINTRESOURCE(DLG_SCALEL),ghwnd_main,
01171             (DLGPROC)SizeL_DlgProc,(LPARAM)&SS)) == OK){
01172    EDIT_ACTION=YES;
01173    if(Size.lastframe >= Size.firstframe){
01174      memcpy(xp,&Size,sizeof(size));
01175      *sx=Size.Sx;
01176      *sy=Size.Sy;
01177      *sz=Size.Sz;
01178    }
01179  }
01180  EnableToolPannels(ALL_PANNELS,TRUE);
01181  if(original != NULL)SetActiveWindow(original);
01182  return (short)i;
01183 }
01184 
01185 //DLG_SCALEC_POLARISATION
01186 static BOOL CALLBACK SizeC_DlgProc(HWND hwnd,UINT msg,
01187                                  WPARAM wparam,LPARAM lparam){
01188  static short l_limit,u_limit;
01189  static size *sp;
01190  SIZESTRUCT *ss;
01191  char str[32];
01192  BOOL err;
01193  int i,ilens;
01194  double lens,fov,ar,fd;
01195  long range;
01196  char *cameralenslist[]={" 15 mm"," 25 mm"," 50 mm","100 mm","200 mm"};
01197  int cameralens[]={15,25,50,100,200};
01198  int Nplist=5;
01199  char *plist[]={"None","Horizontal","Vertical","Circular+","Circular-"};
01200  HWND hctl;
01201  switch( msg ) {
01202    case WM_PAINT:
01203      PaintDialogBackground(hwnd,ghinst_main);
01204      break;
01205    case WM_INITDIALOG:{
01206        ss=(SIZESTRUCT *)lparam;
01207        sp=ss->sp;
01208 //       SetWindowLong(hwnd,GWL_USERDATA,(LONG)sp);
01209 
01210        sprintf(str,"%.3lf",sp->camera_params.stereo_separation);
01211        SetDlgItemText(hwnd,DLG_SCALEC_STEREO_SEP,(LPCTSTR)str);
01212        sprintf(str,"%.3lf",sp->camera_params.parallax_distance);
01213        SetDlgItemText(hwnd,DLG_SCALEC_PARALLAX_DIST,(LPCTSTR)str);
01214 
01215        sprintf(str,"%.3lf",sp->camera_params.focal_length);
01216        SetDlgItemText(hwnd,DLG_SCALEC_FOCAL_LENGTH,(LPCTSTR)str);
01217        sprintf(str,"%.3lf",sp->camera_params.f_number);
01218        SetDlgItemText(hwnd,DLG_SCALEC_F_NUMBER,(LPCTSTR)str);
01219        fd=sp->camera_params.focus_distance/ruler;
01220        sprintf(str,"%.3lf",fd);
01221        SetDlgItemText(hwnd,DLG_SCALEC_F_FOCUS_DISTANCE,(LPCTSTR)str);
01222        hctl=GetDlgItem(hwnd,DLG_SCALEC_POLARISATION);
01223        SendMessage(hctl,CB_RESETCONTENT,0,0);
01224        for(i=0;i<Nplist;i++)SendMessage(hctl,CB_ADDSTRING,0,(LPARAM)plist[i]);
01225        SendMessage(hctl,CB_SELECTSTRING,0,(LPARAM)plist[(int)(sp->camera_params.polar_type )]);
01226        if( (lens=50.0 * sp->Sx) - floor(lens) > 0.5)lens += 1.0;
01227        ilens=(int)lens;       // (5 999)
01228        fov=180/PI*2*atan2(21.22,(double)ilens);  //(5.0 160.0)
01229        ar = sp->Sy / sp->Sx; // (0.1,5.0);
01230        for(i=0;i<5;i++)SendDlgItemMessage(hwnd,DLG_SCALEC_PRESET,
01231          CB_ADDSTRING,0,(LPARAM)cameralenslist[i]);
01232        SendDlgItemMessage(hwnd,DLG_SCALEC_PRESET,CB_SELECTSTRING,
01233          0,(LPARAM)cameralenslist[2]);
01234        SetDlgItemInt(hwnd,DLG_SCALEC_LENS,ilens,FALSE);
01235        SendDlgItemMessage(hwnd,DLG_SCALEC_LENS_S,SPNM_SETRANGE,0,
01236                           MAKELPARAM(5,999));
01237        SendDlgItemMessage(hwnd,DLG_SCALEC_LENS_S,SPNM_SETCRNTVALUE,
01238                           (WPARAM)ilens,0);
01239        SendDlgItemMessage(hwnd,DLG_SCALEC_LENS_S,SPNM_SETEDITCTRL,0,
01240                           (LPARAM)GetDlgItem(hwnd,DLG_SCALEC_LENS));
01241        sprintf(str,"%.2lf",fov);
01242        SetDlgItemText(hwnd,DLG_SCALEC_FOV,(LPCTSTR)str);
01243        SendDlgItemMessage(hwnd,DLG_SCALEC_FOV,EM_LIMITTEXT,(WPARAM)12,0);
01244        sprintf(str,"%.2lf",ar);
01245        SetDlgItemText(hwnd,DLG_SCALEC_AR,(LPCTSTR)str);
01246        SendDlgItemMessage(hwnd,DLG_SCALEC_AR,EM_LIMITTEXT,(WPARAM)12,0);
01247        SetDlgItemInt(hwnd,DLG_SCALEC_FROM,sp->firstframe,FALSE);
01248        SetDlgItemInt(hwnd,DLG_SCALEC_TO,  sp->lastframe,FALSE);
01249        if(sp->last != NULL)l_limit=sp->last->lastframe+1;
01250        else l_limit=1;
01251        if(sp->next != NULL)u_limit=sp->next->firstframe-1;
01252        else u_limit=Nframes;
01253        SendDlgItemMessage(hwnd,DLG_SCALEC_FROM_S,SPNM_SETRANGE,0,
01254                           MAKELPARAM(l_limit,u_limit));
01255        SendDlgItemMessage(hwnd,DLG_SCALEC_FROM_S,SPNM_SETCRNTVALUE,
01256                           (WPARAM)sp->firstframe,0);
01257        SendDlgItemMessage(hwnd,DLG_SCALEC_FROM_S,SPNM_SETEDITCTRL,0,
01258                           (LPARAM)GetDlgItem(hwnd,DLG_SCALEC_FROM));
01259        SendDlgItemMessage(hwnd,DLG_SCALEC_TO_S,SPNM_SETRANGE,0,
01260                           MAKELPARAM(l_limit,u_limit));
01261        SendDlgItemMessage(hwnd,DLG_SCALEC_TO_S,SPNM_SETCRNTVALUE,
01262                           (WPARAM)sp->lastframe,0);
01263        SendDlgItemMessage(hwnd,DLG_SCALEC_TO_S,SPNM_SETEDITCTRL,0,
01264                           (LPARAM)GetDlgItem(hwnd,DLG_SCALEC_TO));
01265        if(ss->d == 0){
01266          EnableWindow(GetDlgItem(hwnd,DLG_SCALEC_DELETE),FALSE);
01267        }
01268        CentreDialogOnScreen(hwnd);
01269      }
01270      return (TRUE);
01271    case WM_COMMAND:
01272 //      sp=(size *)GetWindowLong(hwnd,GWL_USERDATA);
01273      switch(HIWORD(wparam)){
01274        case CBN_SELENDOK:
01275          if(LOWORD(wparam) == DLG_SCALEC_PRESET){
01276            SendDlgItemMessage(hwnd,DLG_SCALEC_PRESET,WM_GETTEXT,
01277              (WPARAM)12,(LPARAM)str);
01278            for(i=0;i<5;i++)if(strcmp(str,cameralenslist[i]) == 0)break;
01279            ilens=cameralens[i];
01280            SetDlgItemInt(hwnd,DLG_SCALEC_LENS,ilens,FALSE);
01281            SendDlgItemMessage(hwnd,DLG_SCALEC_LENS_S,SPNM_SETCRNTVALUE,
01282                           (WPARAM)ilens,0);
01283            fov=180/PI*2*atan2(21.22,(double)ilens);
01284            sprintf(str,"%.2lf",fov);
01285            SetDlgItemText(hwnd,DLG_SCALEC_FOV,(LPCTSTR)str);
01286          }
01287          break;
01288        default: break;
01289       }
01290       switch(LOWORD(wparam)){
01291         case DLG_SCALEC_DELETE:
01292           EndDialog(hwnd,2);
01293           return(TRUE);
01294         case IDCANCEL:
01295         case DLG_SCALEC_CANCEL:
01296           EndDialog(hwnd,FAIL);
01297           return(TRUE);
01298         case IDOK:
01299         case DLG_SCALEC_OK:
01300 
01301           GetDlgItemText(hwnd,DLG_SCALEC_STEREO_SEP,str,10);  
01302           sp->camera_params.stereo_separation=atof(str);
01303           GetDlgItemText(hwnd,DLG_SCALEC_PARALLAX_DIST,str,10);  
01304           sp->camera_params.parallax_distance=atof(str);
01305 
01306           GetDlgItemText(hwnd,DLG_SCALEC_FOCAL_LENGTH,str,10);  
01307           sp->camera_params.focal_length=atof(str);
01308           GetDlgItemText(hwnd,DLG_SCALEC_F_NUMBER,str,10);  
01309           sp->camera_params.f_number=atof(str);
01310           GetDlgItemText(hwnd,DLG_SCALEC_F_FOCUS_DISTANCE,str,10);  
01311           sp->camera_params.focus_distance=atof(str)*ruler;
01312           SendDlgItemMessage(hwnd,DLG_SCALEC_POLARISATION,WM_GETTEXT,(WPARAM)31,(LPARAM)str);
01313           for(i=0;i<Nplist;i++){ 
01314             if(strcmp(str,plist[i]) == 0){
01315               sp->camera_params.polar_type=(double)i;
01316               break;
01317             }
01318           }
01319           range=SendDlgItemMessage(hwnd,DLG_SCALEC_FROM_S,SPNM_GETRANGE,0,0);
01320           i=GetDlgItemInt(hwnd,DLG_SCALEC_FROM,&err,FALSE);
01321           if(!err || i < LOWORD(range) || i > HIWORD(range))goto CANCELX;
01322           if(err)sp->firstframe=(short)i;
01323           range=SendDlgItemMessage(hwnd,DLG_SCALEC_TO_S,SPNM_GETRANGE,0,0);
01324           i=GetDlgItemInt(hwnd,DLG_SCALEC_TO,&err,FALSE);
01325           if(!err || i < LOWORD(range) || i > HIWORD(range))goto CANCELX;
01326           if(err)sp->lastframe=(short)i;
01327           ilens=GetDlgItemInt(hwnd,DLG_SCALEC_LENS,&err,FALSE);
01328           if(!err)goto CANCELX;
01329           if(GetDlgItemText(hwnd,DLG_SCALEC_AR,str,10) == 0)goto CANCELX;
01330           if((ar=atof(str)) == 0.0)goto CANCELX;
01331           if(ilens == 50)sp->Sx=1.0;
01332           else           sp->Sx=(double)ilens/50.0;
01333           sp->Sy = sp->Sx * ar;
01334           sp->Sz = sp->Sx;
01335           EndDialog(hwnd,OK);
01336           return(TRUE);
01337           CANCELX:
01338           EndDialog(hwnd,FAIL);
01339           return TRUE;
01340         default:
01341           break;
01342       }
01343       break;
01344     default: break;
01345  }
01346  return(FALSE);
01347 }
01348 
01349 short EditCameraSize(double *sx, double *sy, double *sz, size *xp, int d){
01350  int i;
01351  size Size;
01352  SIZESTRUCT SS;
01353  HWND original;
01354  memcpy(&Size,xp,sizeof(size));
01355  SS.sp=&Size; SS.d=d;
01356  original=GetActiveWindow();
01357  EnableToolPannels(ALL_PANNELS,FALSE);
01358  if((i=DialogBoxParam(ghinst_main,MAKEINTRESOURCE(DLG_SCALEC),ghwnd_main,
01359             (DLGPROC)SizeC_DlgProc,(LPARAM)&SS)) == OK){
01360    EDIT_ACTION=YES;
01361    if(Size.lastframe >= Size.firstframe){
01362      memcpy(xp,&Size,sizeof(size));
01363      *sx=Size.Sx;
01364      *sy=Size.Sy;
01365      *sz=Size.Sz;
01366    }
01367  }
01368  EnableToolPannels(ALL_PANNELS,TRUE);
01369  if(original != NULL)SetActiveWindow(original);
01370  return (short)i;
01371 }
01372 
01373 void LensSettings(void){
01374  size *tss=NULL;
01375  position *tpp=NULL;
01376  align *taa=NULL;
01377  object *too=NULL;
01378  GetTimelinesAtFrame(SelectedNode,CurrentFrame,&too,
01379                     &tpp,&taa,&tss);
01380  if(tss != NULL)EditSize(SelectedNode,(short)tss->lastframe,
01381                                       (short)tss->lastframe);
01382  return;
01383 }
01384 
01385 BOOL CALLBACK EditObjectDlgProc(HWND hdlg,UINT msg,
01386                            WPARAM wparam,LPARAM lparam){
01387  static BOOL actor_edit_flag;
01388  static object actor;
01389  static short l_limit,u_limit;
01390  static object *op;
01391  BOOL err;
01392  char effectname[256];
01393  int i,id;
01394  short l,f;
01395  switch( msg ) {
01396    case WM_PAINT:
01397      PaintDialogBackground(hdlg,ghinst_main);
01398      break;
01399    case WM_INITDIALOG:
01400      op=(object *)lparam;
01401 //     SetWindowLong(hdlg,GWL_USERDATA,lparam);
01402      memcpy(&actor,op,sizeof(object));
01403      l_limit=(short)(op->firstframe);
01404      if(op->last != NULL)l_limit=op->last->lastframe+1;
01405      else l_limit=1;
01406      u_limit=(short)(op->lastframe);
01407      if(op->next != NULL)u_limit=op->next->firstframe-1;
01408      else u_limit=Nframes;
01409      if(op->effect != NULL){
01410        actor.effect=(char *)X__Malloc(strlen(op->effect)+1);
01411        if(actor.effect != NULL){
01412          memcpy(actor.effect,op->effect,strlen(op->effect)+1);
01413        }
01414      }
01415      actor_edit_flag=FALSE;
01416      EnableToolPannels(ALL_PANNELS,FALSE);
01417      SetDlgItemInt(hdlg,DLG_COSTUME_FROM,op->firstframe,FALSE);
01418      SetDlgItemInt(hdlg,DLG_COSTUME_TO  ,op->lastframe, FALSE);
01419      SendDlgItemMessage(hdlg,DLG_COSTUME_FROMS,SPNM_SETRANGE,0,
01420                         MAKELPARAM(l_limit,u_limit));
01421      SendDlgItemMessage(hdlg,DLG_COSTUME_FROMS,SPNM_SETCRNTVALUE,
01422                          (WPARAM)op->firstframe,0);
01423      SendDlgItemMessage(hdlg,DLG_COSTUME_FROMS,SPNM_SETEDITCTRL,0,
01424                          (LPARAM)GetDlgItem(hdlg,DLG_COSTUME_FROM));
01425      SendDlgItemMessage(hdlg,DLG_COSTUME_TOS,SPNM_SETRANGE,0,
01426                         MAKELPARAM(l_limit,u_limit));
01427      SendDlgItemMessage(hdlg,DLG_COSTUME_TOS,SPNM_SETCRNTVALUE,
01428                         (WPARAM)op->lastframe,0);
01429      SendDlgItemMessage(hdlg,DLG_COSTUME_TOS,SPNM_SETEDITCTRL,0,
01430                         (LPARAM)GetDlgItem(hdlg,DLG_COSTUME_TO));
01431      SetDlgItemText(hdlg,DLG_COSTUME_NAME,short_form(actor.name));
01432      SetDlgItemText(hdlg,DLG_COSTUME_PATH,truncate_path(actor.name,40));
01433      if(op->morph == QMORPH)
01434           SendDlgItemMessage(hdlg,DLG_COSTUME_MORPH_Q,BM_SETCHECK,TRUE,0);
01435      else if(op->morph == YES)
01436           SendDlgItemMessage(hdlg,DLG_COSTUME_MORPH_LINEAR,BM_SETCHECK,TRUE,0);
01437      else SendDlgItemMessage(hdlg,DLG_COSTUME_MORPH_NO,BM_SETCHECK,TRUE,0);
01438      if(op->bWireframe)
01439           SendDlgItemMessage(hdlg,DLG_COSTUME_WIREFRAME,BM_SETCHECK,TRUE,0);
01440      if(op->self_shadow)
01441           SendDlgItemMessage(hdlg,DLG_COSTUME_SELF_SHADOWS,BM_SETCHECK,TRUE,0);
01442      if(op->cast_shadow)
01443           SendDlgItemMessage(hdlg,DLG_COSTUME_CAST_SHADOWS,BM_SETCHECK,TRUE,0);
01444      if(op->show_shadow)
01445           SendDlgItemMessage(hdlg,DLG_COSTUME_SHOW_SHADOWS,BM_SETCHECK,TRUE,0);
01446      if(op->effect == NULL){
01447        EnableWindow(GetDlgItem(hdlg,DLG_COSTUME_EFFECT_EDIT),FALSE);
01448        SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_NAME,"No Effect in Use");
01449        SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_PATH," ");
01450      }
01451      else{
01452        SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_SET,"&Drop");
01453        sscanf(op->effect,"%s",effectname);
01454        RestoreWhiteSpaces(effectname);
01455        if(strlen(effectname) == 1){
01456          id=atoi(effectname);
01457          sprintf(effectname,"%seffects\\%s",gszHomeDir,
01458                  internal_effect_list[id-1]);
01459        }
01460        SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_NAME,short_form(effectname));
01461        SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_PATH,truncate_path(effectname,40));
01462      }
01463      CentreDialogOnCursor(hdlg);
01464      return (TRUE);
01465    case WM_DESTROY:
01466      EnableToolPannels(ALL_PANNELS,TRUE);
01467      break;
01468    case WM_COMMAND:
01469 //      op=(object *)GetWindowLong(hdlg,GWL_USERDATA);
01470       switch(LOWORD(wparam)){
01471         case DLG_COSTUME_CHANGE:
01472           if(SelectSfxFileName(0,gszSCEfile,gszSCEdir,IDX_MISC_REPLACEMENT,
01473              "(*.MFX)|*.mfx|",hdlg) == TRUE){
01474             strcpy(actor.name,gszSCEfile);
01475             actor_edit_flag=TRUE;
01476             SetDlgItemText(hdlg,DLG_COSTUME_NAME,short_form(actor.name));
01477             SetDlgItemText(hdlg,DLG_COSTUME_PATH,truncate_path(actor.name,40));
01478           }
01479           break;
01480         case DLG_COSTUME_EFFECT_SET:
01481           if(op->effect == NULL)AddEffect(op,hdlg);
01482           else{
01483             DeleteEffect(op);
01484           }
01485           if(op->effect == NULL){
01486             EnableWindow(GetDlgItem(hdlg,DLG_COSTUME_EFFECT_EDIT),FALSE);
01487             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_NAME,"No Effect in Use");
01488             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_PATH," ");
01489             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_SET,"&Set");
01490           }
01491           else{
01492             sscanf(op->effect,"%s",effectname);
01493             RestoreWhiteSpaces(effectname);
01494             if(strlen(effectname) == 1){
01495               id=atoi(effectname);
01496               sprintf(effectname,"%seffects\\%s",gszHomeDir,
01497                             internal_effect_list[id-1]);
01498             }
01499             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_SET,"&Drop");
01500             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_NAME,short_form(effectname));
01501             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_PATH,truncate_path(effectname,40));
01502             EnableWindow(GetDlgItem(hdlg,DLG_COSTUME_EFFECT_EDIT),TRUE);
01503           }
01504           break;
01505         case DLG_COSTUME_EFFECT_EDIT:
01506           if(op->effect == NULL)break;
01507           EditActorEffect(op,hdlg);
01508           if(op->effect == NULL){
01509             EnableWindow(GetDlgItem(hdlg,DLG_COSTUME_EFFECT_EDIT),FALSE);
01510             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_NAME,"No Effect in Use");
01511             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_PATH," ");
01512             SetDlgItemText(hdlg,DLG_COSTUME_EFFECT_SET,"&Set");
01513           }
01514           break;
01515         case DLG_COSTUME_MORPH_NO:
01516           actor.morph=NO;
01517           break;
01518         case DLG_COSTUME_MORPH_LINEAR:
01519           actor.morph=YES;
01520           break;
01521         case DLG_COSTUME_MORPH_Q:
01522           actor.morph=QMORPH;
01523           break;
01524         case IDCANCEL:
01525         case DLG_COSTUME_CANCEL:
01526           CANCELX:
01527           if(op->effect != NULL)DeleteEffect(op);
01528           if(actor.effect != NULL){
01529             LoadEffectLibrary(actor.effectname,op);
01530             op->effect=actor.effect;
01531           }
01532           EndDialog(hdlg,-1);
01533           return(TRUE);
01534         case IDOK:
01535         case DLG_COSTUME_OK:
01536           i=GetDlgItemInt(hdlg,DLG_COSTUME_FROM,&err,FALSE);
01537           if(!err || i < l_limit ||
01538                      i > u_limit)goto CANCELX;
01539           actor.firstframe = (short)i;
01540           i=GetDlgItemInt(hdlg,DLG_COSTUME_TO,&err,FALSE);
01541           if(!err || i < l_limit ||
01542                      i > u_limit)goto CANCELX;
01543           actor.lastframe = (short)i;
01544           if(actor.lastframe < actor.firstframe)goto CANCELX;
01545           if(actor_edit_flag){ /* change the models database etc */
01546             ReplaceObjectFile(op,actor.name);
01547           }
01548           f=actor.firstframe; l=actor.lastframe;
01549           if(actor.type == PATH && actor.v != NULL){
01550             op->v=ReTweenVelocity(&actor,actor.v,
01551                             (int)(op->lastframe-op->firstframe+1),
01552                             (int)(l-f+1),actor.pathlength,0);
01553           }
01554           op->firstframe=f; op->lastframe=l;
01555           op->morph=actor.morph;
01556           if(SendDlgItemMessage(hdlg,DLG_COSTUME_WIREFRAME,BM_GETCHECK,
01557                                 0,0))op->bWireframe=1;
01558           else                       op->bWireframe=0;
01559           if(SendDlgItemMessage(hdlg,DLG_COSTUME_SELF_SHADOWS,BM_GETCHECK,
01560                                 0,0))op->self_shadow=1;
01561           else                       op->self_shadow=0;
01562           if(SendDlgItemMessage(hdlg,DLG_COSTUME_SHOW_SHADOWS,BM_GETCHECK,
01563                                 0,0))op->show_shadow=1;
01564           else                       op->show_shadow=0;
01565           if(SendDlgItemMessage(hdlg,DLG_COSTUME_CAST_SHADOWS,BM_GETCHECK,
01566                                 0,0))op->cast_shadow=1;
01567           else                       op->cast_shadow=0;
01568           EndDialog(hdlg,-1);
01569           return(TRUE);
01570         default:  break;
01571       }
01572       break;
01573     default: break;
01574  }
01575  return(FALSE);
01576 }
01577 
01578 BOOL CALLBACK EditObjectXipDlgProc(HWND hdlg,UINT msg,
01579                            WPARAM wparam,LPARAM lparam){
01580  static char *local_xip;
01581  static short l_limit,u_limit;
01582  static object *op;
01583  char   xipfilename[256];
01584  BOOL err;
01585  int i,id;
01586  short l,f;
01587  switch( msg ) {
01588    case WM_PAINT:
01589      PaintDialogBackground(hdlg,ghinst_main);
01590      break;
01591    case WM_INITDIALOG:
01592      op=(object *)lparam;
01593      l_limit=(short)(op->firstframe);
01594      if(op->last != NULL)l_limit=op->last->lastframe+1;
01595      else l_limit=1;
01596      u_limit=(short)(op->lastframe);
01597      if(op->next != NULL)u_limit=op->next->firstframe-1;
01598      else u_limit=Nframes;
01599      EnableToolPannels(ALL_PANNELS,FALSE);
01600      SetDlgItemInt(hdlg,DLG_COSTUMEXIP_FROM,op->firstframe,FALSE);
01601      SetDlgItemInt(hdlg,DLG_COSTUMEXIP_TO  ,op->lastframe, FALSE);
01602      SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_FROMS,SPNM_SETRANGE,0,
01603                         MAKELPARAM(l_limit,u_limit));
01604      SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_FROMS,SPNM_SETCRNTVALUE,
01605                          (WPARAM)op->firstframe,0);
01606      SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_FROMS,SPNM_SETEDITCTRL,0,
01607                          (LPARAM)GetDlgItem(hdlg,DLG_COSTUME_FROM));
01608      SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_TOS,SPNM_SETRANGE,0,
01609                         MAKELPARAM(l_limit,u_limit));
01610      SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_TOS,SPNM_SETCRNTVALUE,
01611                         (WPARAM)op->lastframe,0);
01612      SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_TOS,SPNM_SETEDITCTRL,0,
01613                         (LPARAM)GetDlgItem(hdlg,DLG_COSTUME_TO));
01614      if(op->morph == YES)
01615           SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_MORPH_YES,BM_SETCHECK,TRUE,0);
01616      else SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_MORPH_NO,BM_SETCHECK,TRUE,0);
01617      if(op->xip == NULL){
01618        local_xip=NULL;
01619        SetDlgItemText(hdlg,DLG_COSTUMEXIP_NAME,"No Post Process Loaded");
01620        SetDlgItemText(hdlg,DLG_COSTUMEXIP_PATH," ");
01621      }
01622      else{
01623        local_xip=(char *)X__Malloc(strlen(op->xip)+1);
01624        if(local_xip != NULL)strcpy(local_xip,op->xip);
01625        sscanf(op->xip,"%s",xipfilename);
01626        RestoreWhiteSpaces(xipfilename);
01627        SetDlgItemText(hdlg,DLG_COSTUMEXIP_NAME,short_form(xipfilename));
01628        SetDlgItemText(hdlg,DLG_COSTUMEXIP_PATH,truncate_path(xipfilename,40));
01629      }
01630      CentreDialogOnCursor(hdlg);
01631      return (TRUE);
01632    case WM_DESTROY:
01633      EnableToolPannels(ALL_PANNELS,TRUE);
01634      break;
01635    case WM_COMMAND:
01636       switch(LOWORD(wparam)){
01637         case DLG_COSTUMEXIP_SET:{
01638             char *temp_xip;
01639             if((temp_xip=EditObjectImageProcess(hdlg,NULL)) != NULL){
01640               if(local_xip != NULL)X__Free(local_xip);
01641               local_xip=temp_xip;
01642               sscanf(local_xip,"%s",xipfilename);
01643               RestoreWhiteSpaces(xipfilename);
01644               SetDlgItemText(hdlg,DLG_COSTUMEXIP_NAME,short_form(xipfilename));
01645               SetDlgItemText(hdlg,DLG_COSTUMEXIP_PATH,truncate_path(xipfilename,40));
01646             }
01647           }
01648           break;
01649         case DLG_COSTUMEXIP_EDIT:
01650           if(local_xip != NULL){
01651             local_xip=EditObjectImageProcess(hdlg,local_xip);
01652           }
01653           break;
01654         case IDCANCEL:
01655           CANCELX:
01656           if(local_xip != NULL)X__Free(local_xip);
01657           EndDialog(hdlg,-1);
01658           return(TRUE);
01659         case DLG_COSTUMEXIP_DELETE:
01660           EndDialog(hdlg,0);
01661           return(TRUE);
01662         case DLG_COSTUMEXIP_CUTOUT:
01663           EndDialog(hdlg,3);
01664           return(TRUE);
01665         case DLG_COSTUMEXIP_COPY:
01666           EndDialog(hdlg,4);
01667           return(TRUE);
01668         case IDOK:
01669           i=GetDlgItemInt(hdlg,DLG_COSTUMEXIP_FROM,&err,FALSE);
01670           if(!err || i < l_limit ||
01671                      i > u_limit)goto CANCELX;
01672           f = (short)i;
01673           i=GetDlgItemInt(hdlg,DLG_COSTUMEXIP_TO,&err,FALSE);
01674           if(!err || i < l_limit ||
01675                      i > u_limit)goto CANCELX;
01676           l = (short)i;
01677           if(l < f)goto CANCELX;
01678           op->firstframe=f; op->lastframe=l;
01679           if(SendDlgItemMessage(hdlg,DLG_COSTUMEXIP_MORPH_YES,BM_GETCHECK,
01680                                 0,0))op->morph=YES;
01681           else op->morph=NO;
01682           if(local_xip != NULL){
01683             X__Free(op->xip);
01684             op->xip=(char *)X__Malloc(strlen(local_xip)+1);
01685             if(op->xip != NULL)strcpy(op->xip,local_xip);
01686             X__Free(local_xip);
01687           }
01688           EndDialog(hdlg,-1);
01689           return(TRUE);
01690         default:  break;
01691       }
01692       break;
01693     default: break;
01694  }
01695  return(FALSE);
01696 }
01697 
01698 static void BuildImageListTable(HWND hctl, BOOL erase){
01699  XIP  *Ip;
01700  char name[256];
01701  if(erase)SendMessage(hctl,LB_RESETCONTENT,0,0);
01702  Ip=FirstIp;
01703  while(Ip != NULL){
01704    if(Ip->p != NULL){
01705      sscanf(Ip->p,"%s",name);
01706      RestoreWhiteSpaces(name);
01707      SendMessage(hctl,LB_ADDSTRING,0,(LPARAM)name);
01708    }
01709    Ip=Ip->next;
01710  }
01711  SendMessage(hctl,LB_SETCURSEL,0,0);
01712 }
01713 
01714 BOOL CALLBACK EditXipDlgProc(HWND hdlg,UINT msg,
01715                           WPARAM wparam,LPARAM lparam){
01716  HWND hctl;
01717  XIP  *Ip;
01718  char name[256];
01719  BOOL flag;
01720  int id,i;
01721  switch( msg ) {
01722    case WM_PAINT:
01723      PaintDialogBackground(hdlg,ghinst_main);
01724      break;
01725    case WM_INITDIALOG:
01726      Ip=FirstIp;
01727      if(Ip == NULL){
01728        EnableWindow(GetDlgItem(hdlg,DLG_XIP_EDIT),FALSE);
01729        EnableWindow(GetDlgItem(hdlg,DLG_XIP_DELETE),FALSE);
01730        EnableWindow(GetDlgItem(hdlg,DLG_XIP_VECTOR),FALSE);
01731        EnableWindow(GetDlgItem(hdlg,DLG_XIP_MOVE_FIRST),FALSE);
01732        EnableWindow(GetDlgItem(hdlg,DLG_XIP_MOVE_LAST),FALSE);
01733      }
01734      else {
01735        hctl=GetDlgItem(hdlg,DLG_XIP_LIST);
01736        BuildImageListTable(hctl,FALSE);
01737      }
01738      CentreDialogOnScreen(hdlg);
01739      EnableToolPannels(ALL_PANNELS,FALSE);
01740      return (TRUE);
01741    case WM_DESTROY:
01742      EnableToolPannels(ALL_PANNELS,TRUE);
01743      break;
01744    case WM_COMMAND:
01745       switch(LOWORD(wparam)){
01746         case DLG_XIP_LIST:
01747           if(HIWORD(wparam) == LBN_SELCHANGE){
01748             ;//MessageBeep(MB_OK);
01749           }
01750           if(HIWORD(wparam) == LBN_DBLCLK){
01751             SendMessage(hdlg,WM_COMMAND,MAKEWPARAM(DLG_XIP_EDIT,0),0);
01752           }
01753           break;
01754         case DLG_XIP_MOVE_FIRST:
01755         case DLG_XIP_MOVE_LAST:
01756         case DLG_XIP_EDIT:
01757           if((id=SendDlgItemMessage(hdlg,DLG_XIP_LIST,LB_GETCURSEL,0,0))
01758              == LB_ERR || (Ip=FirstIp) == NULL)break;
01759           i=0; while(Ip != NULL){
01760             if(i == id){
01761               if(LOWORD(wparam) == DLG_XIP_MOVE_FIRST){
01762                 if(Ip != FirstIp){
01763                   if(MainIp == Ip)MainIp=Ip->last;
01764                   FirstIp->last=Ip;
01765                   Ip->last->next=Ip->next;
01766                   if(Ip->next != NULL)Ip->next->last=Ip->last;
01767                   Ip->next=FirstIp;
01768                   Ip->last=NULL;
01769                   FirstIp=Ip;
01770                   hctl=GetDlgItem(hdlg,DLG_XIP_LIST);
01771                   BuildImageListTable(hctl,TRUE);
01772                 }
01773               }
01774               else if(LOWORD(wparam) == DLG_XIP_MOVE_LAST){
01775                 XIP *LastIp;
01776                 LastIp=FirstIp;
01777                 while(LastIp->next != NULL)LastIp=LastIp->next;
01778                 if(Ip->next != NULL){
01779                   if(Ip == FirstIp)FirstIp=Ip->next;
01780                   Ip->next->last=Ip->last;
01781                   if(Ip->last != NULL)Ip->last->next=Ip->next;
01782                   Ip->next=NULL;
01783                   LastIp->next=Ip;
01784                   Ip->last=LastIp;
01785                   MainIp=Ip;
01786                   hctl=GetDlgItem(hdlg,DLG_XIP_LIST);
01787                   BuildImageListTable(hctl,TRUE);
01788                 }
01789               }
01790               else EditImageProcess(hdlg,Ip);
01791               break;
01792             }
01793             i++; Ip=Ip->next;
01794           }
01795           break;
01796         case DLG_XIP_VECTOR:{
01797             char temp[MAX_FILE],new_dir[MAX_DIR];
01798             PSTR c,cn;
01799             int j;
01800             XIP *Jp;
01801             strcpy(new_dir,gszHomeDir);strcat(new_dir,"postprocess\\");
01802             if(!RequestCharString(64,new_dir,"Post Processor Path"))break;
01803             HideWhiteSpaces(new_dir);
01804             if((j=strlen(new_dir)) < 3)break;
01805             if(new_dir[j-1] != '\\')strcat(new_dir,"\\");
01806             Jp=FirstIp;  while(Jp != NULL){
01807               sscanf(Jp->p,"%s",name);
01808               if((c=FileInPath(name)) != NULL){
01809                 strcpy(temp,c); strcpy(name,new_dir); strcat(name,temp);
01810                 c=strchr(Jp->p,' ');
01811                 j=strlen(Jp->p)+strlen(c)+2;
01812                 if((cn=(PSTR)X__Malloc(j)) != NULL){
01813                   strcpy(cn,name); strcat(cn," "); strcat(cn,c+1);
01814                   X__Free(Jp->p);
01815                   Jp->p=cn;
01816                 }
01817               }
01818               Jp=Jp->next;
01819             }
01820             hctl=GetDlgItem(hdlg,DLG_XIP_LIST);
01821             BuildImageListTable(hctl,TRUE);
01822           }
01823           break;
01824         case DLG_XIP_ADD:
01825           if(FirstIp == NULL)flag=TRUE; else flag=FALSE;
01826           if(CreateImageProcess(hdlg) != NULL){
01827             sscanf(MainIp->p,"%s",name);
01828             RestoreWhiteSpaces(name);
01829             SendDlgItemMessage(hdlg,DLG_XIP_LIST,LB_ADDSTRING,0,(LPARAM)name);
01830             if(flag){
01831               EnableWindow(GetDlgItem(hdlg,DLG_XIP_EDIT),TRUE);
01832               EnableWindow(GetDlgItem(hdlg,DLG_XIP_DELETE),TRUE);
01833               EnableWindow(GetDlgItem(hdlg,DLG_XIP_VECTOR),TRUE);
01834               EnableWindow(GetDlgItem(hdlg,DLG_XIP_MOVE_FIRST),TRUE);
01835               EnableWindow(GetDlgItem(hdlg,DLG_XIP_MOVE_LAST),TRUE);
01836               SendDlgItemMessage(hdlg,DLG_XIP_LIST,LB_SETCURSEL,0,0);
01837             }
01838           }
01839           break;
01840         case DLG_XIP_DELETE:
01841           if((id=SendDlgItemMessage(hdlg,DLG_XIP_LIST,LB_GETCURSEL,0,0))
01842              == LB_ERR || (Ip=FirstIp) == NULL)break;
01843           i=0; while(Ip != NULL){
01844             if(i == id){
01845               DeleteImageProcess(Ip);
01846               SendDlgItemMessage(hdlg,DLG_XIP_LIST,LB_DELETESTRING,(WPARAM)id,0);
01847               if(FirstIp == NULL){
01848                 EnableWindow(GetDlgItem(hdlg,DLG_XIP_EDIT),FALSE);
01849                 EnableWindow(GetDlgItem(hdlg,DLG_XIP_DELETE),FALSE);
01850                 EnableWindow(GetDlgItem(hdlg,DLG_XIP_VECTOR),FALSE);
01851                 EnableWindow(GetDlgItem(hdlg,DLG_XIP_MOVE_FIRST),FALSE);
01852                 EnableWindow(GetDlgItem(hdlg,DLG_XIP_MOVE_LAST),FALSE);
01853               }
01854               else SendDlgItemMessage(hdlg,DLG_XIP_LIST,LB_SETCURSEL,0,0);
01855               break;
01856             }
01857             i++; Ip=Ip->next;
01858           }
01859           break;
01860         case IDCANCEL:
01861           EndDialog(hdlg,-1);
01862           return(TRUE);
01863         default:  break;
01864       }
01865       break;
01866     default: break;
01867  }
01868  return(FALSE);
01869 }
01870 
01871 BOOL CALLBACK ShiftKeysDlgProc(HWND hdlg,UINT msg,
01872                            WPARAM wparam,LPARAM lparam){
01873  int n;
01874  BOOL type,err;
01875  switch( msg ) {
01876    case WM_PAINT:
01877      PaintDialogBackground(hdlg,ghinst_main);
01878      break;
01879    case WM_INITDIALOG:
01880      n=0;
01881      SetDlgItemInt(hdlg,DLG_SHIFTKEYS_NUMBER,n,FALSE);
01882      SendDlgItemMessage(hdlg,DLG_SHIFTKEYS_UP,BM_SETCHECK,TRUE,0);
01883      CentreDialogOnCursor(hdlg);
01884      return (TRUE);
01885    case WM_COMMAND:
01886       switch(LOWORD(wparam)){
01887         case IDOK:
01888           n=GetDlgItemInt(hdlg,DLG_SHIFTKEYS_NUMBER,&err,FALSE);
01889           if(SendDlgItemMessage(hdlg,DLG_SHIFTKEYS_DOWN,BM_GETCHECK,0,0))
01890             n = -n;
01891           EndDialog(hdlg,n);
01892           return(TRUE);
01893           break;
01894         case IDCANCEL:
01895           EndDialog(hdlg,0);
01896           return(TRUE);
01897           break;
01898         default:  break;
01899       }
01900       break;
01901     default: break;
01902  }
01903  return(FALSE);
01904 }
01905 
01906 #include "..\common\animate\about.h"
01907 
01908 BOOL CALLBACK AboutDlgProc(HWND hdlg,UINT msg,
01909                            WPARAM wparam,LPARAM lparam){
01910  char name[255];
01911  switch( msg ) {
01912    case WM_PAINT:
01913      PaintDialogBackground(hdlg,ghinst_main);
01914      break;
01915    case WM_INITDIALOG:
01916      CentreDialogOnScreen(hdlg);
01917 //     strcpy(name,gszHomeDir);
01918 //     strcat(name,"OPENFX.AVI");
01919      SendDlgItemMessage(hdlg,DLG_ABOUT_VERSION,WM_SETTEXT,
01920                        0,(LPARAM)ABOUT_VERSION);
01921 //     Animate_Open(GetDlgItem(hdlg,DLG_ABOUT_ANIMATE),name);
01922 //     Animate_Play(GetDlgItem(hdlg, DLG_ABOUT_ANIMATE),0, -1, -1);
01923      return TRUE;
01924    case WM_COMMAND:
01925       switch(LOWORD(wparam)){
01926         case IDCANCEL:
01927         case IDOK:
01928           EndDialog(hdlg,TRUE);
01929           return(TRUE);
01930         default:  break;
01931       }
01932       break;
01933     default: break;
01934  }
01935  return(FALSE);
01936 }
01937 
01938 static BOOL CALLBACK GeneralPreferencesDlgProc(HWND hdlg,UINT msg,
01939                            WPARAM wparam,LPARAM lparam){
01940  BOOL state,err;
01941  char *w, ss[32], yesyes[]="YES", nono[]="NO",appname[256];
01942  int i;
01943  switch( msg ) {
01944    case WM_PAINT:
01945      PaintDialogBackground(hdlg,ghinst_main);
01946      break;
01947    case WM_INITDIALOG:
01948      if(Preferences.quick_trick)state=TRUE; else state=FALSE;
01949      SendDlgItemMessage(hdlg,DLG_PREFERENCES_QUICKTRICK,BM_SETCHECK,state,0);
01950      if(Preferences.undo)state=TRUE; else state=FALSE;
01951      SendDlgItemMessage(hdlg,DLG_PREFERENCES_UNDO,BM_SETCHECK,state,0);
01952      if(Preferences.ground)state=TRUE; else state=FALSE;
01953      SendDlgItemMessage(hdlg,DLG_PREFERENCES_GROUND,BM_SETCHECK,state,0);
01954      if(Preferences.tooltips)state=TRUE; else state=FALSE;
01955      SendDlgItemMessage(hdlg,DLG_PREFERENCES_TOOLTIPS,BM_SETCHECK,state,0);
01956      if(Preferences.autocentre)state=TRUE; else state=FALSE;
01957      SendDlgItemMessage(hdlg,DLG_PREFERENCES_AUTOCENTRE,BM_SETCHECK,state,0);
01958      if(!Preferences.detail_auto)state=TRUE; else state=FALSE;
01959      SendDlgItemMessage(hdlg,DLG_PREFERENCES_AUTODETAIL,BM_SETCHECK,state,0);
01960      if(Preferences.toolsmall)state=TRUE; else state=FALSE;
01961      SendDlgItemMessage(hdlg,DLG_PREFERENCES_TOOLSMALL,BM_SETCHECK,state,0);
01962      if(Preferences.toolleft)state=TRUE; else state=FALSE;
01963      SendDlgItemMessage(hdlg,DLG_PREFERENCES_TOOLLEFT,BM_SETCHECK,state,0);
01964      if(Preferences.use_gl_robot)state=TRUE; else state=FALSE;
01965      SendDlgItemMessage(hdlg,DLG_PREFERENCES_ROBOTGL,BM_SETCHECK,state,0);
01966      SetDlgItemInt(hdlg,DLG_PREFERENCES_STEPDETAIL,
01967                    Preferences.detail_step,FALSE);
01968      SendDlgItemMessage(hdlg,DLG_PREFERENCES_STEPDETAILS,SPNM_SETRANGE,0,
01969                         MAKELPARAM(1,1000));
01970      SendDlgItemMessage(hdlg,DLG_PREFERENCES_STEPDETAILS,SPNM_SETCRNTVALUE,
01971                         (WPARAM)Preferences.detail_step,0);
01972      SendDlgItemMessage(hdlg,DLG_PREFERENCES_STEPDETAILS,SPNM_SETEDITCTRL,0,
01973                         (LPARAM)GetDlgItem(hdlg,DLG_PREFERENCES_STEPDETAIL));
01974 
01975      GetPrivateProfileString(IniSection,"EDITAPP","$$$",
01976                              appname,sizeof(appname),IniFilename);
01977      if(strncmp(appname,"$$$",3) != 0){
01978        SetDlgItemText(hdlg,DLG_PREFERENCES_EDITAPP,(LPCSTR)appname);
01979      }
01980      return (TRUE);
01981    case WM_COMMAND:
01982      switch(LOWORD(wparam)){
01983        default: break;
01984        case DLG_PREFERENCES_EDITAPPSET:{
01985          char appdir[256];
01986          if(GetDlgItemText(hdlg,DLG_PREFERENCES_EDITAPP,appname,255) == 0){
01987            strcpy(appname,"*.exe");
01988          }
01989          strcpy(appdir,appname);
01990          if(SelectFileName(0,appname,appdir," ",
01991                            "(*.EXE)|*.exe|",ghwnd_main)
01992                            == TRUE){
01993            SetDlgItemText(hdlg,DLG_PREFERENCES_EDITAPP,(LPCSTR)appname);
01994          }
01995        }
01996        break;
01997      }
01998      break;
01999    case WM_NOTIFY:
02000      switch(((LPNMHDR)lparam)->code){
02001        case PSN_APPLY:
02002          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_QUICKTRICK,BM_GETCHECK,0,0))
02003             Preferences.quick_trick=TRUE; else Preferences.quick_trick=FALSE;
02004          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_UNDO,BM_GETCHECK,0,0))
02005             Preferences.undo=TRUE; else Preferences.undo=FALSE;
02006          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_GROUND,BM_GETCHECK,0,0))
02007             Preferences.ground=TRUE; else Preferences.ground=FALSE;
02008          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_TOOLTIPS,BM_GETCHECK,0,0))
02009             Preferences.tooltips=TRUE; else Preferences.tooltips=FALSE;
02010          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_AUTOCENTRE,BM_GETCHECK,0,0))
02011             Preferences.autocentre=TRUE; else Preferences.autocentre=FALSE;
02012          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_TOOLSMALL,BM_GETCHECK,0,0))
02013             Preferences.toolsmall=TRUE; else Preferences.toolsmall=FALSE;
02014          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_TOOLLEFT,BM_GETCHECK,0,0))
02015             Preferences.toolleft=TRUE; else Preferences.toolleft=FALSE;
02016          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_AUTODETAIL,BM_GETCHECK,0,0))
02017             Preferences.detail_auto=FALSE; else Preferences.detail_auto=TRUE;
02018          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_ROBOTGL,BM_GETCHECK,0,0))
02019             Preferences.use_gl_robot=TRUE; else Preferences.use_gl_robot=FALSE;
02020          i=GetDlgItemInt(hdlg,DLG_PREFERENCES_STEPDETAIL,&err,FALSE);
02021          if(err && i > 0 && i < 1000)Preferences.detail_step=i;
02022          if(GetDlgItemText(hdlg,DLG_PREFERENCES_EDITAPP,appname,255) != 0)
02023            WritePrivateProfileString(IniSection,"EDITAPP",appname,IniFilename);
02024          else
02025            WritePrivateProfileString(IniSection,"EDITAPP",NULL,IniFilename);
02026          if(Preferences.quick_trick)w=yesyes; else w=nono;
02027          WritePrivateProfileString(IniSection,"QUICKTRICK",w,IniFilename);
02028          if(Preferences.undo)w=yesyes; else w=nono;
02029          WritePrivateProfileString(IniSection,"UNDO",w,IniFilename);
02030          if(Preferences.undo)UNDO_ACTIVE=YES; else UNDO_ACTIVE=NO;
02031          if(Preferences.ground)w=yesyes; else w=nono;
02032          WritePrivateProfileString(IniSection,"GROUND",w,IniFilename);
02033          if(Preferences.tooltips)w=yesyes; else w=nono;
02034          WritePrivateProfileString(IniSection,"TOOLTIPS",w,IniFilename);
02035          if(Preferences.autocentre)w=yesyes; else w=nono;
02036          WritePrivateProfileString(IniSection,"AUTOCENTRE",w,IniFilename);
02037          if(Preferences.toolsmall)w=yesyes; else w=nono;
02038          WritePrivateProfileString(IniSection,"TOOLSMALL",w,IniFilename);
02039          if(Preferences.toolleft)w=yesyes; else w=nono;
02040          WritePrivateProfileString(IniSection,"TOOLLEFT",w,IniFilename);
02041          if(Preferences.detail_auto)w=yesyes; else w=nono;
02042          WritePrivateProfileString(IniSection,"DETAILAUTO",w,IniFilename);
02043          sprintf(ss,"%ld",Preferences.detail_step);
02044          WritePrivateProfileString(IniSection,"DETAILSTEP",ss,
02045                                    IniFilename);
02046          if(Preferences.use_gl_robot)w=yesyes; else w=nono;
02047          WritePrivateProfileString(IniSection,"GLROBOT",w,IniFilename);
02048          break;
02049        default:  break;
02050      }
02051      break;
02052    default: break;
02053  }
02054  return(FALSE);
02055 }
02056 
02057 static BOOL CALLBACK StartupPreferencesDlgProc(HWND hdlg,UINT msg,
02058                            WPARAM wparam,LPARAM lparam){
02059  BOOL state,err;
02060  char str[32];
02061  char *w, yesyes[]="YES", nono[]="NO";
02062  switch( msg ) {
02063    case WM_PAINT:
02064      PaintDialogBackground(hdlg,ghinst_main);
02065      break;
02066    case WM_INITDIALOG:
02067      if(Preferences.buttons)state=TRUE; else state=FALSE;
02068      SendDlgItemMessage(hdlg,DLG_PREFERENCES_BUTTONS,BM_SETCHECK,state,0);
02069 //     if(Preferences.show_select)state=TRUE; else state=FALSE;
02070 //     SendDlgItemMessage(hdlg,DLG_PREFERENCES_SELECT,BM_SETCHECK,state,0);
02071      if(Preferences.default_start)state=TRUE; else state=FALSE;
02072      SendDlgItemMessage(hdlg,DLG_PREFERENCES_STARTUP,BM_SETCHECK,state,0);
02073      if(Preferences.use_positions)state=TRUE; else state=FALSE;
02074      SendDlgItemMessage(hdlg,DLG_PREFERENCES_POSITIONS,BM_SETCHECK,state,0);
02075      if(Preferences.background)state=TRUE; else state=FALSE;
02076      SendDlgItemMessage(hdlg,DLG_PREFERENCES_BACKGROUND,BM_SETCHECK,state,0);
02077      SetDlgItemInt(hdlg,DLG_PREFERENCES_SPLASH,Preferences.splash,FALSE);
02078      return (TRUE);
02079    case WM_NOTIFY:
02080      switch(((LPNMHDR)lparam)->code){
02081        case PSN_APPLY:
02082          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_BUTTONS,BM_GETCHECK,0,0))
02083             Preferences.buttons=TRUE; else Preferences.buttons=FALSE;
02084 //         if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_SELECT,BM_GETCHECK,0,0))
02085 //            Preferences.show_select=TRUE; else Preferences.show_select=FALSE;
02086          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_STARTUP,BM_GETCHECK,0,0))
02087             Preferences.default_start=TRUE; else Preferences.default_start=FALSE;
02088          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_POSITIONS,BM_GETCHECK,0,0))
02089             Preferences.use_positions=TRUE; else Preferences.use_positions=FALSE;
02090          Preferences.splash=GetDlgItemInt(hdlg,DLG_PREFERENCES_SPLASH,&err,FALSE);
02091          if(Preferences.buttons)w=yesyes; else w=nono;
02092          if(SendDlgItemMessage(hdlg,DLG_PREFERENCES_BACKGROUND,BM_GETCHECK,0,0))
02093             Preferences.background=TRUE; else Preferences.background=FALSE;
02094          WritePrivateProfileString(IniSection,"BUTTONS",w,IniFilename);
02095          if(Preferences.show_select)w=yesyes; else w=nono;
02096          WritePrivateProfileString(IniSection,"SELECTPANNEL",w,IniFilename);
02097          if(Preferences.default_start)w=yesyes; else w=nono;
02098          WritePrivateProfileString(IniSection,"DEFAULTSTART",w,IniFilename);
02099          if(Preferences.use_positions)w=yesyes; else w=nono;
02100          WritePrivateProfileString(IniSection,"POSITIONS",w,IniFilename);
02101          if(Preferences.background)w=yesyes; else w=nono;
02102          WritePrivateProfileString(IniSection,"BACKIMAGE",w,IniFilename);
02103          sprintf(str,"%ld",Preferences.splash);
02104          WritePrivateProfileString(IniSection,"SPLASH",str,IniFilename);
02105          break;
02106        default:  break;
02107      }
02108      break;
02109    default: break;
02110  }
02111  return(FALSE);
02112 }
02113 
02114 static BOOL CALLBACK ModelPathPreferencesDlgProc(HWND hdlg,UINT msg,
02115                            WPARAM wparam,LPARAM lparam){
02116  char txt[256],none[64];
02117  char tempstr[256],tempdir[256];
02118  static HBITMAP CrossButtonBitmap=NULL;
02119  static HBITMAP FolderButtonBitmap=NULL;
02120  switch( msg ) {
02121    case WM_PAINT:
02122      PaintDialogBackground(hdlg,ghinst_main);
02123      break;
02124    case WM_INITDIALOG:
02125      LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02126      GetPrivateProfileString(IniRenderSection,"MODEL-PATH1",none,
02127                              txt,255,IniFilename);
02128      SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH1,txt);
02129      GetPrivateProfileString(IniRenderSection,"MODEL-PATH2",none,
02130                              txt,255,IniFilename);
02131      SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH2,txt);
02132      GetPrivateProfileString(IniRenderSection,"MODEL-PATH3",none,
02133                              txt,255,IniFilename);
02134      SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH3,txt);
02135      GetPrivateProfileString(IniRenderSection,"MODEL-PATH4",none,
02136                              txt,255,IniFilename);
02137      SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH4,txt);
02138      CrossButtonBitmap=LoadBitmap(ghinst_main,MAKEINTRESOURCE(IDBM_CROSS));
02139      FolderButtonBitmap=(HBITMAP)LoadImage(ghinst_main,"FOLDERS",IMAGE_ICON,
02140                                0,0,LR_DEFAULTCOLOR); // ICON
02141 
02142      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH1_D),BM_SETIMAGE,
02143                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02144      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH2_D),BM_SETIMAGE,
02145                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02146      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH3_D),BM_SETIMAGE,
02147                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02148      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH4_D),BM_SETIMAGE,
02149                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02150 
02151      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH1_B),BM_SETIMAGE,
02152                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02153      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH2_B),BM_SETIMAGE,
02154                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02155      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH3_B),BM_SETIMAGE,
02156                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02157      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODPATH4_B),BM_SETIMAGE,
02158                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02159 
02160      return (TRUE);
02161    case WM_DESTROY:
02162      if(CrossButtonBitmap != NULL)DeleteObject(CrossButtonBitmap);
02163      break;
02164    case WM_COMMAND:
02165      switch(LOWORD(wparam)){
02166        case DLG_PREFERENCES_MODPATH1_B:
02167          strcpy(tempstr,"temp.scr");
02168          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH1,tempdir,255);
02169          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02170          if(SelectDirectoryName(tempstr,tempdir,txt,
02171            "(*.SCR)|*.scr|",hdlg) == TRUE){
02172            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02173            SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH1,tempdir);
02174          }
02175          break;
02176        case DLG_PREFERENCES_MODPATH1_D:
02177          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02178          SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH1,none);
02179          break;
02180        case DLG_PREFERENCES_MODPATH2_B:
02181          strcpy(tempstr,"temp.scr");
02182          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH2,tempdir,255);
02183          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02184          if(SelectDirectoryName(tempstr,tempdir,txt,
02185            "(*.SCR)|*.scr|",hdlg) == TRUE){
02186            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02187            SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH2,tempdir);
02188          }
02189          break;
02190        case DLG_PREFERENCES_MODPATH2_D:
02191          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02192          SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH2,none);
02193          break;
02194        case DLG_PREFERENCES_MODPATH3_B:
02195          strcpy(tempstr,"temp.scr");
02196          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH3,tempdir,255);
02197          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02198          if(SelectDirectoryName(tempstr,tempdir,txt,
02199            "(*.SCR)|*.scr|",hdlg) == TRUE){
02200            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02201            SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH3,tempdir);
02202          }
02203          break;
02204        case DLG_PREFERENCES_MODPATH3_D:
02205          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02206          SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH3,none);
02207          break;
02208        case DLG_PREFERENCES_MODPATH4_B:
02209          strcpy(tempstr,"temp.scr");
02210          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH4,tempdir,255);
02211          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02212          if(SelectDirectoryName(tempstr,tempdir,txt,
02213            "(*.SCR)|*.scr|",hdlg) == TRUE){
02214            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02215            SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH4,tempdir);
02216          }
02217          break;
02218        case DLG_PREFERENCES_MODPATH4_D:
02219          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02220          SetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH4,none);
02221          break;
02222        default: break;
02223      }
02224      break;
02225    case WM_NOTIFY:
02226      switch(((LPNMHDR)lparam)->code){
02227        case PSN_APPLY:
02228          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH1,tempdir,255);
02229          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02230          if(!strcmp(tempdir,none))
02231               WritePrivateProfileString(IniRenderSection,"MODEL-PATH1",
02232                                         NULL,IniFilename);
02233          else WritePrivateProfileString(IniRenderSection,"MODEL-PATH1",
02234                                         tempdir,IniFilename);
02235          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH2,tempdir,255);
02236          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02237          if(!strcmp(tempdir,none))
02238               WritePrivateProfileString(IniRenderSection,"MODEL-PATH2",
02239                                         NULL,IniFilename);
02240          else WritePrivateProfileString(IniRenderSection,"MODEL-PATH2",
02241                                         tempdir,IniFilename);
02242          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH3,tempdir,255);
02243          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02244          if(!strcmp(tempdir,none))
02245               WritePrivateProfileString(IniRenderSection,"MODEL-PATH3",
02246                                         NULL,IniFilename);
02247          else WritePrivateProfileString(IniRenderSection,"MODEL-PATH3",
02248                                         tempdir,IniFilename);
02249          GetDlgItemText(hdlg,DLG_PREFERENCES_MODPATH4,tempdir,255);
02250          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02251          if(!strcmp(tempdir,none))
02252               WritePrivateProfileString(IniRenderSection,"MODEL-PATH4",
02253                                         NULL,IniFilename);
02254          else WritePrivateProfileString(IniRenderSection,"MODEL-PATH4",
02255                                         tempdir,IniFilename);
02256          break;
02257        default: break;
02258      }
02259      break;
02260    default: break;
02261  }
02262  return(FALSE);
02263 }
02264 
02265 static BOOL CALLBACK MapPathPreferencesDlgProc(HWND hdlg,UINT msg,
02266                            WPARAM wparam,LPARAM lparam){
02267  char txt[256],none[64];
02268  char tempstr[256],tempdir[256];
02269  static HBITMAP CrossButtonBitmap=NULL;
02270  static HBITMAP FolderButtonBitmap=NULL;
02271  switch( msg ) {
02272    case WM_PAINT:
02273      PaintDialogBackground(hdlg,ghinst_main);
02274      break;
02275    case WM_INITDIALOG:
02276      LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02277      GetPrivateProfileString(IniRenderSection,"MAP-PATH1",none,
02278                              txt,255,IniFilename);
02279      SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH1,txt);
02280      GetPrivateProfileString(IniRenderSection,"MAP-PATH2",none,
02281                              txt,255,IniFilename);
02282      SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH2,txt);
02283      GetPrivateProfileString(IniRenderSection,"MAP-PATH3",none,
02284                              txt,255,IniFilename);
02285      SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH3,txt);
02286      GetPrivateProfileString(IniRenderSection,"MAP-PATH4",none,
02287                              txt,255,IniFilename);
02288      SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH4,txt);
02289      CrossButtonBitmap=LoadBitmap(ghinst_main,MAKEINTRESOURCE(IDBM_CROSS));
02290      FolderButtonBitmap=(HBITMAP)LoadImage(ghinst_main,"FOLDERS",IMAGE_ICON,
02291                                0,0,LR_DEFAULTCOLOR); // ICON
02292 
02293      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH1_D),BM_SETIMAGE,
02294                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02295      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH2_D),BM_SETIMAGE,
02296                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02297      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH3_D),BM_SETIMAGE,
02298                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02299      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH4_D),BM_SETIMAGE,
02300                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02301 
02302      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH1_B),BM_SETIMAGE,
02303                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02304      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH2_B),BM_SETIMAGE,
02305                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02306      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH3_B),BM_SETIMAGE,
02307                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02308      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MAPPATH4_B),BM_SETIMAGE,
02309                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02310 
02311      return (TRUE);
02312    case WM_DESTROY:
02313      if(CrossButtonBitmap != NULL)DeleteObject(CrossButtonBitmap);
02314      break;
02315    case WM_COMMAND:
02316      switch(LOWORD(wparam)){
02317        case DLG_PREFERENCES_MAPPATH1_B:
02318          strcpy(tempstr,"temp.scr");
02319          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH1,tempdir,255);
02320          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02321          if(SelectDirectoryName(tempstr,tempdir,txt,
02322            "(*.SCR)|*.scr|",hdlg) == TRUE){
02323            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02324            SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH1,tempdir);
02325          }
02326          break;
02327        case DLG_PREFERENCES_MAPPATH1_D:
02328          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02329          SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH1,none);
02330          break;
02331        case DLG_PREFERENCES_MAPPATH2_B:
02332          strcpy(tempstr,"temp.scr");
02333          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH2,tempdir,255);
02334          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02335          if(SelectDirectoryName(tempstr,tempdir,txt,
02336            "(*.SCR)|*.scr|",hdlg) == TRUE){
02337            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02338            SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH2,tempdir);
02339          }
02340          break;
02341        case DLG_PREFERENCES_MAPPATH2_D:
02342          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02343          SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH2,none);
02344          break;
02345        case DLG_PREFERENCES_MAPPATH3_B:
02346          strcpy(tempstr,"temp.scr");
02347          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH3,tempdir,255);
02348          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02349          if(SelectDirectoryName(tempstr,tempdir,txt,
02350            "(*.SCR)|*.scr|",hdlg) == TRUE){
02351            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02352            SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH3,tempdir);
02353          }
02354          break;
02355        case DLG_PREFERENCES_MAPPATH3_D:
02356          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02357          SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH3,none);
02358          break;
02359        case DLG_PREFERENCES_MAPPATH4_B:
02360          strcpy(tempstr,"temp.scr");
02361          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH4,tempdir,255);
02362          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02363          if(SelectDirectoryName(tempstr,tempdir,txt,
02364            "(*.SCR)|*.scr|",hdlg) == TRUE){
02365            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02366            SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH4,tempdir);
02367          }
02368          break;
02369        case DLG_PREFERENCES_MAPPATH4_D:
02370          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02371          SetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH4,none);
02372          break;
02373        default: break;
02374      }
02375      break;
02376    case WM_NOTIFY:
02377      switch(((LPNMHDR)lparam)->code){
02378        case PSN_APPLY:
02379          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH1,tempdir,255);
02380          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02381          if(!strcmp(tempdir,none))
02382               WritePrivateProfileString(IniRenderSection,"MAP-PATH1",
02383                                         NULL,IniFilename);
02384          else WritePrivateProfileString(IniRenderSection,"MAP-PATH1",
02385                                         tempdir,IniFilename);
02386          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH2,tempdir,255);
02387          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02388          if(!strcmp(tempdir,none))
02389               WritePrivateProfileString(IniRenderSection,"MAP-PATH2",
02390                                         NULL,IniFilename);
02391          else WritePrivateProfileString(IniRenderSection,"MAP-PATH2",
02392                                         tempdir,IniFilename);
02393          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH3,tempdir,255);
02394          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02395          if(!strcmp(tempdir,none))
02396               WritePrivateProfileString(IniRenderSection,"MAP-PATH3",
02397                                         NULL,IniFilename);
02398          else WritePrivateProfileString(IniRenderSection,"MAP-PATH3",
02399                                         tempdir,IniFilename);
02400          GetDlgItemText(hdlg,DLG_PREFERENCES_MAPPATH4,tempdir,255);
02401          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02402          if(!strcmp(tempdir,none))
02403               WritePrivateProfileString(IniRenderSection,"MAP-PATH4",
02404                                         NULL,IniFilename);
02405          else WritePrivateProfileString(IniRenderSection,"MAP-PATH4",
02406                                         tempdir,IniFilename);
02407          break;
02408        default: break;
02409      }
02410      break;
02411    default: break;
02412  }
02413  return(FALSE);
02414 }
02415 
02416 static BOOL CALLBACK ModelRootPreferencesDlgProc(HWND hdlg,UINT msg,
02417                            WPARAM wparam,LPARAM lparam){
02418  char txt[256],none[64];
02419  char tempstr[256],tempdir[256];
02420  static HBITMAP CrossButtonBitmap=NULL;
02421  static HBITMAP FolderButtonBitmap=NULL;
02422  switch( msg ) {
02423    case WM_PAINT:
02424      PaintDialogBackground(hdlg,ghinst_main);
02425      break;
02426    case WM_INITDIALOG:
02427      LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02428      GetPrivateProfileString(IniRenderSection,"MODEL-ROOT",none,
02429                              txt,255,IniFilename);
02430      SetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT,txt);
02431      GetPrivateProfileString(IniRenderSection,"MODEL-ROOT1",none,
02432                              txt,255,IniFilename);
02433      SetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT1,txt);
02434      CrossButtonBitmap=LoadBitmap(ghinst_main,MAKEINTRESOURCE(IDBM_CROSS));
02435      FolderButtonBitmap=(HBITMAP)LoadImage(ghinst_main,"FOLDERS",IMAGE_ICON,
02436                                0,0,LR_DEFAULTCOLOR); // ICON
02437 
02438      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODROOT_D),BM_SETIMAGE,
02439                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02440      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODROOT1_D),BM_SETIMAGE,
02441                  (WPARAM)0,(LPARAM)CrossButtonBitmap);
02442 
02443      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODROOT_B),BM_SETIMAGE,
02444                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02445      SendMessage(GetDlgItem(hdlg,DLG_PREFERENCES_MODROOT1_B),BM_SETIMAGE,
02446                  (WPARAM)IMAGE_ICON,(LPARAM)FolderButtonBitmap);
02447 
02448      return (TRUE);
02449    case WM_DESTROY:
02450      if(CrossButtonBitmap != NULL)DeleteObject(CrossButtonBitmap);
02451      break;
02452    case WM_COMMAND:
02453      switch(LOWORD(wparam)){
02454        case DLG_PREFERENCES_MODROOT_B:
02455          strcpy(tempstr,"temp.scr");
02456          GetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT,tempdir,255);
02457          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02458          if(SelectDirectoryName(tempstr,tempdir,txt,
02459            "(*.SCR)|*.scr|",hdlg) == TRUE){
02460            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02461            SetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT,tempdir);
02462          }
02463          break;
02464        case DLG_PREFERENCES_MODROOT_D:
02465          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02466          SetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT,none);
02467          break;
02468        case DLG_PREFERENCES_MODROOT1_B:
02469          strcpy(tempstr,"temp.scr");
02470          GetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT1,tempdir,255);
02471          LoadString(ghinst_main,IDX_MISC_CHOOSEPATH,txt,255);
02472          if(SelectDirectoryName(tempstr,tempdir,txt,
02473            "(*.SCR)|*.scr|",hdlg) == TRUE){
02474            if(strlen(tempdir) == 2)strcat(tempdir,"\\");
02475            SetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT1,tempdir);
02476          }
02477          break;
02478        case DLG_PREFERENCES_MODROOT1_D:
02479          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02480          SetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT1,none);
02481          break;
02482      }
02483      break;
02484    case WM_NOTIFY:
02485      switch(((LPNMHDR)lparam)->code){
02486        case PSN_APPLY:
02487          GetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT,tempdir,255);
02488          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02489          if(!strcmp(tempdir,none))
02490               WritePrivateProfileString(IniRenderSection,"MODEL-ROOT",
02491                                         NULL,IniFilename);
02492          else WritePrivateProfileString(IniRenderSection,"MODEL-ROOT",
02493                                         tempdir,IniFilename);
02494          GetDlgItemText(hdlg,DLG_PREFERENCES_MODROOT1,tempdir,255);
02495          LoadString(ghinst_main,IDX_MISC_NONE,none,63);
02496          if(!strcmp(tempdir,none))
02497               WritePrivateProfileString(IniRenderSection,"MODEL-ROOT1",
02498                                         NULL,IniFilename);
02499          else WritePrivateProfileString(IniRenderSection,"MODEL-ROOT1",
02500                                         tempdir,IniFilename);
02501          break;
02502        default: break;
02503      }
02504      break;
02505    default: break;
02506  }
02507  return(FALSE);
02508 }
02509 
02510 
02511 void PreferencesPropertyDlgProc(HWND hwndOwner){
02512  char title[256];
02513  int i;
02514  PROPSHEETPAGE psp[5];
02515  PROPSHEETHEADER psh;
02516  HWND hWndP;
02517  for(i=0;i<5;i++){
02518    psp[i].dwSize = sizeof(PROPSHEETPAGE);
02519    psp[i].dwFlags = PSP_DEFAULT;
02520    psp[i].hInstance = ghinst_main;
02521    psp[i].pszIcon = NULL;
02522    psp[i].lParam = 0;
02523  }
02524  psp[0].pszTemplate = MAKEINTRESOURCE(DLG_PREFERENCES_GENERAL);
02525  psp[0].pfnDlgProc = GeneralPreferencesDlgProc;
02526  psp[1].pszTemplate = MAKEINTRESOURCE(DLG_PREFERENCES_START);
02527  psp[1].pfnDlgProc = StartupPreferencesDlgProc;
02528  psp[2].pszTemplate = MAKEINTRESOURCE(DLG_PREFERENCES_MODPATH);
02529  psp[2].pfnDlgProc = ModelPathPreferencesDlgProc;
02530  psp[3].pszTemplate = MAKEINTRESOURCE(DLG_PREFERENCES_MAPPATH);
02531  psp[3].pfnDlgProc = MapPathPreferencesDlgProc;
02532  psp[4].pszTemplate = MAKEINTRESOURCE(DLG_PREFERENCES_ROOTPATH);
02533  psp[4].pfnDlgProc = ModelRootPreferencesDlgProc;
02534 
02535  psh.dwSize = sizeof(PROPSHEETHEADER);
02536  psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
02537  psh.hwndParent = hwndOwner;
02538  psh.hInstance = ghinst_main;
02539  psh.nStartPage = 0;
02540  psh.pszIcon = NULL;
02541  LoadString(ghinst_main,IDX_MISC_PREF_TITLE,title,255);
02542  psh.pszCaption = (LPSTR)title;
02543  psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
02544  psh.ppsp = (LPCPROPSHEETPAGE) &psp;
02545  PropertySheet(&psh);
02546  return;
02547 }
02548 
02549 static BOOL CALLBACK TrackerToolDlgProc(HWND hdlg,UINT msg,
02550                            WPARAM wparam,LPARAM lparam){
02551  switch( msg ) {
02552    case WM_PAINT:
02553      PaintDialogBackground(hdlg,ghinst_main);
02554      break;
02555    case WM_INITDIALOG:
02556      if(gToolFlags.flagT == 0)
02557        SendDlgItemMessage(hdlg,DLG_TRACK_MOVE,BM_SETCHECK,TRUE,0);
02558      if(gToolFlags.flagT == 1)
02559        SendDlgItemMessage(hdlg,DLG_TRACK_TIMESHIFT,BM_SETCHECK,TRUE,0);
02560      if(gToolFlags.flagT == 2)
02561        SendDlgItemMessage(hdlg,DLG_TRACK_DELETE,BM_SETCHECK,TRUE,0);
02562      if(gToolFlags.flagT == 3)
02563        SendDlgItemMessage(hdlg,DLG_TRACK_TENSION,BM_SETCHECK,TRUE,0);
02564      return (TRUE);
02565    case WM_DESTROY:
02566      break;
02567    case WM_COMMAND:
02568       switch(LOWORD(wparam)){
02569         case DLG_TRACK_MOVE:      gToolFlags.flagT=0; break;
02570         case DLG_TRACK_TIMESHIFT: gToolFlags.flagT=1; break;
02571         case DLG_TRACK_DELETE:    gToolFlags.flagT=2; break;
02572         case DLG_TRACK_TENSION:   gToolFlags.flagT=3; break;
02573         default: break;
02574       }
02575       break;
02576     default: break;
02577  }
02578  return(FALSE);
02579 }
02580 
02581 static BOOL CALLBACK DirectorToolDlgProc(HWND hdlg,UINT msg,
02582                            WPARAM wparam,LPARAM lparam){
02583  BOOL err;
02584  switch( msg ) {
02585    case WM_PAINT:
02586      PaintDialogBackground(hdlg,ghinst_main);
02587      break;
02588    case WM_INITDIALOG:
02589      if(gToolFlags.flagR == 0)
02590        SendDlgItemMessage(hdlg,DLG_DIRECT_MOVE,BM_SETCHECK,TRUE,0);
02591      if(gToolFlags.flagR == 1)
02592        SendDlgItemMessage(hdlg,DLG_DIRECT_TIMESHIFT,BM_SETCHECK,TRUE,0);
02593      if(gToolFlags.flagR == 2)
02594        SendDlgItemMessage(hdlg,DLG_DIRECT_DELETE,BM_SETCHECK,TRUE,0);
02595      if(gToolFlags.flagR == 3)
02596        SendDlgItemMessage(hdlg,DLG_DIRECT_TENSION,BM_SETCHECK,TRUE,0);
02597      if(gToolFlags.flagA == 0)
02598        SendDlgItemMessage(hdlg,DLG_ROTATOR_X,BM_SETCHECK,TRUE,0);
02599      else if(gToolFlags.flagA == 1)
02600        SendDlgItemMessage(hdlg,DLG_ROTATOR_Y,BM_SETCHECK,TRUE,0);
02601      else if(gToolFlags.flagA == 2)
02602        SendDlgItemMessage(hdlg,DLG_ROTATOR_Z,BM_SETCHECK,TRUE,0);
02603      if(gToolFlags.flagR == 0)err=TRUE; else err=FALSE;
02604      EnableWindow(GetDlgItem(hdlg,DLG_ROTATOR_X),err);
02605      EnableWindow(GetDlgItem(hdlg,DLG_ROTATOR_Y),err);
02606      EnableWindow(GetDlgItem(hdlg,DLG_ROTATOR_Z),err);
02607      return (TRUE);
02608    case WM_DESTROY:
02609      break;
02610    case WM_COMMAND:
02611       switch(LOWORD(wparam)){
02612         case DLG_ROTATOR_X:        gToolFlags.flagA=0; break;
02613         case DLG_ROTATOR_Y:        gToolFlags.flagA=1; break;
02614         case DLG_ROTATOR_Z:        gToolFlags.flagA=2; break;
02615         case DLG_DIRECT_MOVE:      gToolFlags.flagR=0; goto SETFLAGS;
02616         case DLG_DIRECT_TIMESHIFT: gToolFlags.flagR=1; goto SETFLAGS;
02617         case DLG_DIRECT_DELETE:    gToolFlags.flagR=2; goto SETFLAGS;
02618         case DLG_DIRECT_TENSION:   gToolFlags.flagR=3;
02619         SETFLAGS:
02620           if(gToolFlags.flagR == 0)err=TRUE; else err=FALSE;
02621           EnableWindow(GetDlgItem(hdlg,DLG_ROTATOR_X),err);
02622           EnableWindow(GetDlgItem(hdlg,DLG_ROTATOR_Y),err);
02623           EnableWindow(GetDlgItem(hdlg,DLG_ROTATOR_Z),err);
02624           break;
02625         default:  break;
02626       }
02627       break;
02628     default: break;
02629  }
02630  return(FALSE);
02631 }
02632 
02633 BOOL CALLBACK SplineTweenDlgProc(HWND hdlg, UINT msg, WPARAM wparam,
02634                                      LPARAM lparam ){
02635  // resource must contain at least one control or DLG3D is bad //
02636  static int xpos= -1,ypos= -1;
02637  RECT rc;
02638  switch( msg ){
02639    case WM_INITDIALOG:{
02640        TC_ITEM tie;
02641        int h;
02642        DWORD dwDlgBase=GetDialogBaseUnits();
02643        if(xpos == -1 && ypos == -1){
02644          RECT rc1;
02645          GetWindowRect(hdlg,&rc1);
02646          GetWindowRect(ghwndTools,&rc);
02647          if(bToolpannelLeft)xpos=rc.right+5;
02648          else               xpos=rc.left-(rc1.right-rc1.left)-5;
02649          ypos=rc.top;
02650        }
02651        SetWindowPos(hdlg,HWND_TOP,xpos,ypos,0,0,SWP_NOSIZE);
02652        lpDlgHdr=&DlgHdr;
02653        GetClientRect(hdlg,&rc);
02654        h=rc.bottom-rc.top;
02655        hwndTab=CreateWindow(WC_TABCONTROL," ",
02656                             WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
02657                             (D_BORDER*LOWORD(dwDlgBase))/4,
02658                             (D_BORDER*HIWORD(dwDlgBase))/8,
02659                             rc.right-(2*D_BORDER*LOWORD(dwDlgBase))/4,
02660                             h-(2*D_BORDER*HIWORD(dwDlgBase))/8,
02661                             hdlg,NULL,ghinst_main,NULL);
02662        LoadString(ghinst_main,IDX_MISC_LANGUAGE,res_str,256);
02663        if(strcmp(res_str,"ENGLISH") == 0)
02664          SendMessage(hwndTab,WM_SETFONT, /* for text in tab */
02665                     (WPARAM)GetStockObject(ANSI_VAR_FONT),0);
02666        memset(&tie,0,sizeof(TC_ITEM));
02667        tie.mask = TCIF_TEXT | TCIF_IMAGE;
02668        tie.iImage = -1;
02669        tie.pszText="Track";
02670        TabCtrl_InsertItem(hwndTab,0,&tie);
02671        tie.pszText="Direction";
02672        TabCtrl_InsertItem(hwndTab,1,&tie);
02673        SetRectEmpty(&rc);
02674        TabCtrl_AdjustRect(hwndTab,FALSE,&rc);
02675        rc.left += (D_BORDER*LOWORD(dwDlgBase))/4;
02676        rc.top += (D_BORDER*HIWORD(dwDlgBase))/8;
02677        CopyRect(&(lpDlgHdr->rcTab),&rc);
02678        lpDlgHdr->hwndDlg1=NULL;
02679        lpDlgHdr->hwndDlg2=NULL;
02680        lpDlgHdr->hwndDlg3=NULL;
02681        lpDlgHdr->hwndDlg4=NULL;
02682        lpDlgHdr->hwndDlg5=NULL;
02683        lpDlgHdr->hwndDlg6=NULL;
02684        lpDlgHdr->hwndDlg1=CreateDialog(ghinst_main,
02685                                     MAKEINTRESOURCE(DLG_TRACK),
02686                                    hdlg,(DLGPROC)TrackerToolDlgProc);
02687        SetWindowPos(lpDlgHdr->hwndDlg1,NULL,
02688                     lpDlgHdr->rcTab.left,lpDlgHdr->rcTab.top,0,0,
02689                     SWP_NOSIZE | SWP_NOZORDER);
02690        ShowWindow(lpDlgHdr->hwndDlg1,SW_SHOW);
02691      }
02692      return TRUE;
02693    case WM_NOTIFY:
02694      if( ((LPNMHDR)lparam)->code == TCN_SELCHANGING){
02695        int id=TabCtrl_GetCurSel(hwndTab);
02696        if(id == 0 || id == 1)SwitchTrackerType();
02697     }
02698      if( ((LPNMHDR)lparam)->code == TCN_SELCHANGE){
02699        int id=TabCtrl_GetCurSel(hwndTab);
02700        if(lpDlgHdr->hwndDlg1 != NULL){
02701          DestroyWindow(lpDlgHdr->hwndDlg1);
02702          lpDlgHdr->hwndDlg1=NULL;
02703        }
02704        if(lpDlgHdr->hwndDlg2 != NULL){
02705          DestroyWindow(lpDlgHdr->hwndDlg2);
02706          lpDlgHdr->hwndDlg2=NULL;
02707        }
02708        if(id == 0){
02709          lpDlgHdr->hwndDlg1=CreateDialog(ghinst_main,
02710                                      MAKEINTRESOURCE(DLG_TRACK),
02711                                      hdlg,(DLGPROC)TrackerToolDlgProc);
02712          SetWindowPos(lpDlgHdr->hwndDlg1,NULL,
02713                       lpDlgHdr->rcTab.left,lpDlgHdr->rcTab.top,0,0,
02714                       SWP_NOSIZE | SWP_NOZORDER);
02715          ShowWindow(lpDlgHdr->hwndDlg1,SW_SHOW);
02716        }
02717        else if(id == 1){
02718          lpDlgHdr->hwndDlg2=CreateDialog(ghinst_main,
02719                                      MAKEINTRESOURCE(DLG_DIRECT),
02720                                      hdlg,(DLGPROC)DirectorToolDlgProc);
02721          SetWindowPos(lpDlgHdr->hwndDlg2,NULL,
02722                       lpDlgHdr->rcTab.left,lpDlgHdr->rcTab.top,0,0,
02723                       SWP_NOSIZE | SWP_NOZORDER);
02724          ShowWindow(lpDlgHdr->hwndDlg2,SW_SHOW);
02725        }
02726      }
02727      break;
02728    case WM_SYSCOMMAND:
02729      switch(LOWORD(wparam & 0xfff0)){
02730        default:
02731          break;
02732        case SC_CLOSE:
02733          PostMessage(ghwnd_main,WM_COMMAND,IDM_STOP_TOOL,0);
02734          break;
02735      }
02736      break;
02737    case WM_COMMAND:
02738      switch( LOWORD(wparam) ){
02739        default:
02740          break;
02741      }
02742      break;
02743    case WM_NCHITTEST:
02744      if(current_message >= 0){
02745        current_message = -1;
02746        SendPrgmMessage(IDS_ZERO,1);
02747      }
02748      break;
02749    case WM_DESTROY:
02750      if(lpDlgHdr->hwndDlg1 != NULL)DestroyWindow(lpDlgHdr->hwndDlg1);
02751      lpDlgHdr->hwndDlg1=NULL;
02752      if(lpDlgHdr->hwndDlg2 != NULL)DestroyWindow(lpDlgHdr->hwndDlg2);
02753      lpDlgHdr->hwndDlg2=NULL;
02754      GetWindowRect(hdlg,&rc);
02755      xpos=rc.left; ypos=rc.top;
02756      break;
02757    default: break;
02758  }
02759  return( FALSE );
02760 }
02761 
02762 static void DisplayImageFile(char *pathname){
02763  WritePrivateProfileString("VIEWER","MAPFILE",pathname,IniFilename);
02764  LoadViewer(2);
02765  return;
02766 }
02767 
02768 static void EditImageFile(char *pathname){
02769  char appname[256];
02770  GetPrivateProfileString(IniSection,"EDITAPP","$$$",
02771                          appname,sizeof(appname),IniFilename);
02772  if(strncmp(appname,"$$$",3) != 0){
02773    ShellExecute(ghwnd_main,NULL,appname,
02774                 pathname,appname,SW_SHOW);
02775  }
02776  return;
02777 }
02778 
02779 BOOL CALLBACK PathToolDlgProc(HWND hdlg,UINT msg,
02780                            WPARAM wparam,LPARAM lparam){
02781  HWND hctl;
02782  BOOL err;
02783  RECT rc;
02784  static int xpos=-1,ypos=-1;
02785  switch( msg ) {
02786    case WM_INITDIALOG:
02787      if(gToolFlags.flagP == 0)
02788        SendDlgItemMessage(hdlg,DLG_PATHTOOL_MOVE,BM_SETCHECK,TRUE,0);
02789      else if(gToolFlags.flagP == 1)
02790        SendDlgItemMessage(hdlg,DLG_PATHTOOL_ADD,BM_SETCHECK,TRUE,0);
02791      else if(gToolFlags.flagP == 2)
02792        SendDlgItemMessage(hdlg,DLG_PATHTOOL_DELETE,BM_SETCHECK,TRUE,0);
02793      else if(gToolFlags.flagP == 3)
02794        SendDlgItemMessage(hdlg,DLG_PATHTOOL_TENSION,BM_SETCHECK,TRUE,0);
02795      if(xpos == -1 && ypos == -1){
02796        RECT rc1;
02797        GetWindowRect(hdlg,&rc1);
02798        GetWindowRect(ghwndTools,&rc);
02799        if(bToolpannelLeft)xpos=rc.right+5;
02800        else               xpos=rc.left-(rc1.right-rc1.left)-5;
02801        ypos=rc.top;
02802      }
02803      SetWindowPos(hdlg,HWND_TOP,xpos,ypos,0,0,SWP_NOSIZE);
02804      return (TRUE);
02805    case WM_DESTROY:
02806      GetWindowRect(hdlg,&rc);
02807      xpos=rc.left; ypos=rc.top;
02808      break;
02809    case WM_NCHITTEST:
02810      if(current_message >= 0){
02811        current_message = -1;
02812        SendPrgmMessage(IDS_ZERO,1);
02813      }
02814      break;
02815    case WM_SYSCOMMAND:
02816      switch(LOWORD(wparam & 0xfff0)){
02817        default:
02818          break;
02819        case SC_CLOSE:
02820          PostMessage(ghwnd_main,WM_COMMAND,IDM_STOP_TOOL,0);
02821          break;
02822      }
02823      break;
02824    case WM_PAINT:
02825      PaintDialogBackground(hdlg,ghinst_main);
02826      break;
02827    case WM_COMMAND:
02828      switch(LOWORD(wparam)){
02829        case IDCANCEL:
02830          PostMessage(ghwnd_main,WM_COMMAND,IDM_STOP_TOOL,0);
02831          break;
02832        case DLG_PATHTOOL_MOVE:    gToolFlags.flagP=0; goto DRAWIT;
02833        case DLG_PATHTOOL_ADD:     gToolFlags.flagP=1; goto DRAWIT;
02834        case DLG_PATHTOOL_DELETE:  gToolFlags.flagP=2; goto DRAWIT;
02835        case DLG_PATHTOOL_TENSION: gToolFlags.flagP=3;
02836        DRAWIT:
02837        DrawInvertNode(ghdc_triview_Bitmap,SelectedNode,EDITING);
02838        SelectedPathPoint=NULL;
02839        DrawInvertNode(ghdc_triview_Bitmap,SelectedNode,EDITING);
02840        default:   break;
02841      }
02842      break;
02843    default: break;
02844  }
02845  return(FALSE);
02846 }
02847 
02848 BOOL CALLBACK RotatorToolDlgProc(HWND hdlg,UINT msg,
02849                            WPARAM wparam,LPARAM lparam){
02850  HWND hctl;
02851  BOOL err;
02852  RECT rc;
02853  static int xpos=-1,ypos=-1;
02854  switch( msg ) {
02855    case WM_INITDIALOG:
02856      if(gToolFlags.flagA == 0)
02857        SendDlgItemMessage(hdlg,DLG_ROTATOR_X,BM_SETCHECK,TRUE,0);
02858      else if(gToolFlags.flagA == 1)
02859        SendDlgItemMessage(hdlg,DLG_ROTATOR_Y,BM_SETCHECK,TRUE,0);
02860      else if(gToolFlags.flagA == 2)
02861        SendDlgItemMessage(hdlg,DLG_ROTATOR_Z,BM_SETCHECK,TRUE,0);
02862      if(xpos == -1 && ypos == -1){
02863        RECT rc1;
02864        GetWindowRect(hdlg,&rc1);
02865        GetWindowRect(ghwndTools,&rc);
02866        if(bToolpannelLeft)xpos=rc.right+5;
02867        else               xpos=rc.left-(rc1.right-rc1.left)-5;
02868        ypos=rc.top;
02869      }
02870 //     SetClassLong(hdlg,GCL_HICON,(LONG)LoadIcon(ghinst_main,"ANIMATORICON"));
02871      SetWindowPos(hdlg,HWND_TOP,xpos,ypos,0,0,SWP_NOSIZE);
02872      return (TRUE);
02873    case WM_DESTROY:
02874      GetWindowRect(hdlg,&rc);
02875      xpos=rc.left; ypos=rc.top;
02876      break;
02877    case WM_NCHITTEST:
02878      if(current_message >= 0){
02879        current_message = -1;
02880        SendPrgmMessage(IDS_ZERO,1);
02881      }
02882      break;
02883    case WM_PAINT:
02884      PaintDialogBackground(hdlg,ghinst_main);
02885      break;
02886    case WM_SYSCOMMAND:
02887      switch(LOWORD(wparam & 0xfff0)){
02888        default:
02889          break;
02890        case SC_CLOSE:
02891          PostMessage(ghwnd_main,WM_COMMAND,IDM_STOP_TOOL,0);
02892          break;
02893      }
02894      break;
02895    case WM_COMMAND:
02896      switch(LOWORD(wparam)){
02897        case IDCANCEL:
02898          PostMessage(ghwnd_main,WM_COMMAND,IDM_STOP_TOOL,0);
02899        break;
02900        case DLG_ROTATOR_X: gToolFlags.flagA=0; break;
02901        case DLG_ROTATOR_Y: gToolFlags.flagA=1; break;
02902        case DLG_ROTATOR_Z: gToolFlags.flagA=2; break;
02903        default:             break;
02904      }
02905      break;
02906    default: break;
02907  }
02908  return(FALSE);
02909 }
02910 
02911 BOOL CALLBACK SizerToolDlgProc(HWND hdlg,UINT msg,
02912                            WPARAM wparam,LPARAM lparam){
02913  HWND hctl;
02914  BOOL err;
02915  RECT rc;
02916  static int xpos= -1,ypos= -1;
02917  switch( msg ) {
02918    case WM_INITDIALOG:
02919      SendDlgItemMessage(hdlg,DLG_SIZER_X,BM_SETCHECK,gToolFlags.flagX,0);
02920      SendDlgItemMessage(hdlg,DLG_SIZER_Y,BM_SETCHECK,gToolFlags.flagY,0);
02921      SendDlgItemMessage(hdlg,DLG_SIZER_Z,BM_SETCHECK,gToolFlags.flagZ,0);
02922      if(xpos == -1 && ypos == -1){
02923        RECT rc1;
02924        GetWindowRect(hdlg,&rc1);
02925        GetWindowRect(ghwndTools,&rc);
02926        if(bToolpannelLeft)xpos=rc.right+5;
02927        else               xpos=rc.left-(rc1.right-rc1.left)-5;
02928        ypos=rc.top;
02929      }
02930      SetWindowPos(hdlg,HWND_TOP,xpos,ypos,0,0,SWP_NOSIZE);
02931      return (TRUE);
02932    case WM_DESTROY:
02933      GetWindowRect(hdlg,&rc);
02934      xpos=rc.left; ypos=rc.top;
02935      break;
02936    case WM_NCHITTEST:
02937      if(current_message >= 0){
02938        current_message = -1;
02939        SendPrgmMessage(IDS_ZERO,1);
02940      }
02941      break;
02942    case WM_PAINT:
02943      PaintDialogBackground(hdlg,ghinst_main);
02944      break;
02945    case WM_SYSCOMMAND:
02946      switch(LOWORD(wparam & 0xfff0)){
02947        default:
02948          break;
02949        case SC_CLOSE:
02950          PostMessage(ghwnd_main,WM_COMMAND,IDM_STOP_TOOL,0);
02951          break;
02952      }
02953      break;
02954    case WM_COMMAND:
02955       switch(LOWORD(wparam)){
02956         case IDCANCEL:
02957           PostMessage(ghwnd_main,WM_COMMAND,IDM_STOP_TOOL,0);
02958         break;
02959         case DLG_SIZER_X: gToolFlags.flagX = !gToolFlags.flagX; break;
02960         case DLG_SIZER_Y: gToolFlags.flagY = !gToolFlags.flagY; break;
02961         case DLG_SIZER_Z: gToolFlags.flagZ = !gToolFlags.flagZ; break;
02962         default:
02963           break;
02964       }
02965       break;
02966     default: break;
02967  }
02968  return(FALSE);
02969 }
02970 
02971 #define BITMAPX 36
02972 #define BITMAPY 20
02973 
02974 BOOL CALLBACK SelectActorDlgProc(HWND hDlg,UINT msg,
02975                            WPARAM wparam,LPARAM lparam){
02976  static node *np;
02977  static HBITMAP hbmpPicture,hbmpOld;
02978  static HBITMAP hbmpImages[N_OBJECTTYPELIST];
02979  HWND hListBox;
02980  TEXTMETRIC tm;
02981  int i,y,nItem;
02982  int tc;
02983  node *nnp;
02984  HDC hdcMem;
02985  LPMEASUREITEMSTRUCT lpmis;
02986  LPDRAWITEMSTRUCT lpdis;
02987  RECT rcBitmap;
02988  TCHAR tchBuf[MAX_PATH];
02989  switch( msg ) {
02990    case WM_INITDIALOG:
02991      np=(node *)lparam;
02992 //     SetWindowLong(hDlg,GWL_USERDATA,lparam);
02993      for(i=0;i<N_OBJECTTYPELIST;i++){
02994        hbmpImages[i]=LoadBitmap(ghinst_main,
02995          MAKEINTRESOURCE(ObjectBitmapIdList[i]));
02996      }
02997      hListBox=GetDlgItem(hDlg,DLG_ADDACTOR_LISTBOX);
02998      for(i=0;i<N_OBJECTTYPELIST;i++){
02999        nItem=SendMessage(hListBox,LB_ADDSTRING,0,(LPARAM)ObjectTypeList[i]);
03000        SendMessage(hListBox,LB_SETITEMDATA,nItem,(LPARAM)hbmpImages[i]);
03001      }
03002      SetFocus(hListBox);
03003      SendMessage(hListBox,LB_SETCURSEL,0,0);
03004      tc=1;
03005      nnp=FirstNp; while(nnp != NULL){
03006        if(nnp->type == ObjectTypeListOrder[0])tc++;
03007        nnp=nnp->next;
03008      }
03009      sprintf(tchBuf,"%s%d",ObjectTypeList[0],tc);
03010      SetDlgItemText(hDlg,DLG_ADDACTOR_NAME,(LPCSTR)tchBuf);
03011      SendDlgItemMessage(hDlg,DLG_ADDACTOR_NAME,CB_LIMITTEXT,10,0);
03012      CentreDialogOnCursor(hDlg);
03013      return TRUE;
03014    case WM_MEASUREITEM:
03015      lpmis=(LPMEASUREITEMSTRUCT)lparam;
03016      lpmis->itemHeight=BITMAPY+2;  // use bigger number for extra spacing
03017      return TRUE;
03018    case WM_DRAWITEM:
03019      lpdis=(LPDRAWITEMSTRUCT)lparam;
03020      if(lpdis->itemID == -1)break;
03021      switch(lpdis->itemAction){
03022        case ODA_SELECT:
03023        case ODA_DRAWENTIRE:
03024          hbmpPicture=(HBITMAP)SendMessage(lpdis->hwndItem,LB_GETITEMDATA,
03025           lpdis->itemID,(LPARAM)0);
03026          hdcMem=CreateCompatibleDC(lpdis->hDC);
03027          hbmpOld=SelectObject(hdcMem,hbmpPicture);
03028          BitBlt(lpdis->hDC,lpdis->rcItem.left,lpdis->rcItem.top,
03029                 lpdis->rcItem.right-lpdis->rcItem.left,
03030                 lpdis->rcItem.bottom-lpdis->rcItem.top,
03031                 hdcMem,0,0,SRCCOPY);
03032          SendMessage(lpdis->hwndItem,LB_GETTEXT,lpdis->itemID,(LPARAM)tchBuf);
03033          GetTextMetrics(lpdis->hDC,&tm);
03034          y=(lpdis->rcItem.bottom+lpdis->rcItem.top-tm.tmHeight)/2;
03035          TextOut(lpdis->hDC,BITMAPX+6,y,tchBuf,strlen(tchBuf));
03036          SelectObject(hdcMem,hbmpOld);
03037          DeleteDC(hdcMem);
03038          if(lpdis->itemState & ODS_SELECTED){
03039            rcBitmap.left=lpdis->rcItem.left;
03040            rcBitmap.top=lpdis->rcItem.top;
03041            rcBitmap.right=lpdis->rcItem.left+BITMAPX;
03042            rcBitmap.bottom=lpdis->rcItem.top+BITMAPY;
03043            InvertRect(lpdis->hDC,&rcBitmap);
03044          }
03045          break;
03046        case ODA_FOCUS:
03047          break;
03048      }
03049      return TRUE;
03050    case WM_PAINT:
03051      PaintDialogBackground(hDlg,ghinst_main);
03052      break;
03053    case WM_COMMAND:
03054      switch(LOWORD(wparam)){
03055        case DLG_ADDACTOR_LISTBOX:
03056          switch(HIWORD(wparam)){
03057            case LBN_DBLCLK:
03058              SendMessage(hDlg,WM_COMMAND,MAKEWPARAM(DLG_ADDACTOR_OK,0),0);
03059              break;
03060            case LBN_SELCHANGE:
03061              i=SendDlgItemMessage(hDlg,DLG_ADDACTOR_LISTBOX,LB_GETCURSEL,0,0);
03062              if(i == GROUND || i == 7 || i == 11) // Sky + director
03063                sprintf(tchBuf,"%s",ObjectTypeList[i]);
03064              else{
03065                tc=1;
03066                nnp=FirstNp; while(nnp != NULL){
03067                  if(nnp->type == ObjectTypeListOrder[i])tc++;
03068                  nnp=nnp->next;
03069                }
03070                sprintf(tchBuf,"%s%d",ObjectTypeList[i],tc);
03071              }
03072              SetDlgItemText(hDlg,DLG_ADDACTOR_NAME,(LPCSTR)tchBuf);
03073              break;
03074            default:
03075              break;
03076          }
03077          break;
03078        case IDOK:
03079        case DLG_ADDACTOR_OK:
03080          i=SendDlgItemMessage(hDlg,DLG_ADDACTOR_LISTBOX,LB_GETCURSEL,0,0);
03081 //         np=(node *)GetWindowLong(hDlg,GWL_USERDATA);
03082 #if __LITE__
03083          if(i == 5 || i == 8 || i == 10 ){
03084            MessageBox(NULL,"This object type is not available","Warning",MB_OK);
03085            break;
03086          }
03087 #endif
03088          if(GetDlgItemText(hDlg,DLG_ADDACTOR_NAME,(LPSTR)tchBuf,10) == 0){
03089             EndDialog(hDlg,FAIL);
03090             return(TRUE);
03091          }
03092          if(ActorNameExists(hDlg,np,tchBuf))break;
03093          strcpy(np->actorname,tchBuf);
03094          EndDialog(hDlg,i);
03095          return(TRUE);
03096        case IDCANCEL:
03097        case DLG_ADDACTOR_CANCEL:
03098          EndDialog(hDlg,FAIL);
03099          return(TRUE);
03100        default:
03101          break;
03102      }
03103      break;
03104    case WM_DESTROY:
03105      for(i=0;i<N_OBJECTTYPELIST;i++)DeleteObject(hbmpImages[i]);
03106      return TRUE;
03107    default: break;
03108  }
03109  return(FALSE);
03110 }
03111 
03112 static void UpdateframesDlgProc(HWND hdlg, int lframe, int *action){
03113  BOOL status;
03114  if(*action < 0)*action=0;
03115  if(lframe == Nframes){
03116    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_EXTEND),FALSE);
03117    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_BLANKS),FALSE);
03118    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_SCALE),FALSE);
03119    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_CHOP),FALSE);
03120    *action= -1;
03121  }
03122  else if(lframe > Nframes){
03123    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_EXTEND),TRUE);
03124    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_BLANKS),TRUE);
03125    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_SCALE),TRUE);
03126    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_CHOP),FALSE);
03127    if(*action == 3)*action=0;
03128  }
03129  else if(lframe < Nframes){
03130    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_EXTEND),FALSE);
03131    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_BLANKS),FALSE);
03132    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_SCALE),TRUE);
03133    EnableWindow(GetDlgItem(hdlg,DLG_SETFRAMES_CHOP),TRUE);
03134    if(*action == 0 || *action == 1)*action=3;
03135  }
03136  if(*action == 0)status=TRUE; else status=FALSE;
03137  SendDlgItemMessage(hdlg,DLG_SETFRAMES_EXTEND,BM_SETCHECK,(WPARAM)status,0);
03138  if(*action == 1)status=TRUE; else status=FALSE;
03139  SendDlgItemMessage(hdlg,DLG_SETFRAMES_BLANKS,BM_SETCHECK,(WPARAM)status,0);
03140  if(*action == 2)status=TRUE; else status=FALSE;
03141  SendDlgItemMessage(hdlg,DLG_SETFRAMES_SCALE,BM_SETCHECK,(WPARAM)status,0);
03142  if(*action == 3)status=TRUE; else status=FALSE;
03143  SendDlgItemMessage(hdlg,DLG_SETFRAMES_CHOP,BM_SETCHECK,(WPARAM)status,0);
03144  return;
03145 }
03146 
03147 BOOL CALLBACK SetFramesDlgProc(HWND hdlg,UINT msg,
03148                            WPARAM wparam,LPARAM lparam){
03149  BOOL err;
03150  RECT rc;
03151  char str[16];
03152  static int xpos= -1,ypos= -1,action,lframe;
03153  static BOOL inuse=FALSE;
03154  int *i,k;
03155  switch( msg ) {
03156    case WM_INITDIALOG:{
03157        char colist0[]={"              "};
03158        char colist1[]={"              "};
03159        char colist2[]={"              "};
03160        LoadString(ghinst_main,IDX_MISC_FFNTSC,colist0,256);
03161        LoadString(ghinst_main,IDX_MISC_FFPAL,colist1,256);
03162        LoadString(ghinst_main,IDX_MISC_FFFPS,colist2,256);
03163        SetWindowLong(hdlg,GWL_USERDATA,lparam);
03164        SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_RESETCONTENT,0,0);
03165        SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_ADDSTRING,
03166                             0,(LPARAM)colist0);
03167        SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_ADDSTRING,
03168                             0,(LPARAM)colist1);
03169        SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_ADDSTRING,
03170                             0,(LPARAM)colist2);
03171        if     (FramesPerSec == 30)
03172          SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_SELECTSTRING,
03173                             0,(LPARAM)colist0);
03174        else if(FramesPerSec == 25)
03175          SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_SELECTSTRING,
03176                             0,(LPARAM)colist1);
03177        else if(FramesPerSec == 15)
03178          SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_SELECTSTRING,
03179                             0,(LPARAM)colist2);
03180        SetDlgItemInt(hdlg,DLG_SETFRAMES_EDIT,Nframes,FALSE);
03181        SendDlgItemMessage(hdlg,DLG_SETFRAMES_SPIN,SPNM_SETRANGE,0,
03182                            MAKELPARAM(1,10000));
03183        SendDlgItemMessage(hdlg,DLG_SETFRAMES_SPIN,SPNM_SETCRNTVALUE,
03184                           (WPARAM)Nframes,0);
03185        SendDlgItemMessage(hdlg,DLG_SETFRAMES_SPIN,SPNM_SETEDITCTRL,0,
03186                           (LPARAM)GetDlgItem(hdlg,DLG_SETFRAMES_EDIT));
03187        sprintf(str,"%.2lf",(double)Nframes/(double)FramesPerSec);
03188        inuse=TRUE;
03189        SetDlgItemText(hdlg,DLG_SETFRAMES_TIME,str);
03190        inuse=FALSE;
03191        action= -1; lframe=Nframes;
03192        UpdateframesDlgProc(hdlg,lframe,&action);
03193        if(xpos == -1 && ypos == -1)CentreDialogOnCursor(hdlg);
03194        else SetWindowPos(hdlg,HWND_TOP,xpos,ypos,0,0,SWP_NOSIZE);
03195      }
03196      return (TRUE);
03197    case WM_DESTROY:
03198      GetWindowRect(hdlg,&rc);
03199      xpos=rc.left; ypos=rc.top;
03200      break;
03201    case WM_PAINT:
03202      PaintDialogBackground(hdlg,ghinst_main);
03203      break;
03204    case WM_COMMAND:
03205      switch( HIWORD(wparam) ){
03206        case CBN_SELENDOK:
03207          if(LOWORD(wparam) == DLG_SETFRAMES_TYPE){
03208            k=SendDlgItemMessage(hdlg,DLG_SETFRAMES_TYPE,CB_GETCURSEL,0,0);
03209            if(k == 0)FramesPerSec=30;
03210            if(k == 1)FramesPerSec=25;
03211            if(k == 2)FramesPerSec=15;
03212            sprintf(str,"%.2lf",(double)lframe/(double)FramesPerSec);
03213            inuse=TRUE;
03214            SetDlgItemText(hdlg,DLG_SETFRAMES_TIME,str);
03215            inuse=FALSE;
03216          }
03217          break;
03218        default:
03219          break;
03220      }
03221      switch(LOWORD(wparam)){
03222        case DLG_SETFRAMES_EDIT:
03223          if(HIWORD(wparam) == EN_UPDATE && !inuse){
03224            lframe=GetDlgItemInt(hdlg,DLG_SETFRAMES_EDIT,&err,FALSE);
03225            if(err && lframe > 0){
03226              UpdateframesDlgProc(hdlg,lframe,&action);
03227              sprintf(str,"%.2lf",(double)lframe/(double)FramesPerSec);
03228              inuse=TRUE;
03229              SetDlgItemText(hdlg,DLG_SETFRAMES_TIME,str);
03230              inuse=FALSE;
03231            }
03232            else MessageBeep(MB_OK);
03233            break;
03234          }
03235          break;
03236        case DLG_SETFRAMES_TIME:
03237          if(HIWORD(wparam) == EN_UPDATE && !inuse){
03238            GetDlgItemText(hdlg,DLG_SETFRAMES_TIME,str,15);
03239            lframe=(long)(atof(str)*(double)FramesPerSec);
03240            if(lframe > 0){
03241              UpdateframesDlgProc(hdlg,lframe,&action);
03242              inuse=TRUE;
03243              SetDlgItemInt(hdlg,DLG_SETFRAMES_EDIT,lframe,FALSE);
03244              SendDlgItemMessage(hdlg,DLG_SETFRAMES_SPIN,SPNM_SETCRNTVALUE,
03245                           (WPARAM)lframe,0);
03246              inuse=FALSE;
03247            }
03248            else MessageBeep(MB_OK);
03249            break;
03250          }
03251          break;
03252        case DLG_SETFRAMES_EXTEND: action=0; break;
03253        case DLG_SETFRAMES_BLANKS: action=1; break;
03254        case DLG_SETFRAMES_SCALE:  action=2; break;
03255        case DLG_SETFRAMES_CHOP:   action=3; break;
03256        case IDOK:
03257        case DLG_SETFRAMES_OK:
03258          i=(int *)GetWindowLong(hdlg,GWL_USERDATA);
03259          if(action < 0) *i=0;
03260          else if(action == 0 || action == 3) *i=0;
03261          else if(action == 1) *i=2;
03262          else if(action == 2) *i=1;
03263          EndDialog(hdlg,lframe);
03264          return(TRUE);
03265        case IDCANCEL:
03266        case DLG_SETFRAMES_CANCEL:
03267          EndDialog(hdlg,-1);
03268          return(TRUE);
03269        default:  break;
03270      }
03271      break;
03272    default: break;
03273  }
03274  return(FALSE);
03275 }
03276 
03277 BOOL CALLBACK InsertFramesDlgProc(HWND hdlg,UINT msg,
03278                            WPARAM wparam,LPARAM lparam){
03279  BOOL err;
03280  RECT rc;
03281  static int xpos= -1,ypos= -1;
03282  int *i;
03283  switch( msg ) {
03284    case WM_INITDIALOG:{
03285        SetWindowLong(hdlg,GWL_USERDATA,lparam);
03286        SetDlgItemInt(hdlg,DLG_INSERTFRAMES_EDIT,10,FALSE);
03287        SendDlgItemMessage(hdlg,DLG_INSERTFRAMES_SPIN,SPNM_SETRANGE,0,
03288                            MAKELPARAM(1,10000));
03289        SendDlgItemMessage(hdlg,DLG_INSERTFRAMES_SPIN,SPNM_SETCRNTVALUE,
03290                           (WPARAM)10,0);
03291        SendDlgItemMessage(hdlg,DLG_INSERTFRAMES_SPIN,SPNM_SETEDITCTRL,0,
03292                           (LPARAM)GetDlgItem(hdlg,DLG_INSERTFRAMES_EDIT));
03293        SetDlgItemInt(hdlg,DLG_INSERTFRAMES_EDITAT,CurrentFrame,FALSE);
03294        SendDlgItemMessage(hdlg,DLG_INSERTFRAMES_SPINAT,SPNM_SETRANGE,0,
03295                            MAKELPARAM(1,Nframes));
03296        SendDlgItemMessage(hdlg,DLG_INSERTFRAMES_SPINAT,SPNM_SETCRNTVALUE,
03297                           (WPARAM)CurrentFrame,0);
03298        SendDlgItemMessage(hdlg,DLG_INSERTFRAMES_SPINAT,SPNM_SETEDITCTRL,0,
03299                           (LPARAM)GetDlgItem(hdlg,DLG_INSERTFRAMES_EDITAT));
03300        if(xpos == -1 && ypos == -1)CentreDialogOnCursor(hdlg);
03301        else SetWindowPos(hdlg,HWND_TOP,xpos,ypos,0,0,SWP_NOSIZE);
03302      }
03303      return (TRUE);
03304    case WM_DESTROY:
03305      GetWindowRect(hdlg,&rc);
03306      xpos=rc.left; ypos=rc.top;
03307      break;
03308    case WM_PAINT:
03309      PaintDialogBackground(hdlg,ghinst_main);
03310      break;
03311    case WM_COMMAND:
03312      switch(LOWORD(wparam)){
03313        case IDOK:
03314        case DLG_INSERTFRAMES_OK:
03315          i=(int *)GetWindowLong(hdlg,GWL_USERDATA);
03316          *i=(int)GetDlgItemInt(hdlg,DLG_INSERTFRAMES_EDITAT,&err,FALSE);
03317          EndDialog(hdlg,GetDlgItemInt(hdlg,DLG_INSERTFRAMES_EDIT,&err,FALSE));
03318          return(TRUE);
03319        case IDCANCEL:
03320        case DLG_INSERTFRAMES_CANCEL:
03321          EndDialog(hdlg,-1);
03322          return(TRUE);
03323        default:  break;
03324      }
03325      break;
03326    default: break;
03327  }
03328  return(FALSE);
03329 }
03330 
03331 BOOL CALLBACK DeleteFramesDlgProc(HWND hdlg,UINT msg,
03332                            WPARAM wparam,LPARAM lparam){
03333  BOOL err;
03334  RECT rc;
03335  static int xpos= -1,ypos= -1;
03336  int *i;
03337  switch( msg ) {
03338    case WM_INITDIALOG:{
03339        SetWindowLong(hdlg,GWL_USERDATA,lparam);
03340        SetDlgItemInt(hdlg,DLG_DELETEFRAMES_EDIT,10,FALSE);
03341        SendDlgItemMessage(hdlg,DLG_DELETEFRAMES_SPIN,SPNM_SETRANGE,0,
03342                            MAKELPARAM(1,10000));
03343        SendDlgItemMessage(hdlg,DLG_DELETEFRAMES_SPIN,SPNM_SETCRNTVALUE,
03344                           (WPARAM)10,0);
03345        SendDlgItemMessage(hdlg,DLG_DELETEFRAMES_SPIN,SPNM_SETEDITCTRL,0,
03346                           (LPARAM)GetDlgItem(hdlg,DLG_DELETEFRAMES_EDIT));
03347        SetDlgItemInt(hdlg,DLG_DELETEFRAMES_EDITAT,CurrentFrame,FALSE);
03348        SendDlgItemMessage(hdlg,DLG_DELETEFRAMES_SPINAT,SPNM_SETRANGE,0,
03349                            MAKELPARAM(1,Nframes));
03350        SendDlgItemMessage(hdlg,DLG_DELETEFRAMES_SPINAT,SPNM_SETCRNTVALUE,
03351                           (WPARAM)CurrentFrame,0);
03352        SendDlgItemMessage(hdlg,DLG_DELETEFRAMES_SPINAT,SPNM_SETEDITCTRL,0,
03353                           (LPARAM)GetDlgItem(hdlg,DLG_DELETEFRAMES_EDITAT));
03354        if(xpos == -1 && ypos == -1)CentreDialogOnCursor(hdlg);
03355        else SetWindowPos(hdlg,HWND_TOP,xpos,ypos,0,0,SWP_NOSIZE);
03356      }
03357      return (TRUE);
03358    case WM_DESTROY:
03359      GetWindowRect(hdlg,&rc);
03360      xpos=rc.left; ypos=rc.top;
03361      break;
03362    case WM_PAINT:
03363      PaintDialogBackground(hdlg,ghinst_main);
03364      break;
03365    case WM_COMMAND:
03366      switch(LOWORD(wparam)){
03367        case IDOK:
03368        case DLG_DELETEFRAMES_OK:
03369          i=(int *)GetWindowLong(hdlg,GWL_USERDATA);
03370          *i=(int)GetDlgItemInt(hdlg,DLG_DELETEFRAMES_EDITAT,&err,FALSE);
03371          EndDialog(hdlg,GetDlgItemInt(hdlg,DLG_DELETEFRAMES_EDIT,&err,FALSE));
03372          return(TRUE);
03373        case IDCANCEL:
03374        case DLG_DELETEFRAMES_CANCEL:
03375          EndDialog(hdlg,-1);
03376          return(TRUE);
03377        default:  break;
03378      }
03379      break;
03380    default: break;
03381  }
03382  return(FALSE);
03383 }
03384 
03385 static BOOL CALLBACK AddKeyframeDlgProc(HWND hdlg,UINT msg,
03386                            WPARAM wparam,LPARAM lparam){
03387  switch( msg ) {
03388    case WM_INITDIALOG:
03389      CentreDialogOnCursor(hdlg);
03390      return (TRUE);
03391    case WM_PAINT:
03392      PaintDialogBackground(hdlg,ghinst_main);
03393      break;
03394    case WM_COMMAND:
03395       switch(LOWORD(wparam)){
03396         case IDOK:
03397         case DLG_KEYMAKER_GOTO:
03398           EndDialog(hdlg,1);
03399           return(TRUE);
03400           break;
03401         case DLG_KEYMAKER_MAKE:
03402           EndDialog(hdlg,2);
03403           return(TRUE);
03404           break;
03405         case IDCANCEL:
03406         case DLG_KEYMAKER_CANCEL:
03407           EndDialog(hdlg,0);
03408           return(TRUE);
03409           break;
03410         default:  break;
03411       }
03412       break;
03413     default: break;
03414  }
03415  return(FALSE);
03416 }
03417 
03418 int SelectKeyMaker(void){
03419  int id;
03420  EnableToolPannels(ALL_PANNELS,FALSE);
03421  id=DialogBox(ghinst_main,MAKEINTRESOURCE(DLG_KEYMAKER),
03422               ghwnd_main,(DLGPROC)AddKeyframeDlgProc);
03423  EnableToolPannels(ALL_PANNELS,TRUE);
03424  return id;
03425 }
03426 
03427 BOOL CALLBACK ObjectTimelineDlgProc(HWND hdlg,UINT msg,
03428                            WPARAM wparam,LPARAM lparam){
03429  char line1[256],line2[256],line3[256];
03430  struct NP {node *np; short ff,lf;} *NP;
03431  sky    *sp;
03432  object *op;
03433  char title[255];
03434  switch( msg ) {
03435    case WM_INITDIALOG:
03436      NP=(struct NP *)lparam;
03437      line1[0]=0; line2[0]=0; line3[0]=0;
03438      if(NP->np->type == SKY){
03439        LoadString(ghinst_main,IDX_MISC_DSKYINFO,line2,256);
03440        strcpy(line1,line2);
03441        SkyCostumeInfo(NP->np,(short)(NP->lf),line2);
03442      }
03443      else if(NP->np->type == DIRECTOR){
03444        LoadString(ghinst_main,IDX_MISC_DIRECTORINFO,line2,256);
03445        strcpy(line1,line2);
03446        DirectorCostumeInfo(NP->np,(short)(NP->lf),line2);
03447      }
03448      else{
03449        op=GetObjectAtFrame(NP->np,(long)(NP->lf));
03450        if(op == NULL){
03451          MessageBeep(MB_OK); /* should never happen */
03452          SendMessage(hdlg,WM_COMMAND,IDCANCEL,0);
03453        }
03454        CostumeInfo(op,line1,line2,line3);
03455      }
03456      LoadString(ghinst_main,IDX_MISC_DCOSTUME,res_str,256);
03457      sprintf(title,res_str,NP->np->actorname);
03458      SendMessage(hdlg,WM_SETTEXT,0,(LPARAM)title);
03459      EnableToolPannels(ALL_PANNELS,FALSE);
03460      SendDlgItemMessage(hdlg,DLG_LINEOPT_T1,WM_SETTEXT,0,(LPARAM)line1);
03461      SendDlgItemMessage(hdlg,DLG_LINEOPT_T2,WM_SETTEXT,0,(LPARAM)line2);
03462      SendDlgItemMessage(hdlg,DLG_LINEOPT_T3,WM_SETTEXT,0,(LPARAM)line3);
03463      if(NP->np->type == PARTICLE ||
03464         NP->np->type == PATH ||
03465         NP->np->type == DIRECTOR ||
03466         NP->np->type == SKY){
03467        EnableWindow(GetDlgItem(hdlg,DLG_LINEOPT_CUT),FALSE);
03468        EnableWindow(GetDlgItem(hdlg,DLG_LINEOPT_COPY),FALSE);
03469      }
03470      if(NP->np->type == ROBOT ||
03471         NP->np->type == TARGET || NP->np->type == PATH){
03472        EnableWindow(GetDlgItem(hdlg,DLG_LINEOPT_EDIT),FALSE);
03473      }
03474      if(NP->np->type == ROBOT){
03475        EnableWindow(GetDlgItem(hdlg,DLG_LINEOPT_ROBOT_EXPORT),TRUE);
03476        EnableWindow(GetDlgItem(hdlg,DLG_LINEOPT_ROBOT_SETPATH),TRUE);
03477      }
03478      CentreDialogOnScreen(hdlg);
03479      return (TRUE);
03480    case WM_DESTROY:
03481      EnableToolPannels(ALL_PANNELS,TRUE);
03482      break;
03483    case WM_PAINT:
03484      PaintDialogBackground(hdlg,ghinst_main);
03485      break;
03486    case WM_COMMAND:
03487       switch(LOWORD(wparam)){
03488         case DLG_LINEOPT_CUT:           EndDialog(hdlg,3); return TRUE;
03489         case DLG_LINEOPT_COPY:          EndDialog(hdlg,4); return TRUE;
03490         case DLG_LINEOPT_EDIT:          EndDialog(hdlg,1); return TRUE;
03491         case DLG_LINEOPT_DELETE:        EndDialog(hdlg,0); return TRUE;
03492         case DLG_LINEOPT_ROBOT_EXPORT:  EndDialog(hdlg,5); return TRUE;
03493         case DLG_LINEOPT_ROBOT_SETPATH: EndDialog(hdlg,6); return TRUE;
03494         case IDCANCEL:
03495         case DLG_LINEOPT_CANCEL:
03496           EndDialog(hdlg,-1);
03497           return(TRUE);
03498         default:  break;
03499       }
03500       break;
03501     default: break;
03502  }
03503  return(FALSE);
03504 }
03505 
03506 BOOL CALLBACK PathSetDlgProc(HWND hdlg,UINT msg,
03507                              WPARAM wparam,LPARAM lparam){
03508  switch( msg ) {
03509    case WM_INITDIALOG:
03510      CentreDialogOnScreen(hdlg);
03511      EnableToolPannels(ALL_PANNELS,FALSE);
03512      return (TRUE);
03513    case WM_DESTROY:
03514      EnableToolPannels(ALL_PANNELS,TRUE);
03515      break;
03516    case WM_PAINT:
03517      PaintDialogBackground(hdlg,ghinst_main);
03518      break;
03519    case WM_COMMAND:
03520       switch(LOWORD(wparam)){
03521         case DLG_PATHTYPE_OPEN:
03522           EndDialog(hdlg,0);
03523           return(TRUE);
03524           break;
03525         case DLG_PATHTYPE_CLOSED:
03526           EndDialog(hdlg,1);
03527           return(TRUE);
03528           break;
03529         case DLG_PATHTYPE_LOAD:
03530           EndDialog(hdlg,2);
03531           return(TRUE);
03532           break;
03533         case DLG_PATHTYPE_COPY:
03534           EndDialog(hdlg,3);
03535           return(TRUE);
03536           break;
03537         case IDCANCEL:
03538           EndDialog(hdlg,-1);
03539           return(TRUE);
03540           break;
03541         default:  break;
03542       }
03543       break;
03544     default: break;
03545  }
03546  return(FALSE);
03547 }
03548 
03549 // The popup dialog that appears when the Quick and Wireframe previews
03550 // are being drawn
03551 
03552 extern UINT AnimationTimer;
03553 
03554 static BOOL CALLBACK QuickPlayDlgProc(HWND hwnd,UINT msg,
03555                                 WPARAM wparam,LPARAM lparam){
03556  RECT rc;
03557  POINT p;
03558  switch( msg ) {
03559    case WM_PAINT:
03560      PaintDialogBackground(hwnd,ghinst_main);
03561      break;
03562    case WM_INITDIALOG:
03563      if(View == ONEVIEW){
03564        GetWindowRect(hwnd,&rc);
03565        if(BigCameraView){
03566          p.x=WindowViewSliderXpos+WindowViewSliderXsize+15;
03567          p.y=WindowViewSliderYpos-15;
03568          p.y -= (rc.bottom - rc.top);
03569        }
03570        else{
03571          p.x=WindowViewSliderXpos+WindowViewSliderXsize;
03572          p.x -= (rc.right - rc.left);
03573          p.y=WindowViewSliderYpos+WindowViewSliderYsize;
03574        }
03575        ClientToScreen(ghwnd_main,&p);
03576        p.x -= 5; p.y += 10;
03577      }
03578      else{
03579        GetWindowRect(hwnd,&rc);
03580        p.x=WindowViewSliderXpos+WindowViewSliderXsize;
03581        p.x -= (rc.right - rc.left);
03582        p.y=WindowViewSliderYpos+WindowViewSliderYsize;
03583        ClientToScreen(ghwnd_main,&p);
03584        p.x -= 5; p.y += 10;
03585      }
03586      SetWindowPos(hwnd,NULL,p.x,p.y,0,0,SWP_NOSIZE | SWP_NOZORDER);
03587      return (TRUE);
03588    case WM_COMMAND:
03589      switch(LOWORD(wparam)){
03590        case IDCANCEL:
03591          EndDialog(hwnd,IDCANCEL);
03592          return(TRUE);
03593        case IDOK:
03594          EndDialog(hwnd,IDOK);
03595          return(TRUE);
03596        default:
03597          break;
03598      }
03599      break;
03600    default: break;
03601  }
03602  return(FALSE);
03603 }
03604 
03605 void AnimationPlayer(int type, HWND hwnd){
03606  static int AnimationStoreFrame;
03607  int i,b;
03608  if((AnimationTimer=SetTimer(ghwnd_view,type+1,33,NULL)) == 0)return;
03609  AnimationStoreFrame=CurrentFrame;
03610  EnableToolPannels(ALL_PANNELS,FALSE);
03611  if(DialogBox(ghinst_main,MAKEINTRESOURCE(DLG_QUICKPLAY),hwnd,
03612      (DLGPROC)QuickPlayDlgProc) == IDOK)b=0;
03613  else b=1;
03614  KillTimer(ghwnd_view,AnimationTimer); AnimationTimer=0;
03615  if(b)CurrentFrame=AnimationStoreFrame;
03616  else UpdateSelectedActor(FALSE);
03617 // SetScrollPos(ghwnd_xscl,SB_CTL,(int)CurrentFrame,TRUE);
03618  SendMessage(ghwnd_xscl,TBM_SETPOS,TRUE,(LPARAM)CurrentFrame);
03619  ReDrawStageDisplay(TRUE);
03620  if(ghwndOpenGLview == NULL)PerspectiveView(0,1);
03621  else UpdateGLview(TRUE);
03622  EnableToolPannels(ALL_PANNELS,TRUE);
03623 }

Generated on Sun Apr 27 14:20:08 2014 for OpenFX by  doxygen 1.5.6