コード例 #1
0
ファイル: QSelectPanel.cs プロジェクト: usmanatron/quuxplayer
 public void StartItemEdit()
 {
     if (!Locked && Editable && SelectedIndex > 0)
     {
         if (txtEditValue == null)
         {
             txtEditValue          = new TextBox();
             txtEditValue.KeyDown += (s, e) =>
             {
                 if (e.KeyData == Keys.Enter || e.KeyData == Keys.Tab || e.KeyData == Keys.Escape)
                 {
                     e.SuppressKeyPress = true; commitEdit();
                 }
             };
             txtEditValue.Font   = this.font;
             txtEditValue.Enter += (s, e) => { controller.RequestAction(QActionType.KeyPreviewChange); };
             txtEditValue.Leave += (s, e) => { controller.RequestAction(QActionType.KeyPreviewChange); };
         }
         txtEditValue.Font        = font;
         txtEditValue.Bounds      = Cells[SelectedIndex - FirstVisibleItem + 1];
         txtEditValue.BorderStyle = BorderStyle.None;
         txtEditValue.Text        = Values[SelectedIndex];
         this.Controls.Add(txtEditValue);
         txtEditValue.Focus();
     }
 }
コード例 #2
0
 private void click()
 {
     this.close();
     if (frmMiniPlayer.GetInstance() == null)
     {
         controller.RequestAction(QActionType.MakeForeground);
     }
 }
コード例 #3
0
ファイル: Sleep.cs プロジェクト: usmanatron/quuxplayer
 private void tick()
 {
     if (Active)
     {
         if (FadeActive && !fading && DateTime.Now > Fade)
         {
             fading = true;
         }
         if (fading)
         {
             controller.RequestAction(QActionType.VolumeDownForSleep);
         }
         if (DateTime.Now > Alarm)
         {
             doIt();
         }
         nextTick = Clock.DoOnMainThread(tick, getTickDelay());
         controller.RequestAction(QActionType.SetMainFormTitle);
     }
 }
コード例 #4
0
ファイル: FilterBar.cs プロジェクト: usmanatron/quuxplayer
        private void filterSelected(FilterButton FilterButton)
        {
            RemoveFilterIndex();

            if (!FilterButton.Equals(currentFilter))
            {
                currentFilter = FilterButton;

                foreach (KeyValuePair <FilterType, FilterButton> kvp in filterButtons)
                {
                    if (kvp.Key != FilterButton.FilterType)
                    {
                        kvp.Value.Selected = false;
                    }
                }

                if (AllowEvents)
                {
                    controller.RequestAction(QActionType.LoadFilterValues);
                }

                arrangeControls();
            }
        }
コード例 #5
0
        protected override void OnVisibleChanged(EventArgs e)
        {
            if (this.Visible)
            {
                this.SplitterDistance = Setting.SplitterDistance;
            }

            base.OnVisibleChanged(e);
            Controller c = Controller.GetInstance();

            if (c != null)
            {
                c.RequestAction(QActionType.KeyPreviewChange);
            }

            if (this.Visible)
            {
                stationPanel.Focus();
            }
        }
コード例 #6
0
ファイル: NormalView.cs プロジェクト: usmanatron/quuxplayer
        public NormalView(frmMain MainForm)
        {
            this.mainForm = MainForm;
            instance      = this;

            this.trackList       = new TrackList(this);
            this.filterValueList = new FilterValueList();
            this.filterBar       = new FilterBar();
            this.artwork         = new Artwork();

            this.splMain = new QSplitContainer();

            this.splMain.Panel1.Controls.Add(filterValueList);
            this.splMain.Panel2.Controls.Add(trackList);
            this.Controls.Add(splMain);
            this.Controls.Add(filterBar);

            splMain.Resize         += (s, e) => { arrangeSplitterControls(); };
            splMain.SplitterMoved  += (s, e) => { arrangeSplitterControls(); };
            splMain.VisibleChanged += (s, e) =>
            {
                if (splMain.Visible)
                {
                    splMain.SplitterDistance = Setting.SplitterDistance;
                }
            };

            this.artwork = Artwork;

            splMain.Panel1.Controls.Add(artwork);

            filterBar.FilterReleased     += filterBarFilterCleared;
            filterBar.FilterValueChanged += filterBarFilterValueChanged;

            filterValueList.FilterValueSelected += new FilterValueList.FilterValueSelect(filterValueChanged);
            filterValueList.ValueChanged        += (oldVal, newVal) => { changePlaylistName(oldVal, newVal); };

            arrangeSplitterControls();
            splMain.Panel1.Paint += new PaintEventHandler(Panel1_Paint);
            artwork.Click        += (s, e) => { controller.RequestAction(QActionType.FindPlayingTrack); };
        }
