void Blockedit_DLG_CB(int var){ switch(var){ case SAVE_SETTINGS: updatemenu=1; writeini(LOCAL_INI,NULL); break; case CLOSE_WINDOW: DialogMenu(DIALOG_GEOMETRY); smooth_blockages(); break; default: ASSERT(FFALSE); break; } }
void STEREO_CB(int var){ switch(var){ case STEREO_GREEN: // right_blue=1.0-right_green; // SPINNER_right_blue2->set_float_val(right_blue); break; case STEREO_BLUE: // right_green=1.0-right_blue; // SPINNER_right_green2->set_float_val(right_green); break; case STEREO_SHOW: if(showstereoOLD!=showstereo){ Update_Glui_Stereo(); showstereoOLD=showstereo; } if(showstereo==STEREO_CUSTOM){ SPINNER_right_blue2->enable(); SPINNER_right_green2->enable(); } else{ SPINNER_right_blue2->disable(); SPINNER_right_green2->disable(); } break; case STEREO_RESET: SPINNER_zero_parallax->set_float_val(SCALE2FDS(0.25)); break; case STEREO_CLOSE: hide_glui_stereo(); break; case SAVE_SETTINGS: writeini(LOCAL_INI,NULL); break; default: ASSERT(FFALSE); break; } }
extern "C" void WUI_CB(int var) { int fire_line_type; switch(var) { case TERRAIN_MIN: case TERRAIN_MAX: break; case TERRAIN_FIRE_LINE_UPDATE: fire_line_type=getslicetype_fromlabel("Fire line"); if(fire_line_type<0)break; list_slice_index=fire_line_type; updateslicelist(list_slice_index); Slice_CB(FILETYPEINDEX); setslicemin=1; setslicemax=1; slicemin=20.0; slicemax=fire_line_max; setslicechopmin=1; setslicechopmax=0; slicechopmin=fire_line_min; Slice_CB(SETVALMIN); Slice_CB(SETVALMAX); Slice_CB(VALMIN); Slice_CB(VALMAX); Slice_CB(SETCHOPMINVAL); Slice_CB(SETCHOPMAXVAL); Slice_CB(CHOPVALMIN); Slice_CB(CHOPVALMAX); Slice_CB(FILEUPDATE); Slice_CB(CHOPUPDATE); break; case TERRAIN_COLORS: update_terrain_colors(); break; case TERRAIN_VERT: update_terrain(0,vertical_factor); break; case TERRAIN_TYPE: if(visTerrainType==TERRAIN_3D) { planar_terrain_slice=0; } else { planar_terrain_slice=1; } updatemenu=1; break; case SAVE_SETTINGS: writeini(LOCAL_INI,NULL); break; case WUI_CLOSE: hide_glui_wui(); break; default: ASSERT(FFALSE); break; } }
//------------------------------------------------------------------ LRESULT CALLBACK WndMainProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int i, notif; Tsquare *t; switch(message){ case WM_PAINT: { static PAINTSTRUCT ps; BeginPaint(hWnd, &ps); paint(ps.hdc, &ps.rcPaint); EndPaint(hWnd, &ps); } break; case WM_LBUTTONDOWN: lbutton(lParam); break; case WM_RBUTTONDOWN: rbutton(lParam); break; case WM_LBUTTONUP: if(inserting){ ReleaseCapture(); inserting=false; insertGroup(); resetSolution(); } break; case WM_MOUSEMOVE: if(inserting){ t= hitTest(lParam); if(t && t!=insSquares[insLen-1] && insLen<Nsymbol){ insSquares[insLen++]=t; } } #ifdef _DEBUGM mousemove(lParam); #endif break; case WM_TIMER: if(!IsIconic(hWin)){ playtime++; statusTime(); checkShowErr(false); } break; case WM_KEYDOWN: key(wParam); break; case WM_GETMINMAXINFO: { LPMINMAXINFO lpmm = (LPMINMAXINFO)lParam; lpmm->ptMinTrackSize.x = 250; lpmm->ptMinTrackSize.y = 200+toolH; break; } case WM_SIZE: width=LOWORD(lParam); height=HIWORD(lParam); SendMessage(toolbar, TB_AUTOSIZE, 0, 0); SendMessage(statusbar, WM_SIZE, 0, 0); onMoved(); invalidate(); break; case WM_MOVE: onMoved(); break; case WM_CLOSE: SendMessage(hWin, WM_COMMAND, ID_EXIT, 0); break; case WM_QUERYENDSESSION: writeini(); return TRUE; case WM_DESTROY: PostQuitMessage(0); break; case WM_COMMAND: notif=HIWORD(wParam); wParam=LOWORD(wParam); if(setLang(wParam)) break; if(wParam>=ID_SYMBOL && wParam<unsigned(ID_SYMBOL+size)){ select(wParam-ID_SYMBOL); break; } if(wParam>=ID_SIZE+4 && wParam<=ID_SIZE+Msize){ if(askNew()) break; size=wParam-ID_SIZE; newGameFormat(); numButtons(); break; } if(wParam>=ID_MULTI && wParam<ID_MULTI+sizeA(gameTypeA)-1){ if(askNew()) break; gameType=wParam-ID_MULTI; newGameFormat(); break; } switch(wParam){ case ID_CLEAR: noScore=true; init(false); invalidate(); break; case ID_CLEAR_ALL: noScore=true; initSquare(false); invalidate(); break; case ID_EDITOR: if(!editor){ if((undoPos==0 || done==Nsquare) && isGenerated()){ initSquare(false); } editor=true; playtime=0; noScore=true; editorChanged(); } break; case ID_EDITOR_END: if(editor){ endEditor(); editor=false; editorChanged(); } break; case ID_SOLVE: case ID_SOLVE1: if(testTotal()) break; noScore=true; if(done<Nsquare){ waitOn(); #ifdef _DEBUG DWORD time=getTickCount(); #endif Nsolution=0; curSolution=-1; //find all solutions (up to Msolution) undoAllPos=undoPos; if(wParam==ID_SOLVE1) resolve1(); else resolve(); freeGroups(); #ifdef _DEBUG status(4, _T("%d ms"), getTickCount()-time); #endif waitOff(); } if(Nsolution>0){ i=curSolution; curSolution++; if(curSolution>=Nsolution) curSolution=0; if(Nsolution>1){ if(i<0){ status(4, _T("%d %s"), Nsolution, lng(662, "solutions")); } else{ status(4, _T("%d/%d"), curSolution+1, Nsolution); } } rdSolution(); } else{ //easy solution (without recurse) or not solvable curSolution=0; status(4, _T("")); } checkErr(); invalidate(); break; case ID_CHEAT: noScore=true; if(errTime<0){ waitOn(); hint(); waitOff(); } checkShowErr(true); break; case ID_UNDO: undo(); checkErr(); break; case ID_REDO: redo(); checkErr(); break; case ID_UNDO_SYMBOL: undoSymbol(); checkErr(); break; case ID_REDO_SYMBOL: redoSymbol(); checkErr(); break; case ID_UNDO_ALL: undoAll(); checkErr(); break; case ID_REDO_ALL: while(redo()); checkErr(); break; case ID_DEL: select(-1); break; case ID_INS: select(-2); break; case ID_SIGN: select(-3); break; case ID_CONS: select(-4); break; case ID_EVEN: select(-5); break; case ID_EXIT: writeini(); DestroyWindow(hWin); break; case ID_DIAGONAL: if(askNew()) break; diag=!diag; newGameFormat(); break; case ID_SYMETRIC: if(askNew()) break; symetric=!symetric; newGameFormat(); break; case ID_LEVEL: if(DialogBox(inst, MAKEINTRESOURCE(IDD_LEVEL), hWnd, (DLGPROC)LevelProc)){ if(!editor) newGame(); } break; case ID_SHOWERR: DialogBox(inst, MAKEINTRESOURCE(IDD_ERRTIME), hWnd, (DLGPROC)ShowErrProc); break; case ID_KILLER: if(askNew()) break; killer=!killer; newGameFormat(); numButtons(); break; case ID_GREATER: if(askNew()) break; greater=!greater; newGameFormat(); break; case ID_CONSECUTIVE: if(askNew()) break; consecutive=!consecutive; newGameFormat(); if(selectedNum==-4 && !consecutive) select(-1); break; case ID_ODDEVEN: if(askNew()) break; oddeven=!oddeven; newGameFormat(); if(selectedNum==-5 && !oddeven) select(-1); break; case ID_DIGITS: case ID_LETTERS: case ID_COLORS: symbol0=wParam-350; checkMenus(); invalidate(); numButtons(); break; case ID_NEWGAME: if(editor) SendMessage(hWnd, WM_COMMAND, ID_EDITOR_END, 0); else newGame(); break; case ID_DELINI: delreg=true; break; case ID_DELHISCORE: if(MessageBox(hWnd, lng(799, "Do you really want to delete all hiscores ?"), title, MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2) == IDYES){ for(TscoreTab *tab=score; tab;){ TscoreTab *t1= tab->next; delete tab; tab=t1; } score=0; writeScore(); } break; case ID_BEST_SCORES: DialogBox(inst, MAKEINTRESOURCE(IDD_HISCORE), hWnd, (DLGPROC)ScoreProc); break; case ID_COLORDLG: DialogBox(inst, MAKEINTRESOURCE(IDD_COLORS), hWin, (DLGPROC)ColorProc); break; case ID_ABOUT: DialogBox(inst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)AboutProc); break; case ID_HELP_README: { TCHAR *buf=(TCHAR*)_alloca(2*MAX_PATH); getExeDir(buf, lng(13, "readme.txt")); if(ShellExecute(0, _T("open"), buf, 0, 0, SW_SHOWNORMAL)==(HINSTANCE)ERROR_FILE_NOT_FOUND){ msglng(730, "Cannot open %s", buf); } } break; case ID_WRBMP: if(saveFileDlg(&bmpOfn, hWnd, 0)){ wrBmp(bmpFn, bmpOfn.nFilterIndex); } break; case ID_SAVE: if(saveFileDlg(&gameOfn, hWnd, OFN_OVERWRITEPROMPT)){ save(gameFn); } break; case ID_OPEN: if(openFileDlg(&gameOfn, hWnd, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY)){ open(gameFn); checkErr(); } break; case ID_CLEAR_GRP: resetSolution(); for(i=0; i<Ngroup; i++){ delGroup(&group[i]); } invalidate(); break; case ID_CLEAR_SGN: case ID_CLEAR_CONS: resetSolution(); for(i=0; i<Nboard; i++){ if(wParam==ID_CLEAR_SGN){ putSign(0, &board[i], 0); putSign(0, &board[i], 1); } if(wParam==ID_CLEAR_CONS){ putCons(false, &board[i], 0); putCons(false, &board[i], 1); } } invalidate(); break; case ID_MARKS: noScore=true; showMarks(); break; case ID_DELMARKS: delAllMarks(); break; case ID_PDF: if(askNew()) break; DialogBox(inst, MAKEINTRESOURCE(IDD_PDF), hWnd, (DLGPROC)PdfProc); numButtons(); break; } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
extern "C" void Smoke3d_CB(int var) { int i; char *tour_label; char *vol_prefixptr; updatemenu=1; switch(var) { float temp_min, temp_max; case VOL_UNLOAD_ALL: UnLoadVolSmoke3DMenu(-1); break; case VOL_PREFIX: break; case VOL_TOUR_LIST: TOUR_CB(TOUR_LIST); break; case START_FRAME: if(vol_startframe0<0) { vol_startframe0=0; SPINNER_startframe->set_int_val(vol_startframe0); } break; case SKIP_FRAME: if(vol_skipframe0<1) { vol_skipframe0=1; SPINNER_skipframe->set_int_val(vol_skipframe0); } break; case CANCEL_GENERATE_IMAGES: Script_CB(SCRIPT_CANCEL_NOW); break; case GENERATE_IMAGES: if(selected_tour==NULL) { tour_label=NULL; } else { tour_label=selected_tour->label; } trim(vol_prefix); vol_prefixptr=trim_front(vol_prefix); if(strlen(vol_prefixptr)==0)vol_prefixptr=fdsprefix; init_volrender_script(vol_prefixptr, tour_label, vol_startframe0, vol_skipframe0); break; case NONGPU_VOL_FACTOR: init_volrender_surface(NOT_FIRSTCALL); break; case GPU_VOL_FACTOR: break; case COMBINE_MESHES: define_volsmoke_textures(); break; case SHOW_FIRECOLORMAP: Update_Smokecolormap(smoke_render_option); if(show_firecolormap==1) { show_glui_colorbar(); } else { hide_glui_colorbar(); } break; case TEMP_MIN: temp_min = 20.0; temp_max = (float)(10.0*(int)(temperature_cutoff/10.0)-10.0); SPINNER_temperature_min->set_float_limits(temp_min,temp_max); Update_Smokecolormap(smoke_render_option); break; case TEMP_CUTOFF: temp_min = (float)(10*(int)(temperature_min/10.0) + 10.0); temp_max = (float)(10*(int)(temperature_max/10.0) - 10.0); SPINNER_temperature_cutoff->set_float_limits(temp_min,temp_max); Update_Smokecolormap(smoke_render_option); break; case TEMP_MAX: temp_min = (float)(10*(int)(temperature_cutoff/10.0)+10.0); temp_max = 1800.0; SPINNER_temperature_max->set_float_limits(temp_min,temp_max); Update_Smokecolormap(smoke_render_option); break; case LOAD_COMPRESSED_DATA: if(load_volcompressed==1) { CHECKBOX_compress_volsmoke->disable(); } else { CHECKBOX_compress_volsmoke->enable(); } break; case SMOKE_OPTIONS: if(firecolormap_type!=FIRECOLORMAP_NOCONSTRAINT&&smoke_render_option==RENDER_SLICE) { PANEL_colormap2b->enable(); SPINNER_hrrpuv_cutoff->enable(); PANEL_colormap2b->open(); } else { PANEL_colormap2b->disable(); PANEL_colormap2b->close(); } if(smoke_render_option==RENDER_SLICE) { if(PANEL_colormap2a!=NULL) { PANEL_colormap2a->disable(); PANEL_colormap2a->close(); } if(PANEL_absorption!=NULL)PANEL_absorption->enable(); firecolormap_type=firecolormap_type_save; RADIO_use_colormap->set_int_val(firecolormap_type); RADIOBUTTON_direct->enable(); SPINNER_smoke3d_fire_halfdepth->enable(); } else { if(PANEL_colormap2a!=NULL) { PANEL_colormap2a->enable(); PANEL_colormap2a->open(); } if(PANEL_absorption!=NULL)PANEL_absorption->disable(); firecolormap_type_save=firecolormap_type; firecolormap_type=FIRECOLORMAP_CONSTRAINT; RADIO_use_colormap->set_int_val(firecolormap_type); RADIOBUTTON_direct->disable(); SPINNER_smoke3d_fire_halfdepth->disable(); } Smoke3d_CB(FIRECOLORMAP_TYPE); Update_Smoke_Type(); break; case FIRECOLORMAP_TYPE: if(firecolormap_type==FIRECOLORMAP_CONSTRAINT&&smoke_render_option==RENDER_VOLUME) { PANEL_colormap2a->open(); PANEL_colormap2a->enable(); } else { PANEL_colormap2a->close(); PANEL_colormap2a->disable(); } if(firecolormap_type!=FIRECOLORMAP_NOCONSTRAINT&&smoke_render_option==RENDER_SLICE) { PANEL_colormap2b->enable(); SPINNER_hrrpuv_cutoff->enable(); PANEL_colormap2b->open(); } else { PANEL_colormap2b->disable(); PANEL_colormap2b->close(); } if(firecolormap_type!=FIRECOLORMAP_DIRECT) { LISTBOX_smoke_colorbar->enable(); ROLLOUT_colormap3->disable(); ROLLOUT_colormap3->close(); if(fire_colorbar_index_save!=-1) { SmokeColorBarMenu(fire_colorbar_index_save); } else { SmokeColorBarMenu(fire_colorbar_index); } } else { LISTBOX_smoke_colorbar->disable(); ROLLOUT_colormap3->enable(); ROLLOUT_colormap3->open(); SPINNER_smoke3d_smoke_albedo->enable(); SPINNER_smoke3d_fire_red->enable(); SPINNER_smoke3d_fire_green->enable(); SPINNER_smoke3d_fire_blue->enable(); SPINNER_smoke3d_fire_halfdepth->enable(); fire_colorbar_index_save=fire_colorbar_index; } if(LISTBOX_smoke_colorbar->get_int_val()!=fire_colorbar_index) { LISTBOX_smoke_colorbar->set_int_val(fire_colorbar_index); } Update_Smokecolormap(smoke_render_option); break; case SMOKE_COLORBAR_LIST: SmokeColorBarMenu(fire_colorbar_index); Update_Smokecolormap(smoke_render_option); updatemenu=1; break; case SMOKETEST: update_alpha(); break; case FRAMELOADING: smoke3dframestep = smoke3dframeskip+1; updatemenu=1; break; case SAVE_SETTINGS: writeini(LOCAL_INI,NULL); break; case GLOBAL_FIRE_CUTOFF: glutPostRedisplay(); force_redisplay=1; Idle_CB(); Update_Smokecolormap(smoke_render_option); break; case FIRE_RED: case FIRE_GREEN: case FIRE_BLUE: case SMOKE_SHADE: glutPostRedisplay(); force_redisplay=1; Update_Smokecolormap(smoke_render_option); Idle_CB(); break; case FIRE_HALFDEPTH: for(i=0; i<nmeshes; i++) { mesh *meshi; meshi = meshinfo + i; meshi->update_firehalfdepth=1; } glutPostRedisplay(); force_redisplay=1; Update_Smokecolormap(smoke_render_option); Idle_CB(); break; #ifdef pp_GPU case SMOKE_RTHICK: smoke3d_thick = log_base2(smoke3d_rthick); glutPostRedisplay(); force_redisplay=1; Idle_CB(); break; #else case SMOKE_THICK: glutPostRedisplay(); force_redisplay=1; Idle_CB(); break; #endif #ifdef pp_CULL case CULL_PORTSIZE: initcull(cullsmoke); break; case CULL_SMOKE: initcull(cullsmoke); break; #endif case VOL_NGRID: glutPostRedisplay(); break; case VOL_SMOKE: { volrenderdata *vr; vr = &meshinfo->volrenderinfo; if(vr!=NULL&&vr->smokeslice!=NULL&&vr->smokeslice->slicetype==SLICE_CENTER) { if(usegpu==1&&combine_meshes==1) { combine_meshes=0; update_combine_meshes(); Smoke3d_CB(COMBINE_MESHES); } if(usegpu==0&&combine_meshes==0) { combine_meshes=1; update_combine_meshes(); Smoke3d_CB(COMBINE_MESHES); } } } if(smoke_render_option==RENDER_SLICE) { #ifdef pp_GPU if(usegpu==1) { RADIO_skipframes->set_int_val(0); RADIO_skipframes->disable(); #ifdef pp_CULL if(cullactive==1) { CHECKBOX_smokecullflag->enable(); } SPINNER_cull_portsize->enable(); CHECKBOX_show_cullports->enable(); #endif } else { RADIO_skipframes->enable(); #ifdef pp_CULL CHECKBOX_smokecullflag->disable(); SPINNER_cull_portsize->disable(); CHECKBOX_show_cullports->disable(); #endif } #else RADIO_skipframes->enable(); #endif } break; default: #ifdef _DEBUG abort(); #endif break; } }
void update_ShowScene(void){ if(update_playmovie==1){ enable_disable_playmovie(); update_playmovie = 0; } update_render_start_button(); if(update_makemovie == 1)MakeMovie(); if(compute_fed == 1)DefineAllFEDs(); if(restart_time == 1){ restart_time = 0; reset_itimes0(); } if(loadfiles_at_startup==1&&update_load_Files == 1){ load_Files(); } if(update_startup_view == 1){ camera *ca; ca = get_camera(label_startup_view); if(ca != NULL){ ResetMenu(ca->view_id); } update_rotation_center = 0; update_rotation_center_ini = 0; update_startup_view = 0; } if(menusmooth == 1 && smoothing_blocks == 0 && updatesmoothblocks == 1){ smooth_blockages(); } if(update_tourlist == 1){ Update_Tourlist(); } if(update_gslice == 1){ update_gslice_parms(); } #define MESH_LIST 4 if(update_rotation_center == 1){ camera_current->rotation_index = glui_rotation_index; Motion_CB(MESH_LIST); update_rotation_center = 0; } if(update_rotation_center_ini == 1){ camera_current->rotation_index = glui_rotation_index_ini; Motion_CB(MESH_LIST); update_rotation_center_ini = 0; } if(camera_current->dirty == 1){ update_camera(camera_current); } if(updateclipvals == 1){ clip2cam(camera_current); update_clip_all(); updateclipvals = 0; } if(update_selectedtour_index == 1){ update_tourindex(); } if(trainer_mode == 1 && fontindex != LARGE_FONT)FontMenu(LARGE_FONT); if(updateindexcolors == 1){ UpdateIndexColors(); } if(force_isometric == 1){ force_isometric = 0; projection_type = 1; camera_current->projection_type = projection_type; ZoomMenu(UPDATE_PROJECTION); } if(convert_ini == 1){ writeini(SCRIPT_INI, ini_to); exit(0); } Update_Show(); if(global_times!=NULL&&updateUpdateFrameRateMenu==1)FrameRateMenu(frameratevalue); if(updatefaces==1)UpdateFaces(); if(updatefacelists==1)UpdateFacelists(); }