void WindowConnectivityConfiguration::DoUpdateUI() { if ( m_conn && m_conn->IsValid() ) { m_choiceDisplay->SetSelection( m_conn->GetDisplayMode() ); m_choiceRadius->SetSelection( m_conn->GetVaryRadius()?1:0 ); double range[2]; m_conn->GetRadiusRange( range ); m_sliderRadiusMin->SetValue( (int)( (range[0]-RADIUS_MIN)*100/(RADIUS_MAX-RADIUS_MIN) ) ); UpdateTextValue( m_textRadiusMin, range[0] ); m_sliderRadiusMax->SetValue( (int)( (range[1]-RADIUS_MIN)*100/(RADIUS_MAX-RADIUS_MIN) ) ); UpdateTextValue( m_textRadiusMax, range[1] ); m_sliderRadiusMax->Enable( m_conn->GetVaryRadius() ); m_textRadiusMax->Enable( m_conn->GetVaryRadius() ); double data_range[2]; m_conn->GetDataRange( data_range ); m_conn->GetThresholdRange( range ); m_sliderThresholdMin->SetValue( (int)( (range[0]-data_range[0])*100/(data_range[1]-data_range[0]) ) ); UpdateTextValue( m_textThresholdMin, range[0] ); m_sliderThresholdMax->SetValue( (int)( (range[1]-data_range[0])*100/(data_range[1]-data_range[0]) ) ); UpdateTextValue( m_textThresholdMax, range[1] ); m_checkAddOn->SetValue( m_conn->GetIncrementalDisplay() ); m_checkAddOn->Enable( m_conn->GetDisplayMode() != ConnectivityData::DM_All ); } else { Close(); } }
// Este método está incluido no Game_Loop() no Game_Main.cpp void Game_GUI_Loop() { switch (gameState) { case GAMEPLAY: PutTextOnScreen(scoreText, "Pontos: "); PutTextOnScreen(levelText, "Level"); PutTextOnScreen(chancesLeftText, "Chances Restantes"); UpdateTextValue(scoreText_Value, playerScore); if (gameLevel < 5) UpdateTextValue(levelText_Value, gameLevel); else PutTextOnScreen(levelText_Value, "MAX"); // Muda a cor conforme o jogador for perdendo chances restantes if (chancesLeft > 25) UpdateTextValue(chancesLeftText_Value, chancesLeft); if (chancesLeft > 10 && chancesLeft <= 25) // Amarelo meio escuro, e mais vísivel - Hex #FFD700 - RGB 255, 215, 0 UpdateTextValue(chancesLeftText_Value, chancesLeft, 255, 215, 0); if (chancesLeft <= 10) UpdateTextValue(chancesLeftText_Value, chancesLeft, 255, 0, 0); // Vermelho, óbvio kkk break; case GAMEOVER: switch (gameOverIndex) { case 1: PutTextOnScreen(gameOverText, "Você colidiu o seu avião!"); PutTextOnScreen(playerScoreText, "Sua pontuação final "); PutTextOnScreen(highScoreText, "High Score"); UpdateTextValue(highScoreText_Value, highScore); UpdateTextValue(playerScoreText_Value, playerScore); break; case 2: PutTextOnScreen(gameOverText, "Você deixou inimigos demais passarem"); PutTextOnScreen(playerScoreText, "Sua pontuação final "); PutTextOnScreen(highScoreText, "High Score"); UpdateTextValue(highScoreText_Value, highScore); UpdateTextValue(playerScoreText_Value, playerScore); break; } break; } }
void PanelSurface::OnSliderMidPointChanging( wxScrollEvent& event ) { LayerSurface* surf = ( LayerSurface* )MainWindow::GetMainWindowPointer()->GetLayerCollection( "Surface" )->GetActiveLayer(); if ( surf ) { double range[2]; surf->GetCurvatureRange( range ); UpdateTextValue( m_textMidPoint, (double)m_sliderMidPoint->GetValue() / 100.0 * ( range[1] - range[0] ) + range[0] ); } }
void FloatSpinCtrl::UpdateValue(double newValue) { if (newValue > m_Max) newValue = m_Max; if (newValue < m_Min) newValue = m_Min; m_Value = newValue; UpdateTextValue(); SendEvent(); }
void FloatSpinCtrl::ValidateTextValue() { m_bSettingProcess = true; wxString stringValue = m_textCtrl->GetValue(); double temp; if (stringValue.ToDouble(&temp)) { UpdateValue(temp); } else { UpdateTextValue(); } m_bSettingProcess = false; }
FloatSpinCtrl::FloatSpinCtrl(wxWindow* parent, wxWindowID id, double value, double min, double max, double step, const wxPoint& point, const wxSize& size, long style, const wxString& name ) : wxPanel(parent, id, point, size, style, name), m_bSettingProcess(false), m_Min(min), m_Max(max), m_Step(step), m_Value(value), m_NumericValidator(wxFILTER_NUMERIC) { m_textCtrl = new MyTextCtrl(this, FloatSpinCtrl::wxID_TEXTCTRL, "", wxDefaultPosition, wxSize(-1,-1), wxTE_PROCESS_ENTER, m_NumericValidator); m_spinButton = new wxSpinButton(this, FloatSpinCtrl::wxID_SPINBUTTON, wxDefaultPosition, wxSize(16, 21), wxSP_ARROW_KEYS | wxSP_VERTICAL); UpdateTextValue(); m_sizer = new wxBoxSizer(wxHORIZONTAL); DoLayout(); }
void PanelSurface::OnSliderOpacityChanging( wxScrollEvent& event ) { double fMin = 0; double fMax = 1; UpdateTextValue( m_textOpacity, (double)m_sliderOpacity->GetValue() / 100.0 * ( fMax - fMin ) + fMin ); }
void PanelSurface::OnSliderSlopeChanging( wxScrollEvent& event ) { double fMin = 0; double fMax = 100; UpdateTextValue( m_textSlope, (double)m_sliderSlope->GetValue() / 100.0 * ( fMax - fMin ) + fMin ); }
void PanelSurface::DoUpdateUI() { if ( !IsShown() ) return; bool bHasSurface = ( m_listBoxLayers->GetSelection() != wxNOT_FOUND ); wxWindowList children = XRCCTRL( *this, "ID_SCROLL_WINDOW", wxScrolledWindow )->GetChildren(); wxWindowList::iterator it = children.begin(), end = children.end(); for (; it != end; it++) { if ( !(*it)->IsKindOf(CLASSINFO(wxToolBar) ) && *it != m_listBoxLayers ) (*it)->Enable( bHasSurface ); } LayerSurface* layer = NULL; FSSurface* surf = NULL; if ( bHasSurface ) { LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( "Surface" ); for ( int i = 0; i < (int)m_listBoxLayers->GetCount() && i < lc->GetNumberOfLayers(); i++ ) m_listBoxLayers->Check( i, lc->GetLayer( i )->IsVisible() ); layer = ( LayerSurface* )( void* )m_listBoxLayers->GetClientData( m_listBoxLayers->GetSelection() ); if ( layer ) { m_sliderOpacity->SetValue( (int)( layer->GetProperties()->GetOpacity() * 100 ) ); UpdateTextValue( m_textOpacity, layer->GetProperties()->GetOpacity() ); double* rgb = layer->GetProperties()->GetBinaryColor(); m_colorPicker->SetColour( wxColour( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); rgb = layer->GetProperties()->GetEdgeColor(); m_colorPickerEdge->SetColour( wxColour( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); rgb = layer->GetProperties()->GetVectorColor(); m_colorPickerVector->SetColour( wxColour( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); m_textFileName->ChangeValue( wxString::FromAscii( layer->GetFileName() ) ); m_textFileName->SetInsertionPointEnd(); m_textFileName->ShowPosition( m_textFileName->GetLastPosition() ); m_spinEdgeThickness->SetValue( layer->GetProperties()->GetEdgeThickness() ); m_spinVectorPointSize->SetValue( layer->GetProperties()->GetVectorPointSize() ); m_choiceCurvatureMap->SetSelection( layer->GetProperties()->GetCurvatureMap() ); UpdateTextValue( m_textMidPoint, layer->GetProperties()->GetThresholdMidPoint() ); UpdateTextValue( m_textSlope, layer->GetProperties()->GetThresholdSlope() ); double range[2]; layer->GetCurvatureRange( range ); m_sliderMidPoint->SetValue( (int) ( ( layer->GetProperties()->GetThresholdMidPoint() - range[0] ) / ( range[1] - range[0] ) * 100 ) ); m_sliderSlope->SetValue( (int) ( layer->GetProperties()->GetThresholdSlope() ) ); surf = layer->GetSourceSurface(); m_choiceRenderMode->SetSelection( layer->GetProperties()->GetSurfaceRenderMode() ); m_choiceMeshColorMap->SetSelection( layer->GetProperties()->GetMeshColorMap() ); m_checkShowVertices->SetValue( layer->GetProperties()->GetShowVertices() ); rgb = layer->GetProperties()->GetVertexColor(); m_colorPickerVertex->SetColour( wxColour( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); m_spinVertexPointSize->SetValue( layer->GetProperties()->GetVertexPointSize() ); double* dPos = layer->GetProperties()->GetPosition(); wxString value_strg = ( (wxString)_("") << dPos [0] << _(" ") << dPos[1] << _(" ") << dPos[2] ); m_textPosition->ChangeValue( value_strg ); m_checkHideInfo->SetValue( !layer->GetProperties()->GetShowInfo() ); } lc->SetActiveLayer( ( Layer* )m_listBoxLayers->GetClientData( m_listBoxLayers->GetSelection() ) ); } m_choiceVector->Clear(); m_choiceVector->Append( _("Off") ); if ( surf ) { for ( int i = 0; i < surf->GetNumberOfVectorSets(); i++ ) { m_choiceVector->Append( wxString::FromAscii( surf->GetVectorSetName( i ) ) ); } } m_choiceVector->Append( _("Load vector data...") ); m_choiceVector->SetSelection( surf ? 1 + surf->GetActiveVector() : 0 ); // update overlay controls m_choiceOverlay->Clear(); m_choiceOverlay->Append( _("Off") ); if ( layer ) { for ( int i = 0; i < layer->GetNumberOfOverlays(); i++ ) { m_choiceOverlay->Append( wxString::FromAscii( layer->GetOverlay( i )->GetName() ) ); } } m_choiceOverlay->Append( _("Load from file...") ); m_choiceOverlay->SetSelection( layer ? 1 + layer->GetActiveOverlayIndex() : 0 ); m_btnOverlayConfiguration->Show( layer && layer->GetActiveOverlayIndex() >= 0 ); // update annotation controls m_choiceAnnotation->Clear(); m_choiceAnnotation->Append( _("Off") ); if ( layer ) { for ( int i = 0; i < layer->GetNumberOfAnnotations(); i++ ) { m_choiceAnnotation->Append( wxString::FromAscii( layer->GetAnnotation( i )->GetName() ) ); } } m_choiceAnnotation->Append( _("Load from file...") ); m_choiceAnnotation->SetSelection( layer ? 1 + layer->GetActiveAnnotationIndex() : 0 ); // update label controls m_choiceLabel->Clear(); if ( layer ) { if ( layer->GetNumberOfLabels() > 0 ) { for ( int i = 0; i < layer->GetNumberOfLabels(); i++ ) { m_choiceLabel->Append( wxString::FromAscii( layer->GetLabel( i )->GetName() ) ); } } else m_choiceLabel->Append( _("None") ); } m_choiceLabel->Append( _("Load from file...") ); if ( layer && layer->GetActiveLabelIndex() >= 0 ) m_choiceLabel->SetSelection( layer->GetActiveLabelIndex() ); else m_choiceLabel->SetSelection( 0 ); if ( layer && layer->GetActiveLabel() ) { double* rgb = layer->GetActiveLabel()->GetColor(); m_colorPickerLabel->SetColour( wxColour( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); } int nCurvatureMap = layer ? layer->GetProperties()->GetCurvatureMap() : 0; for ( size_t i = 0; i < m_widgetsMidPoint.size(); i++ ) { m_widgetsMidPoint[i]->Show( nCurvatureMap != LayerPropertiesSurface::CM_Off ); } for ( size_t i = 0; i < m_widgetsSlope.size(); i++ ) { m_widgetsSlope[i]->Show( nCurvatureMap == LayerPropertiesSurface::CM_Threshold ); } for ( size_t i = 0; i < m_widgetsVector.size(); i++ ) { m_widgetsVector[i]->Show( m_choiceVector->GetSelection() > 0 ); } for ( size_t i = 0; i < m_widgetsVertex.size(); i++ ) { m_widgetsVertex[i]->Show( m_checkShowVertices->GetValue() ); } for ( size_t i = 0; i < m_widgetsMesh.size(); i++ ) { m_widgetsMesh[i]->Show( layer && layer->GetProperties()->GetSurfaceRenderMode() != LayerPropertiesSurface::SM_Surface ); } for ( size_t i = 0; i < m_widgetsLabel.size(); i++ ) { m_widgetsLabel[i]->Show( layer && layer->GetActiveLabelIndex() >= 0 ); } m_colorPicker->Enable( layer ); // && nCurvatureMap != LayerPropertiesSurface::CM_Threshold ); // hack to force resize of these controls in scrolled window for ( size_t i = 0; i < m_widgetsResize.size(); i++ ) { wxSize sz = m_widgetsResize[i]->GetMinSize(); m_widgetsResize[i]->SetMinSize( wxSize( 100, sz.GetHeight() ) ); } Layout(); }
void ToolWindowEdit::DoUpdateTools() { int nViewId = MainWindow::GetMainWindowPointer()->GetActiveViewId(); if ( nViewId < 0 || nViewId > 2 ) nViewId = 0; RenderView2D* view = ( RenderView2D* )MainWindow::GetMainWindowPointer()->GetRenderView( nViewId ); bool bVoxelEditVisible = m_toolbarVoxelEdit->IsShown(); bool bROIEditVisible = m_toolbarROIEdit->IsShown(); if ( bVoxelEditVisible != (view->GetInteractionMode() == RenderView2D::IM_VoxelEdit) || bROIEditVisible != (view->GetInteractionMode() == RenderView2D::IM_ROIEdit) ) { m_toolbarVoxelEdit ->Show( view->GetInteractionMode() == RenderView2D::IM_VoxelEdit ); m_toolbarROIEdit ->Show( view->GetInteractionMode() == RenderView2D::IM_ROIEdit ); XRCCTRL( *this, "ID_PANEL_HOLDER", wxPanel )->Layout(); } // XRCCTRL( *m_toolbarBrush, "ID_STATIC_BRUSH_SIZE", wxStaticText )->Enable( m_viewAxial->GetAction() != Interactor2DROIEdit::EM_Fill ); m_spinBrushSize->Enable( view->GetAction() != Interactor2DROIEdit::EM_Fill ); m_spinBrushTolerance->Enable( view->GetAction() == Interactor2DROIEdit::EM_Fill ); // choiceTemplate->Enable( checkTemplate->IsChecked() && m_viewAxial->GetAction() == Interactor2DROIEdit::EM_Fill ); // XRCCTRL( *m_toolbarBrush, "ID_STATIC_BRUSH_TOLERANCE", wxStaticText )->Enable( checkTemplate->IsChecked() ); //&& m_viewAxial->GetAction() == Interactor2DROIEdit::EM_Fill ); // XRCCTRL( *m_toolbarBrush, "ID_SPIN_BRUSH_TOLERANCE", wxSpinCtrl )->Enable( checkTemplate->IsChecked() );//&& m_viewAxial->GetAction() == Interactor2DROIEdit::EM_Fill ); BrushProperty* bp = MainWindow::GetMainWindowPointer()->GetBrushProperty(); LayerVolumeBase* layer = bp->GetReferenceLayer(); // if ( m_choiceTemplate->GetSelection() != wxNOT_FOUND ) // layer = ( LayerEditable* )(void*)m_choiceTemplate->GetClientData( m_choiceTemplate->GetSelection() ); m_choiceTemplate->Clear(); m_choiceTemplate->Append( _("None"), (void*)NULL ); LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" ); int nSel = 0; for ( int i = 0; i < lc->GetNumberOfLayers(); i++ ) { LayerMRI* mri = (LayerMRI*)lc->GetLayer( i ); if ( layer == mri ) { nSel = i+1; } m_choiceTemplate->Append( wxString::FromAscii( mri->GetName() ), (void*)mri ); } // if ( !lc->IsEmpty() ) m_choiceTemplate->SetSelection( nSel ); m_spinBrushSize->SetValue( bp->GetBrushSize() ); m_spinBrushTolerance->SetValue( bp->GetBrushTolerance( ) ); m_checkDrawConnectedOnly->SetValue( bp->GetDrawConnectedOnly() ); m_checkDrawRange ->SetValue( bp->GetDrawRangeEnabled() ); m_checkExcludeRange ->SetValue( bp->GetExcludeRangeEnabled() ); m_editDrawRangeLow ->Enable( bp->GetDrawRangeEnabled() ); m_editDrawRangeHigh ->Enable( bp->GetDrawRangeEnabled() ); m_editExcludeRangeLow ->Enable( bp->GetExcludeRangeEnabled() ); m_editExcludeRangeHigh ->Enable( bp->GetExcludeRangeEnabled() ); double* range = bp->GetDrawRange(); UpdateTextValue( m_editDrawRangeLow, range[0] ); UpdateTextValue( m_editDrawRangeHigh, range[1] ); range = bp->GetExcludeRange(); UpdateTextValue( m_editExcludeRangeLow, range[0] ); UpdateTextValue( m_editExcludeRangeHigh, range[1] ); Contour2D* c2d = view->GetContour2D(); m_checkSmooth->SetValue( c2d->GetSmooth() ); UpdateTextValue( m_editSmoothSD, c2d->GetSmoothSD() ); m_editSmoothSD->Enable( c2d->GetSmooth() ); UpdateTextValue( m_editContourValue, c2d->GetContourValue() ); double* rgb = c2d->GetContourColor(); m_colorPickerContour->SetColour( wxColour( (int)(rgb[0]*255), (int)(rgb[1]*255), (int)(rgb[2]*255) ) ); int nAction = view->GetAction(); ShowWidgets( m_widgetsBrushSize, nAction != Interactor2DVoxelEdit::EM_Contour && nAction != Interactor2DVoxelEdit::EM_ColorPicker && nAction != Interactor2DVoxelEdit::EM_Fill ); ShowWidgets( m_widgetsReference, nAction == Interactor2DVoxelEdit::EM_Fill || nAction == Interactor2DVoxelEdit::EM_Contour ); ShowWidgets( m_widgetsTolerance, nAction == Interactor2DVoxelEdit::EM_Fill ); ShowWidgets( m_widgetsConstrain, nAction != Interactor2DVoxelEdit::EM_ColorPicker && nAction != Interactor2DVoxelEdit::EM_Contour ); ShowWidgets( m_widgetsSmooth, nAction == Interactor2DVoxelEdit::EM_Contour ); ShowWidgets( m_widgetsContour, nAction == Interactor2DVoxelEdit::EM_Contour ); m_bToUpdateTools = false; wxPanel* panel = XRCCTRL( *this, "ID_PANEL_HOLDER", wxPanel ); panel->Layout(); panel->Fit(); Fit(); Layout(); MainWindow::GetMainWindowPointer()->NeedRedraw( 1 ); }