void GUI::FreeControls() { if(GetControls()) { GetControls()->Clear(); delete GetControls(); SetControls(NULL); } }
// // OnApplyChanges // // Changes made should be kept. Change the variable // HRESULT CCalibFilterProperties::OnApplyChanges() { GetControls(m_hwnd); SetParameters(); m_bDirty = FALSE; return NOERROR; } // OnApplyChanges
void AUInstrumentBase::HandlePolyPressure( int inChannel, UInt8 inKey, UInt8 inValue, long inStartFrame) { GetControls(inChannel)->mPolyPressure[inKey] = inValue; }
std::shared_ptr<TrackPanelCell> Track::GetTrackControl() { if (!mpControls) // create on demand mpControls = GetControls(); return mpControls; }
// Organize the members. This will re-organize the // controls Z-order so that the tab-order goes from // top-left to right bottom. void ClsLayoutEngine::OrganizeMembers() { // Storage for the members. ClsLinkedList<ClsCNode> list; // Are we already organized? if (( m_dwFlags & LF_ORGANIZED ) != LF_ORGANIZED ) { // No. Get all member controls. GetControls( &list ); // Organize the controls. ClsCNode *pNode; HWND hPrev = NULL; for ( pNode = list.GetFirst(); pNode; pNode = list.GetNext( pNode )) { // Setup Z order. ::SetWindowPos( pNode->m_hWnd, hPrev ? hPrev : HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); // Save predecessor. hPrev = pNode->m_hWnd; } // Free nodes. while (( pNode = list.RemoveHead()) != NULL ) delete pNode; // We are organized. m_dwFlags |= LF_ORGANIZED; } }
void AUInstrumentBase::HandlePitchWheel( int inChannel, UInt8 inPitch1, UInt8 inPitch2, long inStartFrame) { MidiControls* controls = GetControls(inChannel); controls->mPitchBend = (inPitch2 << 7) | inPitch1; controls->mFPitchBend = (float)((SInt16)controls->mPitchBend - 8192) / 8192.; }
ECode ZoomControlExternal::Show() { if (mZoomControlRunnable != NULL) { mPrivateHandler->RemoveCallbacks(mZoomControlRunnable); } GetControls()->Show(TRUE); Boolean result = FALSE; mPrivateHandler->PostDelayed(mZoomControlRunnable, ZOOM_CONTROLS_TIMEOUT, &result); return NOERROR; }
void CCheckBoxGroup::MarkActiveCheckBox(CControlUI * const control) { const std::vector<CControlUI *> controls = GetControls(); for (std::vector<CControlUI *>::const_iterator itr = controls.begin(); itr != controls.end(); ++itr) { if ((*itr)->GetType() == ECT_CHECKBOX) { if ((*itr) == control) { (*itr)->SetCurrentState(EGUICS_ONCLICK); m_active = reinterpret_cast<CCheckBoxUI *>(*itr); } else (*itr)->SetCurrentState(EGUICS_DEFAULT); } } CControlUI::NotifyListeners(this); }
void AUInstrumentBase::HandleControlChange( int inChannel, UInt8 inController, UInt8 inValue, long inStartFrame) { GetControls(inChannel)->mControls[inController] = inValue; switch (inController) { case kMidiController_Sustain : if (inValue >= 64) SendPedalEvent(inChannel, SynthEvent::kEventType_SustainOn, inStartFrame); else SendPedalEvent(inChannel, SynthEvent::kEventType_SustainOff, inStartFrame); break; case kMidiController_Sostenuto : if (inValue >= 64) SendPedalEvent(inChannel, SynthEvent::kEventType_SostenutoOn, inStartFrame); else SendPedalEvent(inChannel, SynthEvent::kEventType_SostenutoOff, inStartFrame); break; } }
void AUInstrumentBase::HandleProgramChange( int inChannel, UInt8 inValue) { GetControls(inChannel)->mMonoPressure = inValue; }
void AUInstrumentBase::HandleChannelPressure( int inChannel, UInt8 inValue, long inStartFrame) { GetControls(inChannel)->mMonoPressure = inValue; }
void PlayerFireWeapon(Guy *me) { byte c; if (player.life == 0) return; // no shooting when you're dead switch (player.weapon) { case WPN_MISSILES: if (player.ammo) { FireBullet(me->x, me->y, me->facing, BLT_MISSILE, 1); player.ammo--; } player.wpnReload = 2; break; case WPN_BOMBS: if (player.ammo) { FireBullet(me->x, me->y, me->facing, BLT_BOMB, 1); player.ammo--; } player.wpnReload = 15; break; case WPN_AK8087: if (player.ammo) { FireBullet(me->x, me->y, me->facing, BLT_LASER, 1); player.ammo--; } me->z += FIXAMT * MGL_random(4); me->dx += FIXAMT / 2 - MGL_random(65535); me->dy += FIXAMT / 2 - MGL_random(65535); c = GetControls(); if (c & CONTROL_B2) // fire is held { player.wpnReload = 1; me->frmTimer = 0; } else { player.wpnReload = 5; } DoPlayerFacing(c, me); break; case WPN_FLAME: if (player.ammo) { FireBullet(me->x, me->y, me->facing, BLT_FLAME, 1); player.ammo--; } c = GetControls(); if (c & CONTROL_B2) // fire is held { player.wpnReload = 1; me->frmTimer = 0; } else player.wpnReload = 5; DoPlayerFacing(c, me); break; case WPN_BIGAXE: if (player.ammo) { FireBullet(me->x, me->y, me->facing, BLT_BIGAXE, 1); MakeSound(SND_BOMBTHROW, me->x, me->y, SND_CUTOFF, 1200); player.ammo--; } player.wpnReload = 10; break; case WPN_LIGHTNING: if (player.ammo) { // fire lightning FireBullet(me->x, me->y, me->facing, BLT_LIGHTNING, 1); player.ammo--; } c = GetControls(); if (c & CONTROL_B2) // fire is held { player.wpnReload = 1; me->frmTimer = 0; } else { player.wpnReload = 5; } DoPlayerFacing(c, me); break; case WPN_SPEAR: if (player.ammo) { MakeSound(SND_BOMBTHROW, me->x, me->y, SND_CUTOFF, 1200); FireBullet(me->x, me->y, me->facing, BLT_SPEAR, 1); player.ammo--; } player.wpnReload = 5; break; case WPN_MACHETE: if (player.ammo) { MakeSound(SND_SLASH, me->x, me->y, SND_CUTOFF, 1200); FireBullet(me->x + Cosine(me->facing * 32)*32, me->y + Sine(me->facing * 32)*32, me->facing, BLT_SLASH, 1); player.ammo--; } player.wpnReload = 2; break; case WPN_MINES: if (player.ammo) { MakeSound(SND_MINELAY, me->x, me->y, SND_CUTOFF, 1200); FireBullet(me->x - Cosine(me->facing * 32)*32, me->y - Sine(me->facing * 32)*32, me->facing, BLT_MINE, 1); player.ammo--; } player.wpnReload = 15; break; case WPN_TURRET: if (player.ammo) { Guy *g; g = AddGuy(me->x + Cosine(me->facing * 32)*32, me->y + Sine(me->facing * 32)*32, FIXAMT * 10, MONS_GOODTURRET); if (g == NULL || !g->CanWalk(g->x, g->y, GameCurrentMap(), &curWorld)) { MakeSound(SND_TURRETBZZT, me->x, me->y, SND_CUTOFF, 1200); if (g) g->type = MONS_NONE; } else { MakeSound(SND_MINELAY, me->x, me->y, SND_CUTOFF, 1200); player.ammo--; } player.wpnReload = 15; } break; case WPN_MINDCONTROL: if (player.ammo) { MakeSound(SND_MINDWIPE, me->x, me->y, SND_CUTOFF, 1200); FireBullet(me->x + Cosine(me->facing * 32)*32, me->y + Sine(me->facing * 32)*32, me->facing, BLT_MINDWIPE, 1); player.ammo--; player.wpnReload = 15; } break; case WPN_REFLECTOR: if (player.ammo) { MakeSound(SND_LIGHTSON, me->x, me->y, SND_CUTOFF, 1200); FireBullet(me->x, me->y, me->facing, BLT_REFLECT, 1); player.ammo--; c = GetControls(); if (c & CONTROL_B2) // fire is held { player.wpnReload = 0; me->frmTimer = 0; } else { player.wpnReload = 10; } } break; case WPN_JETPACK: if (player.ammo) { player.jetting = 5; player.ammo--; player.wpnReload = 3; } break; case WPN_SWAPGUN: if (player.ammo) { MakeSound(SND_LIGHTSON, me->x, me->y, SND_CUTOFF, 1200); FireBullet(me->x, me->y, me->facing, BLT_SWAP, 1); player.ammo--; player.wpnReload = 10; } break; } if (!player.ammo) player.weapon = 0; }
void PlayerControlMe(Guy *me, mapTile_t *mapTile, world_t *world) { byte c; int x, y, i; player.life = me->hp; if (player.rage) { if (player.rage > 5) player.rage -= 6; else player.rage = 0; } if (player.rageClock) DoRage(me); if (player.invisibility) player.invisibility--; if (player.jetting && me->seq != ANIM_DIE && me->seq != ANIM_A3) { me->dx += Cosine(me->facing * 32)*6; me->dy += Sine(me->facing * 32)*6; Clamp(&me->dx, FIXAMT * 20); Clamp(&me->dy, FIXAMT * 20); if (me->z < FIXAMT * 20) me->z += FIXAMT * 4; me->dz = 0; MakeSound(SND_FLAMEGO, me->x, me->y, SND_CUTOFF, 1200); for (i = 0; i < 3; i++) { c = ((me->facing + 4)&7)*32; x = me->x + Cosine(c)*10 - FIXAMT * 10 + MGL_randoml(FIXAMT * 20); y = me->y + Sine(c)*10 - FIXAMT * 10 + MGL_randoml(FIXAMT * 20); FireBullet(x, y, (me->facing + 4)&7, BLT_FLAME, 1); } player.jetting--; } if (player.weapon == WPN_PWRARMOR) { PlayerControlPowerArmor(me, mapTile, world); return; } if (player.reload) player.reload--; if (player.wpnReload) player.wpnReload--; if (player.garlic) { player.garlic--; StinkySteam(me->x - FIXAMT * 20 + MGL_randoml(FIXAMT * 40), me->y - FIXAMT * 20 + MGL_randoml(FIXAMT * 40), me->z + FIXAMT * 40, FIXAMT * 2); } if (player.shield) player.shield--; if (player.pushPower) player.pushPower--; if (tportclock) tportclock--; // ice is slippery if (!(world->terrain[mapTile->floor].flags & TF_ICE)) { if (player.jetting && me->mind1) { if (me->mind1 & 1) { me->dx = -me->dx; switch (me->facing) { case 0: me->facing = 4; break; case 1: me->facing = 3; break; case 2: case 6: break; case 3: me->facing = 1; break; case 4: me->facing = 0; break; case 5: me->facing = 7; break; case 7: me->facing = 5; break; } } if (me->mind1 & 2) { me->dy = -me->dy; switch (me->facing) { case 0: case 4: break; case 1: me->facing = 7; break; case 2: me->facing = 6; break; case 3: me->facing = 5; break; case 5: me->facing = 3; break; case 6: me->facing = 2; break; case 7: me->facing = 1; break; } } } Dampen(&me->dx, PLYR_DECEL); Dampen(&me->dy, PLYR_DECEL); } else { if (me->mind1) // bumped a wall while on ice { if (me->mind1 & 1) me->dx = -me->dx / 8; if (me->mind1 & 2) me->dy = -me->dy / 8; } } me->mind1 = 0; if (me->ouch == 4) { if (opt.playAs == PLAYAS_BOUAPHA) { if (me->hp > 0) MakeSound(SND_BOUAPHAOUCH, me->x, me->y, SND_CUTOFF | SND_ONE, 2000); else if (me->seq == ANIM_DIE) // so it doesn't do this if you're drowning MakeSound(SND_BOUAPHADIE, me->x, me->y, SND_CUTOFF | SND_ONE, 2000); } else if (opt.playAs == PLAYAS_LUNATIC) { if (me->hp > 0) MakeSound(SND_DRLOUCH, me->x, me->y, SND_CUTOFF | SND_ONE, 2000); else if (me->seq == ANIM_DIE) // so it doesn't do this if you're drowning MakeSound(SND_DRLDIE, me->x, me->y, SND_CUTOFF | SND_ONE, 2000); } else { if (me->hp > 0) MakeSound(SND_HAPPYOUCH, me->x, me->y, SND_CUTOFF | SND_ONE, 2000); else if (me->seq == ANIM_DIE) // so it doesn't do this if you're drowning MakeSound(SND_HAPPYDIE, me->x, me->y, SND_CUTOFF | SND_ONE, 2000); } } if (me->parent) // being grabbed by a Super Zombie or something { if (me->parent->type == MONS_SUPERZOMBIE) { me->dz = 0; if (me->parent->frm < 4) me->z += FIXAMT * 3; else if (me->parent->frm > 18) { me->z -= FIXAMT * 4; if (me->parent->frm == 21) { me->z = 0; me->parent = NULL; me->action = ACTION_IDLE; if (me->hp == 0) { me->seq = ANIM_DIE; me->frm = 0; me->frmTimer = 0; me->frmAdvance = 64; me->action = ACTION_BUSY; } return; } } if (me->seq != ANIM_MOVE) { me->seq = ANIM_MOVE; me->frm = 0; me->frmTimer = 0; me->frmAdvance = 512; } return; } else if (me->parent->type == MONS_MINECART) { me->x = me->parent->x; me->y = me->parent->y + 1; me->z = FIXAMT * 8; } else { me->parent = NULL; } } // triggering stuff if (me->action == ACTION_BUSY) { // throw hammer if need be, use item if need be if (me->seq == ANIM_A1 && me->frm == 2 && player.wpnReload == 0) { PlayerFireWeapon(me); return; } if (me->seq == ANIM_A3) { if (me->frm < 11) { me->z = FIXAMT * 8; // hover while spinning feet in the air before plunging into water me->dz = FIXAMT; } else { ExplodeParticles(PART_WATER, me->x, me->y, 0, 16); } return; } if (me->seq == ANIM_DIE) { me->facing = (me->facing + 1)&7; return; } if (me->seq == ANIM_A1) return; } // not busy, let's see if you want to do something c = GetControls(); if (!player.jetting) DoPlayerFacing(c, me); if (me->action == ACTION_IDLE) { if ((c & (CONTROL_B1 | CONTROL_B2)) == (CONTROL_B1 | CONTROL_B2) && (player.rage / 256) >= player.life) { // RAGE!!!!!!! player.rage = 0; player.rageClock = 15; if (player.shield == 0) player.shield = 30; EnterRage(); } if ((c & CONTROL_B1) && player.reload == 0) // pushed hammer throw button { me->action = ACTION_IDLE; if (!(c & (CONTROL_UP | CONTROL_DN | CONTROL_LF | CONTROL_RT))) { me->seq = ANIM_ATTACK; // even if unarmed me->frm = 0; me->frmTimer = 0; me->frmAdvance = 255; me->frm += 4 - (player.hamSpeed >> 2); } player.boredom = 0; if (player.hammers > 0) PlayerThrowHammer(me); player.reload += (10 - (4 - (player.hamSpeed >> 2))); }
// Window procedure override. Handles layout engine private messages. LRESULT ClsLayoutEngine::WindowProc( UINT uMsg, WPARAM wParam, LPARAM lParam ) { // Interpred message. switch ( uMsg ) { case WM_CREATE: { // Get the default font height used // by the layout control. This information // is needed if the control font is not // set. ClsGetDC dc( this ); ClsSize sz = dc.GetTextExtent( _T( "W" ), 1 ); m_nFontHeight = sz.CY(); break; } case WM_GETFONT: // Valid font? return ( LRESULT )( m_Font.IsValid() ? ( HFONT )m_Font : NULL ); case WM_SETFONT: { // Detach old font. m_Font.Detach(); // Valid? if ( wParam ) { // Attach the new font. m_Font.Attach(( HFONT )wParam, FALSE ); // Set the font to the frame // if it exists. if ( m_Frame.GetSafeHWND()) m_Frame.SetFont( &m_Font, FALSE ); // Pass this message to all our members // when they do not have a font set. ClsMember *pMember; for ( pMember = m_Members.GetFirst(); pMember; pMember = m_Members.GetNext( pMember )) { // Skip spacing members. if (( pMember->m_dwFlags & ClsMember::MF_SPACING ) != ClsMember::MF_SPACING ) { // Does it have a font? if ( pMember->m_pMember->SendMessage( WM_GETFONT ) == NULL ) // No. Set it. pMember->m_pMember->SendMessage( WM_SETFONT, wParam, MAKELPARAM( FALSE, 0 )); } } // Pickup the font height. ClsGetDC dc(this); ClsSelector sel( &dc, ( HFONT )wParam ); ClsSize sz = dc.GetTextExtent( _T( "W" ), 1 ); // Store the height. m_nFontHeight = sz.CY(); m_dwFlags &= ~LF_DIMENSIONED; } break; } case WM_ISLAYOUTENGINE: // Yes, we really are a layout engine... return TRUE; case WM_ORGANIZE: // Organize the members. m_dwFlags &= ~LF_ORGANIZED; OrganizeMembers(); return TRUE; case WM_GETCONTROLS: // Add members to the passed list. GetControls(( ClsLinkedList<ClsCNode> * )lParam ); return TRUE; case WM_ERRORS: // Return error bool. return ( LRESULT )(( BOOL )( m_dwFlags & LF_ADDERROR )); //case WM_SIZE: // Resize the frame. // if ( m_bFrameGroup && m_Frame.GetSafeHWND()) // { // ClsRect rc; // GetClientRect( rc ); // m_Frame.MoveWindow( rc, FALSE ); // } // return 0; case WM_RELAYOUT: // Group dimensioned? When ever a group contents // has changed we need to call the OnGetMinSize() // method before we re-layout. This is to make sure // the layout engine always works with the latest // information. if (( m_dwFlags & LF_DIMENSIONED ) != LF_DIMENSIONED ) { ClsSize szMinSize( 0, 0 ); // OK? if ( OnGetMinSize( szMinSize ) == FALSE ) return FALSE; } // Is this the master group? if ( m_dwFlags & LF_MASTER ) { // Organized? if (( m_dwFlags & LF_ORGANIZED ) != LF_ORGANIZED ) OrganizeMembers(); // Get the parent it's client rectangle. ClsRect rc = GetParent()->GetClientRect(); // Re-size the group. MoveWindow( rc, FALSE ); } // Scale the group members. if ( m_bIsHorizontal ) ScaleHGroup(); else ScaleVGroup(); // Master group? if ((( m_dwFlags & LF_MASTER ) == LF_MASTER ) && GetParent()->IsWindowVisible()) // Force the parent to redraw. GetParent()->RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN ); return TRUE; case WM_SHOWMEMBERS: { // Show/Hide members. ClsMember *pMember; for ( pMember = m_Members.GetFirst(); pMember; pMember = m_Members.GetNext( pMember )) { // A spacing member? if (( pMember->m_dwFlags & ClsMember::MF_SPACING ) != ClsMember::MF_SPACING ) { if ( pMember->m_pMember->SendMessage( WM_ISLAYOUTENGINE )) pMember->m_pMember->SendMessage( WM_SHOWMEMBERS, wParam ); else { pMember->m_pMember->ShowWindow( wParam ? SW_SHOW : SW_HIDE ); if ( wParam ) pMember->m_pMember->UpdateWindow(); } } } // Show/Hide the frame. if ( m_bFrameGroup && m_Frame.GetSafeHWND()) { m_Frame.ShowWindow( wParam ? SW_SHOW : SW_HIDE ); if ( wParam ) m_Frame.UpdateWindow(); } return TRUE; } case WM_REFRESH: { // Do longer dimensioned or organized... m_dwFlags &= ~( LF_ORGANIZED | LF_DIMENSIONED ); // Refresh layout engine members. ClsMember *pMember; for ( pMember = m_Members.GetFirst(); pMember; pMember = m_Members.GetNext( pMember )) { // A spacing member? if (( pMember->m_dwFlags & ClsMember::MF_SPACING ) != ClsMember::MF_SPACING ) { // Is it a layout engine? if ( pMember->m_pMember->SendMessage( WM_ISLAYOUTENGINE )) pMember->m_pMember->SendMessage( WM_REFRESH ); } } // Are we the master? if ( m_dwFlags & LF_MASTER ) // Layout the group. SendMessage( WM_RELAYOUT ); return TRUE; } } // Call the base class. return ClsWindow::WindowProc( uMsg, wParam, lParam ); }