static void update_status_line(struct status_line *status) { int i; for (i = 0; i < status->num; ++i) { const struct block *config_block = status->blocks + i; struct block *updated_block = status->updated_blocks + i; /* Skip static block */ if (!*config_block->command) { bdebug(config_block, "no command, skipping"); continue; } /* If a block needs an update, reset and execute it */ if (need_update(updated_block)) { struct click click; /* save click info and restore config values */ memcpy(&click, &updated_block->click, sizeof(struct click)); memcpy(updated_block, config_block, sizeof(struct block)); memcpy(&updated_block->click, &click, sizeof(struct click)); block_update(updated_block); /* clear click info */ memset(&updated_block->click, 0, sizeof(struct click)); } } if (caughtsig > 0) caughtsig = 0; }
IC void CStalkerAnimationManager::update_tracks () { if (!need_update()) return; m_skeleton_animated->UpdateTracks (); }
void control::need_parent_update() { if (_parent){ _parent->need_update(); } else{ need_update(); // root only } }
void container::displayed(bool displayed_) { _b_displayed = displayed_; for(int i = 0; i < _items.size(); i++){ _items[i]->set_visible_by_parent(control::is_visible()); } need_update(); }
int bunsan_pm_repository_need_update(bunsan_pm_repository repo, cstring package, cstring destination, time_t lifetime, bool *need, string error_msg, size_type error_size) { const auto r = static_cast<bunsan::pm::compatibility::repository *>(repo); BOOST_ASSERT(r); BOOST_ASSERT(need); return wrap_cpp( [&] { *need = r->need_update(package, destination, lifetime); }, error_msg, error_size); }
void CEnemyManager::try_change_enemy () { const CEntityAlive *previous_selected = selected(); bool only_wounded; process_wounded (only_wounded); if (!need_update(only_wounded)) return; inherited::update (); if (selected() != previous_selected) { if (selected() && previous_selected) on_enemy_change (previous_selected); else m_last_enemy_change = Device.dwTimeGlobal; } if (selected() != previous_selected) m_object->on_enemy_change (previous_selected); }
void BufferRefImage::update() { if (!need_update()) return; cerr << "BufferRefImage: Updated!\n"; assert (_view != 0); VIEWimpl *impl = _view->impl(); assert(impl != 0); _observing = false; impl->draw_setup(); impl->draw_frame(); _observing=true; glViewport(0,0,_width,_height); copy_to_ram(); _dirty = 0; }
int config_read(int all, char *force_ver, char *base_dir, char *conf_file) { int r; if (modpath != NULL) return 0; /* already initialized */ if (uname(&uts_info) < 0) { error("Failed to find kernel name information"); return -1; } if (access(MODUTILS_MACROS, R_OK) == 0) { r = do_read(all, force_ver, base_dir, MODUTILS_MACROS, 0); r = do_read(all, force_ver, "", conf_file, 1); } else { r = do_read(all, force_ver, base_dir, conf_file, 0); } if (quick && !r && !need_update (force_ver, base_dir)) exit (0); return r; }
void update_status_line(struct status_line *status) { int i; for (i = 0; i < status->num; ++i) { const struct block *config_block = status->blocks + i; struct block *updated_block = status->updated_blocks + i; /* Skip static block */ if (!*config_block->command) continue; /* If a block needs an update, reset and execute it */ if (need_update(updated_block)) { memcpy(updated_block, config_block, sizeof(struct block)); if (update_block(updated_block)) fprintf(stderr, "failed to update block %s\n", updated_block->name); } } if (caughtsig > 0) caughtsig = 0; }
void Case::mouseReleaseEvent(QMouseEvent *event) { if(left_click ==true && right_click == false) { hidden = false; if(!flag) { if(etat == 0) emit is_empty(num); else if(etat == 9) emit is_mine(num); } } else if(left_click ==false && right_click == true) { if(hidden == false && flag == false) return; if(flag) { flag = false; hidden = true; emit deflag_mine(); } else { flag = true; hidden = false; emit flag_mine(); } } else if(left_click ==true && right_click == true) emit is_double_clicked(num); left_click = false; right_click = false; emit need_update(); }
bool CUpdator::DownLoad() { //get local update path tstring targpath = m_config->GetLocalUpdatePath(); //get update list map<tstring,tstring> updatelist = m_pverinfo->GetUpdateList(m_services); //notify l int usize = updatelist.size(); Event need_update(E_TOTALFILES,(void*)this,0,usize); Notify(need_update); // bool res = find_if(updatelist.begin(),updatelist.end(),boost::bind(&CUpdator::DownLoadFile,this,_1,targpath)) == updatelist.end(); struct dinfo{ char tarPath[256]; bool result; }; dinfo df={0}; df.result = res; SafeStrCpy(df.tarPath,targpath.c_str()); Event download_e(E_DOWNLOAD,0,(void*)&df,sizeof(df)); Notify(download_e); return res; }
void HaloRefImage::update() { // render the scene and read pixels to main memory // and/or texture memory if (!need_update()) return; static bool debug = Config::get_var_bool("DEBUG_HALO_UPDATE",false); err_adv(debug, "HaloRefImage::update: updating..."); check_resize(); glPushAttrib( GL_LINE_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT | GL_VIEWPORT | // XXX - not needed GL_COLOR_BUFFER_BIT | // XXX - not needed GL_TEXTURE_BIT // XXX - not needed ); // XXX - remove this: assert(_view && _view == VIEW::peek()); // set up lights _view->setup_lights(); // set default state // XXX - check glLineWidth(1.0); // GL_LINE_BIT glDepthMask(GL_TRUE); // GL_DEPTH_BUFFER_BIT glDepthFunc(GL_LESS); // GL_DEPTH_BUFFER_BIT glEnable(GL_DEPTH_TEST); // GL_DEPTH_BUFFER_BIT glDisable(GL_NORMALIZE); // GL_ENABLE_BIT glDisable(GL_BLEND); // GL_ENABLE_BIT glEnable(GL_CULL_FACE); // GL_ENABLE_BIT glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); glEnable(GL_COLOR_MATERIAL); // GL_ENABLE_BIT glShadeModel(GL_SMOOTH); // GL_LIGHTING_BIT // set viewport to ref image size: glViewport(0,0,_width,_height); // GL_VIEWPORT_BIT draw_objects(_view->drawn()); // copy image to main memory or texture memory // (or both) as requested: if (_update_main_mem) { if (use_fbos) glBindFramebuffer(GL_READ_FRAMEBUFFER, _fbo); else glReadBuffer(GL_AUX0); //because the image is constructed in aux0 copy_to_ram(); if (use_fbos) glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); else glReadBuffer(GL_BACK); } if (_update_tex_mem) copy_to_tex_aux(); //copies from aux0 // clear update flags until next update request is made: _update_main_mem = _update_tex_mem = false; glPopAttrib(); // restore viewport to window size: int w, h; _view->get_size(w,h); glViewport(0,0,w,h); }
tracking_window::tracking_window(QWidget *parent,ODFModel* new_handle,bool handle_release_) : QMainWindow(parent),handle(new_handle),handle_release(handle_release_), ui(new Ui::tracking_window),scene(*this,new_handle),slice(new_handle) { ODFModel* odf_model = (ODFModel*)handle; FibData& fib_data = odf_model->fib_data; odf_size = fib_data.fib.odf_table.size(); odf_face_size = fib_data.fib.odf_faces.size(); has_odfs = fib_data.fib.has_odfs() ? 1:0; // check whether first index is "fa0" is_dti = (fib_data.view_item[0].name[0] == 'f'); ui->setupUi(this); { setGeometry(10,10,800,600); ui->regionDockWidget->setMinimumWidth(0); ui->dockWidget->setMinimumWidth(0); ui->dockWidget_3->setMinimumWidth(0); ui->renderingLayout->addWidget(renderWidget = new RenderingTableWidget(*this,ui->renderingWidgetHolder,has_odfs)); ui->centralLayout->insertWidget(1,glWidget = new GLWidget(renderWidget->getData("anti_aliasing").toInt(), *this,renderWidget,ui->centralwidget)); ui->verticalLayout_3->addWidget(regionWidget = new RegionTableWidget(*this,ui->regionDockWidget)); ui->tractverticalLayout->addWidget(tractWidget = new TractTableWidget(*this,ui->TractWidgetHolder)); ui->graphicsView->setScene(&scene); ui->graphicsView->setCursor(Qt::CrossCursor); scene.statusbar = ui->statusbar; color_bar.reset(new color_bar_dialog(this)); } // setup fa threshold { for(int index = 0;index < fib_data.fib.index_name.size();++index) ui->tracking_index->addItem((fib_data.fib.index_name[index]+" threshold").c_str()); ui->tracking_index->setCurrentIndex(0); ui->step_size->setValue(fib_data.vs[0]/2.0); } // setup sliders { slice_no_update = true; ui->SagSlider->setRange(0,slice.geometry[0]-1); ui->CorSlider->setRange(0,slice.geometry[1]-1); ui->AxiSlider->setRange(0,slice.geometry[2]-1); ui->SagSlider->setValue(slice.slice_pos[0]); ui->CorSlider->setValue(slice.slice_pos[1]); ui->AxiSlider->setValue(slice.slice_pos[2]); ui->glSagBox->setRange(0,slice.geometry[0]-1); ui->glCorBox->setRange(0,slice.geometry[1]-1); ui->glAxiBox->setRange(0,slice.geometry[2]-1); ui->glSagBox->setValue(slice.slice_pos[0]); ui->glCorBox->setValue(slice.slice_pos[1]); ui->glAxiBox->setValue(slice.slice_pos[2]); slice_no_update = false; on_SliceModality_currentIndexChanged(0); for (unsigned int index = 0;index < fib_data.view_item.size(); ++index) { ui->sliceViewBox->addItem(fib_data.view_item[index].name.c_str()); if(fib_data.view_item[index].is_overlay) ui->overlay->addItem(fib_data.view_item[index].name.c_str()); } ui->sliceViewBox->setCurrentIndex(0); ui->overlay->setCurrentIndex(0); if(ui->overlay->count() == 1) ui->overlay->hide(); } is_qsdr = !handle->fib_data.trans_to_mni.empty(); // setup atlas if(!fa_template_imp.I.empty() && fib_data.vs[0] > 0.5 && !is_qsdr) { mi3_arg.scaling[0] = slice.voxel_size[0] / std::fabs(fa_template_imp.tran[0]); mi3_arg.scaling[1] = slice.voxel_size[1] / std::fabs(fa_template_imp.tran[5]); mi3_arg.scaling[2] = slice.voxel_size[2] / std::fabs(fa_template_imp.tran[10]); image::reg::align_center(slice.source_images,fa_template_imp.I,mi3_arg); mi3.reset(new manual_alignment(this,slice.source_images,fa_template_imp.I,mi3_arg)); is_qsdr = false; } else ui->actionManual_Registration->setEnabled(false); ui->actionConnectometry->setEnabled(handle->fib_data.fib.has_odfs() && is_qsdr); for(int index = 0;index < atlas_list.size();++index) ui->atlasListBox->addItem(atlas_list[index].name.c_str()); { if(is_dti) ui->actionQuantitative_anisotropy_QA->setText("Save FA..."); for (int index = fib_data.other_mapping_index; index < fib_data.view_item.size(); ++index) { std::string& name = fib_data.view_item[index].name; QAction* Item = new QAction(this); Item->setText(QString("Save %1...").arg(name.c_str())); Item->setData(QString(name.c_str())); Item->setVisible(true); connect(Item, SIGNAL(triggered()),tractWidget, SLOT(save_tracts_data_as())); ui->menuSave->addAction(Item); } } // opengl { connect(renderWidget->treemodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)), glWidget,SLOT(updateGL())); connect(ui->tbDefaultParam,SIGNAL(clicked()),renderWidget,SLOT(setDefault())); connect(ui->tbDefaultParam,SIGNAL(clicked()),glWidget,SLOT(updateGL())); connect(ui->glSagSlider,SIGNAL(valueChanged(int)),this,SLOT(glSliderValueChanged())); connect(ui->glCorSlider,SIGNAL(valueChanged(int)),this,SLOT(glSliderValueChanged())); connect(ui->glAxiSlider,SIGNAL(valueChanged(int)),this,SLOT(glSliderValueChanged())); connect(ui->glSagCheck,SIGNAL(stateChanged(int)),glWidget,SLOT(updateGL())); connect(ui->glCorCheck,SIGNAL(stateChanged(int)),glWidget,SLOT(updateGL())); connect(ui->glAxiCheck,SIGNAL(stateChanged(int)),glWidget,SLOT(updateGL())); connect(ui->glSagView,SIGNAL(clicked()),this,SLOT(on_SagView_clicked())); connect(ui->glCorView,SIGNAL(clicked()),this,SLOT(on_CorView_clicked())); connect(ui->glAxiView,SIGNAL(clicked()),this,SLOT(on_AxiView_clicked())); connect(ui->addSlices,SIGNAL(clicked()),this,SLOT(on_actionInsert_T1_T2_triggered())); connect(ui->actionAdd_surface,SIGNAL(triggered()),glWidget,SLOT(addSurface())); connect(ui->SliceModality,SIGNAL(currentIndexChanged(int)),glWidget,SLOT(updateGL())); connect(ui->actionSave_Screen,SIGNAL(triggered()),glWidget,SLOT(catchScreen())); connect(ui->actionSave_3D_screen_in_high_resolution,SIGNAL(triggered()),glWidget,SLOT(catchScreen2())); connect(ui->actionLoad_Camera,SIGNAL(triggered()),glWidget,SLOT(loadCamera())); connect(ui->actionSave_Camera,SIGNAL(triggered()),glWidget,SLOT(saveCamera())); connect(ui->actionLoad_mapping,SIGNAL(triggered()),glWidget,SLOT(loadMapping())); connect(ui->actionSave_mapping,SIGNAL(triggered()),glWidget,SLOT(saveMapping())); connect(ui->actionSave_Rotation_Images,SIGNAL(triggered()),glWidget,SLOT(saveRotationSeries())); connect(ui->actionSave_Left_Right_3D_Image,SIGNAL(triggered()),glWidget,SLOT(saveLeftRight3DImage())); } // scene view { connect(ui->SagSlider,SIGNAL(valueChanged(int)),this,SLOT(SliderValueChanged())); connect(ui->CorSlider,SIGNAL(valueChanged(int)),this,SLOT(SliderValueChanged())); connect(ui->AxiSlider,SIGNAL(valueChanged(int)),this,SLOT(SliderValueChanged())); connect(&scene,SIGNAL(need_update()),&scene,SLOT(show_slice())); connect(&scene,SIGNAL(need_update()),glWidget,SLOT(updateGL())); connect(ui->fa_threshold,SIGNAL(valueChanged(double)),&scene,SLOT(show_slice())); connect(ui->contrast,SIGNAL(valueChanged(int)),&scene,SLOT(show_slice())); connect(ui->offset,SIGNAL(valueChanged(int)),&scene,SLOT(show_slice())); connect(ui->show_fiber,SIGNAL(clicked()),&scene,SLOT(show_slice())); connect(ui->show_pos,SIGNAL(clicked()),&scene,SLOT(show_slice())); connect(ui->show_lr,SIGNAL(clicked()),&scene,SLOT(show_slice())); connect(ui->zoom,SIGNAL(valueChanged(double)),&scene,SLOT(show_slice())); connect(ui->zoom,SIGNAL(valueChanged(double)),&scene,SLOT(center())); connect(ui->actionAxial_View,SIGNAL(triggered()),this,SLOT(on_AxiView_clicked())); connect(ui->actionCoronal_View,SIGNAL(triggered()),this,SLOT(on_CorView_clicked())); connect(ui->actionSagittal_view,SIGNAL(triggered()),this,SLOT(on_SagView_clicked())); connect(ui->actionSave_ROI_Screen,SIGNAL(triggered()),&scene,SLOT(catch_screen())); connect(ui->actionSave_Anisotrpy_Map_as,SIGNAL(triggered()),&scene,SLOT(save_slice_as())); connect(ui->overlay,SIGNAL(currentIndexChanged(int)),this,SLOT(on_sliceViewBox_currentIndexChanged(int))); } // regions { connect(regionWidget,SIGNAL(need_update()),&scene,SLOT(show_slice())); connect(regionWidget,SIGNAL(need_update()),glWidget,SLOT(updateGL())); connect(ui->whole_brain,SIGNAL(clicked()),regionWidget,SLOT(whole_brain())); connect(ui->view_style,SIGNAL(currentIndexChanged(int)),&scene,SLOT(show_slice())); //atlas connect(ui->addRegionFromAtlas,SIGNAL(clicked()),regionWidget,SLOT(add_atlas())); connect(ui->actionNewRegion,SIGNAL(triggered()),regionWidget,SLOT(new_region())); connect(ui->actionOpenRegion,SIGNAL(triggered()),regionWidget,SLOT(load_region())); connect(ui->actionSaveRegionAs,SIGNAL(triggered()),regionWidget,SLOT(save_region())); connect(ui->actionSave_Voxel_Data_As,SIGNAL(triggered()),regionWidget,SLOT(save_region_info())); connect(ui->actionDeleteRegion,SIGNAL(triggered()),regionWidget,SLOT(delete_region())); connect(ui->actionDeleteRegionAll,SIGNAL(triggered()),regionWidget,SLOT(delete_all_region())); // actions connect(ui->actionShift_X,SIGNAL(triggered()),regionWidget,SLOT(action_shiftx())); connect(ui->actionShift_X_2,SIGNAL(triggered()),regionWidget,SLOT(action_shiftnx())); connect(ui->actionShift_Y,SIGNAL(triggered()),regionWidget,SLOT(action_shifty())); connect(ui->actionShift_Y_2,SIGNAL(triggered()),regionWidget,SLOT(action_shiftny())); connect(ui->actionShift_Z,SIGNAL(triggered()),regionWidget,SLOT(action_shiftz())); connect(ui->actionShift_Z_2,SIGNAL(triggered()),regionWidget,SLOT(action_shiftnz())); connect(ui->actionFlip_X,SIGNAL(triggered()),regionWidget,SLOT(action_flipx())); connect(ui->actionFlip_Y,SIGNAL(triggered()),regionWidget,SLOT(action_flipy())); connect(ui->actionFlip_Z,SIGNAL(triggered()),regionWidget,SLOT(action_flipz())); connect(ui->actionThreshold,SIGNAL(triggered()),regionWidget,SLOT(action_threshold())); connect(ui->actionSmoothing,SIGNAL(triggered()),regionWidget,SLOT(action_smoothing())); connect(ui->actionErosion,SIGNAL(triggered()),regionWidget,SLOT(action_erosion())); connect(ui->actionDilation,SIGNAL(triggered()),regionWidget,SLOT(action_dilation())); connect(ui->actionNegate,SIGNAL(triggered()),regionWidget,SLOT(action_negate())); connect(ui->actionDefragment,SIGNAL(triggered()),regionWidget,SLOT(action_defragment())); connect(ui->actionCheck_all_regions,SIGNAL(triggered()),regionWidget,SLOT(check_all())); connect(ui->actionUnckech_all_regions,SIGNAL(triggered()),regionWidget,SLOT(uncheck_all())); connect(ui->actionWhole_brain_seeding,SIGNAL(triggered()),regionWidget,SLOT(whole_brain())); connect(ui->actionRegion_statistics,SIGNAL(triggered()),regionWidget,SLOT(show_statistics())); } // tracts { connect(ui->perform_tracking,SIGNAL(clicked()),tractWidget,SLOT(start_tracking())); connect(ui->stopTracking,SIGNAL(clicked()),tractWidget,SLOT(stop_tracking())); connect(tractWidget,SIGNAL(need_update()),glWidget,SLOT(makeTracts())); connect(tractWidget,SIGNAL(need_update()),glWidget,SLOT(updateGL())); connect(glWidget,SIGNAL(edited()),tractWidget,SLOT(edit_tracts())); connect(glWidget,SIGNAL(region_edited()),glWidget,SLOT(updateGL())); connect(glWidget,SIGNAL(region_edited()),&scene,SLOT(show_slice())); connect(ui->actionOpenTract,SIGNAL(triggered()),tractWidget,SLOT(load_tracts())); connect(ui->actionMerge_All,SIGNAL(triggered()),tractWidget,SLOT(merge_all())); connect(ui->actionCopyTrack,SIGNAL(triggered()),tractWidget,SLOT(copy_track())); connect(ui->actionDeleteTract,SIGNAL(triggered()),tractWidget,SLOT(delete_tract())); connect(ui->actionDeleteTractAll,SIGNAL(triggered()),tractWidget,SLOT(delete_all_tract())); connect(ui->actionOpen_Colors,SIGNAL(triggered()),tractWidget,SLOT(load_tracts_color())); connect(ui->actionSave_Tracts_Colors_As,SIGNAL(triggered()),tractWidget,SLOT(save_tracts_color_as())); connect(ui->actionUndo,SIGNAL(triggered()),tractWidget,SLOT(undo_tracts())); connect(ui->actionRedo,SIGNAL(triggered()),tractWidget,SLOT(redo_tracts())); connect(ui->actionTrim,SIGNAL(triggered()),tractWidget,SLOT(trim_tracts())); connect(ui->actionSet_Color,SIGNAL(triggered()),tractWidget,SLOT(set_color())); connect(ui->actionK_means,SIGNAL(triggered()),tractWidget,SLOT(clustering_kmeans())); connect(ui->actionEM,SIGNAL(triggered()),tractWidget,SLOT(clustering_EM())); connect(ui->actionHierarchical,SIGNAL(triggered()),tractWidget,SLOT(clustering_hie())); connect(ui->actionOpen_Cluster_Labels,SIGNAL(triggered()),tractWidget,SLOT(open_cluster_label())); //setup menu connect(ui->actionSaveTractAs,SIGNAL(triggered()),tractWidget,SLOT(save_tracts_as())); connect(ui->actionSave_All_Tracts_As,SIGNAL(triggered()),tractWidget,SLOT(save_all_tracts_as())); connect(ui->actionQuantitative_anisotropy_QA,SIGNAL(triggered()),tractWidget,SLOT(save_fa_as())); connect(ui->actionSave_End_Points_As,SIGNAL(triggered()),tractWidget,SLOT(save_end_point_as())); connect(ui->actionStatistics,SIGNAL(triggered()),tractWidget,SLOT(show_tracts_statistics())); connect(ui->track_up,SIGNAL(clicked()),tractWidget,SLOT(move_up())); connect(ui->track_down,SIGNAL(clicked()),tractWidget,SLOT(move_down())); } // recall the setting { QSettings settings; if(!default_geo.size()) default_geo = saveGeometry(); if(!default_state.size()) default_state = saveState(); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("state").toByteArray()); ui->turning_angle->setValue(settings.value("turning_angle",60).toDouble()); ui->smoothing->setValue(settings.value("smoothing",0.0).toDouble()); ui->min_length->setValue(settings.value("min_length",0.0).toDouble()); ui->max_length->setValue(settings.value("max_length",500).toDouble()); ui->tracking_method->setCurrentIndex(settings.value("tracking_method",0).toInt()); ui->seed_plan->setCurrentIndex(settings.value("seed_plan",0).toInt()); ui->initial_direction->setCurrentIndex(settings.value("initial_direction",0).toInt()); ui->interpolation->setCurrentIndex(settings.value("interpolation",0).toInt()); ui->tracking_plan->setCurrentIndex(settings.value("tracking_plan",0).toInt()); ui->track_count->setValue(settings.value("track_count",2000).toInt()); ui->thread_count->setCurrentIndex(settings.value("thread_count",0).toInt()); ui->glSagCheck->setChecked(settings.value("SagSlice",1).toBool()); ui->glCorCheck->setChecked(settings.value("CorSlice",1).toBool()); ui->glAxiCheck->setChecked(settings.value("AxiSlice",1).toBool()); ui->RenderingQualityBox->setCurrentIndex(settings.value("RenderingQuality",1).toInt()); ui->view_style->setCurrentIndex((settings.value("view_style",0).toInt())); ui->RAS->setChecked(settings.value("RAS",0).toBool()); } { scene.center(); slice_no_update = false; copy_target = 0; } on_glAxiView_clicked(); if(scene.neurology_convention) on_glAxiView_clicked(); qApp->installEventFilter(this); }