コード例 #7
0
        private static void sendTracks()
        {
            try
            {
                lock (@lock)
                {
                    int numTracks = newTracks.Count;

                    List <Track> tracks = newTracks.Take(numTracks).ToList();
                    newTracks.RemoveRange(0, numTracks);

                    Controller c = Controller.GetInstance();

                    c.AddToLibrarySilent(tracks, false);
                    c.RequestAction(QActionType.UpdateTrackCount);

                    addTracksAlarm = Clock.NULL_ALARM;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.ToString());
            }
        }
コード例 #8
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            Item i;

            lock (@lock)
            {
                i = Item.ItemAt(e.Location);
            }
            Controller c = Controller.GetInstance();

            if (i == null)
            {
                c.RequestAction(QActionType.AdvanceScreen);
            }
            else
            {
                switch (this.ViewMode)
                {
                case ViewModeEnum.Artist:

                    if ((e.Button == MouseButtons.Right) || (i.Count < 2) || (Database.FindAllTracks(t => t.MainGroup == i.Text && t.Album.Length > 0).GroupBy(t => t.Album).Count() < 2))
                    {
                        c.RequestAction(new QAction(QActionType.ShowAllOfArtist, i.Text));
                    }
                    else
                    {
                        this.ViewMode = ViewModeEnum.Album;
                        currentArtist = i.Text;
                        setupItems();
                    }
                    break;

                case ViewModeEnum.Album:
                    c.RequestAction(new QAction(QActionType.ShowAllOfAlbum, i.Text, currentArtist));
                    break;

                case ViewModeEnum.Genre:

                    if (e.Button == MouseButtons.Right)
                    {
                        c.RequestAction(new QAction(QActionType.ShowAllOfGenre, i.Text));
                    }
                    else
                    {
                        this.ViewMode = ViewModeEnum.Artist;

                        currentGrouping = String.Empty;
                        currentGenre    = i.Text;

                        setupItems();
                    }
                    break;

                case ViewModeEnum.Grouping:

                    if (e.Button == MouseButtons.Right)
                    {
                        c.RequestAction(new QAction(QActionType.ShowAllOfGrouping, i.Text));
                    }
                    else
                    {
                        this.ViewMode = ViewModeEnum.Artist;

                        currentGrouping = i.Text;
                        currentGenre    = String.Empty;

                        setupItems();
                    }
                    break;
                }
            }
        }
コード例 #9
0
 private void btnLink_ButtonPressed(QButton Button)
 {
     controller.RequestAction(new QAction(QActionType.PlayThisAlbum, CurrentTrack));
 }
