// // Handle ToolDock events // void ToolDock::Dock( ToolBar *bar, int before ) { // Adopt the toolbar into our family bar->Reparent( this ); mBars[ bar->GetId() ] = bar; // Reset height bar->SetSize( bar->GetSize().x, bar->GetDockedSize().y ); // Park the new bar in the correct berth if( before >= 0 && before < (int)mDockedBars.GetCount() ) { mDockedBars.Insert( bar, before ); } else { mDockedBars.Add( bar ); } // Inform toolbar of change bar->SetDocked( this, false ); // Rearrange our world LayoutToolBars(); Updated(); }
VirtScreen::VirtScreen(World * const world_, Player * const player_) : w(world_), player(player_) { connect(w, SIGNAL(Notify(const QString &)), this, SLOT(Notify(const QString &))); connect(player, SIGNAL(Notify(const QString &)), this, SLOT(Notify(const QString &))); connect(w, SIGNAL(GetString(QString &)), this, SLOT(PassString(QString &)), Qt::DirectConnection); connect(player, SIGNAL(GetString(QString &)), this, SLOT(PassString(QString &)), Qt::DirectConnection); connect(player, SIGNAL(Updated()), this, SLOT(UpdatePlayer()), Qt::DirectConnection); connect(w, SIGNAL(ReConnect()), this, SLOT(ConnectWorld()), Qt::DirectConnection); connect(w, SIGNAL(UpdatedAll()), this, SLOT(UpdateAll()), Qt::DirectConnection); connect(w, SIGNAL(Moved(const int)), this, SLOT(Move(const int)), Qt::DirectConnection); ConnectWorld(); connect(w, SIGNAL(UpdatesEnded()), this, SLOT(UpdatesEnd()), Qt::DirectConnection); }
void MixerToolBar::UpdatePrefs() { #if USE_PORTMIXER float inputVolume; float playbackVolume; int inputSource; // Reset the selected source gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume); // Show or hide the input slider based on whether it works mInputSlider->Enable(gAudioIO->InputMixerWorks()); // Layout the toolbar Layout(); // Resize the toolbar to fit the contents Fit(); // And make that size the minimum SetMinSize( wxWindow::GetSizer()->GetMinSize() ); SetSize( GetMinSize() ); // Notify someone that we've changed our size Updated(); #endif // Set label to pull in language change SetLabel(_("Mixer")); // Give base class a chance ToolBar::UpdatePrefs(); }
// // Set the visible/hidden state of a toolbar // void ToolDock::Expose( int type, bool show ) { ToolBar *t = mBars[ type ]; // Maintain the docked array if( show ) { if( mDockedBars.Index( t ) == wxNOT_FOUND ) { mDockedBars.Add( t ); } } else { if( mDockedBars.Index( t ) != wxNOT_FOUND ) { mDockedBars.Remove( t ); } } // Make it (dis)appear t->Expose( show ); // Update the layout LayoutToolBars(); Updated(); }
void ControlToolBar::UpdatePrefs() { bool updated = false; bool active; gPrefs->Read( wxT("/GUI/ErgonomicTransportButtons"), &active, true ); if( mErgonomicTransportButtons != active ) { mErgonomicTransportButtons = active; updated = true; } gPrefs->Read( wxT("/Batch/CleanSpeechMode"), &active, false ); if( mCleanSpeechMode != active ) { mCleanSpeechMode = active; updated = true; } if( updated ) { ReCreateButtons(); Updated(); } }
TextureSource* DIBTextureHost::GetTextureSources() { if (!mTextureSource) { Updated(); } return mTextureSource; }
bool DIBTextureHost::BindTextureSource(CompositableTextureSourceRef& aTexture) { if (!mTextureSource) { Updated(); } aTexture = mTextureSource; return !!aTexture; }
bool TextureHostDirectUpload::BindTextureSource(CompositableTextureSourceRef& aTexture) { if (!mTextureSource) { Updated(); } aTexture = mTextureSource; return !!aTexture; }
void SelectionBar::OnUpdate(wxCommandEvent &evt) { int index = evt.GetInt(); wxWindow *w = FindFocus(); bool leftFocus = (w == mLeftTime); bool rightFocus = (w == mRightTime); bool audioFocus = (w == mAudioTime); evt.Skip(false); /* we don't actually need a TimeTextCtrl, but need it's * translations which are done at runtime */ TimeTextCtrl *ttc = new TimeTextCtrl(this, wxID_ANY, wxT(""), 0.0, mRate); wxString formatName(ttc->GetBuiltinName(index)); gPrefs->Write(wxT("/SelectionFormat"), formatName); gPrefs->Flush(); #if wxUSE_TOOLTIPS mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), formatName.c_str())); #endif delete ttc; // ToolBar::ReCreateButtons() will get rid of our sizers and controls // so reset pointers first. mLeftTime = mRightTime = mAudioTime = NULL; mRightEndButton = mRightLengthButton = NULL; mRateBox = NULL; mRateText = NULL; ToolBar::ReCreateButtons(); ValuesToControls(); wxString formatString = mLeftTime->GetBuiltinFormat(index); mLeftTime->SetFormatString(formatString); mRightTime->SetFormatString(formatString); mAudioTime->SetFormatString(formatString); if (leftFocus) { mLeftTime->SetFocus(); } else if (rightFocus) { mRightTime->SetFocus(); } else if (audioFocus) { mAudioTime->SetFocus(); } Updated(); }
void ToolManager::Reset() { int ndx; // Disconnect all docked bars for( ndx = 0; ndx < ToolBarCount; ndx++ ) { wxWindow *parent; ToolDock *dock; ToolBar *bar = mBars[ ndx ]; // Disconnect the bar if( bar->IsDocked() ) { bar->GetDock()->Undock( bar ); parent = NULL; } else { parent = bar->GetParent(); } if( ndx == SelectionBarID ) { dock = mBotDock; wxCommandEvent e; bar->GetEventHandler()->ProcessEvent(e); } else { dock = mTopDock; bar->ReCreateButtons(); } bar->EnableDisableButtons(); #if 0 if( bar->IsResizable() ) { bar->SetSize(bar->GetBestFittingSize()); } #endif dock->Dock( bar ); Expose( ndx, ndx == DeviceBarID ? false : true ); if( parent ) { parent->Destroy(); } } LayoutToolBars(); Updated(); }
void TimeTextCtrl::OnMouse(wxMouseEvent &event) { if (event.LeftDown() && event.GetX() >= mWidth) { wxContextMenuEvent e; OnContext(e); } else if (event.LeftDown()) { SetFocus(); int bestDist = 9999; unsigned int i; mFocusedDigit = 0; for(i=0; i<mDigits.GetCount(); i++) { int dist = abs(event.m_x - (mDigits[i].digitBox.x + mDigits[i].digitBox.width/2)); if (dist < bestDist) { mFocusedDigit = i; bestDist = dist; } } Refresh(false); } else if (event.RightDown() && mMenuEnabled) { wxContextMenuEvent e; OnContext(e); } else if( event.m_wheelRotation != 0 ) { int steps = event.m_wheelRotation / (event.m_wheelDelta > 0 ? event.m_wheelDelta : 120); if (steps < 0) { Decrease(-steps); Updated(); } else { Increase(steps); Updated(); } } }
tUsbPortManager::tUsbPortManager( size_t cpuCount, tHALIOInterface& rHal, tUsbPortSettings& rSettings, QObject* pParent ) : QObject( pParent ) , m_PortCount( rHal.GetUsbPortMux().size() ) // this allows to determine the number of port we can actually changed , m_CpuCount( cpuCount ) , m_rHal( rHal ) , m_rSettings( rSettings ) { Connect( &m_rSettings, SIGNAL( Updated() ), this, SLOT( OnSettingsChanged() ) ); Connect( &m_rHal, SIGNAL( UsbPortMuxChanged(std::vector<Hal::tCpuNumber> ) ), this, SLOT( OnPortMuxChanged() ) ); OnSettingsChanged(); // load current config }
// // Transition a toolbar from float to dragging // void ToolManager::OnGrabber( GrabberEvent & event ) { // No need to propagate any further event.Skip( false ); // Remember which bar we're dragging mDragBar = mBars[ event.GetId() ]; // Calculate the drag offset wxPoint mp = event.GetPosition(); mDragOffset = mp - mDragBar->GetParent()->ClientToScreen( mDragBar->GetPosition() ) + wxPoint( 1, 1 ); // Must set the bar afloat if it's currently docked if( mDragBar->IsDocked() ) { #if defined(__WXMAC__) // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Adjust the starting position mp -= mDragOffset; // Inform toolbar of change mDragBar->SetDocked( NULL, true ); // Construct a new floater mDragWindow = new ToolFrame( mParent, this, mDragBar, mp ); // Make sure the ferry is visible mDragWindow->Show(); // Notify parent of change Updated(); #if defined(__WXMAC__) // Reinstate original transition wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } else { mDragWindow = (ToolFrame *) mDragBar->GetParent(); } // We want all mouse events from this point on mParent->CaptureMouse(); // Start monitoring shift key changes mLastState = wxGetKeyState( WXK_SHIFT ); mTimer.Start( 100 ); }
// Animal:: section inner_actions Animal::ActInner() { if ( GROUP_MEAT != GetSubGroup(Sub()) ) return INNER_ACTION_NONE; if ( satiation <= 0 ) { Damage(5, DAMAGE_HUNGER); } else { --satiation; Mend(1); } emit Updated(); return INNER_ACTION_NONE; }
void TrackingUser::Update() { if(!device_ || !tracking_) return; if(device_->userGenerator_.GetSkeletonCap().IsTracking(id_)) { if(skeleton_->Update()) emit Updated(id_, skeleton_); } }
void SelectionBar::OnUpdate(wxCommandEvent &evt) { int index = evt.GetInt(); wxWindow *w = FindFocus(); bool leftFocus = (w == mLeftTime); bool rightFocus = (w == mRightTime); bool audioFocus = (w == mAudioTime); evt.Skip(false); wxString format; // Save format name before recreating the controls so they resize properly format = mLeftTime->GetBuiltinName(index); mListener->AS_SetSelectionFormat(format); #if wxUSE_TOOLTIPS mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), format.c_str())); #endif // ToolBar::ReCreateButtons() will get rid of our sizers and controls // so reset pointers first. mLeftTime = mRightTime = mAudioTime = NULL; mRightEndButton = mRightLengthButton = NULL; mRateBox = NULL; mRateText = NULL; ToolBar::ReCreateButtons(); ValuesToControls(); format = mLeftTime->GetBuiltinFormat(index); mLeftTime->SetFormatString(format); mRightTime->SetFormatString(format); mAudioTime->SetFormatString(format); if (leftFocus) { mLeftTime->SetFocus(); } else if (rightFocus) { mRightTime->SetFocus(); } else if (audioFocus) { mAudioTime->SetFocus(); } Updated(); }
RenderView3D::RenderView3D( QWidget* parent ) : RenderView( parent ) { this->GetRenderWindow()->GetInteractor()->SetDesiredUpdateRate(30); this->GetRenderWindow()->GetInteractor()->SetStillUpdateRate(0.01); GetRenderWindow()->SetAlphaBitPlanes(0); GetRenderWindow()->SetMultiSamples(0); GetRenderer()->SetUseDepthPeeling(true); GetRenderer()->SetMaximumNumberOfPeels(4); GetRenderer()->SetOcclusionRatio(0); m_bShowSliceFrames = true; m_bShowAxes = true; for ( int i = 0; i < 3; i++ ) { m_actorSliceFrames[i] = vtkSmartPointer<vtkActor>::New(); m_actorSliceFrames[i]->SetMapper( vtkSmartPointer<vtkPolyDataMapper>::New() ); m_actorSliceFrames[i]->GetProperty()->SetRepresentationToWireframe(); m_actorSliceFrames[i]->GetProperty()->SetDiffuse( 0.0 ); m_actorSliceFrames[i]->GetProperty()->SetAmbient( 1.0 ); m_bSliceVisibility[i] = true; m_actorSliceBoundingBox[i] = vtkSmartPointer<vtkActor>::New(); m_cubeSliceBoundingBox[i] = vtkSmartPointer<vtkCubeSource>::New(); vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputConnection( m_cubeSliceBoundingBox[i]->GetOutputPort() ); m_actorSliceBoundingBox[i]->SetMapper( mapper ); mapper->Update(); m_actorSliceBoundingBox[i]->GetProperty()->SetRepresentationToWireframe(); } HighlightSliceFrame( -1 ); m_cursor3D = new Cursor3D( this ); m_interactorNavigate = new Interactor3DNavigate( this ); m_interactorMeasure = new Interactor3DMeasure( this ); m_interactorVolumeCrop = new Interactor3DVolumeCrop(this); connect(m_cursor3D, SIGNAL(Updated()), this, SLOT(RequestRedraw())); m_actorScalarBar->SetNumberOfLabels( 4 ); m_actorAxesActor = vtkSmartPointer<vtkCubeAxesActor>::New(); m_actorAxesActor->XAxisLabelVisibilityOn(); m_actorAxesActor->YAxisLabelVisibilityOn(); m_actorAxesActor->ZAxisLabelVisibilityOn(); m_actorAxesActor->SetXTitle(""); m_actorAxesActor->SetYTitle(""); m_actorAxesActor->SetZTitle(""); m_actorAxesActor->SetFlyModeToClosestTriad(); m_actorAxesActor->SetCamera(m_renderer->GetActiveCamera()); SetInteractionMode(IM_Navigate); }
void SelectionBar::OnUpdate(wxCommandEvent &evt) { int index = evt.GetInt(); wxWindow *w = FindFocus(); bool leftFocus = (w == mLeftTime); bool rightFocus = (w == mRightTime); bool audioFocus = (w == mAudioTime); evt.Skip(false); /* we need an object to call these methods on. It actually doesn't matter * which as they have no effect on the object state, so we just use the first * one to hand */ wxString formatName = mLeftTime->GetBuiltinName(index); wxString formatString = mLeftTime->GetBuiltinFormat(index); gPrefs->Write(wxT("/SelectionFormat"), formatName); // ToolBar::ReCreateButtons() will get rid of our sizers and controls // so reset pointers first. mLeftTime = mRightTime = mAudioTime = NULL; mRightEndButton = mRightLengthButton = NULL; mRateBox = NULL; ToolBar::ReCreateButtons(); ValuesToControls(); mLeftTime->SetFormatString(formatString); mRightTime->SetFormatString(formatString); mAudioTime->SetFormatString(formatString); if (leftFocus) { mLeftTime->SetFocus(); } else if (rightFocus) { mRightTime->SetFocus(); } else if (audioFocus) { mAudioTime->SetFocus(); } Updated(); }
void SpectralSelectionBar::OnUpdate(wxCommandEvent &evt) { int index = evt.GetInt(); wxWindow *w = FindFocus(); bool centerFocus = (w && w == mCenterCtrl); bool widthFocus = (w && w == mWidthCtrl); bool lowFocus = (w && w == mLowCtrl); bool highFocus = (w && w == mHighCtrl); evt.Skip(false); // Save formats before recreating the controls so they resize properly wxEventType type = evt.GetEventType(); if (type == EVT_FREQUENCYTEXTCTRL_UPDATED) { NumericTextCtrl *frequencyCtrl = (mbCenterAndWidth ? mCenterCtrl : mLowCtrl); wxString frequencyFormatName = frequencyCtrl->GetBuiltinName(index); mListener->SSBL_SetFrequencySelectionFormatName(frequencyFormatName); } else if (mbCenterAndWidth && type == EVT_BANDWIDTHTEXTCTRL_UPDATED) { wxString bandwidthFormatName = mWidthCtrl->GetBuiltinName(index); mListener->SSBL_SetBandwidthSelectionFormatName(bandwidthFormatName); } // ToolBar::ReCreateButtons() will get rid of our sizers and controls // so reset pointers first. mCenterCtrl = mWidthCtrl = NULL; mLowCtrl = mHighCtrl = NULL; ToolBar::ReCreateButtons(); ValuesToControls(); if (centerFocus) { mCenterCtrl->SetFocus(); } else if (widthFocus) { mWidthCtrl->SetFocus(); } else if (lowFocus) { mLowCtrl->SetFocus(); } else if (highFocus) { mHighCtrl->SetFocus(); } Updated(); }
bool ImageClientBridge::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) { if (!GetForwarder() || !mLayer) { return false; } if (mAsyncContainerID == aContainer->GetAsyncContainerID()) { return true; } mAsyncContainerID = aContainer->GetAsyncContainerID(); static_cast<ShadowLayerForwarder*>(GetForwarder())->AttachAsyncCompositable(mAsyncContainerID, mLayer); AutoLockImage autoLock(aContainer); aContainer->NotifyPaintedImage(autoLock.GetImage()); Updated(); return true; }
void MixerToolBar::UpdatePrefs() { #if USE_PORTMIXER float inputVolume; float playbackVolume; int inputSource; wxArrayString inputSources = gAudioIO->GetInputSourceNames(); // Repopulate the selections mInputSourceChoice->Clear(); mInputSourceChoice->Append(inputSources); // Reset the selected source gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume); mInputSourceChoice->SetSelection(inputSource); // Resize the control mInputSourceChoice->SetSize(mInputSourceChoice->GetEffectiveMinSize()); // Show or hide the control based on input sources mInputSourceChoice->Show( inputSources.GetCount() != 0 ); // Show or hide the input slider based on whether it works mInputSlider->Enable(gAudioIO->InputMixerWorks()); SetToolTips(); // Layout the toolbar Layout(); // Resize the toolbar to fit the contents Fit(); // And make that size the minimum SetMinSize( wxWindow::GetSizer()->GetMinSize() ); SetSize( GetMinSize() ); // Notify someone that we've changed our size Updated(); #endif // Set label to pull in language change SetLabel(_("Mixer")); // Give base class a chance ToolBar::UpdatePrefs(); }
void SpectralSelectionBar::OnChoice(wxCommandEvent &) { mbCenterAndWidth = (0 == mChoice->GetSelection()); gPrefs->Write(preferencePath, mbCenterAndWidth); gPrefs->Flush(); mCenterCtrl->Show(mbCenterAndWidth); mWidthCtrl->Show(mbCenterAndWidth); mLowCtrl->Show(!mbCenterAndWidth); mHighCtrl->Show(!mbCenterAndWidth); ValuesToControls(); GetSizer()->Layout(); // Required so that the layout does not mess up on Windows when changing the format. wxWindowBase::GetSizer()->SetMinSize(wxSize(0, mHeight)); // so that height of toolbar does not change wxWindowBase::GetSizer()->SetSizeHints(this); Updated(); }
void World::Drop(Block * const block_from, const ushort x_to, const ushort y_to, const ushort z_to, const ushort src, const ushort dest, const ushort num) { Block * block_to=GetBlock(x_to, y_to, z_to); if ( AIR==block_to->Sub() ) { SetBlock((block_to=NewBlock(PILE, DIFFERENT)), x_to, y_to, z_to); } else if ( WATER==block_to->Sub() ) { Block * const pile = NewBlock(PILE, DIFFERENT); SetBlock(pile, x_to, y_to, z_to); pile->HasInventory()->Get(block_to); block_to = pile; } Exchange(block_from, block_to, src, dest, num); emit Updated(x_to, y_to, z_to); }
void Animal::DoRareAction() { if ( GROUP_MEAT != GetSubGroup(Sub()) ) return; if ( not IsSubAround(AIR) ) { if ( breath <= 0 ) { Damage(10, DAMAGE_BREATH); } else { --breath; } } else if ( breath < MAX_BREATH ) { ++breath; } if ( GetDurability() <= 0 ) { GetWorld()->DestroyAndReplace(X(), Y(), Z()); } else { emit Updated(); } }
void BillboardSet::SetNetBillboardsAttr(const PODVector<unsigned char>& value) { MemoryBuffer buf(value); unsigned numBillboards = buf.ReadVLE(); SetNumBillboards(numBillboards); for (PODVector<Billboard>::Iterator i = billboards_.Begin(); i != billboards_.End(); ++i) { i->position_ = buf.ReadVector3(); i->size_ = buf.ReadVector2(); i->uv_ = buf.ReadRect(); i->color_ = buf.ReadColor(); i->rotation_ = buf.ReadFloat(); i->enabled_ = buf.ReadBool(); } Updated(); }
int UserAddNewsDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: Done(); break; case 1: Updated((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QString(*)>(_a[4])),(*reinterpret_cast< int(*)>(_a[5]))); break; case 2: UserAddNewsAttempt(); break; case 3: ServerAddNewsAnswer((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: onNewsInputEdit(); break; case 5: onCloseDialog(); break; default: ; } _id -= 6; } return _id; }
void tTripRangeCircleLabelFormatter::Format(float value, bool isValid) { QString formattedString; if (isValid) { tUnitsType actualUnitsType = m_UnitsType; formattedString = m_Convert.BaseToStringWithUnits(m_UnitsType, value, &actualUnitsType, m_FormatString); } else { formattedString = m_FormatString .arg("---") .arg(m_Convert.GetUnitsString(m_UnitsType)); } emit RangeIsValid(isValid); emit Updated(formattedString); }
void BillboardSet::SetBillboardsAttr(VariantVector value) { unsigned index = 0; unsigned numBillboards = index < value.Size() ? value[index++].GetUInt() : 0; SetNumBillboards(numBillboards); for (PODVector<Billboard>::Iterator i = billboards_.Begin(); i != billboards_.End() && index < value.Size(); ++i) { i->position_ = value[index++].GetVector3(); i->size_ = value[index++].GetVector2(); Vector4 uv = value[index++].GetVector4(); i->uv_ = Rect(uv.x_, uv.y_, uv.z_, uv.w_); i->color_ = value[index++].GetColor(); i->rotation_ = value[index++].GetFloat(); i->enabled_ = value[index++].GetBool(); } Updated(); }
void BillboardSet::SetNumBillboards(unsigned num) { unsigned oldNum = billboards_.Size(); billboards_.Resize(num); // Set default values to new billboards for (unsigned i = oldNum; i < num; ++i) { billboards_[i].position_ = Vector3::ZERO; billboards_[i].size_ = Vector2::ONE; billboards_[i].uv_ = Rect::POSITIVE; billboards_[i].color_ = Color(1.0f, 1.0f, 1.0f); billboards_[i].rotation_ = 0.0f; billboards_[i].enabled_ = false; } bufferSizeDirty_ = true; Updated(); }
NetworkManager::Connection::Connection(const QString &path, QObject *parent) : QObject(parent) , d_ptr(new ConnectionPrivate(path)) { Q_D(Connection); qDBusRegisterMetaType<NMVariantMapMap>(); QDBusReply<NMVariantMapMap> reply = d->iface.GetSettings(); if (reply.isValid()) { d->updateSettings(reply.value()); } else { d->updateSettings(); } d->path = path; //nmDebug() << m_connection; connect(&d->iface, SIGNAL(Updated()), this, SLOT(onConnectionUpdated())); connect(&d->iface, SIGNAL(Removed()), this, SLOT(onConnectionRemoved())); }