// Add an item to the selection list //----------------------------------------------------------------------------- CPUTResult CPUTDropdown::AddSelectionItem(const cString Item, bool bIsSelected) { // Don't allow adding 'empty' elements // causes a spacing issue if(0==Item.size()) { return CPUT_ERROR_INVALID_PARAMETER; } // create a static item to hold the text CPUTText *pNewItem = new CPUTText(mpFont); pNewItem->SetText(Item, 0.35f); // set the text slightly higher than the 0.5 normal mode mpListOfSelectableItems.push_back(pNewItem); // Should this be the currently selected item? if(bIsSelected) { mSelectedItemIndex = (int) mpListOfSelectableItems.size()-1; } // was this the first item added to an empty list? if( 1==mpListOfSelectableItems.size() ) { mSelectedItemIndex=0; } // mark that a resize of dropdown selection box is needed mbSizeDirty = true; Recalculate(); // position or size may move - force a recalculation of this control's location // if it is managed by the auto-arrange function if(this->IsAutoArranged()) { CPUTGuiControllerDX11::GetController()->Resize(); } return CPUT_SUCCESS; }
void CVisualSynanView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { CScrollView::OnPrepareDC(pDC, pInfo); if( pInfo ) { if( m_iStartSent == -1 ) { pInfo->m_bContinuePrinting = FALSE; m_iStartSent = 0; m_iStartLine = 0; m_iOffset = 0; CClientDC dc(this); Recalculate(dc); return; } pInfo->m_bContinuePrinting = TRUE; pDC->SetMapMode(MM_ANISOTROPIC); CSize sizeDoc = GetDocument()->GetSentencesSize(); if( (sizeDoc.cx == 0) && (sizeDoc.cy == 0) ) { sizeDoc.cx = 200; sizeDoc.cy = 200; } pDC->SetWindowExt(sizeDoc); int xLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSX); int yLogPixPerInch = pDC->GetDeviceCaps(LOGPIXELSY); long xExt = (long)sizeDoc.cx * xLogPixPerInch; xExt /= 100 ; long yExt = (long)sizeDoc.cy * yLogPixPerInch; yExt /= 100 ; pDC->SetViewportExt((int)xExt, (int)yExt); } }
void RenderEngine::SetData( Data::PointData * _pdata, Data::Mesh::PointMesh * _pmesh, Data::Mesh::SolidMesh * _tdata ){ if( _pdata == 0 || _pmesh == 0 || _tdata == 0 ) return; pdata = _pdata; tdata = _tdata; pmesh = _pmesh; SCI::Vex3 bbmid = pmesh->bb.GetCenter(); float siz = pmesh->bb.GetMaximumDimensionSize(); tdata->BuildSpacePartition( *pmesh ); tdata->tri_mesh.FixNormals( *pmesh ); std::cout << "RenderEngine: " << "Finding clusters" << std::endl << std::flush; cluster_type = KMeansClustering::KM_L2Norm; cluster.Initialize( pdata, 1, 1, cluster_type ); //std::cout << "Estimated clusters: " << (int)sqrt( (double)pdata->GetElementCount()/2.0) << std::endl << std::flush; std::cout << "Estimated clusters: " << (int)(log( (double)pdata->GetElementCount()/2.0) / log(2.0)) << std::endl << std::flush; /* std::cout << "RenderEngine: " << "Extracting Edges" << std::endl << std::flush; edge_mesh.clear(); tdata->ExtractEdges( edge_mesh ); edge_data.Resize( (int)edge_mesh.size(), pdata->GetDimension() ); for(int i = 0; i < (int)edge_mesh.size(); i++){ edge_data.SetElement( i, SCI::fabsf( pdata->GetElement(edge_mesh[i].v0) - pdata->GetElement(edge_mesh[i].v1) ) ); } */ re2[0].SetData( pdata, pmesh, tdata, SCI::Vex4(1,0,0,-pmesh->bb.GetCenter().x), SCI::Vex4( 90, 0, 1, 0 ) ); re2[1].SetData( pdata, pmesh, tdata, SCI::Vex4(0,1,0,-pmesh->bb.GetCenter().y), SCI::Vex4(-90, 1, 0, 0 ) ); re2[2].SetData( pdata, pmesh, tdata, SCI::Vex4(0,0,1,-pmesh->bb.GetCenter().z), SCI::Vex4( 0, 1, 0, 0 ) ); pca.SetData( pdata, pmesh, tdata, &colormap ); std::cout << "RenderEngine: " << "Recalculating colors" << std::endl << std::flush; Recalculate(); }
// Moves the slider gripper to the specified value on the slider //-------------------------------------------------------------------------------- CPUTResult CPUTSlider::SetValue(float fValue) { if(fValue>mSliderEndValue) { fValue = mSliderEndValue; } else if(fValue<mSliderStartValue) { fValue = mSliderStartValue; } LocationGuides guides; CalculateLocationGuides(guides); //+ guides.TickIndent ) + (i*guides.TickSpacing); float percentValue = (fValue-mSliderStartValue)/(mSliderEndValue-mSliderStartValue); float locationOnTray = guides.TotalWidth *percentValue; int index = (int) (locationOnTray/guides.StepSpacing); float remainder = locationOnTray - index*guides.StepSpacing; if(remainder > (guides.StepSpacing/2.0f)) { // snap to next higher spot index++; } float stepSizeValue = (mSliderEndValue - mSliderStartValue)/(mSliderNumberOfSteps-1); float remainderValue = (fValue-mSliderStartValue) - index*stepSizeValue; float remainderPercent = remainderValue/stepSizeValue; float remainderPixels = remainderPercent*guides.StepSpacing; mSliderNubLocation = (float)(guides.TickIndent + (index*guides.StepSpacing) + remainderPixels - (mpActiveImageSizeList[Grip].width/2.0f)); Recalculate(); return CPUT_SUCCESS; }
// Delete an item at a specific index //----------------------------------------------------------------------------- void CPUTDropdown::DeleteSelectionItem(const UINT index) { if((0==index) || (index>mpListOfSelectableItems.size())) return; // list is zero based, not 1 based UINT itemIndex = index-1; // physically delete the text object CPUTText *pItem = mpListOfSelectableItems[itemIndex]; SAFE_DELETE(pItem); // remove the item from the list mpListOfSelectableItems.erase(mpListOfSelectableItems.begin()+itemIndex); // if we're deleting the selected item or any above it // move the current selection down by oneq if(mSelectedItemIndex > itemIndex) { mSelectedItemIndex--; } if(mSelectedItemIndex >= mpListOfSelectableItems.size()) mSelectedItemIndex = (UINT) mpListOfSelectableItems.size()-1; // resize the dropdown selection box mbSizeDirty = true; Recalculate(); // position or size may move - force a recalculation of this control's location // if it is managed by the auto-arrange function if(this->IsAutoArranged()) { CPUTGuiControllerDX11::GetController()->Resize(); } }
void SoundParameter::Read( TextReader *_in ) { char *parameter = _in->GetNextToken(); AppDebugAssert( stricmp( parameter, "PARAMETER" ) == 0 ); char *paramType = _in->GetNextToken(); m_type = GetParameterType( paramType ); switch( m_type ) { case TypeFixedValue: m_outputLower = atof( _in->GetNextToken() ); break; case TypeRangedRandom: m_outputLower = atof( _in->GetNextToken() ); m_outputUpper = atof( _in->GetNextToken() ); m_smooth = atof( _in->GetNextToken() ); break; case TypeLinked: m_inputLower = atof( _in->GetNextToken() ); m_outputLower = atof( _in->GetNextToken() ); m_inputUpper = atof( _in->GetNextToken() ); m_outputUpper = atof( _in->GetNextToken() ); m_smooth = atof( _in->GetNextToken() ); char *linkType = _in->GetNextToken(); m_link = GetLinkType( linkType ); break; } char *updateType = _in->GetNextToken(); m_updateType = GetUpdateType( updateType ); Recalculate(); }
void DtmfDialog::OnDtmfStringText(wxCommandEvent & event) { Recalculate(); }
// Construct an empty node Node::Node() : id(""), globalTransformMatrix(glm::mat4()), transform(Transform()), children(0, NULL), parent(NULL) { // Initialize all internal transforms Recalculate(); }
void EffectDtmf::OnDuration(wxCommandEvent & WXUNUSED(evt)) { SetDuration(mDtmfDurationT->GetValue()); Recalculate(); UpdateUI(); }
bool EffectDtmf::Init() { Recalculate(); return true; }
void RenderEngine::setColorModeFibers( ){ color_mode = 6; Recalculate(); }
void RenderEngine::setColorModeIsovalue( ){ color_mode = 4; Recalculate(); }
void RenderEngine::setDrawModeVolumeRendering( ){ draw_mode = 1; Recalculate(); }
void RenderEngine::setDrawModePoints( ){ draw_mode = 0; Recalculate(); }
RenderEngine::RenderEngine(SCI::ThirdPersonCameraControls *_pView) { re.pView = _pView; draw_mode = 0; color_mode = 0; color_dim = 0; clusterN = 12; clusterI = 5; cluster_histogram = true; color_dim = 0; isoval = 0; view_dim_iso = false; view_min_iso = false; view_mean_iso = false; view_max_iso = false; view_fibers = false; fiber_length = 0.2f; tdata = 0; pdata = 0; fdata = 0; pmesh = 0; dfield = 0; //font.Load( "../fonts/arial.font" ); font.Load( ":/fonts/arial.font" ); re.pdata = pdata; re.pmesh = pmesh; re.tdata = tdata; re.NeedUpdate(); re.draw_mode = draw_mode; re.iso_points = &iso_points; re.iso_tris = &iso_tris; re.iso_tets = &iso_tets; re.iso_hexs = &iso_hexs; re.iso_color = &iso_color; re.df_points = &df_points; re.df_tris = &df_tris; re.df_color = &df_color; //re.edge_data = &edge_data; //re.edge_mesh = &edge_mesh; re.cluster = &cluster; //re.vox_assoc = &vox_assoc; re.colormap = &colormap; re.seq_cmap = &seq_cmap; re.cat_cmap = &cat_cmap; re.draw_mode = draw_mode; re.color_mode = color_mode; re.font = &font; re.cluster_histogram = cluster_histogram; pca.font = &font; for(int i = 0; i < 3; i++){ re.pln[i] = &(re2[i].plane); re.pln_color[i] = &(re2[i].pln_color); re2[i].font = &font; connect( &(re2[i]), SIGNAL(Updated(RenderEngine2D*)), this, SLOT(UpdateRenderEngine2DColor(RenderEngine2D*)) ); } re2[0].pln_color = SCI::Vex3(127, 201, 127)/255.0f; re2[1].pln_color = SCI::Vex3(190, 174, 212)/255.0f; re2[2].pln_color = SCI::Vex3(253, 192, 134)/255.0f; connect( &cluster, SIGNAL(IterationComplete()), this, SLOT(Recalculate()) ); }
void RenderEngine::setColorModeStDev( ){ color_mode = 2; Recalculate(); }
void RenderEngine::setColorModeCluster( ){ color_mode = 3; Recalculate(); }
void RenderEngine::setDrawModeIsosurfacing( ){ draw_mode = 2; Recalculate(); }
void RenderEngine::setColorModePCA( ){ color_mode = 5; Recalculate(); }
void RenderEngine::setDrawModeDistanceField( ){ draw_mode = 3; Recalculate(); }
void RenderEngine::setDimension( int v ){ color_dim = v; Recalculate(); }
void RenderEngine::setDrawModeNetwork( ){ draw_mode = 4; Recalculate(); }
void EffectDtmf::OnSequence(wxCommandEvent & WXUNUSED(evt)) { dtmfSequence = mDtmfSequenceT->GetValue(); Recalculate(); UpdateUI(); }
void RenderEngine::setColorModeDimension( ){ color_mode = 0; Recalculate(); }
void EffectDtmf::OnDutyCycle(wxCommandEvent & evt) { dtmfDutyCycle = (double) evt.GetInt() / SCL_DutyCycle; Recalculate(); UpdateUI(); }
void RenderEngine::setColorModeMin( ){ color_mode = 7; Recalculate(); }
void DtmfDialog::OnDutyCycleSlider(wxCommandEvent & event) { Recalculate(); }
void RenderEngine::setColorModeMax( ){ color_mode = 8; Recalculate(); }
void DtmfDialog::OnDtmfDurationText(wxCommandEvent & event) { Recalculate(); }
void RenderEngine::setColorModeMedian( ){ color_mode = 1; Recalculate(); }