コード例 #10
0
ファイル: frmMain.cs プロジェクト: usmanatron/quuxplayer
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (KeyPreview && !normal.HasPanel)
            {
                switch (keyData)
                {
                case KeyDefs.MoveDown:
                    controller.RequestAction(QActionType.MoveDown);
                    return(true);

                case KeyDefs.MoveUp:
                    controller.RequestAction(QActionType.MoveUp);
                    return(true);

                case KeyDefs.MoveLeft:
                    controller.RequestAction(QActionType.MoveLeft);
                    return(true);

                case KeyDefs.MoveRight:
                    controller.RequestAction(QActionType.MoveRight);
                    return(true);

                case Keys.Control | KeyDefs.MoveUp:
                    if (normal.NondynamicPlaylistBasedView)
                    {
                        if (!Locked)
                        {
                            controller.RequestAction(QActionType.MoveTracksUp);
                        }
                    }
                    else
                    {
                        controller.RequestAction(QActionType.MoveUp);
                    }
                    return(true);

                case Keys.Control | KeyDefs.MoveDown:
                    if (normal.NondynamicPlaylistBasedView)
                    {
                        if (!Locked)
                        {
                            controller.RequestAction(QActionType.MoveTracksDown);
                        }
                    }
                    else
                    {
                        controller.RequestAction(QActionType.MoveDown);
                    }
                    return(true);

                case Keys.Shift | KeyDefs.MoveDown:
                    normal.MoveDown(1, true);
                    return(true);

                case Keys.Shift | KeyDefs.MoveUp:
                    normal.MoveUp(1, true);
                    return(true);

                case Keys.Alt | KeyDefs.MoveDown:
                    controller.RequestAction(QActionType.VolumeDown);
                    return(true);

                case Keys.Alt | KeyDefs.MoveUp:
                    controller.RequestAction(QActionType.VolumeUp);
                    return(true);

                case KeyDefs.Rename:
                    if (!Locked)
                    {
                        switch (controller.CurrentView)
                        {
                        case ViewType.Normal:
                            controller.RequestAction(QActionType.RenameSelectedPlaylist);
                            break;

                        case ViewType.Radio:
                            controller.RequestAction(QActionType.RenameSelectedRadioGenre);
                            break;
                        }
                    }
                    return(true);

                default:
                    return(base.ProcessCmdKey(ref msg, keyData));
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #11
0
ファイル: KeyboardHook.cs プロジェクト: usmanatron/quuxplayer
        private IntPtr HookCallback(int nCode, IntPtr wParam, ref KBDLLHOOKSTRUCT lParam)
        {
            if (nCode < 0)
            {
                return(CallNextHookEx(hookID, nCode, wParam, ref lParam));
            }

            bool doAction = (wParam == (IntPtr)WM_KEYUP);
            bool done     = false;

            action      = QActionType.None;
            popupAction = frmGlobalInfoBox.ActionType.None;

            switch (lParam.vkCode)
            {
            case 160:
            case 161:
                controller.NotifyShift();
                break;

            case VK_MEDIA_NEXT_TRACK:
                if (doAction)
                {
                    action      = QActionType.Next;
                    popupAction = frmGlobalInfoBox.ActionType.Next;
                }
                done = true;
                break;

            case VK_MEDIA_PREV_TRACK:
                if (doAction)
                {
                    action      = QActionType.Previous;
                    popupAction = frmGlobalInfoBox.ActionType.Previous;
                }
                done = true;
                break;

            case VK_MEDIA_STOP:
                if (doAction)
                {
                    action      = QActionType.Stop;
                    popupAction = frmGlobalInfoBox.ActionType.Stop;
                }
                done = true;
                break;

            case VK_MEDIA_PLAY_PAUSE:
                if (doAction)
                {
                    action      = QActionType.PlayPause;
                    popupAction = frmGlobalInfoBox.ActionType.PlayPause;
                }
                done = true;
                break;

            case VK_VOLUME_UP:
                if (doAction && controller.LocalVolumeControl && controller.Playing)
                {
                    action      = QActionType.VolumeUp;
                    popupAction = frmGlobalInfoBox.ActionType.VolumeUp;
                    done        = true;
                }
                break;

            case VK_VOLUME_DOWN:
                if (doAction && controller.LocalVolumeControl && controller.Playing)
                {
                    action      = QActionType.VolumeDown;
                    popupAction = frmGlobalInfoBox.ActionType.VolumeDown;
                    done        = true;
                }
                break;

            default:
                doAction = false;
                break;
            }

            if (action != QActionType.None)
            {
                controller.RequestAction(action);
            }
            if (popupAction != frmGlobalInfoBox.ActionType.None)
            {
                frmGlobalInfoBox.Show(controller, popupAction);
            }

            if (done)
            {
                return((IntPtr)1);
            }
            else
            {
                return(CallNextHookEx(hookID, nCode, wParam, ref lParam));
            }
        }
コード例 #12
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            mouseDown    = true;
            lastPoint    = e.Location;
            initialPoint = this.Location;

            volUpMouseDown   = false;
            volDownMouseDown = false;
            if (volUpRect.Contains(e.Location))
            {
                volUpMouseDown = true;
                controller.RequestAction(QActionType.VolumeUpLarge);
                Clock.Update(ref volChangeTimer, repeatVolChange, VOL_ADJUST_RATE, false);
            }
            else if (volDownRect.Contains(e.Location))
            {
                volDownMouseDown = true;
                controller.RequestAction(QActionType.VolumeDownLarge);
                Clock.Update(ref volChangeTimer, repeatVolChange, VOL_ADJUST_RATE, false);
            }
        }
コード例 #13
0
        private void setup()
        {
            streamRef = 0;

            controller.RequestAction(QActionType.Resumed);

            int maxLoops = 4;

            for (int i = 0; (i < maxLoops) && (streamRef == 0); i++)
            {
                streamRef = Bass.BASS_StreamCreateURL(station.URL, 0, BASSFlag.BASS_STREAM_STATUS | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT, myStreamCreateURL, IntPtr.Zero);

                if (closing)
                {
                    controller.RequestAction(QActionType.Stop);
                    return;
                }

                if (streamRef == 0)
                {
                    isWMA     = true;
                    streamRef = BassWma.BASS_WMA_StreamCreateURL(station.URL, 0, 0, BASSFlag.BASS_STREAM_STATUS | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT);
                }

                if (closing)
                {
                    controller.RequestAction(QActionType.Stop);
                    return;
                }

                if (streamRef == 0 && i < maxLoops - 1)
                {
                    System.Threading.Thread.Sleep(500);
                }
            }

            if (streamRef == 0)
            {
                Radio.PlayingStation = null;
                controller.RequestAction(QActionType.RadioFailed);
                return;
            }

            setupChannelFromStream();

            if (Frequency != presumedFreq)
            {
                frequencyMismatchDelegate();
            }

            syncEvent = new SYNCPROC(MetaSync);
            Bass.BASS_ChannelSetSync(streamRef, BASSSync.BASS_SYNC_META, 0, syncEvent, IntPtr.Zero);
            Bass.BASS_ChannelSetSync(streamRef, BASSSync.BASS_SYNC_WMA_CHANGE, 0, syncEvent, IntPtr.Zero);

            myStreamCreateURL = new DOWNLOADPROC(MyDownloadProc);

            try
            {
                // might throw up on certains chars
                tagInfo = new TAG_INFO(station.URL);
            }
            catch
            {
            }

            prebuffer();

            buffered = true;

            Radio.PlayingStation  = station;
            controller.RadioTrack = null;

            readStreamTags();

            if (station.StreamType == StationStreamType.None)
            {
                setStationStreamType();
            }

            controller.RequestAction(QActionType.RadioStreamStarted);
        }
コード例 #14
0
 protected override void ok()
 {
     controller.RequestAction(QActionType.ReleaseFullScreenAuto);
     Lib.Run(Lib.ProgramPath("license.rtf"));
 }
コード例 #15
0
ファイル: Player.cs プロジェクト: usmanatron/quuxplayer
        public bool Play(Track Track)
        {
            while (output == null)
            {
                Lib.DoEvents(); // don't delete; could prevent a race condition w/ output startup
                System.Threading.Thread.Sleep(100);
            }

            if (Track == null)
            {
                return(false);
            }
            else
            {
                if (playMode == PlayMode.Playing || playMode == PlayMode.Paused)
                {
                    NextTrack        = Track;
                    playNextTrackNow = true;
                    if (output.Paused)
                    {
                        Resume();
                    }
                }
                else
                {
                    if (!startFileStream(Track))
                    {
                        killAudioStream();

                        controller.RequestAction(new QAction(QActionType.TrackFailed, Track));

                        return(false);
                    }

                    if (output.Paused)
                    {
                        output.Resume();
                    }

                    playMode = PlayMode.Playing;

                    controller.RequestAction(QActionType.StartOfTrack);
                }
            }
            return(true);
        }
コード例 #16
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (!Locked)
            {
                Point p = new Point(e.X - controlPanelLeft, e.Y);

                if (volumeDragging)
                {
                    userSetVolume(getVolumeFromPosn(p.X - volumeRectangle.Left - volumeDragStartXOffset));
                    volumeDragging = false;
                }
                else
                {
                    if (nowPlayingRectangle.Contains(p))
                    {
                        controller.RequestAction(QActionType.ViewNowPlaying);
                    }
                    else if (radioRectangle.Contains(p))
                    {
                        controller.RequestAction(QActionType.ToggleRadioMode);
                    }
                    else if (advanceRectangle.Contains(p))
                    {
                        controller.RequestAction(QActionType.AdvanceScreen);
                    }
                    else if (stopRectangle.Contains(p))
                    {
                        if (!stopped)
                        {
                            controller.RequestAction(QActionType.Stop);
                        }
                    }
                    else if (playRectangle.Contains(p))
                    {
                        if (stopped)
                        {
                            controller.RequestAction(QActionType.Play);
                        }
                        else
                        {
                            controller.RequestAction(QActionType.Pause);
                        }
                    }
                    else if (fwdRectangle.Contains(p))
                    {
                        if (!stopped)
                        {
                            controller.RequestAction(QActionType.Next);
                        }
                    }
                    else if (backRectangle.Contains(p))
                    {
                        if (!stopped)
                        {
                            controller.RequestAction(QActionType.Previous);
                        }
                    }
                    else if (muteRectangle.Contains(p))
                    {
                        controller.RequestAction(QActionType.Mute);
                    }
                    else if (shuffleRectangle.Contains(p))
                    {
                        controller.RequestAction(QActionType.Shuffle);
                    }
                    else if (repeatRectangle.Contains(p))
                    {
                        controller.RequestAction(QActionType.RepeatToggle);
                    }
                    else if (volumeRectangle.Contains(p))
                    {
                        userSetVolume(getVolumeFromPosn(p.X - 6 - volumeRectangle.Left));
                        controller.RequestAction(QActionType.SetVolume);
                    }
                }
            }
            base.OnMouseUp(e);
        }