void CSCBDockContext::StartDrag(CPoint pt) { ASSERT_VALID(m_pBar); m_bDragging = TRUE; InitLoop(); ASSERT((m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC) != 0); // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; CSize sizeHorz = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK); CSize sizeVert = m_pBar->CalcDynamicLayout(0, LM_VERTDOCK); CSize sizeFloat = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH); m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz); m_rectDragVert = CRect(rect.TopLeft(), sizeVert); // calculate frame dragging rectangle m_rectFrameDragHorz = CRect(rect.TopLeft(), sizeFloat); #ifdef _MAC CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz, WS_THICKFRAME, WS_EX_FORCESIZEBOX); #else CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz, WS_THICKFRAME); #endif m_rectFrameDragHorz.DeflateRect(2, 2); m_rectFrameDragVert = m_rectFrameDragHorz; // adjust rectangles so that point is inside AdjustRectangle(m_rectDragHorz, pt); AdjustRectangle(m_rectDragVert, pt); AdjustRectangle(m_rectFrameDragHorz, pt); AdjustRectangle(m_rectFrameDragVert, pt); // initialize tracking state and enter tracking loop m_dwOverDockStyle = CanDock(); Move(pt); // call it here to handle special keys Track(); }
bool CPitchBendEditor::ConstructEvent( BPoint point) { // check if destination is set int32 destination = TrackWindow()->Document()->GetDefaultAttribute(EvAttr_Channel); if (TrackWindow()->Document()->FindDestination(destination) == NULL) return false; // Initialize a new event m_newEv.SetCommand(TrackWindow()->NewEventType(EvtType_PitchBend)); // Compute the difference between the original // time and the new time we're dragging the events to. int32 time; time = RendererFor(m_newEv)->QuantizeDragTime(m_newEv, 0, BPoint(0.0, 0.0), point, true); TrackWindow()->SetHorizontalPositionInfo(Track(), time); m_newEv.SetStart(time); m_newEv.SetDuration(0); m_newEv.SetVChannel(destination); switch (m_newEv.Command()) { case EvtType_PitchBend: { m_newEv.pitchBend.targetBend = m_newEv.pitchBend.startBend = ViewCoordsToValue(point.y, true) + 0x2000; m_newEv.pitchBend.updatePeriod = TrackWindow()->Document()->GetDefaultAttribute(EvAttr_UpdatePeriod); break; } default: { beep(); return false; } } return true; }
void CDockContext::StartDrag( CPoint pt ) /***************************************/ { ASSERT( m_pBar != NULL ); m_ptLast = pt; m_dwStyle = m_pBar->m_dwStyle & CBRS_ALIGN_ANY; m_bFlip = ::GetKeyState( VK_SHIFT ) & 0x8000; m_bForceFrame = ::GetKeyState( VK_CONTROL ) & 0x8000; if( m_pBar->m_dwStyle & CBRS_ORIENT_HORZ ) { m_pBar->GetWindowRect( &m_rectDragHorz ); int xCenter = (m_rectDragHorz.left + m_rectDragHorz.right) / 2; int yCenter = (m_rectDragHorz.top + m_rectDragHorz.bottom) / 2; int nWidth = m_rectDragHorz.right - m_rectDragHorz.left; int nHeight = m_rectDragHorz.bottom - m_rectDragHorz.top; m_rectDragVert.left = xCenter - nHeight / 2; m_rectDragVert.top = yCenter - nWidth / 2; m_rectDragVert.right = xCenter + nHeight / 2; m_rectDragVert.bottom = yCenter + nWidth / 2; } else { m_pBar->GetWindowRect( &m_rectDragVert ); int xCenter = (m_rectDragVert.left + m_rectDragVert.right) / 2; int yCenter = (m_rectDragVert.top + m_rectDragVert.bottom) / 2; int nWidth = m_rectDragVert.right - m_rectDragVert.left; int nHeight = m_rectDragVert.bottom - m_rectDragVert.top; m_rectDragHorz.left = xCenter - nHeight / 2; m_rectDragHorz.top = yCenter - nWidth / 2; m_rectDragHorz.right = xCenter + nHeight / 2; m_rectDragHorz.bottom = yCenter + nWidth / 2; } m_rectFrameDragHorz = m_rectDragHorz; CMiniFrameWnd::CalcBorders( &m_rectFrameDragHorz ); m_rectFrameDragVert = m_rectDragVert; CMiniFrameWnd::CalcBorders( &m_rectFrameDragVert ); m_pDC = new CClientDC( NULL ); m_dwOverDockStyle = CanDock(); m_bDragging = TRUE; DrawFocusRect(); Track(); }
TrackListPanel::TrackListPanel(const iscore::ApplicationContext &ctx): iscore::PanelDelegate{ctx}, m_widget{new QWidget}, m_trackModel(new TrackModel), m_layout{new QVBoxLayout}, m_containerpanel{new QMLContainerPanel} { m_trackModel->addTrack(Track(100, 0, 0)); QQuickWidget* container = m_containerpanel->container(); QQmlEngine* engine = container->engine(); QQmlContext* rootctxt = engine->rootContext(); rootctxt->setContextProperty(QString("trackModel"), m_trackModel); m_containerpanel->setSource(QString("qrc:/qml/TrackList.qml")); m_containerpanel->setContainerSize(m_containerpanel->size()); m_containerpanel->setObjectName("TrackList"); m_containerpanel->setBaseSize(m_widget->size()); m_layout->addWidget(m_containerpanel); m_widget->setLayout(m_layout); }
void NowPlayingWidget::onTrackStarted( const lastfm::Track& track, const lastfm::Track& ) { if ( track != Track() ) { setUpdatesEnabled( false ); if ( ui.metadata ) { ui.stack->removeWidget( ui.metadata ); ui.metadata->deleteLater(); } ui.stack->addWidget( ui.metadata = new MetadataWidget( track, this ) ); ui.metadata->setBackButtonVisible( false ); ui.stack->setCurrentWidget( ui.metadata ); m_movie->stop(); setUpdatesEnabled( true ); } }
void CDockContext::StartResize(int nHitTest, CPoint pt) { ASSERT_VALID(m_pBar); ASSERT(m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC); m_bDragging = FALSE; InitLoop(); // GetWindowRect returns screen coordinates(not mirrored) // So if the desktop is mirrored then turn off mirroring // for the desktop dc so that we draw correct focus rect if (m_pDC->GetLayout() & LAYOUT_RTL) m_pDC->SetLayout(LAYOUT_LTR); // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; m_nHitTest = nHitTest; CSize size = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH); m_rectRequestedSize = CRect(rect.TopLeft(), size); m_rectActualSize = CRect(rect.TopLeft(), size); m_rectActualFrameSize = CRect(rect.TopLeft(), size); // calculate frame rectangle CMiniFrameWnd::CalcBorders(&m_rectActualFrameSize); m_rectActualFrameSize.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameBorders = CRect(CPoint(0,0), m_rectActualFrameSize.Size() - m_rectActualSize.Size()); // initialize tracking state and enter tracking loop m_dwOverDockStyle = 0; Stretch(pt); // call it here to handle special keys Track(); }
BOOL CCutTrk::OnLButtonDown(POINT Point,UINT Flags,CWnd* pWnd, double Zoom,int UpdateMode) { BOOL Changed = FALSE; int HC = GetHitCode(Point,pWnd,Zoom); if (HC == HC_Outside) { Update(UpdateMode,pWnd,Zoom); Changed = TrackRubberBand(Point,Flags,pWnd,Zoom); if (Changed) Update(UpdateMode,pWnd,Zoom); else SetRect(CRect(0,0,0,0)); Changed = TRUE; } else Changed = Track(Point,Flags,pWnd,Zoom,UpdateMode); return(Changed); }
void CDockContext::StartResize(int nHitTest, CPoint pt) { ASSERT_VALID(m_pBar); ASSERT(m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC); m_bDragging = FALSE; InitLoop(); // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; m_nHitTest = nHitTest; CSize size = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH); m_rectRequestedSize = CRect(rect.TopLeft(), size); m_rectActualSize = CRect(rect.TopLeft(), size); m_rectActualFrameSize = CRect(rect.TopLeft(), size); // calculate frame rectangle #ifdef _MAC CMiniFrameWnd::CalcBorders(&m_rectActualFrameSize, WS_THICKFRAME | WS_CAPTION, WS_EX_FORCESIZEBOX); #else CMiniFrameWnd::CalcBorders(&m_rectActualFrameSize); #endif m_rectActualFrameSize.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameBorders = CRect(CPoint(0,0), m_rectActualFrameSize.Size() - m_rectActualSize.Size()); // initialize tracking state and enter tracking loop m_dwOverDockStyle = 0; Stretch(pt); // call it here to handle special keys Track(); }
int Metadata::compare(const Metadata *other) const { if (m_format == "cast") { int artist_cmp = Artist().toLower().localeAwareCompare( other->Artist().toLower()); if (artist_cmp == 0) return Title().toLower().localeAwareCompare( other->Title().toLower()); return artist_cmp; } else { int track_cmp = Track() - other->Track(); if (track_cmp == 0) return Title().toLower().localeAwareCompare( other->Title().toLower()); return track_cmp; } }
BOOL CMoveTrk::TrackMove(POINT Point,UINT Flags,CWnd* pWnd,double Zoom) { BOOL Changed = FALSE; CRect OldRect(m_Rect); m_DevRect = m_Rect; LogToDev(m_DevRect,pWnd,Zoom); m_Zoom = Zoom; Changed = Track(Point,Flags,pWnd,Zoom,UPDATE_NULL); if (Changed) { CSize Off; Off.cx = m_Rect.left - OldRect.left; Off.cy = m_Rect.top - OldRect.top; POSITION Pos = m_RectList.GetHeadPosition(); while (Pos != NULL) { CRect* pRect = (CRect*)m_RectList.GetNext(Pos); pRect->left = pRect->left + Off.cx; pRect->top = pRect->top + Off.cy; pRect->right = pRect->right + Off.cx; pRect->bottom = pRect->bottom + Off.cy; } } return(Changed); }
std::vector<Event> Event::select(std::string cond, int limit){ DB::Result r = DB::query("SELECT type, source_id, source_name, target_id, target_name, track_id, track_title, message, date AT TIME ZONE 'UTC', id FROM events" + (cond.empty()?"":" WHERE "+cond) + " ORDER BY date DESC" + (limit?" LIMIT "+number(limit):"")); std::vector<Event> events(r.size()); for(unsigned i=0; i<r.size(); i++){ Type t = r[i][0] == "publish" ? Publish : r[i][0] == "comment" ? Comment : r[i][0] == "favorite" ? Favorite : Follow; events[i] = Event(t, User(number(r[i][1]),r[i][2]), User(number(r[i][3]),r[i][4]), Track(number(r[i][5]),r[i][6]), r[i][7], r[i][8], number(r[i][9])); } return events; }
Project::Project(MYSQL* mysql, char* projectID) { //Grab Project Information MYSQL_RES *res; SQLInterface db; string s; s = "SELECT artist, album FROM projects WHERE id = "; s.append(projectID); s = s + " LIMIT 1"; res = db.Query(mysql,s); project_id = atoi(projectID); MYSQL_ROW row; row = mysql_fetch_row(res); artist = row[0]; album = row[1]; mysql_free_result(res); //Get Track names s = "select track_number, track_name from track_listing where project_id = "; s.append(projectID); res = db.Query(mysql,s); if( res != NULL ) { while (row = mysql_fetch_row(res)) { tracks.push_back(Track(artist,album,row[1], atoi(row[0]))); } } mysql_free_result(res); //Get weighted_keywords s = "select keyword, weight from weighted_keywords where project_id = "; s.append(projectID); res = db.Query(mysql,s); if( res != NULL ) { while (row = mysql_fetch_row(res)) { weighted_keywords.push_back(WeightedWords(row[0], atoi(row[1]))); } } mysql_free_result(res); //Get weighted_ex_keywords s = "select keyword, weight from weighted_ex_keywords where project_id = "; s.append(projectID); res = db.Query(mysql,s); if( res != NULL ) { while (row = mysql_fetch_row(res)) { weighted_ex_keywords.push_back(WeightedWords(row[0], atoi(row[1]))); } } mysql_free_result(res); //Get killwords s = "select killword from killwords where project_id = "; s.append(projectID); res = db.Query(mysql,s); if( res != NULL ) { while (row = mysql_fetch_row(res)) { killwords.push_back(WeightedWords(row[0], TRIGGER_WEIGHT)); } } mysql_free_result(res); }
virtual void onSceneLoadToMemory(){ texArrowLeft.loadFromFile("files/textures/isaydisco/arrow_left.png"); texArrowUp.loadFromFile("files/textures/isaydisco/arrow_up.png"); texArrowRight.loadFromFile("files/textures/isaydisco/arrow_right.png"); texArrowDown.loadFromFile("files/textures/isaydisco/arrow_down.png"); vecTracks.resize(1); vecTracks[0] = Track("Da_Funk", "Daft Punk", 112); vecTextures.resize(17); for(int i = 0; i < vecTextures.size(); i++){ vecTextures[i].loadFromFile("files/textures/isaydisco/"+Utils::stringify(i)+".png"); if(i != 16) animDanceAll.addFrame(AnimationFrame(&vecTextures[i], 120*2)); } texIdle.loadFromFile("files/textures/isaydisco/idle.png"); animHands.addFrame(AnimationFrame(&vecTextures[2], 120*2)); animHands.addFrame(AnimationFrame(&vecTextures[8], 120*2)); animHands.addFrame(AnimationFrame(&vecTextures[4], 120*2)); animHands.addFrame(AnimationFrame(&vecTextures[6], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[9], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[10], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[11], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[12], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[9], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[10], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[11], 120*2)); animHips.addFrame(AnimationFrame(&vecTextures[12], 120*2)); animWindmill.addFrame(AnimationFrame(&vecTextures[0], 120*2)); animWindmill.addFrame(AnimationFrame(&vecTextures[8], 120*2)); animWindmill.addFrame(AnimationFrame(&vecTextures[0], 120*2)); animWindmill.addFrame(AnimationFrame(&texIdle, 120*4)); animWindmill.addFrame(AnimationFrame(&vecTextures[6], 120*2)); animWindmill.addFrame(AnimationFrame(&vecTextures[15], 120*2)); animWindmill.addFrame(AnimationFrame(&vecTextures[6], 120*2)); vecTexturesDaftDJ.resize(8); for(int i = 0; i < vecTexturesDaftDJ.size(); i++){ vecTexturesDaftDJ[i].loadFromFile("files/textures/isaydisco/DaftPunk1_DJ"+Utils::stringify(i)+".png"); } vecTexturesDaftGuitar.resize(8); for(int i = 0; i < 4; i++){ vecTexturesDaftGuitar[i].loadFromFile("files/textures/isaydisco/DaftPunk1_GF"+Utils::stringify(i)+".png"); } for(int i = 0; i < 4; i++){ vecTexturesDaftGuitar[i+4].loadFromFile("files/textures/isaydisco/DaftPunk1_GG"+Utils::stringify(i)+".png"); } for(int i = 0; i < 4; i++){ animDJ1.addFrame(AnimationFrame(&vecTexturesDaftDJ[i], 112*2)); animGuitar1.addFrame(AnimationFrame(&vecTexturesDaftGuitar[i], 112*2)); animDJ2.addFrame(AnimationFrame(&vecTexturesDaftDJ[i+4], 112*2)); animGuitar2.addFrame(AnimationFrame(&vecTexturesDaftGuitar[i+4], 112*2)); } vecSteps.resize(4); vecSteps[0] = DanceStep(&animHands, {0,2,4,6}, {HAND_LEFT, HAND_RIGHT, HAND_LEFT, HAND_RIGHT}); vecSteps[1] = DanceStep(&animHips, {0,2,4,6}, {HIPS_LEFT, HIPS_RIGHT, HIPS_LEFT, HIPS_RIGHT}); vecSteps[2] = DanceStep(&animWindmill, {0,2,3,3,4,6}, {HAND_LEFT,HAND_LEFT,LEG_LEFT,LEG_RIGHT,HAND_RIGHT,HAND_RIGHT}); //vecSteps[3] = DanceStep(&animDanceAll, {3, 3}, {HAND_LEFT, HAND_RIGHT}); vecSteps[3] = DanceStep(&animDanceAll, {0, 4, 6, 8, 13, 15}, {HAND_LEFT,LEG_RIGHT,HAND_RIGHT,HAND_LEFT,LEG_RIGHT,HAND_RIGHT}); dbgText.move(100, 0); //martwe pixele ftw dbgText.setFont(Common::Font::Comic_Sans); vecDiscoColors.push_back(sf::Color(255, 255, 255)); vecDiscoColors.push_back(sf::Color(0, 255, 0)); vecDiscoColors.push_back(sf::Color(255, 255, 0)); vecDiscoColors.push_back(sf::Color(0 ,255,255)); //vecDiscoColors.push_back(sf::Color(238,190,67)); vecDiscoReactionsGood.push_back("WOAH!"); vecDiscoReactionsGood.push_back("Superb!"); vecDiscoReactionsGood.push_back("Smooth!"); vecDiscoReactionsGood.push_back("Fantastic!"); vecDiscoReactionsGood.push_back("COMBO x42"); vecDiscoReactionsBad.push_back("Go home, you are drunk"); vecDiscoReactionsBad.push_back("Boooooo"); vecDiscoReactionsBad.push_back("Awful"); vecDiscoReactionsBad.push_back("Absolutely Disgusting"); vecDiscoReactionsBad.push_back("Disgusting"); texBkgrnd.loadFromFile("files/textures/isaydisco/background.png"); background.setTexture(texBkgrnd); background.setScale((float)window->getSize().x/(float)texBkgrnd.getSize().x, (float)window->getSize().y/(float)texBkgrnd.getSize().y); }
Track Sensor::CreateTrack(Unit *target) const { assert(player); return Track(player, target); }
Track Sensor::CreateTrack(Unit *target, const Vector& position) const { assert(player); return Track(player, target, position); }
bool WalkingEngineKick::load(const char* filePath, char* buf) { initialized = false; int lineNumber = 0; bool error = false; for(int i = 0; i < numOfTracks; ++i) { tracks[i].clear(); addPhase(Track(i), 0); } while(*buf) { ++lineNumber; try { while(*buf == ' ' || *buf == '\t') ++buf; if(*buf != '#' && *buf != ';' && *buf != '\r' && *buf != '\n') { String str = readString(buf); if(str == "setType") { String str = readString(buf); if(str == "standing") standKick = true; else if(str == "walking") standKick = false; else throw ParseException("expected 'standing' or 'walking'"); } else if(str == "setPreStepSize") { preStepSizeXValue = readValue(buf); preStepSizeYValue = readValue(buf); preStepSizeZValue = readValue(buf); readValue(buf); readValue(buf); preStepSizeRValue = readValue(buf); } else if(str == "setStepSize") { stepSizeXValue = readValue(buf); stepSizeYValue = readValue(buf); stepSizeZValue = readValue(buf); readValue(buf); readValue(buf); stepSizeRValue = readValue(buf); } else if(str == "setDuration") { durationValue = readValue(buf); } else if(str == "setRefX") { refXValue = readValue(buf); } else if(str == "proceed") { Value* value = readValue(buf); for(int i = 0; i < numOfTracks; ++i) { Phase& lastPhase = tracks[i].back(); if(!lastPhase.lengthValue) lastPhase.lengthValue = value; else lastPhase.lengthValue = new PlusExpression(*lastPhase.lengthValue, *value, *this); } } else if(str == "setLeg") { addPhase(footTranslationX, readValue(buf)); addPhase(footTranslationY, readValue(buf)); addPhase(footTranslationZ, readValue(buf)); addPhase(footRotationX, readValue(buf)); addPhase(footRotationY, readValue(buf)); addPhase(footRotationZ, readValue(buf)); } else if(str == "setArms") { addPhase(lShoulderPitch, readValue(buf)); addPhase(lShoulderRoll, readValue(buf)); addPhase(lElbowYaw, readValue(buf)); addPhase(lElbowRoll, readValue(buf)); addPhase(rShoulderPitch, readValue(buf)); addPhase(rShoulderRoll, readValue(buf)); addPhase(rElbowYaw, readValue(buf)); addPhase(rElbowRoll, readValue(buf)); } else if(str == "setHead") { addPhase(headYaw, readValue(buf)); addPhase(headPitch, readValue(buf)); } else throw ParseException("expected keyword"); while(*buf == ' ' || *buf == '\t') ++buf; } if(*buf == '#' || *buf == ';') { ++buf; while(*buf && *buf != '\r' && *buf != '\n') ++buf; } if(*buf && *buf != '\r' && *buf != '\n') throw ParseException("expected end of line"); } catch(ParseException e) { // OUTPUT(idText, text, filePath << ":" << lineNumber << ": " << e.message); (void)e; error = true; } while(*buf && *buf != '\r' && *buf != '\n') ++buf; if(*buf == '\r' && buf[1] == '\n') buf += 2; else if(*buf) ++buf; } if(error) { for(int i = 0; i < numOfTracks; ++i) tracks[i].clear(); // OUTPUT(idText, text, filePath << ": failed to load file"); return false; } for(int i = 0; i < numOfTracks; ++i) addPhase(Track(i), 0); return true; }
void MusicManager::addTrack(TrackID id, sf::SoundBuffer&& sound) { mTracks.emplace(id, Track(std::move(sound))); }
void CDockContext::StartDrag(CPoint pt) { ASSERT_VALID(m_pBar); m_bDragging = TRUE; InitLoop(); if (m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC) { // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; CSize sizeHorz = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK); CSize sizeVert = m_pBar->CalcDynamicLayout(0, LM_VERTDOCK); CSize sizeFloat = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH); m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz); m_rectDragVert = CRect(rect.TopLeft(), sizeVert); // calculate frame dragging rectangle m_rectFrameDragHorz = CRect(rect.TopLeft(), sizeFloat); m_rectFrameDragVert = CRect(rect.TopLeft(), sizeFloat); #ifdef _MAC CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz, WS_THICKFRAME | WS_CAPTION, WS_EX_FORCESIZEBOX); CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert, WS_THICKFRAME | WS_CAPTION, WS_EX_FORCESIZEBOX); #else CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz); CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert); #endif m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); } else if (m_pBar->m_dwStyle & CBRS_SIZE_FIXED) { // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; CSize sizeHorz = m_pBar->CalcDynamicLayout(-1, LM_HORZ | LM_HORZDOCK); CSize sizeVert = m_pBar->CalcDynamicLayout(-1, LM_VERTDOCK); // calculate frame dragging rectangle m_rectFrameDragHorz = m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz); m_rectFrameDragVert = m_rectDragVert = CRect(rect.TopLeft(), sizeVert); CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz); CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert); m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); } else { // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; BOOL bHorz = HORZF(m_dwStyle); DWORD dwMode = !bHorz ? (LM_HORZ | LM_HORZDOCK) : LM_VERTDOCK; CSize size = m_pBar->CalcDynamicLayout(-1, dwMode); // calculate inverted dragging rect if (bHorz) { m_rectDragHorz = rect; m_rectDragVert = CRect(CPoint(pt.x - rect.Height()/2, rect.top), size); } else // vertical orientation { m_rectDragVert = rect; m_rectDragHorz = CRect(CPoint(rect.left, pt.y - rect.Width()/2), size); } // calculate frame dragging rectangle m_rectFrameDragHorz = m_rectDragHorz; m_rectFrameDragVert = m_rectDragVert; CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz); CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert); m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); } // adjust rectangles so that point is inside AdjustRectangle(m_rectDragHorz, pt); AdjustRectangle(m_rectDragVert, pt); AdjustRectangle(m_rectFrameDragHorz, pt); AdjustRectangle(m_rectFrameDragVert, pt); // initialize tracking state and enter tracking loop m_dwOverDockStyle = CanDock(); Move(pt); // call it here to handle special keys Track(); }
void CDockContext::StartDrag(CPoint pt) { ASSERT_VALID(m_pBar); m_bDragging = TRUE; InitLoop(); // GetWindowRect returns screen coordinates(not mirrored), // so if the desktop is mirrored then turn off mirroring // for the desktop dc so that we get correct focus rect drawn. // This layout change should be remembered, just in case ... if (m_pDC->GetLayout() & LAYOUT_RTL) m_pDC->SetLayout(LAYOUT_LTR); if (m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC) { // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; CSize sizeHorz = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK); CSize sizeVert = m_pBar->CalcDynamicLayout(0, LM_VERTDOCK); CSize sizeFloat = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH); m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz); m_rectDragVert = CRect(rect.TopLeft(), sizeVert); // calculate frame dragging rectangle m_rectFrameDragHorz = CRect(rect.TopLeft(), sizeFloat); m_rectFrameDragVert = CRect(rect.TopLeft(), sizeFloat); CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz); CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert); m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); } else if (m_pBar->m_dwStyle & CBRS_SIZE_FIXED) { // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; CSize sizeHorz = m_pBar->CalcDynamicLayout(-1, LM_HORZ | LM_HORZDOCK); CSize sizeVert = m_pBar->CalcDynamicLayout(-1, LM_VERTDOCK); // calculate frame dragging rectangle m_rectFrameDragHorz = m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz); m_rectFrameDragVert = m_rectDragVert = CRect(rect.TopLeft(), sizeVert); CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz); CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert); m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); } else { // get true bar size (including borders) CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; BOOL bHorz = HORZF(m_dwStyle); DWORD dwMode = !bHorz ? (LM_HORZ | LM_HORZDOCK) : LM_VERTDOCK; CSize size = m_pBar->CalcDynamicLayout(-1, dwMode); // calculate inverted dragging rect if (bHorz) { m_rectDragHorz = rect; m_rectDragVert = CRect(CPoint(pt.x - rect.Height()/2, rect.top), size); } else // vertical orientation { m_rectDragVert = rect; m_rectDragHorz = CRect(CPoint(rect.left, pt.y - rect.Width()/2), size); } // calculate frame dragging rectangle m_rectFrameDragHorz = m_rectDragHorz; m_rectFrameDragVert = m_rectDragVert; CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz); CMiniFrameWnd::CalcBorders(&m_rectFrameDragVert); m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); } // adjust rectangles so that point is inside _AfxAdjustRectangle(m_rectDragHorz, pt); _AfxAdjustRectangle(m_rectDragVert, pt); _AfxAdjustRectangle(m_rectFrameDragHorz, pt); _AfxAdjustRectangle(m_rectFrameDragVert, pt); // initialize tracking state and enter tracking loop m_dwOverDockStyle = CanDock(); Move(pt); // call it here to handle special keys Track(); }
Track ArtistBrowse::tophitTrackAt(int index) const { return isValid() ? Track(sp_artistbrowse_tophit_track(handle(), index)) : Track(); }
// start dragging. This is the only routine exposed externally. // pt = mouse position at start of drag (screen co-ords) void COXDragDockContext::StartDrag(CPoint pt) { ASSERT_VALID(m_pBar); ASSERT(m_pBar->IsKindOf(RUNTIME_CLASS(COXSizeControlBar))); COXSizeControlBar* pSzBar = (COXSizeControlBar*)m_pBar; // get styles from bar m_dwDockStyle = m_pBar->m_dwDockStyle; m_dwStyle = m_pBar->m_dwStyle & CBRS_ALIGN_ANY; ASSERT(m_dwStyle != 0); // check to see we're not hanging from a COXMDIFloatWnd. // Disallow dragging if we are... if (m_pBar->IsFloating()) { CFrameWnd* pFrameWnd = m_pBar->GetParentFrame(); ASSERT(pFrameWnd != NULL); ASSERT(pFrameWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd))); if (pFrameWnd->IsKindOf(RUNTIME_CLASS(COXMDIFloatWnd))) return; // do nothing if floating inside a COXMDIFloatWnd } // dragging has started message (only if window will actually dock !) if ((m_dwDockStyle & CBRS_ALIGN_ANY) == CBRS_ALIGN_ANY) AfxGetMainWnd()->SendMessage(WM_SETMESSAGESTRING, IDS_OX_MRC_STARTDOCKING); // handle pending WM_PAINT messages MSG msg; while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_NOREMOVE)) { if (!GetMessage(&msg, NULL, WM_PAINT, WM_PAINT)) return; ASSERT(msg.message == WM_PAINT); DispatchMessage(&msg); } // initialize drag state m_rectLast.SetRectEmpty(); m_sizeLast.cx = m_sizeLast.cy = 0; m_bForceFrame = m_bFlip = m_bDitherLast = FALSE; // get current bar location CRect rect; m_pBar->GetWindowRect(rect); m_ptLast = pt; m_ptStart = pt; BOOL bHorz = HORZF(m_dwStyle); // MFC includes code for flipping orientation using the shift key - I wasn't keen // on this... (sorry) so I've left it out for now. Some references are still left // in for it, in case I decide to implement it. // Start by working out the possible rectangles that dragging could result in. // These are: // m_rectFrameDragHorz : floating frame, horizontal orientation // m_rectFrameDragVert : floating frame, vertical orientation (not used, 'cos // flipping not allowed) // // m_rectDragHorz : docking horizontally, another bar already on this row // m_rectDragVert : docking vertically, another bar already on this row // m_rectDragHorzAlone : docking horizontally, on a new row // m_rectDragVertAlone : docking vertically, on a new row // calculate dragging rects if you drag on the new row/column // CRect rectBorder; m_pDockSite->RepositionBars(0,0xffff,AFX_IDW_PANE_FIRST, CFrameWnd::reposQuery,&rectBorder); m_pDockSite->ClientToScreen(rectBorder); CWnd* pLeftDockBar=m_pDockSite->GetControlBar(AFX_IDW_DOCKBAR_LEFT); if(pLeftDockBar!=NULL && pLeftDockBar->GetStyle()&WS_VISIBLE) { CRect rectDockBar; pLeftDockBar->GetWindowRect(rectDockBar); rectBorder.left-=rectDockBar.Width(); } CWnd* pRightDockBar=m_pDockSite->GetControlBar(AFX_IDW_DOCKBAR_RIGHT); if(pRightDockBar!=NULL && pRightDockBar->GetStyle()&WS_VISIBLE) { CRect rectDockBar; pRightDockBar->GetWindowRect(rectDockBar); rectBorder.right+=rectDockBar.Width(); } m_rectDragHorzAlone=CRect(CPoint(rectBorder.left,rect.top),rectBorder.Size()); m_rectDragVertAlone=CRect(CPoint(rect.left,rectBorder.top),rectBorder.Size()); m_rectDragHorzAlone.bottom=m_rectDragHorzAlone.top+pSzBar->m_HorzDockSize.cy; m_rectDragVertAlone.right=m_rectDragVertAlone.left+pSzBar->m_VertDockSize.cx; // ////////////////////////////////////////////////////////////// ////////////////// // int nDockAreaWidth = rectBorder.Width(); int nDockAreaHeight = rectBorder.Height(); CSize HorzAloneSize(nDockAreaWidth, pSzBar->m_HorzDockSize.cy); CSize VertAloneSize(pSzBar->m_VertDockSize.cx, nDockAreaHeight); // sizes to use when docking into a row that already has some bars. // use the stored sizes - unless they are > the max dock area - // in which case make a guess. if (pSzBar->m_VertDockSize.cy >= nDockAreaHeight - 16) VertAloneSize.cy = nDockAreaHeight / 3; else VertAloneSize.cy = pSzBar->m_VertDockSize.cy; if (pSzBar->m_HorzDockSize.cx >= nDockAreaWidth - 16) HorzAloneSize.cx = nDockAreaWidth / 3; else HorzAloneSize.cx = pSzBar->m_HorzDockSize.cx; m_rectDragHorz = CRect(rect.TopLeft(), HorzAloneSize); m_rectDragVert = CRect(rect.TopLeft(), VertAloneSize); // /////////////////// // rectangle for the floating frame... m_rectFrameDragVert = m_rectFrameDragHorz = CRect(rect.TopLeft(), pSzBar->m_FloatSize); // To work out the size we actually create a floating mini frame, and then see how big // it is CMiniDockFrameWnd* pFloatFrame = m_pDockSite->CreateFloatingFrame(bHorz ? CBRS_ALIGN_TOP : CBRS_ALIGN_LEFT); if (pFloatFrame == NULL) AfxThrowMemoryException(); pFloatFrame->CalcWindowRect(&m_rectFrameDragHorz); pFloatFrame->CalcWindowRect(&m_rectFrameDragVert); // m_rectFrameDragHorz.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); // m_rectFrameDragVert.InflateRect(-afxData.cxBorder2, -afxData.cyBorder2); pFloatFrame->DestroyWindow(); // adjust rectangles so that point is inside AdjustRectangle(m_rectDragHorzAlone, pt); AdjustRectangle(m_rectDragVertAlone, pt); AdjustRectangle(m_rectDragHorz, pt); AdjustRectangle(m_rectDragVert, pt); AdjustRectangle(m_rectFrameDragHorz, pt); AdjustRectangle(m_rectFrameDragVert, pt); // lock window update while dragging ASSERT(m_pDC == NULL); CWnd* pWnd = CWnd::GetDesktopWindow(); #ifndef _MAC if (pWnd->LockWindowUpdate()) m_pDC = pWnd->GetDCEx(NULL, DCX_WINDOW|DCX_CACHE|DCX_LOCKWINDOWUPDATE); else #endif m_pDC = pWnd->GetDCEx(NULL, DCX_WINDOW|DCX_CACHE); ASSERT(m_pDC != NULL); // initialize tracking state and enter tracking loop m_dwOverDockStyle = CanDock(); Move(pt); // call it here to handle special keys Track(); }
//============================================================================= // eFdd::ReadFdi //----------------------------------------------------------------------------- bool eFdd::ReadFdi(const void* _data, size_t data_size) { const byte* buf = (const byte*)_data; SAFE_DELETE(disk); disk = new eUdi(buf[4], buf[6]); const byte* trk = buf + 0x0E + Word(buf + 0x0C); const byte* dat = buf + Word(buf + 0x0A); for(int i = 0; i < disk->Cyls(); ++i) { for(int j = 0; j < disk->Sides(); ++j) { Seek(i, j); int id_len = Track().data_len / 8 + ((Track().data_len & 7) ? 1 : 0); memset(Track().data, 0, Track().data_len + id_len); int pos = 0; WriteBlock(pos, 0x4e, 80); //gap4a WriteBlock(pos, 0, 12); //sync WriteBlock(pos, 0xc2, 3, true); //iam Write(pos++, 0xfc); const byte* t0 = dat + Dword(trk); int ns = trk[6]; Track().sectors_amount = ns; trk += 7; for(int i = 0; i < ns; ++i) { WriteBlock(pos, 0x4e, 40); //gap1 50 fixme: recalculate gap1 only for non standard formats WriteBlock(pos, 0, 12); //sync WriteBlock(pos, 0xa1, 3, true); //id am Write(pos++, 0xfe); eUdi::eTrack::eSector& sec = Sector(i); sec.id = Track().data + pos; Write(pos++, trk[0]); Write(pos++, trk[1]); Write(pos++, trk[2]); Write(pos++, trk[3]); word crc = Crc(Track().data + pos - 5, 5); Write(pos++, crc >> 8); Write(pos++, (byte)crc); if(trk[4] & 0x40) { sec.data = NULL; } else { const byte* data = t0 + Word(trk+5); if(data + 128 > buf + data_size) return false; WriteBlock(pos, 0x4e, 22); //gap2 WriteBlock(pos, 0, 12); //sync WriteBlock(pos, 0xa1, 3, true); //data am Write(pos++, 0xfb); sec.data = Track().data + pos; int len = sec.Len(); memcpy(sec.data, data, len); crc = Crc(Track().data + pos - 1, len + 1); if(!(trk[4] & (1<<(trk[3] & 3)))) crc ^= 0xffff; pos += len; Write(pos++, crc >> 8); Write(pos++, (byte)crc); } trk += 7; } if(pos > Track().data_len) { assert(0); //track too long } WriteBlock(pos, 0x4e, Track().data_len - pos - 1); //gap3 } } return true; }
//============================================================================= // eFdd::CreateTrd //----------------------------------------------------------------------------- void eFdd::CreateTrd() { SAFE_DELETE(disk); disk = new eUdi(eUdi::MAX_CYL, eUdi::MAX_SIDE); for(int i = 0; i < disk->Cyls(); ++i) { for(int j = 0; j < disk->Sides(); ++j) { Seek(i, j); int id_len = Track().data_len / 8 + ((Track().data_len & 7) ? 1 : 0); memset(Track().data, 0, Track().data_len + id_len); int pos = 0; WriteBlock(pos, 0x4e, 80); //gap4a WriteBlock(pos, 0, 12); //sync WriteBlock(pos, 0xc2, 3, true); //iam Write(pos++, 0xfc); const int max_trd_sectors = 16; static const byte lv[3][max_trd_sectors] = { { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 }, { 1,9,2,10,3,11,4,12,5,13,6,14,7,15,8,16 }, { 1,12,7,2,13,8,3,14,9,4,15,10,5,16,11,6 } }; Track().sectors_amount = max_trd_sectors; for(int i = 0; i < max_trd_sectors; ++i) { WriteBlock(pos, 0x4e, 40); //gap1 50 fixme: recalculate gap1 only for non standard formats WriteBlock(pos, 0, 12); //sync WriteBlock(pos, 0xa1, 3, true); //id am Write(pos++, 0xfe); eUdi::eTrack::eSector& sec = Sector(i); sec.id = Track().data + pos; Write(pos++, cyl); Write(pos++, side); Write(pos++, lv[trdos_interleave][i]); Write(pos++, 1); //256byte word crc = Crc(Track().data + pos - 5, 5); Write(pos++, crc >> 8); Write(pos++, (byte)crc); WriteBlock(pos, 0x4e, 22); //gap2 WriteBlock(pos, 0, 12); //sync WriteBlock(pos, 0xa1, 3, true); //data am Write(pos++, 0xfb); sec.data = Track().data + pos; int len = sec.Len(); crc = Crc(Track().data + pos - 1, len + 1); pos += len; Write(pos++, crc >> 8); Write(pos++, (byte)crc); } if(pos > Track().data_len) { assert(0); //track too long } WriteBlock(pos, 0x4e, Track().data_len - pos - 1); //gap3 } } eUdi::eTrack::eSector* s = GetSector(0, 0, 9); if(!s) return; s->data[0xe2] = 1; // first free track s->data[0xe3] = 0x16; // 80T,DS SectorDataW(s, 0xe5, 2544); // free sec s->data[0xe7] = 0x10; // trdos flag UpdateCRC(s); }
BOOL CFixTrk::OnLButtonDown(POINT Point,UINT Flags,CWnd* pWnd, double Zoom,int UpdateMode) { return( Track(Point,Flags,pWnd,Zoom,UpdateMode) ); }
void ProgressBar::paintEvent( QPaintEvent* e ) { QFrame::paintEvent( e ); QPainter p( this ); StopWatch* sw = ScrobbleService::instance().stopWatch(); if ( m_track != Track() ) { QFont timeFont = font(); timeFont.setPixelSize( 10 ); setFont( timeFont ); p.setPen( QColor( 0x333333 ) ); if ( m_track.extra( "playerId" ) != "spt" ) { if ( m_track.duration() >= 30 ) { QString format( "m:ss" ); QTime duration( 0, 0 ); duration = duration.addMSecs( m_track.duration() * 1000 ); QTime progress( 0, 0 ); progress = progress.addMSecs( m_frame ); if ( duration.hour() > 0 ) format = "h:mm:ss"; QTextOption timeTextOption; timeTextOption.setAlignment( Qt::AlignVCenter | Qt::AlignLeft ); QString timeText; if ( m_track.source() == Track::LastFmRadio ) timeText = QString( "%1 / %2" ).arg( progress.toString( format ), duration.toString( format ) ); else timeText = QString( "%1" ).arg( progress.toString( format ) ); p.setPen( QColor( 0x333333 ) ); p.drawText( rect().adjusted( 6, 0, 0, 0 ), timeText, timeTextOption ); QFontMetrics fm( font() ); int indent = fm.width( timeText ) + ( 2 * 6 ) + 2; int width = this->width() - indent; p.setPen( QColor( 0xbdbdbd )); p.drawLine( QPoint( indent - 2, rect().top() ), QPoint( indent - 2, rect().bottom() - 1 ) ); p.setPen( QColor( 0xe6e6e6 ) ); p.drawLine( QPoint( indent - 1, rect().top() ), QPoint( indent - 1, rect().bottom() - 1 ) ); // draw the chunk p.setPen( Qt::transparent ); p.setBrush( m_chunk ); p.drawRect( rect().adjusted( indent, 0, ((m_frame * width) / (m_track.duration() * 1000)) - width, -1) ); //bool scrobblingOn = unicorn::UserSettings().value( "scrobblingOn", true ).toBool(); bool scrobblingOn = ScrobbleService::instance().scrobblableTrack( m_track ); if ( scrobblingOn || ( !scrobblingOn && (m_track.scrobbleStatus() != Track::Null) ) ) { if ( !scrobblingOn && m_track.scrobbleStatus() != Track::Null ) { QTextOption textOption; textOption.setAlignment( Qt::AlignVCenter | Qt::AlignRight ); p.drawText( rect().adjusted( 0, 0, -6, 0 ), tr( "Scrobbling off" ), textOption ); } uint scrobblePoint = sw->scrobblePoint() * 1000; int scrobbleMarker = indent + (scrobblePoint * width) / ( m_track.duration() * 1000 ); p.setPen( QPen( QColor( 0xbdbdbd ), 1, Qt::DashLine) ); p.drawLine( QPoint( scrobbleMarker - 1, rect().top() ), QPoint( scrobbleMarker - 1, rect().bottom() ) ); p.setPen( QPen( QColor( 0xe6e6e6 ), 1, Qt::DashLine) ); p.drawLine( QPoint( scrobbleMarker, rect().top() ), QPoint( scrobbleMarker, rect().bottom() ) ); // Draw the 'as'! // if the scrobble marker is too close to the left draw the 'as' on the right hand side QPoint asPoint; QImage as( m_track.scrobbleStatus() != Track::Null ? m_scrobbleMarkerOn : m_scrobbleMarkerOff ); if ( ( as.width() + 10 ) > scrobbleMarker - indent ) asPoint = QPoint ( scrobbleMarker + 5 , (rect().height() / 2) - (as.height() / 2) ); else asPoint = QPoint ( scrobbleMarker - as.width() - 5, (rect().height() / 2) - (as.height() / 2) ); p.drawImage( asPoint, as ); } else { QString offMessage = NULL; if ( unicorn::UserSettings().value( "scrobblingOn", true ).toBool() ) { if ( m_track.isVideo() ) offMessage = tr( "Not scrobbling - not a music video" ); else if ( !unicorn::UserSettings().value( "podcasts", true ).toBool() && m_track.isPodcast() ) offMessage = tr( "Not scrobbling - podcasts disabled" ); else if ( m_track.artist().isNull() ) offMessage = tr( "Not scrobbling - missing artist" ); } if(offMessage != NULL) { p.setPen( QColor( 0x333333 ) ); QTextOption textOption; textOption.setAlignment( Qt::AlignVCenter | Qt::AlignRight ); p.drawText( rect().adjusted( 0, 0, -6, 0 ), offMessage, textOption ); } } } else { QTextOption textOption; textOption.setAlignment( Qt::AlignVCenter | Qt::AlignRight ); p.drawText( rect().adjusted( 0, 0, -6, 0 ), tr( "Not scrobbling - track too short" ), textOption ); } } else { QTextOption textOption; textOption.setAlignment( Qt::AlignVCenter | Qt::AlignRight ); p.drawText( rect().adjusted( 0, 0, -6, 0 ), tr("Enable scrobbling in Spotify's preferences!"), textOption ); } } }
FaceTrackFrame FaceTracker::Track( const ColorImageFrame& colorFrame, const DepthImageFrame& depthFrame ) { return Track( colorFrame, depthFrame, 0 ); }
Event Event::comment(const User &tgt, const User &src, std::string msg){ Event e(Comment, src, tgt, Track(), msg); e.push(); return e; }
Track Search::trackAt(int index) const { return isValid() ? Track(sp_search_track(handle(), index)) : Track(); }
int main (int argc, char * const argv[]) { Track (argc, argv); return 0; }
void Weapon::ExecFrame(double seconds) { System::ExecFrame(seconds); if (refire > 0) refire -= (float) seconds; locked = false; centered = false; if (!ship) return; if (orders == POINT_DEFENSE && enabled) SelectTarget(); if (beams && !target) { for (int i = 0; i < nbarrels; i++) { if (beams[i]) { // aim beam straight: Aim(); SetBeamPoints(false); return; } } } if (design->self_aiming) { Track(target, subtarget); } else if (turret) { ZeroAim(); } if (ship->CheckFire()) return; // aim beam at target: bool aim_beams = false; if (beams) { for (int i = 0; i < nbarrels; i++) { if (beams[i]) { aim_beams = true; SetBeamPoints(true); break; } } } if (!aim_beams) { if (ripple_count > 0) { if (Fire()) ripple_count--; } else if (locked && !blocked) { if (!ship->IsHostileTo(target)) return; if (orders == AUTO && centered) { if (energy >= design->charge && (ammo < 0 || target && target->Integrity() >= 1) && objective.length() < design->max_range) Fire(); } else if (orders == POINT_DEFENSE) { if (energy >= design->min_charge && (ammo < 0 || target && target->Integrity() >= 1) && objective.length() < design->max_range) Fire(); } } } }