PREFS.C

Go to the documentation of this file.
00001 // file PREFS.C
00002 
00003 #define MODULE_PREFS 1
00004 
00005 #include "animate.h"
00006 
00007 void LoadPreferences(void){
00008  char pref_id[32];
00009  Preferences.buttons=TRUE;
00010  Preferences.quick_trick=TRUE;
00011  Preferences.show_select=FALSE;
00012  Preferences.default_start=FALSE;
00013  Preferences.use_3d_dialogs=TRUE;
00014  Preferences.use_OpenGL=FALSE;
00015  Preferences.undo=FALSE;
00016  Preferences.use_positions=TRUE;
00017  Preferences.ground=FALSE;
00018  Preferences.big_camera=FALSE;
00019  Preferences.tooltips=TRUE;
00020  Preferences.toolleft=FALSE;
00021  Preferences.toolsmall=FALSE;
00022  Preferences.autocentre=TRUE;
00023  Preferences.detail_auto=TRUE;
00024  Preferences.detail_step=1;
00025  Preferences.background=TRUE;
00026  Preferences.auto_update_keyframer=TRUE;
00027  Preferences.use_gl_robot=FALSE;
00028  Preferences.splash = 1000;
00029  Preferences.embedimages=TRUE;
00030  ActiveView=TRITOP;
00031  select_visible=0;
00032  GetPrivateProfileString(IniSection,"BUTTONS","$$$",
00033                    pref_id,sizeof(pref_id),IniFilename);
00034  if(strncmp(pref_id,"NO",3) == 0){
00035    Preferences.buttons=FALSE;
00036  }
00037  GetPrivateProfileString(IniSection,"SELECTPANNEL","$$$",
00038                    pref_id,sizeof(pref_id),IniFilename);
00039  if(strncmp(pref_id,"YES",3) == 0){
00040    Preferences.show_select=TRUE;
00041    select_visible=1;
00042  }
00043  GetPrivateProfileString(IniSection,"QUICKTRICK","$$$",
00044                    pref_id,sizeof(pref_id),IniFilename);
00045  if(strncmp(pref_id,"NO",3) == 0){
00046    Preferences.quick_trick=FALSE;
00047  }
00048  GetPrivateProfileString(IniSection,"DEFAULTSTART","$$$",
00049                    pref_id,sizeof(pref_id),IniFilename);
00050  if(strncmp(pref_id,"YES",3) == 0){
00051    Preferences.default_start=TRUE;
00052  }
00053  GetPrivateProfileString(IniSection,"DIALOGS3D","$$$",
00054                    pref_id,sizeof(pref_id),IniFilename);
00055  if(strncmp(pref_id,"NO",3) == 0){
00056    Preferences.use_3d_dialogs=FALSE;
00057  }
00058  GetPrivateProfileString(IniSection,"UNDO","$$$",
00059                    pref_id,sizeof(pref_id),IniFilename);
00060  if(strncmp(pref_id,"YES",3) == 0){
00061    Preferences.undo=TRUE;
00062  }
00063  GetPrivateProfileString(IniSection,"POSITIONS","$$$",
00064                    pref_id,sizeof(pref_id),IniFilename);
00065  if(strncmp(pref_id,"NO",2) == 0){
00066    Preferences.use_positions=FALSE;
00067  }
00068  GetPrivateProfileString(IniSection,"GROUND","$$$",
00069                    pref_id,sizeof(pref_id),IniFilename);
00070  if(strncmp(pref_id,"YES",3) == 0){
00071    Preferences.ground=TRUE;
00072  }
00073  GetPrivateProfileString(IniSection,"TOOLTIPS","$$$",
00074                    pref_id,sizeof(pref_id),IniFilename);
00075  if(strncmp(pref_id,"NO",2) == 0){
00076    Preferences.tooltips=FALSE;
00077  }
00078  GetPrivateProfileString(IniSection,"BIGCAMERA","$$$",
00079                    pref_id,sizeof(pref_id),IniFilename);
00080  if(strncmp(pref_id,"YES",3) == 0){
00081    Preferences.big_camera=TRUE;
00082  }
00083  GetPrivateProfileString(IniSection,"TOOLLEFT","$$$",
00084                    pref_id,sizeof(pref_id),IniFilename);
00085  if(strncmp(pref_id,"YES",3) == 0)Preferences.toolleft=TRUE;
00086  if(strncmp(pref_id,"NO",2) == 0)Preferences.toolleft=FALSE;
00087  GetPrivateProfileString(IniSection,"TOOLSMALL","$$$",
00088                    pref_id,sizeof(pref_id),IniFilename);
00089  if(strncmp(pref_id,"YES",3) == 0)Preferences.toolsmall=TRUE;
00090  if(strncmp(pref_id,"NO",2) == 0)Preferences.toolsmall=FALSE;
00091  GetPrivateProfileString(IniSection,"AUTOCENTRE","$$$",
00092                    pref_id,sizeof(pref_id),IniFilename);
00093  if(strncmp(pref_id,"NO",2) == 0){
00094    Preferences.autocentre=FALSE;
00095  }
00096  Preferences.splash=GetPrivateProfileInt(IniSection,"SPLASH",
00097                     Preferences.splash,IniFilename);
00098  GetPrivateProfileString(IniSection,"BACKIMAGE","$$$",
00099                    pref_id,sizeof(pref_id),IniFilename);
00100  if(strncmp(pref_id,"YES",3) == 0)Preferences.background=TRUE;
00101  if(strncmp(pref_id,"NO",2) == 0)Preferences.background=FALSE;
00102  bBackgroundImage=Preferences.background;
00103  bToolpannelLeft=Preferences.toolleft;
00104  bToolpannelSmall=Preferences.toolsmall;
00105  bEmbedImageMaps=Preferences.embedimages;
00106  ActiveView=GetPrivateProfileInt(IniSection,"ACTIVEVIEW",TRITOP,
00107                                  IniFilename);
00108  FramesPerSec=GetPrivateProfileInt(IniSection,"FPS",FramesPerSec,
00109                                  IniFilename);
00110  GetPrivateProfileString(IniSection,"DETAILAUTO","$$$",
00111                    pref_id,sizeof(pref_id),IniFilename);
00112  if(strncmp(pref_id,"YES",3) == 0)Preferences.detail_auto=1;
00113  if(strncmp(pref_id,"NO",2) == 0)Preferences.detail_auto=0;
00114  Preferences.detail_step=GetPrivateProfileInt(IniSection,"DETAILSTEP",
00115                          Preferences.detail_step,IniFilename);
00116 
00117  GetPrivateProfileString(IniSection,"QUICKDRAW","$$$",
00118                           pref_id,sizeof(pref_id),IniFilename);
00119  if(strncmp(pref_id,"YES",3) == 0)global_quickdraw=1;
00120  if(strncmp(pref_id,"NO",2) == 0)global_quickdraw=0;
00121  AllDrawStatus=GetPrivateProfileInt(IniSection,"DRAWFULLTYPE",
00122                                     3,IniFilename);
00123  GetPrivateProfileString(IniSection,"DRAWFULL","$$$",
00124                           pref_id,sizeof(pref_id),IniFilename);
00125  if(strncmp(pref_id,"NO",3) == 0)DrawStatus=0;
00126  if(strncmp(pref_id,"YES",2) == 0)DrawStatus=AllDrawStatus;
00127  GetPrivateProfileString(IniSection,"LIGHTCONES","$$$",
00128                    pref_id,sizeof(pref_id),IniFilename);
00129  show_camera_fov=1;
00130  show_light_cones=1;
00131  if(strncmp(pref_id,"YES",3) == 0)show_light_cones=1;
00132  if(strncmp(pref_id,"NO",2) == 0)show_light_cones=0;
00133  GetPrivateProfileString(IniSection,"CAMERAFOV","$$$",
00134                    pref_id,sizeof(pref_id),IniFilename);
00135  if(strncmp(pref_id,"YES",3) == 0)show_camera_fov=1;
00136  if(strncmp(pref_id,"NO",2) == 0)show_camera_fov=0;
00137  GetPrivateProfileString(IniSection,"OPENGL1","$$$",
00138                    pref_id,sizeof(pref_id),IniFilename);
00139  if(strncmp(pref_id,"YES",3) == 0)opengl_visible=1;
00140  if(strncmp(pref_id,"NO",2) == 0)opengl_visible=0;
00141  GetPrivateProfileString(IniSection,"GLROBOT","$$$",
00142                    pref_id,sizeof(pref_id),IniFilename);
00143  if(strncmp(pref_id,"YES",3) == 0){
00144    Preferences.use_gl_robot=TRUE;
00145  }
00146  coords_visible=GetPrivateProfileInt(IniSection,"COORDSVISIBLE",
00147                                      coords_visible,IniFilename);
00148  draw_grid_on=GetPrivateProfileInt(IniSection,"DRAWGRIDON",
00149                                      draw_grid_on,IniFilename);
00150  grid_on=GetPrivateProfileInt(IniSection,"GRIDON",
00151                                      grid_on,IniFilename);
00152  return;
00153 }
00154 
00155 void ActivatePreferences(void){
00156  char pref_id[32];
00157  if(Preferences.undo)UNDO_ACTIVE=YES;
00158  if(Preferences.big_camera)PostMessage(ghwnd_main,WM_COMMAND,
00159                     (WPARAM)IDM_WINDOW_BIGCAMERA,(LPARAM)0);
00160  if(GetPrivateProfileInt(IniSection,"VIEW",View,IniFilename)
00161      == ONEVIEW)PostMessage(ghwnd_main,WM_COMMAND,
00162                            (WPARAM)IDM_WINDOW_SWITCHWINDOWS,(LPARAM)0);
00163  if(global_quickdraw)CheckMenuItem(GetMenu(ghwnd_main),
00164                      IDM_VIEW_GLOBALQUICKDRAW,MF_CHECKED);
00165  else                CheckMenuItem(GetMenu(ghwnd_main),
00166                      IDM_VIEW_GLOBALQUICKDRAW,MF_UNCHECKED);
00167  if(AllDrawStatus == 1)CheckMenuItem(GetMenu(ghwnd_main),
00168                            IDM_VIEW_DRAW_SELECTED  ,MF_CHECKED);
00169  if(AllDrawStatus == 2)CheckMenuItem(GetMenu(ghwnd_main),
00170                            IDM_VIEW_DRAW_DESELECTED,MF_CHECKED);
00171  if(AllDrawStatus == 3)CheckMenuItem(GetMenu(ghwnd_main),
00172                            IDM_VIEW_DRAW_ALL       ,MF_CHECKED);
00173  if(DrawStatus == 0){
00174    char tt[128];
00175    LoadString(ghinst_main,IDX_MISC_DRAWFULL,tt,128);
00176    ModifyMenu(GetMenu(ghwnd_main),IDM_VIEW_DRAW_BOUNDED,
00177               MF_BYCOMMAND|MF_STRING,IDM_VIEW_DRAW_BOUNDED,tt);
00178  }
00179  else{
00180    char tt[128];
00181    LoadString(ghinst_main,IDX_MISC_DRAWBOUNDED,tt,128);
00182    ModifyMenu(GetMenu(ghwnd_main),IDM_VIEW_DRAW_BOUNDED,
00183               MF_BYCOMMAND|MF_STRING,IDM_VIEW_DRAW_BOUNDED,tt);
00184    EnableMenuItem(GetMenu(ghwnd_main),IDM_VIEW_DRAW_SELECTED,MF_ENABLED);
00185    EnableMenuItem(GetMenu(ghwnd_main),IDM_VIEW_DRAW_DESELECTED,MF_ENABLED);
00186    EnableMenuItem(GetMenu(ghwnd_main),IDM_VIEW_DRAW_ALL,MF_ENABLED);
00187  }
00188  if(show_camera_fov)CheckMenuItem(GetMenu(ghwnd_main),
00189                         IDM_VIEW_FEEDBACK_CAMERA,MF_CHECKED);
00190  else               CheckMenuItem(GetMenu(ghwnd_main),
00191                         IDM_VIEW_FEEDBACK_CAMERA,MF_UNCHECKED);
00192  if(show_light_cones)CheckMenuItem(GetMenu(ghwnd_main),
00193                          IDM_VIEW_FEEDBACK_LIGHT,MF_CHECKED);
00194  else                CheckMenuItem(GetMenu(ghwnd_main),
00195                          IDM_VIEW_FEEDBACK_LIGHT,MF_UNCHECKED);
00196  GetPrivateProfileString(IniSection,"KEYDOCK","$$$",
00197                    pref_id,sizeof(pref_id),IniFilename);
00198  if(strncmp(pref_id,"YES",3) == 0)keyframer_docked=1;
00199  if(strncmp(pref_id,"NO",2) == 0)keyframer_docked=0;
00200  if(keyframer_docked)
00201    CheckMenuItem(GetMenu(ghwnd_main),IDM_FILE_KEYFRAMERDOCK,MF_CHECKED);
00202  else
00203    CheckMenuItem(GetMenu(ghwnd_main),IDM_FILE_KEYFRAMERDOCK,MF_UNCHECKED);
00204  if(coords_visible){
00205    if(IsWindow(ghwndCoord1))ShowWindow(ghwndCoord1,SW_SHOWNA);
00206    CheckMenuItem(GetMenu(ghwnd_main),IDM_WINDOW_COORDS,MF_CHECKED);
00207  }
00208  if(draw_grid_on)CheckMenuItem(GetMenu(ghwnd_main),IDM_VIEW_DRAW_GRID,MF_CHECKED);
00209  if(grid_on)CheckMenuItem(GetMenu(ghwnd_main),IDM_VIEW_GRID,MF_CHECKED);
00210 }

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