// **************************************************************************** // Method: XMLEditFunctions::UpdateWindowSingleItem // // Purpose: // Update the window based on the state a single item in the list. // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Brad Whitlock, Thu Mar 6 15:50:51 PST 2008 // Added target. // // Brad Whitlock, Mon Apr 28 16:08:06 PDT 2008 // Added access. // // Cyrus Harrison, Thu May 15 16:00:46 PDT 2008 // First pass at porting to Qt 4.4.0 // // **************************************************************************** void XMLEditFunctions::UpdateWindowSingleItem() { BlockAllSignals(true); Attribute *a = xmldoc->attribute; int index = functionlist->currentRow(); if (index == -1) { name->setText(""); typeGroup->button(0)->setChecked(false); member->setChecked(false); target->setText(""); declaration->setText(""); definition->setText(""); access->setCurrentIndex(0); } else { Function *f = a->functions[index]; name->setText(f->name); typeGroup->button(f->user ? 0 : 1)->setChecked(true); target->setText(f->target); declaration->setText(f->decl); definition->setText(f->def); member->setChecked(f->member); access->setCurrentIndex((int)f->accessType); } UpdateWindowSensitivity(); BlockAllSignals(false); }
void PanelPointSet::DoIdle() { // update action status BlockAllSignals( true ); BlockAllSignals( false ); }
// **************************************************************************** // Method: XMLEditConstants::UpdateWindowSingleItem // // Purpose: // Update the window based on the state a single item in the list. // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Brad Whitlock, Thu Mar 6 16:12:45 PST 2008 // Added targets. // // Cyrus Harrison, Thu May 15 16:00:46 PDT 200 // First pass at porting to Qt 4.4.0 // // **************************************************************************** void XMLEditConstants::UpdateWindowSingleItem() { BlockAllSignals(true); Attribute *a = xmldoc->attribute; int index = constantlist->currentRow(); if (index == -1) { target->setText(""); name->setText(""); member->setChecked(false); declaration->setText(""); definition->setText(""); } else { Constant *c = a->constants[index]; target->setText(c->target); name->setText(c->name); declaration->setText(c->decl); definition->setText(c->def); member->setChecked(c->member); } UpdateWindowSensitivity(); BlockAllSignals(false); }
void VisibilityToolPanel::RestoreState() { SceneEditor2* sceneEditor = GetActiveScene(); bool enabled = sceneEditor->visibilityToolSystem->IsLandscapeEditingEnabled(); int32 brushSize = AreaSizeSystemToUI(sceneEditor->visibilityToolSystem->GetBrushSize()); VisibilityToolSystem::eVisibilityToolState state = sceneEditor->visibilityToolSystem->GetState(); int32 areaSizeMin = DEF_AREA_MIN_SIZE; int32 areaSizeMax = DEF_AREA_MAX_SIZE; KeyedArchive* customProperties = GetCustomPropertiesArchieve(sceneEditor); if (customProperties) { areaSizeMin = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MIN, DEF_AREA_MIN_SIZE); areaSizeMax = customProperties->GetInt32(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_MAX, DEF_AREA_MAX_SIZE); } SetWidgetsState(enabled); BlockAllSignals(true); sliderWidgetAreaSize->SetRangeMin(areaSizeMin); sliderWidgetAreaSize->SetRangeMax(areaSizeMax); sliderWidgetAreaSize->SetValue(brushSize); buttonSetVisibilityPoint->setChecked(state == VisibilityToolSystem::VT_STATE_SET_POINT); buttonSetVisibilityArea->setChecked(state == VisibilityToolSystem::VT_STATE_SET_AREA); BlockAllSignals(!enabled); }
void VisibilityToolPanel::InitUI() { QVBoxLayout* layout = new QVBoxLayout(this); buttonSetVisibilityPoint = new QPushButton(this); buttonSetVisibilityArea = new QPushButton(this); buttonSaveTexture = new QPushButton(this); sliderWidgetAreaSize = new SliderWidget(this); QSpacerItem* spacer = new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Expanding); QVBoxLayout* layoutBrushSize = new QVBoxLayout(); QLabel* labelBrushSize = new QLabel(); labelBrushSize->setText(ResourceEditor::VISIBILITY_TOOL_AREA_SIZE_CAPTION.c_str()); layoutBrushSize->addWidget(labelBrushSize); layoutBrushSize->addWidget(sliderWidgetAreaSize); layout->addWidget(buttonSetVisibilityPoint); layout->addLayout(layoutBrushSize); layout->addWidget(buttonSetVisibilityArea); layout->addWidget(buttonSaveTexture); layout->addSpacerItem(spacer); setLayout(layout); SetWidgetsState(false); BlockAllSignals(true); sliderWidgetAreaSize->Init(false, DEF_AREA_MAX_SIZE, DEF_AREA_MIN_SIZE, DEF_AREA_MIN_SIZE); sliderWidgetAreaSize->SetRangeBoundaries(ResourceEditor::BRUSH_MIN_BOUNDARY, ResourceEditor::BRUSH_MAX_BOUNDARY); buttonSetVisibilityPoint->setText(ResourceEditor::VISIBILITY_TOOL_SET_POINT_CAPTION.c_str()); buttonSetVisibilityPoint->setCheckable(true); buttonSetVisibilityArea->setText(ResourceEditor::VISIBILITY_TOOL_SET_AREA_CAPTION.c_str()); buttonSetVisibilityArea->setCheckable(true); buttonSaveTexture->setText(ResourceEditor::VISIBILITY_TOOL_SAVE_TEXTURE_CAPTION.c_str()); }
void PanelROI::DoIdle() { // update action status BlockAllSignals( true ); QTreeWidgetItem* item = ui->treeWidgetLayers->currentItem(); LayerROI* layer = NULL; if ( item ) { layer = qobject_cast<LayerROI*>( item->data(0, Qt::UserRole).value<QObject*>() ); } int nItemIndex = ui->treeWidgetLayers->indexOfTopLevelItem(item); ui->actionMoveLayerUp->setEnabled( item && !layer->IsLocked() && ui->treeWidgetLayers->topLevelItemCount() > 1 && nItemIndex != 0 ); ui->actionMoveLayerDown->setEnabled( item && !layer->IsLocked() && ui->treeWidgetLayers->topLevelItemCount() > 1 && nItemIndex < ui->treeWidgetLayers->topLevelItemCount()-1 ); BlockAllSignals( false ); }
void PanelROI::DoUpdateWidgets() { BlockAllSignals( true ); for ( int i = 0; i < ui->treeWidgetLayers->topLevelItemCount(); i++ ) { QTreeWidgetItem* item = ui->treeWidgetLayers->topLevelItem( i ); Layer* layer = qobject_cast<Layer*>( item->data(0, Qt::UserRole).value<QObject*>() ); if ( layer ) { item->setCheckState( 0, (layer->IsVisible() ? Qt::Checked : Qt::Unchecked) ); } } LayerROI* layer = GetCurrentLayer<LayerROI*>(); for ( int i = 0; i < this->allWidgets.size(); i++ ) { if ( allWidgets[i] != ui->toolbar && allWidgets[i]->parentWidget() != ui->toolbar ) { allWidgets[i]->setEnabled(layer); } } ui->lineEditFileName->clear(); if ( layer ) { ui->sliderOpacity->setValue( (int)( layer->GetProperty()->GetOpacity() * 100 ) ); ChangeDoubleSpinBoxValue( ui->doubleSpinBoxOpacity, layer->GetProperty()->GetOpacity() ); double* rgb = layer->GetProperty()->GetColor(); ui->colorPickerColor->setCurrentColor( QColor( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); ui->lineEditFileName->setText( MyUtils::Win32PathProof(layer->GetFileName()) ); ui->lineEditFileName->setCursorPosition( ui->lineEditFileName->text().size() ); } ui->doubleSpinBoxOpacity->setEnabled( layer ); ui->colorPickerColor->setEnabled( layer ); ui->sliderOpacity->setEnabled( layer ); ui->labelColor->setEnabled( layer ); ui->labelFileName->setEnabled( layer ); ui->lineEditFileName->setEnabled( layer ); ui->labelOpacity->setEnabled( layer ); BlockAllSignals( false ); }
// **************************************************************************** // Method: XMLEditFunctions::nameTextChanged // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Brad Whitlock, Thu Mar 6 15:55:17 PST 2008 // Added support for multiple targets. // // Cyrus Harrison, Thu May 15 16:00:46 PDT 2008 // First pass at porting to Qt 4.4.0 // // **************************************************************************** void XMLEditFunctions::nameTextChanged(const QString &text) { Attribute *a = xmldoc->attribute; int index = functionlist->currentRow(); if (index == -1) return; Function *f = a->functions[index]; QString newname = text.trimmed(); f->name = newname; if(CountFunctions(newname) > 1) { newname += "["; newname += f->target; newname += "]"; } BlockAllSignals(true); functionlist->item(index)->setText(newname); BlockAllSignals(false); }
// **************************************************************************** // Method: XMLEditConstants::nameTextChanged // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Brad Whitlock, Thu Mar 6 16:12:45 PST 2008 // Added targets. // // Cyrus Harrison, Thu May 15 16:00:46 PDT 200 // First pass at porting to Qt 4.4.0 // // **************************************************************************** void XMLEditConstants::nameTextChanged(const QString &text) { Attribute *a = xmldoc->attribute; int index = constantlist->currentRow(); if (index == -1) return; Constant *c = a->constants[index]; QString newname = text.trimmed(); c->name = newname; if(CountConstants(newname) > 1) { newname += "["; newname += c->target; newname += "]"; } BlockAllSignals(true); constantlist->item(index)->setText(text); BlockAllSignals(false); }
// **************************************************************************** // Method: XMLEditConstants::UpdateWindowContents // // Purpose: // Update the window based on the current state. // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Brad Whitlock, Thu Mar 6 16:12:45 PST 2008 // Added targets. // // Cyrus Harrison, Thu May 15 16:00:46 PDT 200 // First pass at porting to Qt 4.4.0 // // **************************************************************************** void XMLEditConstants::UpdateWindowContents() { BlockAllSignals(true); Attribute *a = xmldoc->attribute; constantlist->clear(); for (size_t i=0; i<a->constants.size(); i++) { if(CountConstants(a->constants[i]->name) > 1) { QString id = QString("%1 [%2]").arg(a->constants[i]->name).arg(a->constants[i]->target); constantlist->addItem(id); } else constantlist->addItem(a->constants[i]->name); } BlockAllSignals(false); UpdateWindowSingleItem(); }
// **************************************************************************** // Method: XMLEditAttribute::UpdateWindowContents // // Purpose: // Update the window based on the current state. // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Brad Whitlock, Wed Mar 7 16:06:43 PST 2007 // Added keyframe. // // Brad Whitlock, Thu Mar 6 14:51:29 PST 2008 // Adapted to newer CodeFile implementation. // // Mark C. Miller, Wed Aug 26 11:03:19 PDT 2009 // Added support for custom base class for derived state objects. // **************************************************************************** void XMLEditAttribute::UpdateWindowContents() { BlockAllSignals(true); bool plugin = (xmldoc->docType == "Plugin"); Attribute *a = xmldoc->attribute; name->setText(a->name); purpose->setText(a->purpose); if (a->codeFile) codefile->setText(a->codeFile->FileBase()); else codefile->setText(""); if (plugin) { exportAPI->setText(""); exportInclude->setText(""); } else { exportAPI->setText(a->exportAPI); exportInclude->setText(a->exportInclude); } persistent->setChecked(a->persistent); keyframe->setChecked(a->keyframe); customBaseClass->setChecked(a->custombase); if (customBaseClass->isChecked()) baseClass->setText(a->baseClass.isNull()?"AttributeSubject":a->baseClass); else baseClass->setText("AttributeSubject"); UpdateWindowSensitivity(); BlockAllSignals(false); }
static void *RunDaemon(void *Arg) { char Buffer[MaxBufferSize]; fprintf(stderr, "daemon is running...\n"); /* * Block all signals. Applications such as MySQL and Apache have their own way * of handling signals, which we do not want to interfere. For instance, MySQL * has a special signal handling thread, which calls sigwait to wait for * signals. If the Loom daemon stole the signal, the sigwait would never * return, and the server would not be killed. */ if (BlockAllSignals() == -1) return (void *)-1; /* Set the thread name, so that we can "ps c" to view it. */ SetThreadName(); CtrlSock = CreateSocketToController(); if (CtrlSock == -1) return (void *)-1; fprintf(stderr, "Loom daemon is connected to Loom controller\n"); /* Tell the controller "I am a daemon". */ sprintf(Buffer, "iam loom_daemon %d\n", getpid()); if (SendMessage(CtrlSock, Buffer) == -1) return (void *)-1; while (1) { char Response[MaxBufferSize] = {'\0'}; if (ReceiveMessage(CtrlSock, Buffer) == -1) return (void *)-1; ProcessMessage(Buffer, Response); assert(strlen(Response) > 0 && "empty response"); if (SendMessage(CtrlSock, Response) == -1) return (void *)-1; } /* unreachable */ assert(0 && "unreachable"); return NULL; }
void XMLEditPlugin::UpdateWindowContents() { BlockAllSignals(true); if (xmldoc->docType == "Plugin") { attpluginGroup->button(0)->setChecked(true); name->setText(xmldoc->plugin->name); label->setText(xmldoc->plugin->label); version->setText(xmldoc->plugin->version); varTypeMesh->setChecked(false); varTypeScalar->setChecked(false); varTypeVector->setChecked(false); varTypeMaterial->setChecked(false); varTypeSubset->setChecked(false); varTypeSpecies->setChecked(false); varTypeCurve->setChecked(false); varTypeTensor->setChecked(false); varTypeSymmetricTensor->setChecked(false); varTypeLabel->setChecked(false); varTypeArray->setChecked(false); createExpressions->setChecked(false); inOpVarTypeMesh->setChecked(false); inOpVarTypeScalar->setChecked(false); inOpVarTypeVector->setChecked(false); inOpVarTypeMaterial->setChecked(false); inOpVarTypeSubset->setChecked(false); inOpVarTypeSpecies->setChecked(false); inOpVarTypeCurve->setChecked(false); inOpVarTypeTensor->setChecked(false); inOpVarTypeSymmetricTensor->setChecked(false); inOpVarTypeLabel->setChecked(false); inOpVarTypeArray->setChecked(false); outOpVarTypeMesh->setChecked(false); outOpVarTypeScalar->setChecked(false); outOpVarTypeVector->setChecked(false); outOpVarTypeMaterial->setChecked(false); outOpVarTypeSubset->setChecked(false); outOpVarTypeSpecies->setChecked(false); outOpVarTypeCurve->setChecked(false); outOpVarTypeTensor->setChecked(false); outOpVarTypeSymmetricTensor->setChecked(false); outOpVarTypeLabel->setChecked(false); outOpVarTypeArray->setChecked(false); enabledByDefault->setChecked(xmldoc->plugin->enabledByDefault); dbType->setCurrentIndex(0); filePatterns->setText(""); if (xmldoc->plugin->type == "plot") { iconFile->setText(xmldoc->plugin->iconFile); hasIcon->setChecked(xmldoc->plugin->iconFile.length() > 0); pluginType->setCurrentIndex(1); std::vector<QString> types = SplitValues(xmldoc->plugin->vartype); for (size_t i=0; i<types.size(); i++) { if (types[i] == "mesh") varTypeMesh->setChecked(true); else if (types[i] == "scalar") varTypeScalar->setChecked(true); else if (types[i] == "vector") varTypeVector->setChecked(true); else if (types[i] == "material") varTypeMaterial->setChecked(true); else if (types[i] == "subset") varTypeSubset->setChecked(true); else if (types[i] == "species") varTypeSpecies->setChecked(true); else if (types[i] == "curve") varTypeCurve->setChecked(true); else if (types[i] == "tensor") varTypeTensor->setChecked(true); else if (types[i] == "symmetrictensor") varTypeSymmetricTensor->setChecked(true); else if (types[i] == "label") varTypeLabel->setChecked(true); else if (types[i] == "array") varTypeArray->setChecked(true); } } else if (xmldoc->plugin->type == "operator") { iconFile->setText(xmldoc->plugin->iconFile); hasIcon->setChecked(xmldoc->plugin->iconFile.length() > 0); createExpressions->setChecked(xmldoc->plugin->createExpression); std::vector<QString> types = SplitValues(xmldoc->plugin->exprInType); for (size_t i=0; i<types.size(); i++) { if (types[i] == "mesh") inOpVarTypeMesh->setChecked(true); else if (types[i] == "scalar") inOpVarTypeScalar->setChecked(true); else if (types[i] == "vector") inOpVarTypeVector->setChecked(true); else if (types[i] == "material") inOpVarTypeMaterial->setChecked(true); else if (types[i] == "subset") inOpVarTypeSubset->setChecked(true); else if (types[i] == "species") inOpVarTypeSpecies->setChecked(true); else if (types[i] == "curve") inOpVarTypeCurve->setChecked(true); else if (types[i] == "tensor") inOpVarTypeTensor->setChecked(true); else if (types[i] == "symmetrictensor") inOpVarTypeSymmetricTensor->setChecked(true); else if (types[i] == "label") inOpVarTypeLabel->setChecked(true); else if (types[i] == "array") inOpVarTypeArray->setChecked(true); } types = SplitValues(xmldoc->plugin->exprOutType); for (size_t i=0; i<types.size(); i++) { if (types[i] == "mesh") outOpVarTypeMesh->setChecked(true); else if (types[i] == "scalar") outOpVarTypeScalar->setChecked(true); else if (types[i] == "vector") outOpVarTypeVector->setChecked(true); else if (types[i] == "material") outOpVarTypeMaterial->setChecked(true); else if (types[i] == "subset") outOpVarTypeSubset->setChecked(true); else if (types[i] == "species") outOpVarTypeSpecies->setChecked(true); else if (types[i] == "curve") outOpVarTypeCurve->setChecked(true); else if (types[i] == "tensor") outOpVarTypeTensor->setChecked(true); else if (types[i] == "symmetrictensor") outOpVarTypeSymmetricTensor->setChecked(true); else if (types[i] == "label") outOpVarTypeLabel->setChecked(true); else if (types[i] == "array") outOpVarTypeArray->setChecked(true); } pluginType->setCurrentIndex(2); } else if (xmldoc->plugin->type == "database") { iconFile->setText(""); hasIcon->setChecked(false); hasWriter->setChecked(xmldoc->plugin->haswriter); hasOptions->setChecked(xmldoc->plugin->hasoptions); filePatternsStrict->setChecked(xmldoc->plugin->filePatternsStrict); opensWholeDirectory->setChecked(xmldoc->plugin->opensWholeDirectory); pluginType->setCurrentIndex(3); filePatterns->setText(JoinValues(xmldoc->plugin->filePatterns, ' ')); if (xmldoc->plugin->dbtype == "STSD") dbType->setCurrentIndex(1); else if (xmldoc->plugin->dbtype == "MTSD") dbType->setCurrentIndex(2); else if (xmldoc->plugin->dbtype == "STMD") dbType->setCurrentIndex(3); else if (xmldoc->plugin->dbtype == "MTMD") dbType->setCurrentIndex(4); else if (xmldoc->plugin->dbtype == "Custom") dbType->setCurrentIndex(5); } else { iconFile->setText(""); hasIcon->setChecked(false); hasWriter->setChecked(false); hasOptions->setChecked(false); enabledByDefault->setChecked(true); pluginType->setCurrentIndex(0); } } else { attpluginGroup->button(1)->setChecked(true); name->setText(xmldoc->attribute->name); label->setText(""); version->setText(""); varTypeMesh->setChecked(false); varTypeScalar->setChecked(false); varTypeVector->setChecked(false); varTypeMaterial->setChecked(false); varTypeSubset->setChecked(false); varTypeSpecies->setChecked(false); varTypeCurve->setChecked(false); varTypeTensor->setChecked(false); varTypeSymmetricTensor->setChecked(false); varTypeLabel->setChecked(false); varTypeArray->setChecked(false); hasIcon->setChecked(false); iconFile->setText(""); hasWriter->setChecked(false); hasOptions->setChecked(false); pluginType->setCurrentIndex(0); dbType->setCurrentIndex(0); filePatterns->setText(""); filePatternsStrict->setChecked(false); opensWholeDirectory->setChecked(false); enabledByDefault->setChecked(true); } UpdateWindowSensitivity(); BlockAllSignals(false); }
// **************************************************************************** // Method: XMLEditMakefile::UpdateWindowContents // // Purpose: // Update the window based on the current state. // // Programmer: Jeremy Meredith // Creation: October 17, 2002 // // Modifications: // Sean Ahern, Fri Nov 15 15:25:23 PST 2002 // Added "widget files" so we can have custom GUI elements. // // Jeremy Meredith, Wed Jul 7 17:08:03 PDT 2004 // Allow for mdserver-specific code in a plugin's source files. // // Brad Whitlock, Fri Feb 23 17:49:59 PST 2007 // Added viewer widgets. // // Cyrus Harrison, Wed Mar 7 09:07:37 PST 2007 // Allow for engine-specific code in a plugin's source files. // // Cyrus Harrison, Fri Sep 19 13:58:39 PDT 2008 // Added support for custom libs for gui,engine,mdserver, and viewer libs. // // **************************************************************************** void XMLEditMakefile::UpdateWindowContents() { BlockAllSignals(true); if (xmldoc->docType == "Plugin") { Plugin *p = xmldoc->plugin; CXXFLAGS->setText(JoinValues(p->cxxflags, ' ')); LDFLAGS->setText(JoinValues(p->ldflags, ' ')); LIBS->setText(JoinValues(p->libs, ' ')); // gui if (p->customgfiles) GFiles->setText(JoinValues(p->gfiles, ' ')); else GFiles->setText(JoinValues(p->defaultgfiles, ' ')); customGFiles->setChecked(p->customgfiles); // scripting if (p->customglibs) GLibs->setText(JoinValues(p->glibs, ' ')); customGLibs->setChecked(p->customglibs); if (p->customsfiles) SFiles->setText(JoinValues(p->sfiles, ' ')); else SFiles->setText(JoinValues(p->defaultsfiles, ' ')); customSFiles->setChecked(p->customsfiles); // viewer if (p->customvfiles) VFiles->setText(JoinValues(p->vfiles, ' ')); else VFiles->setText(JoinValues(p->defaultvfiles, ' ')); customVFiles->setChecked(p->customvfiles); if (p->customvlibs) VLibs->setText(JoinValues(p->vlibs, ' ')); customVLibs->setChecked(p->customvlibs); // mdserver if (p->custommfiles) MFiles->setText(JoinValues(p->mfiles, ' ')); else MFiles->setText(JoinValues(p->defaultmfiles, ' ')); customMFiles->setChecked(p->custommfiles); if (p->custommlibs) MLibs->setText(JoinValues(p->mlibs, ' ')); customMLibs->setChecked(p->custommlibs); // engine if (p->customefiles) EFiles->setText(JoinValues(p->efiles, ' ')); else EFiles->setText(JoinValues(p->defaultefiles, ' ')); customEFiles->setChecked(p->customefiles); if (p->customelibsSer) ELibsSer->setText(JoinValues(p->elibsSer, ' ')); customELibsSer->setChecked(p->customelibsSer); if (p->customelibsPar) ELibsPar->setText(JoinValues(p->elibsPar, ' ')); customELibsPar->setChecked(p->customelibsPar); // widgets if (p->customwfiles) WFiles->setText(JoinValues(p->wfiles, ' ')); else WFiles->setText(JoinValues(p->defaultwfiles, ' ')); customWFiles->setChecked(p->customwfiles); // viewer widgets if (p->customvwfiles) VWFiles->setText(JoinValues(p->vwfiles, ' ')); else VWFiles->setText(""); customVWFiles->setChecked(p->customvwfiles); // engine spec code engSpecificCode->setChecked(p->hasEngineSpecificCode); // only allow mdserver-specific code if this is a database plugin if(xmldoc->plugin->type !="database") p->has_MDS_specific_code=false; mdSpecificCode->setChecked(p->has_MDS_specific_code); } else { mdSpecificCode->setChecked(false); engSpecificCode->setChecked(false); } UpdateWindowSensitivity(); BlockAllSignals(false); }
void PanelPointSet::DoUpdateWidgets() { BlockAllSignals( true ); LayerPointSet* layer = GetCurrentLayer<LayerPointSet*>(); for ( int i = 0; i < this->allWidgets.size(); i++ ) { if ( allWidgets[i] != ui->toolbar && allWidgets[i]->parentWidget() != ui->toolbar ) { allWidgets[i]->setEnabled(layer); } } int nColorMap = 0; bool bShowSpline = false; ui->lineEditFileName->clear(); if ( layer ) { ui->sliderOpacity->setValue( (int)( layer->GetProperty()->GetOpacity() * 100 ) ); ChangeDoubleSpinBoxValue( ui->doubleSpinBoxOpacity, layer->GetProperty()->GetOpacity() ); double* rgb = layer->GetProperty()->GetColor(); ui->colorpickerPointColor->setCurrentColor( QColor( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); rgb = layer->GetProperty()->GetSplineColor(); ui->colorpickerSplineColor->setCurrentColor( QColor( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); ui->lineEditFileName->setText( MyUtils::Win32PathProof(layer->GetFileName()) ); ui->lineEditFileName->setCursorPosition( ui->lineEditFileName->text().size() ); ChangeLineEditNumber( ui->lineEditRadius, layer->GetProperty()->GetRadius() ); ChangeLineEditNumber( ui->lineEditSplineRadius, layer->GetProperty()->GetSplineRadius() ); ui->labelNumberTotal->setText(QString("%1").arg(layer->GetNumberOfPoints())); ui->spinBoxGoToPoint->setRange(1, layer->GetNumberOfPoints()); nColorMap = layer->GetProperty()->GetColorMap(); double fMin = layer->GetProperty()->GetScalarMinValue(); double fMax = layer->GetProperty()->GetScalarMaxValue(); ui->sliderMin->setValue( (int)( ( layer->GetProperty()->GetHeatScaleMin() - fMin ) / ( fMax - fMin ) * 100 ) ); ui->sliderMid->setValue( (int)( ( layer->GetProperty()->GetHeatScaleMid() - fMin ) / ( fMax - fMin ) * 100 ) ); ui->sliderMax->setValue( (int)( ( layer->GetProperty()->GetHeatScaleMax() - fMin ) / ( fMax - fMin ) * 100 ) ); ui->sliderOffset->setValue( (int)( ( layer->GetProperty()->GetHeatScaleOffset() + fMax ) / ( fMax + fMax ) * 100 ) ); ChangeLineEditNumber( ui->lineEditMin, layer->GetProperty()->GetHeatScaleMin() ); ChangeLineEditNumber( ui->lineEditMid, layer->GetProperty()->GetHeatScaleMid() ); ChangeLineEditNumber( ui->lineEditMax, layer->GetProperty()->GetHeatScaleMax() ); ChangeLineEditNumber( ui->lineEditOffset, layer->GetProperty()->GetHeatScaleOffset() ); ui->comboBoxSplineColor->setCurrentIndex( nColorMap ); ui->comboBoxScalarMap->clear();; QList<Layer*> layers = MainWindow::GetMainWindow()->GetLayerCollection( "MRI" )->GetLayers(); int nSel = -1; for ( int i = 0; i < layers.size(); i++ ) { ui->comboBoxScalarMap->addItem( layers[i]->GetName(), QVariant::fromValue((QObject*)layers[i]) ); if ( layer->GetProperty()->GetScalarType() == LayerPropertyPointSet::ScalarLayer && layer->GetProperty()->GetScalarLayer() == layers[i] ) { nSel = i; } } std::vector<ScalarValues> svs = layer->GetProperty()->GetScalarSets(); for ( int i = 0; i < (int)svs.size(); i++ ) { ui->comboBoxScalarMap->addItem( svs[i].strName ); if ( layer->GetProperty()->GetScalarType() == LayerPropertyPointSet::ScalarSet && layer->GetProperty()->GetScalarSet() == i ) { nSel = i + layers.size(); } } ui->comboBoxScalarMap->addItem( "Load..." ); if ( nSel >= 0 ) { ui->comboBoxScalarMap->setCurrentIndex( nSel ); } bShowSpline = layer->GetProperty()->GetShowSpline(); ui->checkBoxShowSpline->setChecked( bShowSpline ); ui->checkBoxSnapToCenter->setChecked( layer->GetProperty()->GetSnapToVoxelCenter() ); } // MainWindow* mainWnd = MainWindow::GetMainWindowPointer(); ui->colorpickerPointColor->setEnabled( layer ); ui->comboBoxSplineColor->setEnabled( layer ); ShowWidgets( m_widgetlistSpline, bShowSpline ); ShowWidgets( m_widgetlistSolidColor, bShowSpline && layer && nColorMap == LayerPropertyPointSet::SolidColor ); ShowWidgets( m_widgetlistHeatScale, bShowSpline && layer && nColorMap == LayerPropertyPointSet::HeatScale ); BlockAllSignals( false ); }
static void ManagerThreadProc ( ClientData clientData ) { BlockAllSignals(); Tcl_MutexLock(&spointsLock); /* Notify creator thread we're ready */ threadReady = 1; Tcl_ConditionNotify(&spointsCV); while (1) { Queue eventQueue; SignalMapSearch iterator; SyncPoint *spointPtr; while (condReady == 0) { Tcl_ConditionWait(&spointsCV, &spointsLock, NULL); } condReady = 0; if (shutdownRequested) { break; } InitEventList(&eventQueue); HarvestDanglingSyncpoints(&danglingSpoints, &eventQueue); spointPtr = FirstSigMapEntry(&syncpoints, &iterator); while (spointPtr != NULL) { HarvestSyncpoint(spointPtr, &eventQueue); spointPtr = NextSigMapEntry(&iterator); } Tcl_MutexUnlock(&spointsLock); { SignalEvent *evPtr; Tcl_ThreadId lastId; evPtr = QueuePop(&eventQueue); lastId = evPtr->threadId; do { SignalEvent *nextEvPtr; Tcl_ThreadId threadId; nextEvPtr = QueuePop(&eventQueue); threadId = evPtr->threadId; Tcl_ThreadQueueEvent(threadId, (Tcl_Event*) evPtr, TCL_QUEUE_TAIL); if (threadId != lastId) { Tcl_ThreadAlert(lastId); } printf("Sent %d to %x\n", evPtr->signum, evPtr->threadId); evPtr = nextEvPtr; lastId = threadId; } while (evPtr != NULL); Tcl_ThreadAlert(lastId); } Tcl_MutexLock(&spointsLock); } /* Notify creator thread we're finished. * Note that the spointsLock is held at this point. */ threadReady = 1; Tcl_ConditionNotify(&spointsCV); Tcl_MutexUnlock(&spointsLock); }